Last Comment Bug 719518 - Selection.extend() with no ranges should throw standard exception type
: Selection.extend() with no ranges should throw standard exception type
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Selection (show other bugs)
: Trunk
: x86 Linux
: -- minor (vote)
: mozilla14
Assigned To: Aryeh Gregor (:ayg) (next working March 28-April 26)
:
: Jet Villegas (:jet)
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-01-19 11:26 PST by Aryeh Gregor (:ayg) (next working March 28-April 26)
Modified: 2012-03-16 05:59 PDT (History)
3 users (show)
ehsan: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch v1 (2.62 KB, patch)
2012-03-14 11:28 PDT, Aryeh Gregor (:ayg) (next working March 28-April 26)
ehsan: review+
Details | Diff | Splinter Review

Description Aryeh Gregor (:ayg) (next working March 28-April 26) 2012-01-19 11:26:26 PST
Test case:

data:text/html,<!doctype html>
<body>
<script>
try {
getSelection().extend(document.body, 0);
} catch(e) {
document.body.textContent = e;
throw e;
}
document.body.textContent = getSelection().rangeCount;
</script>

Chrome 17 dev outputs "1", Opera Next 12.00 alpha outputs "0", Firefox 12.0a1 outputs

"""
[Exception... "Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsISelection.extend]" nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: data:text/html,<!doctype%20html><body><script>try%20{getSelection().extend(document.body,%200);}%20catch(e)%20{document.body.textContent%20=%20e;throw%20e;}document.body.textContent%20=%20getSelection().rangeCount;</script> :: <TOP_LEVEL> :: line 1" data: no]
"""

IE9 doesn't support extend().  Since there's no interop here at all, I went with Gecko's implementation when I was speccing this a number of months back, since it's the oldest.  But the exception type needs to be something standard, so I specced it as a DOMException, InvalidStateError:

"""
1. If the context object's range is null, throw an InvalidStateError exception and abort these steps.
"""
http://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#dom-selection-extend

Gecko should change the exception thrown here to InvalidStateError.

This causes test failures in <http://dvcs.w3.org/hg/editing/raw-file/tip/selecttest/extend.html>.  If this bug, bug 711047, and bug 719515 are fixed, it looks like Gecko will pass all the tests in that file.
Comment 1 Aryeh Gregor (:ayg) (next working March 28-April 26) 2012-03-14 11:28:37 PDT
Created attachment 605860 [details] [diff] [review]
Patch v1
Comment 2 Mozilla RelEng Bot 2012-03-14 11:45:15 PDT
Autoland Patchset:
	Patches: 605860
	Branch: mozilla-central => try
Patch 605860 could not be applied to mozilla-central.
hg: unknown command 'qimport'

Patchset could not be applied and pushed.
Comment 3 :Ms2ger (⌚ UTC+1/+2) 2012-03-14 12:11:31 PDT
https://tbpl.mozilla.org/?tree=Try&rev=a363a7c71a54
Comment 4 Aryeh Gregor (:ayg) (next working March 28-April 26) 2012-03-14 13:51:33 PDT
The bug 719515 patch is causing failures on the try server, so I'll do a different run with just this patch to see if we can land this even if that one needs more revisions.
Comment 5 Mozilla RelEng Bot 2012-03-14 13:54:05 PDT
Autoland Patchset:
	Patches: 605860
	Branch: mozilla-central => try
	Destination: http://hg.mozilla.org/try/pushloghtml?changeset=f6af7fe4f2ac
Try run started, revision f6af7fe4f2ac. To cancel or monitor the job, see: https://tbpl.mozilla.org/?tree=Try&rev=f6af7fe4f2ac
Comment 6 Mozilla RelEng Bot 2012-03-15 00:46:43 PDT
Try run for f6af7fe4f2ac is complete.
Detailed breakdown of the results available here:
    https://tbpl.mozilla.org/?tree=Try&rev=f6af7fe4f2ac
Results (out of 216 total builds):
    exception: 2
    success: 172
    warnings: 42
Builds (or logs if builds failed) available at:
http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/autolanduser@mozilla.com-f6af7fe4f2ac
Comment 7 Aryeh Gregor (:ayg) (next working March 28-April 26) 2012-03-15 08:36:38 PDT
There are some xpcshell failures that I can't pin on any existing bug and that occur on all Windows builds, but are surely unrelated to this commit.
Comment 8 :Ehsan Akhgari 2012-03-15 08:43:33 PDT
(In reply to Aryeh Gregor from comment #7)
> There are some xpcshell failures that I can't pin on any existing bug and
> that occur on all Windows builds, but are surely unrelated to this commit.

These are my fault, and I fixed them on m-c last night.  I'll push your patch now.
Comment 10 Marco Bonardo [::mak] 2012-03-16 05:59:52 PDT
https://hg.mozilla.org/mozilla-central/rev/895c2f503553

Note You need to log in before you can comment on or make changes to this bug.