Diff
Modified: trunk/LayoutTests/ChangeLog (209668 => 209669)
--- trunk/LayoutTests/ChangeLog 2016-12-10 19:14:51 UTC (rev 209668)
+++ trunk/LayoutTests/ChangeLog 2016-12-10 19:36:08 UTC (rev 209669)
@@ -1,3 +1,15 @@
+2016-12-09 Sam Weinig <[email protected]>
+
+ [WebIDL] Remove custom bindings for Geolocation
+ https://bugs.webkit.org/show_bug.cgi?id=165625
+
+ Reviewed by Alex Christensen.
+
+ * fast/dom/Geolocation/argument-types-expected.txt:
+ * fast/dom/Geolocation/not-enough-arguments-expected.txt:
+ * fast/dom/Geolocation/script-tests/argument-types.js:
+ Update tests for improved error messages / adherence to WebIDL.
+
2016-12-09 Dave Hyatt <[email protected]>
[CSS Parser] Remove the old CSS Parser
Modified: trunk/LayoutTests/fast/dom/Geolocation/argument-types-expected.txt (209668 => 209669)
--- trunk/LayoutTests/fast/dom/Geolocation/argument-types-expected.txt 2016-12-10 19:14:51 UTC (rev 209668)
+++ trunk/LayoutTests/fast/dom/Geolocation/argument-types-expected.txt 2016-12-10 19:36:08 UTC (rev 209669)
@@ -3,41 +3,41 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-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() 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(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 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(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(emptyFunction, undefined) did not throw exception.
PASS navigator.geolocation.getCurrentPosition(emptyFunction, null) did not throw exception.
-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, {}) 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, 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 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, 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, 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) 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, 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, {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 (209668 => 209669)
--- trunk/LayoutTests/fast/dom/Geolocation/not-enough-arguments-expected.txt 2016-12-10 19:14:51 UTC (rev 209668)
+++ trunk/LayoutTests/fast/dom/Geolocation/not-enough-arguments-expected.txt 2016-12-10 19:36:08 UTC (rev 209669)
@@ -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 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.getCurrentPosition() threw exception TypeError: Not enough arguments.
+PASS window.navigator.geolocation.watchPosition() threw exception TypeError: Not enough arguments.
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 (209668 => 209669)
--- trunk/LayoutTests/fast/dom/Geolocation/script-tests/argument-types.js 2016-12-10 19:14:51 UTC (rev 209668)
+++ trunk/LayoutTests/fast/dom/Geolocation/script-tests/argument-types.js 2016-12-10 19:36:08 UTC (rev 209669)
@@ -15,7 +15,7 @@
if (expectedException)
shouldThrow(_expression_, '(function() { return "' + expectedException + '"; })();');
else
- 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."; })();');
+ shouldThrow(_expression_, '(function() { return "TypeError: Type error"; })();');
} else {
shouldNotThrow(_expression_);
}
@@ -33,33 +33,33 @@
var objectThrowingException = new ObjectThrowingException();
-test('navigator.geolocation.getCurrentPosition()', true);
+test('navigator.geolocation.getCurrentPosition()', true, "TypeError: Not enough arguments");
-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(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(emptyFunction)', false);
test('navigator.geolocation.getCurrentPosition(Math.abs)', false);
test('navigator.geolocation.getCurrentPosition(testRunner.setGeolocationPermission)', false);
-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(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(emptyFunction, undefined)', false);
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, {})', 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, 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);
-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, 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, 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)', 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, 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, {dummyProperty:undefined})', false);
test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:null})', false);
Modified: trunk/Source/WebCore/CMakeLists.txt (209668 => 209669)
--- trunk/Source/WebCore/CMakeLists.txt 2016-12-10 19:14:51 UTC (rev 209668)
+++ trunk/Source/WebCore/CMakeLists.txt 2016-12-10 19:36:08 UTC (rev 209669)
@@ -180,6 +180,7 @@
Modules/geolocation/PositionCallback.idl
Modules/geolocation/PositionError.idl
Modules/geolocation/PositionErrorCallback.idl
+ Modules/geolocation/PositionOptions.idl
Modules/indexeddb/DOMWindowIndexedDatabase.idl
Modules/indexeddb/IDBCursor.idl
@@ -1133,7 +1134,6 @@
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 (209668 => 209669)
--- trunk/Source/WebCore/ChangeLog 2016-12-10 19:14:51 UTC (rev 209668)
+++ trunk/Source/WebCore/ChangeLog 2016-12-10 19:36:08 UTC (rev 209669)
@@ -1,3 +1,53 @@
+2016-12-09 Sam Weinig <[email protected]>
+
+ [WebIDL] Remove custom bindings for Geolocation
+ https://bugs.webkit.org/show_bug.cgi?id=165625
+
+ Reviewed by Alex Christensen.
+
+ * CMakeLists.txt:
+ * DerivedSources.cpp:
+ * DerivedSources.make:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSBindingsAllInOne.cpp:
+ Add/remove files.
+
+ * Modules/geolocation/GeoNotifier.cpp:
+ (WebCore::GeoNotifier::GeoNotifier):
+ (WebCore::GeoNotifier::hasZeroTimeout):
+ (WebCore::GeoNotifier::startTimerIfNeeded):
+ * Modules/geolocation/GeoNotifier.h:
+ (WebCore::GeoNotifier::create):
+ (WebCore::GeoNotifier::options):
+ Update to store PositionOptions as a value, and pass the PositionCallback
+ as a Ref, rather than a RefPtr, since it is not optional.
+
+ * Modules/geolocation/Geolocation.cpp:
+ (WebCore::createGeoposition):
+ Use auto, to get the good type for Coordinates (Ref).
+
+ (WebCore::Geolocation::getCurrentPosition):
+ (WebCore::Geolocation::watchPosition):
+ (WebCore::Geolocation::haveSuitableCachedPosition):
+ (WebCore::Geolocation::startUpdating):
+ * Modules/geolocation/Geolocation.h:
+ Update to pass PositionOptions itself now that it is a plain struct.
+
+ * Modules/geolocation/Geolocation.idl:
+ Remove [Custom] extended attribute and add FIXME about nullable annotation.
+
+ * Modules/geolocation/Geoposition.h:
+ Pass/store Coordinates as a Ref.
+
+ * Modules/geolocation/PositionOptions.h:
+ Convert to be a simple struct.
+
+ * Modules/geolocation/PositionOptions.idl:
+ Added.
+
+ * bindings/js/JSGeolocationCustom.cpp:
+ Removed.
+
2016-12-09 Dave Hyatt <[email protected]>
[CSS Parser] Remove the old CSS Parser
Modified: trunk/Source/WebCore/DerivedSources.cpp (209668 => 209669)
--- trunk/Source/WebCore/DerivedSources.cpp 2016-12-10 19:14:51 UTC (rev 209668)
+++ trunk/Source/WebCore/DerivedSources.cpp 2016-12-10 19:36:08 UTC (rev 209669)
@@ -392,6 +392,7 @@
#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 (209668 => 209669)
--- trunk/Source/WebCore/DerivedSources.make 2016-12-10 19:14:51 UTC (rev 209668)
+++ trunk/Source/WebCore/DerivedSources.make 2016-12-10 19:36:08 UTC (rev 209669)
@@ -114,6 +114,7 @@
$(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 (209668 => 209669)
--- trunk/Source/WebCore/Modules/geolocation/GeoNotifier.cpp 2016-12-10 19:14:51 UTC (rev 209668)
+++ trunk/Source/WebCore/Modules/geolocation/GeoNotifier.cpp 2016-12-10 19:36:08 UTC (rev 209669)
@@ -34,7 +34,7 @@
namespace WebCore {
-GeoNotifier::GeoNotifier(Geolocation& geolocation, RefPtr<PositionCallback>&& successCallback, RefPtr<PositionErrorCallback>&& errorCallback, RefPtr<PositionOptions>&& options)
+GeoNotifier::GeoNotifier(Geolocation& geolocation, Ref<PositionCallback>&& successCallback, RefPtr<PositionErrorCallback>&& errorCallback, PositionOptions&& options)
: m_geolocation(geolocation)
, m_successCallback(WTFMove(successCallback))
, m_errorCallback(WTFMove(errorCallback))
@@ -42,10 +42,6 @@
, 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)
@@ -70,7 +66,7 @@
bool GeoNotifier::hasZeroTimeout() const
{
- return m_options->hasTimeout() && !m_options->timeout();
+ return !m_options.timeout;
}
void GeoNotifier::runSuccessCallback(Geoposition* position)
@@ -91,8 +87,7 @@
void GeoNotifier::startTimerIfNeeded()
{
- if (m_options->hasTimeout())
- m_timer.startOneShot(m_options->timeout() / 1000.0);
+ m_timer.startOneShot(m_options.timeout / 1000.0);
}
void GeoNotifier::stopTimer()
Modified: trunk/Source/WebCore/Modules/geolocation/GeoNotifier.h (209668 => 209669)
--- trunk/Source/WebCore/Modules/geolocation/GeoNotifier.h 2016-12-10 19:14:51 UTC (rev 209668)
+++ trunk/Source/WebCore/Modules/geolocation/GeoNotifier.h 2016-12-10 19:36:08 UTC (rev 209669)
@@ -28,6 +28,7 @@
#if ENABLE(GEOLOCATION)
+#include "PositionOptions.h"
#include "Timer.h"
#include <wtf/Forward.h>
#include <wtf/RefCounted.h>
@@ -40,16 +41,15 @@
class PositionCallback;
class PositionError;
class PositionErrorCallback;
-class PositionOptions;
class GeoNotifier : public RefCounted<GeoNotifier> {
public:
- static Ref<GeoNotifier> create(Geolocation& geolocation, RefPtr<PositionCallback>&& positionCallback, RefPtr<PositionErrorCallback>&& positionErrorCallback, RefPtr<PositionOptions>&& options)
+ static Ref<GeoNotifier> create(Geolocation& geolocation, Ref<PositionCallback>&& positionCallback, RefPtr<PositionErrorCallback>&& positionErrorCallback, PositionOptions&& options)
{
return adoptRef(*new GeoNotifier(geolocation, WTFMove(positionCallback), WTFMove(positionErrorCallback), WTFMove(options)));
}
- PositionOptions* options() const { return m_options.get(); }
+ const PositionOptions& options() const { return m_options; }
void setFatalError(RefPtr<PositionError>&&);
bool useCachedPosition() const { return m_useCachedPosition; }
@@ -64,12 +64,12 @@
bool hasZeroTimeout() const;
private:
- GeoNotifier(Geolocation&, RefPtr<PositionCallback>&&, RefPtr<PositionErrorCallback>&&, RefPtr<PositionOptions>&&);
+ GeoNotifier(Geolocation&, Ref<PositionCallback>&&, RefPtr<PositionErrorCallback>&&, PositionOptions&&);
Ref<Geolocation> m_geolocation;
- RefPtr<PositionCallback> m_successCallback;
+ Ref<PositionCallback> m_successCallback;
RefPtr<PositionErrorCallback> m_errorCallback;
- RefPtr<PositionOptions> m_options;
+ PositionOptions m_options;
Timer m_timer;
RefPtr<PositionError> m_fatalError;
bool m_useCachedPosition;
Modified: trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp (209668 => 209669)
--- trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp 2016-12-10 19:14:51 UTC (rev 209668)
+++ trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp 2016-12-10 19:36:08 UTC (rev 209669)
@@ -57,9 +57,10 @@
if (!position)
return nullptr;
- 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());
+ 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());
+
return Geoposition::create(WTFMove(coordinates), convertSecondsToDOMTimeStamp(position->timestamp()));
}
@@ -149,21 +150,11 @@
ASSERT(m_allowGeolocation != InProgress);
}
-Document* Geolocation::document() const
-{
- return downcast<Document>(scriptExecutionContext());
-}
-
SecurityOrigin* Geolocation::securityOrigin() const
{
return scriptExecutionContext()->securityOrigin();
}
-Frame* Geolocation::frame() const
-{
- return document() ? document()->frame() : nullptr;
-}
-
Page* Geolocation::page() const
{
return document() ? document()->page() : nullptr;
@@ -311,7 +302,7 @@
return m_lastPosition.get();
}
-void Geolocation::getCurrentPosition(RefPtr<PositionCallback>&& successCallback, RefPtr<PositionErrorCallback>&& errorCallback, RefPtr<PositionOptions>&& options)
+void Geolocation::getCurrentPosition(Ref<PositionCallback>&& successCallback, RefPtr<PositionErrorCallback>&& errorCallback, PositionOptions&& options)
{
if (!frame())
return;
@@ -322,7 +313,7 @@
m_oneShots.add(notifier);
}
-int Geolocation::watchPosition(RefPtr<PositionCallback>&& successCallback, RefPtr<PositionErrorCallback>&& errorCallback, RefPtr<PositionOptions>&& options)
+int Geolocation::watchPosition(Ref<PositionCallback>&& successCallback, RefPtr<PositionErrorCallback>&& errorCallback, PositionOptions&& options)
{
if (!frame())
return 0;
@@ -459,17 +450,15 @@
stopUpdating();
}
-bool Geolocation::haveSuitableCachedPosition(PositionOptions* options)
+bool Geolocation::haveSuitableCachedPosition(const PositionOptions& options)
{
Geoposition* cachedPosition = lastPosition();
if (!cachedPosition)
return false;
- if (!options->hasMaximumAge())
- return true;
- if (!options->maximumAge())
+ 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)
@@ -703,7 +692,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 (209668 => 209669)
--- trunk/Source/WebCore/Modules/geolocation/Geolocation.h 2016-12-10 19:14:51 UTC (rev 209668)
+++ trunk/Source/WebCore/Modules/geolocation/Geolocation.h 2016-12-10 19:36:08 UTC (rev 209669)
@@ -29,6 +29,7 @@
#if ENABLE(GEOLOCATION)
#include "ActiveDOMObject.h"
+#include "Document.h"
#include "Geoposition.h"
#include "PositionCallback.h"
#include "PositionError.h"
@@ -41,7 +42,6 @@
namespace WebCore {
-class Document;
class Frame;
class GeoNotifier;
class GeolocationError;
@@ -48,21 +48,20 @@
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();
WEBCORE_EXPORT void resetAllGeolocationPermission();
- Document* document() const;
- WEBCORE_EXPORT Frame* frame() const;
+ Document* document() const { return downcast<Document>(scriptExecutionContext()); }
+ Frame* frame() const { return document() ? document()->frame() : nullptr; }
- void getCurrentPosition(RefPtr<PositionCallback>&&, RefPtr<PositionErrorCallback>&&, RefPtr<PositionOptions>&&);
- int watchPosition(RefPtr<PositionCallback>&&, RefPtr<PositionErrorCallback>&&, RefPtr<PositionOptions>&&);
+ void getCurrentPosition(Ref<PositionCallback>&&, RefPtr<PositionErrorCallback>&&, PositionOptions&&);
+ int watchPosition(Ref<PositionCallback>&&, RefPtr<PositionErrorCallback>&&, PositionOptions&&);
void clearWatch(int watchID);
WEBCORE_EXPORT void setIsAllowed(bool);
@@ -141,7 +140,7 @@
void fatalErrorOccurred(GeoNotifier*);
void requestTimedOut(GeoNotifier*);
void requestUsesCachedPosition(GeoNotifier*);
- bool haveSuitableCachedPosition(PositionOptions*);
+ bool haveSuitableCachedPosition(const PositionOptions&);
void makeCachedPositionCallbacks();
GeoNotifierSet m_oneShots;
Modified: trunk/Source/WebCore/Modules/geolocation/Geolocation.idl (209668 => 209669)
--- trunk/Source/WebCore/Modules/geolocation/Geolocation.idl 2016-12-10 19:14:51 UTC (rev 209668)
+++ trunk/Source/WebCore/Modules/geolocation/Geolocation.idl 2016-12-10 19:36:08 UTC (rev 209669)
@@ -29,14 +29,16 @@
Conditional=GEOLOCATION,
GenerateIsReachable=ImplFrame,
] interface Geolocation {
- [Custom] void getCurrentPosition(PositionCallback successCallback,
- optional PositionErrorCallback? errorCallback,
- optional PositionOptions options);
+ // FIXME: PositionErrorCallback should not be nullable
+ void getCurrentPosition(PositionCallback successCallback,
+ optional PositionErrorCallback? errorCallback,
+ optional PositionOptions options);
- [Custom] long watchPosition(PositionCallback successCallback,
- optional PositionErrorCallback? errorCallback,
- optional PositionOptions options);
+ // FIXME: PositionErrorCallback should not be nullable
+ 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 (209668 => 209669)
--- trunk/Source/WebCore/Modules/geolocation/Geoposition.h 2016-12-10 19:14:51 UTC (rev 209668)
+++ trunk/Source/WebCore/Modules/geolocation/Geoposition.h 2016-12-10 19:36:08 UTC (rev 209669)
@@ -34,7 +34,7 @@
class Geoposition : public RefCounted<Geoposition> {
public:
- static Ref<Geoposition> create(RefPtr<Coordinates>&& coordinates, DOMTimeStamp timestamp)
+ static Ref<Geoposition> create(Ref<Coordinates>&& coordinates, DOMTimeStamp timestamp)
{
return adoptRef(*new Geoposition(WTFMove(coordinates), timestamp));
}
@@ -45,17 +45,16 @@
}
DOMTimeStamp timestamp() const { return m_timestamp; }
- Coordinates* coords() const { return m_coordinates.get(); }
+ const Coordinates& coords() const { return m_coordinates.get(); }
private:
- Geoposition(RefPtr<Coordinates>&& coordinates, DOMTimeStamp timestamp)
+ Geoposition(Ref<Coordinates>&& coordinates, DOMTimeStamp timestamp)
: m_coordinates(WTFMove(coordinates))
, m_timestamp(timestamp)
{
- ASSERT(m_coordinates);
}
- RefPtr<Coordinates> m_coordinates;
+ Ref<Coordinates> m_coordinates;
DOMTimeStamp m_timestamp;
};
Modified: trunk/Source/WebCore/Modules/geolocation/PositionOptions.h (209668 => 209669)
--- trunk/Source/WebCore/Modules/geolocation/PositionOptions.h 2016-12-10 19:14:51 UTC (rev 209668)
+++ trunk/Source/WebCore/Modules/geolocation/PositionOptions.h 2016-12-10 19:36:08 UTC (rev 209669)
@@ -25,55 +25,12 @@
#pragma once
-#include <wtf/RefCounted.h>
-
namespace WebCore {
-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;
+struct PositionOptions {
+ bool enableHighAccuracy { false };
+ unsigned timeout { 0xFFFFFFFF };
+ unsigned maximumAge { 0 };
};
} // namespace WebCore
Added: trunk/Source/WebCore/Modules/geolocation/PositionOptions.idl (0 => 209669)
--- trunk/Source/WebCore/Modules/geolocation/PositionOptions.idl (rev 0)
+++ trunk/Source/WebCore/Modules/geolocation/PositionOptions.idl 2016-12-10 19:36:08 UTC (rev 209669)
@@ -0,0 +1,30 @@
+/*
+ * 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 (209668 => 209669)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-12-10 19:14:51 UTC (rev 209668)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-12-10 19:36:08 UTC (rev 209669)
@@ -2841,6 +2841,8 @@
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 */; };
@@ -6841,7 +6843,6 @@
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 */; };
@@ -10313,6 +10314,9 @@
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>"; };
@@ -14906,7 +14910,6 @@
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>"; };
@@ -15653,6 +15656,7 @@
42A023FA1A39F13A00F722CF /* FetchAPI */,
89878576122CA1DA003AABDA /* FileAPI */,
518F4FFC194CABE30081BAAE /* Gamepad */,
+ 7C330A041DF9F93B00D3395C /* Geolocation */,
A83B79080CCAFF2B000B0825 /* HTML */,
AA93C850175D5B2000FD3CE3 /* IndieUI */,
1C5FAECA0DCFD8C900D58F78 /* Inspector */,
@@ -17811,8 +17815,6 @@
65BF02180974806300C43196 /* page */ = {
isa = PBXGroup;
children = (
- AD5A0C211DECA10100707054 /* PerformanceLogging.cpp */,
- AD5A0C201DECA0B500707054 /* PerformanceLogging.h */,
316FE1060E6E1D8400BF6088 /* animation */,
5D5975B5196362BE00D00878 /* cocoa */,
CE17AD141C58522F005F4799 /* csp */,
@@ -17952,6 +17954,8 @@
CB38FD4A1CCCF2DD00592A3F /* PerformanceEntry.cpp */,
86BE33FB15058CB200CE0FD8 /* PerformanceEntry.h */,
86BE33FC15058CB200CE0FD8 /* PerformanceEntry.idl */,
+ AD5A0C211DECA10100707054 /* PerformanceLogging.cpp */,
+ AD5A0C201DECA0B500707054 /* PerformanceLogging.h */,
8AF4E55211DC5A36000ED3DE /* PerformanceNavigation.cpp */,
8AF4E55311DC5A36000ED3DE /* PerformanceNavigation.h */,
8AF4E55411DC5A36000ED3DE /* PerformanceNavigation.idl */,
@@ -18243,6 +18247,27 @@
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 = (
@@ -19133,6 +19158,7 @@
9746AF2014F4DDE6003E7A70 /* PositionErrorCallback.h */,
9746AF2114F4DDE6003E7A70 /* PositionErrorCallback.idl */,
9746AF2214F4DDE6003E7A70 /* PositionOptions.h */,
+ 7C330A031DF9E95B00D3395C /* PositionOptions.idl */,
);
path = geolocation;
sourceTree = "<group>";
@@ -20412,8 +20438,6 @@
65DF31E009D1CC60000BE325 /* JSCharacterData.h */,
93F9B6DE0BA0FB7200854064 /* JSComment.cpp */,
93F9B6DF0BA0FB7200854064 /* JSComment.h */,
- FE6FD48B0F676E9300092873 /* JSCoordinates.cpp */,
- FE6FD48C0F676E9300092873 /* JSCoordinates.h */,
9BE671091D5AEB0400345514 /* JSCustomElementRegistry.cpp */,
9BE6710A1D5AEB0400345514 /* JSCustomElementRegistry.h */,
BCA83E4D0D7CE1E9003421A8 /* JSDataTransfer.cpp */,
@@ -20452,10 +20476,6 @@
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 */,
@@ -20466,12 +20486,6 @@
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 */,
@@ -22048,7 +22062,6 @@
2E7582ED12764F260062628B /* JSFileReaderCustom.cpp */,
C28083411C6DC96A001451B6 /* JSFontFaceCustom.cpp */,
1C24EEAA1C72AA0A0080F8FC /* JSFontFaceSetCustom.cpp */,
- FE80D7A60E9C1ED2000D6F75 /* JSGeolocationCustom.cpp */,
BCE7B1920D4E86960075A539 /* JSHistoryCustom.cpp */,
BC97E42B10915B060010D361 /* JSHTMLAllCollectionCustom.cpp */,
BC4EDEF30C08F3FB007EDD49 /* JSHTMLAppletElementCustom.cpp */,
@@ -25408,6 +25421,7 @@
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 */,
@@ -28761,6 +28775,7 @@
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 */,
@@ -29901,7 +29916,6 @@
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 (209668 => 209669)
--- trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp 2016-12-10 19:14:51 UTC (rev 209668)
+++ trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp 2016-12-10 19:36:08 UTC (rev 209669)
@@ -76,7 +76,6 @@
#include "JSEventTargetCustom.cpp"
#include "JSExceptionBase.cpp"
#include "JSFileReaderCustom.cpp"
-#include "JSGeolocationCustom.cpp"
#include "JSHTMLAllCollectionCustom.cpp"
#include "JSHTMLAppletElementCustom.cpp"
#include "JSHTMLCanvasElementCustom.cpp"
Deleted: trunk/Source/WebCore/bindings/js/JSGeolocationCustom.cpp (209668 => 209669)
--- trunk/Source/WebCore/bindings/js/JSGeolocationCustom.cpp 2016-12-10 19:14:51 UTC (rev 209668)
+++ trunk/Source/WebCore/bindings/js/JSGeolocationCustom.cpp 2016-12-10 19:36:08 UTC (rev 209669)
@@ -1,149 +0,0 @@
-/*
- * 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)