Closed
Bug 943466
Opened 12 years ago
Closed 12 years ago
Text selection Actionbar generates JS error in browser.js
Categories
(Firefox for Android Graveyard :: Text Selection, defect)
Tracking
(fennec28+)
RESOLVED
FIXED
Firefox 28
| Tracking | Status | |
|---|---|---|
| fennec | 28+ | --- |
People
(Reporter: capella, Assigned: Margaret)
References
Details
(Keywords: regression)
Attachments
(1 file)
|
2.08 KB,
patch
|
wesj
:
review+
|
Details | Diff | Splinter Review |
If I use the actionbar to 'select All' text in an <input> field, then use it to 'Cut', I get a javascript message generated into logcat:
Error: "TypeError: aElement is null" {file: "chrome://browser/content/browser.js" line: 6598}]
This is currently pointing here:
http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/browser.js?mark=6623-6623#6621
| Assignee | ||
Updated•12 years ago
|
Updated•12 years ago
|
tracking-fennec: ? → 28+
| Assignee | ||
Comment 2•12 years ago
|
||
This error is caused by the fact that aElement is null in the SEARCH_ADD selector:
http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/browser.js#6628
This happens because this._targetElement is null here in SelectionHandler._sendMessage:
http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/SelectionHandler.js#312
This happens because the cut actions calls copySelection, which calls _closeSelection, which clears the state of the SelectionHandler, but then _updateMenu expects there to be an active selection.
However, even if we get rid of the _closeSelection call in copySelection (which I think makes sense), notifySelectionChanged will close the selection for us.
This feels like a mess :/ I think we need to audit the places we close the selection vs. keeping it active. For example, I see we're calling _closeSelection in the share action (although we're also calling _closeSelection inside shareSelection itself).
| Assignee | ||
Comment 3•12 years ago
|
||
This fixes some issues with copy and cut.
As I mentioned in my last comment, copySelection closes the selection. Since after performing a cut, we want a caret to appear when the text got removed, we should actually just be calling attachCaret, to set up SelectionHandler with TYPE_CURSOR.
And since copySelection closes the selection, we shouldn't call _updateMenu afterwards in the COPY action. It just throws an error.
We also don't need to call _closeSelection in the SHARE action, since shareSelection also takes care of that for us.
Attachment #8341991 -
Flags: review?(wjohnston)
Comment 4•12 years ago
|
||
Comment on attachment 8341991 [details] [diff] [review]
patch
Review of attachment 8341991 [details] [diff] [review]:
-----------------------------------------------------------------
I'm not sure who should own these closeSelection calls, but I obviously went overboard with them :) Thanks.
Attachment #8341991 -
Flags: review?(wjohnston) → review+
| Assignee | ||
Comment 5•12 years ago
|
||
Comment 6•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 28
Updated•5 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•