Last Comment Bug 505783 - Setting dynamically xml:base for XHTML elements has no effect in HTML documents
: Setting dynamically xml:base for XHTML elements has no effect in HTML documents
Status: RESOLVED FIXED
: html5
Product: Core
Classification: Components
Component: DOM (show other bugs)
: Trunk
: x86 Windows XP
: -- normal (vote)
: ---
Assigned To: Henri Sivonen (:hsivonen)
:
Mentors:
Depends on:
Blocks: 468708
  Show dependency treegraph
 
Reported: 2009-07-22 09:16 PDT by nanto_vi (TOYAMA Nao)
Modified: 2009-11-26 02:03 PST (History)
4 users (show)
hsivonen: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
beta1-fixed


Attachments
Testcase: setting xml:base on an XHTML "a" element (395 bytes, text/html)
2009-07-22 09:16 PDT, nanto_vi (TOYAMA Nao)
no flags Details
Don't make xml:base special in HTML (1.04 KB, patch)
2009-08-13 06:13 PDT, Henri Sivonen (:hsivonen)
jonas: review+
jonas: approval1.9.2+
Details | Diff | Review
Mochitest (1.77 KB, patch)
2009-10-02 06:15 PDT, Henri Sivonen (:hsivonen)
jonas: review+
Details | Diff | Review

Description nanto_vi (TOYAMA Nao) 2009-07-22 09:16:04 PDT
Created attachment 389975 [details]
Testcase: setting xml:base on an XHTML "a" element

Setting the xml:base attribute on an XML (including XHTML) element changes the base URI of the element, but Mozilla now ignores xml:base if the elements is an XHTML element and the document is an HTML document (served as text/html).

See the attachment to reproduce this.

Expected:
  http://example.org/
  http://example.org/foo

Actual:
  https://bugzilla.mozilla.org/attachment.cgi?id=nnn
  https://bugzilla.mozilla.org/foo

This is a regression.  Firefox 3.5 and older works as expected.  This breaks resolving-relative-URIs techniques [1] and some Greasemonkey scripts that use the techniques [2] [3].

[1] http://www.google.com/codesearch?q=createElementNS+setAttributeNS+xml%3Abase+file%3A\.js%24
[2] http://userscripts.org/scripts/show/8551
[3] http://userscripts.org/scripts/show/22702
Comment 1 Olli Pettay [:smaug] (high review load, please consider other reviewers) 2009-07-22 09:20:30 PDT
I think this is a regression from Bug 468708.
Comment 2 Jonas Sicking (:sicking) PTO Until July 5th 2009-07-23 08:33:12 PDT
I suppose we could enable xml:base in HTML too :( I'm not a big fan of xml:base in general since I think it's somewhat over complicated, but if people really use it that seems like a reasonable solution.
Comment 3 Henri Sivonen (:hsivonen) 2009-08-05 00:32:03 PDT
IIRC, HTML5/Hixie says that script-inserted xml:base in HTML documents should work.
Comment 4 Boris Zbarsky [:bz] (Out June 25-July 6) 2009-08-11 10:08:26 PDT
Isn't this just a matter of this code in nsGenericHTMLElement::GetBaseURI() bailing out early?

Do we need to make sure to fix this in 1.9.2, if this is breaking real things out there?

We could just take out the early-bail and see what happens, perf-wise, I suppose...

Maybe we should flag nodes that have an ancestor with xml:base set, so that we can fast-path all the other (common!) cases?
Comment 5 Henri Sivonen (:hsivonen) 2009-08-13 06:13:05 PDT
Created attachment 394261 [details] [diff] [review]
Don't make xml:base special in HTML

Need to get some perf numbers for this.
Comment 6 Henri Sivonen (:hsivonen) 2009-08-14 06:15:50 PDT
Comment on attachment 394261 [details] [diff] [review]
Don't make xml:base special in HTML

Looks OK on tryserver talos.
Comment 7 Henri Sivonen (:hsivonen) 2009-08-27 00:43:02 PDT
http://hg.mozilla.org/mozilla-central/rev/50c82c606fcd

Are the flags on this bug now right for 3.6 approval consideration?
Comment 8 Jonas Sicking (:sicking) PTO Until July 5th 2009-08-27 23:20:06 PDT
Is this really important enough for 1.9.2? Seems very much like an edgecase. If you think we need it you need to set the approval 1.9.2? flag on the patch.
Comment 9 Henri Sivonen (:hsivonen) 2009-08-27 23:54:33 PDT
Comment on attachment 394261 [details] [diff] [review]
Don't make xml:base special in HTML

This is unlikely to matter for Web compat. However, not having this patch in 1.9.2 could break Greasemonkey scripts or extensions as stated in the bug description.
Comment 10 Benjamin Smedberg [:bsmedberg] 2009-09-29 11:28:12 PDT
Comment on attachment 394261 [details] [diff] [review]
Don't make xml:base special in HTML

I can't imagine taking this on branch without a test (and it should have a test anyway, no?)
Comment 11 Henri Sivonen (:hsivonen) 2009-10-02 06:15:50 PDT
Created attachment 404235 [details] [diff] [review]
Mochitest

Could this bug get branch approval with this test case, please?
Comment 12 Jonas Sicking (:sicking) PTO Until July 5th 2009-10-02 09:21:46 PDT
Comment on attachment 404235 [details] [diff] [review]
Mochitest

Could you *also* test that things work if the <a> is inserted into the document.

r=me with that
Comment 13 Jonas Sicking (:sicking) PTO Until July 5th 2009-10-02 09:22:50 PDT
Comment on attachment 394261 [details] [diff] [review]
Don't make xml:base special in HTML

a=sicking with the testcase once fixed per above comment.
Comment 14 Henri Sivonen (:hsivonen) 2009-10-05 04:12:59 PDT
Test pushed with additional in-document check:
http://hg.mozilla.org/mozilla-central/rev/1470fa9c9f01

Pushed to branch:
http://hg.mozilla.org/releases/mozilla-1.9.2/rev/aa636984cd78

Thanks!

Note You need to log in before you can comment on or make changes to this bug.