needShowTimer() { return true; }
onDidFinishLoad() { }
profileName() { return 'common' }
+ certificateError(error: string) { return false; }
+ setInitValue(appControl: any) { }
}
backgroundExecutionMetaData: string = 'false';
inspectorSrc: string = '';
isAlwaysReload: boolean = false;
+ initBundleValue: string = 'none';
preloadStatus: string = 'none';
runningStatus: string = 'none';
launchMode: string = 'none';
return true;
}
+ certificateError(error: string) {
+ console.log(`certificateError = ${error}, isColdAppBoot = ${this.initBundleValue}`);
+ if (error === 'net::ERR_CERT_DATE_INVALID' && this.initBundleValue === 'cold_appboot') {
+ return true;
+ }
+ return false;
+ }
+
+ setInitValue(appControl: any) {
+ let initValue = appControl.getData('init');
+ this.initBundleValue = initValue;
+ console.log(`initBundleValue = ${this.initBundleValue}`);
+ }
+
profileName() {
return 'TV';
}
app.on('certificate-error', (event: any, webContents: any, url: string, error: string, certificate: any, callback: any) => {
console.log('A certificate error has occurred');
event.preventDefault();
+ if (this.profileDelegate.certificateError(error)) {
+ console.log('App will quit!');
+ setTimeout(() => {
+ app.quit();
+ }, 0);
+ return;
+ }
+
if (certificate.data) {
const id = ++this.pendingID;
console.log(`Raising a certificate error response with id: ${id}`);
}
loadUrl(appControl: NativeWRTjs.AppControl) {
+ this.profileDelegate.setInitValue(appControl);
this.contentSrc = appControl.getLoadInfo().getSrc();
if (this.earlyLoadedUrl === this.contentSrc)
return;