mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-05 23:07:31 +09:00
Origin for about: URL should not contain query or ref parts.
This commit is contained in:
parent
c554052ddd
commit
f85bb5c221
1 changed files with 13 additions and 0 deletions
|
|
@ -161,6 +161,19 @@ nsPrincipal::GetOriginForURI(nsIURI* aURI, nsACString& aOrigin)
|
||||||
(NS_SUCCEEDED(origin->SchemeIs("indexeddb", &isBehaved)) && isBehaved)) {
|
(NS_SUCCEEDED(origin->SchemeIs("indexeddb", &isBehaved)) && isBehaved)) {
|
||||||
rv = origin->GetAsciiSpec(aOrigin);
|
rv = origin->GetAsciiSpec(aOrigin);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
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.
|
// These URIs could technically contain a '^', but they never should.
|
||||||
if (NS_WARN_IF(aOrigin.FindChar('^', 0) != -1)) {
|
if (NS_WARN_IF(aOrigin.FindChar('^', 0) != -1)) {
|
||||||
aOrigin.Truncate();
|
aOrigin.Truncate();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue