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

'Get Window Handles' returns window handles ordered by timestamp of creation #1123

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

JonasTaulien
Copy link

@JonasTaulien JonasTaulien commented Oct 6, 2017

I suggest, that the Get Window handles command returns the window handles in ascending order, sorted by the timestamp of the creation of their associated top-level browsing context.
By doing this, testers can rely on the fact, that the first window handle in the list represents the window, with which the test was started and the last window handle in the list represents the most recently opened window.

There also is a StackOverflow question [0] with ~200k views from which the accepted answer suggests to just switch to the last window handle when one wants to switch to the most recently opened browsing context. While researching I also found other humans (examples: [1][2]) wrongly asserting that behaviour of the command.

I think, this improvement would be really helpful .

What do you think?


This change is Reviewable

@andreastt andreastt added this to the Level 2 milestone Oct 9, 2017
@andreastt
Copy link
Member

The last time we discussed this, we landed on explicitly calling out arbitrary ordering of window handles because it is difficult to achieve what you are describing in some user agents. The reality of this may have changed, however, so I think it could be worth revisiting this discussion for level 2.

Certainly I would love for there to be some determinism about how window handles are ordered.

@jgraham
Copy link
Member

jgraham commented Nov 6, 2017

Per the testing policy, this PR can't be accepted without a corresponding test in the web-platform-tests repository.

@andreastt
Copy link
Member

@jonasrudolph Do you have time to follow up on @jgraham’s note? I’d be happy to review tests to WPT.

@shs96c
Copy link
Contributor

shs96c commented May 14, 2018

I'm not sure whether this will provide a stable ordering in all cases (for example, start a timer that opens a window once it expires, then have a loop that opens windows --- what's the expected stable ordering), and requires the browser to track when the window was opened.

Admittedly, the example given here is a pathological case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants