Revert "protocol: respect requests from partition"

This reverts commit 85800256de.
This commit is contained in:
Cheng Zhao 2016-02-24 13:25:30 +08:00
parent bb1e4c2208
commit 8ff30a2abc
7 changed files with 49 additions and 105 deletions

View file

@ -3,7 +3,6 @@ const http = require('http');
const path = require('path');
const qs = require('querystring');
const remote = require('electron').remote;
const BrowserWindow = remote.require('electron').BrowserWindow;
const protocol = remote.require('electron').protocol;
describe('protocol module', function() {
@ -815,54 +814,4 @@ describe('protocol module', function() {
});
});
});
describe('protocol.fromPartition', function() {
var partitionName = 'temp';
var tempProtocol = protocol.fromPartition(partitionName);
var w = null;
beforeEach(function() {
if (w != null) {
w.destroy();
}
w = new BrowserWindow({
show: false,
width: 400,
height: 400,
webPreferences: {
partition: partitionName
}
});
});
afterEach(function() {
if (w != null) {
w.destroy();
}
w = null;
});
it('handles requests from a partition', function(done) {
var handler = function(error, callback) {
callback({
data: text
});
};
tempProtocol.registerStringProtocol(protocolName, handler, function(error) {
if (error) {
return done(error);
}
protocol.isProtocolHandled(protocolName, function(result) {
assert.equal(result, false);
});
tempProtocol.isProtocolHandled(protocolName, function(result) {
assert.equal(result, true);
});
});
w.webContents.on('did-finish-load', function() {
done();
});
w.loadURL(protocolName + "://fake-host");
});
});
});