Bug 1643998: Ignore load events from stale actors in browserLoaded helper. r=nika

Differential Revision: https://phabricator.services.mozilla.com/D117570
This commit is contained in:
Kris Maglione 2021-06-17 04:42:34 +00:00
Родитель db959e6eb0
Коммит 5c9ca10ec3
2 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -81,7 +81,6 @@ support-files = file_new_tab_page.html
skip-if =
!e10s
os == 'linux' && debug && bits == 64 # Pref and test only relevant for e10s, Bug 1581500.
fission && (os == "mac" || os == 'linux') # Bug 1713893 - new Fission platform triage
[browser_privilegedmozilla_process_pref.js]
skip-if = !e10s # Pref and test only relevant for e10s.
[browser_newwindow_tabstrip_overflow.js]

Просмотреть файл

@ -11,6 +11,15 @@ class BrowserTestUtilsParent extends JSWindowActorParent {
switch (aMessage.name) {
case "DOMContentLoaded":
case "load": {
// Don't dispatch events that came from stale actors.
let bc = this.browsingContext;
if (
(bc.embedderElement && bc.embedderElement.browsingContext != bc) ||
!(this.manager && this.manager.isCurrentGlobal)
) {
return;
}
let event = new CustomEvent(
`BrowserTestUtils:ContentEvent:${aMessage.name}`,
{