зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1575144 - Update Geolocation implementation to match latest spec r=baku,marcosc
The Geolocation API specification renamed the following interfaces and removed the [NoInterfaceObject] annotation so that these types are now exposed to script: * Coordinates -> GeolocationCoordinates * Position -> GeolocationPosition * PositionError -> GeolocationPositionError This is done in response to an effort to remove the [NoInterfaceObject] annotation from WebIDL. Additionally, the following interfaces are now only exposed in Secure Contexts: * GeolocationCoordinates * GeolocationPosition Differential Revision: https://phabricator.services.mozilla.com/D51972 --HG-- rename : dom/geolocation/PositionError.cpp => dom/geolocation/GeolocationPositionError.cpp rename : dom/geolocation/PositionError.h => dom/geolocation/GeolocationPositionError.h rename : dom/webidl/Coordinates.webidl => dom/webidl/GeolocationCoordinates.webidl rename : dom/webidl/Position.webidl => dom/webidl/GeolocationPosition.webidl rename : dom/webidl/PositionError.webidl => dom/webidl/GeolocationPositionError.webidl extra : moz-landing-system : lando
This commit is contained in:
Родитель
e008ba8ab4
Коммит
6023989158
|
@ -135,7 +135,7 @@ DOMInterfaces = {
|
|||
'implicitJSContext': [ 'buffer' ],
|
||||
},
|
||||
|
||||
'Coordinates': {
|
||||
'GeolocationCoordinates': {
|
||||
'headerFile': 'nsGeoPosition.h'
|
||||
},
|
||||
|
||||
|
@ -637,7 +637,7 @@ DOMInterfaces = {
|
|||
'nativeType': 'mozilla::dom::FeaturePolicy',
|
||||
},
|
||||
|
||||
'Position': {
|
||||
'GeolocationPosition': {
|
||||
'headerFile': 'nsGeoPosition.h'
|
||||
},
|
||||
|
||||
|
|
|
@ -4,32 +4,33 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/PositionError.h"
|
||||
#include "mozilla/dom/PositionErrorBinding.h"
|
||||
#include "mozilla/dom/GeolocationPositionError.h"
|
||||
#include "mozilla/dom/GeolocationPositionErrorBinding.h"
|
||||
#include "mozilla/CycleCollectedJSContext.h" // for nsAutoMicroTask
|
||||
#include "nsGeolocation.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(PositionError, mParent)
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(PositionError, AddRef)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(PositionError, Release)
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(GeolocationPositionError, mParent)
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(GeolocationPositionError, AddRef)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(GeolocationPositionError, Release)
|
||||
|
||||
PositionError::PositionError(Geolocation* aParent, int16_t aCode)
|
||||
GeolocationPositionError::GeolocationPositionError(Geolocation* aParent,
|
||||
int16_t aCode)
|
||||
: mCode(aCode), mParent(aParent) {}
|
||||
|
||||
PositionError::~PositionError() = default;
|
||||
GeolocationPositionError::~GeolocationPositionError() = default;
|
||||
|
||||
void PositionError::GetMessage(nsAString& aMessage) const {
|
||||
void GeolocationPositionError::GetMessage(nsAString& aMessage) const {
|
||||
switch (mCode) {
|
||||
case PositionError_Binding::PERMISSION_DENIED:
|
||||
case GeolocationPositionError_Binding::PERMISSION_DENIED:
|
||||
aMessage = NS_LITERAL_STRING("User denied geolocation prompt");
|
||||
break;
|
||||
case PositionError_Binding::POSITION_UNAVAILABLE:
|
||||
case GeolocationPositionError_Binding::POSITION_UNAVAILABLE:
|
||||
aMessage = NS_LITERAL_STRING("Unknown error acquiring position");
|
||||
break;
|
||||
case PositionError_Binding::TIMEOUT:
|
||||
case GeolocationPositionError_Binding::TIMEOUT:
|
||||
aMessage = NS_LITERAL_STRING("Position acquisition timed out");
|
||||
break;
|
||||
default:
|
||||
|
@ -37,14 +38,17 @@ void PositionError::GetMessage(nsAString& aMessage) const {
|
|||
}
|
||||
}
|
||||
|
||||
nsWrapperCache* PositionError::GetParentObject() const { return mParent; }
|
||||
|
||||
JSObject* PositionError::WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) {
|
||||
return PositionError_Binding::Wrap(aCx, this, aGivenProto);
|
||||
nsWrapperCache* GeolocationPositionError::GetParentObject() const {
|
||||
return mParent;
|
||||
}
|
||||
|
||||
void PositionError::NotifyCallback(const GeoPositionErrorCallback& aCallback) {
|
||||
JSObject* GeolocationPositionError::WrapObject(
|
||||
JSContext* aCx, JS::Handle<JSObject*> aGivenProto) {
|
||||
return GeolocationPositionError_Binding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
void GeolocationPositionError::NotifyCallback(
|
||||
const GeoPositionErrorCallback& aCallback) {
|
||||
nsAutoMicroTask mt;
|
||||
if (aCallback.HasWebIDLCallback()) {
|
||||
RefPtr<PositionErrorCallback> callback = aCallback.GetWebIDLCallback();
|
|
@ -22,12 +22,12 @@ typedef CallbackObjectHolder<PositionErrorCallback,
|
|||
nsIDOMGeoPositionErrorCallback>
|
||||
GeoPositionErrorCallback;
|
||||
|
||||
class PositionError final : public nsWrapperCache {
|
||||
class GeolocationPositionError final : public nsWrapperCache {
|
||||
public:
|
||||
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(PositionError)
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(PositionError)
|
||||
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(GeolocationPositionError)
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(GeolocationPositionError)
|
||||
|
||||
PositionError(Geolocation* aParent, int16_t aCode);
|
||||
GeolocationPositionError(Geolocation* aParent, int16_t aCode);
|
||||
|
||||
nsWrapperCache* GetParentObject() const;
|
||||
|
||||
|
@ -42,7 +42,7 @@ class PositionError final : public nsWrapperCache {
|
|||
void NotifyCallback(const GeoPositionErrorCallback& callback);
|
||||
|
||||
private:
|
||||
~PositionError();
|
||||
~GeolocationPositionError();
|
||||
int16_t mCode;
|
||||
RefPtr<Geolocation> mParent;
|
||||
};
|
|
@ -13,12 +13,12 @@ EXPORTS += [
|
|||
]
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
'PositionError.h',
|
||||
'GeolocationPositionError.h',
|
||||
]
|
||||
|
||||
SOURCES += [
|
||||
'GeolocationPositionError.cpp',
|
||||
'nsGeolocation.cpp',
|
||||
'PositionError.cpp',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
#include "nsGeoPosition.h"
|
||||
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/dom/PositionBinding.h"
|
||||
#include "mozilla/dom/CoordinatesBinding.h"
|
||||
#include "mozilla/dom/GeolocationPositionBinding.h"
|
||||
#include "mozilla/dom/GeolocationCoordinatesBinding.h"
|
||||
|
||||
using mozilla::EqualOrBothNaN;
|
||||
using mozilla::IsNaN;
|
||||
|
@ -144,81 +144,86 @@ nsGeoPosition::GetCoords(nsIDOMGeoPositionCoords** aCoords) {
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Position, mParent, mCoordinates)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(Position)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(Position)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Position)
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(GeolocationPosition, mParent,
|
||||
mCoordinates)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(GeolocationPosition)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(GeolocationPosition)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(GeolocationPosition)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
Position::Position(nsISupports* aParent, nsIDOMGeoPosition* aGeoPosition)
|
||||
GeolocationPosition::GeolocationPosition(nsISupports* aParent,
|
||||
nsIDOMGeoPosition* aGeoPosition)
|
||||
: mParent(aParent), mGeoPosition(aGeoPosition) {}
|
||||
|
||||
Position::~Position() {}
|
||||
GeolocationPosition::~GeolocationPosition() {}
|
||||
|
||||
nsISupports* Position::GetParentObject() const { return mParent; }
|
||||
nsISupports* GeolocationPosition::GetParentObject() const { return mParent; }
|
||||
|
||||
JSObject* Position::WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) {
|
||||
return Position_Binding::Wrap(aCx, this, aGivenProto);
|
||||
JSObject* GeolocationPosition::WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) {
|
||||
return GeolocationPosition_Binding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
Coordinates* Position::Coords() {
|
||||
GeolocationCoordinates* GeolocationPosition::Coords() {
|
||||
if (!mCoordinates) {
|
||||
nsCOMPtr<nsIDOMGeoPositionCoords> coords;
|
||||
mGeoPosition->GetCoords(getter_AddRefs(coords));
|
||||
MOZ_ASSERT(coords, "coords should not be null");
|
||||
|
||||
mCoordinates = new Coordinates(this, coords);
|
||||
mCoordinates = new GeolocationCoordinates(this, coords);
|
||||
}
|
||||
|
||||
return mCoordinates;
|
||||
}
|
||||
|
||||
uint64_t Position::Timestamp() const {
|
||||
uint64_t GeolocationPosition::Timestamp() const {
|
||||
uint64_t rv;
|
||||
|
||||
mGeoPosition->GetTimestamp(&rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Coordinates, mPosition)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(Coordinates)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(Coordinates)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Coordinates)
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(GeolocationCoordinates, mPosition)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(GeolocationCoordinates)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(GeolocationCoordinates)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(GeolocationCoordinates)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
Coordinates::Coordinates(Position* aPosition, nsIDOMGeoPositionCoords* aCoords)
|
||||
GeolocationCoordinates::GeolocationCoordinates(GeolocationPosition* aPosition,
|
||||
nsIDOMGeoPositionCoords* aCoords)
|
||||
: mPosition(aPosition), mCoords(aCoords) {}
|
||||
|
||||
Coordinates::~Coordinates() {}
|
||||
GeolocationCoordinates::~GeolocationCoordinates() {}
|
||||
|
||||
Position* Coordinates::GetParentObject() const { return mPosition; }
|
||||
|
||||
JSObject* Coordinates::WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) {
|
||||
return Coordinates_Binding::Wrap(aCx, this, aGivenProto);
|
||||
GeolocationPosition* GeolocationCoordinates::GetParentObject() const {
|
||||
return mPosition;
|
||||
}
|
||||
|
||||
#define GENERATE_COORDS_WRAPPED_GETTER(name) \
|
||||
double Coordinates::name() const { \
|
||||
double rv; \
|
||||
mCoords->Get##name(&rv); \
|
||||
return rv; \
|
||||
JSObject* GeolocationCoordinates::WrapObject(
|
||||
JSContext* aCx, JS::Handle<JSObject*> aGivenProto) {
|
||||
return GeolocationCoordinates_Binding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
#define GENERATE_COORDS_WRAPPED_GETTER(name) \
|
||||
double GeolocationCoordinates::name() const { \
|
||||
double rv; \
|
||||
mCoords->Get##name(&rv); \
|
||||
return rv; \
|
||||
}
|
||||
|
||||
#define GENERATE_COORDS_WRAPPED_GETTER_NULLABLE(name) \
|
||||
Nullable<double> Coordinates::Get##name() const { \
|
||||
double value; \
|
||||
mCoords->Get##name(&value); \
|
||||
Nullable<double> rv; \
|
||||
if (!IsNaN(value)) { \
|
||||
rv.SetValue(value); \
|
||||
} \
|
||||
return rv; \
|
||||
#define GENERATE_COORDS_WRAPPED_GETTER_NULLABLE(name) \
|
||||
Nullable<double> GeolocationCoordinates::Get##name() const { \
|
||||
double value; \
|
||||
mCoords->Get##name(&value); \
|
||||
Nullable<double> rv; \
|
||||
if (!IsNaN(value)) { \
|
||||
rv.SetValue(value); \
|
||||
} \
|
||||
return rv; \
|
||||
}
|
||||
|
||||
GENERATE_COORDS_WRAPPED_GETTER(Latitude)
|
||||
|
|
|
@ -64,46 +64,47 @@ class nsGeoPosition final : public nsIDOMGeoPosition {
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class Coordinates;
|
||||
class GeolocationCoordinates;
|
||||
|
||||
class Position final : public nsISupports, public nsWrapperCache {
|
||||
~Position();
|
||||
class GeolocationPosition final : public nsISupports, public nsWrapperCache {
|
||||
~GeolocationPosition();
|
||||
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Position)
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(GeolocationPosition)
|
||||
|
||||
public:
|
||||
Position(nsISupports* aParent, nsIDOMGeoPosition* aGeoPosition);
|
||||
GeolocationPosition(nsISupports* aParent, nsIDOMGeoPosition* aGeoPosition);
|
||||
|
||||
nsISupports* GetParentObject() const;
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
Coordinates* Coords();
|
||||
GeolocationCoordinates* Coords();
|
||||
|
||||
uint64_t Timestamp() const;
|
||||
|
||||
nsIDOMGeoPosition* GetWrappedGeoPosition() { return mGeoPosition; }
|
||||
|
||||
private:
|
||||
RefPtr<Coordinates> mCoordinates;
|
||||
RefPtr<GeolocationCoordinates> mCoordinates;
|
||||
nsCOMPtr<nsISupports> mParent;
|
||||
nsCOMPtr<nsIDOMGeoPosition> mGeoPosition;
|
||||
};
|
||||
|
||||
class Coordinates final : public nsISupports, public nsWrapperCache {
|
||||
~Coordinates();
|
||||
class GeolocationCoordinates final : public nsISupports, public nsWrapperCache {
|
||||
~GeolocationCoordinates();
|
||||
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Coordinates)
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(GeolocationCoordinates)
|
||||
|
||||
public:
|
||||
Coordinates(Position* aPosition, nsIDOMGeoPositionCoords* aCoords);
|
||||
GeolocationCoordinates(GeolocationPosition* aPosition,
|
||||
nsIDOMGeoPositionCoords* aCoords);
|
||||
|
||||
Position* GetParentObject() const;
|
||||
GeolocationPosition* GetParentObject() const;
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
@ -123,7 +124,7 @@ class Coordinates final : public nsISupports, public nsWrapperCache {
|
|||
Nullable<double> GetSpeed() const;
|
||||
|
||||
private:
|
||||
RefPtr<Position> mPosition;
|
||||
RefPtr<GeolocationPosition> mPosition;
|
||||
nsCOMPtr<nsIDOMGeoPositionCoords> mCoords;
|
||||
};
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/FeaturePolicyUtils.h"
|
||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||
#include "mozilla/dom/PositionError.h"
|
||||
#include "mozilla/dom/PositionErrorBinding.h"
|
||||
#include "mozilla/dom/GeolocationPositionError.h"
|
||||
#include "mozilla/dom/GeolocationPositionErrorBinding.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/StaticPrefs_geo.h"
|
||||
|
@ -231,7 +231,7 @@ NS_IMPL_CYCLE_COLLECTION_INHERITED(nsGeolocationRequest,
|
|||
|
||||
void nsGeolocationRequest::Notify() {
|
||||
SetTimeoutTimer();
|
||||
NotifyErrorAndShutdown(PositionError_Binding::TIMEOUT);
|
||||
NotifyErrorAndShutdown(GeolocationPositionError_Binding::TIMEOUT);
|
||||
}
|
||||
|
||||
void nsGeolocationRequest::NotifyErrorAndShutdown(uint16_t aErrorCode) {
|
||||
|
@ -258,7 +258,7 @@ nsGeolocationRequest::Cancel() {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NotifyError(PositionError_Binding::PERMISSION_DENIED);
|
||||
NotifyError(GeolocationPositionError_Binding::PERMISSION_DENIED);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -333,7 +333,7 @@ nsGeolocationRequest::Allow(JS::HandleValue aChoices) {
|
|||
// if it is not a watch request and timeout is 0,
|
||||
// invoke the errorCallback (if present) with TIMEOUT code
|
||||
if (mOptions && mOptions->mTimeout == 0 && !mIsWatchPositionRequest) {
|
||||
NotifyError(PositionError_Binding::TIMEOUT);
|
||||
NotifyError(GeolocationPositionError_Binding::TIMEOUT);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ nsGeolocationRequest::Allow(JS::HandleValue aChoices) {
|
|||
|
||||
if (NS_FAILED(rv)) {
|
||||
// Location provider error
|
||||
NotifyError(PositionError_Binding::POSITION_UNAVAILABLE);
|
||||
NotifyError(GeolocationPositionError_Binding::POSITION_UNAVAILABLE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -395,18 +395,19 @@ void nsGeolocationRequest::SendLocation(nsIDOMGeoPosition* aPosition) {
|
|||
}
|
||||
}
|
||||
|
||||
RefPtr<mozilla::dom::Position> wrapped;
|
||||
RefPtr<mozilla::dom::GeolocationPosition> wrapped;
|
||||
|
||||
if (aPosition) {
|
||||
nsCOMPtr<nsIDOMGeoPositionCoords> coords;
|
||||
aPosition->GetCoords(getter_AddRefs(coords));
|
||||
if (coords) {
|
||||
wrapped = new mozilla::dom::Position(ToSupports(mLocator), aPosition);
|
||||
wrapped = new mozilla::dom::GeolocationPosition(ToSupports(mLocator),
|
||||
aPosition);
|
||||
}
|
||||
}
|
||||
|
||||
if (!wrapped) {
|
||||
NotifyError(PositionError_Binding::POSITION_UNAVAILABLE);
|
||||
NotifyError(GeolocationPositionError_Binding::POSITION_UNAVAILABLE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -452,7 +453,8 @@ nsGeolocationRequest::Update(nsIDOMGeoPosition* aPosition) {
|
|||
NS_IMETHODIMP
|
||||
nsGeolocationRequest::NotifyError(uint16_t aErrorCode) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
RefPtr<PositionError> positionError = new PositionError(mLocator, aErrorCode);
|
||||
RefPtr<GeolocationPositionError> positionError =
|
||||
new GeolocationPositionError(mLocator, aErrorCode);
|
||||
positionError->NotifyCallback(mErrorCallback);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -667,7 +669,7 @@ nsresult nsGeolocationService::StartDevice(nsIPrincipal* aPrincipal) {
|
|||
|
||||
if (NS_FAILED(rv = mProvider->Startup()) ||
|
||||
NS_FAILED(rv = mProvider->Watch(this))) {
|
||||
NotifyError(PositionError_Binding::POSITION_UNAVAILABLE);
|
||||
NotifyError(GeolocationPositionError_Binding::POSITION_UNAVAILABLE);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
#include "domstubs.idl"
|
||||
|
||||
webidl PositionError;
|
||||
webidl GeolocationPositionError;
|
||||
|
||||
[scriptable, function, uuid(7D9B09D9-4843-43EB-A7A7-67F7DDA6B3C4)]
|
||||
interface nsIDOMGeoPositionErrorCallback : nsISupports {
|
||||
void handleEvent(in PositionError positionError);
|
||||
void handleEvent(in GeolocationPositionError positionError);
|
||||
};
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
#include "mozilla/dom/Notification.h"
|
||||
#include "mozilla/dom/PContentPermissionRequestParent.h"
|
||||
#include "mozilla/dom/PCycleCollectWithLogsParent.h"
|
||||
#include "mozilla/dom/PositionError.h"
|
||||
#include "mozilla/dom/GeolocationPositionError.h"
|
||||
#include "mozilla/dom/ServiceWorkerRegistrar.h"
|
||||
#include "mozilla/dom/power/PowerManagerService.h"
|
||||
#include "mozilla/dom/Permissions.h"
|
||||
|
@ -4105,7 +4105,7 @@ ContentParent::HandleEvent(nsIDOMGeoPosition* postion) {
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ContentParent::HandleEvent(PositionError* positionError) {
|
||||
ContentParent::HandleEvent(GeolocationPositionError* positionError) {
|
||||
Unused << SendGeolocationError(positionError->Code());
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/LazyIdleThread.h"
|
||||
#include "mozilla/dom/PositionErrorBinding.h"
|
||||
#include "mozilla/dom/GeolocationPositionErrorBinding.h"
|
||||
#include "nsGeoPosition.h"
|
||||
#include "nsProxyRelease.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
@ -162,7 +162,7 @@ class GpsdLocationProvider::PollRunnable final : public Runnable {
|
|||
err = PollLoop5();
|
||||
break;
|
||||
default:
|
||||
err = PositionError_Binding::POSITION_UNAVAILABLE;
|
||||
err = GeolocationPositionError_Binding::POSITION_UNAVAILABLE;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -277,7 +277,7 @@ class GpsdLocationProvider::PollRunnable final : public Runnable {
|
|||
|
||||
return err;
|
||||
#else
|
||||
return PositionError_Binding::POSITION_UNAVAILABLE;
|
||||
return GeolocationPositionError_Binding::POSITION_UNAVAILABLE;
|
||||
#endif // GPSD_MAJOR_API_VERSION
|
||||
}
|
||||
|
||||
|
@ -288,13 +288,13 @@ class GpsdLocationProvider::PollRunnable final : public Runnable {
|
|||
case EPERM:
|
||||
MOZ_FALLTHROUGH;
|
||||
case EROFS:
|
||||
return PositionError_Binding::PERMISSION_DENIED;
|
||||
return GeolocationPositionError_Binding::PERMISSION_DENIED;
|
||||
case ETIME:
|
||||
MOZ_FALLTHROUGH;
|
||||
case ETIMEDOUT:
|
||||
return PositionError_Binding::TIMEOUT;
|
||||
return GeolocationPositionError_Binding::TIMEOUT;
|
||||
default:
|
||||
return PositionError_Binding::POSITION_UNAVAILABLE;
|
||||
return GeolocationPositionError_Binding::POSITION_UNAVAILABLE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "prtime.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/dom/PositionErrorBinding.h"
|
||||
#include "mozilla/dom/GeolocationPositionErrorBinding.h"
|
||||
#include "MLSFallback.h"
|
||||
|
||||
#include <CoreLocation/CLError.h>
|
||||
|
@ -62,7 +62,7 @@ static const CLLocationAccuracy kDEFAULT_ACCURACY = kCLLocationAccuracyNearestTe
|
|||
console->LogStringMessage(NS_ConvertUTF8toUTF16([message UTF8String]).get());
|
||||
|
||||
if ([aError code] == kCLErrorDenied) {
|
||||
mProvider->NotifyError(dom::PositionError_Binding::PERMISSION_DENIED);
|
||||
mProvider->NotifyError(dom::GeolocationPositionError_Binding::PERMISSION_DENIED);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/dom/PositionErrorBinding.h"
|
||||
#include "mozilla/dom/GeolocationPositionErrorBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -121,11 +121,11 @@ LocationEvent::OnStatusChanged(REFIID aReportType,
|
|||
uint16_t err;
|
||||
switch (aStatus) {
|
||||
case REPORT_ACCESS_DENIED:
|
||||
err = PositionError_Binding::PERMISSION_DENIED;
|
||||
err = GeolocationPositionError_Binding::PERMISSION_DENIED;
|
||||
break;
|
||||
case REPORT_NOT_SUPPORTED:
|
||||
case REPORT_ERROR:
|
||||
err = PositionError_Binding::POSITION_UNAVAILABLE;
|
||||
err = GeolocationPositionError_Binding::POSITION_UNAVAILABLE;
|
||||
break;
|
||||
default:
|
||||
return S_OK;
|
||||
|
|
|
@ -412,6 +412,14 @@ var interfaceNamesInGlobalScope = [
|
|||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{ name: "GamepadTouch", insecureContext: false, disabled: true },
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{ name: "Geolocation", insecureContext: true },
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{ name: "GeolocationCoordinates", insecureContext: false },
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{ name: "GeolocationPosition", insecureContext: false },
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{ name: "GeolocationPositionError", insecureContext: true },
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{ name: "HashChangeEvent", insecureContext: true },
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{ name: "Headers", insecureContext: true },
|
||||
|
|
|
@ -16,8 +16,7 @@ dictionary PositionOptions {
|
|||
[Clamp] unsigned long maximumAge = 0;
|
||||
};
|
||||
|
||||
[NoInterfaceObject,
|
||||
Exposed=Window]
|
||||
[Exposed=Window]
|
||||
interface Geolocation {
|
||||
[Throws, NeedsCallerType]
|
||||
void getCurrentPosition(PositionCallback successCallback,
|
||||
|
@ -32,6 +31,6 @@ interface Geolocation {
|
|||
void clearWatch(long watchId);
|
||||
};
|
||||
|
||||
callback PositionCallback = void (Position position);
|
||||
callback PositionCallback = void (GeolocationPosition position);
|
||||
|
||||
callback PositionErrorCallback = void (PositionError positionError);
|
||||
callback PositionErrorCallback = void (GeolocationPositionError positionError);
|
||||
|
|
|
@ -10,9 +10,8 @@
|
|||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
[NoInterfaceObject,
|
||||
Exposed=Window]
|
||||
interface Coordinates {
|
||||
[Exposed=Window, SecureContext]
|
||||
interface GeolocationCoordinates {
|
||||
readonly attribute double latitude;
|
||||
readonly attribute double longitude;
|
||||
readonly attribute double? altitude;
|
|
@ -10,9 +10,8 @@
|
|||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
[NoInterfaceObject,
|
||||
Exposed=Window]
|
||||
interface Position {
|
||||
readonly attribute Coordinates coords;
|
||||
[Exposed=Window, SecureContext]
|
||||
interface GeolocationPosition {
|
||||
readonly attribute GeolocationCoordinates coords;
|
||||
readonly attribute DOMTimeStamp timestamp;
|
||||
};
|
|
@ -10,9 +10,8 @@
|
|||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
[NoInterfaceObject,
|
||||
Exposed=Window]
|
||||
interface PositionError {
|
||||
[Exposed=Window]
|
||||
interface GeolocationPositionError {
|
||||
const unsigned short PERMISSION_DENIED = 1;
|
||||
const unsigned short POSITION_UNAVAILABLE = 2;
|
||||
const unsigned short TIMEOUT = 3;
|
|
@ -70,7 +70,7 @@ with Files("ConstantSourceNode.webidl"):
|
|||
with Files("ConvolverNode.webidl"):
|
||||
BUG_COMPONENT = ("Core", "Web Audio")
|
||||
|
||||
with Files("Coordinates.webidl"):
|
||||
with Files("GeolocationCoordinates.webidl"):
|
||||
BUG_COMPONENT = ("Core", "DOM: Geolocation")
|
||||
|
||||
with Files("Crypto.webidl"):
|
||||
|
@ -241,7 +241,7 @@ with Files("PointerEvent.webidl"):
|
|||
with Files("PopStateEvent.webidl*"):
|
||||
BUG_COMPONENT = ("Core", "DOM: Events")
|
||||
|
||||
with Files("Position*"):
|
||||
with Files("GeolocationPosition*"):
|
||||
BUG_COMPONENT = ("Core", "DOM: Geolocation")
|
||||
|
||||
with Files("ProfileTimelineMarker.webidl"):
|
||||
|
@ -428,7 +428,6 @@ WEBIDL_FILES = [
|
|||
'Console.webidl',
|
||||
'ConstantSourceNode.webidl',
|
||||
'ConvolverNode.webidl',
|
||||
'Coordinates.webidl',
|
||||
'CreateOfferRequest.webidl',
|
||||
'CredentialManagement.webidl',
|
||||
'Crypto.webidl',
|
||||
|
@ -523,6 +522,9 @@ WEBIDL_FILES = [
|
|||
'GamepadServiceTest.webidl',
|
||||
'GamepadTouch.webidl',
|
||||
'Geolocation.webidl',
|
||||
'GeolocationCoordinates.webidl',
|
||||
'GeolocationPosition.webidl',
|
||||
'GeolocationPositionError.webidl',
|
||||
'GeometryUtils.webidl',
|
||||
'GetUserMediaRequest.webidl',
|
||||
'Grid.webidl',
|
||||
|
@ -730,8 +732,6 @@ WEBIDL_FILES = [
|
|||
'Plugin.webidl',
|
||||
'PluginArray.webidl',
|
||||
'PointerEvent.webidl',
|
||||
'Position.webidl',
|
||||
'PositionError.webidl',
|
||||
'Presentation.webidl',
|
||||
'PresentationAvailability.webidl',
|
||||
'PresentationConnection.webidl',
|
||||
|
|
|
@ -14,5 +14,4 @@
|
|||
TIMEOUT
|
||||
|
||||
[GeolocationPositionError toString]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,136 +1,91 @@
|
|||
[idlharness.https.window.html]
|
||||
[GeolocationPositionError interface: constant PERMISSION_DENIED on interface object]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationPositionError interface: existence and properties of interface prototype object's @@unscopables property]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationPositionError interface: existence and properties of interface prototype object's "constructor" property]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationCoordinates interface: attribute accuracy]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationCoordinates interface: attribute latitude]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationCoordinates interface: attribute heading]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationCoordinates interface object name]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationPositionError interface object length]
|
||||
expected: FAIL
|
||||
|
||||
[Geolocation interface: existence and properties of interface prototype object]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationPositionError interface: constant PERMISSION_DENIED on interface prototype object]
|
||||
expected: FAIL
|
||||
|
||||
[Geolocation interface: existence and properties of interface prototype object's @@unscopables property]
|
||||
expected: FAIL
|
||||
|
||||
[Geolocation interface: existence and properties of interface object]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationPositionError interface: constant POSITION_UNAVAILABLE on interface object]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationPositionError interface object name]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationPositionError interface: constant TIMEOUT on interface prototype object]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationPositionError interface: attribute message]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationPosition interface object name]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationPosition interface: existence and properties of interface object]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationPositionError interface: constant POSITION_UNAVAILABLE on interface prototype object]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationCoordinates interface: existence and properties of interface prototype object's "constructor" property]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationCoordinates interface object length]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationCoordinates interface: attribute altitudeAccuracy]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationPosition interface: existence and properties of interface prototype object's @@unscopables property]
|
||||
expected: FAIL
|
||||
|
||||
[Geolocation must be primary interface of navigator.geolocation]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationCoordinates interface: attribute altitude]
|
||||
expected: FAIL
|
||||
|
||||
[Geolocation interface: existence and properties of interface prototype object's "constructor" property]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationCoordinates interface: attribute speed]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationPositionError interface: existence and properties of interface prototype object]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationCoordinates interface: existence and properties of interface object]
|
||||
expected: FAIL
|
||||
|
||||
[Geolocation interface: operation watchPosition(PositionCallback, PositionErrorCallback, PositionOptions)]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationPosition interface: attribute coords]
|
||||
expected: FAIL
|
||||
|
||||
[Geolocation interface: operation clearWatch(long)]
|
||||
expected: FAIL
|
||||
|
||||
[Geolocation interface object length]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationCoordinates interface: attribute longitude]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationCoordinates interface: existence and properties of interface prototype object]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationCoordinates interface: existence and properties of interface prototype object's @@unscopables property]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationPosition interface: existence and properties of interface prototype object]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationPositionError interface: constant TIMEOUT on interface object]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationPositionError interface: attribute code]
|
||||
expected: FAIL
|
||||
|
||||
[Geolocation interface: operation getCurrentPosition(PositionCallback, PositionErrorCallback, PositionOptions)]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationPosition interface: attribute timestamp]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationPosition interface object length]
|
||||
expected: FAIL
|
||||
|
||||
[Geolocation interface object name]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationPositionError interface: existence and properties of interface object]
|
||||
expected: FAIL
|
||||
|
||||
[GeolocationPosition interface: existence and properties of interface prototype object's "constructor" property]
|
||||
expected: FAIL
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче