Closed Bug 370098 Opened 13 years ago Closed 13 years ago
Some constructors raise a "XXX is not a function" exception when called (DOMParser, XMLSerializer, XMLHttp
Request, XPath Evaluator, XSLTProcessor)
This makes calling them as functions work. Note that all DOM prototype objects are of type function, even when they're not callable/constructable. We could easily change that, but not sure what the side-effects will be or whether we care.
Assignee: general → peterv
Status: NEW → ASSIGNED
This one makes only constructable DOM classes return "Function" for typeof, others return "Object".
Brendan or Blake: any idea what |typeof Element| should return if you can't really call |Element()| or |new Element()|?
(In reply to comment #3) > Brendan or Blake: any idea what |typeof Element| should return if you can't > really call |Element()| or |new Element()|? "object" If you can call Element(), then ECMA-262 says "function", but real-world browsers do not agree. We should err on the side of reality here and go with "object" unless IE and another browser or two say "function". /be
Comment on attachment 264044 [details] [diff] [review] v1.1 private: + nsresult GetNameStruct(const nsGlobalNameStruct **aNameStruct) Looks like this, and the other method with the same signature, always return either NS_OK an a non-null aNameStruct, or NS_ERROR_UNEXPECTED on failure. Any reason not to make this method return a const nsGlobalNameStruct* and make the callers throw when necessary? r+sr=jst with that considered.
(In reply to comment #6) > Looks like this, and the other method with the same signature, always return > either NS_OK an a non-null aNameStruct, or NS_ERROR_UNEXPECTED on failure. Any > reason not to make this method return a const nsGlobalNameStruct* and make the > callers throw when necessary? Did that for the first, but not the second function, because that one sometimes returns NS_OK for a null aNameStruct (looking up the name worked but didn't return anything, so shouldn't throw).
Attachment #264044 - Attachment is obsolete: true
Target Milestone: --- → mozilla1.9alpha5
Comment on attachment 264235 [details] [diff] [review] Mochitest r+sr=jst
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
The mochitest was checked in on 2007-05-25 09:06 and is passing here and on the tinderbox.
Status: RESOLVED → VERIFIED
Flags: in-testsuite? → in-testsuite+
You need to log in before you can comment on or make changes to this bug.