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

App history API to navigation API rename (3/n) #33184

Merged
merged 1 commit into from Mar 16, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 0 additions & 11 deletions navigation-api/README.md

This file was deleted.

2 changes: 1 addition & 1 deletion navigation-api/currententrychange-event/anchor-click.html
Expand Up @@ -14,5 +14,5 @@
});
a.click();
assert_true(oncurrententrychange_called);
}, "AppHistoryCurrentChangeEvent fires for link click");
}, "currententrychange fires for link click");
</script>
8 changes: 4 additions & 4 deletions navigation-api/currententrychange-event/constructor.html
Expand Up @@ -4,20 +4,20 @@
<script>
test(() => {
assert_throws_js(TypeError, () => {
new AppHistoryCurrentChangeEvent("currententrychange");
new NavigationCurrentEntryChangeEvent("currententrychange");
});
}, "can't bypass required members by omitting the dictionary entirely");

test(() => {
assert_throws_js(TypeError, () => {
new AppHistoryCurrentChangeEvent("currententrychange", {
new NavigationCurrentEntryChangeEvent("currententrychange", {
navigationType: "push"
});
});
}, "from is required");

test(() => {
const event = new AppHistoryCurrentChangeEvent("currententrychange", {
const event = new NavigationCurrentEntryChangeEvent("currententrychange", {
navigationType: "replace",
from: navigation.currentEntry
});
Expand All @@ -26,7 +26,7 @@
}, "all properties are reflected back");

test(t => {
const event = new AppHistoryCurrentChangeEvent("currententrychange", { from: navigation.currentEntry });
const event = new NavigationCurrentEntryChangeEvent("currententrychange", { from: navigation.currentEntry });
assert_equals(event.navigationType, null);
}, "defaults are as expected");
</script>
Expand Up @@ -20,5 +20,5 @@
assert_false(oncurrententrychange_called);
await new Promise(resolve => window.onpopstate = resolve);
assert_true(oncurrententrychange_called);
}, "AppHistoryCurrentChangeEvent fires for history.back()");
}, "currententrychange fires for history.back()");
</script>
Expand Up @@ -12,5 +12,5 @@
});
history.pushState(1, "", "#1");
assert_true(oncurrententrychange_called);
}, "AppHistoryCurrentChangeEvent fires for history.pushState()");
}, "currententrychange fires for history.pushState()");
</script>
Expand Up @@ -14,5 +14,5 @@
});
history.replaceState(1, "", "#1");
assert_true(oncurrententrychange_called);
}, "AppHistoryCurrentChangeEvent fires for history.replaceState()");
}, "currententrychange fires for history.replaceState()");
</script>
2 changes: 1 addition & 1 deletion navigation-api/currententrychange-event/location-api.html
Expand Up @@ -14,5 +14,5 @@
});
location.hash = "#foo";
assert_true(oncurrententrychange_called);
}, "AppHistoryCurrentChangeEvent fires for location API navigations");
}, "currententrychange fires for location API navigations");
</script>
Expand Up @@ -11,5 +11,5 @@
assert_equals(w.location.href, "about:blank#2");

await new Promise(resolve => t.step_timeout(resolve, 10));
}, "AppHistoryCurrentChangeEvent does not fire when navigating away from the initial about:blank (popup window)");
}, "currententrychange does not fire when navigating away from the initial about:blank (popup window)");
</script>
Expand Up @@ -8,5 +8,5 @@
i.contentWindow.location.href = "about:blank#1";
i.contentWindow.location.href = "about:blank#2";
await new Promise(resolve => t.step_timeout(resolve, 10));
}, "AppHistoryCurrentChangeEvent does not fire when navigating away from the initial about:blank");
}, "currententrychange does not fire when navigating away from the initial about:blank");
</script>
Expand Up @@ -7,5 +7,5 @@
i.contentWindow.navigation.oncurrententrychange = t.unreached_func("currententrychange should not fire");
i.contentWindow.navigation.navigate("/common/blank.html");
await new Promise(resolve => t.step_timeout(resolve, 10));
}, "AppHistoryCurrentChangeEvent does not fire when navigating away from the initial about:blank");
}, "currententrychange does not fire when navigating away from the initial about:blank");
</script>
Expand Up @@ -16,5 +16,5 @@
i.contentWindow.navigation.oncurrententrychange = t.unreached_func("currententrychange should not fire for cross-document navigations");
i.contentWindow.navigation.forward();
await new Promise(resolve => i.onload = resolve);
}, "AppHistoryCurrentChangeEvent does not fire for cross-document navigation.back() and navigation.forward()");
}, "currententrychange does not fire for cross-document navigation.back() and navigation.forward()");
</script>
Expand Up @@ -36,5 +36,5 @@
assert_false(oncurrententrychange_forward_called);
await forward_result.committed.then(() => forward_committed = true);
assert_true(oncurrententrychange_forward_called);
}, "AppHistoryCurrentChangeEvent fires for navigation.back() and navigation.forward()");
}, "currententrychange fires for same-document navigation.back() and navigation.forward()");
</script>
Expand Up @@ -8,5 +8,5 @@
i.contentWindow.navigation.oncurrententrychange = t.unreached_func("currententrychange should not fire for cross-document navigations");
i.contentWindow.navigation.navigate("/common/blank.html?1");
await new Promise(resolve => i.onload = resolve);
}, "AppHistoryCurrentChangeEvent does not fire for cross-document navigation.navigate()");
}, "currententrychange does not fire for cross-document navigation.navigate()");
</script>
Expand Up @@ -6,5 +6,5 @@
navigation.oncurrententrychange = t.unreached_func("currententrychange should not fire");
navigation.onnavigate = e => e.preventDefault();
await promise_rejects_dom(t, "AbortError", navigation.navigate("#foo").committed);
}, "AppHistoryCurrentChangeEvent does not fire when onnavigate preventDefault() is called");
}, "currententrychange does not fire when onnavigate preventDefault() is called");
</script>
Expand Up @@ -8,5 +8,5 @@
i.contentWindow.navigation.oncurrententrychange = t.unreached_func("currententrychange should not fire for cross-document navigations");
i.contentWindow.navigation.navigate("/common/blank.html?1", { replace: true });
await new Promise(resolve => i.onload = resolve);
}, "AppHistoryCurrentChangeEvent does not fire for cross-document navigation.navigate() with replace");
}, "currententrychange does not fire for cross-document navigation.navigate() with replace");
</script>
Expand Up @@ -19,5 +19,5 @@
let result = navigation.navigate("#foo", { replace: true });
assert_true(oncurrententrychange_called);
await result.committed;
}, "AppHistoryCurrentChangeEvent fires for navigation.navigate() with replace");
}, "currententrychange fires for navigation.navigate() with replace");
</script>
Expand Up @@ -19,5 +19,5 @@
let result = i.contentWindow.navigation.navigate("/common/blank.html?1", { replace: true });
assert_true(oncurrententrychange_called);
await result.committed;
}, "AppHistoryCurrentChangeEvent fires for navigation.navigate() with replace intercepted by transitionWhile");
}, "currententrychange fires for navigation.navigate() with replace intercepted by transitionWhile()");
</script>
Expand Up @@ -17,5 +17,5 @@
let result = navigation.navigate("#foo");
assert_true(oncurrententrychange_called);
await result.committed;
}, "AppHistoryCurrentChangeEvent fires for navigation.navigate()");
}, "currententrychange fires for navigation.navigate()");
</script>
Expand Up @@ -17,5 +17,5 @@
let result = i.contentWindow.navigation.navigate("/common/blank.html?1");
assert_true(oncurrententrychange_called);
await result.committed;
}, "AppHistoryCurrentChangeEvent fires for navigation.navigate() intercepted by transitionWhile");
}, "currententrychange fires for navigation.navigate() intercepted by transitionWhile()");
</script>
Expand Up @@ -8,5 +8,5 @@
i.contentWindow.navigation.oncurrententrychange = t.unreached_func("currententrychange should not fire for cross-document navigations");
i.contentWindow.navigation.reload();
await new Promise(resolve => i.onload = resolve);
}, "AppHistoryCurrentChangeEvent does not fire for cross-document navigation.reload()");
}, "currententrychange does not fire for cross-document navigation.reload()");
</script>
Expand Up @@ -17,5 +17,5 @@
let result = i.contentWindow.navigation.reload();
assert_true(oncurrententrychange_called);
await result.committed;
}, "AppHistoryCurrentChangeEvent fires for navigation.reload() intercepted by transitionWhile");
}, "currententrychange fires for navigation.reload() intercepted by transitionWhile()");
</script>
Expand Up @@ -16,5 +16,5 @@
// "Updating" the state to the current state should still fire currententrychange.
navigation.updateCurrentEntry({ state: navigation.currentEntry.getState() });
assert_equals(oncurrententrychange_count, 2);
}, "AppHistoryCurrentChangeEvent fires for navigation.updateCurrentEntry()");
}, "currententrychange fires for navigation.updateCurrentEntry()");
</script>
4 changes: 2 additions & 2 deletions navigation-api/currententrychange-event/properties.html
Expand Up @@ -4,11 +4,11 @@
<script>
async_test(t => {
navigation.oncurrententrychange = t.step_func_done(e => {
assert_equals(e.constructor, AppHistoryCurrentChangeEvent);
assert_equals(e.constructor, NavigationCurrentEntryChangeEvent);
assert_false(e.bubbles);
assert_false(e.cancelable);
assert_true(e.isTrusted);
});
location.href = "#1";
}, "AppHistoryCurrentChangeEvent's properties");
}, "NavigationCurrentEntryChangeEvent's properties");
</script>
16 changes: 8 additions & 8 deletions navigation-api/navigate-event/event-constructor.html
Expand Up @@ -4,13 +4,13 @@
<script>
test(() => {
assert_throws_js(TypeError, () => {
new AppHistoryNavigateEvent("navigate");
new NavigateEvent("navigate");
});
}, "can't bypass required members by omitting the dictionary entirely");

test(() => {
assert_throws_js(TypeError, () => {
new AppHistoryNavigateEvent("navigate", {
new NavigateEvent("navigate", {
navigationType: "push",
canTransition: false,
userInitiated: false,
Expand All @@ -23,10 +23,10 @@
}, "destination is required");

async_test(t => {
// We need to grab an AppHistoryDestination.
// We need to grab an NavigationDestination.
navigation.onnavigate = t.step_func_done(e => {
assert_throws_js(TypeError, () => {
new AppHistoryNavigateEvent("navigate", {
new NavigateEvent("navigate", {
navigationType: "push",
destination: e.destination,
canTransition: false,
Expand All @@ -41,13 +41,13 @@
}, "signal is required");

async_test(t => {
// We need to grab an AppHistoryDestination.
// We need to grab an NavigationDestination.
navigation.onnavigate = t.step_func_done(e => {
const info = { some: "object with identity" };
const formData = new FormData();
const signal = (new AbortController()).signal;

const event = new AppHistoryNavigateEvent("navigate", {
const event = new NavigateEvent("navigate", {
navigationType: "replace",
destination: e.destination,
canTransition: true,
Expand All @@ -71,9 +71,9 @@
}, "all properties are reflected back");

async_test(t => {
// We need to grab an AppHistoryDestination.
// We need to grab an NavigationDestination.
navigation.onnavigate = t.step_func_done(e => {
const event = new AppHistoryNavigateEvent("navigate", {
const event = new NavigateEvent("navigate", {
destination: e.destination,
signal: (new AbortController()).signal
});
Expand Down
Expand Up @@ -17,5 +17,5 @@
await promise_rejects_dom(t, 'AbortError', iframe_constructor, i.contentWindow.navigation.navigate("#1").committed);
assert_true(abort_signal.aborted);
assert_true(onabort_called);
}, "window detach inside AppHistoryNavigateEvent signals AppHistoryNavigateEvent.signal");
}, "window detach inside a navigate event signals event.signal");
</script>
Expand Up @@ -15,5 +15,5 @@
await promise_rejects_dom(t, 'AbortError', navigation.navigate("?1").committed);
assert_true(abort_signal.aborted);
assert_array_equals(events, ["onabort", "onnavigateerror"]);
}, "AppHistoryNavigateEvent.preventDefault signals AppHistoryNavigateEvent.signal");
}, "event.preventDefault() signals event.signal");
</script>
Expand Up @@ -14,5 +14,5 @@
await navigation.navigate("?1").finished;
assert_false(abort_signal.aborted);
assert_false(onabort_called);
}, "AppHistoryNavigateEvent's transitionWhile() does not signal AppHistoryNavigateEvent's signal");
}, "event.transitionWhile() does not signal event.signal");
</script>
Expand Up @@ -36,5 +36,5 @@
t.step_timeout(t.step_func_done(() => {}), 5);
});
});
}, "window.stop() cancels AppHistoryNavigateEvent's transitionWhile() and signals AppHistoryNavigateEvent's signal");
}, "window.stop() cancels the navigate event's transitionWhile() and signals event.signal");
</script>
Expand Up @@ -20,5 +20,5 @@
assert_true(onabort_called);
assert_true(canceled_in_second_handler);
});
}, "window.stop() signals AppHistoryNavigateEvent.signal inside a navigate event handler");
}, "window.stop() signals event.signal inside a navigate event handler");
</script>
Expand Up @@ -19,5 +19,5 @@
// didn't fire on a microtask.
t.step_timeout(t.step_func_done(() => {}), 0);
});
}, "window.stop() signals AppHistoryNavigateEvent.signal");
}, "window.stop() signals event.signal");
</script>
Expand Up @@ -12,5 +12,5 @@
});

