summaryrefslogtreecommitdiffstats
path: root/caps/nsPrincipal.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-11-07 12:47:12 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-11-07 12:47:12 +0100
commit8240fb9c736f91044cabbdde8c537b179fc4921e (patch)
tree49a4cc8dc683cf955d61b6618ad471860554ccb5 /caps/nsPrincipal.cpp
parentf9e04b54c2ccbc1f8e24b511003de09b4565193c (diff)
parent5c83a18cde404b5c0c9fba1d35f003d951ea32e2 (diff)
downloadUXP-8240fb9c736f91044cabbdde8c537b179fc4921e.tar
UXP-8240fb9c736f91044cabbdde8c537b179fc4921e.tar.gz
UXP-8240fb9c736f91044cabbdde8c537b179fc4921e.tar.lz
UXP-8240fb9c736f91044cabbdde8c537b179fc4921e.tar.xz
UXP-8240fb9c736f91044cabbdde8c537b179fc4921e.zip
Merge branch 'master' into Pale_Moon-release
# Conflicts: # application/palemoon/config/version.txt
Diffstat (limited to 'caps/nsPrincipal.cpp')
-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();