forked from mirrors/gecko-dev
ContentTask tasks have a different lifetime than SpecialPowers tasks, with the former being tied to the lifetime of a message manager and the latter tied to the lifetime of a window global. That means that existing ContentTask callers which expect to be able to register load listeners before the creation of a window global, or which expect to persist after a page has navigated, won't work as SpecialPowers tasks. Since those sorts of tasks are not really resilient in the face of Fission, they should really be written to work differently, but this patch mostly just reverts them to using ContentTask for the time being. Differential Revision: https://phabricator.services.mozilla.com/D53744 --HG-- extra : moz-landing-system : lando
23 lines
689 B
JavaScript
23 lines
689 B
JavaScript
// Tests that the DOMDocElementInserted event is visible on the frame
|
|
add_task(async function() {
|
|
let tab = BrowserTestUtils.addTab(gBrowser);
|
|
let uri = "data:text/html;charset=utf-8,<html/>";
|
|
|
|
let eventPromise = ContentTask.spawn(tab.linkedBrowser, null, function() {
|
|
return new Promise(resolve => {
|
|
addEventListener(
|
|
"DOMDocElementInserted",
|
|
event => resolve(event.target.documentURIObject.spec),
|
|
{
|
|
once: true,
|
|
}
|
|
);
|
|
});
|
|
});
|
|
|
|
BrowserTestUtils.loadURI(tab.linkedBrowser, uri);
|
|
let loadedURI = await eventPromise;
|
|
is(loadedURI, uri, "Should have seen the event for the right URI");
|
|
|
|
gBrowser.removeTab(tab);
|
|
});
|