зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1422456
- Origin for about: URL should not contain query or ref parts, r=smaug
This commit is contained in:
Родитель
99db42b684
Коммит
d654a2915d
|
@ -157,6 +157,18 @@ ContentPrincipal::GenerateOriginNoSuffixFromURI(nsIURI* aURI,
|
|||
(NS_SUCCEEDED(origin->SchemeIs("indexeddb", &isBehaved)) && isBehaved)) {
|
||||
rv = origin->GetAsciiSpec(aOriginNoSuffix);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
int32_t pos = aOriginNoSuffix.FindChar('?');
|
||||
int32_t hashPos = aOriginNoSuffix.FindChar('#');
|
||||
|
||||
if (hashPos != kNotFound && (pos == kNotFound || hashPos < pos)) {
|
||||
pos = hashPos;
|
||||
}
|
||||
|
||||
if (pos != kNotFound) {
|
||||
aOriginNoSuffix.Truncate(pos);
|
||||
}
|
||||
|
||||
// These URIs could technically contain a '^', but they never should.
|
||||
if (NS_WARN_IF(aOriginNoSuffix.FindChar('^', 0) != -1)) {
|
||||
aOriginNoSuffix.Truncate();
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
[browser_checkloaduri.js]
|
||||
[browser_aboutOrigin.js]
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
let tests = [ "about:robots?foo", "about:robots#foo", "about:robots?foo#bar"];
|
||||
tests.forEach(async test => {
|
||||
add_task(async () => {
|
||||
await BrowserTestUtils.withNewTab(test, async browser => {
|
||||
await ContentTask.spawn(browser, null, () => {
|
||||
is(content.document.nodePrincipal.origin, "about:robots");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
Загрузка…
Ссылка в новой задаче