Unofficial mirror of the WebKit SVN repository
Latest commit b9b9738 Jul 30, 2016 cdumez@apple.com [WebIDL] Enable strict type checking for operations' nullable paramet…
…ers of wrapper types


https://bugs.webkit.org/show_bug.cgi?id=160374

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Rebaseline W3C test now that one more check is passing.

* web-platform-tests/dom/nodes/DOMImplementation-createDocument-expected.txt:

Source/WebCore:

Enable strict type checking for operations' nullable parameters of
wrapper types to comply with the Web IDL specification:
- http://heycam.github.io/webidl/#es-nullable-type
- http://heycam.github.io/webidl/#es-interface

For such parameters, if the JS passes a value that is not null /
undefined and does not have the expected wrapper type, then we now
throw a TypeError instead of silently converting the value to null.

This behavior is consistent with Chrome and Firefox. It also helps
identify bugs in JavaScript code.

No new tests, rebaselined existing tests.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateParametersCheck):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapper):
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapperIsNull):
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalXPathNSResolver):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod1):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod2):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod6):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter1):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2):
(WebCore::jsTestObjPrototypeFunctionConvert2):
(WebCore::jsTestObjPrototypeFunctionStrictFunctionWithSequence):
(WebCore::jsTestObjPrototypeFunctionConditionalMethod3): Deleted.
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod5): Deleted.
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod): Deleted.
(WebCore::jsTestObjPrototypeFunctionOrange): Deleted.

LayoutTests:

Update / rebaseline existing tests to reflect behavior change. Also fix
several bugs in tests that became obvious now that we throw.

* editing/execCommand/indent-pre-expected.txt:
* editing/execCommand/indent-pre.html:
* editing/selection/4895428-2.html:
* editing/selection/move-by-word-visually-null-box.html:
* fast/dom/DOMImplementation/detached-doctype.html:
* fast/dom/MutationObserver/observe-attributes.html:
* fast/dom/Node/contains-method-expected.txt:
* fast/dom/Node/script-tests/contains-method.js:
* fast/dom/Window/webkitConvertPoint.html:
* fast/dom/adopt-node-crash-2.html:
* fast/dom/incompatible-operations-expected.txt:
* fast/dom/incompatible-operations.html:
* fast/events/selectstart-by-arrow-keys.html:
* fast/images/image-copy-memory-usage.html:
* fast/xsl/xslt-processor-expected.txt:
* http/tests/misc/webtiming-cross-origin-and-back1.html:
* platform/mac/fast/dom/Window/webkitConvertPoint-expected.txt:
* svg/custom/unicode-in-tspan-multi-svg-crash.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@203941 268f45cc-cd09-0410-ab3c-d52691b4dbfc