Bug 1964063 - Try to reset a geolocation override only if it was set before. r=saschanaz

Differential Revision: https://phabricator.services.mozilla.com/D247601
This commit is contained in:
Alexandra Borovova
2025-05-05 12:15:50 +00:00
committed by aborovova@mozilla.com
parent c9e995bfa3
commit e4fed060be
2 changed files with 48 additions and 4 deletions

View File

@@ -3254,13 +3254,12 @@ void BrowsingContext::SetGeolocationServiceOverride(
mGeolocationServiceOverride->Init();
}
mGeolocationServiceOverride->Update(aGeolocationOverride.Value());
} else {
} else if (RefPtr<nsGeolocationService> serviceOverride =
mGeolocationServiceOverride.forget()) {
// Create an original service and move the locators.
RefPtr<nsGeolocationService> service =
nsGeolocationService::GetGeolocationService();
mGeolocationServiceOverride->MoveLocators(service);
mGeolocationServiceOverride = nullptr;
serviceOverride->MoveLocators(service);
}
}