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

RESOLVED FIXED in mozilla12

Status

()

Core
DOM
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: xKhorasan, Assigned: imphil)

Tracking

unspecified
mozilla12
x86
Linux
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

6 years ago
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?

Comment 2

6 years ago
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

6 years ago
OR Triggered by:
Bug 659053 - Remove nsIDOM3Node
Yeah, almost certainly the same as bug 693615.
Depends on: 693615
(Assignee)

Comment 5

6 years ago
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.
Assignee: nobody → mail
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #585087 - Flags: review?(jonas)
(Assignee)

Comment 6

6 years ago
try looks good:
https://tbpl.mozilla.org/?tree=Try&rev=8f3b2f629c42
http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/mail@philipp-wagner.com-8f3b2f629c42
Blocks: 659053
(Assignee)

Comment 7

6 years ago
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)
Attachment #585087 - Flags: review?(bzbarsky) → review+
(Assignee)

Comment 8

6 years ago
Created attachment 591587 [details] [diff] [review]
[for-checkin] patch for mozilla-central; r=jonas
(Assignee)

Comment 9

6 years ago
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
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.