mirror of https://github.com/gorhill/uBlock.git
Create synthetic event for new windows created from external application
Related discussion: - https://github.com/uBlockOrigin/uAssets/issues/10323#issuecomment-993592288 Synthesize a onCreatedNavigationTarget event for new browser windows created as a result of an external application triggering a navigation event.
This commit is contained in:
parent
01f87e979e
commit
89e67887ee
|
@ -28,6 +28,8 @@
|
|||
// https://github.com/uBlockOrigin/uBlock-issues/issues/1659
|
||||
// Chromium fails to dispatch onCreatedNavigationTarget() events sometimes,
|
||||
// so we synthetize these missing events when this happens.
|
||||
// https://github.com/uBlockOrigin/uAssets/issues/10323
|
||||
// Also mind whether the new tab is launched from an external application.
|
||||
|
||||
vAPI.Tabs = class extends vAPI.Tabs {
|
||||
constructor() {
|
||||
|
@ -65,12 +67,11 @@ vAPI.Tabs = class extends vAPI.Tabs {
|
|||
synthesizeNavigationTargetEvent(details) {
|
||||
if ( this.tabIds.has(details.tabId) === false ) { return; }
|
||||
this.tabIds.delete(details.tabId);
|
||||
if (
|
||||
Array.isArray(details.transitionQualifiers) === false ||
|
||||
details.transitionQualifiers.includes('client_redirect') === false
|
||||
) {
|
||||
return;
|
||||
}
|
||||
const isClientRedirect =
|
||||
Array.isArray(details.transitionQualifiers) &&
|
||||
details.transitionQualifiers.includes('client_redirect');
|
||||
const isStartPage = details.transitionType === 'start_page';
|
||||
if ( isClientRedirect === false && isStartPage === false ) { return; }
|
||||
this.onCreatedNavigationTargetHandler({
|
||||
tabId: details.tabId,
|
||||
sourceTabId: details.tabId,
|
||||
|
|
Loading…
Reference in New Issue