blink: PopState and NavigateEvent init + ship hasUAVisualTransition
This change implements the following:
- Fix PopStateEvent and NavigateEvent initializers to take
hasUAVisualTransition. See spec change at
https://github.com/whatwg/html/pull/9628.
- Ship hasUAVisualTransition. See approved I2S at:
https://groups.google.com/a/chromium.org/g/blink-dev/c/OTGqhEZ7aug/m/tDfjCG4KAQAJ
R=vmpstr@chromium.org
Fixed: 1470029
Change-Id: I2385cd87df8d823e40d6de88efcc348de168370c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4811335
Auto-Submit: Khushal Sagar <khushalsagar@chromium.org>
Reviewed-by: Vladimir Levin <vmpstr@chromium.org>
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Commit-Queue: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1187983}
diff --git a/html/browsers/browsing-the-web/history-traversal/PopStateEvent.html b/html/browsers/browsing-the-web/history-traversal/PopStateEvent.html
index 5774c15..9ee7576 100644
--- a/html/browsers/browsing-the-web/history-traversal/PopStateEvent.html
+++ b/html/browsers/browsing-the-web/history-traversal/PopStateEvent.html
@@ -24,15 +24,24 @@
}, "Initial value of PopStateEvent.state must be null");
test(function () {
+ var popStateEvent = new PopStateEvent("popstate");
+ assert_false(popStateEvent.hasUAVisualTransition, "the PopStateEvent.hasUAVisualTransition");
+}, "Initial value of PopStateEvent.hasUAVisualTransition must be false");
+
+test(function () {
var state = history.state;
var data;
+ var hasUAVisualTransition = false;
window.addEventListener('popstate', function (e) {
data = e.state;
+ hasUAVisualTransition = e.hasUAVisualTransition;
});
window.dispatchEvent(new PopStateEvent('popstate', {
- 'state': {testdata:true}
+ 'state': {testdata:true},
+ 'hasUAVisualTransition': true
}));
assert_true(data.testdata,'state data was corrupted');
assert_equals(history.state, state, "history.state was NOT set by dispatching the event");
+ assert_true(hasUAVisualTransition, 'hasUAVisualTransition not set correctly');
}, 'Dispatching a synthetic PopStateEvent');
</script>
diff --git a/navigation-api/navigate-event/event-constructor.html b/navigation-api/navigate-event/event-constructor.html
index 0658842..a668730 100644
--- a/navigation-api/navigate-event/event-constructor.html
+++ b/navigation-api/navigate-event/event-constructor.html
@@ -49,6 +49,7 @@
const formData = new FormData();
const signal = (new AbortController()).signal;
const downloadRequest = "abc";
+ const hasUAVisualTransition = true;
const event = new NavigateEvent("navigate", {
navigationType: "replace",
@@ -59,7 +60,8 @@
signal,
formData,
downloadRequest,
- info
+ info,
+ hasUAVisualTransition
});
assert_equals(event.navigationType, "replace");
@@ -71,6 +73,7 @@
assert_equals(event.formData, formData);
assert_equals(event.downloadRequest, downloadRequest);
assert_equals(event.info, info);
+ assert_equals(event.hasUAVisualTransition, hasUAVisualTransition);
});
history.pushState(2, null, "#2");
}, "all properties are reflected back");
@@ -93,4 +96,16 @@
});
history.pushState(3, null, "#3");
}, "defaults are as expected");
+
+async_test(t => {
+ navigation.onnavigate = t.step_func_done(e => {
+ const event = new NavigateEvent("navigate", {
+ destination: e.destination,
+ signal: (new AbortController()).signal
+ });
+
+ assert_false(event.hasUAVisualTransition);
+ });
+ history.pushState(3, null, "#3");
+}, "hasUAVisualTransition is default false");
</script>