Browse Source

this fixes #234 + other fixes imported from uBlock

pull/2/head
gorhill 10 years ago
parent
commit
bbfef4f6cf
  1. 1
      platform/chromium/manifest.json
  2. 35
      platform/chromium/vapi-background.js
  3. 7
      platform/firefox/frameModule.js
  4. 6
      platform/firefox/vapi-background.js

1
platform/chromium/manifest.json

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

35
platform/chromium/vapi-background.js

@ -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 = { vAPI.app = {
name: manifest.name, name: manifest.name,
version: manifest.version version: manifest.version
@ -680,20 +701,6 @@ vAPI.net.registerListeners = function() {
// <<<<<<<< // <<<<<<<<
// End of: Normalizing request types // 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 // Network event handlers
// >>>>>>>> // >>>>>>>>
var onBeforeRequestClient = this.onBeforeRequest.callback; var onBeforeRequestClient = this.onBeforeRequest.callback;

7
platform/firefox/frameModule.js

@ -192,6 +192,13 @@ const contentObserver = {
return; 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 !== 'http:' && loc.protocol !== 'https:' && loc.protocol !== 'file:' ) {
if ( loc.protocol === 'chrome:' && loc.host === hostName ) { if ( loc.protocol === 'chrome:' && loc.host === hostName ) {
this.initContentScripts(win); this.initContentScripts(win);

6
platform/firefox/vapi-background.js

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

Loading…
Cancel
Save