MOBILE-2478 desktop: Clear inappbrowser session on SSO

main
Dani Palou 2018-07-19 09:29:22 +02:00
parent 3a48f5d4a6
commit 6e026bd813
1 changed files with 14 additions and 1 deletions

View File

@ -43,7 +43,17 @@ export class InAppBrowserObjectMock {
let width = 800,
height = 600,
display;
const bwOptions: any = {};
const bwOptions: any = {
webPreferences: {}
};
try {
// Create a separate session for inappbrowser so we can clear its data without affecting the app.
bwOptions.webPreferences.session = require('electron').remote.session.fromPartition('inappbrowsersession');
} catch (ex) {
// Ignore errors.
}
if (screen) {
display = this.screen.getPrimaryDisplay();
@ -65,6 +75,9 @@ export class InAppBrowserObjectMock {
if (options.indexOf('fullscreen=yes') != -1) {
bwOptions.fullscreen = true;
}
if (options.indexOf('clearsessioncache=yes') != -1 && bwOptions.webPreferences.session) {
bwOptions.webPreferences.session.clearStorageData({storages: 'cookies'});
}
this.window = new this.browserWindow(bwOptions);
this.window.loadURL(url);