Skip to content
This repository has been archived by the owner on Jul 21, 2021. It is now read-only.

Commit

Permalink
this fixes #234 + other fixes imported from uBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed May 30, 2015
1 parent 9f51e49 commit bbfef4f
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 14 deletions.
1 change: 1 addition & 0 deletions platform/chromium/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"browsingData",
"contentSettings",
"cookies",
"privacy",
"storage",
"tabs",
"unlimitedStorage",
Expand Down
35 changes: 21 additions & 14 deletions platform/chromium/vapi-background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions platform/firefox/frameModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions platform/firefox/vapi-background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
);
Expand Down

0 comments on commit bbfef4f

Please sign in to comment.