Closed Bug 490411 Opened 17 years ago Closed 17 years ago

elementslib.Lookup(document, expression) does not work for annon element

Categories

(Testing Graveyard :: Mozmill, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: dongdongdeng, Unassigned)

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b5pre) Gecko/20090427 Shiretoko/3.5b5pre Build Identifier: 1.1 I wanna use controller.click(new elementslib.Lookup(controller.window.document,'anon(attrib({"anonid":"loginButton"}))')); to fire a click event to a button which is in a xbl element. But there is some errors just like the following. Messenger log is: _byAnonAttrib:[Exception... "Could not convert JavaScript argument arg 0 [nsIDOMDocumentXBL.getAnonymousElementByAttribute]" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: file:///C:/Documents%20and%20Settings/Administrator/Application%20Data/M... :: anonymous :: line 333" data: no] The error comes from Lookup.prototype.getNode = function () in elementslib.js. When the codes run into var reduceLookup = function (parent, exp) {}, _byAnonAttrib(_document, parent, value) was executed. And the first argument passed to getAnonymousElementByAttribute was a document which inherited from nsIDOMDocument->nsIDomNode, but the needed argument is a nsIDOMElement ->nsIDomNode. So the above error comes out. Since nsIDOMDocument can not be converted into nsIDOMElement. In my opinion, if lookup an anon element. Another argument should be add. Then the code may look like this elementslib.Lookup(controller.window.document,'anon(attrib({"anonid":"loginButton"}))'), parentNodeOfAnon); parentNodeOfAnon is the exactly parentNode of the anno element in xul. It also stands for the xbl element itself. Good luck. Reproducible: Always Steps to Reproduce: 1.add a xbl element in xul 2.get the xbl element in js controller.click(new elementslib.Lookup(controller.window.document,'anon(attrib({"anonid":"yourbuttonid"})) Actual Results: byAnonAttrib:[Exception... "Could not convert JavaScript argument arg 0 [nsIDOMDocumentXBL.getAnonymousElementByAttribute]" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: file:///C:/Documents%20and%20Settings/Administrator/Application%20Data/M... :: anonymous :: line 333" data: no] Expected Results: no exception
Mikeal, is the lookup correct that way? Reporter, could you please come up with a real example test we could run our side?
Are you attempting to write Lookup expressions by hand? You should use the inspector to generate those expressions. I wrote the expressions syntax, generation, and parsing code and even I wouldn't be able to write them by hand from scratch.
No response from reporter since nearly two month. Feel free to reopen if your problem still persists.
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → INCOMPLETE
Product: Testing → Testing Graveyard
You need to log in before you can comment on or make changes to this bug.