Closed Bug 692520 Opened 13 years ago Closed 13 years ago

Getting selectionStart / selectionEnd from a hidden textarea results in an uncaught NS_ERROR_FAILURE

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla10

People

(Reporter: pascal.kriete, Assigned: ehsan.akhgari)

Details

Attachments

(2 files, 1 obsolete file)

Attached file ff_selection_test.html
User Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-us) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27

Steps to reproduce:

If you try to grab the selectionStart or selectionEnd from a textarea after setting style.display to "none", you get an uncaught NS_ERROR_FAILURE exception.



Expected results:

Other browsers seem to cache the old selection. Tested in FF 5.5, 7, and today's nightly.
Ehsan, don't we store that stuff in the editor state now?
Attachment #565290 - Attachment mime type: text/plain → text/html
The problem here is that in GetSelectionStart/End, we do a GetFormControlFrame which might flush, in which case the frame will go away and we throw.  We need to check for the selection information being cached after doing that too.
Assignee: nobody → ehsan
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attached patch Patch (v1) (obsolete) — Splinter Review
Attachment #565325 - Flags: review?(bzbarsky)
Comment on attachment 565325 [details] [diff] [review]
Patch (v1)

Textarea didn't use to null-check mState.  Should it have, or should that change not be made in this patch?

r=me with that sorted out.
Attachment #565325 - Flags: review?(bzbarsky) → review+
Attached patch Patch (v2)Splinter Review
You're right, the null check is not necessary.
Attachment #565325 - Attachment is obsolete: true
(In reply to Ms2ger from comment #6)
> Ahem: Bug 617068

That's a really cryptic bug, but reading the patch, if all you want to do is to throw NS_ERROR_DOM_INVALID_STATE_ERR when this stuff is called on non-text inputs, then you should really look into building your patch on top of this one.  That patch is incorrect already.  :-)
OS: Mac OS X → All
Hardware: x86 → All
Version: 10 Branch → Trunk
https://hg.mozilla.org/integration/mozilla-inbound/rev/463ad8fec3e5
Flags: in-testsuite+
Target Milestone: --- → mozilla10
https://hg.mozilla.org/mozilla-central/rev/463ad8fec3e5
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: