WebCore: Geolocation PositionOptions does not use correct default values.
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Aug 2009 23:34:12 +0000 (23:34 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Aug 2009 23:34:12 +0000 (23:34 +0000)
commit5a6a0c0f5ac1dcda96338bff098dde4d59ea3aa7
tree936ef2bc926107bf537cf7dba70036d19aafb850
parentf1169804e293bc5ab11d81ac7a66459e336abc80
WebCore: Geolocation PositionOptions does not use correct default values.
https://bugs.webkit.org/show_bug.cgi?id=27254

Patch by Steve Block <steveblock@google.com> on 2009-08-13
Reviewed by Darin Adler.

Sets the correct default values for the properties of the PositionOptions object
passed to Geolocation methods. See http://www.w3.org/TR/geolocation-API/.

Also adds checking to throw an exception if arguments of the incorrect type are
passed to Geolocation methods. Adds a layout test to test this. This test should
pass on all platforms where Geolocation is implemented.

Test: fast/dom/Geolocation/argument-types.html

* bindings/js/JSGeolocationCustom.cpp:
(WebCore::createPositionCallback): Added. Creates the callback.
(WebCore::createPositionErrorCallback): Added. Creates the calback.
(WebCore::createPositionOptions): Added. Creates the PositionOptions object, setting defaults where required.
(WebCore::JSGeolocation::getCurrentPosition): Modified. Now uses above helper functions.
(WebCore::JSGeolocation::watchPosition): Modified. Now uses above helper functions.
* page/Geolocation.cpp:
(WebCore::Geolocation::GeoNotifier::GeoNotifier): Modified. Asserts that PositionOptions object is present.
(WebCore::Geolocation::GeoNotifier::startTimer): Modified. Only starts timer if timeout has been set.
* page/PositionOptions.h:
(WebCore::PositionOptions::create): Modified. Creates object with default values.
(WebCore::PositionOptions::timeout): Modified. Uses correct type.
(WebCore::PositionOptions::hasTimeout): Added. Determines whether a timeout has been set.
(WebCore::PositionOptions::setTimeout): Modified. Uses correct type.
(WebCore::PositionOptions::maximumAge): Modified. Uses correct type.
(WebCore::PositionOptions::setMaximumAge): Modified. Uses correct type.
(WebCore::PositionOptions::PositionOptions): Modified. Creates object with default values.

LayoutTests: Geolocation PositionOptions does not use correct default values.
https://bugs.webkit.org/show_bug.cgi?id=27254

Patch by Steve Block <steveblock@google.com> on 2009-08-13
Reviewed by Darin Adler.

Adds a layout test to check the acceptable types for arguments to Geolocation methods.

* fast/dom/Geolocation/resources/argument-types.js: Added. Tests the types of the arguments that can be passed to Geolocation methods.
* fast/dom/Geolocation/argument-types.html: Added. HTML wrapper for above JS test.
* fast/dom/Geolocation/argument-types-expected.txt: Added. Expected output for above test.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@47252 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/dom/Geolocation/argument-types-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/Geolocation/argument-types.html [new file with mode: 0644]
LayoutTests/fast/dom/Geolocation/resources/argument-types.js [new file with mode: 0644]
WebCore/ChangeLog
WebCore/bindings/js/JSGeolocationCustom.cpp
WebCore/page/Geolocation.cpp
WebCore/page/PositionOptions.h