history.pushState produces non-DOM errors on about: pages, and doesn't work to go from `about:foo` to `about:foo#hash` despite the spec claiming that should be allowed
Categories
(Core :: DOM: Navigation, defect)
Tracking
()
People
(Reporter: Gijs, Unassigned, NeedInfo)
References
(Depends on 1 open bug, Blocks 1 open bug)
Details
Spec says:
A Document document can have its URL rewritten to a URL targetURL if the following algorithm returns true:
- Let documentURL be document's URL.
- If targetURL and documentURL differ in their scheme, username, password, host, or port components, then return false.
- If targetURL's scheme is an HTTP(S) scheme, then return true. (Differences in path, query, and fragment are allowed for http: and https: URLs.)
- If targetURL's scheme is "file", and targetURL and documentURL differ in their path component, then return false. (Differences in query and fragment are allowed for file: URLs.)
- If targetURL and documentURL differ in their path component or query components, then return false. (Only differences in fragment are allowed for other types of URLs.)
- Return true.
It also explicitly lists push/replaceState navigation from about:blank
to about:blank#hash
as allowed, but this doesn't work in practice, producing:
Exception { name: "NS_ERROR_FAILURE", message: "", result: 2147500037, filename: "debugger eval code", lineNumber: 1, columnNumber: 0, data: null, stack: "@debugger eval code:1:9\n" }
This is also against the spec, which says (step 2 of the shared history push/replaceState steps) that there should be a SecurityError DOMException.
AFAICT there aren't (failing) web platform tests for this right now.
Reporter | ||
Comment 2•3 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #1)
smaug, do you happen to know what's wrong here?
FWIW, I analyzed a bit in bug 1766143 comment 2. TL;DR: we enforce here that we can get a userpass from the URL - but blob/about/data URLs aren't nsStandardURLs so attempting to fetch userpass info fails. There might then be additional issues with CheckSameOriginURI
for these URLs - the spec as quoted doesn't actually check origins but has a hand-rolled almost-but-not-quite equivalent check.
It also appears this is a dupe of or closely related to bug 1729961.
Comment 3•3 years ago
|
||
(I don't know why this is being tracked. )
Description
•