mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-07 03:12:33 +01:00
Context of about:blank
is that of parent frame (popup
option)
Related feedback: - https://github.com/uBlockOrigin/uBlock-issues/discussions/2534#discussioncomment-5264792
This commit is contained in:
parent
3c4c3767a2
commit
574f30ed43
@ -316,9 +316,24 @@ const onPopupUpdated = (( ) => {
|
|||||||
if ( tabContext === null ) { return; }
|
if ( tabContext === null ) { return; }
|
||||||
const rootOpenerURL = tabContext.rawURL;
|
const rootOpenerURL = tabContext.rawURL;
|
||||||
if ( rootOpenerURL === '' ) { return; }
|
if ( rootOpenerURL === '' ) { return; }
|
||||||
const localOpenerURL = openerDetails.frameId !== 0
|
const pageStore = µb.pageStoreFromTabId(openerTabId);
|
||||||
|
|
||||||
|
// https://github.com/uBlockOrigin/uBlock-issues/discussions/2534#discussioncomment-5264792
|
||||||
|
// An `about:blank` frame's context is that of the parent context
|
||||||
|
let localOpenerURL = openerDetails.frameId !== 0
|
||||||
? openerDetails.frameURL
|
? openerDetails.frameURL
|
||||||
: undefined;
|
: undefined;
|
||||||
|
if ( localOpenerURL === 'about:blank' && pageStore !== null ) {
|
||||||
|
let openerFrameId = openerDetails.frameId;
|
||||||
|
do {
|
||||||
|
const frame = pageStore.getFrameStore(openerFrameId);
|
||||||
|
if ( frame === null ) { break; }
|
||||||
|
openerFrameId = frame.parentId;
|
||||||
|
const parentFrame = pageStore.getFrameStore(openerFrameId);
|
||||||
|
if ( parentFrame === null ) { break; }
|
||||||
|
localOpenerURL = parentFrame.frameURL;
|
||||||
|
} while ( localOpenerURL === 'about:blank' && openerFrameId !== 0 );
|
||||||
|
}
|
||||||
|
|
||||||
// Popup details.
|
// Popup details.
|
||||||
tabContext = µb.tabContextManager.lookup(targetTabId);
|
tabContext = µb.tabContextManager.lookup(targetTabId);
|
||||||
@ -392,7 +407,6 @@ const onPopupUpdated = (( ) => {
|
|||||||
|
|
||||||
// Only if a popup was blocked do we report it in the dynamic
|
// Only if a popup was blocked do we report it in the dynamic
|
||||||
// filtering pane.
|
// filtering pane.
|
||||||
const pageStore = µb.pageStoreFromTabId(openerTabId);
|
|
||||||
if ( pageStore ) {
|
if ( pageStore ) {
|
||||||
pageStore.journalAddRequest(fctxt, result);
|
pageStore.journalAddRequest(fctxt, result);
|
||||||
pageStore.popupBlockedCount += 1;
|
pageStore.popupBlockedCount += 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user