The default bug view has changed. See this FAQ.

Selection.extend() with no ranges should throw standard exception type

RESOLVED FIXED in mozilla14

Status

()

Core
Selection
--
minor
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: ayg, Assigned: ayg)

Tracking

Trunk
mozilla14
x86
Linux
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

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.
Created attachment 605860 [details] [diff] [review]
Patch v1
Assignee: nobody → ayg
Status: NEW → ASSIGNED
Attachment #605860 - Flags: review?(ehsan)
Whiteboard: [autoland-try:-u all]

Updated

5 years ago
Whiteboard: [autoland-try:-u all] → [autoland-in-queue]

Comment 2

5 years ago
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.

Updated

5 years ago
Whiteboard: [autoland-in-queue]
https://tbpl.mozilla.org/?tree=Try&rev=a363a7c71a54

Updated

5 years ago
Attachment #605860 - Flags: review?(ehsan) → review+
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.
Whiteboard: [autoland-try:-u all]

Updated

5 years ago
Whiteboard: [autoland-try:-u all] → [autoland-in-queue]

Comment 5

5 years ago
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

5 years ago
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

Updated

5 years ago
Whiteboard: [autoland-in-queue]
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.
Keywords: checkin-needed
(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.
https://hg.mozilla.org/integration/mozilla-inbound/rev/895c2f503553
Flags: in-testsuite+
Target Milestone: --- → mozilla14
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/895c2f503553
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.