Expand set of blocked URI schemes

This commit is contained in:
Scott Nonnenberg 2018-05-23 16:02:33 -07:00
parent 3a1d64b19d
commit 53a471b2b1

View file

@ -41,15 +41,26 @@ function installFileHandler({ protocol, userDataPath, installPath }) {
);
}
// Turn off all browser web requests since we do all web requests via Node.js
function _webHandler(request, callback) {
// Turn off browser URI scheme since we do all network requests via Node.js
function _disabledHandler(request, callback) {
return callback();
}
function installWebHandler({ protocol }) {
protocol.interceptFileProtocol('http', _webHandler);
protocol.interceptFileProtocol('https', _webHandler);
protocol.interceptFileProtocol('ftp', _webHandler);
protocol.interceptFileProtocol('about', _disabledHandler);
protocol.interceptFileProtocol('content', _disabledHandler);
protocol.interceptFileProtocol('chrome', _disabledHandler);
protocol.interceptFileProtocol('cid', _disabledHandler);
protocol.interceptFileProtocol('data', _disabledHandler);
protocol.interceptFileProtocol('filesystem', _disabledHandler);
protocol.interceptFileProtocol('ftp', _disabledHandler);
protocol.interceptFileProtocol('gopher', _disabledHandler);
protocol.interceptFileProtocol('http', _disabledHandler);
protocol.interceptFileProtocol('https', _disabledHandler);
protocol.interceptFileProtocol('javascript', _disabledHandler);
protocol.interceptFileProtocol('mailto', _disabledHandler);
protocol.interceptFileProtocol('ws', _disabledHandler);
protocol.interceptFileProtocol('wss', _disabledHandler);
}
module.exports = {