Title: [201627] trunk
- Revision
- 201627
- Author
- [email protected]
- Date
- 2016-06-02 16:45:31 -0700 (Thu, 02 Jun 2016)
Log Message
[WebIDL] 'undefined' should be an acceptable value for nullable parameters
https://bugs.webkit.org/show_bug.cgi?id=158321
Reviewed by Ryosuke Niwa.
LayoutTests/imported/w3c:
Rebaseline test. The test is failing because the first parameter to
createPattern is wrongly marked as nullable in our IDL and because our
implementation throws a legacy TYPE_MISMATCH_ERR instead of a standard
TypeError when getting null as first parameter. I will fix this bug
and this test via Bug 158322.
* canvas/2d.pattern.image.undefined-expected.txt:
Source/WebCore:
'undefined' should be an acceptable value for nullable parameters (and
should be converted to null):
- https://heycam.github.io/webidl/#es-nullable-type
Our bindings got most of the cases right but there was a bug in our
overload resolution code. This patch fixes it.
No new tests, already covered by existing tests.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateParametersCheckExpression):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter):
LayoutTests:
Rebaseline existing test that is now passing.
* canvas/philip/tests/2d.pattern.image.undefined-expected.txt:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (201626 => 201627)
--- trunk/LayoutTests/ChangeLog 2016-06-02 23:33:42 UTC (rev 201626)
+++ trunk/LayoutTests/ChangeLog 2016-06-02 23:45:31 UTC (rev 201627)
@@ -1,3 +1,14 @@
+2016-06-02 Chris Dumez <[email protected]>
+
+ [WebIDL] 'undefined' should be an acceptable value for nullable parameters
+ https://bugs.webkit.org/show_bug.cgi?id=158321
+
+ Reviewed by Ryosuke Niwa.
+
+ Rebaseline existing test that is now passing.
+
+ * canvas/philip/tests/2d.pattern.image.undefined-expected.txt:
+
2016-06-02 Oliver Hunt <[email protected]>
JS parser incorrectly handles invalid utf8 in error messages.
Modified: trunk/LayoutTests/canvas/philip/tests/2d.pattern.image.undefined-expected.txt (201626 => 201627)
--- trunk/LayoutTests/canvas/philip/tests/2d.pattern.image.undefined-expected.txt 2016-06-02 23:33:42 UTC (rev 201626)
+++ trunk/LayoutTests/canvas/philip/tests/2d.pattern.image.undefined-expected.txt 2016-06-02 23:45:31 UTC (rev 201627)
@@ -1 +1 @@
-Failed assertion: expected exception of type TYPE_MISMATCH_ERR, got: Type error
+Passed
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (201626 => 201627)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2016-06-02 23:33:42 UTC (rev 201626)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2016-06-02 23:45:31 UTC (rev 201627)
@@ -1,3 +1,18 @@
+2016-06-02 Chris Dumez <[email protected]>
+
+ [WebIDL] 'undefined' should be an acceptable value for nullable parameters
+ https://bugs.webkit.org/show_bug.cgi?id=158321
+
+ Reviewed by Ryosuke Niwa.
+
+ Rebaseline test. The test is failing because the first parameter to
+ createPattern is wrongly marked as nullable in our IDL and because our
+ implementation throws a legacy TYPE_MISMATCH_ERR instead of a standard
+ TypeError when getting null as first parameter. I will fix this bug
+ and this test via Bug 158322.
+
+ * canvas/2d.pattern.image.undefined-expected.txt:
+
2016-06-01 Nael Ouedraogo <[email protected]>
POST request on a blob resource should return a "network error" instead of HTTP 500 response
Modified: trunk/LayoutTests/imported/w3c/canvas/2d.pattern.image.undefined-expected.txt (201626 => 201627)
--- trunk/LayoutTests/imported/w3c/canvas/2d.pattern.image.undefined-expected.txt 2016-06-02 23:33:42 UTC (rev 201626)
+++ trunk/LayoutTests/imported/w3c/canvas/2d.pattern.image.undefined-expected.txt 2016-06-02 23:45:31 UTC (rev 201627)
@@ -2,4 +2,4 @@
Spec references: 2d.pattern.IDL
Defined in "Web IDL" (draft)
Actual output:
-Passed
+Failed assertion: expected exception of type TypeError, got: Error: TypeMismatchError: DOM Exception 17
Modified: trunk/Source/WebCore/ChangeLog (201626 => 201627)
--- trunk/Source/WebCore/ChangeLog 2016-06-02 23:33:42 UTC (rev 201626)
+++ trunk/Source/WebCore/ChangeLog 2016-06-02 23:45:31 UTC (rev 201627)
@@ -1,3 +1,25 @@
+2016-06-02 Chris Dumez <[email protected]>
+
+ [WebIDL] 'undefined' should be an acceptable value for nullable parameters
+ https://bugs.webkit.org/show_bug.cgi?id=158321
+
+ Reviewed by Ryosuke Niwa.
+
+ 'undefined' should be an acceptable value for nullable parameters (and
+ should be converted to null):
+ - https://heycam.github.io/webidl/#es-nullable-type
+
+ Our bindings got most of the cases right but there was a bug in our
+ overload resolution code. This patch fixes it.
+
+ No new tests, already covered by existing tests.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateParametersCheckExpression):
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore::jsTestObjPrototypeFunctionOverloadedMethod):
+ (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter):
+
2016-06-02 Brady Eidson <[email protected]>
Modernize how many platform/network classes do isolatedCopy().
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (201626 => 201627)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-06-02 23:33:42 UTC (rev 201626)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-06-02 23:45:31 UTC (rev 201627)
@@ -1687,9 +1687,8 @@
my $condition = "";
$condition .= "${value}.isUndefined() || " if $parameter->isOptional;
- # FIXME: WebIDL says that undefined is also acceptable for nullable parameters and should be converted to null:
# http://heycam.github.io/webidl/#es-nullable-type
- $condition .= "${value}.isNull() || " if $parameter->isNullable;
+ $condition .= "${value}.isUndefinedOrNull() || " if $parameter->isNullable;
if ($codeGenerator->GetArrayOrSequenceType($type)) {
# FIXME: Add proper support for T[], T[]?, sequence<T>.
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (201626 => 201627)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-06-02 23:33:42 UTC (rev 201626)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-06-02 23:45:31 UTC (rev 201627)
@@ -5399,9 +5399,9 @@
size_t argsCount = std::min<size_t>(2, state->argumentCount());
JSValue arg0(state->argument(0));
JSValue arg1(state->argument(1));
- if ((argsCount == 2 && (arg0.isNull() || (arg0.isObject() && asObject(arg0)->inherits(JSTestObj::info()))) && (arg1.isUndefinedOrNull() || arg1.isString() || arg1.isObject())))
+ if ((argsCount == 2 && (arg0.isUndefinedOrNull() || (arg0.isObject() && asObject(arg0)->inherits(JSTestObj::info()))) && (arg1.isUndefinedOrNull() || arg1.isString() || arg1.isObject())))
return jsTestObjPrototypeFunctionOverloadedMethod1(state);
- if ((argsCount == 1 && (arg0.isNull() || (arg0.isObject() && asObject(arg0)->inherits(JSTestObj::info())))) || (argsCount == 2 && (arg0.isNull() || (arg0.isObject() && asObject(arg0)->inherits(JSTestObj::info())))))
+ if ((argsCount == 1 && (arg0.isUndefinedOrNull() || (arg0.isObject() && asObject(arg0)->inherits(JSTestObj::info())))) || (argsCount == 2 && (arg0.isUndefinedOrNull() || (arg0.isObject() && asObject(arg0)->inherits(JSTestObj::info())))))
return jsTestObjPrototypeFunctionOverloadedMethod2(state);
if ((argsCount == 1 && (arg0.isUndefinedOrNull() || arg0.isString() || arg0.isObject())))
return jsTestObjPrototypeFunctionOverloadedMethod3(state);
@@ -5409,9 +5409,9 @@
return jsTestObjPrototypeFunctionOverloadedMethod4(state);
if ((argsCount == 1 && (arg0.isNull() || arg0.isObject())))
return jsTestObjPrototypeFunctionOverloadedMethod5(state);
- if ((argsCount == 1 && (arg0.isNull() || (arg0.isObject() && asObject(arg0)->inherits(JSDOMStringList::info())))))
+ if ((argsCount == 1 && (arg0.isUndefinedOrNull() || (arg0.isObject() && asObject(arg0)->inherits(JSDOMStringList::info())))))
return jsTestObjPrototypeFunctionOverloadedMethod6(state);
- if ((argsCount == 1 && (arg0.isNull() || (arg0.isObject() && isJSArray(arg0)))))
+ if ((argsCount == 1 && (arg0.isUndefinedOrNull() || (arg0.isObject() && isJSArray(arg0)))))
return jsTestObjPrototypeFunctionOverloadedMethod7(state);
if ((argsCount == 1 && ((arg0.isObject() && asObject(arg0)->inherits(JSTestObj::info())))))
return jsTestObjPrototypeFunctionOverloadedMethod8(state);
@@ -5467,9 +5467,9 @@
size_t argsCount = std::min<size_t>(2, state->argumentCount());
JSValue arg0(state->argument(0));
JSValue arg1(state->argument(1));
- if ((argsCount == 1 && (arg0.isNull() || (arg0.isObject() && asObject(arg0)->inherits(JSTestObj::info())))) || (argsCount == 2 && (arg0.isNull() || (arg0.isObject() && asObject(arg0)->inherits(JSTestObj::info()))) && (arg1.isUndefined() || arg1.isNull() || (arg1.isObject() && asObject(arg1)->inherits(JSTestObj::info())))))
+ if ((argsCount == 1 && (arg0.isUndefinedOrNull() || (arg0.isObject() && asObject(arg0)->inherits(JSTestObj::info())))) || (argsCount == 2 && (arg0.isUndefinedOrNull() || (arg0.isObject() && asObject(arg0)->inherits(JSTestObj::info()))) && (arg1.isUndefined() || arg1.isUndefinedOrNull() || (arg1.isObject() && asObject(arg1)->inherits(JSTestObj::info())))))
return jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter1(state);
- if ((argsCount == 1 && (arg0.isNull() || (arg0.isObject() && asObject(arg0)->inherits(JSTestObj::info())))) || (argsCount == 2 && (arg0.isNull() || (arg0.isObject() && asObject(arg0)->inherits(JSTestObj::info())))))
+ if ((argsCount == 1 && (arg0.isUndefinedOrNull() || (arg0.isObject() && asObject(arg0)->inherits(JSTestObj::info())))) || (argsCount == 2 && (arg0.isUndefinedOrNull() || (arg0.isObject() && asObject(arg0)->inherits(JSTestObj::info())))))
return jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2(state);
if (UNLIKELY(argsCount < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes