Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blink: PopState and NavigateEvent init + ship hasUAVisualTransition #41623

Merged
merged 1 commit into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,25 @@
assert_equals(popStateEvent.state, null, "the PopStateEvent.state");
}, "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>
17 changes: 16 additions & 1 deletion navigation-api/navigate-event/event-constructor.html
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -59,7 +60,8 @@
signal,
formData,
downloadRequest,
info
info,
hasUAVisualTransition
});

assert_equals(event.navigationType, "replace");
Expand All @@ -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");
Expand All @@ -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>