summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-10-31 18:32:00 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-10-31 18:32:00 +0100
commit752311fd47d24fe949aeabedbd8c9ffe25f740f4 (patch)
tree0304c58f500bae52d8d453ddd1bad1a9c0314605
parent1cfcf17a10898f8c429021c4f78bd9ae61935c52 (diff)
downloadUXP-752311fd47d24fe949aeabedbd8c9ffe25f740f4.tar
UXP-752311fd47d24fe949aeabedbd8c9ffe25f740f4.tar.gz
UXP-752311fd47d24fe949aeabedbd8c9ffe25f740f4.tar.lz
UXP-752311fd47d24fe949aeabedbd8c9ffe25f740f4.tar.xz
UXP-752311fd47d24fe949aeabedbd8c9ffe25f740f4.zip
Origin for about: URL should not contain query or ref parts.
-rw-r--r--caps/nsPrincipal.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/caps/nsPrincipal.cpp b/caps/nsPrincipal.cpp
index f89061043..129cdf9a0 100644
--- a/caps/nsPrincipal.cpp
+++ b/caps/nsPrincipal.cpp
@@ -161,6 +161,19 @@ nsPrincipal::GetOriginForURI(nsIURI* aURI, nsACString& aOrigin)
(NS_SUCCEEDED(origin->SchemeIs("indexeddb", &isBehaved)) && isBehaved)) {
rv = origin->GetAsciiSpec(aOrigin);
NS_ENSURE_SUCCESS(rv, rv);
+
+ // Remove query or ref part from about: origin
+ int32_t pos = aOrigin.FindChar('?');
+ int32_t hashPos = aOrigin.FindChar('#');
+
+ if (hashPos != kNotFound && (pos == kNotFound || hashPos < pos)) {
+ pos = hashPos;
+ }
+
+ if (pos != kNotFound) {
+ aOrigin.Truncate(pos);
+ }
+
// These URIs could technically contain a '^', but they never should.
if (NS_WARN_IF(aOrigin.FindChar('^', 0) != -1)) {
aOrigin.Truncate();