Bug 1335291 - Change the console flag for insecure geo requests from warning to error. r?jdm
MozReview-Commit-ID: 4gLN8jVDyPm
--- a/dom/geolocation/nsGeolocation.cpp
+++ b/dom/geolocation/nsGeolocation.cpp
@@ -1193,17 +1193,17 @@ Geolocation::ShouldBlockInsecureRequests
}
nsCOMPtr<nsIDocument> doc = win->GetDoc();
if (!doc) {
return false;
}
if (!nsGlobalWindow::Cast(win)->IsSecureContext()) {
- nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
+ nsContentUtils::ReportToConsole(nsIScriptError::errorFlag,
NS_LITERAL_CSTRING("DOM"), doc,
nsContentUtils::eDOM_PROPERTIES,
"GeolocationInsecureRequestIsForbidden");
return true;
}
return false;
}
--- a/dom/tests/mochitest/geolocation/test_geoGetCurrentPositionBlockedInInsecureContext.html
+++ b/dom/tests/mochitest/geolocation/test_geoGetCurrentPositionBlockedInInsecureContext.html
@@ -24,16 +24,17 @@ https://bugzilla.mozilla.org/show_bug.cg
// secure context.
function successCallback(position) {
ok(false, "Success callback is not expected to be called");
SimpleTest.finish();
}
function errorCallback(error) {
ok(true, "Check for the error callback to be called for insecure requests");
+ is(error.code, error.PERMISSION_DENIED, "Check error code for insecure requests");
SimpleTest.finish();
}
// Insecure requests should be blocked, for that we enable the relevant pref.
SpecialPowers.pushPrefEnv({"set": [["geo.security.allowinsecure", false]]}, function() {
force_prompt(true, function() {
navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
})
--- a/dom/tests/mochitest/geolocation/test_geoWatchPositionBlockedInInsecureContext.html
+++ b/dom/tests/mochitest/geolocation/test_geoWatchPositionBlockedInInsecureContext.html
@@ -27,16 +27,17 @@ https://bugzilla.mozilla.org/show_bug.cg
function successCallback(position) {
ok(false, "Success callback is not expected to be called");
navigator.geolocation.clearWatch(wid);
SimpleTest.finish();
}
function errorCallback(error) {
ok(true, "Check for the error callback to be called for insecure requests");
+ is(error.code, error.PERMISSION_DENIED, "Check error code for insecure requests");
navigator.geolocation.clearWatch(wid);
SimpleTest.finish();
}
// Insecure requests should be blocked, for that we enable the relevant pref.
SpecialPowers.pushPrefEnv({"set": [["geo.security.allowinsecure", false]]}, function() {
force_prompt(true, function() {
wid = navigator.geolocation.watchPosition(successCallback, errorCallback);