Title: [209612] trunk

Diff

Modified: trunk/LayoutTests/ChangeLog (209611 => 209612)


--- trunk/LayoutTests/ChangeLog	2016-12-09 17:57:39 UTC (rev 209611)
+++ trunk/LayoutTests/ChangeLog	2016-12-09 18:12:31 UTC (rev 209612)
@@ -1,3 +1,15 @@
+2016-12-09  Ryan Haddad  <ryanhad...@apple.com>
+
+        Unreviewed, rolling out r209574.
+
+        This change broke the Windows build.
+
+        Reverted changeset:
+
+        "[WebIDL] Remove custom bindings for Geolocation"
+        https://bugs.webkit.org/show_bug.cgi?id=165625
+        http://trac.webkit.org/changeset/209574
+
 2016-12-09  Gustavo Noronha Silva  <gustavo.noro...@collabora.co.uk>
 
         Fedora also needs a PHP7 config file alternative

Modified: trunk/LayoutTests/fast/dom/Geolocation/argument-types-expected.txt (209611 => 209612)


--- trunk/LayoutTests/fast/dom/Geolocation/argument-types-expected.txt	2016-12-09 17:57:39 UTC (rev 209611)
+++ trunk/LayoutTests/fast/dom/Geolocation/argument-types-expected.txt	2016-12-09 18:12:31 UTC (rev 209612)
@@ -3,41 +3,41 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS navigator.geolocation.getCurrentPosition() threw exception TypeError: Not enough arguments.
-PASS navigator.geolocation.getCurrentPosition(undefined) threw exception TypeError: Argument 1 ('successCallback') to Geolocation.getCurrentPosition must be a function.
-PASS navigator.geolocation.getCurrentPosition(null) threw exception TypeError: Argument 1 ('successCallback') to Geolocation.getCurrentPosition must be a function.
-PASS navigator.geolocation.getCurrentPosition({}) threw exception TypeError: Argument 1 ('successCallback') to Geolocation.getCurrentPosition must be a function.
-PASS navigator.geolocation.getCurrentPosition(objectThrowingException) threw exception TypeError: Argument 1 ('successCallback') to Geolocation.getCurrentPosition must be a function.
+PASS navigator.geolocation.getCurrentPosition() threw exception TypeMismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object..
+PASS navigator.geolocation.getCurrentPosition(undefined) threw exception TypeMismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object..
+PASS navigator.geolocation.getCurrentPosition(null) threw exception TypeMismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object..
+PASS navigator.geolocation.getCurrentPosition({}) threw exception TypeMismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object..
+PASS navigator.geolocation.getCurrentPosition(objectThrowingException) threw exception TypeMismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object..
 PASS navigator.geolocation.getCurrentPosition(emptyFunction) did not throw exception.
 PASS navigator.geolocation.getCurrentPosition(Math.abs) did not throw exception.
 PASS navigator.geolocation.getCurrentPosition(testRunner.setGeolocationPermission) did not throw exception.
-PASS navigator.geolocation.getCurrentPosition(true) threw exception TypeError: Argument 1 ('successCallback') to Geolocation.getCurrentPosition must be a function.
-PASS navigator.geolocation.getCurrentPosition(42) threw exception TypeError: Argument 1 ('successCallback') to Geolocation.getCurrentPosition must be a function.
-PASS navigator.geolocation.getCurrentPosition(Infinity) threw exception TypeError: Argument 1 ('successCallback') to Geolocation.getCurrentPosition must be a function.
-PASS navigator.geolocation.getCurrentPosition(-Infinity) threw exception TypeError: Argument 1 ('successCallback') to Geolocation.getCurrentPosition must be a function.
-PASS navigator.geolocation.getCurrentPosition("string") threw exception TypeError: Argument 1 ('successCallback') to Geolocation.getCurrentPosition must be a function.
+PASS navigator.geolocation.getCurrentPosition(true) threw exception TypeMismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object..
+PASS navigator.geolocation.getCurrentPosition(42) threw exception TypeMismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object..
+PASS navigator.geolocation.getCurrentPosition(Infinity) threw exception TypeMismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object..
+PASS navigator.geolocation.getCurrentPosition(-Infinity) threw exception TypeMismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object..
+PASS navigator.geolocation.getCurrentPosition("string") threw exception TypeMismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object..
 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined) did not throw exception.
 PASS navigator.geolocation.getCurrentPosition(emptyFunction, null) did not throw exception.
-PASS navigator.geolocation.getCurrentPosition(emptyFunction, {}) threw exception TypeError: Argument 2 ('errorCallback') to Geolocation.getCurrentPosition must be a function.
-PASS navigator.geolocation.getCurrentPosition(emptyFunction, objectThrowingException) threw exception TypeError: Argument 2 ('errorCallback') to Geolocation.getCurrentPosition must be a function.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, {}) threw exception TypeMismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object..
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, objectThrowingException) threw exception TypeMismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object..
 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, testRunner.setGeolocationPermission) did not throw exception.
-PASS navigator.geolocation.getCurrentPosition(emptyFunction, true) threw exception TypeError: Argument 2 ('errorCallback') to Geolocation.getCurrentPosition must be a function.
-PASS navigator.geolocation.getCurrentPosition(emptyFunction, 42) threw exception TypeError: Argument 2 ('errorCallback') to Geolocation.getCurrentPosition must be a function.
-PASS navigator.geolocation.getCurrentPosition(emptyFunction, Infinity) threw exception TypeError: Argument 2 ('errorCallback') to Geolocation.getCurrentPosition must be a function.
-PASS navigator.geolocation.getCurrentPosition(emptyFunction, -Infinity) threw exception TypeError: Argument 2 ('errorCallback') to Geolocation.getCurrentPosition must be a function.
-PASS navigator.geolocation.getCurrentPosition(emptyFunction, "string") threw exception TypeError: Argument 2 ('errorCallback') to Geolocation.getCurrentPosition must be a function.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, true) threw exception TypeMismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object..
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, 42) threw exception TypeMismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object..
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, Infinity) threw exception TypeMismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object..
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, -Infinity) threw exception TypeMismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object..
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, "string") threw exception TypeMismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object..
 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, undefined) did not throw exception.
 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, null) did not throw exception.
 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {}) did not throw exception.
 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, objectThrowingException) threw exception Error: enableHighAccuracy getter exception.
 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, emptyFunction) did not throw exception.
-PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, true) threw exception TypeError: Type error.
-PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, 42) threw exception TypeError: Type error.
-PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, Infinity) threw exception TypeError: Type error.
-PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, -Infinity) threw exception TypeError: Type error.
-PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, "string") threw exception TypeError: Type error.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, true) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, 42) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, Infinity) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, -Infinity) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, "string") did not throw exception.
 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:undefined}) did not throw exception.
 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:null}) did not throw exception.
 PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:{}}) did not throw exception.

Modified: trunk/LayoutTests/fast/dom/Geolocation/not-enough-arguments-expected.txt (209611 => 209612)


--- trunk/LayoutTests/fast/dom/Geolocation/not-enough-arguments-expected.txt	2016-12-09 17:57:39 UTC (rev 209611)
+++ trunk/LayoutTests/fast/dom/Geolocation/not-enough-arguments-expected.txt	2016-12-09 18:12:31 UTC (rev 209612)
@@ -3,8 +3,8 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS window.navigator.geolocation.getCurrentPosition() threw exception TypeError: Not enough arguments.
-PASS window.navigator.geolocation.watchPosition() threw exception TypeError: Not enough arguments.
+PASS window.navigator.geolocation.getCurrentPosition() threw exception TypeMismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object..
+PASS window.navigator.geolocation.watchPosition() threw exception TypeMismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object..
 PASS window.navigator.geolocation.clearWatch() threw exception TypeError: Not enough arguments.
 PASS successfullyParsed is true
 

Modified: trunk/LayoutTests/fast/dom/Geolocation/script-tests/argument-types.js (209611 => 209612)


--- trunk/LayoutTests/fast/dom/Geolocation/script-tests/argument-types.js	2016-12-09 17:57:39 UTC (rev 209611)
+++ trunk/LayoutTests/fast/dom/Geolocation/script-tests/argument-types.js	2016-12-09 18:12:31 UTC (rev 209612)
@@ -15,7 +15,7 @@
         if (expectedException)
             shouldThrow(_expression_, '(function() { return "' + expectedException + '"; })();');
         else
-            shouldThrow(_expression_, '(function() { return "TypeError: Type error"; })();');
+            shouldThrow(_expression_, '(function() { return "TypeMismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object."; })();');
     } else {
         shouldNotThrow(_expression_);
     }
@@ -33,33 +33,33 @@
 var objectThrowingException = new ObjectThrowingException();
 
 
-test('navigator.geolocation.getCurrentPosition()', true, "TypeError: Not enough arguments");
+test('navigator.geolocation.getCurrentPosition()', true);
 
-test('navigator.geolocation.getCurrentPosition(undefined)', true, "TypeError: Argument 1 ('successCallback') to Geolocation.getCurrentPosition must be a function");
-test('navigator.geolocation.getCurrentPosition(null)', true, "TypeError: Argument 1 ('successCallback') to Geolocation.getCurrentPosition must be a function");
-test('navigator.geolocation.getCurrentPosition({})', true, "TypeError: Argument 1 ('successCallback') to Geolocation.getCurrentPosition must be a function");
-test('navigator.geolocation.getCurrentPosition(objectThrowingException)', true, "TypeError: Argument 1 ('successCallback') to Geolocation.getCurrentPosition must be a function");
+test('navigator.geolocation.getCurrentPosition(undefined)', true);
+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(testRunner.setGeolocationPermission)', false);
-test('navigator.geolocation.getCurrentPosition(true)', true, "TypeError: Argument 1 ('successCallback') to Geolocation.getCurrentPosition must be a function");
-test('navigator.geolocation.getCurrentPosition(42)', true, "TypeError: Argument 1 ('successCallback') to Geolocation.getCurrentPosition must be a function");
-test('navigator.geolocation.getCurrentPosition(Infinity)', true, "TypeError: Argument 1 ('successCallback') to Geolocation.getCurrentPosition must be a function");
-test('navigator.geolocation.getCurrentPosition(-Infinity)', true, "TypeError: Argument 1 ('successCallback') to Geolocation.getCurrentPosition must be a function");
-test('navigator.geolocation.getCurrentPosition("string")', true, "TypeError: Argument 1 ('successCallback') to Geolocation.getCurrentPosition must be a function");
+test('navigator.geolocation.getCurrentPosition(true)', true);
+test('navigator.geolocation.getCurrentPosition(42)', true);
+test('navigator.geolocation.getCurrentPosition(Infinity)', true);
+test('navigator.geolocation.getCurrentPosition(-Infinity)', true);
+test('navigator.geolocation.getCurrentPosition("string")', true);
 
 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined)', false);
 test('navigator.geolocation.getCurrentPosition(emptyFunction, null)', false);
-test('navigator.geolocation.getCurrentPosition(emptyFunction, {})', true, "TypeError: Argument 2 ('errorCallback') to Geolocation.getCurrentPosition must be a function");
-test('navigator.geolocation.getCurrentPosition(emptyFunction, objectThrowingException)', true, "TypeError: Argument 2 ('errorCallback') to Geolocation.getCurrentPosition must be a function");
+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, testRunner.setGeolocationPermission)', false);
-test('navigator.geolocation.getCurrentPosition(emptyFunction, true)', true, "TypeError: Argument 2 ('errorCallback') to Geolocation.getCurrentPosition must be a function");
-test('navigator.geolocation.getCurrentPosition(emptyFunction, 42)', true, "TypeError: Argument 2 ('errorCallback') to Geolocation.getCurrentPosition must be a function");
-test('navigator.geolocation.getCurrentPosition(emptyFunction, Infinity)', true, "TypeError: Argument 2 ('errorCallback') to Geolocation.getCurrentPosition must be a function");
-test('navigator.geolocation.getCurrentPosition(emptyFunction, -Infinity)', true, "TypeError: Argument 2 ('errorCallback') to Geolocation.getCurrentPosition must be a function");
-test('navigator.geolocation.getCurrentPosition(emptyFunction, "string")', true, "TypeError: Argument 2 ('errorCallback') to Geolocation.getCurrentPosition must be a function");
+test('navigator.geolocation.getCurrentPosition(emptyFunction, true)', true);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, 42)', true);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, Infinity)', true);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, -Infinity)', true);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, "string")', true);
 
 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, undefined)', false);
 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, null)', false);
@@ -66,11 +66,11 @@
 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {})', false);
 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, objectThrowingException)', true, 'Error: enableHighAccuracy getter exception');
 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, emptyFunction)', false);
-test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, true)', true);
-test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, 42)', true);
-test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, Infinity)', true);
-test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, -Infinity)', true);
-test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, "string")', true);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, true)', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, 42)', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, Infinity)', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, -Infinity)', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, "string")', false);
 
 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:undefined})', false);
 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:null})', false);

Modified: trunk/Source/WebCore/CMakeLists.txt (209611 => 209612)


--- trunk/Source/WebCore/CMakeLists.txt	2016-12-09 17:57:39 UTC (rev 209611)
+++ trunk/Source/WebCore/CMakeLists.txt	2016-12-09 18:12:31 UTC (rev 209612)
@@ -183,7 +183,6 @@
     Modules/geolocation/PositionCallback.idl
     Modules/geolocation/PositionError.idl
     Modules/geolocation/PositionErrorCallback.idl
-    Modules/geolocation/PositionOptions.idl
 
     Modules/indexeddb/DOMWindowIndexedDatabase.idl
     Modules/indexeddb/IDBCursor.idl
@@ -1136,6 +1135,7 @@
     bindings/js/JSEventTargetCustom.cpp
     bindings/js/JSExceptionBase.cpp
     bindings/js/JSFileReaderCustom.cpp
+    bindings/js/JSGeolocationCustom.cpp
     bindings/js/JSHTMLAllCollectionCustom.cpp
     bindings/js/JSHTMLAppletElementCustom.cpp
     bindings/js/JSHTMLCanvasElementCustom.cpp

Modified: trunk/Source/WebCore/ChangeLog (209611 => 209612)


--- trunk/Source/WebCore/ChangeLog	2016-12-09 17:57:39 UTC (rev 209611)
+++ trunk/Source/WebCore/ChangeLog	2016-12-09 18:12:31 UTC (rev 209612)
@@ -1,3 +1,15 @@
+2016-12-09  Ryan Haddad  <ryanhad...@apple.com>
+
+        Unreviewed, rolling out r209574.
+
+        This change broke the Windows build.
+
+        Reverted changeset:
+
+        "[WebIDL] Remove custom bindings for Geolocation"
+        https://bugs.webkit.org/show_bug.cgi?id=165625
+        http://trac.webkit.org/changeset/209574
+
 2016-12-09  Ryosuke Niwa  <rn...@webkit.org>
 
         Custom Elements from a different document are not customized when created with innerHTML

Modified: trunk/Source/WebCore/DerivedSources.cpp (209611 => 209612)


--- trunk/Source/WebCore/DerivedSources.cpp	2016-12-09 17:57:39 UTC (rev 209611)
+++ trunk/Source/WebCore/DerivedSources.cpp	2016-12-09 18:12:31 UTC (rev 209612)
@@ -392,7 +392,6 @@
 #include "JSPositionCallback.cpp"
 #include "JSPositionError.cpp"
 #include "JSPositionErrorCallback.cpp"
-#include "JSPositionOptions.cpp"
 #include "JSProcessingInstruction.cpp"
 #include "JSProgressEvent.cpp"
 #include "JSRadioNodeList.cpp"

Modified: trunk/Source/WebCore/DerivedSources.make (209611 => 209612)


--- trunk/Source/WebCore/DerivedSources.make	2016-12-09 17:57:39 UTC (rev 209611)
+++ trunk/Source/WebCore/DerivedSources.make	2016-12-09 18:12:31 UTC (rev 209612)
@@ -114,7 +114,6 @@
     $(WebCore)/Modules/geolocation/PositionCallback.idl \
     $(WebCore)/Modules/geolocation/PositionError.idl \
     $(WebCore)/Modules/geolocation/PositionErrorCallback.idl \
-    $(WebCore)/Modules/geolocation/PositionOptions.idl \
     $(WebCore)/Modules/indexeddb/DOMWindowIndexedDatabase.idl \
     $(WebCore)/Modules/indexeddb/IDBCursor.idl \
     $(WebCore)/Modules/indexeddb/IDBCursorWithValue.idl \

Modified: trunk/Source/WebCore/Modules/geolocation/GeoNotifier.cpp (209611 => 209612)


--- trunk/Source/WebCore/Modules/geolocation/GeoNotifier.cpp	2016-12-09 17:57:39 UTC (rev 209611)
+++ trunk/Source/WebCore/Modules/geolocation/GeoNotifier.cpp	2016-12-09 18:12:31 UTC (rev 209612)
@@ -34,7 +34,7 @@
 
 namespace WebCore {
 
-GeoNotifier::GeoNotifier(Geolocation& geolocation, Ref<PositionCallback>&& successCallback, RefPtr<PositionErrorCallback>&& errorCallback, PositionOptions&& options)
+GeoNotifier::GeoNotifier(Geolocation& geolocation, RefPtr<PositionCallback>&& successCallback, RefPtr<PositionErrorCallback>&& errorCallback, RefPtr<PositionOptions>&& options)
     : m_geolocation(geolocation)
     , m_successCallback(WTFMove(successCallback))
     , m_errorCallback(WTFMove(errorCallback))
@@ -42,6 +42,10 @@
     , m_timer(*this, &GeoNotifier::timerFired)
     , m_useCachedPosition(false)
 {
+    ASSERT(m_successCallback);
+    // If no options were supplied from JS, we should have created a default set
+    // of options in JSGeolocationCustom.cpp.
+    ASSERT(m_options);
 }
 
 void GeoNotifier::setFatalError(RefPtr<PositionError>&& error)
@@ -66,7 +70,7 @@
 
 bool GeoNotifier::hasZeroTimeout() const
 {
-    return !m_options.timeout;
+    return m_options->hasTimeout() && !m_options->timeout();
 }
 
 void GeoNotifier::runSuccessCallback(Geoposition* position)
@@ -87,7 +91,8 @@
 
 void GeoNotifier::startTimerIfNeeded()
 {
-    m_timer.startOneShot(m_options.timeout / 1000.0);
+    if (m_options->hasTimeout())
+        m_timer.startOneShot(m_options->timeout() / 1000.0);
 }
 
 void GeoNotifier::stopTimer()

Modified: trunk/Source/WebCore/Modules/geolocation/GeoNotifier.h (209611 => 209612)


--- trunk/Source/WebCore/Modules/geolocation/GeoNotifier.h	2016-12-09 17:57:39 UTC (rev 209611)
+++ trunk/Source/WebCore/Modules/geolocation/GeoNotifier.h	2016-12-09 18:12:31 UTC (rev 209612)
@@ -28,7 +28,6 @@
 
 #if ENABLE(GEOLOCATION)
 
-#include "PositionOptions.h"
 #include "Timer.h"
 #include <wtf/Forward.h>
 #include <wtf/RefCounted.h>
@@ -41,15 +40,16 @@
 class PositionCallback;
 class PositionError;
 class PositionErrorCallback;
+class PositionOptions;
 
 class GeoNotifier : public RefCounted<GeoNotifier> {
 public:
-    static Ref<GeoNotifier> create(Geolocation& geolocation, Ref<PositionCallback>&& positionCallback, RefPtr<PositionErrorCallback>&& positionErrorCallback, PositionOptions&& options)
+    static Ref<GeoNotifier> create(Geolocation& geolocation, RefPtr<PositionCallback>&& positionCallback, RefPtr<PositionErrorCallback>&& positionErrorCallback, RefPtr<PositionOptions>&& options)
     {
         return adoptRef(*new GeoNotifier(geolocation, WTFMove(positionCallback), WTFMove(positionErrorCallback), WTFMove(options)));
     }
 
-    const PositionOptions& options() const { return m_options; }
+    PositionOptions* options() const { return m_options.get(); }
     void setFatalError(RefPtr<PositionError>&&);
 
     bool useCachedPosition() const { return m_useCachedPosition; }
@@ -64,12 +64,12 @@
     bool hasZeroTimeout() const;
 
 private:
-    GeoNotifier(Geolocation&, Ref<PositionCallback>&&, RefPtr<PositionErrorCallback>&&, PositionOptions&&);
+    GeoNotifier(Geolocation&, RefPtr<PositionCallback>&&, RefPtr<PositionErrorCallback>&&, RefPtr<PositionOptions>&&);
 
     Ref<Geolocation> m_geolocation;
-    Ref<PositionCallback> m_successCallback;
+    RefPtr<PositionCallback> m_successCallback;
     RefPtr<PositionErrorCallback> m_errorCallback;
-    PositionOptions m_options;
+    RefPtr<PositionOptions> m_options;
     Timer m_timer;
     RefPtr<PositionError> m_fatalError;
     bool m_useCachedPosition;

Modified: trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp (209611 => 209612)


--- trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp	2016-12-09 17:57:39 UTC (rev 209611)
+++ trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp	2016-12-09 18:12:31 UTC (rev 209612)
@@ -57,10 +57,9 @@
     if (!position)
         return nullptr;
     
-    auto coordinates = Coordinates::create(position->latitude(), position->longitude(), position->canProvideAltitude(), position->altitude(), 
-        position->accuracy(), position->canProvideAltitudeAccuracy(), position->altitudeAccuracy(),
-        position->canProvideHeading(), position->heading(), position->canProvideSpeed(), position->speed());
-
+    RefPtr<Coordinates> coordinates = Coordinates::create(position->latitude(), position->longitude(), position->canProvideAltitude(), position->altitude(), 
+                                                          position->accuracy(), position->canProvideAltitudeAccuracy(), position->altitudeAccuracy(),
+                                                          position->canProvideHeading(), position->heading(), position->canProvideSpeed(), position->speed());
     return Geoposition::create(WTFMove(coordinates), convertSecondsToDOMTimeStamp(position->timestamp()));
 }
 
@@ -312,7 +311,7 @@
     return m_lastPosition.get();
 }
 
