mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-06 09:37:12 +02:00
fix #3185
This commit is contained in:
parent
b02fcb1b31
commit
387eaa0b21
@ -38,13 +38,13 @@
|
|||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
{
|
{
|
||||||
"matches": ["http://*/*", "https://*/*"],
|
"matches": ["http://*/*", "https://*/*"],
|
||||||
"js": ["js/vapi.js", "js/vapi-client.js", "js/contentscript.js"],
|
"js": ["/js/vapi.js", "/js/vapi-client.js", "/js/contentscript.js"],
|
||||||
"run_at": "document_start",
|
"run_at": "document_start",
|
||||||
"all_frames": true
|
"all_frames": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"matches": ["http://*/*", "https://*/*"],
|
"matches": ["http://*/*", "https://*/*"],
|
||||||
"js": ["js/scriptlets/subscriber.js"],
|
"js": ["/js/scriptlets/subscriber.js"],
|
||||||
"run_at": "document_idle",
|
"run_at": "document_idle",
|
||||||
"all_frames": false
|
"all_frames": false
|
||||||
}
|
}
|
||||||
|
@ -1031,20 +1031,21 @@ vAPI.onLoadAllCompleted = function() {
|
|||||||
// http://code.google.com/p/chromium/issues/detail?id=410868#c11
|
// http://code.google.com/p/chromium/issues/detail?id=410868#c11
|
||||||
// Need to be sure to access `vAPI.lastError()` to prevent
|
// Need to be sure to access `vAPI.lastError()` to prevent
|
||||||
// spurious warnings in the console.
|
// spurious warnings in the console.
|
||||||
var scriptDone = function() {
|
var onScriptInjected = function() {
|
||||||
vAPI.lastError();
|
vAPI.lastError();
|
||||||
};
|
};
|
||||||
var scriptStart = function(tabId) {
|
var scriptStart = function(tabId) {
|
||||||
vAPI.tabs.injectScript(tabId, {
|
var manifest = chrome.runtime.getManifest();
|
||||||
file: 'js/vapi-client.js',
|
if ( manifest instanceof Object === false ) { return; }
|
||||||
allFrames: true,
|
for ( var contentScript of manifest.content_scripts ) {
|
||||||
runAt: 'document_idle'
|
for ( var file of contentScript.js ) {
|
||||||
}, function(){ });
|
vAPI.tabs.injectScript(tabId, {
|
||||||
vAPI.tabs.injectScript(tabId, {
|
file: file,
|
||||||
file: 'js/contentscript.js',
|
allFrames: contentScript.all_frames,
|
||||||
allFrames: true,
|
runAt: contentScript.run_at
|
||||||
runAt: 'document_idle'
|
}, onScriptInjected);
|
||||||
}, scriptDone);
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
var bindToTabs = function(tabs) {
|
var bindToTabs = function(tabs) {
|
||||||
var µb = µBlock;
|
var µb = µBlock;
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1408996#c9
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=1408996#c9
|
||||||
var vAPI; // jshint ignore:line
|
var vAPI = window.vAPI; // jshint ignore:line
|
||||||
|
|
||||||
// https://github.com/chrisaljoudi/uBlock/issues/464
|
// https://github.com/chrisaljoudi/uBlock/issues/464
|
||||||
// https://github.com/chrisaljoudi/uBlock/issues/1528
|
// https://github.com/chrisaljoudi/uBlock/issues/1528
|
||||||
@ -48,7 +48,9 @@ if (
|
|||||||
) &&
|
) &&
|
||||||
(/^image\/|^text\/plain/.test(document.contentType || '') === false)
|
(/^image\/|^text\/plain/.test(document.contentType || '') === false)
|
||||||
) {
|
) {
|
||||||
vAPI = vAPI instanceof Object && vAPI.uBO === true ? vAPI : { uBO: true };
|
vAPI = window.vAPI = vAPI instanceof Object && vAPI.uBO === true
|
||||||
|
? vAPI
|
||||||
|
: { uBO: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -37,9 +37,9 @@
|
|||||||
"file://*/*"
|
"file://*/*"
|
||||||
],
|
],
|
||||||
"js":[
|
"js":[
|
||||||
"js/vapi.js",
|
"/js/vapi.js",
|
||||||
"js/vapi-client.js",
|
"/js/vapi-client.js",
|
||||||
"js/contentscript.js"
|
"/js/contentscript.js"
|
||||||
],
|
],
|
||||||
"run_at":"document_start",
|
"run_at":"document_start",
|
||||||
"all_frames":true
|
"all_frames":true
|
||||||
@ -50,7 +50,7 @@
|
|||||||
"https://*/*"
|
"https://*/*"
|
||||||
],
|
],
|
||||||
"js":[
|
"js":[
|
||||||
"js/scriptlets/subscriber.js"
|
"/js/scriptlets/subscriber.js"
|
||||||
],
|
],
|
||||||
"run_at":"document_idle",
|
"run_at":"document_idle",
|
||||||
"all_frames":false
|
"all_frames":false
|
||||||
|
@ -46,6 +46,11 @@ var exports = {};
|
|||||||
|
|
||||||
var onBeforeReady = null;
|
var onBeforeReady = null;
|
||||||
|
|
||||||
|
µBlock.onStartCompletedQueue.push(function(callback) {
|
||||||
|
vAPI.onLoadAllCompleted();
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
|
||||||
if ( µBlock.hiddenSettings.suspendTabsUntilReady ) {
|
if ( µBlock.hiddenSettings.suspendTabsUntilReady ) {
|
||||||
onBeforeReady = (function() {
|
onBeforeReady = (function() {
|
||||||
var suspendedTabs = new Set();
|
var suspendedTabs = new Set();
|
||||||
@ -66,11 +71,6 @@ if ( µBlock.hiddenSettings.suspendTabsUntilReady ) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
} else {
|
|
||||||
µBlock.onStartCompletedQueue.push(function(callback) {
|
|
||||||
vAPI.onLoadAllCompleted();
|
|
||||||
callback();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user