-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AppHistory ongoing navigation tracking
Change-Id: I1cb78990a52a10a44325734eed5736507564ebb9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3044718 Commit-Queue: Nate Chapin <japhet@chromium.org> Reviewed-by: Domenic Denicola <domenic@chromium.org> Cr-Commit-Position: refs/heads/master@{#909066}
- Loading branch information
1 parent
f27ebe5
commit a143b9b
Showing
11 changed files
with
303 additions
and
145 deletions.
There are no files selected for viewing
286 changes: 173 additions & 113 deletions
286
third_party/blink/renderer/core/app_history/app_history.cc
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
3 changes: 2 additions & 1 deletion
3
.../web_tests/external/wpt/app-history/navigate-event/signal-abort-detach-in-onnavigate.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
4 changes: 0 additions & 4 deletions
4
...al/wpt/app-history/navigate-event/signal-abort-window-stop-after-respondWith-expected.txt
This file was deleted.
Oops, something went wrong.
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
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
26 changes: 26 additions & 0 deletions
26
third_party/blink/web_tests/external/wpt/app-history/navigate/navigate-beforeunload.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> | ||
<iframe id="i" src="/common/blank.html"></iframe> | ||
<script> | ||
promise_test(async t => { | ||
await new Promise(resolve => window.onload = resolve); | ||
let navigate_event_count = 0; | ||
i.contentWindow.appHistory.onnavigate = () => navigate_event_count++; | ||
i.contentWindow.appHistory.onnavigatesuccess = t.unreached_func('onnavigatesuccess should not be called'); | ||
i.contentWindow.appHistory.onnavigateerror = t.unreached_func('onnavigateerror should not be called'); | ||
let onbeforeunload_promise; | ||
// The iframe does not have sticky activation, so per | ||
// https://html.spec.whatwg.org/#prompt-to-unload-a-document, no prompt is | ||
// shown and the navigation will proceed. | ||
i.contentWindow.onbeforeunload = t.step_func(() => { | ||
onbeforeunload_promise = i.contentWindow.appHistory.navigate("#").catch(e => { | ||
assert_equals(e.constructor, i.contentWindow.DOMException); | ||
assert_equals(e.name, "InvalidStateError"); | ||
}); | ||
}); | ||
i.contentWindow.appHistory.navigate("?1"); | ||
await onbeforeunload_promise; | ||
assert_equals(navigate_event_count, 1); | ||
}, "Navigate inside onbeforeunload"); | ||
</script> |
21 changes: 21 additions & 0 deletions
21
...nal/wpt/app-history/navigate/navigate-in-initial-about-blank-document-cross-document.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 src="/resources/get-host-info.js"></script> | ||
<body> | ||
<script> | ||
promise_test(async t => { | ||
let i = document.createElement("iframe"); | ||
document.body.appendChild(i); | ||
i.contentWindow.appHistory.onnavigate = t.unreached_func('onnavigate should not be called'); | ||
i.contentWindow.appHistory.onnavigatesuccess = t.unreached_func('onnavigatesuccess should not be called'); | ||
i.contentWindow.appHistory.onnavigateerror = t.unreached_func('onnavigateerror should not be called'); | ||
let promise_resolved = false; | ||
i.contentWindow.appHistory.navigate(new URL("/common/blank.html?1", location.href).href) | ||
.then(() => promise_resolved = true); | ||
await new Promise(resolve => i.onload = resolve); | ||
assert_equals(i.contentWindow.location.search, "?1"); | ||
assert_false(promise_resolved); | ||
}, "navigate in initial about:blank document"); | ||
</script> | ||
</body> |
16 changes: 16 additions & 0 deletions
16
...web_tests/external/wpt/app-history/navigate/navigate-in-initial-about-blank-document.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> | ||
<body> | ||
<script> | ||
promise_test(async t => { | ||
let i = document.createElement("iframe"); | ||
document.body.appendChild(i); | ||
let navigate_event_count = 0; | ||
i.contentWindow.appHistory.onnavigate = t.unreached_func('onnavigate should not be called'); | ||
i.contentWindow.appHistory.onnavigatesuccess = t.unreached_func('onnavigatesuccess should not be called'); | ||
i.contentWindow.appHistory.onnavigateerror = t.unreached_func('onnavigateerror should not be called'); | ||
await i.contentWindow.appHistory.navigate("#"); | ||
}, "navigate in initial about:blank document"); | ||
</script> | ||
</body> |
24 changes: 24 additions & 0 deletions
24
third_party/blink/web_tests/external/wpt/app-history/navigate/navigate-unload.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,24 @@ | ||
<!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 navigate_event_count = 0; | ||
i.contentWindow.appHistory.onnavigate = () => navigate_event_count++; | ||
i.contentWindow.appHistory.onnavigatesuccess = t.unreached_func('onnavigatesuccess should not be called'); | ||
i.contentWindow.appHistory.onnavigateerror = t.unreached_func('onnavigateerror should not be called'); | ||
i.contentWindow.appHistory.navigate("?1"); | ||
await new Promise(resolve => { | ||
i.contentWindow.onunload = t.step_func(() => { | ||
i.contentWindow.appHistory.navigate("#").catch(e => { | ||
assert_equals(e.constructor, i.contentWindow.DOMException); | ||
assert_equals(e.name, "InvalidStateError"); | ||
resolve(); | ||
}); | ||
}); | ||
}); | ||
assert_equals(navigate_event_count, 1); | ||
}, "Navigate inside onunload"); | ||
</script> |