This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 29316 - clicking 'back' when an an iframe should not navigate the top-level browsing context
Summary: clicking 'back' when an an iframe should not navigate the top-level browsing ...
Status: RESOLVED FIXED
Alias: None
Product: Browser Test/Tools WG
Classification: Unclassified
Component: WebDriver (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Andreas Tolfsen
QA Contact: Browser Testing and Tools WG
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 20860
  Show dependency treegraph
 
Reported: 2015-11-30 17:46 UTC by John Jansen
Modified: 2016-01-04 21:49 UTC (History)
4 users (show)

See Also:


Attachments

Description John Jansen 2015-11-30 17:46:12 UTC
the spec says, "The Back command
 causes the browser to traverse one step backward
 in the joint session history of the current top-level browsing context."

If you have done a switch to iframe, then the 'back' command should probably navigate back inside the iframe because this is what happens when you browse as a human.
Comment 1 James Graham 2015-11-30 18:21:18 UTC
This specifies the typical behaviour of the back button. Making the navigation frame specific would not be the way that most browsers behave when back is clicked.
Comment 2 John Jansen 2015-12-01 23:44:18 UTC
I want to make sure my understanding here is correct. My usecase is to browse to a parent page that has an IFrame, click a link in that IFrame and then hit the back button. In all browsers, doing this will navigate the IFrame back to the initial state. However, if I use the .back command in WebDriver, it is supposed to navigate back the parent page.

Is there a different command I'm missing for navigating back within the iframe?
Comment 3 James Graham 2015-12-02 00:21:18 UTC
Well that's not how I understand what it's supposed to do; if the intent was just to navigate the parent page then the spec is wrong. I don't think the intent should be to just navigate the parent page though. This seems like a case where the philosophy of "act like a user" makes sense; clicking the back button in a browser will go back in the joint session history, which is what the spec says to do.
Comment 4 Andreas Tolfsen 2015-12-08 21:33:07 UTC
Actually my tests show that the back/forward buttons will navigate the history delta of the active document, that is the iframe.  Since WebDriver is supposed to implement the behaviour of the back button, this bug is valid.

The HTML standard says for “traversing the history by a delta” that the document that is to be navigated should be the “specified browsing context’s active document”, not of the top-level browsing context: https://html.spec.whatwg.org/multipage/browsers.html#traverse-the-history-by-a-delta
Comment 5 Andreas Tolfsen 2015-12-09 16:53:44 UTC
My above comment is misleading on one point: You traverse the _joint session history_ of the top-level browsing context.  This is:

> […] the union of all the session histories of
> all browsing contexts of
> all the fully active Document objects
> that share that top-level browsing context,
> with all the entries that are current entries
> in their respective session histories
> except for the current entry of the joint session history.

John, this describes exactly what you want, in that the back command should navigate back _inside_ the iframe if that is the most recent entry in the join session history.

We tap into this by traversing said history by a delta of -1.

That said, I think the HTML standard is confusing on this topic and I think we could make this clearer with an addition of some non-normative prose to describe in simpler terms what is the intention of the command.
Comment 6 Andreas Tolfsen 2015-12-09 17:16:50 UTC
Submitted https://github.com/w3c/webdriver/pull/284 to provide a simpler description of its intention.
Comment 7 David Burns :automatedtester 2016-01-04 21:49:22 UTC
landed in f2b23e9