Skip to content

Commit

Permalink
[WebIDL] Drop [Default] WebKit-IDL extended attribute
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=156955

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline some tests now that a different exception type is thrown
for some of our APIs when passing null.

* web-platform-tests/dom/interfaces-expected.txt:
* web-platform-tests/html/dom/interfaces-expected.txt:

Source/WebCore:

Drop [Default] WebKit-IDL extended attribute in favor of the standard
WebIDL syntax for parameters' default value.

Here is what it looks like:
[Default=NullString] optional DOMString a -> optional DOMString a = null
[Default=NullString] optional DOMString? a -> optional DOMString? a = null
[Default=Undefined] optional DOMString a -> optional DOMString a = "undefined"
[Default=Undefined] optional DOMString? a -> optional DOMString? a = null
[Default=Undefined] optional long a -> optional long a = 0
[Default=Undefined] optional bool a -> optional bool a = false
[Default=Undefined] optional unrestricted double a -> optional unrestricted double a = NaN
[Default=Undefined] optional unrestricted float a -> optional unrestricted float a = NaN
[Default=Undefined] optional sequence<DOMString> a -> optional sequence<DOMString> a = []

These do not cause any Web-Exposed behavior change. However, when getting
rid of [Default] started passing more parameters by derefence instead of
pointer (as is expected for parameters not marked as nullable). As a result,
I had to mark a few parameters as nullable in the IDL to maintain the
previous behavior. In some cases, the implementation was already throwing
when passing null. In such cases, I have not marked the type as nullable
so that the generated bindings now throw the exception instead of our
implementation code. In some cases, the exception being thrown is now
different. This is why some of the layout tests had to be rebaselined.

No new tests, existing tests have been rebaselined. No significant Web
exposed behavior change is expected from this patch, beside exceptions
type sometimes being different.

