зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1467437. Align with other browsers and the spec for whether hashchange and popstate events bubble. r=smaug
I think I caught all the places in our tree that add event listeners for these events on a non-Window (and hence depend on bubbling behavior), but I'm a little worried about what happens if webextensions do bareword addEventListener() for these events... Differential Revision: https://phabricator.services.mozilla.com/D66798 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
819630de4b
Коммит
cf6ef6a24b
|
@ -22,7 +22,8 @@ add_task(async function() {
|
|||
|
||||
let popStatePromise = BrowserTestUtils.waitForContentEvent(
|
||||
gBrowser.selectedBrowser,
|
||||
"popstate"
|
||||
"popstate",
|
||||
true
|
||||
);
|
||||
EventUtils.synthesizeMouseAtPoint(xPixel, yPixel, {}, window);
|
||||
await popStatePromise;
|
||||
|
|
|
@ -21,7 +21,7 @@ add_task(async function test_duplicate() {
|
|||
docShell.chromeEventHandler.addEventListener(
|
||||
"hashchange",
|
||||
() => resolve(),
|
||||
{ once: true }
|
||||
{ once: true, capture: true }
|
||||
);
|
||||
|
||||
// Click the link.
|
||||
|
@ -60,7 +60,7 @@ add_task(async function test_duplicate_remove() {
|
|||
docShell.chromeEventHandler.addEventListener(
|
||||
"hashchange",
|
||||
() => resolve(),
|
||||
{ once: true }
|
||||
{ once: true, capture: true }
|
||||
);
|
||||
|
||||
// Click the link.
|
||||
|
|
|
@ -25,7 +25,7 @@ add_task(async function test_flush() {
|
|||
docShell.chromeEventHandler.addEventListener(
|
||||
"hashchange",
|
||||
() => resolve(),
|
||||
{ once: true }
|
||||
{ once: true, capture: true }
|
||||
);
|
||||
|
||||
// Click the link.
|
||||
|
@ -64,7 +64,7 @@ add_task(async function test_crash() {
|
|||
docShell.chromeEventHandler.addEventListener(
|
||||
"hashchange",
|
||||
() => resolve(),
|
||||
{ once: true }
|
||||
{ once: true, capture: true }
|
||||
);
|
||||
|
||||
// Click the link.
|
||||
|
@ -107,7 +107,7 @@ add_task(async function test_remove() {
|
|||
docShell.chromeEventHandler.addEventListener(
|
||||
"hashchange",
|
||||
() => resolve(),
|
||||
{ once: true }
|
||||
{ once: true, capture: true }
|
||||
);
|
||||
|
||||
// Click the link.
|
||||
|
|
|
@ -48,9 +48,13 @@ if (sessionHistory) {
|
|||
* to modify and query docShell data when running with multiple processes.
|
||||
*/
|
||||
|
||||
addEventListener("hashchange", function() {
|
||||
sendAsyncMessage("ss-test:hashchange");
|
||||
});
|
||||
addEventListener(
|
||||
"hashchange",
|
||||
function() {
|
||||
sendAsyncMessage("ss-test:hashchange");
|
||||
},
|
||||
true
|
||||
);
|
||||
|
||||
addMessageListener("ss-test:getStyleSheets", function(msg) {
|
||||
let sheets = content.document.styleSheets;
|
||||
|
|
|
@ -17,7 +17,7 @@ add_task(async function test_ignoreFragment() {
|
|||
tabRefAboutHome.linkedBrowser,
|
||||
[],
|
||||
async function() {
|
||||
await ContentTaskUtils.waitForEvent(this, "hashchange", false);
|
||||
await ContentTaskUtils.waitForEvent(this, "hashchange", true);
|
||||
}
|
||||
);
|
||||
switchTab("about:home#2", true, {
|
||||
|
|
|
@ -186,8 +186,8 @@ function* run_test() {
|
|||
"Event type should be 'hashchange'.");
|
||||
is(gSampleEvent.cancelable, false,
|
||||
"The hashchange event shouldn't be cancelable.");
|
||||
is(gSampleEvent.bubbles, true,
|
||||
"The hashchange event should bubble.");
|
||||
is(gSampleEvent.bubbles, false,
|
||||
"The hashchange event should not bubble.");
|
||||
|
||||
/*
|
||||
* TEST 3 tests that:
|
||||
|
|
|
@ -4243,8 +4243,6 @@ nsresult nsGlobalWindowInner::FireHashchange(const nsAString& aOldURL,
|
|||
NS_ENSURE_STATE(IsCurrentInnerWindow());
|
||||
|
||||
HashChangeEventInit init;
|
||||
init.mBubbles = true;
|
||||
init.mCancelable = false;
|
||||
init.mNewURL = aNewURL;
|
||||
init.mOldURL = aOldURL;
|
||||
|
||||
|
@ -4284,8 +4282,6 @@ nsresult nsGlobalWindowInner::DispatchSyncPopState() {
|
|||
NS_ENSURE_TRUE(result, NS_ERROR_FAILURE);
|
||||
|
||||
RootedDictionary<PopStateEventInit> init(cx);
|
||||
init.mBubbles = true;
|
||||
init.mCancelable = false;
|
||||
init.mState = stateJSValue;
|
||||
|
||||
RefPtr<PopStateEvent> event =
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
[hashchange_event.html]
|
||||
[Queue a task to fire hashchange event]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[popstate_event.html]
|
||||
[Queue a task to fire popstate event]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[004.html]
|
||||
[Fragment Navigation: hashchange event]
|
||||
expected: FAIL
|
||||
|
Загрузка…
Ссылка в новой задаче