Open
Bug 1207283
Opened 10 years ago
Updated 3 years ago
nsDocShell::LoadURI makes the wrong decision for using the parent's session history object to override the URL of an iframe
Categories
(Core :: DOM: Navigation, defect)
Core
DOM: Navigation
Tracking
()
NEW
People
(Reporter: mconley, Unassigned)
Details
Attachments
(1 obsolete file)
STR (by ehsan):
1) View the attached testcase
2) The page's iframe should say "sucker"
3) Reload the page
ER:
The iframe should not say "sucker" after the reload.
AR:
The iframe says "sucker".
It looks like we're falling into this branch: https://dxr.mozilla.org/mozilla-central/rev/a1ccea59e254a88f7bb44b0ad8a58b77b7eca339/docshell/base/nsDocShell.cpp#1394
Which is causing us to retrieve the data URI from the shEntry to set the iframe's URI to.
| Reporter | ||
Comment 1•10 years ago
|
||
| Reporter | ||
Comment 2•10 years ago
|
||
Comment on attachment 8664406 [details]
testcase.html
Strangely, this bug doesn't appear over HTTPS. :/
How about this: http://people.mozilla.org/~mconley2/moz/weird-testcase.html
Attachment #8664406 -
Attachment is obsolete: true
Comment 4•10 years ago
|
||
Yes, it is. When reloading, we reload the current URI of the iframe, not the original URI.
To see why, consider these steps:
1) Load page A that frames page B.
2) Click a link in B that navigates the frame to C.
3) Reload.
The user's expectation at this point is that they reload whatever they're seeing, so A at toplevel and C in the subframe.
I have no clue why it's not working with bugzilla, honestly; I've have to step through and debug it. I'd expect it to work exactly the same way there.
Flags: needinfo?(bzbarsky)
Comment 5•10 years ago
|
||
(In reply to Boris Zbarsky [:bz] from comment #4)
> Yes, it is. When reloading, we reload the current URI of the iframe, not
> the original URI.
>
> To see why, consider these steps:
>
> 1) Load page A that frames page B.
> 2) Click a link in B that navigates the frame to C.
> 3) Reload.
>
> The user's expectation at this point is that they reload whatever they're
> seeing, so A at toplevel and C in the subframe.
I agree. But you're noting that what this test case does is different than the above scenario, right? Namely in that the user hasn't navigated anything. It is the parent page that has navigated the iframe dynamically.
> I have no clue why it's not working with bugzilla, honestly; I've have to
> step through and debug it. I'd expect it to work exactly the same way there.
That seems to be an https difference. For example, <http://people.mozilla.org/~mconley2/moz/weird-testcase.html> reproduces, but <https://people.mozilla.org/~mconley2/moz/weird-testcase.html> doesn't. But note that this difference is not what this bug is about.
Flags: needinfo?(bzbarsky)
Comment 6•10 years ago
|
||
(Also, according to our tests, we're the only UA that does this, the test case works fine in all other browsers. We did not test Edge but tested IE11.)
Comment 7•10 years ago
|
||
> It is the parent page that has navigated the iframe dynamically.
Sure. Just like it could be the parent page doing a location set on the iframe in response to a user click...
> the test case works fine in all other browsers
How do other browsers handle the situation I described in comment 4? Last I checked at least some of them just blew away subframe state and reloaded the toplevel, then did normal loads from there instead of trying to preserve subframe state.
Flags: needinfo?(bzbarsky)
Comment 8•10 years ago
|
||
(In reply to Boris Zbarsky [:bz] from comment #7)
> How do other browsers handle the situation I described in comment 4? Last I
> checked at least some of them just blew away subframe state and reloaded the
> toplevel, then did normal loads from there instead of trying to preserve
> subframe state.
The key difference is that the other browsers reload the subframe to whatever the src location is set to.
In this case, since the src is set dynamically, the parent page's state stores the iframe without a src attribute.
Currently, in Firefox, this iframe loads with its previous content, rather than with content following the src declaration.
The expectation is that the iframe would load about:blank if no src is set.
Updated•10 years ago
|
Flags: needinfo?(bzbarsky)
Comment 9•10 years ago
|
||
> The other browsers reload the subframe to whatever the src location is set to.
Yes, which is totally bogus in the scenario I describe in comment 4, no?
Flags: needinfo?(bzbarsky)
Comment 10•10 years ago
|
||
(In reply to Boris Zbarsky [:bz] from comment #9)
> > The other browsers reload the subframe to whatever the src location is set to.
>
> Yes, which is totally bogus in the scenario I describe in comment 4, no?
Sure, but we can detect the two cases. I'm not sure why comment 4 precludes fixing comment 0.
Comment 11•10 years ago
|
||
So one thing that's been proposed before (and I can find the relevant bug if that would be useful) is to remember in session history whether the url in the frame matched the src and if so on reload to load the src (whaver that is at that point) instead of whatever used to be in the frame. That sort of handles sites that dynamically write out a different src each time.
Comment 12•10 years ago
|
||
That would be very useful, Boris. We're in the situation where implementing this proposal would be very helpful.
Comment 13•10 years ago
|
||
Hmm. I did some looking around, and I can't find the bug that was suggested in. In any case, the actual work can just happen in this bug.
Comment 14•10 years ago
|
||
That makes sense to me.
| Reporter | ||
Comment 15•10 years ago
|
||
Hey oyiptong - does this need to block any of that newtab work?
Flags: needinfo?(oyiptong)
Comment 16•10 years ago
|
||
We worked around it by waiting for a message to be sent from inside the iframe which only runs on document ready. So, we're good.
Flags: needinfo?(oyiptong)
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•