move session wrapper to webcontents
This commit is contained in:
parent
609f5dcaaf
commit
14661819c2
3 changed files with 7 additions and 11 deletions
|
@ -3,9 +3,6 @@
|
||||||
const {Menu} = require('electron')
|
const {Menu} = require('electron')
|
||||||
const EventEmitter = require('events').EventEmitter
|
const EventEmitter = require('events').EventEmitter
|
||||||
|
|
||||||
// Initialize session
|
|
||||||
require('electron').session
|
|
||||||
|
|
||||||
const bindings = process.atomBinding('app')
|
const bindings = process.atomBinding('app')
|
||||||
const downloadItemBindings = process.atomBinding('download_item')
|
const downloadItemBindings = process.atomBinding('download_item')
|
||||||
const app = bindings.app
|
const app = bindings.app
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
const EventEmitter = require('events').EventEmitter
|
|
||||||
const bindings = process.atomBinding('session')
|
const bindings = process.atomBinding('session')
|
||||||
const PERSIST_PREFIX = 'persist:'
|
const PERSIST_PREFIX = 'persist:'
|
||||||
|
|
||||||
|
@ -24,10 +23,3 @@ Object.defineProperty(exports, 'defaultSession', {
|
||||||
return bindings.fromPartition('', false)
|
return bindings.fromPartition('', false)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
var wrapSession = function (session) {
|
|
||||||
// session is an EventEmitter.
|
|
||||||
Object.setPrototypeOf(session, EventEmitter.prototype)
|
|
||||||
}
|
|
||||||
|
|
||||||
bindings._setWrapSession(wrapSession)
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ const Menu = require('electron').Menu
|
||||||
|
|
||||||
const binding = process.atomBinding('web_contents')
|
const binding = process.atomBinding('web_contents')
|
||||||
const debuggerBinding = process.atomBinding('debugger')
|
const debuggerBinding = process.atomBinding('debugger')
|
||||||
|
const sessionBinding = process.atomBinding('session')
|
||||||
|
|
||||||
let nextId = 0
|
let nextId = 0
|
||||||
|
|
||||||
|
@ -211,8 +212,14 @@ let wrapDebugger = function (webContentsDebugger) {
|
||||||
Object.setPrototypeOf(webContentsDebugger, EventEmitter.prototype)
|
Object.setPrototypeOf(webContentsDebugger, EventEmitter.prototype)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var wrapSession = function (session) {
|
||||||
|
// session is an EventEmitter.
|
||||||
|
Object.setPrototypeOf(session, EventEmitter.prototype)
|
||||||
|
}
|
||||||
|
|
||||||
binding._setWrapWebContents(wrapWebContents)
|
binding._setWrapWebContents(wrapWebContents)
|
||||||
debuggerBinding._setWrapDebugger(wrapDebugger)
|
debuggerBinding._setWrapDebugger(wrapDebugger)
|
||||||
|
sessionBinding._setWrapSession(wrapSession)
|
||||||
|
|
||||||
module.exports.create = function (options) {
|
module.exports.create = function (options) {
|
||||||
if (options == null) {
|
if (options == null) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue