mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge mozilla-central to mozilla-inbound
This commit is contained in:
commit
1f6dd08a24
@ -2005,14 +2005,20 @@ ContentParent::RecvAddGeolocationListener(const IPC::Principal& aPrincipal)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (mGeolocationWatchID == -1) {
|
// To ensure no geolocation updates are skipped, we always force the
|
||||||
nsCOMPtr<nsIDOMGeoGeolocation> geo = do_GetService("@mozilla.org/geolocation;1");
|
// creation of a new listener.
|
||||||
if (!geo) {
|
RecvRemoveGeolocationListener();
|
||||||
return true;
|
|
||||||
}
|
nsCOMPtr<nsIDOMGeoGeolocation> geo = do_GetService("@mozilla.org/geolocation;1");
|
||||||
jsval dummy = JSVAL_VOID;
|
if (!geo) {
|
||||||
geo->WatchPosition(this, nullptr, dummy, nullptr, &mGeolocationWatchID);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsRefPtr<nsGeolocation> geosvc = static_cast<nsGeolocation*>(geo.get());
|
||||||
|
nsAutoPtr<mozilla::dom::GeoPositionOptions> options(new mozilla::dom::GeoPositionOptions());
|
||||||
|
jsval null = JS::NullValue();
|
||||||
|
options->Init(nullptr, &null);
|
||||||
|
geosvc->WatchPosition(this, nullptr, options.forget(), &mGeolocationWatchID);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ PluginHangUIParent::Init(const nsString& aPluginName)
|
|||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
rv = mMiniShm.Init(this, ::IsDebuggerPresent() ? INFINITE : kTimeout);
|
rv = mMiniShm.Init(this, ::IsDebuggerPresent() ? INFINITE : kTimeout);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, false);
|
||||||
nsCOMPtr<nsIProperties>
|
nsCOMPtr<nsIProperties>
|
||||||
directoryService(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID));
|
directoryService(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID));
|
||||||
if (!directoryService) {
|
if (!directoryService) {
|
||||||
|
@ -9,15 +9,14 @@
|
|||||||
#include "nsGeoPosition.h"
|
#include "nsGeoPosition.h"
|
||||||
#include "nsIDOMGeoPosition.h"
|
#include "nsIDOMGeoPosition.h"
|
||||||
|
|
||||||
typedef nsGeoPositionCoords *GeoPositionCoords;
|
typedef nsIDOMGeoPosition* GeoPosition;
|
||||||
typedef nsIDOMGeoPosition *GeoPosition;
|
|
||||||
|
|
||||||
namespace IPC {
|
namespace IPC {
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ParamTraits<GeoPositionCoords>
|
struct ParamTraits<nsIDOMGeoPositionCoords*>
|
||||||
{
|
{
|
||||||
typedef GeoPositionCoords paramType;
|
typedef nsIDOMGeoPositionCoords* paramType;
|
||||||
|
|
||||||
// Function to serialize a geoposition
|
// Function to serialize a geoposition
|
||||||
static void Write(Message *aMsg, const paramType& aParam)
|
static void Write(Message *aMsg, const paramType& aParam)
|
||||||
@ -96,9 +95,9 @@ struct ParamTraits<GeoPositionCoords>
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ParamTraits<GeoPosition>
|
struct ParamTraits<nsIDOMGeoPosition*>
|
||||||
{
|
{
|
||||||
typedef GeoPosition paramType;
|
typedef nsIDOMGeoPosition* paramType;
|
||||||
|
|
||||||
// Function to serialize a geoposition
|
// Function to serialize a geoposition
|
||||||
static void Write(Message *aMsg, const paramType& aParam)
|
static void Write(Message *aMsg, const paramType& aParam)
|
||||||
@ -114,8 +113,7 @@ struct ParamTraits<GeoPosition>
|
|||||||
|
|
||||||
nsCOMPtr<nsIDOMGeoPositionCoords> coords;
|
nsCOMPtr<nsIDOMGeoPositionCoords> coords;
|
||||||
aParam->GetCoords(getter_AddRefs(coords));
|
aParam->GetCoords(getter_AddRefs(coords));
|
||||||
GeoPositionCoords simpleCoords = static_cast<GeoPositionCoords>(coords.get());
|
WriteParam(aMsg, coords.get());
|
||||||
WriteParam(aMsg, simpleCoords);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to de-serialize a geoposition
|
// Function to de-serialize a geoposition
|
||||||
@ -131,16 +129,14 @@ struct ParamTraits<GeoPosition>
|
|||||||
}
|
}
|
||||||
|
|
||||||
DOMTimeStamp timeStamp;
|
DOMTimeStamp timeStamp;
|
||||||
GeoPositionCoords coords = nullptr;
|
nsIDOMGeoPositionCoords* coords = nullptr;
|
||||||
|
|
||||||
// It's not important to us where it fails, but rather if it fails
|
// It's not important to us where it fails, but rather if it fails
|
||||||
if (!( ReadParam(aMsg, aIter, &timeStamp)
|
if (!ReadParam(aMsg, aIter, &timeStamp) ||
|
||||||
&& ReadParam(aMsg, aIter, &coords ))) {
|
!ReadParam(aMsg, aIter, &coords)) {
|
||||||
// note it is fine to do "delete nullptr" in case coords hasn't
|
nsCOMPtr<nsIDOMGeoPositionCoords> tmpcoords = coords;
|
||||||
// been allocated
|
return false;
|
||||||
delete coords;
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
*aResult = new nsGeoPosition(coords, timeStamp);
|
*aResult = new nsGeoPosition(coords, timeStamp);
|
||||||
|
|
||||||
|
@ -285,6 +285,7 @@ nsDOMGeoPositionError::NotifyCallback(nsIDOMGeoPositionErrorCallback* aCallback)
|
|||||||
nsGeolocationRequest::nsGeolocationRequest(nsGeolocation* aLocator,
|
nsGeolocationRequest::nsGeolocationRequest(nsGeolocation* aLocator,
|
||||||
nsIDOMGeoPositionCallback* aCallback,
|
nsIDOMGeoPositionCallback* aCallback,
|
||||||
nsIDOMGeoPositionErrorCallback* aErrorCallback,
|
nsIDOMGeoPositionErrorCallback* aErrorCallback,
|
||||||
|
mozilla::dom::GeoPositionOptions* aOptions,
|
||||||
bool aWatchPositionRequest,
|
bool aWatchPositionRequest,
|
||||||
int32_t aWatchId)
|
int32_t aWatchId)
|
||||||
: mAllowed(false),
|
: mAllowed(false),
|
||||||
@ -293,6 +294,7 @@ nsGeolocationRequest::nsGeolocationRequest(nsGeolocation* aLocator,
|
|||||||
mIsWatchPositionRequest(aWatchPositionRequest),
|
mIsWatchPositionRequest(aWatchPositionRequest),
|
||||||
mCallback(aCallback),
|
mCallback(aCallback),
|
||||||
mErrorCallback(aErrorCallback),
|
mErrorCallback(aErrorCallback),
|
||||||
|
mOptions(aOptions),
|
||||||
mLocator(aLocator),
|
mLocator(aLocator),
|
||||||
mWatchId(aWatchId)
|
mWatchId(aWatchId)
|
||||||
{
|
{
|
||||||
@ -302,15 +304,21 @@ nsGeolocationRequest::~nsGeolocationRequest()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsGeolocationRequest::Init(JSContext* aCx, const jsval& aOptions)
|
static mozilla::dom::GeoPositionOptions*
|
||||||
|
OptionsFromJSOptions(JSContext* aCx, const jsval& aOptions, nsresult* aRv)
|
||||||
{
|
{
|
||||||
|
*aRv = NS_OK;
|
||||||
|
nsAutoPtr<mozilla::dom::GeoPositionOptions> options(nullptr);
|
||||||
if (aCx && !JSVAL_IS_VOID(aOptions) && !JSVAL_IS_NULL(aOptions)) {
|
if (aCx && !JSVAL_IS_VOID(aOptions) && !JSVAL_IS_NULL(aOptions)) {
|
||||||
mOptions = new mozilla::dom::GeoPositionOptions();
|
options = new mozilla::dom::GeoPositionOptions();
|
||||||
nsresult rv = mOptions->Init(aCx, &aOptions);
|
nsresult rv = options->Init(aCx, &aOptions);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
if (NS_FAILED(rv)) {
|
||||||
|
*aRv = rv;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return options.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGeolocationRequest)
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGeolocationRequest)
|
||||||
@ -865,10 +873,6 @@ nsGeolocationService::IsBetterPosition(nsIDOMGeoPosition *aSomewhere)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mProviders.Count() == 1 || !mLastPosition) {
|
if (mProviders.Count() == 1 || !mLastPosition) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1242,8 +1246,20 @@ nsGeolocation::Update(nsIDOMGeoPosition *aSomewhere, bool aIsBetter)
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsGeolocation::GetCurrentPosition(nsIDOMGeoPositionCallback *callback,
|
nsGeolocation::GetCurrentPosition(nsIDOMGeoPositionCallback *callback,
|
||||||
nsIDOMGeoPositionErrorCallback *errorCallback,
|
nsIDOMGeoPositionErrorCallback *errorCallback,
|
||||||
const jsval& options,
|
const jsval& jsoptions,
|
||||||
JSContext* cx)
|
JSContext* cx)
|
||||||
|
{
|
||||||
|
nsresult rv;
|
||||||
|
nsAutoPtr<mozilla::dom::GeoPositionOptions> options(
|
||||||
|
OptionsFromJSOptions(cx, jsoptions, &rv));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
return GetCurrentPosition(callback, errorCallback, options.forget());
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsGeolocation::GetCurrentPosition(nsIDOMGeoPositionCallback *callback,
|
||||||
|
nsIDOMGeoPositionErrorCallback *errorCallback,
|
||||||
|
mozilla::dom::GeoPositionOptions *options)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(callback);
|
NS_ENSURE_ARG_POINTER(callback);
|
||||||
|
|
||||||
@ -1254,13 +1270,8 @@ nsGeolocation::GetCurrentPosition(nsIDOMGeoPositionCallback *callback,
|
|||||||
nsRefPtr<nsGeolocationRequest> request = new nsGeolocationRequest(this,
|
nsRefPtr<nsGeolocationRequest> request = new nsGeolocationRequest(this,
|
||||||
callback,
|
callback,
|
||||||
errorCallback,
|
errorCallback,
|
||||||
|
options,
|
||||||
false);
|
false);
|
||||||
if (!request) {
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult rv = request->Init(cx, options);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
if (!sGeoEnabled) {
|
if (!sGeoEnabled) {
|
||||||
nsCOMPtr<nsIRunnable> ev = new RequestAllowEvent(false, request);
|
nsCOMPtr<nsIRunnable> ev = new RequestAllowEvent(false, request);
|
||||||
@ -1307,9 +1318,22 @@ nsGeolocation::GetCurrentPositionReady(nsGeolocationRequest* aRequest)
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsGeolocation::WatchPosition(nsIDOMGeoPositionCallback *callback,
|
nsGeolocation::WatchPosition(nsIDOMGeoPositionCallback *callback,
|
||||||
nsIDOMGeoPositionErrorCallback *errorCallback,
|
nsIDOMGeoPositionErrorCallback *errorCallback,
|
||||||
const jsval& options,
|
const jsval& jsoptions,
|
||||||
JSContext* cx,
|
JSContext* cx,
|
||||||
int32_t *_retval)
|
int32_t *_retval)
|
||||||
|
{
|
||||||
|
nsresult rv;
|
||||||
|
nsAutoPtr<mozilla::dom::GeoPositionOptions> options(
|
||||||
|
OptionsFromJSOptions(cx, jsoptions, &rv));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
return WatchPosition(callback, errorCallback, options.forget(), _retval);
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsGeolocation::WatchPosition(nsIDOMGeoPositionCallback *callback,
|
||||||
|
nsIDOMGeoPositionErrorCallback *errorCallback,
|
||||||
|
mozilla::dom::GeoPositionOptions *options,
|
||||||
|
int32_t *_retval)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(callback);
|
NS_ENSURE_ARG_POINTER(callback);
|
||||||
|
|
||||||
@ -1323,14 +1347,9 @@ nsGeolocation::WatchPosition(nsIDOMGeoPositionCallback *callback,
|
|||||||
nsRefPtr<nsGeolocationRequest> request = new nsGeolocationRequest(this,
|
nsRefPtr<nsGeolocationRequest> request = new nsGeolocationRequest(this,
|
||||||
callback,
|
callback,
|
||||||
errorCallback,
|
errorCallback,
|
||||||
|
options,
|
||||||
true,
|
true,
|
||||||
*_retval);
|
*_retval);
|
||||||
if (!request) {
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult rv = request->Init(cx, options);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
if (!sGeoEnabled) {
|
if (!sGeoEnabled) {
|
||||||
nsCOMPtr<nsIRunnable> ev = new RequestAllowEvent(false, request);
|
nsCOMPtr<nsIRunnable> ev = new RequestAllowEvent(false, request);
|
||||||
|
@ -53,9 +53,9 @@ class nsGeolocationRequest
|
|||||||
nsGeolocationRequest(nsGeolocation* locator,
|
nsGeolocationRequest(nsGeolocation* locator,
|
||||||
nsIDOMGeoPositionCallback* callback,
|
nsIDOMGeoPositionCallback* callback,
|
||||||
nsIDOMGeoPositionErrorCallback* errorCallback,
|
nsIDOMGeoPositionErrorCallback* errorCallback,
|
||||||
|
mozilla::dom::GeoPositionOptions* aOptions,
|
||||||
bool watchPositionRequest = false,
|
bool watchPositionRequest = false,
|
||||||
int32_t watchId = 0);
|
int32_t watchId = 0);
|
||||||
nsresult Init(JSContext* aCx, const jsval& aOptions);
|
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
// Called by the geolocation device to notify that a location has changed.
|
// Called by the geolocation device to notify that a location has changed.
|
||||||
@ -75,7 +75,6 @@ class nsGeolocationRequest
|
|||||||
void IPDLRelease() { Release(); }
|
void IPDLRelease() { Release(); }
|
||||||
|
|
||||||
int32_t WatchId() { return mWatchId; }
|
int32_t WatchId() { return mWatchId; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void NotifyError(int16_t errorCode);
|
void NotifyError(int16_t errorCode);
|
||||||
@ -202,6 +201,14 @@ public:
|
|||||||
// Notification from the service:
|
// Notification from the service:
|
||||||
void ServiceReady();
|
void ServiceReady();
|
||||||
|
|
||||||
|
// Versions of the DOM APIs that don't require JS option values
|
||||||
|
nsresult WatchPosition(nsIDOMGeoPositionCallback *callback,
|
||||||
|
nsIDOMGeoPositionErrorCallback *errorCallback,
|
||||||
|
mozilla::dom::GeoPositionOptions *options,
|
||||||
|
int32_t *_retval);
|
||||||
|
nsresult GetCurrentPosition(nsIDOMGeoPositionCallback *callback,
|
||||||
|
nsIDOMGeoPositionErrorCallback *errorCallback,
|
||||||
|
mozilla::dom::GeoPositionOptions *options);
|
||||||
private:
|
private:
|
||||||
|
|
||||||
~nsGeolocation();
|
~nsGeolocation();
|
||||||
|
@ -15,7 +15,7 @@ const Cc = Components.classes;
|
|||||||
|
|
||||||
let gLoggingEnabled = false;
|
let gLoggingEnabled = false;
|
||||||
let gTestingEnabled = false;
|
let gTestingEnabled = false;
|
||||||
let gDesist = false;
|
let gUseScanning = true;
|
||||||
|
|
||||||
let gPrivateAccessToken = '';
|
let gPrivateAccessToken = '';
|
||||||
let gPrivateAccessTime = 0;
|
let gPrivateAccessTime = 0;
|
||||||
@ -76,6 +76,10 @@ function WifiGeoPositionProvider() {
|
|||||||
gTestingEnabled = Services.prefs.getBoolPref("geo.wifi.testing");
|
gTestingEnabled = Services.prefs.getBoolPref("geo.wifi.testing");
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
|
try {
|
||||||
|
gUseScanning = Services.prefs.getBoolPref("geo.wifi.scan");
|
||||||
|
} catch (e) {}
|
||||||
|
|
||||||
this.wifiService = null;
|
this.wifiService = null;
|
||||||
this.timer = null;
|
this.timer = null;
|
||||||
this.hasSeenWiFi = false;
|
this.hasSeenWiFi = false;
|
||||||
@ -111,20 +115,20 @@ WifiGeoPositionProvider.prototype = {
|
|||||||
watch: function(c, requestPrivate) {
|
watch: function(c, requestPrivate) {
|
||||||
LOG("watch called");
|
LOG("watch called");
|
||||||
|
|
||||||
let useScanning = true;
|
if (!this.wifiService && gUseScanning) {
|
||||||
try {
|
|
||||||
useScanning = Services.prefs.getBoolPref("geo.wifi.scan");
|
|
||||||
} catch (e) {}
|
|
||||||
|
|
||||||
if (!this.wifiService && useScanning) {
|
|
||||||
this.wifiService = Cc["@mozilla.org/wifi/monitor;1"].getService(Components.interfaces.nsIWifiMonitor);
|
this.wifiService = Cc["@mozilla.org/wifi/monitor;1"].getService(Components.interfaces.nsIWifiMonitor);
|
||||||
this.wifiService.startWatching(this);
|
this.wifiService.startWatching(this);
|
||||||
this.lastRequestPrivate = requestPrivate;
|
this.lastRequestPrivate = requestPrivate;
|
||||||
}
|
}
|
||||||
if (this.hasSeenWiFi) {
|
if (this.hasSeenWiFi) {
|
||||||
this.hasSeenWiFi = false;
|
this.hasSeenWiFi = false;
|
||||||
this.wifiService.stopWatching(this);
|
if (gUseScanning) {
|
||||||
this.wifiService.startWatching(this);
|
this.wifiService.stopWatching(this);
|
||||||
|
this.wifiService.startWatching(this);
|
||||||
|
} else {
|
||||||
|
// For testing situations, ensure that we always trigger an update.
|
||||||
|
this.timer.initWithCallback(this, 5000, this.timer.TYPE_ONE_SHOT);
|
||||||
|
}
|
||||||
this.lastRequestPrivate = requestPrivate;
|
this.lastRequestPrivate = requestPrivate;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -314,7 +318,7 @@ WifiGeoPositionProvider.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
notify: function (timer) {
|
notify: function (timer) {
|
||||||
if (gTestingEnabled) {
|
if (gTestingEnabled || !gUseScanning) {
|
||||||
// if we are testing, timer is repeating
|
// if we are testing, timer is repeating
|
||||||
this.onChange(null);
|
this.onChange(null);
|
||||||
}
|
}
|
||||||
|
70
dom/tests/unit/test_multiple_geo_listeners.js
Normal file
70
dom/tests/unit/test_multiple_geo_listeners.js
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
const Cc = Components.classes;
|
||||||
|
const Ci = Components.interfaces;
|
||||||
|
const Cu = Components.utils;
|
||||||
|
const Cr = Components.results;
|
||||||
|
|
||||||
|
Cu.import("resource://testing-common/httpd.js");
|
||||||
|
|
||||||
|
var httpserver = null;
|
||||||
|
var geolocation = null;
|
||||||
|
var success = false;
|
||||||
|
var watchId = -1;
|
||||||
|
|
||||||
|
let gAccuracy = 42;
|
||||||
|
function geoHandler(metadata, response)
|
||||||
|
{
|
||||||
|
var georesponse = {
|
||||||
|
status: "OK",
|
||||||
|
location: {
|
||||||
|
lat: 0.45,
|
||||||
|
lng: 0.45,
|
||||||
|
},
|
||||||
|
accuracy: gAccuracy,
|
||||||
|
};
|
||||||
|
var position = JSON.stringify(georesponse);
|
||||||
|
response.setStatusLine("1.0", 200, "OK");
|
||||||
|
response.setHeader("Cache-Control", "no-cache", false);
|
||||||
|
response.setHeader("Content-Type", "aplication/x-javascript", false);
|
||||||
|
response.write(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
function errorCallback() {
|
||||||
|
do_check_true(false);
|
||||||
|
do_test_finished();
|
||||||
|
}
|
||||||
|
|
||||||
|
function run_test()
|
||||||
|
{
|
||||||
|
do_test_pending();
|
||||||
|
|
||||||
|
httpserver = new HttpServer();
|
||||||
|
httpserver.registerPathHandler("/geo", geoHandler);
|
||||||
|
httpserver.start(4444);
|
||||||
|
|
||||||
|
if (Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime)
|
||||||
|
.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
|
||||||
|
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
||||||
|
prefs.setBoolPref("geo.wifi.scan", false);
|
||||||
|
prefs.setCharPref("geo.wifi.uri", "http://localhost:4444/geo");
|
||||||
|
prefs.setBoolPref("geo.testing.ignore_ipc_principal", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
let timesCalled = 0;
|
||||||
|
geolocation = Cc["@mozilla.org/geolocation;1"].createInstance(Ci.nsIDOMGeoGeolocation);
|
||||||
|
geolocation.watchPosition(function(pos) {
|
||||||
|
do_check_eq(++timesCalled, 1);
|
||||||
|
do_check_eq(pos.coords.accuracy, gAccuracy);
|
||||||
|
|
||||||
|
gAccuracy = 420;
|
||||||
|
geolocation2 = Cc["@mozilla.org/geolocation;1"].createInstance(Ci.nsIDOMGeoGeolocation);
|
||||||
|
geolocation2.getCurrentPosition(function(pos) {
|
||||||
|
do_check_eq(pos.coords.accuracy, gAccuracy);
|
||||||
|
|
||||||
|
gAccuracy = 400;
|
||||||
|
geolocation2.getCurrentPosition(function(pos) {
|
||||||
|
do_check_eq(pos.coords.accuracy, 42);
|
||||||
|
do_test_finished();
|
||||||
|
}, errorCallback);
|
||||||
|
}, errorCallback, {maximumAge: 0});
|
||||||
|
}, errorCallback, {maximumAge: 0});
|
||||||
|
}
|
10
dom/tests/unit/test_multiple_geo_listeners_wrap.js
Normal file
10
dom/tests/unit/test_multiple_geo_listeners_wrap.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
const Cc = Components.classes;
|
||||||
|
const Ci = Components.interfaces;
|
||||||
|
|
||||||
|
function run_test() {
|
||||||
|
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
||||||
|
prefs.setBoolPref("geo.wifi.scan", false);
|
||||||
|
prefs.setCharPref("geo.wifi.uri", "http://localhost:4444/geo");
|
||||||
|
prefs.setBoolPref("geo.testing.ignore_ipc_principal", true);
|
||||||
|
run_test_in_child("test_multiple_geo_listeners.js");
|
||||||
|
}
|
@ -5,8 +5,11 @@ tail =
|
|||||||
[test_bug319968.js]
|
[test_bug319968.js]
|
||||||
[test_bug465752.js]
|
[test_bug465752.js]
|
||||||
[test_geolocation_provider.js]
|
[test_geolocation_provider.js]
|
||||||
|
# Bug 684962: test hangs consistently on Android
|
||||||
|
skip-if = os == "android"
|
||||||
[test_geolocation_timeout.js]
|
[test_geolocation_timeout.js]
|
||||||
[test_geolocation_timeout_wrap.js]
|
[test_geolocation_timeout_wrap.js]
|
||||||
skip-if = os == "mac"
|
skip-if = os == "mac"
|
||||||
# Bug 684962: test hangs consistently on Android
|
[test_multiple_geo_listeners.js]
|
||||||
skip-if = os == "android"
|
[test_multiple_geo_listeners_wrap.js]
|
||||||
|
skip-if = os == "mac"
|
||||||
|
@ -6,3 +6,4 @@ tail =
|
|||||||
[test_metrics_provider.js]
|
[test_metrics_provider.js]
|
||||||
[test_metrics_collector.js]
|
[test_metrics_collector.js]
|
||||||
[test_metrics_storage.js]
|
[test_metrics_storage.js]
|
||||||
|
skip-if = os == "linux" && debug && bits == 32
|
||||||
|
Loading…
Reference in New Issue
Block a user