Skip to content

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

Open
JonasTaulien wants to merge 1 commit into
w3c:masterfrom
JonasTaulien:patch-1
Open

'Get Window Handles' returns window handles ordered by timestamp of creation#1123
JonasTaulien wants to merge 1 commit into
w3c:masterfrom
JonasTaulien:patch-1

Conversation

@JonasTaulien

@JonasTaulien JonasTaulien commented Oct 6, 2017

Copy link
Copy Markdown

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
Copy Markdown
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

jgraham commented Nov 6, 2017

Copy link
Copy Markdown
Member

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

@andreastt

Copy link
Copy Markdown
Member

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

@shs96c

shs96c commented May 14, 2018

Copy link
Copy Markdown
Contributor

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