Last Comment Bug 694754 - document.lookupNamespaceURI(null) in application/xhtml+xml page return not but null on XrayWrapper
: document.lookupNamespaceURI(null) in application/xhtml+xml page return not ht...
Product: Core
Classification: Components
Component: DOM (show other bugs)
: unspecified
: x86 Linux
-- normal (vote)
: mozilla12
Assigned To: Philipp Wagner [:imphil]
: Andrew Overholt [:overholt]
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:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

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 User image :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 "", not null).  And this does not follow the spec described in, 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 '' 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:

Expected results:


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

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

So it seems that this is a regression.
Comment 1 User image Kyle Huey [:khuey] (Exited; not receiving bugmail, email if necessary) 2011-10-15 08:05:22 PDT
Presumably this is the same problem as Bug 693615?
Comment 2 User image Alice0775 White 2011-10-15 08:27:23 PDT
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0a1) Gecko/20110613 Firefox/7.0a1 ID:20110614005638
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0a1) Gecko/20110614 Firefox/7.0a1 ID:20110614013910
Triggered by:
Bug 659539 - Move more useful information into nsINodeInfo
Comment 3 User image Alice0775 White 2011-10-15 08:28:41 PDT
OR Triggered by:
Bug 659053 - Remove nsIDOM3Node
Comment 4 User image Boris Zbarsky [:bz] (still a bit busy) 2011-10-17 10:35:19 PDT
Yeah, almost certainly the same as bug 693615.
Comment 5 User image Philipp Wagner [:imphil] 2011-12-30 17:32:42 PST
Created attachment 585087 [details] [diff] [review]

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 User image Philipp Wagner [:imphil] 2012-01-21 03:41:36 PST
Comment on attachment 585087 [details] [diff] [review]

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 User image 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 User image Philipp Wagner [:imphil] 2012-01-25 13:00:01 PST
Could someone check this in for me?
Comment 11 User image Matt Brubeck (:mbrubeck) 2012-01-30 19:14:26 PST

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