MOBILE-2915 desktop: Fix password change opened only once

main
Dani Palou 2019-04-25 10:44:23 +02:00
parent daa34a7caa
commit 9181455ffd
1 changed files with 25 additions and 18 deletions

View File

@ -224,31 +224,38 @@ export class InAppBrowserObjectMock {
} }
}; };
switch (name) { if (!this.window.isDestroyed() && !this.window.webContents.isDestroyed()) {
case 'loadstart': switch (name) {
this.window.webContents.on('did-start-loading', received); case 'loadstart':
this.window.webContents.on('did-start-loading', received);
if (this.isSSO) { if (this.isSSO) {
// Linux doesn't support custom URL Schemes. Check if launch page is loaded. // Linux doesn't support custom URL Schemes. Check if launch page is loaded.
this.window.webContents.on('did-finish-load', finishLoad); this.window.webContents.on('did-finish-load', finishLoad);
} }
break; break;
case 'loadstop': case 'loadstop':
this.window.webContents.on('did-finish-load', received); this.window.webContents.on('did-finish-load', received);
break; break;
case 'loaderror': case 'loaderror':
this.window.webContents.on('did-fail-load', received); this.window.webContents.on('did-fail-load', received);
break; break;
case 'exit': case 'exit':
this.window.on('close', received); this.window.on('close', received);
break; break;
default: default:
}
} }
return (): void => { return (): void => {
// Unsubscribing. We need to remove the listeners. // Unsubscribing. We need to remove the listeners.
if (this.window.isDestroyed() || this.window.webContents.isDestroyed()) {
// Page has been destroyed already, no need to remove listeners.
return;
}
switch (name) { switch (name) {
case 'loadstart': case 'loadstart':
this.window.webContents.removeListener('did-start-loading', received); this.window.webContents.removeListener('did-start-loading', received);