Title: [203805] trunk
Revision
203805
Author
[email protected]
Date
2016-07-27 16:50:07 -0700 (Wed, 27 Jul 2016)

Log Message

First parameter to setTimeout() / setInterval() should be mandatory
https://bugs.webkit.org/show_bug.cgi?id=160277

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline W3C test now that more checks are passing.

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

Source/WebCore:

First parameter to setTimeout() / setInterval() should be mandatory:
- https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope

Firefox and Chrome agree with the specification.

No new tests, rebaselined existing test.

* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::setTimeout):
(WebCore::JSDOMWindow::setInterval):
* bindings/js/JSWorkerGlobalScopeCustom.cpp:
(WebCore::JSWorkerGlobalScope::setTimeout):
(WebCore::JSWorkerGlobalScope::setInterval):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (203804 => 203805)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-07-27 23:36:05 UTC (rev 203804)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-07-27 23:50:07 UTC (rev 203805)
@@ -1,5 +1,16 @@
 2016-07-27  Chris Dumez  <[email protected]>
 
+        First parameter to setTimeout() / setInterval() should be mandatory
+        https://bugs.webkit.org/show_bug.cgi?id=160277
+
+        Reviewed by Darin Adler.
+
+        Rebaseline W3C test now that more checks are passing.
+
+        * web-platform-tests/html/dom/interfaces-expected.txt:
+
+2016-07-27  Chris Dumez  <[email protected]>
+
         Parameter to named property getter should be mandatory
         https://bugs.webkit.org/show_bug.cgi?id=160269
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt (203804 => 203805)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt	2016-07-27 23:36:05 UTC (rev 203804)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt	2016-07-27 23:50:07 UTC (rev 203805)
@@ -5454,23 +5454,15 @@
 PASS Window interface: window must inherit property "atob" with the proper type (115) 
 PASS Window interface: calling atob(DOMString) on window with too few arguments must throw TypeError 
 PASS Window interface: window must inherit property "setTimeout" with the proper type (116) 
-FAIL Window interface: calling setTimeout(Function,long,any) on window with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
-            fn.apply(obj, args);
-        }" did not throw
+PASS Window interface: calling setTimeout(Function,long,any) on window with too few arguments must throw TypeError 
 PASS Window interface: window must inherit property "setTimeout" with the proper type (117) 
-FAIL Window interface: calling setTimeout(DOMString,long,any) on window with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
-            fn.apply(obj, args);
-        }" did not throw
+PASS Window interface: calling setTimeout(DOMString,long,any) on window with too few arguments must throw TypeError 
 PASS Window interface: window must inherit property "clearTimeout" with the proper type (118) 
 PASS Window interface: calling clearTimeout(long) on window with too few arguments must throw TypeError 
 PASS Window interface: window must inherit property "setInterval" with the proper type (119) 
-FAIL Window interface: calling setInterval(Function,long,any) on window with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
-            fn.apply(obj, args);
-        }" did not throw
+PASS Window interface: calling setInterval(Function,long,any) on window with too few arguments must throw TypeError 
 PASS Window interface: window must inherit property "setInterval" with the proper type (120) 
-FAIL Window interface: calling setInterval(DOMString,long,any) on window with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
-            fn.apply(obj, args);
-        }" did not throw
+PASS Window interface: calling setInterval(DOMString,long,any) on window with too few arguments must throw TypeError 
 PASS Window interface: window must inherit property "clearInterval" with the proper type (121) 
 PASS Window interface: calling clearInterval(long) on window with too few arguments must throw TypeError 
 FAIL Window interface: window must inherit property "createImageBitmap" with the proper type (122) assert_own_property: expected property "createImageBitmap" missing

Modified: trunk/Source/WebCore/ChangeLog (203804 => 203805)


