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
This commit is contained in:
Aryeh Gregor 2017-04-26 15:50:36 +03:00
Родитель 966c8d03f5
Коммит aec49bff0f
3 изменённых файлов: 4 добавлений и 88 удалений

Просмотреть файл

@ -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);

Просмотреть файл

@ -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

Просмотреть файл

@ -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);