From aec49bff0f3485af55d01907fcc32123b5172562 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Wed, 26 Apr 2017 15:50:36 +0300 Subject: [PATCH] Bug 1359453 - Use standard exception for selection.removeRange() r=masayuki The test change is already upstream: https://github.com/w3c/web-platform-tests/pull/5686 The spec change has not officially been accepted yet as of this writing, possibly delayed for IPR review: https://github.com/w3c/selection-api/pull/87 MozReview-Commit-ID: 3auwvwP4X72 --HG-- extra : rebase_source : 0396cd7c454b234598d77427bc20c6ea0645dc2e --- layout/generic/nsSelection.cpp | 2 +- .../meta/selection/removeRange.html.ini | 86 ------------------- .../tests/selection/removeRange.html | 4 +- 3 files changed, 4 insertions(+), 88 deletions(-) delete mode 100644 testing/web-platform/meta/selection/removeRange.html.ini diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp index 99c9c8e6ed3e..988cb4977b68 100644 --- a/layout/generic/nsSelection.cpp +++ b/layout/generic/nsSelection.cpp @@ -4076,7 +4076,7 @@ Selection::RemoveItem(nsRange* aItem) } } if (idx < 0) - return NS_ERROR_INVALID_ARG; + return NS_ERROR_DOM_NOT_FOUND_ERR; mRanges.RemoveElementAt(idx); aItem->SetSelection(nullptr); diff --git a/testing/web-platform/meta/selection/removeRange.html.ini b/testing/web-platform/meta/selection/removeRange.html.ini deleted file mode 100644 index 7285e6bd9244..000000000000 --- a/testing/web-platform/meta/selection/removeRange.html.ini +++ /dev/null @@ -1,86 +0,0 @@ -[removeRange.html] - type: testharness - [removeRange() with Range 0] - expected: FAIL - - [removeRange() with Range 1] - expected: FAIL - - [removeRange() with Range 2] - expected: FAIL - - [removeRange() with Range 3] - expected: FAIL - - [removeRange() with Range 4] - expected: FAIL - - [removeRange() with Range 5] - expected: FAIL - - [removeRange() with Range 6] - expected: FAIL - - [removeRange() with Range 7] - expected: FAIL - - [removeRange() with Range 14] - expected: FAIL - - [removeRange() with Range 15] - expected: FAIL - - [removeRange() with Range 16] - expected: FAIL - - [removeRange() with Range 17] - expected: FAIL - - [removeRange() with Range 18] - expected: FAIL - - [removeRange() with Range 22] - expected: FAIL - - [removeRange() with Range 23] - expected: FAIL - - [removeRange() with Range 26] - expected: FAIL - - [removeRange() with Range 27] - expected: FAIL - - [removeRange() with Range 28] - expected: FAIL - - [removeRange() with Range 29] - expected: FAIL - - [removeRange() with Range 30] - expected: FAIL - - [removeRange() with Range 31] - expected: FAIL - - [removeRange() with Range 32] - expected: FAIL - - [removeRange() with Range 34] - expected: FAIL - - [removeRange() with Range 35] - expected: FAIL - - [removeRange() with Range 36] - expected: FAIL - - [removeRange() with Range 37] - expected: FAIL - - [removeRange() with Range 38] - expected: FAIL - - [removeRange() with Range 39] - expected: FAIL - diff --git a/testing/web-platform/tests/selection/removeRange.html b/testing/web-platform/tests/selection/removeRange.html index 723f5105ca57..6ddccc66f225 100644 --- a/testing/web-platform/tests/selection/removeRange.html +++ b/testing/web-platform/tests/selection/removeRange.html @@ -30,7 +30,9 @@ testRanges.forEach(function(rangeData, index) { var equivalentRange = ownerDocument(endpoints[0]).createRange(); equivalentRange.setStart(endpoints[0], endpoints[1]); equivalentRange.setEnd(endpoints[2], endpoints[3]); - selection.removeRange(equivalentRange); + assert_throws("NotFoundError", + function() { selection.removeRange(equivalentRange) }, + "Removing a different range should throw"); assert_equals(selection.rangeCount, 1, 'Equivalent Range should not remove the registered Range.'); }, 'removeRange() with Range ' + index);