1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-10-06 09:37:12 +02:00
This commit is contained in:
gorhill 2017-11-16 00:34:01 -05:00
parent 8646b78306
commit b02fcb1b31
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -41,6 +41,9 @@ var exports = {};
// which blocks everything until all is ready.
// This would allow to avoid the permanent special test at the top of
// the main onBeforeRequest just to implement this.
// https://github.com/gorhill/uBlock/issues/3130
// Don't block root frame.
var onBeforeReady = null;
if ( µBlock.hiddenSettings.suspendTabsUntilReady ) {
@ -53,10 +56,14 @@ if ( µBlock.hiddenSettings.suspendTabsUntilReady ) {
}
callback();
});
return function(tabId) {
if ( vAPI.isBehindTheSceneTabId(tabId) ) { return; }
suspendedTabs.add(tabId);
return true;
return function(details) {
if (
details.type !== 'main_frame' &&
vAPI.isBehindTheSceneTabId(details.tabId) === false
) {
suspendedTabs.add(details.tabId);
return true;
}
};
})();
} else {
@ -71,8 +78,7 @@ if ( µBlock.hiddenSettings.suspendTabsUntilReady ) {
// Intercept and filter web requests.
var onBeforeRequest = function(details) {
var tabId = details.tabId;
if ( onBeforeReady !== null && onBeforeReady(tabId) ) {
if ( onBeforeReady !== null && onBeforeReady(details) ) {
return { cancel: true };
}
@ -86,6 +92,7 @@ var onBeforeRequest = function(details) {
}
// Special treatment: behind-the-scene requests
var tabId = details.tabId;
if ( vAPI.isBehindTheSceneTabId(tabId) ) {
return onBeforeBehindTheSceneRequest(details);
}