mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 09:07:54 +01:00
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
3 changed files with 13 additions and 5 deletions
|
@ -627,7 +627,13 @@ const retrieveContentScriptParameters = function(sender, request) {
|
|||
response.specificCosmeticFilters =
|
||||
µ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);
|
||||
}
|
||||
|
||||
|
|
|
@ -377,7 +377,6 @@
|
|||
|
||||
api.injectNow = function(details) {
|
||||
if ( typeof details.frameId !== 'number' ) { return; }
|
||||
if ( µb.URI.isNetworkURI(details.url) === false ) { return; }
|
||||
const request = {
|
||||
tabId: details.tabId,
|
||||
frameId: details.frameId,
|
||||
|
|
|
@ -868,7 +868,10 @@ vAPI.Tabs = class extends vAPI.Tabs {
|
|||
// properly setup if network requests are fired from within the tab.
|
||||
// Example: Chromium + case #6 at
|
||||
// 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) {
|
||||
super.onNavigation(details);
|
||||
const µb = µBlock;
|
||||
|
@ -879,8 +882,8 @@ vAPI.Tabs = class extends vAPI.Tabs {
|
|||
pageStore.journalAddRootFrame('committed', details.url);
|
||||
}
|
||||
}
|
||||
if ( µb.canInjectScriptletsNow ) {
|
||||
let pageStore = µb.pageStoreFromTabId(details.tabId);
|
||||
if ( µb.canInjectScriptletsNow && µb.URI.isNetworkURI(details.url) ) {
|
||||
const pageStore = µb.pageStoreFromTabId(details.tabId);
|
||||
if ( pageStore !== null && pageStore.getNetFilteringSwitch() ) {
|
||||
µb.scriptletFilteringEngine.injectNow(details);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue