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
Add a browsingContext.traverseHistory command #584
Conversation
Note that this is an extremely basic version of the command, that skips all the issues around trying to wait for the history navigation to complete (or even to start; we currently don't return an error if you try to navigate past the last position in the session history, or before the first position). However I think it's nearly enough for what Puppeteer does, the CDP's |
This traverses the history by a specified `delta` (e.g. +1 for forward, or -1 for back). For now there is no `wait` parameter; the command always returns as soon as the hsitory traversal has been enqueued (this should eventually be equivalent to setting wait to `none`). This model differs somewhat from the CDP model where one navigates to an explicit history entry and failure is only possible if the entry id is invalid. But back/forwward only seems closer to the use cases we have, and allowing events to be traced to a specific traversal seems consistent with the way we handle other navigation-related events.
4a0f922
to
fccc0a3
Compare
I've tried to fix the error issue by pre-checking the history entry exists. That's not perfect, but I think it's good enough for now. |
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 it would work for Puppeteer
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.
Generally looks fine to me as well. Just some questions for clarity.
<dd> | ||
<pre class="cddl local-cddl"> | ||
browsingContext.TraverseHistoryResult = { | ||
} |
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.
Should this for now be an EmptyResult
?
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.
Could do, but since we're planning to update this in the future it didn't seem helpful to change.
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.
The question is when this will happen. Also this current type is not extensible. But if all agree with this I'm fine as well.
SHA: d606672 Reason: push, by jgraham Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
FYI we will work the necessary wdspec tests when implementing this feature via https://bugzilla.mozilla.org/show_bug.cgi?id=1841018. |
<dt>Command Type</dt> | ||
<dd> | ||
<pre class="cddl remote-cddl"> | ||
BrowsingContext.TraverseHistory = { |
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.
Should be browsingContext
starting with lower case b
.
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.
Never mind. It is fixed in #601
This traverses the history by a specified
delta
(e.g. +1 for forward, or -1 for back).For now there is no
wait
parameter; the command always returns as soon as the hsitory traversal has been enqueued (this should eventually be equivalent to setting wait tonone
).This model differs somewhat from the CDP model where one navigates to an explicit history entry and failure is only possible if the entry id is invalid. But back/forwward only seems closer to the use cases we have, and allowing events to be traced to a specific traversal seems consistent with the way we handle other navigation-related events.
Preview | Diff