Closed Bug 694754 Opened 13 years ago Closed 13 years ago

document.lookupNamespaceURI(null) in application/xhtml+xml page return not http://www.w3.org/1999/xhtml but null on XrayWrapper

Categories

(Core :: DOM: Core & HTML, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla12

People

(Reporter: xKhorasan, Assigned: imphil)

References

Details

Attachments

(2 files)

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.
Presumably this is the same problem as Bug 693615?
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
OR Triggered by:
Bug 659053 - Remove nsIDOM3Node
Yeah, almost certainly the same as bug 693615.
Depends on: 693615
Attached patch patchSplinter 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.
Assignee: nobody → mail
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #585087 - Flags: review?(jonas)
Blocks: 659053
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).
Attachment #585087 - Flags: review?(jonas) → review?(bzbarsky)
Could someone check this in for me?
Keywords: checkin-needed
http://hg.mozilla.org/integration/mozilla-inbound/rev/9b50354e65c8
Flags: in-testsuite+
Keywords: checkin-needed
Target Milestone: --- → mozilla12
https://hg.mozilla.org/mozilla-central/rev/9b50354e65c8
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: