Explicitly initialize session before webContents
authorCheng Zhao <zcbenz@gmail.com>
Wed, 1 Jun 2016 05:57:35 +0000 (14:57 +0900)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 1 Jun 2016 05:57:35 +0000 (14:57 +0900)
lib/browser/api/app.js
lib/browser/api/web-contents.js

index f8a531626bf75cde6ce07e1c6bd930eba41fdb7c..09835a792e0ecd965fdd30838487e16b2fd0fd2b 100644 (file)
@@ -1,6 +1,7 @@
 'use strict'
 
-const {deprecate, Menu, session} = require('electron')
+const electron = require('electron')
+const {deprecate, Menu} = electron
 const {EventEmitter} = require('events')
 
 const bindings = process.atomBinding('app')
@@ -49,7 +50,7 @@ app.allowNTLMCredentialsForAllDomains = function (allow) {
   if (!this.isReady()) {
     this.commandLine.appendSwitch('auth-server-whitelist', domains)
   } else {
-    session.defaultSession.allowNTLMCredentialsForDomains(domains)
+    electron.session.defaultSession.allowNTLMCredentialsForDomains(domains)
   }
 }
 
index cb8cf41e3aa6e5e2987bb98ad0905afe322a20f3..059f204e1ee7ed6a2a40ca8fb7837002399b7c5c 100644 (file)
@@ -1,7 +1,11 @@
 'use strict'
 
 const {EventEmitter} = require('events')
-const {ipcMain, Menu, NavigationController} = require('electron')
+const {ipcMain, session, Menu, NavigationController} = require('electron')
+
+// session is not used here, the purpose is to make sure session is initalized
+// before the webContents module.
+session
 
 const binding = process.atomBinding('web_contents')
 const debuggerBinding = process.atomBinding('debugger')