Range API is throwing wrong exception type
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Sep 2015 02:25:00 +0000 (02:25 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Sep 2015 02:25:00 +0000 (02:25 +0000)
commitb2838e8e0dfcd15380a36b6107aeb5e2474f2303
tree447925c5e6d7022809cd67a9f0eefef5c5d722bc
parent316f78e2edfad317196718e967a00d947cc3725d
Range API is throwing wrong exception type
https://bugs.webkit.org/show_bug.cgi?id=148648

Reviewed by Ryosuke Niwa.

Source/WebCore:

The RangeException type does not exist in the latest DOM specification.
Instead, the Range API is throwing regular DOMExceptions [1]:
https://dom.spec.whatwg.org/#range

The error codes also differ. RangeException.INVALID_NODE_TYPE_ERR (2)
is replaced with DOMException.INVALID_NODE_TYPE_ERR (24).
RangeException.BAD_BOUNDARYPOINTS_ERR (1) is replaced by
DOMException.INVALID_STATE_ERR (11), as per:
https://dom.spec.whatwg.org/#dom-range-surroundcontents (step 1).

This patch aligns WebKit's behavior with the specification and with
other browsers (tested Firefox and Chrome).

[1] https://heycam.github.io/webidl/#dfn-DOMException

No new tests, covered by existing tests (rebaselined):
http/tests/w3c/dom/ranges/Range-comparePoint.html
http/tests/w3c/dom/ranges/Range-isPointInRange.html
http/tests/w3c/dom/ranges/Range-selectNode.html
http/tests/w3c/dom/ranges/Range-set.html
http/tests/w3c/dom/ranges/Range-surroundContents.html

* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSExceptionBase.cpp:
(WebCore::toExceptionBase): Deleted.
* dom/DOMAllInOne.cpp:
* dom/DOMExceptions.in:
* dom/Range.cpp:
(WebCore::Range::insertNode):
(WebCore::Range::checkNodeWOffset):
(WebCore::Range::checkNodeBA):
(WebCore::Range::selectNode):
(WebCore::Range::selectNodeContents):
(WebCore::Range::surroundContents):
* dom/RangeException.cpp: Removed.
* dom/RangeException.h: Removed.
* dom/RangeException.idl: Removed.

Source/WebKit/win:

* Interfaces/DOMWindow.idl:
Drop outdated comment.

LayoutTests:

Update / rebaseline tests. A lot of w3c tests progressed after this
change. However, some of our pre-existing layout tests were relying
on RangeException.

* fast/dom/DOMException/RangeException-expected.txt: Removed.
* fast/dom/DOMException/RangeException.html: Removed.
* fast/dom/DOMException/resources/RangeException.js: Removed.
* fast/dom/Range/range-compareNode.html:
* fast/dom/Range/range-exceptions-expected.txt:
* fast/dom/Range/range-intersectsNode-expected.txt:
* fast/dom/Range/script-tests/range-exceptions.js:
* fast/dom/Window/get-set-properties-expected.txt:
* fast/dom/Window/get-set-properties.html:
* fast/dom/Window/resources/window-properties.js:
* http/tests/w3c/dom/ranges/Range-comparePoint-expected.txt:
* http/tests/w3c/dom/ranges/Range-isPointInRange-expected.txt:
* http/tests/w3c/dom/ranges/Range-selectNode-expected.txt:
* http/tests/w3c/dom/ranges/Range-set-expected.txt:
* http/tests/w3c/dom/ranges/Range-surroundContents-expected.txt:
* platform/mac/fast/dom/Window/window-lookup-precedence-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189202 268f45cc-cd09-0410-ab3c-d52691b4dbfc
44 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/DOMException/RangeException-expected.txt [deleted file]
LayoutTests/fast/dom/DOMException/RangeException.html [deleted file]
LayoutTests/fast/dom/DOMException/resources/RangeException.js [deleted file]
LayoutTests/fast/dom/Range/range-compareNode.html
LayoutTests/fast/dom/Range/range-exceptions-expected.txt
LayoutTests/fast/dom/Range/range-intersectsNode-expected.txt
LayoutTests/fast/dom/Range/script-tests/range-exceptions.js
LayoutTests/fast/dom/Window/get-set-properties-expected.txt
LayoutTests/fast/dom/Window/get-set-properties.html
LayoutTests/fast/dom/Window/resources/window-properties.js
LayoutTests/http/tests/security/cross-frame-access-getOwnPropertyDescriptor-expected.txt
LayoutTests/http/tests/security/cross-frame-access-getOwnPropertyDescriptor.html
LayoutTests/http/tests/security/cross-frame-access-put-expected.txt
LayoutTests/http/tests/security/cross-frame-access-put.html
LayoutTests/http/tests/w3c/dom/historical-expected.txt
LayoutTests/http/tests/w3c/dom/ranges/Range-comparePoint-expected.txt
LayoutTests/http/tests/w3c/dom/ranges/Range-isPointInRange-expected.txt
LayoutTests/http/tests/w3c/dom/ranges/Range-selectNode-expected.txt
LayoutTests/http/tests/w3c/dom/ranges/Range-set-expected.txt
LayoutTests/http/tests/w3c/dom/ranges/Range-surroundContents-expected.txt
LayoutTests/platform/efl/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/gtk/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/mac/fast/dom/Window/window-lookup-precedence-expected.txt
LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/win/js/dom/global-constructors-attributes-expected.txt
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.cpp
Source/WebCore/DerivedSources.make
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSExceptionBase.cpp
Source/WebCore/dom/DOMAllInOne.cpp
Source/WebCore/dom/DOMExceptions.in
Source/WebCore/dom/Range.cpp
Source/WebCore/dom/RangeException.cpp [deleted file]
Source/WebCore/dom/RangeException.h [deleted file]
Source/WebCore/dom/RangeException.idl [deleted file]
Source/WebKit/win/ChangeLog
Source/WebKit/win/Interfaces/DOMWindow.idl