|
@@ -2,22 +2,7 @@
|
|
|
|
|
|
const { EventEmitter } = require('events')
|
|
|
const { app, deprecate } = require('electron')
|
|
|
-const { Session, Cookies } = process.atomBinding('session')
|
|
|
-const realFromPartition = process.atomBinding('session').fromPartition
|
|
|
-
|
|
|
-const wrappedSymbol = Symbol('wrapped-deprecate')
|
|
|
-const fromPartition = (partition) => {
|
|
|
- const session = realFromPartition(partition)
|
|
|
- if (!session[wrappedSymbol]) {
|
|
|
- session[wrappedSymbol] = true
|
|
|
- const { cookies } = session
|
|
|
- cookies.flushStore = deprecate.promisify(cookies.flushStore)
|
|
|
- cookies.get = deprecate.promisify(cookies.get)
|
|
|
- cookies.remove = deprecate.promisify(cookies.remove)
|
|
|
- cookies.set = deprecate.promisify(cookies.set)
|
|
|
- }
|
|
|
- return session
|
|
|
-}
|
|
|
+const { fromPartition, Session, Cookies, Protocol } = process.atomBinding('session')
|
|
|
|
|
|
// Public API.
|
|
|
Object.defineProperties(exports, {
|
|
@@ -35,6 +20,12 @@ Object.setPrototypeOf(Session.prototype, EventEmitter.prototype)
|
|
|
Object.setPrototypeOf(Cookies.prototype, EventEmitter.prototype)
|
|
|
|
|
|
Session.prototype._init = function () {
|
|
|
- this.protocol.isProtocolHandled = deprecate.promisify(this.protocol.isProtocolHandled)
|
|
|
app.emit('session-created', this)
|
|
|
}
|
|
|
+
|
|
|
+Cookies.prototype.flushStore = deprecate.promisify(Cookies.prototype.flushStore)
|
|
|
+Cookies.prototype.get = deprecate.promisify(Cookies.prototype.get)
|
|
|
+Cookies.prototype.remove = deprecate.promisify(Cookies.prototype.remove)
|
|
|
+Cookies.prototype.set = deprecate.promisify(Cookies.prototype.set)
|
|
|
+
|
|
|
+Protocol.prototype.isProtocolHandled = deprecate.promisify(Protocol.prototype.isProtocolHandled)
|