-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement AppHistoryCurrentChangeEvent
Spec/explainer: WICG/navigation-api#171 Bug: 1252532 Change-Id: Ibd8a856fc36b37d5f4095627808a9a0be15de283
- Loading branch information
1 parent
567dd16
commit 86b3db7
Showing
21 changed files
with
401 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
app-history/current-change-event/currentchange-anchor-href.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!doctype html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<a id="a" href="#foo"></a> | ||
<script> | ||
test(t => { | ||
let oncurrentchange_called = false; | ||
appHistory.oncurrentchange = t.step_func(e => { | ||
oncurrentchange_called = true; | ||
assert_equals(e.from, appHistory.entries()[0]); | ||
assert_equals(e.from.index, 0); | ||
assert_equals(e.navigationType, "push"); | ||
assert_equals(appHistory.current.index, 1); | ||
}); | ||
a.click(); | ||
assert_true(oncurrentchange_called); | ||
}, "AppHistoryCurrentChangeEvent fires for link click"); | ||
</script> |
20 changes: 20 additions & 0 deletions
20
app-history/current-change-event/currentchange-app-history-back-forward-cross-doc.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!doctype html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<iframe id="i" src="/common/blank.html"></iframe> | ||
<script> | ||
promise_test(async t => { | ||
await new Promise(resolve => window.onload = resolve); | ||
i.contentWindow.appHistory.navigate("/common/blank.html?1"); | ||
await new Promise(resolve => i.onload = resolve); | ||
assert_equals(i.contentWindow.appHistory.entries().length, 2); | ||
|
||
i.contentWindow.appHistory.oncurrentchange = t.unreached_func("currentchange should not fire for cross-document navigations"); | ||
i.contentWindow.appHistory.back(); | ||
await new Promise(resolve => i.onload = resolve); | ||
|
||
i.contentWindow.appHistory.oncurrentchange = t.unreached_func("currentchange should not fire for cross-document navigations"); | ||
i.contentWindow.appHistory.forward(); | ||
await new Promise(resolve => i.onload = resolve); | ||
}, "AppHistoryCurrentChangeEvent does not fire for cross-document appHistory.back() and appHistory.forward()"); | ||
</script> |
34 changes: 34 additions & 0 deletions
34
app-history/current-change-event/currentchange-app-history-back-forward-same-doc.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!doctype html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
promise_test(async t => { | ||
await new Promise(resolve => window.onload = t.step_timeout(resolve, 0)); | ||
await appHistory.navigate("#foo"); | ||
assert_equals(appHistory.entries().length, 2); | ||
|
||
let oncurrentchange_back_called = false; | ||
appHistory.oncurrentchange = t.step_func(e => { | ||
oncurrentchange_back_called = true; | ||
assert_equals(e.from, appHistory.entries()[1]); | ||
assert_equals(e.navigationType, "traverse"); | ||
assert_equals(appHistory.current.index, 0); | ||
}); | ||
let back_result = appHistory.back(); | ||
assert_false(oncurrentchange_back_called); | ||
await back_result.committed; | ||
assert_true(oncurrentchange_back_called); | ||
|
||
let oncurrentchange_forward_called = false; | ||
appHistory.oncurrentchange = t.step_func(e => { | ||
oncurrentchange_forward_called = true; | ||
assert_equals(e.from, appHistory.entries()[0]); | ||
assert_equals(e.navigationType, "traverse"); | ||
assert_equals(appHistory.current.index, 1); | ||
}); | ||
let forward_result = appHistory.forward(); | ||
assert_false(oncurrentchange_forward_called); | ||
await forward_result.committed; | ||
assert_true(oncurrentchange_forward_called); | ||
}, "AppHistoryCurrentChangeEvent fires for appHistory.back() and appHistory.forward()"); | ||
</script> |
12 changes: 12 additions & 0 deletions
12
app-history/current-change-event/currentchange-app-history-navigate-cross-doc.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!doctype html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<iframe id="i" src="/common/blank.html"></iframe> | ||
<script> | ||
promise_test(async t => { | ||
await new Promise(resolve => window.onload = resolve); | ||
i.contentWindow.appHistory.oncurrentchange = t.unreached_func("currentchange should not fire for cross-document navigations"); | ||
i.contentWindow.appHistory.navigate("/common/blank.html?1"); | ||
await new Promise(resolve => i.onload = resolve); | ||
}, "AppHistoryCurrentChangeEvent does not fire for cross-document appHistory.navigate()"); | ||
</script> |
10 changes: 10 additions & 0 deletions
10
app-history/current-change-event/currentchange-app-history-navigate-preventDefault.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!doctype html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
promise_test(async t => { | ||
appHistory.oncurrentchange = t.unreached_func("currentchange should not fire"); | ||
appHistory.onnavigate = e => e.preventDefault(); | ||
await promise_rejects_dom(t, "AbortError", appHistory.navigate("#foo").committed); | ||
}, "AppHistoryCurrentChangeEvent does not fire when onnavigate preventDefault() is called"); | ||
</script> |
12 changes: 12 additions & 0 deletions
12
app-history/current-change-event/currentchange-app-history-navigate-replace-cross-doc.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!doctype html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<iframe id="i" src="/common/blank.html"></iframe> | ||
<script> | ||
promise_test(async t => { | ||
await new Promise(resolve => window.onload = resolve); | ||
i.contentWindow.appHistory.oncurrentchange = t.unreached_func("currentchange should not fire for cross-document navigations"); | ||
i.contentWindow.appHistory.navigate("/common/blank.html?1", { replace: true }); | ||
await new Promise(resolve => i.onload = resolve); | ||
}, "AppHistoryCurrentChangeEvent does not fire for cross-document appHistory.navigate() with replace"); | ||
</script> |
21 changes: 21 additions & 0 deletions
21
app-history/current-change-event/currentchange-app-history-navigate-replace-same-doc.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!doctype html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
promise_test(async t => { | ||
await new Promise(resolve => window.onload = t.step_timeout(resolve, 0)); | ||
|
||
let oncurrentchange_called = false; | ||
let original_entry = appHistory.current; | ||
appHistory.oncurrentchange = t.step_func(e => { | ||
oncurrentchange_called = true; | ||
assert_equals(e.from, original_entry); | ||
assert_equals(e.from.index, -1); | ||
assert_equals(e.navigationType, "replace"); | ||
assert_equals(appHistory.current.index, 0); | ||
}); | ||
let result = appHistory.navigate("#foo", { replace: true }); | ||
assert_true(oncurrentchange_called); | ||
await result.committed; | ||
}, "AppHistoryCurrentChangeEvent fires for appHistory.navigate() with replace"); | ||
</script> |
23 changes: 23 additions & 0 deletions
23
...tory/current-change-event/currentchange-app-history-navigate-replace-transitionWhile.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!doctype html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<iframe id="i" src="/common/blank.html"></iframe> | ||
<script> | ||
promise_test(async t => { | ||
await new Promise(resolve => window.onload = resolve); | ||
|
||
let oncurrentchange_called = false; | ||
let original_entry = i.contentWindow.appHistory.current; | ||
i.contentWindow.appHistory.oncurrentchange = t.step_func(e => { | ||
oncurrentchange_called = true; | ||
assert_equals(e.from, original_entry); | ||
assert_equals(e.from.index, -1); | ||
assert_equals(e.navigationType, "replace"); | ||
assert_equals(i.contentWindow.appHistory.current.index, 0); | ||
}); | ||
i.contentWindow.appHistory.onnavigate = e => e.transitionWhile(Promise.resolve()); | ||
let result = i.contentWindow.appHistory.navigate("/common/blank.html?1", { replace: true }); | ||
assert_true(oncurrentchange_called); | ||
await result.committed; | ||
}, "AppHistoryCurrentChangeEvent fires for appHistory.navigate() with replace intercepted by transitionWhile"); | ||
</script> |
19 changes: 19 additions & 0 deletions
19
app-history/current-change-event/currentchange-app-history-navigate-same-doc.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!doctype html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
promise_test(async t => { | ||
await new Promise(resolve => window.onload = t.step_timeout(resolve, 0)); | ||
|
||
let oncurrentchange_called = false; | ||
appHistory.oncurrentchange = t.step_func(e => { | ||
oncurrentchange_called = true; | ||
assert_equals(e.from, appHistory.entries()[0]); | ||
assert_equals(e.navigationType, "push"); | ||
assert_equals(appHistory.current.index, 1); | ||
}); | ||
let result = appHistory.navigate("#foo"); | ||
assert_true(oncurrentchange_called); | ||
await result.committed; | ||
}, "AppHistoryCurrentChangeEvent fires for appHistory.navigate()"); | ||
</script> |
21 changes: 21 additions & 0 deletions
21
app-history/current-change-event/currentchange-app-history-navigate-transitionWhile.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!doctype html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<iframe id="i" src="/common/blank.html"></iframe> | ||
<script> | ||
promise_test(async t => { | ||
await new Promise(resolve => window.onload = resolve); | ||
|
||
let oncurrentchange_called = false; | ||
i.contentWindow.appHistory.oncurrentchange = t.step_func(e => { | ||
oncurrentchange_called = true; | ||
assert_equals(e.from, i.contentWindow.appHistory.entries()[0]); | ||
assert_equals(e.navigationType, "push"); | ||
assert_equals(i.contentWindow.appHistory.current.index, 1); | ||
}); | ||
i.contentWindow.appHistory.onnavigate = e => e.transitionWhile(Promise.resolve()); | ||
let result = i.contentWindow.appHistory.navigate("/common/blank.html?1"); | ||
assert_true(oncurrentchange_called); | ||
await result.committed; | ||
}, "AppHistoryCurrentChangeEvent fires for appHistory.navigate() intercepted by transitionWhile"); | ||
</script> |
12 changes: 12 additions & 0 deletions
12
app-history/current-change-event/currentchange-app-history-reload-cross-doc.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!doctype html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<iframe id="i" src="/common/blank.html"></iframe> | ||
<script> | ||
promise_test(async t => { | ||
await new Promise(resolve => window.onload = resolve); | ||
i.contentWindow.appHistory.oncurrentchange = t.unreached_func("currentchange should not fire for cross-document navigations"); | ||
i.contentWindow.appHistory.reload(); | ||
await new Promise(resolve => i.onload = resolve); | ||
}, "AppHistoryCurrentChangeEvent does not fire for cross-document appHistory.reload()"); | ||
</script> |
21 changes: 21 additions & 0 deletions
21
app-history/current-change-event/currentchange-app-history-reload-transitionWhile.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!doctype html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<iframe id="i" src="/common/blank.html"></iframe> | ||
<script> | ||
promise_test(async t => { | ||
await new Promise(resolve => window.onload = resolve); | ||
|
||
let oncurrentchange_called = false; | ||
i.contentWindow.appHistory.oncurrentchange = t.step_func(e => { | ||
oncurrentchange_called = true; | ||
assert_equals(e.from, i.contentWindow.appHistory.current); | ||
assert_equals(e.navigationType, "reload"); | ||
assert_equals(i.contentWindow.appHistory.current.index, 0); | ||
}); | ||
i.contentWindow.appHistory.onnavigate = e => e.transitionWhile(Promise.resolve()); | ||
let result = i.contentWindow.appHistory.reload(); | ||
assert_true(oncurrentchange_called); | ||
await result.committed; | ||
}, "AppHistoryCurrentChangeEvent fires for appHistory.reload() intercepted by transitionWhile"); | ||
</script> |
20 changes: 20 additions & 0 deletions
20
app-history/current-change-event/currentchange-app-history-updateCurrent.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!doctype html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
test(t => { | ||
let oncurrentchange_count = 0; | ||
appHistory.oncurrentchange = t.step_func(e => { | ||
oncurrentchange_count++; | ||
assert_equals(e.from, appHistory.current); | ||
assert_equals(e.navigationType, null); | ||
assert_equals(appHistory.current.getState(), "newState"); | ||
}); | ||
appHistory.updateCurrent({ state: "newState" }); | ||
assert_equals(oncurrentchange_count, 1); | ||
|
||
// "Updating" the state to the current state should still fire currentchange. | ||
appHistory.updateCurrent({ state: appHistory.current.getState() }); | ||
assert_equals(oncurrentchange_count, 2); | ||
}, "AppHistoryCurrentChangeEvent fires for appHistory.updateCurrent()"); | ||
</script> |
26 changes: 26 additions & 0 deletions
26
app-history/current-change-event/currentchange-dispose-ordering.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!doctype html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
test(t => { | ||
let oncurrentchange_called = false; | ||
let ondispose_called = false; | ||
|
||
let original_entry = appHistory.current; | ||
original_entry.ondispose = t.step_func(() => { | ||
assert_true(oncurrentchange_called); | ||
ondispose_called = true; | ||
}); | ||
|
||
appHistory.oncurrentchange = t.step_func(e => { | ||
oncurrentchange_called = true; | ||
assert_equals(e.from, original_entry); | ||
assert_equals(e.from.index, -1); | ||
assert_equals(e.navigationType, "replace"); | ||
assert_equals(appHistory.current.index, 0); | ||
}); | ||
appHistory.navigate("#foo", { replace: true }); | ||
assert_true(oncurrentchange_called); | ||
assert_true(ondispose_called); | ||
}, "Ordering between AppHistoryCurrentChangeEvent and AppHistoryEntry dispose events"); | ||
</script> |
22 changes: 22 additions & 0 deletions
22
app-history/current-change-event/currentchange-history-back-same-doc.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!doctype html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
promise_test(async t => { | ||
await new Promise(resolve => window.onload = t.step_timeout(resolve, 0)); | ||
await appHistory.navigate("#foo"); | ||
assert_equals(appHistory.entries().length, 2); | ||
|
||
let oncurrentchange_called = false; | ||
appHistory.oncurrentchange = t.step_func(e => { | ||
oncurrentchange_called = true; | ||
assert_equals(e.from, appHistory.entries()[1]); | ||
assert_equals(e.navigationType, "traverse"); | ||
assert_equals(appHistory.current.index, 0); | ||
}); | ||
history.back(); | ||
assert_false(oncurrentchange_called); | ||
await new Promise(resolve => window.onpopstate = resolve); | ||
assert_true(oncurrentchange_called); | ||
}, "AppHistoryCurrentChangeEvent fires for history.back()"); | ||
</script> |
16 changes: 16 additions & 0 deletions
16
app-history/current-change-event/currentchange-history-pushState.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!doctype html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
test(t => { | ||
let oncurrentchange_called = false; | ||
appHistory.oncurrentchange = t.step_func(e => { | ||
oncurrentchange_called = true; | ||
assert_equals(e.from, appHistory.entries()[0]); | ||
assert_equals(e.navigationType, "push"); | ||
assert_equals(appHistory.current.index, 1); | ||
}); | ||
history.pushState(1, "", "#1"); | ||
assert_true(oncurrentchange_called); | ||
}, "AppHistoryCurrentChangeEvent fires for history.pushState()"); | ||
</script> |
18 changes: 18 additions & 0 deletions
18
app-history/current-change-event/currentchange-history-replaceState.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!doctype html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
test(t => { | ||
let oncurrentchange_called = false; | ||
let original_current = appHistory.current; | ||
appHistory.oncurrentchange = t.step_func(e => { | ||
oncurrentchange_called = true; | ||
assert_equals(e.from, original_current); | ||
assert_equals(e.from.index, -1); | ||
assert_equals(e.navigationType, "replace"); | ||
assert_equals(appHistory.current.index, 0); | ||
}); | ||
history.replaceState(1, "", "#1"); | ||
assert_true(oncurrentchange_called); | ||
}, "AppHistoryCurrentChangeEvent fires for history.replaceState()"); | ||
</script> |
18 changes: 18 additions & 0 deletions
18
app-history/current-change-event/currentchange-location-api.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!doctype html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
test(t => { | ||
let oncurrentchange_called = false; | ||
let original_entry = appHistory.current; | ||
appHistory.oncurrentchange = t.step_func(e => { | ||
oncurrentchange_called = true; | ||
assert_equals(e.from, original_entry); | ||
assert_equals(e.from.index, -1); | ||
assert_equals(e.navigationType, "replace"); | ||
assert_equals(appHistory.current.index, 0); | ||
}); | ||
location.hash = "#foo"; | ||
assert_true(oncurrentchange_called); | ||
}, "AppHistoryCurrentChangeEvent fires for location API navigations"); | ||
</script> |
11 changes: 11 additions & 0 deletions
11
app-history/current-change-event/currentchange-naviagte-from-initial-about-blank.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!doctype html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<iframe id="i" src="/common/blank.html"></iframe> | ||
<script> | ||
promise_test(async t => { | ||
i.contentWindow.appHistory.oncurrentchange = t.unreached_func("currentchange should not fire"); | ||
i.contentWindow.appHistory.navigate("/common/blank.html#1"); | ||
await new Promise(resolve => i.onload = resolve); | ||
}, "AppHistoryCurrentChangeEvent does not fire when navigating away from the initial about:blank"); | ||
</script> |
14 changes: 14 additions & 0 deletions
14
app-history/current-change-event/currentchange-properties.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!doctype html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
async_test(t => { | ||
appHistory.oncurrentchange = t.step_func_done(e => { | ||
assert_equals(e.constructor, AppHistoryCurrentChangeEvent); | ||
assert_false(e.bubbles); | ||
assert_false(e.cancelable); | ||
assert_true(e.isTrusted); | ||
}); | ||
location.href = "#1"; | ||
}, "AppHistoryCurrentChangeEvent's properties"); | ||
</script> |
Oops, something went wrong.