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

Commit bbfef4f

Browse files
committed
this fixes #234 + other fixes imported from uBlock
1 parent 9f51e49 commit bbfef4f

File tree

4 files changed

+35
-14
lines changed

4 files changed

+35
-14
lines changed

platform/chromium/manifest.json

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
"browsingData",
7272
"contentSettings",
7373
"cookies",
74+
"privacy",
7475
"storage",
7576
"tabs",
7677
"unlimitedStorage",

platform/chromium/vapi-background.js

+21-14
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,27 @@ var noopFunc = function(){};
4242

4343
/******************************************************************************/
4444

45+
// https://github.com/gorhill/uMatrix/issues/234
46+
// https://developer.chrome.com/extensions/privacy#property-network
47+
chrome.privacy.network.networkPredictionEnabled.set({
48+
value: false
49+
});
50+
51+
// rhill 2013-12-07:
52+
// Tell Chromium to allow all javascript: µMatrix will control whether
53+
// javascript execute through `Content-Policy-Directive` and webRequest.
54+
// https://github.com/gorhill/httpswitchboard/issues/74
55+
chrome.contentSettings.javascript.set({
56+
primaryPattern: 'https://*/*',
57+
setting: 'allow'
58+
});
59+
chrome.contentSettings.javascript.set({
60+
primaryPattern: 'http://*/*',
61+
setting: 'allow'
62+
});
63+
64+
/******************************************************************************/
65+
4566
vAPI.app = {
4667
name: manifest.name,
4768
version: manifest.version
@@ -680,20 +701,6 @@ vAPI.net.registerListeners = function() {
680701
// <<<<<<<<
681702
// End of: Normalizing request types
682703

683-
684-
// rhill 2013-12-07:
685-
// Tell Chromium to allow all javascript: µMatrix will control whether
686-
// javascript execute through `Content-Policy-Directive` and webRequest.
687-
// https://github.com/gorhill/httpswitchboard/issues/74
688-
chrome.contentSettings.javascript.set({
689-
primaryPattern: 'https://*/*',
690-
setting: 'allow'
691-
});
692-
chrome.contentSettings.javascript.set({
693-
primaryPattern: 'http://*/*',
694-
setting: 'allow'
695-
});
696-
697704
// Network event handlers
698705
// >>>>>>>>
699706
var onBeforeRequestClient = this.onBeforeRequest.callback;

platform/firefox/frameModule.js

+7
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,13 @@ const contentObserver = {
192192
return;
193193
}
194194

195+
// https://github.com/gorhill/uBlock/issues/260
196+
// TODO: We may have to skip more types, for now let's be
197+
// conservative, i.e. let's not test against `text/html`.
198+
if ( doc.contentType.lastIndexOf('image/', 0) === 0 ) {
199+
return;
200+
}
201+
195202
if ( loc.protocol !== 'http:' && loc.protocol !== 'https:' && loc.protocol !== 'file:' ) {
196203
if ( loc.protocol === 'chrome:' && loc.host === hostName ) {
197204
this.initContentScripts(win);

platform/firefox/vapi-background.js

+6
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,9 @@ vAPI.tabs.getAll = function(callback) {
625625
continue;
626626
}
627627
for ( tab of tabBrowser.tabs ) {
628+
if ( tab.hasAttribute('pending') ) {
629+
continue;
630+
}
628631
tabs.push({
629632
id: this.getTabId(tab),
630633
url: getBrowserForTab(tab).currentURI.asciiSpec
@@ -1895,6 +1898,9 @@ vAPI.lastError = function() {
18951898
vAPI.onLoadAllCompleted = function() {
18961899
for ( var tab of this.tabs.getAllSync() ) {
18971900
// We're insterested in only the tabs that were already loaded
1901+
if ( tab.hasAttribute('pending') ) {
1902+
continue;
1903+
}
18981904
getBrowserForTab(tab).messageManager.sendAsyncMessage(
18991905
location.host + '-load-completed'
19001906
);

0 commit comments

Comments
 (0)