mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Doug Turner Bug 599591 - Geolocation provider not turned off when navigating away from site. r=jdm a=blocking-fennec
Backed out changeset faf497893b28
This commit is contained in:
parent
5bb521c898
commit
ae10e27921
@ -512,27 +512,22 @@ ContentParent::RecvAsyncMessage(const nsString& aMsg, const nsString& aJSON)
|
|||||||
bool
|
bool
|
||||||
ContentParent::RecvGeolocationStart()
|
ContentParent::RecvGeolocationStart()
|
||||||
{
|
{
|
||||||
if (mGeolocationWatchID == -1) {
|
nsCOMPtr<nsIDOMGeoGeolocation> geo = do_GetService("@mozilla.org/geolocation;1");
|
||||||
nsCOMPtr<nsIDOMGeoGeolocation> geo = do_GetService("@mozilla.org/geolocation;1");
|
if (!geo) {
|
||||||
if (!geo) {
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
geo->WatchPosition(this, nsnull, nsnull, &mGeolocationWatchID);
|
|
||||||
}
|
}
|
||||||
|
geo->WatchPosition(this, nsnull, nsnull, &mGeolocationWatchID);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ContentParent::RecvGeolocationStop()
|
ContentParent::RecvGeolocationStop()
|
||||||
{
|
{
|
||||||
if (mGeolocationWatchID != -1) {
|
nsCOMPtr<nsIDOMGeoGeolocation> geo = do_GetService("@mozilla.org/geolocation;1");
|
||||||
nsCOMPtr<nsIDOMGeoGeolocation> geo = do_GetService("@mozilla.org/geolocation;1");
|
if (!geo) {
|
||||||
if (!geo) {
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
geo->ClearWatch(mGeolocationWatchID);
|
|
||||||
mGeolocationWatchID = -1;
|
|
||||||
}
|
}
|
||||||
|
geo->ClearWatch(mGeolocationWatchID);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -741,11 +741,6 @@ nsGeolocationService::StartDevice()
|
|||||||
if (!sGeoEnabled)
|
if (!sGeoEnabled)
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
return NS_ERROR_NOT_AVAILABLE;
|
||||||
|
|
||||||
// we do not want to keep the geolocation devices online
|
|
||||||
// indefinitely. Close them down after a reasonable period of
|
|
||||||
// inactivivity
|
|
||||||
SetDisconnectTimer();
|
|
||||||
|
|
||||||
#ifdef MOZ_IPC
|
#ifdef MOZ_IPC
|
||||||
if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
||||||
ContentChild* cpc = ContentChild::GetSingleton();
|
ContentChild* cpc = ContentChild::GetSingleton();
|
||||||
@ -755,18 +750,26 @@ nsGeolocationService::StartDevice()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Start them up!
|
// Start them up!
|
||||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
nsresult rv = NS_ERROR_NOT_AVAILABLE;
|
||||||
if (!obs)
|
for (PRUint32 i = mProviders.Count() - 1; i != PRUint32(-1); --i) {
|
||||||
return NS_ERROR_FAILURE;
|
// If any provder gets started without error, go ahead
|
||||||
|
// and proceed without error
|
||||||
|
nsresult temp = mProviders[i]->Startup();
|
||||||
|
if (NS_SUCCEEDED(temp)) {
|
||||||
|
rv = NS_OK;
|
||||||
|
|
||||||
for (PRUint32 i = 0; i < mProviders.Count(); i++) {
|
mProviders[i]->Watch(this);
|
||||||
mProviders[i]->Startup();
|
}
|
||||||
mProviders[i]->Watch(this);
|
|
||||||
obs->NotifyObservers(mProviders[i],
|
|
||||||
"geolocation-device-events",
|
|
||||||
NS_LITERAL_STRING("starting").get());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return NS_ERROR_NOT_AVAILABLE;
|
||||||
|
|
||||||
|
// we do not want to keep the geolocation devices online
|
||||||
|
// indefinitely. Close them down after a reasonable period of
|
||||||
|
// inactivivity
|
||||||
|
SetDisconnectTimer();
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -799,15 +802,8 @@ nsGeolocationService::StopDevice()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
for (PRUint32 i = mProviders.Count() - 1; i != PRUint32(-1); --i) {
|
||||||
if (!obs)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (PRUint32 i = 0; i <mProviders.Count(); i++) {
|
|
||||||
mProviders[i]->Shutdown();
|
mProviders[i]->Shutdown();
|
||||||
obs->NotifyObservers(mProviders[i],
|
|
||||||
"geolocation-device-events",
|
|
||||||
NS_LITERAL_STRING("shutdown").get());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -948,11 +944,7 @@ nsGeolocation::Shutdown()
|
|||||||
PRBool
|
PRBool
|
||||||
nsGeolocation::HasActiveCallbacks()
|
nsGeolocation::HasActiveCallbacks()
|
||||||
{
|
{
|
||||||
for (PRUint32 i = 0; i < mWatchingCallbacks.Length(); i++)
|
return mWatchingCallbacks.Length() != 0;
|
||||||
if (mWatchingCallbacks[i]->IsActive())
|
|
||||||
return PR_TRUE;
|
|
||||||
|
|
||||||
return PR_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -97,7 +97,6 @@ class nsGeolocationRequest
|
|||||||
|
|
||||||
void SendLocation(nsIDOMGeoPosition* location);
|
void SendLocation(nsIDOMGeoPosition* location);
|
||||||
void MarkCleared();
|
void MarkCleared();
|
||||||
PRBool IsActive() {return !mCleared;}
|
|
||||||
PRBool Allowed() {return mAllowed;}
|
PRBool Allowed() {return mAllowed;}
|
||||||
void SetTimeoutTimer();
|
void SetTimeoutTimer();
|
||||||
|
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
|
|
||||||
const Ci = Components.interfaces;
|
|
||||||
const Cc = Components.classes;
|
|
||||||
|
|
||||||
function successCallback(pos){}
|
|
||||||
|
|
||||||
var observer = {
|
|
||||||
QueryInterface: function(iid) {
|
|
||||||
if (iid.equals(Components.interfaces.nsISupports) ||
|
|
||||||
iid.equals(Components.interfaces.nsIObserver))
|
|
||||||
return this;
|
|
||||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
|
||||||
},
|
|
||||||
|
|
||||||
observe: function(subject, topic, data) {
|
|
||||||
if (data == "shutdown") {
|
|
||||||
do_check_true(1)
|
|
||||||
do_test_finished();
|
|
||||||
}
|
|
||||||
else if (data == "starting") {
|
|
||||||
do_check_true(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
function run_test()
|
|
||||||
{
|
|
||||||
// only kill this test when shutdown is called on the provider.
|
|
||||||
do_test_pending();
|
|
||||||
|
|
||||||
var obs = Cc["@mozilla.org/observer-service;1"].getService();
|
|
||||||
obs = obs.QueryInterface(Ci.nsIObserverService);
|
|
||||||
obs.addObserver(observer, "geolocation-device-events", false);
|
|
||||||
|
|
||||||
var geolocation = Cc["@mozilla.org/geolocation;1"].getService(Ci.nsIDOMGeoGeolocation);
|
|
||||||
var watchID = geolocation.watchPosition(successCallback);
|
|
||||||
do_timeout(1000, function() { geolocation.clearWatch(watchID);})
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user