Skip to content

Commit 71456ed

Browse files
authored
fix: dispatch event called on object that doesn't implement EventTarget (#214)
1 parent 84975c6 commit 71456ed

File tree

8 files changed

+11
-8
lines changed

8 files changed

+11
-8
lines changed

Sources/ContentScopeScripts/dist/contentScope.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,7 @@
668668
})();
669669

670670
/* global cloneInto, exportFunction, false */
671+
typeof window === 'undefined' ? null : window.dispatchEvent.bind(window);
671672

672673
/**
673674
* Best guess effort of the tabs hostname; where possible always prefer the args.site.domain
@@ -1432,7 +1433,7 @@
14321433

14331434
// save a reference to original CustomEvent amd dispatchEvent so they can't be overriden to forge messages
14341435
const OriginalCustomEvent = typeof CustomEvent === 'undefined' ? null : CustomEvent;
1435-
const originalWindowDispatchEvent = typeof window === 'undefined' ? null : window.dispatchEvent;
1436+
const originalWindowDispatchEvent = typeof window === 'undefined' ? null : window.dispatchEvent.bind(window);
14361437
function registerMessageSecret (secret) {
14371438
messageSecret = secret;
14381439
}

build/android/contentScope.js

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/chrome-mv3/inject.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/chrome/inject.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/firefox/inject.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/integration/contentScope.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/windows/contentScope.js

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ let messageSecret
99

1010
// save a reference to original CustomEvent amd dispatchEvent so they can't be overriden to forge messages
1111
export const OriginalCustomEvent = typeof CustomEvent === 'undefined' ? null : CustomEvent
12-
export const originalWindowDispatchEvent = typeof window === 'undefined' ? null : window.dispatchEvent
12+
export const originalWindowDispatchEvent = typeof window === 'undefined' ? null : window.dispatchEvent.bind(window)
1313
export function registerMessageSecret (secret) {
1414
messageSecret = secret
1515
}

0 commit comments

Comments
 (0)