Closed Bug 384003 Opened 18 years ago Closed 16 years ago

XPathEvaluator does not accept a Node as NSResolver

Categories

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

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: sjoerd, Assigned: smaug)

Details

Attachments

(2 files, 1 obsolete file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4 The XpathEvaluator accepts besides objects created with createNSResolver also any object with a lookupNamespaceURI method. As any Node has a lookupNamespaceURI method, I expected XPathEvaluator also to accept a Node as a NSResolver, but I get this error: Exception... "Could not convert JavaScript argument" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" Reproducible: Always
Sjoerd, can you provide an actual testcase - the XML and JS code you used to generate this error?
That would be the Xopus product, 1.5Mb of JS code. I don't think that would help you much. Do you have a basic XSLT test case somewhere that I can adapt?
Component: DOM: Core → DOM: Core & HTML
Attached file Simple testcase
This works in Safari 3.1.2 and Opera 9.52.
Per spec what we do is enough, but should be easy to add support for node as resolver.
Assignee: nobody → Olli.Pettay
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached patch possible fix (obsolete) — Splinter Review
We could do it this way. No need to implement anything new, just make dom nodes to implement resolver interface.
Attachment #345716 - Flags: superreview?(peterv)
Attachment #345716 - Flags: review?(peterv)
The applies still to trunk (with some fuzz).
> The XpathEvaluator accepts besides objects created with createNSResolver also > any object with a lookupNamespaceURI method. There is no spec that says that this is the case. It was however recently suggested that nodes should implement XPathNSResolver which would make passing nodes as resolvers work.
Attachment #345716 - Flags: superreview?(peterv) → superreview-
Comment on attachment 345716 [details] [diff] [review] possible fix This is slightly different from what Webkit does, Webkit allows any object that has a lookupNamespaceURI method. In practice it will work the same for now, because our nodes seem to be the only objects that have a lookupNamespaceURI method. I think we need to make createNSResolver do a QI on the node instead of returning a new nsXPathNSResolver. If we add nsIDOMXPathNSResolver to nsNode3Tearoff then we should remove nsXPathNSResolver (the alternative would be to make nsXPathNSResolver a tearoff of nodes instead). Might also want to add nsIDOMXPathNSResolver to the DOMCI data for all nodes and remove the XPathNSResolver DOMCI data. Sicking: don't we need to add CanCallerAccess to places where we take a nsIDOMXPathNSResolver if someone passes in a node?
Actually, XOWs should remove the need for CanCallerAccess, everywhere. Just think we've been conservative elsewhere. And technically making createNSResolver return a Node would be violating specs. At least the spirit if them.
Comment on attachment 345716 [details] [diff] [review] possible fix Hmm, guess so.
Attachment #345716 - Flags: superreview- → superreview+
Attached patch up-to-dateSplinter Review
Attachment #345716 - Attachment is obsolete: true
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
(This seems to have improved TDHTML on Vista, at least! Good job!)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: