mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 7c45205a61a0 (bug 769285)
This commit is contained in:
parent
6f2ad73722
commit
0541a0bcc3
@ -444,6 +444,10 @@ PrivateBrowsingService.prototype = {
|
||||
getService(Ci.nsISecretDecoderRing);
|
||||
sdr.logoutAndTeardown();
|
||||
|
||||
try {
|
||||
this._prefs.deleteBranch("geo.wifi.access_token.");
|
||||
} catch (ex) {}
|
||||
|
||||
if (!this._inPrivateBrowsing) {
|
||||
// Clear the error console
|
||||
let consoleService = Cc["@mozilla.org/consoleservice;1"].
|
||||
|
@ -392,15 +392,10 @@ nsGeolocationRequest::Cancel()
|
||||
NS_IMETHODIMP
|
||||
nsGeolocationRequest::Allow()
|
||||
{
|
||||
nsCOMPtr<nsIDOMWindow> window;
|
||||
GetWindow(getter_AddRefs(window));
|
||||
nsCOMPtr<nsIWebNavigation> webNav = do_GetInterface(window);
|
||||
nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(webNav);
|
||||
bool isPrivate = loadContext && loadContext->UsePrivateBrowsing();
|
||||
nsRefPtr<nsGeolocationService> gs = nsGeolocationService::GetGeolocationService();
|
||||
|
||||
// Kick off the geo device, if it isn't already running
|
||||
nsRefPtr<nsGeolocationService> gs = nsGeolocationService::GetGeolocationService();
|
||||
nsresult rv = gs->StartDevice(isPrivate);
|
||||
nsresult rv = gs->StartDevice();
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
// Location provider error
|
||||
@ -924,7 +919,7 @@ nsGeolocationService::GetCachedPosition()
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGeolocationService::StartDevice(bool aRequestPrivate)
|
||||
nsGeolocationService::StartDevice()
|
||||
{
|
||||
if (!sGeoEnabled || sGeoInitPending) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
@ -949,7 +944,7 @@ nsGeolocationService::StartDevice(bool aRequestPrivate)
|
||||
|
||||
for (int32_t i = 0; i < mProviders.Count(); i++) {
|
||||
mProviders[i]->Startup();
|
||||
mProviders[i]->Watch(this, aRequestPrivate);
|
||||
mProviders[i]->Watch(this);
|
||||
obs->NotifyObservers(mProviders[i],
|
||||
"geolocation-device-events",
|
||||
NS_LITERAL_STRING("starting").get());
|
||||
|
@ -125,7 +125,7 @@ public:
|
||||
PRBool IsBetterPosition(nsIDOMGeoPosition *aSomewhere);
|
||||
|
||||
// Find and startup a geolocation device (gps, nmea, etc.)
|
||||
nsresult StartDevice(bool aRequestPrivate);
|
||||
nsresult StartDevice();
|
||||
|
||||
// Stop the started geolocation device (gps, nmea, etc.)
|
||||
void StopDevice();
|
||||
|
@ -121,7 +121,7 @@ GPSDProvider.prototype = {
|
||||
this.transport.close(Components.results.NS_OK);
|
||||
},
|
||||
|
||||
watch: function(c, isPrivate) {
|
||||
watch: function(c) {
|
||||
LOG("watch called\n");
|
||||
try {
|
||||
// Go into "watcher" mode
|
||||
|
@ -16,9 +16,6 @@ const Cc = Components.classes;
|
||||
let gLoggingEnabled = false;
|
||||
let gTestingEnabled = false;
|
||||
|
||||
let gPrivateAccessToken = '';
|
||||
let gPrivateAccessTime = 0;
|
||||
|
||||
function LOG(aMsg) {
|
||||
if (gLoggingEnabled)
|
||||
{
|
||||
@ -61,11 +58,6 @@ WifiGeoPositionObject.prototype = {
|
||||
classDescription: "wifi geo location position object"}),
|
||||
};
|
||||
|
||||
function privateBrowsingObserver(aSubject, aTopic, aData) {
|
||||
gPrivateAccessToken = '';
|
||||
gPrivateAccessTime = 0;
|
||||
}
|
||||
|
||||
function WifiGeoPositionProvider() {
|
||||
try {
|
||||
gLoggingEnabled = Services.prefs.getBoolPref("geo.wifi.logging.enabled");
|
||||
@ -79,9 +71,6 @@ function WifiGeoPositionProvider() {
|
||||
this.timer = null;
|
||||
this.hasSeenWiFi = false;
|
||||
this.started = false;
|
||||
this.lastRequestPrivate = false;
|
||||
|
||||
Services.obs.addObserver(privateBrowsingObserver, "last-pb-context-exited", false);
|
||||
}
|
||||
|
||||
WifiGeoPositionProvider.prototype = {
|
||||
@ -107,18 +96,16 @@ WifiGeoPositionProvider.prototype = {
|
||||
this.timer.initWithCallback(this, 200, this.timer.TYPE_REPEATING_SLACK);
|
||||
},
|
||||
|
||||
watch: function(c, requestPrivate) {
|
||||
watch: function(c) {
|
||||
LOG("watch called");
|
||||
if (!this.wifiService) {
|
||||
this.wifiService = Cc["@mozilla.org/wifi/monitor;1"].getService(Components.interfaces.nsIWifiMonitor);
|
||||
this.wifiService.startWatching(this);
|
||||
this.lastRequestPrivate = requestPrivate;
|
||||
}
|
||||
if (this.hasSeenWiFi) {
|
||||
this.hasSeenWiFi = false;
|
||||
this.wifiService.stopWatching(this);
|
||||
this.wifiService.startWatching(this);
|
||||
this.lastRequestPrivate = requestPrivate;
|
||||
}
|
||||
},
|
||||
|
||||
@ -151,20 +138,11 @@ WifiGeoPositionProvider.prototype = {
|
||||
// check to see if we have an access token:
|
||||
let accessToken = "";
|
||||
try {
|
||||
if (this.lastRequestPrivate) {
|
||||
accessToken = gPrivateAccessToken;
|
||||
} else {
|
||||
let accessTokenPrefName = "geo.wifi.access_token." + url;
|
||||
accessToken = Services.prefs.getCharPref(accessTokenPrefName);
|
||||
}
|
||||
|
||||
// check to see if it has expired
|
||||
let accessTokenDate;
|
||||
if (this.lastRequestPrivate) {
|
||||
accessTokenDate = gPrivateAccessTime;
|
||||
} else {
|
||||
Services.prefs.getIntPref(accessTokenPrefName + ".time");
|
||||
}
|
||||
let accessTokenDate = Services.prefs.getIntPref(accessTokenPrefName + ".time");
|
||||
|
||||
let accessTokenInterval = 1209600; // seconds in 2 weeks
|
||||
try {
|
||||
@ -274,19 +252,11 @@ WifiGeoPositionProvider.prototype = {
|
||||
{
|
||||
let accessToken = "";
|
||||
let accessTokenPrefName = "geo.wifi.access_token." + providerUrlBase;
|
||||
if (this.lastRequestPrivate) {
|
||||
accessTokenPrefName = gPrivateAccessToken;
|
||||
} else {
|
||||
try { accessToken = Services.prefs.getCharPref(accessTokenPrefName); } catch (e) {}
|
||||
}
|
||||
|
||||
if (accessToken != newAccessToken) {
|
||||
// no match, lets cache
|
||||
LOG("New Access Token: " + newAccessToken + "\n" + accessTokenPrefName);
|
||||
if (this.lastRequestPrivate) {
|
||||
gPrivateAccessToken = newAccessToken;
|
||||
gPrivateAccessTime = nowInSeconds();
|
||||
} else {
|
||||
try {
|
||||
Services.prefs.setIntPref(accessTokenPrefName + ".time", nowInSeconds());
|
||||
Services.prefs.setCharPref(accessTokenPrefName, newAccessToken);
|
||||
@ -295,7 +265,6 @@ WifiGeoPositionProvider.prototype = {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
|
||||
LOG("************************************* ------>>>> sending.");
|
||||
|
@ -585,7 +585,7 @@ GonkGPSGeolocationProvider::Startup()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GonkGPSGeolocationProvider::Watch(nsIGeolocationUpdate* aCallback, bool aPrivate)
|
||||
GonkGPSGeolocationProvider::Watch(nsIGeolocationUpdate* aCallback)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
|
@ -35,7 +35,7 @@ interface nsIGeolocationUpdate : nsISupports {
|
||||
* startup is called, any geo location change should call
|
||||
* callback.update().
|
||||
*/
|
||||
[scriptable, uuid(d32b87b3-fe96-4f42-81ab-2f39f7ec43ff)]
|
||||
[scriptable, uuid(483BE98B-F747-490A-8AF1-53146D2D5373)]
|
||||
interface nsIGeolocationProvider : nsISupports {
|
||||
|
||||
/**
|
||||
@ -46,12 +46,9 @@ interface nsIGeolocationProvider : nsISupports {
|
||||
|
||||
/**
|
||||
* watch
|
||||
* When a location change is observed, notify the callback. The privacy
|
||||
* argument informs the provider whether the initiating request came from
|
||||
* a private context; it is up to the provider to use that information
|
||||
* in a sensible manner.
|
||||
* When a location change is observed, notify the callback
|
||||
*/
|
||||
void watch(in nsIGeolocationUpdate callback, in boolean requestPrivate);
|
||||
void watch(in nsIGeolocationUpdate callback);
|
||||
|
||||
/**
|
||||
* shutdown
|
||||
|
Loading…
Reference in New Issue
Block a user