summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-12-16 13:09:21 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-12-16 13:09:21 +0100
commitaa130641c261789528d81c5bc34b2da7a90bdc40 (patch)
tree80815dd4828ad1422e92528de951f65568162290
parentc2478b9e14ada5be33f3e707883ece01c849010b (diff)
downloadUXP-aa130641c261789528d81c5bc34b2da7a90bdc40.tar
UXP-aa130641c261789528d81c5bc34b2da7a90bdc40.tar.gz
UXP-aa130641c261789528d81c5bc34b2da7a90bdc40.tar.lz
UXP-aa130641c261789528d81c5bc34b2da7a90bdc40.tar.xz
UXP-aa130641c261789528d81c5bc34b2da7a90bdc40.zip
Issue #910 part 1. Don't navigate when location.protocol is set to anything other than http or https.
-rw-r--r--dom/base/Location.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/dom/base/Location.cpp b/dom/base/Location.cpp
index 7b3722f09..5f8738298 100644
--- a/dom/base/Location.cpp
+++ b/dom/base/Location.cpp
@@ -730,6 +730,23 @@ Location::SetProtocol(const nsAString& aProtocol)
if (NS_FAILED(rv)) {
return rv;
}
+
+ bool isHttp;
+ rv = uri->SchemeIs("http", &isHttp);
+ if (NS_WARN_IF(NS_FAILED(rv))) {
+ return rv;
+ }
+
+ bool isHttps;
+ rv = uri->SchemeIs("https", &isHttps);
+ if (NS_WARN_IF(NS_FAILED(rv))) {
+ return rv;
+ }
+
+ if (!isHttp && !isHttps) {
+ // No-op, per spec.
+ return NS_OK;
+ }
return SetURI(uri);
}