Closed
Bug 680257
Opened 13 years ago
Closed 13 years ago
:target pseudo-class not updating when pressing back button
Categories
(Core :: DOM: Navigation, defect)
Core
DOM: Navigation
Tracking
()
VERIFIED
FIXED
mozilla9
People
(Reporter: mattcoz, Assigned: justin.lebar+bug)
References
Details
(Keywords: qawanted, regression)
Attachments
(1 file, 1 obsolete file)
4.82 KB,
patch
|
bzbarsky
:
review+
johnath
:
approval-mozilla-aurora+
johnath
:
approval-mozilla-beta+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20100101 Firefox/6.0
Build ID: 20110811165603
Steps to reproduce:
Here is a jsfiddle that demonstrates the problem.
http://jsfiddle.net/gvFPv/2/
Actual results:
Clicking on the "a" link correctly applies the :target pseudo-class to the "a" link. Clicking on the "b" link then applies the pseudo-class to the "b" link and removes it from the "a" link. Pressing the back button does not update the pseudo-class on either link.
Expected results:
When pressing the back button it should remove the pseudo-class from the "b" link and apply it to the "a" link. This works in Firefox 3.6 and it works in Chrome, but it does not work in Firefox 6. I haven't tested 4 or 5, so I'm not sure when this regressed.
Comment 2•13 years ago
|
||
Regression window(cached m-c hourly):
Works:
http://hg.mozilla.org/mozilla-central/rev/837f762860af
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0a1) Gecko/20110524 Firefox/6.0a1 ID:20110524085016
Fails:
http://hg.mozilla.org/mozilla-central/rev/0fad9fa9fa3f
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0a1) Gecko/20110524 Firefox/7.0a1 ID:20110524105711
Pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=837f762860af&tochange=0fad9fa9fa3f
Suspected:
575362d9b92e Justin Lebar — Bug 653741 - You should be able to scoll back to the current anchor by focusing the location bar and pressing <enter>. r=bz
Blocks: 653741
Status: UNCONFIRMED → NEW
Component: General → Document Navigation
Ever confirmed: true
Keywords: regressionwindow-wanted → regression
Product: Firefox → Core
QA Contact: general → docshell
Assignee | ||
Comment 3•13 years ago
|
||
I guess ScrollToAnchor also updates the :target? That would be unfortunate.
Assignee | ||
Updated•13 years ago
|
Assignee: nobody → justin.lebar+bug
Assignee | ||
Comment 4•13 years ago
|
||
Assignee | ||
Comment 5•13 years ago
|
||
Nominating for tracking 7, 8, 9. :target isn't widely used AFAIK, but this bug breaks it pretty hard.
Assignee | ||
Updated•13 years ago
|
status-firefox5:
--- → unaffected
status-firefox6:
--- → affected
status-firefox7:
--- → affected
status-firefox8:
--- → affected
status-firefox9:
--- → affected
tracking-firefox7:
--- → ?
tracking-firefox8:
--- → ?
tracking-firefox9:
--- → ?
Assignee | ||
Comment 6•13 years ago
|
||
Pushed patch v1 to try:
http://tbpl.allizom.org/?tree=Try&usebuildbot=1&rev=2be0bae7f070
Assignee | ||
Comment 7•13 years ago
|
||
Assignee | ||
Updated•13 years ago
|
Attachment #554947 -
Attachment is obsolete: true
Assignee | ||
Comment 8•13 years ago
|
||
Forgot to include the tests last time.
http://tbpl.allizom.org/?tree=Try&usebuildbot=1&rev=fd83538ee308
Assignee | ||
Comment 9•13 years ago
|
||
Comment on attachment 554949 [details] [diff] [review]
Patch v2 (with tests)
Looks good on try so far.
I think this change is safe, assuming
!aSHEntry iff aLoadType == LOAD_HISTORY (1),
because in ScrollToAnchor, we always pass FALSE as the second argument to shell->GoToAnchor (indicating that we should not scroll to the anchor) if aLoadType == LOAD_HISTORY, and because ScrollToAnchor doesn't do anything other than call shell->GoToAnchor and, if the hash is empty, call SetCurScrollPosEx(0,0).
If (1) does not hold, then I'm confused about why I wrote the condition around ScrollToAnchor as |!aSHEntry| in the first place.
Attachment #554949 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 10•13 years ago
|
||
...and because SetCurScrollPosEx is not called if aLoadType is HISTORY or RELOAD. But this is all probably clearer if you just look at the code. :)
Comment 11•13 years ago
|
||
(1) as written above is certainly false. !aSHEntry is true for non-history loads (e.g. LOAD_NORMAL, LOAD_LINK, etc).
I believe that |aSHEntry iff (aLoadType == LOAD_HISTORY || aLoadType == LOAD_RELOAD_NORMAL)| is true, however, and I would think that's what you really care about here, no?
Comment 12•13 years ago
|
||
Comment on attachment 554949 [details] [diff] [review]
Patch v2 (with tests)
r=me if you fix the commit message to not have try gunk in it.
Thank you for adding tests for this!
Attachment #554949 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 13•13 years ago
|
||
> I believe that |aSHEntry iff (aLoadType == LOAD_HISTORY || aLoadType ==
> LOAD_RELOAD_NORMAL)| is true, however, and I would think that's what you really
> care about here, no?
Yes, indeed!
> Thank you for adding tests for this!
I didn't realize I had a choice. :)
Inbound - http://hg.mozilla.org/integration/mozilla-inbound/rev/ea8d99353056
Flags: in-testsuite+
Whiteboard: [inbound]
Assignee | ||
Comment 14•13 years ago
|
||
WRT branches, we can't just back out bug 653741, because that itself was a regression fix. I think we definitely want this on Aurora. Beta is a tougher call. This code is obviously fragile, and although it seems from comment 9 and comment 11 that this change is safe, it could be that one of our assumptions is wrong in an edge case.
The likely failure mode is that we'd regress some other edge case, so maybe this known fix outweighs the possibility of creating another, similar bug.
Assignee | ||
Updated•13 years ago
|
Attachment #554949 -
Flags: approval-mozilla-beta?
Attachment #554949 -
Flags: approval-mozilla-aurora?
Comment 15•13 years ago
|
||
Status: NEW → RESOLVED
Closed: 13 years ago
OS: Windows 7 → All
Hardware: x86_64 → All
Resolution: --- → FIXED
Whiteboard: [inbound]
Target Milestone: --- → mozilla9
Version: 6 Branch → Trunk
Comment 16•13 years ago
|
||
Comment on attachment 554949 [details] [diff] [review]
Patch v2 (with tests)
Discussed in triage - approving this for both, but it would help if you could give QA some information about how to watch for regressions here. We'll be eager to back this out of beta if those regressions show up, but we need to know what to look for.
Attachment #554949 -
Flags: approval-mozilla-beta?
Attachment #554949 -
Flags: approval-mozilla-beta+
Attachment #554949 -
Flags: approval-mozilla-aurora?
Attachment #554949 -
Flags: approval-mozilla-aurora+
Assignee | ||
Comment 17•13 years ago
|
||
Regressions would likely be apparent when navigating between two history entries which share a document. For instance, when navigating between foo.html and foo.html#bar, or if foo.html calls history.pushState, navigating between those two history entries.
Assignee | ||
Updated•13 years ago
|
Assignee | ||
Comment 18•13 years ago
|
||
Pushed to branches: Aurora (FF8) and Beta (FF7):
http://hg.mozilla.org/releases/mozilla-aurora/rev/636ee9539d54
http://hg.mozilla.org/releases/mozilla-beta/rev/fbcd27571662
Assignee | ||
Comment 19•13 years ago
|
||
Thank you for the bug report, Matt!
Comment 20•13 years ago
|
||
(In reply to Justin Lebar [:jlebar] from comment #18)
> http://hg.mozilla.org/releases/mozilla-beta/rev/fbcd27571662
Backed out because of mochitest-plain-2 perma-orange.
Keywords: qawanted
Assignee | ||
Comment 21•13 years ago
|
||
In particular, the test for this bug is timing out, beta only.
http://tinderbox.mozilla.org/showlog.cgi?log=Mozilla-Beta/1314145114.1314147541.7504.gz
Assignee | ||
Comment 22•13 years ago
|
||
I think the test failure on beta is because my mochitest doesn't include Mochikit/packed.js, which is gone in trunk but not yet in beta.
Try: http://tbpl.allizom.org/?tree=Try&usebuildbot=1&rev=4b67045e0865
Assignee | ||
Comment 23•13 years ago
|
||
With test fix this was green on try. Pushed to beta:
http://hg.mozilla.org/releases/mozilla-beta/rev/dddb008734ee
Updated•13 years ago
|
Comment 25•13 years ago
|
||
Verified as fixed on:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:7.0) Gecko/20100101 Firefox/7.0
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0a2) Gecko/20110831 Firefox/8.0a2
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0a1) Gecko/20110831 Firefox/9.0a1
Mozilla/5.0 (X11; Linux i686; rv:7.0) Gecko/20100101 Firefox/7.0
Mozilla/5.0 (X11; Linux i686; rv:8.0a2) Gecko/20110901 Firefox/8.0a2
Mozilla/5.0 (X11; Linux i686; rv:9.0a1) Gecko/20110831 Firefox/9.0a1
Mozilla/5.0 (Windows NT 5.1; rv:7.0) Gecko/20100101 Firefox/7.0
Mozilla/5.0 (Windows NT 5.1; rv:8.0a2) Gecko/20110828 Firefox/8.0a2
Mozilla/5.0 (Windows NT 5.1; rv:9.0a1) Gecko/20110829 Firefox/9.0a1
Mozilla/5.0 (Windows NT 6.1; rv:7.0) Gecko/20100101 Firefox/7.0
Mozilla/5.0 (Windows NT 6.1; rv:8.0a2) Gecko/20110825 Firefox/8.0a2
Mozilla/5.0 (Windows NT 6.1; rv:9.0a1) Gecko/20110825 Firefox/9.0a1
Steps:
1. Open http://jsfiddle.net/gvFPv/2/
2. Click on the "a" link, then click on the "b" link.
3. Click on the back button.
Clicking on the "a" link applies the :target pseudo-class to the "a" link. Clicking on the "b" link applies the pseudo-class to the "b" link and removes it from the "a" link. When clicking the back button the pseudo-class is applied to the "a" link and it is removed from the "b" link.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•