Closed Bug 661884 Opened 11 years ago Closed 10 years ago
Selection events occur only after (successful!) page load
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:2.0) Gecko/20110321 Firefox/4.0 Build Identifier: Addon SDK 1.0rc1, Mozilla/5.0 (X11; Linux i686; rv:2.0) Gecko/20110321 Firefox/4.0 As far as I can tell: Selection events aren't fired while the page is still loading (minor annoyance). If the pageload is cancelled by the user, the addon will never receive selection events for that page (more serious). In both cases, selection.text and selection.html return the correct values. We're just not informed that they've changed. Reproducible: Always Steps to Reproduce: 1. require("selection").on('select', function() console.log('boo!')); 2. Visit a slow website. 3. Select some text while the page is still loading. 4. Press <Escape> while the page is still loading, then select some other text. Actual Results: No output. Expected Results: "boo!" printed twice.
This might require a platform change to fix; I think we wait until the page is loaded to start listening for selections because the API we're using requires it.
Priority: -- → P2
Target Milestone: --- → Future
Matteo, do you have any insight into whether we need a platform change or if this is something we can do ourselves?
Duplicate of this bug: 664988
(Pushing all open bugs to the --- milestone for the new triage system)
Target Milestone: Future → ---
Still waiting for input from Matteo.
I will check again this bug after I fixed the bug 751469. However I'm quite confident that Myk is right.
In `selection.js` we're using the `Tracker` exposed by `tab-browser` module, so we have the load event only when the page is actually fully loaded. Maybe we can fix it using the observer topic "document-element-inserted" instead; adding listeners at that point seems works. We have just to be sure that we limit that behavior to the document loaded in tabs, and figure out in which event doing the clean up.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P1
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.