-
Notifications
You must be signed in to change notification settings - Fork 26
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
Initial spec for appHistory.navigate() and event.destination #96
Conversation
@@ -135,12 +136,32 @@ interface AppHistory : EventTarget { | |||
readonly attribute boolean canGoBack; | |||
readonly attribute boolean canGoForward; | |||
|
|||
Promise<undefined> navigate(USVString url, optional AppHistoryNavigateOptions options = {}); | |||
Promise<undefined> navigate(optional AppHistoryNavigateOptions options = {}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace is not actually consulted for this overload. Perhaps we should use a fresh dictionary? This is actually observable in that the getter for replace
will be called, whereas if we used a fresh dictionary it would not be called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ok for now, but we should think more about this.
Should options
be required for the no-url variant? It seems nonsensical to call navigate() with 0-args.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Web IDL requires that trailing dictionaries be optional, even if logically they are not optional. See whatwg/webidl#903.
Probably we should include a comment since this is confusing to people.
This has the impact of making appHistory.navigate("#foo", { state }) work instead of ignore the state (even when there's no navigate event handler)
@@ -135,12 +136,32 @@ interface AppHistory : EventTarget { | |||
readonly attribute boolean canGoBack; | |||
readonly attribute boolean canGoForward; | |||
|
|||
Promise<undefined> navigate(USVString url, optional AppHistoryNavigateOptions options = {}); | |||
Promise<undefined> navigate(optional AppHistoryNavigateOptions options = {}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ok for now, but we should think more about this.
Should options
be required for the no-url variant? It seems nonsensical to call navigate() with 0-args.
Note to self: if the |
(This is in the broad sense of "navigation", which includes the navigate algorithm, history traversal, and pushState()/replaceState(). I.e., anything that would fire a navigate event, even if it doesn't.) Discussed in #96 (comment).
I.e., make sure that the rest of the algorithm doesn't think we called respondWith(). This is important for #96.
The behavior in https://chromium-review.googlesource.com/c/chromium/src/+/2822057 is to reject the promise, on the logic that detaching the window effectively aborts all navigations. |
Hmm, it seems we've run into whatwg/html#2621 ... |
Ah OK, it still works. Microtasks, unlike tasks, are not document-bound. |
…pondWith(Promise.reject())
(This is in the broad sense of "navigation", which includes the navigate algorithm, history traversal, and pushState()/replaceState(). I.e., anything that would fire a navigate event, even if it doesn't.) Discussed in #96 (comment).
# Conflicts: # spec.bs
Great, this is rebased on top of all the somewhat-related changes and is ready for re-review. |
# Conflicts: # spec.bs
Regarding #95, for now the promise never settles for cross-document navigations.
Regarding #97, for now I specified
url
,sameDocument
(not changing), andgetState()
.Preview | Diff