-void Geolocation::getCurrentPosition(Ref<PositionCallback>&& successCallback, RefPtr<PositionErrorCallback>&& errorCallback, PositionOptions&& options)
+void Geolocation::getCurrentPosition(RefPtr<PositionCallback>&& successCallback, RefPtr<PositionErrorCallback>&& errorCallback, RefPtr<PositionOptions>&& options)
 {
     if (!frame())
         return;
@@ -323,7 +322,7 @@
     m_oneShots.add(notifier);
 }
 
-int Geolocation::watchPosition(Ref<PositionCallback>&& successCallback, RefPtr<PositionErrorCallback>&& errorCallback, PositionOptions&& options)
+int Geolocation::watchPosition(RefPtr<PositionCallback>&& successCallback, RefPtr<PositionErrorCallback>&& errorCallback, RefPtr<PositionOptions>&& options)
 {
     if (!frame())
         return 0;
@@ -460,15 +459,17 @@
         stopUpdating();
 }
 
-bool Geolocation::haveSuitableCachedPosition(const PositionOptions& options)
+bool Geolocation::haveSuitableCachedPosition(PositionOptions* options)
 {
     Geoposition* cachedPosition = lastPosition();
     if (!cachedPosition)
         return false;
-    if (!options.maximumAge)
+    if (!options->hasMaximumAge())
+        return true;
+    if (!options->maximumAge())
         return false;
     DOMTimeStamp currentTimeMillis = convertSecondsToDOMTimeStamp(currentTime());
-    return cachedPosition->timestamp() > currentTimeMillis - options.maximumAge;
+    return cachedPosition->timestamp() > currentTimeMillis - options->maximumAge();
 }
 
 void Geolocation::clearWatch(int watchID)
@@ -702,7 +703,7 @@
     if (!page)
         return false;
 
-    GeolocationController::from(page)->addObserver(this, notifier->options().enableHighAccuracy);
+    GeolocationController::from(page)->addObserver(this, notifier->options()->enableHighAccuracy());
     return true;
 }
 

Modified: trunk/Source/WebCore/Modules/geolocation/Geolocation.h (209611 => 209612)


--- trunk/Source/WebCore/Modules/geolocation/Geolocation.h	2016-12-09 17:57:39 UTC (rev 209611)
+++ trunk/Source/WebCore/Modules/geolocation/Geolocation.h	2016-12-09 18:12:31 UTC (rev 209612)
@@ -48,10 +48,11 @@
 class Page;
 class ScriptExecutionContext;
 class SecurityOrigin;
-struct PositionOptions;
 
-class Geolocation : public ScriptWrappable, public RefCounted<Geolocation>, public ActiveDOMObject {
-    friend class GeoNotifier;
+class Geolocation : public ScriptWrappable, public RefCounted<Geolocation>, public ActiveDOMObject
+{
+friend class GeoNotifier;
+
 public:
     static Ref<Geolocation> create(ScriptExecutionContext*);
     WEBCORE_EXPORT ~Geolocation();
@@ -60,8 +61,8 @@
     Document* document() const;
     WEBCORE_EXPORT Frame* frame() const;
 
-    void getCurrentPosition(Ref<PositionCallback>&&, RefPtr<PositionErrorCallback>&&, PositionOptions&&);
-    int watchPosition(Ref<PositionCallback>&&, RefPtr<PositionErrorCallback>&&, PositionOptions&&);
+    void getCurrentPosition(RefPtr<PositionCallback>&&, RefPtr<PositionErrorCallback>&&, RefPtr<PositionOptions>&&);
+    int watchPosition(RefPtr<PositionCallback>&&, RefPtr<PositionErrorCallback>&&, RefPtr<PositionOptions>&&);
     void clearWatch(int watchID);
 
     WEBCORE_EXPORT void setIsAllowed(bool);
@@ -140,7 +141,7 @@
     void fatalErrorOccurred(GeoNotifier*);
     void requestTimedOut(GeoNotifier*);
     void requestUsesCachedPosition(GeoNotifier*);
-    bool haveSuitableCachedPosition(const PositionOptions&);
+    bool haveSuitableCachedPosition(PositionOptions*);
     void makeCachedPositionCallbacks();
 
     GeoNotifierSet m_oneShots;

Modified: trunk/Source/WebCore/Modules/geolocation/Geolocation.idl (209611 => 209612)


--- trunk/Source/WebCore/Modules/geolocation/Geolocation.idl	2016-12-09 17:57:39 UTC (rev 209611)
+++ trunk/Source/WebCore/Modules/geolocation/Geolocation.idl	2016-12-09 18:12:31 UTC (rev 209612)
@@ -29,16 +29,14 @@
     Conditional=GEOLOCATION, 
     GenerateIsReachable=ImplFrame,
 ] interface Geolocation {
-    // FIXME: PositionErrorCallback should not be nullable
-    void getCurrentPosition(PositionCallback successCallback,
-                            optional PositionErrorCallback? errorCallback,
-                            optional PositionOptions options);
+    [Custom] void getCurrentPosition(PositionCallback successCallback,
+                                     optional PositionErrorCallback? errorCallback,
+                                     optional PositionOptions options);
 
-    // FIXME: PositionErrorCallback should not be nullable
-    long watchPosition(PositionCallback successCallback,
-                       optional PositionErrorCallback? errorCallback,
-                       optional PositionOptions options);
+    [Custom] long watchPosition(PositionCallback successCallback,
+                                optional PositionErrorCallback? errorCallback,
+                                optional PositionOptions options);
 
-    void clearWatch(long watchId);
+    void clearWatch(long watchID);
 };
 

Modified: trunk/Source/WebCore/Modules/geolocation/Geoposition.h (209611 => 209612)


--- trunk/Source/WebCore/Modules/geolocation/Geoposition.h	2016-12-09 17:57:39 UTC (rev 209611)
+++ trunk/Source/WebCore/Modules/geolocation/Geoposition.h	2016-12-09 18:12:31 UTC (rev 209612)
@@ -34,7 +34,7 @@
 
 class Geoposition : public RefCounted<Geoposition> {
 public:
-    static Ref<Geoposition> create(Ref<Coordinates>&& coordinates, DOMTimeStamp timestamp)
+    static Ref<Geoposition> create(RefPtr<Coordinates>&& coordinates, DOMTimeStamp timestamp)
     {
         return adoptRef(*new Geoposition(WTFMove(coordinates), timestamp));
     }
@@ -45,16 +45,17 @@
     }
 
     DOMTimeStamp timestamp() const { return m_timestamp; }
-    const Coordinates& coords() const { return m_coordinates.get(); }
+    Coordinates* coords() const { return m_coordinates.get(); }
     
 private:
-    Geoposition(Ref<Coordinates>&& coordinates, DOMTimeStamp timestamp)
+    Geoposition(RefPtr<Coordinates>&& coordinates, DOMTimeStamp timestamp)
         : m_coordinates(WTFMove(coordinates))
         , m_timestamp(timestamp)
     {
+        ASSERT(m_coordinates);
     }
 
-    Ref<Coordinates> m_coordinates;
+    RefPtr<Coordinates> m_coordinates;
     DOMTimeStamp m_timestamp;
 };
     

Modified: trunk/Source/WebCore/Modules/geolocation/PositionOptions.h (209611 => 209612)


--- trunk/Source/WebCore/Modules/geolocation/PositionOptions.h	2016-12-09 17:57:39 UTC (rev 209611)
+++ trunk/Source/WebCore/Modules/geolocation/PositionOptions.h	2016-12-09 18:12:31 UTC (rev 209612)
@@ -25,12 +25,55 @@
 
 #pragma once
 
+#include <wtf/RefCounted.h>
+
 namespace WebCore {
     
-struct PositionOptions {
-    bool enableHighAccuracy { false };
-    unsigned timeout { 0xFFFFFFFF };
-    unsigned maximumAge { 0 };
+class PositionOptions : public RefCounted<PositionOptions> {
+public:
+    static Ref<PositionOptions> create() { return adoptRef(*new PositionOptions()); }
+
+    bool enableHighAccuracy() const { return m_highAccuracy; }
+    void setEnableHighAccuracy(bool enable) { m_highAccuracy = enable; }
+    bool hasTimeout() const { return m_hasTimeout; }
+    int timeout() const
+    {
+        ASSERT(hasTimeout());
+        return m_timeout;
+    }
+    void setTimeout(int timeout)
+    {
+        ASSERT(timeout >= 0);
+        m_hasTimeout = true;
+        m_timeout = timeout;
+    }
+    bool hasMaximumAge() const { return m_hasMaximumAge; }
+    int maximumAge() const
+    {
+        ASSERT(hasMaximumAge());
+        return m_maximumAge;
+    }
+    void clearMaximumAge() { m_hasMaximumAge = false; }
+    void setMaximumAge(int age)
+    {
+        ASSERT(age >= 0);
+        m_hasMaximumAge = true;
+        m_maximumAge = age;
+    }
+    
+private:
+    PositionOptions()
+        : m_highAccuracy(false)
+        , m_hasTimeout(false)
+    {
+        setMaximumAge(0);
+    }
+    
+    bool m_highAccuracy;
+    bool m_hasTimeout;
+    int m_timeout;
+    bool m_hasMaximumAge;
+    int m_maximumAge;
 };
     
 } // namespace WebCore

Deleted: trunk/Source/WebCore/Modules/geolocation/PositionOptions.idl (209611 => 209612)


--- trunk/Source/WebCore/Modules/geolocation/PositionOptions.idl	2016-12-09 17:57:39 UTC (rev 209611)
+++ trunk/Source/WebCore/Modules/geolocation/PositionOptions.idl	2016-12-09 18:12:31 UTC (rev 209612)
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-dictionary PositionOptions {
-    boolean enableHighAccuracy = false;
-    [Clamp] unsigned long timeout = 0xFFFFFFFF;
-    [Clamp] unsigned long maximumAge = 0;
-};

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (209611 => 209612)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-12-09 17:57:39 UTC (rev 209611)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-12-09 18:12:31 UTC (rev 209612)
@@ -2842,8 +2842,6 @@
 		7C2BDD3D17C7F98C0038FF15 /* JSDOMGlobalObjectTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C2BDD3B17C7F98B0038FF15 /* JSDOMGlobalObjectTask.cpp */; };
 		7C2BDD3E17C7F98C0038FF15 /* JSDOMGlobalObjectTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C2BDD3C17C7F98B0038FF15 /* JSDOMGlobalObjectTask.h */; };
 		7C330A021DF8FAC600D3395C /* GraphicsContext3DAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C330A011DF8FAC600D3395C /* GraphicsContext3DAttributes.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		7C330A071DF9F95100D3395C /* JSPositionOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C330A051DF9F95100D3395C /* JSPositionOptions.cpp */; };
-		7C330A081DF9F95100D3395C /* JSPositionOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C330A061DF9F95100D3395C /* JSPositionOptions.h */; };
 		7C33F3621B4A050400502CAF /* JSDocumentFragmentCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C33F3601B4A050400502CAF /* JSDocumentFragmentCustom.cpp */; };
 		7C39C3641DDA864C00FEFB29 /* SVGLengthListValues.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C39C3621DDA864900FEFB29 /* SVGLengthListValues.cpp */; };
 		7C39C3651DDA865200FEFB29 /* SVGLengthListValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C39C3631DDA864900FEFB29 /* SVGLengthListValues.h */; };
@@ -6845,6 +6843,7 @@
 		FE699872192087E7006936BD /* FloatingPointEnvironment.h in Headers */ = {isa = PBXBuildFile; fileRef = FE699870192087E7006936BD /* FloatingPointEnvironment.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		FE6FD48D0F676E9300092873 /* JSCoordinates.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE6FD48B0F676E9300092873 /* JSCoordinates.cpp */; };
 		FE6FD48E0F676E9300092873 /* JSCoordinates.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6FD48C0F676E9300092873 /* JSCoordinates.h */; };
+		FE80D7AB0E9C1ED2000D6F75 /* JSGeolocationCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE80D7A60E9C1ED2000D6F75 /* JSGeolocationCustom.cpp */; };
 		FE80DA630E9C4703000D6F75 /* JSGeolocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE80DA5F0E9C4703000D6F75 /* JSGeolocation.cpp */; };
 		FE80DA640E9C4703000D6F75 /* JSGeolocation.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80DA600E9C4703000D6F75 /* JSGeolocation.h */; };
 		FE80DA650E9C4703000D6F75 /* JSGeoposition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE80DA610E9C4703000D6F75 /* JSGeoposition.cpp */; };
@@ -10317,9 +10316,6 @@
 		7C2BDD3B17C7F98B0038FF15 /* JSDOMGlobalObjectTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMGlobalObjectTask.cpp; sourceTree = "<group>"; };
 		7C2BDD3C17C7F98B0038FF15 /* JSDOMGlobalObjectTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMGlobalObjectTask.h; sourceTree = "<group>"; };
 		7C330A011DF8FAC600D3395C /* GraphicsContext3DAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsContext3DAttributes.h; sourceTree = "<group>"; };
-		7C330A031DF9E95B00D3395C /* PositionOptions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = PositionOptions.idl; sourceTree = "<group>"; };
-		7C330A051DF9F95100D3395C /* JSPositionOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPositionOptions.cpp; sourceTree = "<group>"; };
-		7C330A061DF9F95100D3395C /* JSPositionOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPositionOptions.h; sourceTree = "<group>"; };
 		7C33F3601B4A050400502CAF /* JSDocumentFragmentCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDocumentFragmentCustom.cpp; sourceTree = "<group>"; };
 		7C39C3621DDA864900FEFB29 /* SVGLengthListValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGLengthListValues.cpp; sourceTree = "<group>"; };
 		7C39C3631DDA864900FEFB29 /* SVGLengthListValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLengthListValues.h; sourceTree = "<group>"; };
@@ -14915,6 +14911,7 @@
 		FE699870192087E7006936BD /* FloatingPointEnvironment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FloatingPointEnvironment.h; sourceTree = "<group>"; };
 		FE6FD48B0F676E9300092873 /* JSCoordinates.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCoordinates.cpp; sourceTree = "<group>"; };
 		FE6FD48C0F676E9300092873 /* JSCoordinates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCoordinates.h; sourceTree = "<group>"; };
+		FE80D7A60E9C1ED2000D6F75 /* JSGeolocationCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGeolocationCustom.cpp; sourceTree = "<group>"; };
 		FE80DA5F0E9C4703000D6F75 /* JSGeolocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGeolocation.cpp; sourceTree = "<group>"; };
 		FE80DA600E9C4703000D6F75 /* JSGeolocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGeolocation.h; sourceTree = "<group>"; };
 		FE80DA610E9C4703000D6F75 /* JSGeoposition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGeoposition.cpp; sourceTree = "<group>"; };
@@ -15661,7 +15658,6 @@
 				42A023FA1A39F13A00F722CF /* FetchAPI */,
 				89878576122CA1DA003AABDA /* FileAPI */,
 				518F4FFC194CABE30081BAAE /* Gamepad */,
-				7C330A041DF9F93B00D3395C /* Geolocation */,
 				A83B79080CCAFF2B000B0825 /* HTML */,
 				AA93C850175D5B2000FD3CE3 /* IndieUI */,
 				1C5FAECA0DCFD8C900D58F78 /* Inspector */,