--- trunk/Source/WebCore/ChangeLog	2016-07-27 23:36:05 UTC (rev 203804)
+++ trunk/Source/WebCore/ChangeLog	2016-07-27 23:50:07 UTC (rev 203805)
@@ -1,5 +1,26 @@
 2016-07-27  Chris Dumez  <[email protected]>
 
+        First parameter to setTimeout() / setInterval() should be mandatory
+        https://bugs.webkit.org/show_bug.cgi?id=160277
+
+        Reviewed by Darin Adler.
+
+        First parameter to setTimeout() / setInterval() should be mandatory:
+        - https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope
+
+        Firefox and Chrome agree with the specification.
+
+        No new tests, rebaselined existing test.
+
+        * bindings/js/JSDOMWindowCustom.cpp:
+        (WebCore::JSDOMWindow::setTimeout):
+        (WebCore::JSDOMWindow::setInterval):
+        * bindings/js/JSWorkerGlobalScopeCustom.cpp:
+        (WebCore::JSWorkerGlobalScope::setTimeout):
+        (WebCore::JSWorkerGlobalScope::setInterval):
+
+2016-07-27  Chris Dumez  <[email protected]>
+
         Parameters to insertAdjacentText() / insertAdjacentHTML() should be mandatory
         https://bugs.webkit.org/show_bug.cgi?id=160274
 

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp (203804 => 203805)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp	2016-07-27 23:36:05 UTC (rev 203804)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp	2016-07-27 23:50:07 UTC (rev 203805)
@@ -562,6 +562,9 @@
 
 JSValue JSDOMWindow::setTimeout(ExecState& state)
 {
+    if (UNLIKELY(state.argumentCount() < 1))
+        return state.vm().throwException(&state, createNotEnoughArgumentsError(&state));
+
     ContentSecurityPolicy* contentSecurityPolicy = wrapped().document() ? wrapped().document()->contentSecurityPolicy() : nullptr;
     std::unique_ptr<ScheduledAction> action = "" globalObject()->world(), contentSecurityPolicy);
     if (state.hadException())
@@ -581,6 +584,9 @@
 
 JSValue JSDOMWindow::setInterval(ExecState& state)
 {
+    if (UNLIKELY(state.argumentCount() < 1))
+        return state.vm().throwException(&state, createNotEnoughArgumentsError(&state));
+
     ContentSecurityPolicy* contentSecurityPolicy = wrapped().document() ? wrapped().document()->contentSecurityPolicy() : nullptr;
     std::unique_ptr<ScheduledAction> action = "" globalObject()->world(), contentSecurityPolicy);
     if (state.hadException())

Modified: trunk/Source/WebCore/bindings/js/JSWorkerGlobalScopeCustom.cpp (203804 => 203805)


--- trunk/Source/WebCore/bindings/js/JSWorkerGlobalScopeCustom.cpp	2016-07-27 23:36:05 UTC (rev 203804)
+++ trunk/Source/WebCore/bindings/js/JSWorkerGlobalScopeCustom.cpp	2016-07-27 23:50:07 UTC (rev 203805)
@@ -79,6 +79,9 @@
 
 JSValue JSWorkerGlobalScope::setTimeout(ExecState& state)
 {
+    if (UNLIKELY(state.argumentCount() < 1))
+        return state.vm().throwException(&state, createNotEnoughArgumentsError(&state));
+
     std::unique_ptr<ScheduledAction> action = "" globalObject()->world(), wrapped().contentSecurityPolicy());
     if (state.hadException())
         return jsUndefined();
@@ -90,6 +93,9 @@
 
 JSValue JSWorkerGlobalScope::setInterval(ExecState& state)
 {
+    if (UNLIKELY(state.argumentCount() < 1))
+        return state.vm().throwException(&state, createNotEnoughArgumentsError(&state));
+
     std::unique_ptr<ScheduledAction> action = "" globalObject()->world(), wrapped().contentSecurityPolicy());
     if (state.hadException())
         return jsUndefined();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to