* Modules/encryptedmedia/MediaKeys.idl:
* Modules/fetch/FetchRequest.idl:
* Modules/gamepad/deprecated/GamepadList.idl:
* Modules/indexeddb/IDBDatabase.idl:
* Modules/mediastream/RTCStatsResponse.idl:
* Modules/notifications/Notification.idl:
* Modules/speech/SpeechSynthesisUtterance.idl:
* Modules/webaudio/AudioNode.idl:
* Modules/websockets/WebSocket.idl:
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateParametersCheck):
* bindings/scripts/IDLAttributes.txt:
* bindings/scripts/IDLParser.pm:
(parseDefault):
(parseDefaultValue):
* bindings/scripts/test/TestInterface.idl:
* bindings/scripts/test/TestNamedConstructor.idl:
* bindings/scripts/test/TestObj.idl:
* bindings/scripts/test/TestOverrideBuiltins.idl:
* css/CSSKeyframesRule.idl:
* css/CSSMediaRule.idl:
* css/CSSPrimitiveValue.idl:
* css/CSSRuleList.idl:
* css/CSSStyleDeclaration.idl:
* css/CSSStyleSheet.idl:
* css/CSSSupportsRule.idl:
* css/CSSValueList.idl:
* css/MediaList.idl:
* css/MediaQueryList.idl:
* css/MediaQueryListListener.idl:
* css/StyleMedia.idl:
* css/StyleSheetList.idl:
* css/WebKitCSSFilterValue.idl:
* css/WebKitCSSMatrix.idl:
* css/WebKitCSSTransformValue.idl:
* dom/ClientRectList.idl:
* dom/Comment.idl:
* dom/CompositionEvent.idl:
* dom/CustomEvent.h:
* dom/CustomEvent.idl:
* dom/DOMImplementation.idl:
* dom/DOMStringList.idl:
* dom/DataTransferItem.idl:
* dom/DataTransferItemList.idl:
* dom/DeviceMotionEvent.idl:
* dom/DeviceOrientationEvent.idl:
* dom/Document.cpp:
(WebCore::Document::adoptNode):
* dom/Document.idl:
* dom/Element.cpp:
(WebCore::Element::setAttributeNode):
(WebCore::Element::setAttributeNodeNS):
(WebCore::Element::removeAttributeNode):
(WebCore::Element::parseAttributeName): Deleted.
* dom/Element.h:
* dom/Element.idl:
* dom/Event.idl:
* dom/HashChangeEvent.idl:
* dom/KeyboardEvent.idl:
* dom/MessageEvent.idl:
* dom/MouseEvent.idl:
* dom/MutationEvent.idl:
* dom/NamedNodeMap.cpp:
(WebCore::NamedNodeMap::setNamedItem):
(WebCore::NamedNodeMap::setNamedItemNS):
(WebCore::NamedNodeMap::item): Deleted.
* dom/NamedNodeMap.h:
* dom/NamedNodeMap.idl:
* dom/Node.idl:
* dom/NodeFilter.idl:
* dom/NonElementParentNode.idl:
* dom/OverflowEvent.idl:
* dom/Range.idl:
* dom/Text.idl:
* dom/TextEvent.idl:
* dom/TouchEvent.idl:
* dom/UIEvent.idl:
* dom/WheelEvent.idl:
* html/DOMFormData.idl:
* html/HTMLAllCollection.idl:
* html/HTMLAudioElement.idl:
* html/HTMLCanvasElement.idl:
* html/HTMLCollection.idl:
* html/HTMLDocument.idl:
* html/HTMLElement.cpp:
(WebCore::HTMLElement::insertAdjacentElement):
(WebCore::contextElementForInsertion): Deleted.
* html/HTMLElement.h:
* html/HTMLElement.idl:
* html/HTMLFormControlsCollection.idl:
* html/HTMLInputElement.idl:
* html/HTMLMediaElement.idl:
* html/HTMLOptionElement.idl:
* html/HTMLOptionsCollection.idl:
* html/HTMLSelectElement.idl:
* html/HTMLTableElement.idl:
* html/HTMLTableRowElement.idl:
* html/HTMLTableSectionElement.idl:
* html/HTMLTextAreaElement.idl:
* html/ImageData.idl:
* html/canvas/CanvasGradient.idl:
* html/canvas/CanvasRenderingContext2D.idl:
* html/canvas/DOMPath.idl:
* html/canvas/OESVertexArrayObject.idl:
* page/DOMSelection.cpp:
(WebCore::DOMSelection::extend):
(WebCore::DOMSelection::getRangeAt): Deleted.
* page/DOMSelection.h:
* page/DOMSelection.idl:
* page/DOMWindow.idl:
* page/History.idl:
* page/Performance.idl:
* page/WindowTimers.idl:
* plugins/DOMMimeTypeArray.idl:
* plugins/DOMPlugin.idl:
* plugins/DOMPluginArray.idl:
* storage/StorageEvent.idl:
* svg/SVGAnimationElement.idl:
* svg/SVGDocument.idl:
* svg/SVGElement.idl:
* svg/SVGFEDropShadowElement.idl:
* svg/SVGFEGaussianBlurElement.idl:
* svg/SVGFEMorphologyElement.idl:
* svg/SVGFilterElement.idl:
* svg/SVGGraphicsElement.idl:
* svg/SVGMarkerElement.idl:
* svg/SVGPathElement.idl:
* svg/SVGSVGElement.idl:
* svg/SVGTests.idl:
* svg/SVGTextContentElement.idl:
* xml/DOMParser.idl:
* xml/XMLSerializer.cpp:
(WebCore::XMLSerializer::serializeToString):
* xml/XMLSerializer.h:
* xml/XMLSerializer.idl:
* xml/XPathEvaluator.idl:
* xml/XPathExpression.idl:
* xml/XPathNSResolver.idl:
* xml/XPathResult.idl:
* xml/XSLTProcessor.idl:

Tools:

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:

LayoutTests:

Rebaseline some tests now that a different exception type is thrown
for some of our APIs when passing null.

* editing/selection/extend-expected.txt:
* fast/dom/Element/attr-param-typechecking-expected.txt:
* fast/dom/NamedNodeMap-setNamedItem-crash-expected.txt:
* fast/dynamic/insertAdjacentElement-expected.txt:

Canonical link: https://commits.webkit.org/175071@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199969 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
cdumez committed Apr 24, 2016
1 parent 085402e commit 8c7d8cc
Show file tree
Hide file tree
Showing 145 changed files with 1,367 additions and 823 deletions.
15 changes: 15 additions & 0 deletions LayoutTests/ChangeLog
@@ -1,3 +1,18 @@
2016-04-23 Chris Dumez <cdumez@apple.com>

[WebIDL] Drop [Default] WebKit-IDL extended attribute
https://bugs.webkit.org/show_bug.cgi?id=156955

Reviewed by Darin Adler.

Rebaseline some tests now that a different exception type is thrown
for some of our APIs when passing null.

* editing/selection/extend-expected.txt:
* fast/dom/Element/attr-param-typechecking-expected.txt:
* fast/dom/NamedNodeMap-setNamedItem-crash-expected.txt:
* fast/dynamic/insertAdjacentElement-expected.txt:

2016-04-24 Filip Pizlo <fpizlo@apple.com> and Andy VanWagoner <thetalecrafter@gmail.com>

[INTL] Implement String.prototype.localeCompare in ECMA-402
Expand Down
4 changes: 2 additions & 2 deletions LayoutTests/editing/selection/extend-expected.txt
Expand Up @@ -4,5 +4,5 @@ Success: s.extend(span2.firstChild, 4) raised Error: IndexSizeError: DOM Excepti
Success: s.extend(span2.firstChild, -1) raised Error: IndexSizeError: DOM Exception 1.
Success: window.getSelection() is b.
Success: window.getSelection() is arbaz.
Success: s.extend() raised Error: TypeMismatchError: DOM Exception 17.
Success: s.extend(null, 0) raised Error: TypeMismatchError: DOM Exception 17.
Success: s.extend() raised TypeError: Type error.
Success: s.extend(null, 0) raised TypeError: Type error.
24 changes: 12 additions & 12 deletions LayoutTests/fast/dom/Element/attr-param-typechecking-expected.txt
Expand Up @@ -3,18 +3,18 @@ This test checks whether passing wrong types to setAttributeNode causes a crash.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS element.setAttributeNode("style"); threw exception Error: TypeMismatchError: DOM Exception 17.
PASS element.setAttributeNode(null); threw exception Error: TypeMismatchError: DOM Exception 17.
PASS element.setAttributeNode(undefined); threw exception Error: TypeMismatchError: DOM Exception 17.
PASS element.setAttributeNode(new Object); threw exception Error: TypeMismatchError: DOM Exception 17.
PASS element.removeAttributeNode("style"); threw exception Error: TypeMismatchError: DOM Exception 17.
PASS element.removeAttributeNode(null); threw exception Error: TypeMismatchError: DOM Exception 17.
PASS element.removeAttributeNode(undefined); threw exception Error: TypeMismatchError: DOM Exception 17.
PASS element.removeAttributeNode(new Object); threw exception Error: TypeMismatchError: DOM Exception 17.
PASS element.setAttributeNodeNS("style"); threw exception Error: TypeMismatchError: DOM Exception 17.
PASS element.setAttributeNodeNS(null); threw exception Error: TypeMismatchError: DOM Exception 17.
PASS element.setAttributeNodeNS(undefined); threw exception Error: TypeMismatchError: DOM Exception 17.
PASS element.setAttributeNodeNS(new Object); threw exception Error: TypeMismatchError: DOM Exception 17.
PASS element.setAttributeNode("style"); threw exception TypeError: Type error.
PASS element.setAttributeNode(null); threw exception TypeError: Type error.
PASS element.setAttributeNode(undefined); threw exception TypeError: Type error.
PASS element.setAttributeNode(new Object); threw exception TypeError: Type error.
PASS element.removeAttributeNode("style"); threw exception TypeError: Type error.
PASS element.removeAttributeNode(null); threw exception TypeError: Type error.
PASS element.removeAttributeNode(undefined); threw exception TypeError: Type error.
PASS element.removeAttributeNode(new Object); threw exception TypeError: Type error.
PASS element.setAttributeNodeNS("style"); threw exception TypeError: Type error.
PASS element.setAttributeNodeNS(null); threw exception TypeError: Type error.
PASS element.setAttributeNodeNS(undefined); threw exception TypeError: Type error.
PASS element.setAttributeNodeNS(new Object); threw exception TypeError: Type error.
PASS successfullyParsed is true