@@ -17822,6 +17818,8 @@
 		65BF02180974806300C43196 /* page */ = {
 			isa = PBXGroup;
 			children = (
+				AD5A0C211DECA10100707054 /* PerformanceLogging.cpp */,
+				AD5A0C201DECA0B500707054 /* PerformanceLogging.h */,
 				316FE1060E6E1D8400BF6088 /* animation */,
 				5D5975B5196362BE00D00878 /* cocoa */,
 				CE17AD141C58522F005F4799 /* csp */,
@@ -17961,8 +17959,6 @@
 				CB38FD4A1CCCF2DD00592A3F /* PerformanceEntry.cpp */,
 				86BE33FB15058CB200CE0FD8 /* PerformanceEntry.h */,
 				86BE33FC15058CB200CE0FD8 /* PerformanceEntry.idl */,
-				AD5A0C211DECA10100707054 /* PerformanceLogging.cpp */,
-				AD5A0C201DECA0B500707054 /* PerformanceLogging.h */,
 				8AF4E55211DC5A36000ED3DE /* PerformanceNavigation.cpp */,
 				8AF4E55311DC5A36000ED3DE /* PerformanceNavigation.h */,
 				8AF4E55411DC5A36000ED3DE /* PerformanceNavigation.idl */,
@@ -18254,27 +18250,6 @@
 			path = macOS;
 			sourceTree = "<group>";
 		};
-		7C330A041DF9F93B00D3395C /* Geolocation */ = {
-			isa = PBXGroup;
-			children = (
-				FE6FD48B0F676E9300092873 /* JSCoordinates.cpp */,
-				FE6FD48C0F676E9300092873 /* JSCoordinates.h */,
-				FE80DA5F0E9C4703000D6F75 /* JSGeolocation.cpp */,
-				FE80DA600E9C4703000D6F75 /* JSGeolocation.h */,
-				FE80DA610E9C4703000D6F75 /* JSGeoposition.cpp */,
-				FE80DA620E9C4703000D6F75 /* JSGeoposition.h */,
-				598365E31355F604001B185D /* JSPositionCallback.cpp */,
-				598365DC1355F53C001B185D /* JSPositionCallback.h */,
-				FE80DA6D0E9C472F000D6F75 /* JSPositionError.cpp */,
-				FE80DA6E0E9C472F000D6F75 /* JSPositionError.h */,
-				598365E51355F60D001B185D /* JSPositionErrorCallback.cpp */,
-				598365DE1355F562001B185D /* JSPositionErrorCallback.h */,
-				7C330A051DF9F95100D3395C /* JSPositionOptions.cpp */,
-				7C330A061DF9F95100D3395C /* JSPositionOptions.h */,
-			);
-			name = Geolocation;
-			sourceTree = "<group>";
-		};
 		7C3E510718DF8F1200C112F7 /* cocoa */ = {
 			isa = PBXGroup;
 			children = (
@@ -19166,7 +19141,6 @@
 				9746AF2014F4DDE6003E7A70 /* PositionErrorCallback.h */,
 				9746AF2114F4DDE6003E7A70 /* PositionErrorCallback.idl */,
 				9746AF2214F4DDE6003E7A70 /* PositionOptions.h */,
-				7C330A031DF9E95B00D3395C /* PositionOptions.idl */,
 			);
 			path = geolocation;
 			sourceTree = "<group>";
@@ -20444,6 +20418,8 @@
 				65DF31E009D1CC60000BE325 /* JSCharacterData.h */,
 				93F9B6DE0BA0FB7200854064 /* JSComment.cpp */,
 				93F9B6DF0BA0FB7200854064 /* JSComment.h */,
+				FE6FD48B0F676E9300092873 /* JSCoordinates.cpp */,
+				FE6FD48C0F676E9300092873 /* JSCoordinates.h */,
 				9BE671091D5AEB0400345514 /* JSCustomElementRegistry.cpp */,
 				9BE6710A1D5AEB0400345514 /* JSCustomElementRegistry.h */,
 				BCA83E4D0D7CE1E9003421A8 /* JSDataTransfer.cpp */,
@@ -20482,6 +20458,10 @@
 				BC64649611D82349006455B0 /* JSDOMStringMap.h */,
 				65DF31E509D1CC60000BE325 /* JSElement.cpp */,
 				65DF31E609D1CC60000BE325 /* JSElement.h */,
+				FE80DA5F0E9C4703000D6F75 /* JSGeolocation.cpp */,
+				FE80DA600E9C4703000D6F75 /* JSGeolocation.h */,
+				FE80DA610E9C4703000D6F75 /* JSGeoposition.cpp */,
+				FE80DA620E9C4703000D6F75 /* JSGeoposition.h */,
 				C6F0902414327D4F00685849 /* JSMutationObserver.cpp */,
 				C6F0902514327D4F00685849 /* JSMutationObserver.h */,
 				C6F08FC71431000D00685849 /* JSMutationRecord.cpp */,
@@ -20492,6 +20472,12 @@
 				14DC0D3609FED073007B0235 /* JSNode.h */,
 				BCD9C2BE0C17B69E005C90A2 /* JSNodeList.cpp */,
 				BCD9C2BF0C17B69E005C90A2 /* JSNodeList.h */,
+				598365E31355F604001B185D /* JSPositionCallback.cpp */,
+				598365DC1355F53C001B185D /* JSPositionCallback.h */,
+				FE80DA6D0E9C472F000D6F75 /* JSPositionError.cpp */,
+				FE80DA6E0E9C472F000D6F75 /* JSPositionError.h */,
+				598365E51355F60D001B185D /* JSPositionErrorCallback.cpp */,
+				598365DE1355F562001B185D /* JSPositionErrorCallback.h */,
 				65DF31EB09D1CC60000BE325 /* JSProcessingInstruction.cpp */,
 				65DF31EC09D1CC60000BE325 /* JSProcessingInstruction.h */,
 				E4B423850CBFB73C00AF2ECE /* JSProgressEvent.cpp */,
@@ -22068,6 +22054,7 @@
 				2E7582ED12764F260062628B /* JSFileReaderCustom.cpp */,
 				C28083411C6DC96A001451B6 /* JSFontFaceCustom.cpp */,
 				1C24EEAA1C72AA0A0080F8FC /* JSFontFaceSetCustom.cpp */,
+				FE80D7A60E9C1ED2000D6F75 /* JSGeolocationCustom.cpp */,
 				BCE7B1920D4E86960075A539 /* JSHistoryCustom.cpp */,
 				BC97E42B10915B060010D361 /* JSHTMLAllCollectionCustom.cpp */,
 				BC4EDEF30C08F3FB007EDD49 /* JSHTMLAppletElementCustom.cpp */,
@@ -25431,7 +25418,6 @@
 				E3A776681DC85D2800B690D8 /* DOMJITIDLType.h in Headers */,
 				E35802B61DC8435D00A9773C /* DOMJITIDLTypeFilter.h in Headers */,
 				A9C6E4E40D745E05006442E9 /* DOMMimeType.h in Headers */,
-				7C330A081DF9F95100D3395C /* JSPositionOptions.h in Headers */,
 				A9C6E4E80D745E18006442E9 /* DOMMimeTypeArray.h in Headers */,
 				5706A6961DDE5C9500A03B14 /* CryptoAlgorithmRsaOaepParams.h in Headers */,
 				52B6C9C315E3F4DF00690B05 /* DOMNamedFlowCollection.h in Headers */,
@@ -28783,7 +28769,6 @@
 				FD31601512B0267600C1A359 /* AudioNodeInput.cpp in Sources */,
 				FD31601712B0267600C1A359 /* AudioNodeOutput.cpp in Sources */,
 				FD31601C12B0267600C1A359 /* AudioParam.cpp in Sources */,
-				7C330A071DF9F95100D3395C /* JSPositionOptions.cpp in Sources */,
 				FD35918F138DB22000E1EBEC /* AudioParamTimeline.cpp in Sources */,
 				FD31601F12B0267600C1A359 /* AudioProcessingEvent.cpp in Sources */,
 				FD31608512B026F700C1A359 /* AudioResampler.cpp in Sources */,
@@ -29926,6 +29911,7 @@
 				518F5003194CAC3A0081BAAE /* JSGamepadButton.cpp in Sources */,
 				516C62251950E2B900337E75 /* JSGamepadEvent.cpp in Sources */,
 				FE80DA630E9C4703000D6F75 /* JSGeolocation.cpp in Sources */,
+				FE80D7AB0E9C1ED2000D6F75 /* JSGeolocationCustom.cpp in Sources */,
 				FE80DA650E9C4703000D6F75 /* JSGeoposition.cpp in Sources */,
 				0FDA7C1E188322FC00C954B5 /* JSGestureEvent.cpp in Sources */,
 				8482B7511198CB6B00BFB005 /* JSHashChangeEvent.cpp in Sources */,

Modified: trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp (209611 => 209612)


--- trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp	2016-12-09 17:57:39 UTC (rev 209611)
+++ trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp	2016-12-09 18:12:31 UTC (rev 209612)
@@ -76,6 +76,7 @@
 #include "JSEventTargetCustom.cpp"
 #include "JSExceptionBase.cpp"
 #include "JSFileReaderCustom.cpp"
+#include "JSGeolocationCustom.cpp"
 #include "JSHTMLAllCollectionCustom.cpp"
 #include "JSHTMLAppletElementCustom.cpp"
 #include "JSHTMLCanvasElementCustom.cpp"

Added: trunk/Source/WebCore/bindings/js/JSGeolocationCustom.cpp (0 => 209612)


--- trunk/Source/WebCore/bindings/js/JSGeolocationCustom.cpp	                        (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSGeolocationCustom.cpp	2016-12-09 18:12:31 UTC (rev 209612)
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSGeolocation.h"
+
+#if ENABLE(GEOLOCATION)
+
+#include "CallbackFunction.h"
+#include "DOMWindow.h"
+#include "Geolocation.h"
+#include "JSDOMWindow.h"
+#include "JSDictionary.h"
+#include "JSPositionCallback.h"
+#include "JSPositionErrorCallback.h"
+#include "PositionOptions.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+// JSDictionary helper functions
+
+static void setEnableHighAccuracy(PositionOptions* options, const bool& enableHighAccuracy)
+{
+    options->setEnableHighAccuracy(enableHighAccuracy);
+}
+
+static void setTimeout(PositionOptions* options, const double& timeout)
+{
+    // If the value is positive infinity, there's nothing to do.
+    if (!(std::isinf(timeout) && (timeout > 0))) {
+        // Wrap to int32 and force non-negative to match behavior of window.setTimeout.
+        options->setTimeout(std::max<int>(0, timeout));
+    }
+}
+
+static void setMaximumAge(PositionOptions* options, const double& maximumAge)
+{
+    if (std::isinf(maximumAge) && (maximumAge > 0)) {
+        // If the value is positive infinity, clear maximumAge.
+        options->clearMaximumAge();
+    } else {
+        // Wrap to int32 and force non-negative to match behavior of window.setTimeout.
+        options->setMaximumAge(std::max<int>(0, maximumAge));
+    }
+}
+
+
+static RefPtr<PositionOptions> createPositionOptions(ExecState* exec, JSValue value)
+{
+    VM& vm = exec->vm();
+    auto scope = DECLARE_THROW_SCOPE(vm);
+
+    // Create default options.
+    auto options = PositionOptions::create();
+
+    // Argument is optional (hence undefined is allowed), and null is allowed.
+    if (value.isUndefinedOrNull()) {
+        // Use default options.
+        return WTFMove(options);
+    }
+
+    // Given the above test, this will always yield an object.
+    JSObject* object = value.toObject(exec);
+    ASSERT_UNUSED(scope, !scope.exception());
+
+    // Create the dictionary wrapper from the initializer object.
+    JSDictionary dictionary(exec, object);
+
+    if (!dictionary.tryGetProperty("enableHighAccuracy", options.ptr(), setEnableHighAccuracy))
+        return nullptr;
+    if (!dictionary.tryGetProperty("timeout", options.ptr(), setTimeout))
+        return nullptr;
+    if (!dictionary.tryGetProperty("maximumAge", options.ptr(), setMaximumAge))
+        return nullptr;
+
+    return WTFMove(options);
+}
+
+JSValue JSGeolocation::getCurrentPosition(ExecState& state)
+{
+    VM& vm = state.vm();
+    auto scope = DECLARE_THROW_SCOPE(vm);
+
+    // Arguments: PositionCallback, (optional)PositionErrorCallback, (optional)PositionOptions
+
+    auto positionCallback = createFunctionOnlyCallback<JSPositionCallback>(&state, globalObject(), state.argument(0));
+    RETURN_IF_EXCEPTION(scope, JSValue());
+    ASSERT(positionCallback);
+
+    auto positionErrorCallback = createFunctionOnlyCallback<JSPositionErrorCallback>(&state, globalObject(), state.argument(1), CallbackAllowUndefined | CallbackAllowNull);
+    RETURN_IF_EXCEPTION(scope, JSValue());
+
+    auto positionOptions = createPositionOptions(&state, state.argument(2));
+    RETURN_IF_EXCEPTION(scope, JSValue());
+    ASSERT(positionOptions);
+
+    wrapped().getCurrentPosition(WTFMove(positionCallback), WTFMove(positionErrorCallback), WTFMove(positionOptions));
+    return jsUndefined();
+}
+
+JSValue JSGeolocation::watchPosition(ExecState& state)
+{
+    VM& vm = state.vm();
+    auto scope = DECLARE_THROW_SCOPE(vm);
+
+    // Arguments: PositionCallback, (optional)PositionErrorCallback, (optional)PositionOptions
+
+    auto positionCallback = createFunctionOnlyCallback<JSPositionCallback>(&state, globalObject(), state.argument(0));
+    RETURN_IF_EXCEPTION(scope, JSValue());
+    ASSERT(positionCallback);
+
+    auto positionErrorCallback = createFunctionOnlyCallback<JSPositionErrorCallback>(&state, globalObject(), state.argument(1), CallbackAllowUndefined | CallbackAllowNull);
+    RETURN_IF_EXCEPTION(scope, JSValue());
+
+    auto positionOptions = createPositionOptions(&state, state.argument(2));
+    RETURN_IF_EXCEPTION(scope, JSValue());
+    ASSERT(positionOptions);
+
+    int watchID = wrapped().watchPosition(WTFMove(positionCallback), WTFMove(positionErrorCallback), WTFMove(positionOptions));
+    return jsNumber(watchID);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(GEOLOCATION)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to