Open Bug 960506 Opened 10 years ago Updated 2 years ago

Navigation of an iframe by setting src or srcdoc should use the iframe element's document's browsing context as the source browsing context

Categories

(Core :: DOM: Navigation, defect)

defect

Tracking

()

People

(Reporter: bobowen, Assigned: bobowen)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

As per the spec here:
http://www.whatwg.org/specs/web-apps/current-work/multipage/the-iframe-element.html#process-the-iframe-attributes

"Any navigation required of the user agent in the process the iframe attributes algorithm must be completed as an explicit self-navigation override and with the iframe element's document's browsing context as the source browsing context."
Blocks: 960563
Once I'd tracked this through the code it all led to one call to nsDocShell::LoadURI, so this was pretty easy.

It is the same code for old fashioned frames as well, and unsurprisingly these are specified to behave in the same way.

A parent can always navigate its child, so the behaviour is no different than passing a null Source Browsing Context.
It would only come into play for referrer (when we start using Source Browsing Context) and seamless attribute (when we implement it).

Given that, I can't think how to create automated tests for this short of adding hooks into nsDocShell::InternalLoad so I can observe the passed parameters.
That seems like overkill to me.

I've tested it in debug to make sure the correct docshell is being passed for src and srcdoc.

try push: https://tbpl.mozilla.org/?tree=Try&rev=482068c85bda
Assignee: nobody → bobowencode
Attachment #8370783 - Flags: review?(bobbyholley)
Comment on attachment 8370783 [details] [diff] [review]
Bug 960506 fix v1 - Use element's owning document's docshell as source docshell (browsing context) when navigating i/frame with src or srcdoc.

Review of attachment 8370783 [details] [diff] [review]:
-----------------------------------------------------------------

Can you add a test that makes sure that referrer is correct in this situation, so that it'll start testing this code when we switch over to it?

r=me with that.
Attachment #8370783 - Flags: review?(bobbyholley) → review+
Severity: minor → S4
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: