2011-04-12 Steve Block <steveblock@google.com>
authorsteveblock@google.com <steveblock@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Apr 2011 08:13:34 +0000 (08:13 +0000)
committersteveblock@google.com <steveblock@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Apr 2011 08:13:34 +0000 (08:13 +0000)
        Reviewed by Oliver Hunt.

        Callable objects created via JavaScriptCore API cannot be used as Geolocation callbacks
        https://bugs.webkit.org/show_bug.cgi?id=40012

        Covered by fast/dom/Geolocation/argument-types.html
        This is a revert of http://trac.webkit.org/changeset/60522

        * fast/dom/Geolocation/argument-types-expected.txt:
        * fast/dom/Geolocation/script-tests/argument-types.js:
2011-04-12  Steve Block  <steveblock@google.com>

        Reviewed by Oliver Hunt.

        Callable objects created via JavaScriptCore API cannot be used as Geolocation callbacks
        https://bugs.webkit.org/show_bug.cgi?id=40012

        Covered by fast/dom/Geolocation/argument-types.html

        * bindings/js/CallbackFunction.cpp:
        (WebCore::checkFunctionOnlyCallback):

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

LayoutTests/ChangeLog
LayoutTests/fast/dom/Geolocation/argument-types-expected.txt
LayoutTests/fast/dom/Geolocation/script-tests/argument-types.js
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/CallbackFunction.cpp

index cb011b1..161d675 100644 (file)
@@ -1,3 +1,16 @@
+2011-04-12  Steve Block  <steveblock@google.com>
+
+        Reviewed by Oliver Hunt.
+
+        Callable objects created via JavaScriptCore API cannot be used as Geolocation callbacks
+        https://bugs.webkit.org/show_bug.cgi?id=40012
+
+        Covered by fast/dom/Geolocation/argument-types.html
+        This is a revert of http://trac.webkit.org/changeset/60522
+
+        * fast/dom/Geolocation/argument-types-expected.txt:
+        * fast/dom/Geolocation/script-tests/argument-types.js:
+
 2011-04-12  Andrey Kosyakov  <caseq@chromium.org>
 
         Unreviewed. Adjusted chrome test exceptations (state-url-sets-links-visited.html fails
index 23ea685..6c25000 100644 (file)
@@ -9,6 +9,8 @@ PASS navigator.geolocation.getCurrentPosition(null) threw exception Error: TYPE_
 PASS navigator.geolocation.getCurrentPosition({}) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
 PASS navigator.geolocation.getCurrentPosition(objectThrowingException) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
 PASS navigator.geolocation.getCurrentPosition(emptyFunction) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(Math.abs) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(layoutTestController.setGeolocationPermission) did not throw exception.
 PASS navigator.geolocation.getCurrentPosition(true) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
 PASS navigator.geolocation.getCurrentPosition(42) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
 PASS navigator.geolocation.getCurrentPosition(Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
@@ -19,6 +21,8 @@ PASS navigator.geolocation.getCurrentPosition(emptyFunction, null) did not throw
 PASS navigator.geolocation.getCurrentPosition(emptyFunction, {}) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
 PASS navigator.geolocation.getCurrentPosition(emptyFunction, objectThrowingException) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
 PASS navigator.geolocation.getCurrentPosition(emptyFunction, emptyFunction) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, Math.abs) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, layoutTestController.setGeolocationPermission) did not throw exception.
 PASS navigator.geolocation.getCurrentPosition(emptyFunction, true) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
 PASS navigator.geolocation.getCurrentPosition(emptyFunction, 42) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
 PASS navigator.geolocation.getCurrentPosition(emptyFunction, Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
index 01c77f5..73ffb41 100644 (file)
@@ -40,7 +40,8 @@ test('navigator.geolocation.getCurrentPosition(null)', true);
 test('navigator.geolocation.getCurrentPosition({})', true);
 test('navigator.geolocation.getCurrentPosition(objectThrowingException)', true);
 test('navigator.geolocation.getCurrentPosition(emptyFunction)', false);
-//test('navigator.geolocation.getCurrentPosition(Math.abs)', false);
+test('navigator.geolocation.getCurrentPosition(Math.abs)', false);
+test('navigator.geolocation.getCurrentPosition(layoutTestController.setGeolocationPermission)', false);
 test('navigator.geolocation.getCurrentPosition(true)', true);
 test('navigator.geolocation.getCurrentPosition(42)', true);
 test('navigator.geolocation.getCurrentPosition(Infinity)', true);
@@ -52,7 +53,8 @@ test('navigator.geolocation.getCurrentPosition(emptyFunction, null)', false);
 test('navigator.geolocation.getCurrentPosition(emptyFunction, {})', true);
 test('navigator.geolocation.getCurrentPosition(emptyFunction, objectThrowingException)', true);
 test('navigator.geolocation.getCurrentPosition(emptyFunction, emptyFunction)', false);
-//test('navigator.geolocation.getCurrentPosition(emptyFunction, Math.abs)', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, Math.abs)', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, layoutTestController.setGeolocationPermission)', false);
 test('navigator.geolocation.getCurrentPosition(emptyFunction, true)', true);
 test('navigator.geolocation.getCurrentPosition(emptyFunction, 42)', true);
 test('navigator.geolocation.getCurrentPosition(emptyFunction, Infinity)', true);
index 2549f7a..45724dd 100644 (file)
@@ -1,3 +1,15 @@
+2011-04-12  Steve Block  <steveblock@google.com>
+
+        Reviewed by Oliver Hunt.
+
+        Callable objects created via JavaScriptCore API cannot be used as Geolocation callbacks
+        https://bugs.webkit.org/show_bug.cgi?id=40012
+
+        Covered by fast/dom/Geolocation/argument-types.html
+
+        * bindings/js/CallbackFunction.cpp:
+        (WebCore::checkFunctionOnlyCallback):
+
 2011-04-07  Philippe Normand  <pnormand@igalia.com>
 
         Reviewed by Martin Robinson.
index 23eb47c..145d055 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "ExceptionCode.h"
 #include "JSDOMBinding.h"
-#include <runtime/JSFunction.h>
+#include <runtime/CallData.h>
 
 namespace WebCore {
 
@@ -39,9 +39,8 @@ bool checkFunctionOnlyCallback(JSC::ExecState* exec, JSC::JSValue value, Callbac
     if (value.isNull() && (acceptedValues & CallbackAllowNull))
         return false;
 
-    // FIXME: disallows callable objects created via JSC API. It's not clear what exactly the specification intends to allow.
-    // https://bugs.webkit.org/show_bug.cgi?id=40012
-    if (!value.inherits(&JSC::JSFunction::s_info)) {
+    JSC::CallData callData;
+    if (getCallData(value, callData) == JSC::CallTypeNone) {
         setDOMException(exec, TYPE_MISMATCH_ERR);
         return false;
     }