Last Comment Bug 694754 - document.lookupNamespaceURI(null) in application/xhtml+xml page return not http://www.w3.org/1999/xhtml but null on XrayWrapper
: document.lookupNamespaceURI(null) in application/xhtml+xml page return not ht...
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: DOM (show other bugs)
: unspecified
: x86 Linux
: -- normal (vote)
: mozilla12
Assigned To: Philipp Wagner [:imphil]
:
Mentors:
Depends on: 693615
Blocks: 659053
  Show dependency treegraph
 
Reported: 2011-10-15 04:59 PDT by :xKhorasan
Modified: 2012-01-30 19:14 PST (History)
7 users (show)
dao+bmo: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (4.86 KB, patch)
2011-12-30 17:32 PST, Philipp Wagner [:imphil]
jonas: review+
Details | Diff | Splinter Review
[for-checkin] patch for mozilla-central; r=jonas (4.89 KB, patch)
2012-01-25 12:59 PST, Philipp Wagner [:imphil]
no flags Details | Diff | Splinter Review

Description :xKhorasan 2011-10-15 04:59:16 PDT
User Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0a1) Gecko/20111012 Firefox/10.0a1
Build Identifier: 20111012135754

document.lookupNamespaceURI(null) on XrayWrapper in application/xhtml+xml page returns null.

This is not the same as document.lookupNamespace(null) with normal (non XrayWrapper-ed) document in application/xhtml+xml page (in this case, it returns "http://www.w3.org/1999/xhtml", not null).  And this does not follow the spec described in http://www.w3.org/TR/DOM-Level-3-Core/namespaces-algorithms.html#lookupNamespaceURIAlgo, because document.lookupNamespaceURI(null) and document.documentElement.lookupNamespaceURI(null) in application/xhtml+xml page return different namespace URI on XrayWrapper.


Reproducible: Always


Step to reproduce:

1. Set 'devtools.errorconsole.enabled' preference to true in about:config, then restart Firefox.
2. Input 'http://misc-xkyrgyzstan.dotcloud.com/xhtml/lookupnamespaceuri' in the address bar, then press Enter.
3. Press Ctrl + Shift + K to launch web console.
4. Input 'document.lookupNamespaceURI(null)' in console, then press Enter to evaluate the code.
5. Input 'document.documentElement.lookupNamespaceURI(null)' in console, then press Enter to evaluate the code.
6. Press Ctrl + Shift + K to close web console.
7. Press Ctrl + Shift + J to launch error console, then press Alt + C to clear log.
8. Input 'top.opener.gBrowser.contentDocument.defaultView.document.lookupNamespaceURI(null)' in console, then press Alt + V to evaluate the code, and delete inputed code in console.
9. Input 'top.opener.gBrowser.contentDocument.defaultView.document.documentElement.lookupNamespaceURI(null)' in console, then press Alt + V to evaluate the code.


Actual results:

http://www.w3.org/1999/xhtml
http://www.w3.org/1999/xhtml
null
http://www.w3.org/1999/xhtml


Expected results:

http://www.w3.org/1999/xhtml
http://www.w3.org/1999/xhtml
http://www.w3.org/1999/xhtml
http://www.w3.org/1999/xhtml


Notes:

result of Firefox 6.0.2 (User Agent: Mozilla/5.0 (X11; Linux i686; rv:6.0.2) Gecko/20100101 Firefox/6.0.2)

http://www.w3.org/1999/xhtml
http://www.w3.org/1999/xhtml
http://www.w3.org/1999/xhtml
http://www.w3.org/1999/xhtml

result of Firefox 7.0.1 (User Agent: Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20100101 Firefox/7.0.1)

http://www.w3.org/1999/xhtml
http://www.w3.org/1999/xhtml
null
http://www.w3.org/1999/xhtml

So it seems that this is a regression.
Comment 1 Kyle Huey [:khuey] (khuey@mozilla.com) 2011-10-15 08:05:22 PDT
Presumably this is the same problem as Bug 693615?
Comment 2 Alice0775 White 2011-10-15 08:27:23 PDT
Works;
http://hg.mozilla.org/mozilla-central/rev/4e1b20229d4d
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0a1) Gecko/20110613 Firefox/7.0a1 ID:20110614005638
Fails:;
http://hg.mozilla.org/mozilla-central/rev/9ea784903fdf
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0a1) Gecko/20110614 Firefox/7.0a1 ID:20110614013910
Pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=4e1b20229d4d&tochange=9ea784903fdf
Triggered by:
Bug 659539 - Move more useful information into nsINodeInfo
Comment 3 Alice0775 White 2011-10-15 08:28:41 PDT
OR Triggered by:
Bug 659053 - Remove nsIDOM3Node
Comment 4 Boris Zbarsky [:bz] 2011-10-17 10:35:19 PDT
Yeah, almost certainly the same as bug 693615.
Comment 5 Philipp Wagner [:imphil] 2011-12-30 17:32:42 PST
Created attachment 585087 [details] [diff] [review]
patch

This bug is not resolved by the patch in bug 693615, as nsDocument is special. 

I guess the changes to nsDocument::LookupNamespaceURI, nsDocument::LookupPrefix and nsDocument::IsDefaultNamespace made in bug 659053 were meant as an optimization which is only valid for HTML documents, but not for XHTML documents. Thus I added the explicit forwarding to nsINode back.

This patch fixes more than the original bug report (which was only about LookupNamespaceURI) but I guess it's ok to fix all three methods here at once since the problems are strongly related.

A mochitest for all three methods is part of the patch.
Comment 7 Philipp Wagner [:imphil] 2012-01-21 03:41:36 PST
Comment on attachment 585087 [details] [diff] [review]
patch

I'm unable to get in contact with Jonas, but it would be great to get this reviewed until Jan 31st (Aurora uplift).
Comment 8 Philipp Wagner [:imphil] 2012-01-25 12:59:24 PST
Created attachment 591587 [details] [diff] [review]
[for-checkin] patch for mozilla-central; r=jonas
Comment 9 Philipp Wagner [:imphil] 2012-01-25 13:00:01 PST
Could someone check this in for me?
Comment 11 Matt Brubeck (:mbrubeck) 2012-01-30 19:14:26 PST
https://hg.mozilla.org/mozilla-central/rev/9b50354e65c8

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