Diff
Modified: trunk/LayoutTests/ChangeLog (203940 => 203941)
--- trunk/LayoutTests/ChangeLog 2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/ChangeLog 2016-07-30 08:35:06 UTC (rev 203941)
@@ -1,3 +1,32 @@
+2016-07-30 Chris Dumez <[email protected]>
+
+ [WebIDL] Enable strict type checking for operations' nullable parameters of wrapper types
+ https://bugs.webkit.org/show_bug.cgi?id=160374
+
+ Reviewed by Youenn Fablet.
+
+ 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:
+
2016-07-29 Chris Dumez <[email protected]>
Window's named properties should be exposed on a WindowProperties object in its prototype
Modified: trunk/LayoutTests/editing/execCommand/indent-pre-expected.txt (203940 => 203941)
--- trunk/LayoutTests/editing/execCommand/indent-pre-expected.txt 2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/editing/execCommand/indent-pre-expected.txt 2016-07-30 08:35:06 UTC (rev 203941)
@@ -102,7 +102,7 @@
var textNode = node.firstChild;
if (textNode.nodeType != Node.TEXT_NODE)
throw "Wrong node type: " + textNode;
- execSetSelectionCommand(textNode, 0, 0);
+ execSetSelectionCommand(textNode, 0, null);
}
function verifyTextSelection(startNode, startOffset, endNode, endOffset)
Modified: trunk/LayoutTests/editing/execCommand/indent-pre.html (203940 => 203941)
--- trunk/LayoutTests/editing/execCommand/indent-pre.html 2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/editing/execCommand/indent-pre.html 2016-07-30 08:35:06 UTC (rev 203941)
@@ -30,7 +30,7 @@
var textNode = node.firstChild;
if (textNode.nodeType != Node.TEXT_NODE)
throw "Wrong node type: " + textNode;
- execSetSelectionCommand(textNode, 0, 0);
+ execSetSelectionCommand(textNode, 0, null);
}
function verifyTextSelection(startNode, startOffset, endNode, endOffset)
Modified: trunk/LayoutTests/editing/selection/4895428-2.html (203940 => 203941)
--- trunk/LayoutTests/editing/selection/4895428-2.html 2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/editing/selection/4895428-2.html 2016-07-30 08:35:06 UTC (rev 203941)
@@ -18,7 +18,7 @@
if (!window.testRunner)
return;
var cell = document.getElementById("cell");
- cell.addEventListener(handleBlur, "DOMBlurEvent");
+ cell.addEventListener("DOMBlurEvent", handleBlur);
var div = document.getElementById("div");
div.focus();
document.execCommand("SelectAll");
Modified: trunk/LayoutTests/editing/selection/move-by-word-visually-null-box.html (203940 => 203941)
--- trunk/LayoutTests/editing/selection/move-by-word-visually-null-box.html 2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-null-box.html 2016-07-30 08:35:06 UTC (rev 203941)
@@ -9,7 +9,7 @@
// Test NULL VisiblePosition.
var selection = getSelection();
- selection.setPosition(0, 0);
+ selection.setPosition(null, 0);
selection.modify("move", "right", "-webkit-visual-word");
document.body.innerHTML = "Crash test passed";
} finally {
Modified: trunk/LayoutTests/fast/dom/DOMImplementation/detached-doctype.html (203940 => 203941)
--- trunk/LayoutTests/fast/dom/DOMImplementation/detached-doctype.html 2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/fast/dom/DOMImplementation/detached-doctype.html 2016-07-30 08:35:06 UTC (rev 203941)
@@ -14,7 +14,7 @@
testRunner.dumpAsText();
var o = document.implementation.createDocumentType('x', null, null);
-var doc = document.implementation.createDocument("doc", null, 0);
+var doc = document.implementation.createDocument("doc", null, null);
for (i in o) {
try { o[i]; } catch (e) {}
try { o[i](); } catch (e) {}
Modified: trunk/LayoutTests/fast/dom/MutationObserver/observe-attributes.html (203940 => 203941)
--- trunk/LayoutTests/fast/dom/MutationObserver/observe-attributes.html 2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/fast/dom/MutationObserver/observe-attributes.html 2016-07-30 08:35:06 UTC (rev 203941)
@@ -595,7 +595,7 @@
function start() {
debug('Testing that attributeFilter respects case with non-HTML elements.');
- svgDoc = document.implementation.createDocument('http://www.w3.org/2000/svg', 'svg', 'svg');
+ svgDoc = document.implementation.createDocument('http://www.w3.org/2000/svg', 'svg', null);
mutations = null;
observer = new MutationObserver(function(m) {
mutations = m;
Modified: trunk/LayoutTests/fast/dom/Node/contains-method-expected.txt (203940 => 203941)
--- trunk/LayoutTests/fast/dom/Node/contains-method-expected.txt 2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/fast/dom/Node/contains-method-expected.txt 2016-07-30 08:35:06 UTC (rev 203941)
@@ -12,7 +12,7 @@
PASS document.contains(document) is true
PASS test1.contains(test1) is true
PASS test1TextChild.contains(test1TextChild) is true
-PASS test1.contains(123) is false
+PASS test1.contains(123) threw exception TypeError: Argument 1 ('other') to Node.contains must be an instance of Node.
PASS test1.contains(null) is false
PASS document.contains(iframe) is false
PASS iframe.contains(iframe) is true
Modified: trunk/LayoutTests/fast/dom/Node/script-tests/contains-method.js (203940 => 203941)
--- trunk/LayoutTests/fast/dom/Node/script-tests/contains-method.js 2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/fast/dom/Node/script-tests/contains-method.js 2016-07-30 08:35:06 UTC (rev 203941)
@@ -14,7 +14,7 @@
shouldBeTrue("document.contains(document)");
shouldBeTrue("test1.contains(test1)");
shouldBeTrue("test1TextChild.contains(test1TextChild)");
-shouldBeFalse("test1.contains(123)");
+shouldThrow("test1.contains(123)");
shouldBeFalse("test1.contains(null)");
// Cross document tests
Modified: trunk/LayoutTests/fast/dom/Window/webkitConvertPoint.html (203940 => 203941)
--- trunk/LayoutTests/fast/dom/Window/webkitConvertPoint.html 2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/fast/dom/Window/webkitConvertPoint.html 2016-07-30 08:35:06 UTC (rev 203941)
@@ -113,12 +113,7 @@
description("This test exercises the webkitConvertPointFromNodeToPage() function");
debug("Test parameter passing - should not crash");
- var point = webkitConvertPointFromNodeToPage(new WebKitPoint(0, 0));
- if (point == null)
- testPassed("Missing parameter test");
- else
- testFailed("Missing parameter test");
- debug("Test did not crash and therefore was successful");
+ shouldThrow("webkitConvertPointFromNodeToPage(new WebKitPoint(0, 0))");
debug("");
point = webkitConvertPointFromNodeToPage(null, new WebKitPoint(0, 0));
if (point == null)
Modified: trunk/LayoutTests/fast/dom/adopt-node-crash-2.html (203940 => 203941)
--- trunk/LayoutTests/fast/dom/adopt-node-crash-2.html 2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/fast/dom/adopt-node-crash-2.html 2016-07-30 08:35:06 UTC (rev 203941)
@@ -25,6 +25,8 @@
if (window.testRunner)
testRunner.notifyDone();
}
-document.addEventListener("DOMContentLoaded", setTimeout("doit()", 1), false);
+document.addEventListener("DOMContentLoaded", function() {
+ setTimeout("doit()", 1);
+}, false);
</script>
</html>
Modified: trunk/LayoutTests/fast/dom/incompatible-operations-expected.txt (203940 => 203941)
--- trunk/LayoutTests/fast/dom/incompatible-operations-expected.txt 2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/fast/dom/incompatible-operations-expected.txt 2016-07-30 08:35:06 UTC (rev 203941)
@@ -6,8 +6,8 @@
PASS aNode.appendChild(aDOMImplementation) threw exception TypeError: Argument 1 ('node') to Node.appendChild must be an instance of Node.
PASS aNode.appendChild('knort') threw exception TypeError: Argument 1 ('node') to Node.appendChild must be an instance of Node.
PASS aNode.appendChild(void 0) threw exception TypeError: Argument 1 ('node') to Node.appendChild must be an instance of Node.
-PASS aNode.isSameNode(aDOMImplementation) is false
-PASS aNode.isSameNode('foo') is false
+PASS aNode.isSameNode(aDOMImplementation) threw exception TypeError: Argument 1 ('other') to Node.isSameNode must be an instance of Node.
+PASS aNode.isSameNode('foo') threw exception TypeError: Argument 1 ('other') to Node.isSameNode must be an instance of Node.
PASS aNode.isSameNode(void 0) is false
PASS aNode.lookupPrefix(aDOMImplementation) is null
PASS aNode.lookupPrefix(void 0) is null
Modified: trunk/LayoutTests/fast/dom/incompatible-operations.html (203940 => 203941)
--- trunk/LayoutTests/fast/dom/incompatible-operations.html 2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/fast/dom/incompatible-operations.html 2016-07-30 08:35:06 UTC (rev 203941)
@@ -34,8 +34,8 @@
shouldThrow("aNode.appendChild(void 0)");
-shouldBeFalse("aNode.isSameNode(aDOMImplementation)");
-shouldBeFalse("aNode.isSameNode('foo')");
+shouldThrow("aNode.isSameNode(aDOMImplementation)");
+shouldThrow("aNode.isSameNode('foo')");
shouldBeFalse("aNode.isSameNode(void 0)");
shouldBe("aNode.lookupPrefix(aDOMImplementation)", "null");
shouldBe("aNode.lookupPrefix(void 0)", "null");
Modified: trunk/LayoutTests/fast/events/selectstart-by-arrow-keys.html (203940 => 203941)
--- trunk/LayoutTests/fast/events/selectstart-by-arrow-keys.html 2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/fast/events/selectstart-by-arrow-keys.html 2016-07-30 08:35:06 UTC (rev 203941)
@@ -39,7 +39,7 @@
// On Mac, home/end doesn't move caret so manually select " World".
if (navigator.platform.indexOf('Mac') == 0)
- window.getSelection().setBaseAndExtent(div.firstChild, div.textContent.indexOf('World'), div.textContent.length);
+ window.getSelection().setBaseAndExtent(div.firstChild, div.textContent.indexOf('World'));
eventSender.keyDown("leftArrow");
logResult('Check (Left arrow)', 1);
Modified: trunk/LayoutTests/fast/images/image-copy-memory-usage.html (203940 => 203941)
--- trunk/LayoutTests/fast/images/image-copy-memory-usage.html 2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/fast/images/image-copy-memory-usage.html 2016-07-30 08:35:06 UTC (rev 203941)
@@ -41,7 +41,7 @@
// Add a listener for clipboard copy events which will then check how much memory was used to perform
// the copy and also finish the test. setTimeout() is used with a zero delay in order to cause this to
// run after the copy is finished.
- document.getElementById("animationFrame").contentWindow.document.addEventListener("copy",
+ document.getElementById("animationFrame").contentWindow.document.addEventListener("copy", function() {
setTimeout(
function()
{
@@ -50,7 +50,7 @@
shouldBeTrue("changeInCommittedVMBytes < 200000000");
window.finishJSTest();
},
- 0),
+ 0) },
false);
// Exit if execCommand("copy") is not supported since that is needed to automatically copy the animation
Modified: trunk/LayoutTests/fast/xsl/xslt-processor-expected.txt (203940 => 203941)
--- trunk/LayoutTests/fast/xsl/xslt-processor-expected.txt 2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/fast/xsl/xslt-processor-expected.txt 2016-07-30 08:35:06 UTC (rev 203941)
@@ -60,7 +60,7 @@
2.2 fragment with undefined output document:
Success
2.3 use non-DOMDocument output parameter:
-****Failure**** (expected exception, instead got result: "null")
+Success
2.4 transform to same fragment twice:
Success
2.5 transformed fragment containing only text:
Modified: trunk/LayoutTests/http/tests/misc/webtiming-cross-origin-and-back1.html (203940 => 203941)
--- trunk/LayoutTests/http/tests/misc/webtiming-cross-origin-and-back1.html 2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/http/tests/misc/webtiming-cross-origin-and-back1.html 2016-07-30 08:35:06 UTC (rev 203941)
@@ -7,7 +7,9 @@
function doRedirect() {
window.location = "http://127.0.0.1:8000/misc/resources/webtiming-cross-origin-and-back-redirect1.php";
}
-addEventListener("load", setTimeout(doRedirect, 0));
+addEventListener("load", function() {
+ setTimeout(doRedirect, 0);
+});
</script>
</head>
<body>
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (203940 => 203941)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2016-07-30 08:35:06 UTC (rev 203941)
@@ -1,3 +1,14 @@
+2016-07-30 Chris Dumez <[email protected]>
+
+ [WebIDL] Enable strict type checking for operations' nullable parameters of wrapper types
+ https://bugs.webkit.org/show_bug.cgi?id=160374
+
+ Reviewed by Youenn Fablet.
+
+ Rebaseline W3C test now that one more check is passing.
+
+ * web-platform-tests/dom/nodes/DOMImplementation-createDocument-expected.txt:
+
2016-07-29 Chris Dumez <[email protected]>
Window's named properties should be exposed on a WindowProperties object in its prototype
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/DOMImplementation-createDocument-expected.txt (203940 => 203941)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/DOMImplementation-createDocument-expected.txt 2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/DOMImplementation-createDocument-expected.txt 2016-07-30 08:35:06 UTC (rev 203941)
@@ -267,7 +267,7 @@
PASS createDocument test 154: "foo:","xmlfoo:bar",null,null
PASS createDocument test 154: metadata for "foo:","xmlfoo:bar",null
PASS createDocument test 154: characterSet aliases for "foo:","xmlfoo:bar",null
-FAIL createDocument test 155: null,null,false,object "TypeError" assert_throws: function "function () { document.implementation.createDocument(name..." did not throw
+PASS createDocument test 155: null,null,false,object "TypeError"
PASS createDocument test 156: null,null,null,null
PASS createDocument test 156: metadata for null,null,null
PASS createDocument test 156: characterSet aliases for null,null,null
Modified: trunk/LayoutTests/platform/mac/fast/dom/Window/webkitConvertPoint-expected.txt (203940 => 203941)
--- trunk/LayoutTests/platform/mac/fast/dom/Window/webkitConvertPoint-expected.txt 2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/platform/mac/fast/dom/Window/webkitConvertPoint-expected.txt 2016-07-30 08:35:06 UTC (rev 203941)
@@ -27,8 +27,7 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Test parameter passing - should not crash
-PASS Missing parameter test
-Test did not crash and therefore was successful
+PASS webkitConvertPointFromNodeToPage(new WebKitPoint(0, 0)) threw exception TypeError: Argument 1 ('node') to Window.webkitConvertPointFromNodeToPage must be an instance of Node.
PASS null parameter test a
Test did not crash and therefore was successful
Modified: trunk/LayoutTests/svg/custom/unicode-in-tspan-multi-svg-crash.html (203940 => 203941)
--- trunk/LayoutTests/svg/custom/unicode-in-tspan-multi-svg-crash.html 2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/svg/custom/unicode-in-tspan-multi-svg-crash.html 2016-07-30 08:35:06 UTC (rev 203941)
@@ -14,7 +14,7 @@
document.designMode='on';
filterInFirstRoot = document.getElementById('filterInFirstRoot');
useElement = document.getElementById('useElement');
- window.getSelection().setBaseAndExtent(filterInFirstRoot, useElement, 5);
+ window.getSelection().setBaseAndExtent(filterInFirstRoot, 0);
document.execCommand('ForwardDelete');
document.designMode='off';
}
Modified: trunk/Source/WebCore/ChangeLog (203940 => 203941)
--- trunk/Source/WebCore/ChangeLog 2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/Source/WebCore/ChangeLog 2016-07-30 08:35:06 UTC (rev 203941)
@@ -1,3 +1,42 @@
+2016-07-30 Chris Dumez <[email protected]>
+
+ [WebIDL] Enable strict type checking for operations' nullable parameters of wrapper types
+ https://bugs.webkit.org/show_bug.cgi?id=160374
+
+ Reviewed by Youenn Fablet.
+
+ 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.
+
2016-07-29 Chris Dumez <[email protected]>
Window's named properties should be exposed on a WindowProperties object in its prototype
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (203940 => 203941)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-07-30 08:35:06 UTC (rev 203941)
@@ -3750,7 +3750,7 @@
my $isTearOff = $codeGenerator->IsSVGTypeNeedingTearOff($type) && $interfaceName !~ /List$/;
my $shouldPassByReference = $isTearOff || ShouldPassWrapperByReference($parameter, $interface);
- if ($function->signature->extendedAttributes->{"StrictTypeChecking"} && !$shouldPassByReference && $codeGenerator->IsWrapperType($type)) {
+ if (!$shouldPassByReference && $codeGenerator->IsWrapperType($type)) {
$implIncludes{"<runtime/Error.h>"} = 1;
my $checkedArgument = "state->argument($argumentIndex)";
my $uncheckedArgument = "state->uncheckedArgument($argumentIndex)";
@@ -3759,12 +3759,13 @@
push(@$outputArray, " if (!$checkedArgument.isUndefinedOrNull()) {\n");
push(@$outputArray, " $name = $nativeValue;\n");
if ($mayThrowException) {
- push(@$outputArray, " if (UNLIKELY(state->hadException()))\n");
- push(@$outputArray, " return JSValue::encode(jsUndefined());\n");
+ push(@$outputArray, " if (UNLIKELY(state->hadException()))\n");
+ push(@$outputArray, " return JSValue::encode(jsUndefined());\n");
}
push(@$outputArray, " if (UNLIKELY(!$name))\n");
push(@$outputArray, " return throwArgumentTypeError(*state, $argumentIndex, \"$name\", \"$visibleInterfaceName\", $quotedFunctionName, \"$type\");\n");
push(@$outputArray, " }\n");
+ $value = "WTFMove($name)";
} else {
if ($parameter->isOptional && defined($parameter->default) && !WillConvertUndefinedToDefaultParameterValue($type, $parameter->default)) {
my $defaultValue = $parameter->default;
@@ -4295,6 +4296,7 @@
"DOMTimeStamp" => "DOMTimeStamp",
"Date" => "double",
"Dictionary" => "Dictionary",
+ "EventListener" => "RefPtr<EventListener>",
"SerializedScriptValue" => "RefPtr<SerializedScriptValue>",
"XPathNSResolver" => "RefPtr<XPathNSResolver>",
"any" => "JSC::JSValue",
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (203940 => 203941)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-07-30 08:35:06 UTC (rev 203941)
@@ -5028,7 +5028,12 @@
return throwThisTypeError(*state, "TestObject", "methodWithOptionalNullableWrapper");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
auto& impl = castedThis->wrapped();
- auto obj = JSTestObj::toWrapped(state->argument(0));
+ TestObj* obj = nullptr;
+ if (!state->argument(0).isUndefinedOrNull()) {
+ obj = JSTestObj::toWrapped(state->uncheckedArgument(0));
+ if (UNLIKELY(!obj))
+ return throwArgumentTypeError(*state, 0, "obj", "TestObject", "methodWithOptionalNullableWrapper", "TestObj");
+ }
impl.methodWithOptionalNullableWrapper(WTFMove(obj));
return JSValue::encode(jsUndefined());
}
@@ -5041,7 +5046,12 @@
return throwThisTypeError(*state, "TestObject", "methodWithOptionalNullableWrapperIsNull");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
auto& impl = castedThis->wrapped();
- auto obj = JSTestObj::toWrapped(state->argument(0));
+ TestObj* obj = nullptr;
+ if (!state->argument(0).isUndefinedOrNull()) {
+ obj = JSTestObj::toWrapped(state->uncheckedArgument(0));
+ if (UNLIKELY(!obj))
+ return throwArgumentTypeError(*state, 0, "obj", "TestObject", "methodWithOptionalNullableWrapperIsNull", "TestObj");
+ }
impl.methodWithOptionalNullableWrapperIsNull(WTFMove(obj));
return JSValue::encode(jsUndefined());
}
@@ -5054,9 +5064,14 @@
return throwThisTypeError(*state, "TestObject", "methodWithOptionalXPathNSResolver");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
auto& impl = castedThis->wrapped();
- auto resolver = JSXPathNSResolver::toWrapped(*state, state->argument(0));
- if (UNLIKELY(state->hadException()))
- return JSValue::encode(jsUndefined());
+ RefPtr<XPathNSResolver> resolver = nullptr;
+ if (!state->argument(0).isUndefinedOrNull()) {
+ resolver = JSXPathNSResolver::toWrapped(*state, state->uncheckedArgument(0));
+ if (UNLIKELY(state->hadException()))
+ return JSValue::encode(jsUndefined());
+ if (UNLIKELY(!resolver))
+ return throwArgumentTypeError(*state, 0, "resolver", "TestObject", "methodWithOptionalXPathNSResolver", "XPathNSResolver");
+ }
impl.methodWithOptionalXPathNSResolver(WTFMove(resolver));
return JSValue::encode(jsUndefined());
}
@@ -5249,7 +5264,12 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 2))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto objArg = JSTestObj::toWrapped(state->argument(0));
+ TestObj* objArg = nullptr;
+ if (!state->argument(0).isUndefinedOrNull()) {
+ objArg = JSTestObj::toWrapped(state->uncheckedArgument(0));
+ if (UNLIKELY(!objArg))
+ return throwArgumentTypeError(*state, 0, "objArg", "TestObject", "overloadedMethod", "TestObj");
+ }
auto strArg = state->argument(1).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
@@ -5267,7 +5287,12 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto objArg = JSTestObj::toWrapped(state->argument(0));
+ TestObj* objArg = nullptr;
+ if (!state->argument(0).isUndefinedOrNull()) {
+ objArg = JSTestObj::toWrapped(state->uncheckedArgument(0));
+ if (UNLIKELY(!objArg))
+ return throwArgumentTypeError(*state, 0, "objArg", "TestObject", "overloadedMethod", "TestObj");
+ }
auto longArg = state->argument(1).isUndefined() ? Optional<int32_t>() : convert<int32_t>(*state, state->uncheckedArgument(1), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
@@ -5336,9 +5361,14 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto listArg = JSDOMStringList::toWrapped(*state, state->argument(0));
- if (UNLIKELY(state->hadException()))
- return JSValue::encode(jsUndefined());
+ RefPtr<DOMStringList> listArg = nullptr;
+ if (!state->argument(0).isUndefinedOrNull()) {
+ listArg = JSDOMStringList::toWrapped(*state, state->uncheckedArgument(0));
+ if (UNLIKELY(state->hadException()))
+ return JSValue::encode(jsUndefined());
+ if (UNLIKELY(!listArg))
+ return throwArgumentTypeError(*state, 0, "listArg", "TestObject", "overloadedMethod", "DOMStringList");
+ }
impl.overloadedMethod(WTFMove(listArg));
return JSValue::encode(jsUndefined());
}
@@ -5493,8 +5523,18 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto objArg1 = JSTestObj::toWrapped(state->argument(0));
- auto objArg2 = JSTestObj::toWrapped(state->argument(1));
+ TestObj* objArg1 = nullptr;
+ if (!state->argument(0).isUndefinedOrNull()) {
+ objArg1 = JSTestObj::toWrapped(state->uncheckedArgument(0));
+ if (UNLIKELY(!objArg1))
+ return throwArgumentTypeError(*state, 0, "objArg1", "TestObject", "overloadedMethodWithOptionalParameter", "TestObj");
+ }
+ TestObj* objArg2 = nullptr;
+ if (!state->argument(1).isUndefinedOrNull()) {
+ objArg2 = JSTestObj::toWrapped(state->uncheckedArgument(1));
+ if (UNLIKELY(!objArg2))
+ return throwArgumentTypeError(*state, 1, "objArg2", "TestObject", "overloadedMethodWithOptionalParameter", "TestObj");
+ }
impl.overloadedMethodWithOptionalParameter(WTFMove(objArg1), WTFMove(objArg2));
return JSValue::encode(jsUndefined());
}
@@ -5509,7 +5549,12 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto objArg = JSTestObj::toWrapped(state->argument(0));
+ TestObj* objArg = nullptr;
+ if (!state->argument(0).isUndefinedOrNull()) {
+ objArg = JSTestObj::toWrapped(state->uncheckedArgument(0));
+ if (UNLIKELY(!objArg))
+ return throwArgumentTypeError(*state, 0, "objArg", "TestObject", "overloadedMethodWithOptionalParameter", "TestObj");
+ }
auto longArg = state->argument(1).isUndefined() ? Optional<int32_t>() : convert<int32_t>(*state, state->uncheckedArgument(1), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
@@ -5800,7 +5845,12 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto value = JSTestNode::toWrapped(state->argument(0));
+ TestNode* value = nullptr;
+ if (!state->argument(0).isUndefinedOrNull()) {
+ value = JSTestNode::toWrapped(state->uncheckedArgument(0));
+ if (UNLIKELY(!value))
+ return throwArgumentTypeError(*state, 0, "value", "TestObject", "convert2", "TestNode");
+ }
impl.convert2(WTFMove(value));
return JSValue::encode(jsUndefined());
}
@@ -5921,7 +5971,7 @@
auto a = toNativeArray<uint32_t>(*state, state->argument(1));
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- JSValue result = jsBoolean(impl.strictFunctionWithSequence(objArg, WTFMove(a), ec));
+ JSValue result = jsBoolean(impl.strictFunctionWithSequence(WTFMove(objArg), WTFMove(a), ec));
setDOMException(state, ec);
return JSValue::encode(result);