TEST COMPLETE
Expand Down
@@ -1,2 +1,2 @@
CONSOLE MESSAGE: line 7: NotFoundError: DOM Exception 8: An attempt was made to reference a Node in a context where it does not exist.
CONSOLE MESSAGE: line 7: TypeError: Type error
This passes if it does not crash. (see https://bugs.webkit.org/show_bug.cgi?id=18958)
@@ -1,5 +1,5 @@
Caught expected exception: Error: NotSupportedError: DOM Exception 9
Caught expected exception: Error: TypeMismatchError: DOM Exception 17
Caught expected exception: TypeError: Type error
1 (black) 2 (green) 3 (green) 4 (black)

PASS
13 changes: 13 additions & 0 deletions LayoutTests/imported/w3c/ChangeLog
@@ -1,3 +1,16 @@
2016-04-23 Chris Dumez <cdumez@apple.com>

[WebIDL] Drop [Default] WebKit-IDL extended attribute
https://bugs.webkit.org/show_bug.cgi?id=156955

Reviewed by Darin Adler.

Rebaseline some tests now that a different exception type is thrown
for some of our APIs when passing null.

* web-platform-tests/dom/interfaces-expected.txt:
* web-platform-tests/html/dom/interfaces-expected.txt:

2016-04-21 Chris Dumez <cdumez@apple.com>

Drop [UsePointersEvenForNonNullableObjectArguments] from Document
Expand Down
Expand Up @@ -716,9 +716,9 @@ PASS Element interface: operation hasAttribute(DOMString)
FAIL Element interface: operation hasAttributeNS(DOMString,DOMString) assert_equals: property has wrong .length expected 2 but got 0
FAIL Element interface: operation getAttributeNode(DOMString) assert_equals: property has wrong .length expected 1 but got 0
FAIL Element interface: operation getAttributeNodeNS(DOMString,DOMString) assert_equals: property has wrong .length expected 2 but got 0
FAIL Element interface: operation setAttributeNode(Attr) assert_equals: property has wrong .length expected 1 but got 0
FAIL Element interface: operation setAttributeNodeNS(Attr) assert_equals: property has wrong .length expected 1 but got 0
FAIL Element interface: operation removeAttributeNode(Attr) assert_equals: property has wrong .length expected 1 but got 0
PASS Element interface: operation setAttributeNode(Attr)
PASS Element interface: operation setAttributeNodeNS(Attr)
PASS Element interface: operation removeAttributeNode(Attr)
PASS Element interface: operation closest(DOMString)
PASS Element interface: operation matches(DOMString)
FAIL Element interface: operation getElementsByTagName(DOMString) assert_equals: property has wrong .length expected 1 but got 0
Expand Down Expand Up @@ -788,17 +788,11 @@ FAIL Element interface: calling getAttributeNodeNS(DOMString,DOMString) on eleme
fn.apply(obj, args);
}" did not throw
PASS Element interface: element must inherit property "setAttributeNode" with the proper type (19)
FAIL Element interface: calling setAttributeNode(Attr) on element with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
}" threw object "Error: TypeMismatchError: DOM Exception 17" ("TypeMismatchError") expected object "TypeError" ("TypeError")
PASS Element interface: calling setAttributeNode(Attr) on element with too few arguments must throw TypeError
PASS Element interface: element must inherit property "setAttributeNodeNS" with the proper type (20)
FAIL Element interface: calling setAttributeNodeNS(Attr) on element with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
}" threw object "Error: TypeMismatchError: DOM Exception 17" ("TypeMismatchError") expected object "TypeError" ("TypeError")
PASS Element interface: calling setAttributeNodeNS(Attr) on element with too few arguments must throw TypeError
PASS Element interface: element must inherit property "removeAttributeNode" with the proper type (21)
FAIL Element interface: calling removeAttributeNode(Attr) on element with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
}" threw object "Error: TypeMismatchError: DOM Exception 17" ("TypeMismatchError") expected object "TypeError" ("TypeError")
PASS Element interface: calling removeAttributeNode(Attr) on element with too few arguments must throw TypeError
PASS Element interface: element must inherit property "closest" with the proper type (22)
PASS Element interface: calling closest(DOMString) on element with too few arguments must throw TypeError
PASS Element interface: element must inherit property "matches" with the proper type (23)
Expand Down Expand Up @@ -928,8 +922,8 @@ PASS NamedNodeMap interface: attribute length
FAIL NamedNodeMap interface: operation item(unsigned long) assert_equals: property has wrong .length expected 1 but got 0
FAIL NamedNodeMap interface: operation getNamedItem(DOMString) assert_equals: property has wrong .length expected 1 but got 0
FAIL NamedNodeMap interface: operation getNamedItemNS(DOMString,DOMString) assert_equals: property has wrong .length expected 2 but got 0
FAIL NamedNodeMap interface: operation setNamedItem(Attr) assert_equals: property has wrong .length expected 1 but got 0
FAIL NamedNodeMap interface: operation setNamedItemNS(Attr) assert_equals: property has wrong .length expected 1 but got 0
PASS NamedNodeMap interface: operation setNamedItem(Attr)
PASS NamedNodeMap interface: operation setNamedItemNS(Attr)
FAIL NamedNodeMap interface: operation removeNamedItem(DOMString) assert_equals: property has wrong .length expected 1 but got 0
FAIL NamedNodeMap interface: operation removeNamedItemNS(DOMString,DOMString) assert_equals: property has wrong .length expected 2 but got 0
FAIL Attr interface: existence and properties of interface object assert_equals: prototype of self's property "Attr" is not Function.prototype expected function "function () {
Expand Down
Expand Up @@ -1084,17 +1084,11 @@ FAIL Element interface: calling getAttributeNodeNS(DOMString,DOMString) on docum
fn.apply(obj, args);
}" did not throw
PASS Element interface: document.createElement("noscript") must inherit property "setAttributeNode" with the proper type (19)
FAIL Element interface: calling setAttributeNode(Attr) on document.createElement("noscript") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
}" threw object "Error: TypeMismatchError: DOM Exception 17" ("TypeMismatchError") expected object "TypeError" ("TypeError")
PASS Element interface: calling setAttributeNode(Attr) on document.createElement("noscript") with too few arguments must throw TypeError
PASS Element interface: document.createElement("noscript") must inherit property "setAttributeNodeNS" with the proper type (20)
FAIL Element interface: calling setAttributeNodeNS(Attr) on document.createElement("noscript") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
}" threw object "Error: TypeMismatchError: DOM Exception 17" ("TypeMismatchError") expected object "TypeError" ("TypeError")
PASS Element interface: calling setAttributeNodeNS(Attr) on document.createElement("noscript") with too few arguments must throw TypeError
PASS Element interface: document.createElement("noscript") must inherit property "removeAttributeNode" with the proper type (21)
FAIL Element interface: calling removeAttributeNode(Attr) on document.createElement("noscript") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
}" threw object "Error: TypeMismatchError: DOM Exception 17" ("TypeMismatchError") expected object "TypeError" ("TypeError")
PASS Element interface: calling removeAttributeNode(Attr) on document.createElement("noscript") with too few arguments must throw TypeError
PASS Element interface: document.createElement("noscript") must inherit property "closest" with the proper type (22)
PASS Element interface: calling closest(DOMString) on document.createElement("noscript") with too few arguments must throw TypeError
PASS Element interface: document.createElement("noscript") must inherit property "matches" with the proper type (23)
Expand Down
Expand Up @@ -1084,17 +1084,11 @@ FAIL Element interface: calling getAttributeNodeNS(DOMString,DOMString) on docum
fn.apply(obj, args);
}" did not throw
PASS Element interface: document.createElement("noscript") must inherit property "setAttributeNode" with the proper type (19)
FAIL Element interface: calling setAttributeNode(Attr) on document.createElement("noscript") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
}" threw object "Error: TypeMismatchError: DOM Exception 17" ("TypeMismatchError") expected object "TypeError" ("TypeError")
PASS Element interface: calling setAttributeNode(Attr) on document.createElement("noscript") with too few arguments must throw TypeError
PASS Element interface: document.createElement("noscript") must inherit property "setAttributeNodeNS" with the proper type (20)
FAIL Element interface: calling setAttributeNodeNS(Attr) on document.createElement("noscript") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
}" threw object "Error: TypeMismatchError: DOM Exception 17" ("TypeMismatchError") expected object "TypeError" ("TypeError")
PASS Element interface: calling setAttributeNodeNS(Attr) on document.createElement("noscript") with too few arguments must throw TypeError
PASS Element interface: document.createElement("noscript") must inherit property "removeAttributeNode" with the proper type (21)
FAIL Element interface: calling removeAttributeNode(Attr) on document.createElement("noscript") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
fn.apply(obj, args);
}" threw object "Error: TypeMismatchError: DOM Exception 17" ("TypeMismatchError") expected object "TypeError" ("TypeError")
PASS Element interface: calling removeAttributeNode(Attr) on document.createElement("noscript") with too few arguments must throw TypeError
PASS Element interface: document.createElement("noscript") must inherit property "closest" with the proper type (22)
PASS Element interface: calling closest(DOMString) on document.createElement("noscript") with too few arguments must throw TypeError
PASS Element interface: document.createElement("noscript") must inherit property "matches" with the proper type (23)
Expand Down

0 comments on commit 8c7d8cc

Please sign in to comment.