protocol: respect requests from partition

This commit is contained in:
Robo 2016-02-19 19:39:01 +05:30
parent 54a7eefa28
commit 85800256de
7 changed files with 105 additions and 49 deletions

View file

@ -4,7 +4,10 @@ if (!app.isReady()) {
throw new Error('Can not initialize protocol module before app is ready');
}
const protocol = process.atomBinding('protocol').protocol;
const session = require('electron').session;
// Returns the protocol property for default session.
const protocol = session.defaultSession.protocol;
// Warn about removed APIs.
var logAndThrow = function(callback, message) {
@ -16,6 +19,10 @@ var logAndThrow = function(callback, message) {
}
};
protocol.fromPartition = function(partition) {
return session.fromPartition(partition).protocol;
};
protocol.registerProtocol = function(scheme, handler, callback) {
return logAndThrow(callback, 'registerProtocol API has been replaced by the register[File/Http/Buffer/String]Protocol API family, please switch to the new APIs.');
};