location.href = "#1";
}, "AppHistoryNavigateEvent's transitionWhile() throws if used after the dispatch phase");
}, "event.transitionWhile() throws if used after the dispatch phase");
</script>
Expand Up @@ -13,5 +13,5 @@

location.href = "#1";
assert_true(assertionHappened);
}, "AppHistoryNavigateEvent's transitionWhile() throws if used on a canceled event");
}, "event.transitionWhile() throws if used on a canceled event");
</script>
Expand Up @@ -15,5 +15,5 @@
});

window.onload = t.step_func(() => location.href = target_url);
}, "AppHistoryNavigateEvent's transitionWhile() intercepts a same-origin cross-document navigation");
}, "event.transitionWhile() intercepts a same-origin cross-document navigation");
</script>
Expand Up @@ -14,5 +14,5 @@
});

window.onload = t.step_func(() => location.href = get_host_info().HTTPS_REMOTE_ORIGIN);
}, "AppHistoryNavigateEvent's transitionWhile() should throw if called for a cross origin navigation");
}, "event.transitionWhile() should throw if called for a cross origin navigation");
</script>
2 changes: 1 addition & 1 deletion navigation-api/navigate-event/transitionWhile-detach.html
Expand Up @@ -13,5 +13,5 @@

i.contentWindow.location.href = "#1";
});
}, "AppHistoryNavigateEvent's transitionWhile() throws if used on an event from a detached iframe");
}, "event.transitionWhile() throws if used on an event from a detached iframe");
</script>
Expand Up @@ -19,5 +19,5 @@
assert_equals(location.hash, "#1");
assert_equals(history.state, "update");
assert_equals(history.length, start_length + 1);
}, "AppHistoryNavigateEvent's transitionWhile() should proceed if the given promise resolves");
}, "event.transitionWhile() should proceed if the given promise resolves");
</script>
Expand Up @@ -19,5 +19,5 @@
assert_equals(location.hash, "#1");
assert_equals(history.state, "update");
assert_equals(history.length, start_length);
}, "AppHistoryNavigateEvent's transitionWhile() should proceed if the given promise resolves");
}, "event.transitionWhile() should proceed if the given promise resolves");
</script>
Expand Up @@ -31,5 +31,5 @@
}));
assert_true(onnavigateerror_called);
assert_true(caught_rejection);
}, "AppHistoryNavigateEvent's transitionWhile() is called multiple times and one of the promises rejects");
}, "event.transitionWhile() is called multiple times and one of the promises rejects");
</script>
Expand Up @@ -37,5 +37,5 @@
assert_true(p1_resolved);
assert_true(p2_resolved);
assert_true(p3_resolved);
}, "navigation.navigate() returns a finished promise that awaits all promises if AppHistoryNavigateEvent's transitionWhile() is called multiple times");
}, "navigation.navigate() returns a finished promise that awaits all promises if event.transitionWhile() is called multiple times");
</script>
Expand Up @@ -15,5 +15,5 @@
}));
});
}, 0);
}, "AppHistoryNavigateEvent's transitionWhile() can intercept navigation.back()");
}, "event.transitionWhile() can intercept navigation.back()");
</script>
Expand Up @@ -3,15 +3,15 @@
<script src="/resources/testharnessreport.js"></script>
<script>
async_test(t => {
// We need to grab an AppHistoryDestination to construct the event.
// We need to grab an NavigationDestination to construct the event.
navigation.onnavigate = t.step_func_done(e => {
const event = new AppHistoryNavigateEvent("navigate", {
const event = new NavigateEvent("navigate", {
destination: e.destination,
signal: (new AbortController()).signal
});

assert_throws_dom("SecurityError", () => event.transitionWhile(Promise.resolve()));
});
history.pushState(1, null, "#1");
}, "AppHistoryNavigateEvent's transitionWhile() throws if invoked on a synthetic event");
}, "event.transitionWhile() throws if invoked on a synthetic event");
</script>
2 changes: 1 addition & 1 deletion navigation-api/navigate-event/transitionWhile-reject.html
Expand Up @@ -22,5 +22,5 @@

location.href = "#1";
assert_equals(location.hash, "#1");
}, "AppHistoryNavigateEvent's transitionWhile() should abort if the given promise rejects");
}, "event.transitionWhile() should abort if the given promise rejects");
</script>