this fixes #234 + other fixes imported from uBlock

pull/2/head
gorhill 10 years ago
parent 9f51e49725
commit bbfef4f6cf

@ -71,6 +71,7 @@
"browsingData",
"contentSettings",
"cookies",
"privacy",
"storage",
"tabs",
"unlimitedStorage",

@ -42,6 +42,27 @@ var noopFunc = function(){};
/******************************************************************************/
// https://github.com/gorhill/uMatrix/issues/234
// https://developer.chrome.com/extensions/privacy#property-network
chrome.privacy.network.networkPredictionEnabled.set({
value: false
});
// rhill 2013-12-07:
// Tell Chromium to allow all javascript: µMatrix will control whether
// javascript execute through `Content-Policy-Directive` and webRequest.
// https://github.com/gorhill/httpswitchboard/issues/74
chrome.contentSettings.javascript.set({
primaryPattern: 'https://*/*',
setting: 'allow'
});
chrome.contentSettings.javascript.set({
primaryPattern: 'http://*/*',
setting: 'allow'
});
/******************************************************************************/
vAPI.app = {
name: manifest.name,
version: manifest.version
@ -680,20 +701,6 @@ vAPI.net.registerListeners = function() {
// <<<<<<<<
// End of: Normalizing request types
// rhill 2013-12-07:
// Tell Chromium to allow all javascript: µMatrix will control whether
// javascript execute through `Content-Policy-Directive` and webRequest.
// https://github.com/gorhill/httpswitchboard/issues/74
chrome.contentSettings.javascript.set({
primaryPattern: 'https://*/*',
setting: 'allow'
});
chrome.contentSettings.javascript.set({
primaryPattern: 'http://*/*',
setting: 'allow'
});
// Network event handlers
// >>>>>>>>
var onBeforeRequestClient = this.onBeforeRequest.callback;

@ -192,6 +192,13 @@ const contentObserver = {
return;
}
// https://github.com/gorhill/uBlock/issues/260
// TODO: We may have to skip more types, for now let's be
// conservative, i.e. let's not test against `text/html`.
if ( doc.contentType.lastIndexOf('image/', 0) === 0 ) {
return;
}
if ( loc.protocol !== 'http:' && loc.protocol !== 'https:' && loc.protocol !== 'file:' ) {
if ( loc.protocol === 'chrome:' && loc.host === hostName ) {
this.initContentScripts(win);

@ -625,6 +625,9 @@ vAPI.tabs.getAll = function(callback) {
continue;
}
for ( tab of tabBrowser.tabs ) {
if ( tab.hasAttribute('pending') ) {
continue;
}
tabs.push({
id: this.getTabId(tab),
url: getBrowserForTab(tab).currentURI.asciiSpec
@ -1895,6 +1898,9 @@ vAPI.lastError = function() {
vAPI.onLoadAllCompleted = function() {
for ( var tab of this.tabs.getAllSync() ) {
// We're insterested in only the tabs that were already loaded
if ( tab.hasAttribute('pending') ) {
continue;
}
getBrowserForTab(tab).messageManager.sendAsyncMessage(
location.host + '-load-completed'
);

Loading…
Cancel
Save