mirror of https://github.com/gorhill/uBlock.git
Fix case of scriptlet injection not working `about:` frames
This is an issue in uBO affecting only Chromium-based browsers. Related feedback: https://github.com/uBlockOrigin/uBlock-issues/issues/688#issuecomment-748179731
This commit is contained in:
parent
2867ae175f
commit
990cff576d
|
@ -627,7 +627,13 @@ const retrieveContentScriptParameters = function(sender, request) {
|
||||||
response.specificCosmeticFilters =
|
response.specificCosmeticFilters =
|
||||||
µb.cosmeticFilteringEngine.retrieveSpecificSelectors(request, response);
|
µb.cosmeticFilteringEngine.retrieveSpecificSelectors(request, response);
|
||||||
|
|
||||||
if ( µb.canInjectScriptletsNow === false ) {
|
// https://github.com/uBlockOrigin/uBlock-issues/issues/688#issuecomment-748179731
|
||||||
|
// For non-network URIs, scriptlet injection is deferred to here. The
|
||||||
|
// effective URL is available here in `request.url`.
|
||||||
|
if (
|
||||||
|
µb.canInjectScriptletsNow === false ||
|
||||||
|
µb.URI.isNetworkURI(sender.frameURL) === false
|
||||||
|
) {
|
||||||
response.scriptlets = µb.scriptletFilteringEngine.retrieve(request);
|
response.scriptlets = µb.scriptletFilteringEngine.retrieve(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -377,7 +377,6 @@
|
||||||
|
|
||||||
api.injectNow = function(details) {
|
api.injectNow = function(details) {
|
||||||
if ( typeof details.frameId !== 'number' ) { return; }
|
if ( typeof details.frameId !== 'number' ) { return; }
|
||||||
if ( µb.URI.isNetworkURI(details.url) === false ) { return; }
|
|
||||||
const request = {
|
const request = {
|
||||||
tabId: details.tabId,
|
tabId: details.tabId,
|
||||||
frameId: details.frameId,
|
frameId: details.frameId,
|
||||||
|
|
|
@ -868,7 +868,10 @@ vAPI.Tabs = class extends vAPI.Tabs {
|
||||||
// properly setup if network requests are fired from within the tab.
|
// properly setup if network requests are fired from within the tab.
|
||||||
// Example: Chromium + case #6 at
|
// Example: Chromium + case #6 at
|
||||||
// http://raymondhill.net/ublock/popup.html
|
// http://raymondhill.net/ublock/popup.html
|
||||||
|
// https://github.com/uBlockOrigin/uBlock-issues/issues/688#issuecomment-748179731
|
||||||
|
// For non-network URIs, defer scriptlet injection to content script. The
|
||||||
|
// reason for this is that we need the effective URL and this information
|
||||||
|
// is not available at this point.
|
||||||
onNavigation(details) {
|
onNavigation(details) {
|
||||||
super.onNavigation(details);
|
super.onNavigation(details);
|
||||||
const µb = µBlock;
|
const µb = µBlock;
|
||||||
|
@ -879,8 +882,8 @@ vAPI.Tabs = class extends vAPI.Tabs {
|
||||||
pageStore.journalAddRootFrame('committed', details.url);
|
pageStore.journalAddRootFrame('committed', details.url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( µb.canInjectScriptletsNow ) {
|
if ( µb.canInjectScriptletsNow && µb.URI.isNetworkURI(details.url) ) {
|
||||||
let pageStore = µb.pageStoreFromTabId(details.tabId);
|
const pageStore = µb.pageStoreFromTabId(details.tabId);
|
||||||
if ( pageStore !== null && pageStore.getNetFilteringSwitch() ) {
|
if ( pageStore !== null && pageStore.getNetFilteringSwitch() ) {
|
||||||
µb.scriptletFilteringEngine.injectNow(details);
|
µb.scriptletFilteringEngine.injectNow(details);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue