Bug 144652
| Summary: | baseURI getter returns bogus values in some cases | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Boris Zbarsky <bzbarsky> |
| Component: | DOM | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED CONFIGURATION CHANGED | ||
| Severity: | Normal | CC: | ahmad.saleem792, ap, bfulgham, rniwa, sam |
| Priority: | P2 | ||
| Version: | 528+ (Nightly build) | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Boris Zbarsky
Consider this web page:
<iframe></iframe>
<script>
onload = function() {
var doc = frames[0].document;
doc.body.innerHTML = '<a href=""></a>'
alert("Document base URI: " + doc.baseURI);
alert("Anchor base URI: " + doc.querySelector('a').baseURI);
alert("Anchor href: " + doc.querySelector('a').href); }
</script>
This should alert the URI of the web page three times. In Safari it instead alerts "about:blank", "null", and the URI of the web page, respectively.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Boris Zbarsky
A live demo of this is available at http://jsfiddle.net/n0gdh5y4/5/
Ahmad Saleem
Here are updated test results across all browsers (using test case from Comment 01):
*** Safari 15.6 on macOS 12.5 ***
JSFiddle changed to "show":
Document base URI: https://fiddle.jshell.net/n0gdh5y4/5/show/light/
Anchor base URI: https://fiddle.jshell.net/n0gdh5y4/5/show/light/
Anchor href: https://fiddle.jshell.net/n0gdh5y4/5/show/light/
JSFiddle with "show" in URL (not Standalone but Editor mode):
Document base URI: https://fiddle.jshell.net/n0gdh5y4/5/show/?editor_console=
Anchor base URI: https://fiddle.jshell.net/n0gdh5y4/5/show/?editor_console=
Anchor href: https://fiddle.jshell.net/n0gdh5y4/5/show/?editor_console=
*** Chrome Canary 106 ***
Document base URI: https://fiddle.jshell.net/n0gdh5y4/5/show/light/
Anchor base URI: https://fiddle.jshell.net/n0gdh5y4/5/show/light/
Anchor href: https://fiddle.jshell.net/n0gdh5y4/5/show/light/
Document base URI: https://fiddle.jshell.net/n0gdh5y4/5/show/?editor_console=
Anchor base URI: https://fiddle.jshell.net/n0gdh5y4/5/show/?editor_console=
Anchor href: https://fiddle.jshell.net/n0gdh5y4/5/show/?editor_console=
*** Firefox Nightly 105 ***
Document base URI: https://fiddle.jshell.net/n0gdh5y4/5/show/light/
Anchor base URI: https://fiddle.jshell.net/n0gdh5y4/5/show/light/
Anchor href: https://fiddle.jshell.net/n0gdh5y4/5/show/light/
Document base URI: https://fiddle.jshell.net/n0gdh5y4/5/show/?editor_console=
Anchor base URI: https://fiddle.jshell.net/n0gdh5y4/5/show/?editor_console=
Anchor href: https://fiddle.jshell.net/n0gdh5y4/5/show/?editor_console=
_______________
I think it was fixed along the way since, I don't see any "about:blank", "null" etc. as mentioned from Comment 0. I think this can be marked as "RESOLVED CONFIGURATION CHANGED". Thanks!
Ryosuke Niwa
Nice. Thanks for testing!