Closed Bug 919344 Opened 12 years ago Closed 12 years ago

"can't access dead object" after traversing links through quickfind bar

Categories

(Toolkit :: Find Toolbar, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla27
Tracking Status
firefox25 --- unaffected
firefox26 + unaffected
firefox27 + fixed

People

(Reporter: simon.lindholm10, Assigned: evilpies)

References

Details

(Keywords: regression)

Attachments

(1 file, 2 obsolete files)

User Agent: Mozilla/5.0 (X11; Linux i686; rv:27.0) Gecko/20100101 Firefox/27.0 (Beta/Release) Build ID: 20130922030201 Steps to reproduce: Visit http://forums.xkcd.com/. Type ' to open the "quick find (links only)" field, type "board index" (the link with that text will receive a focus outline), and press enter to navigate to http://forums.xkcd.com/index.php. Type ', and again type "board index". This time, the link with the text will not receive focus, and the browser console shows "TypeError: can't access dead object" coming from Finder.jsm:160 and Finder.jsm:98. Press enter to navigate to the same page again (this still works). Type '. This time, the quickfind bar won't even appear - errors will be thrown from Finder.jsm:160. If you then type Ctrl+F to open the find bar, you will see that it contains |board index'|, i.e., most keyboard input is going to the hidden search input field.
Blocks: 666816
Keywords: regression
Version: 27 Branch → Trunk
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached patch dead-object (obsolete) — Splinter Review
Thank you for this really good bug report. So the problem here is that after we navigated the page the _previousLink is dead. We would need a place to reset it, but we don't really now when the page is navigated. (One approximation could be resetting it when all listeners are removed). But I just went with the easiest solution, wrapping it with a try catch.
Assignee: nobody → evilpies
Status: NEW → ASSIGNED
Attachment #808646 - Flags: review?(mdeboer)
Seems to me like we need a more robust solution that avoids leaking references to content objects (even if bug 695480 is helping us here).
I guess we could add an event listener for something like "unload"? I am not sure what the best event would be.
Comment on attachment 808646 [details] [diff] [review] dead-object I am working on a better fix.
Attachment #808646 - Flags: review?(mdeboer)
Attached patch dead object v2 (obsolete) — Splinter Review
I think this is logically a better patch. Every time we remove the selection, we also null the previousLink. The change in tabbrowser.xml should ensure that it's always called on tab change. The change in keypress is because I realized .document has a similar issue. And well the code never really worked. "commandDispatcher" only exists on XUL documents and not the DOM document that the findbar usually operates on.
Attachment #808646 - Attachment is obsolete: true
Attachment #808722 - Flags: review?(mdeboer)
Comment on attachment 808722 [details] [diff] [review] dead object v2 Review of attachment 808722 [details] [diff] [review]: ----------------------------------------------------------------- Bonus points for removing the _document reference! Slowly but surely we'll get to a more sane implementation of the findbar with regard to events.
Attachment #808722 - Flags: review?(mdeboer) → review+
Why did it become an external responsibility to call removeSelection on location changes, and why is this only done in tabbrowser? How does e.g. the view source window deal with this?
Comment on attachment 808722 [details] [diff] [review] dead object v2 Review of attachment 808722 [details] [diff] [review]: ----------------------------------------------------------------- Update: Dão's right. Finder.jsm/ findbar.xml needs to call removeSelection() when the appropriate event is fired. Or do something similar to the `autocomplete` code just below in `onLocationChange`; add a method to findbar.xml that does this. ```js this.mTabBrowser.getFindBar(this.mTab).onLocationChange(); // Or a more appropriate name, but better than having all that code in tabbrowser.xml ``` If we can hook on to "beforeunload" or "pagehide" events, that would be preferable. I don't think this is really an issue for non-browser windows (ie. view-source).
Attachment #808722 - Flags: review+ → feedback+
(In reply to Mike de Boer [:mikedeboer] from comment #8) > If we can hook on to "beforeunload" or "pagehide" events, that would be > preferable. The find bar module should be able to use a progress listener just like tabbrowser does. Not sure why you'd switch to a pagehide event. > I don't think this is really an issue for non-browser windows > (ie. view-source). Why not?
Ok, seems like a good idea to have Finder.jsm standalone, especially when other code that is not the findbar wants to use it.
Attached patch dead-object v3Splinter Review
I am now using onLocationChange to null out the previous link.
Attachment #808722 - Attachment is obsolete: true
Attachment #809377 - Flags: review?(mdeboer)
Comment on attachment 809377 [details] [diff] [review] dead-object v3 Review of attachment 809377 [details] [diff] [review]: ----------------------------------------------------------------- I like it! One thing though, I don't now a thing about nsIWebProgress. Asking Dão to review this patch, because he prolly DOES know ;) ::: toolkit/modules/Finder.jsm @@ +420,5 @@ > > return null; > }, > > + // Start of nsIWebProgressListener nit: please change this comment to ``` // Start of nsIWebProgressListener implementation. ``` ...matching the comment for `nsIEditActionListener`.
Attachment #809377 - Flags: review?(mdeboer) → review?(dao)
Attachment #809377 - Flags: review?(dao) → review+
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
uplift nomination please, with risk assessment.
Flags: needinfo?(evilpies)
Comment on attachment 809377 [details] [diff] [review] dead-object v3 [Approval Request Comment] Bug caused by (feature/regressing bug #): 666816 User impact if declined: Can make searches impossible Testing completed (on m-c, etc.): is on Aurora and Beta, there haven't been any bugs Risk to taking this patch (and alternatives if risky): relatively low, I can't see how it could break something String or IDL/UUID changes made by this patch:
Attachment #809377 - Flags: approval-mozilla-beta?
Flags: needinfo?(evilpies)
Comment on attachment 809377 [details] [diff] [review] dead-object v3 Like bug 919340, we don't actually have this in 26.
Attachment #809377 - Flags: approval-mozilla-beta?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: