Title: [92816] trunk
Revision
92816
Author
[email protected]
Date
2011-08-10 20:58:17 -0700 (Wed, 10 Aug 2011)

Log Message

Add tests of optional arguments for Geolocation
https://bugs.webkit.org/show_bug.cgi?id=65810

Reviewed by Sam Weinig.

Source/WebCore:

Geolocation's treatment of not-enough-arguments almost matches the
spec.  getCurrentPosition and watchPosition work properly, but, because
they are custom, we should use the prettier form of the [Optional]
attribute.

Before this series of patches, clearWatch argument was optional, but
that doesn't match the spec or other browsers.  Calling this function
with zero arguments is pretty non-sensical, so there shouldn't be much
compat risk to tightening up our behavior here.  Matching other
browsers and the spec seems like the bigger win.  If we run into compat
problems, we can re-evaluate this decision.

Test: fast/dom/Geolocation/not-enough-arguments.html

* page/Geolocation.idl:

LayoutTests:

Test what happens when calling geolocation APIs with too few arguments.

* fast/dom/Geolocation/not-enough-arguments-expected.txt: Added.
* fast/dom/Geolocation/not-enough-arguments.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (92815 => 92816)


--- trunk/LayoutTests/ChangeLog	2011-08-11 02:27:50 UTC (rev 92815)
+++ trunk/LayoutTests/ChangeLog	2011-08-11 03:58:17 UTC (rev 92816)
@@ -1,3 +1,15 @@
+2011-08-10  Adam Barth  <[email protected]>
+
+        Add tests of optional arguments for Geolocation
+        https://bugs.webkit.org/show_bug.cgi?id=65810
+
+        Reviewed by Sam Weinig.
+
+        Test what happens when calling geolocation APIs with too few arguments.
+
+        * fast/dom/Geolocation/not-enough-arguments-expected.txt: Added.
+        * fast/dom/Geolocation/not-enough-arguments.html: Added.
+
 2011-08-10  Anders Carlsson  <[email protected]>
 
         Skip some more tests on Lion.

Added: trunk/LayoutTests/fast/dom/Geolocation/not-enough-arguments-expected.txt (0 => 92816)


--- trunk/LayoutTests/fast/dom/Geolocation/not-enough-arguments-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Geolocation/not-enough-arguments-expected.txt	2011-08-11 03:58:17 UTC (rev 92816)
@@ -0,0 +1,12 @@
+Tests how Geolocation handles receiving too few arguments.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS window.navigator.geolocation.getCurrentPosition() threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS window.navigator.geolocation.watchPosition() threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS window.navigator.geolocation.clearWatch() threw exception TypeError: Not enough arguments.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/Geolocation/not-enough-arguments.html (0 => 92816)


--- trunk/LayoutTests/fast/dom/Geolocation/not-enough-arguments.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Geolocation/not-enough-arguments.html	2011-08-11 03:58:17 UTC (rev 92816)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description("Tests how Geolocation handles receiving too few arguments.");
+
+shouldThrow("window.navigator.geolocation.getCurrentPosition()");
+shouldThrow("window.navigator.geolocation.watchPosition()");
+shouldThrow("window.navigator.geolocation.clearWatch()");
+
+window.successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (92815 => 92816)


--- trunk/Source/WebCore/ChangeLog	2011-08-11 02:27:50 UTC (rev 92815)
+++ trunk/Source/WebCore/ChangeLog	2011-08-11 03:58:17 UTC (rev 92816)
@@ -1,3 +1,26 @@
+2011-08-10  Adam Barth  <[email protected]>
+
+        Add tests of optional arguments for Geolocation
+        https://bugs.webkit.org/show_bug.cgi?id=65810
+
+        Reviewed by Sam Weinig.
+
+        Geolocation's treatment of not-enough-arguments almost matches the
+        spec.  getCurrentPosition and watchPosition work properly, but, because
+        they are custom, we should use the prettier form of the [Optional]
+        attribute.
+
+        Before this series of patches, clearWatch argument was optional, but
+        that doesn't match the spec or other browsers.  Calling this function
+        with zero arguments is pretty non-sensical, so there shouldn't be much
+        compat risk to tightening up our behavior here.  Matching other
+        browsers and the spec seems like the bigger win.  If we run into compat
+        problems, we can re-evaluate this decision.
+
+        Test: fast/dom/Geolocation/not-enough-arguments.html
+
+        * page/Geolocation.idl:
+
 2011-08-10  Tim Horton  <[email protected]>
 
         SVGAElement check for internal non-view anchors is inside ENABLE(SVG_ANIMATION)

Modified: trunk/Source/WebCore/page/Geolocation.idl (92815 => 92816)


--- trunk/Source/WebCore/page/Geolocation.idl	2011-08-11 02:27:50 UTC (rev 92815)
+++ trunk/Source/WebCore/page/Geolocation.idl	2011-08-11 03:58:17 UTC (rev 92816)
@@ -25,18 +25,19 @@
 
 module core {
 
+    // http://www.w3.org/TR/geolocation-API/#geolocation_interface
     interface [
         Conditional=GEOLOCATION, 
         GenerateIsReachable=ImplFrame,
         OmitConstructor
     ] Geolocation {
-        [Custom] void getCurrentPosition(in PositionCallback successCallback, 
-                                         in [Optional=CallWithDefaultValue] PositionErrorCallback errorCallback, 
-                                         in [Optional=CallWithDefaultValue] PositionOptions options);
+        [Custom] void getCurrentPosition(in PositionCallback successCallback,
+                                         in [Optional] PositionErrorCallback errorCallback,
+                                         in [Optional] PositionOptions options);
 
-        [Custom] long watchPosition(in PositionCallback successCallback, 
-                                    in [Optional=CallWithDefaultValue] PositionErrorCallback errorCallback, 
-                                    in [Optional=CallWithDefaultValue] PositionOptions options);
+        [Custom] long watchPosition(in PositionCallback successCallback,
+                                    in [Optional] PositionErrorCallback errorCallback,
+                                    in [Optional] PositionOptions options);
 
         void clearWatch(in long watchId);
     };
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to