Closed
Bug 850958
Opened 12 years ago
Closed 12 years ago
Implement instanceof without relying on nsIDOM interfaces
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla22
People
(Reporter: dzbarsky, Assigned: dzbarsky)
References
Details
Attachments
(1 file, 1 obsolete file)
|
5.83 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
No description provided.
| Assignee | ||
Comment 1•12 years ago
|
||
Attachment #724804 -
Flags: review?(bzbarsky)
| Assignee | ||
Comment 2•12 years ago
|
||
Generated code:
http://pastebin.mozilla.org/2216391
Comment 3•12 years ago
|
||
So the one thing that bothers me here is that if we have something like "Node implements foo" we'll end up with a bajillion entries in the if cascade with this patch, whereas if we just looked for the node proto id at the right depth we'd only need one entry.
Or put another way, if we just look at the right depths, we only need entries for the things that actually have our interface as a consequential interface, not for all of their descendants...
Thoughts?
| Assignee | ||
Comment 4•12 years ago
|
||
I considered that, but I didn't know how to find the right depth. In addition, iface.interfacesBasedOnSelf returns all the descendants as well, so we would need to change that. Another option would be to avoid checking for non-concrete interfaces, except that concreteness is stored on the descriptor so we would need to find the right descriptor for the interface or something.
Comment 5•12 years ago
|
||
> I considered that, but I didn't know how to find the right depth.
PrototypeTraits<PrototypeID>::Depth
> In addition, iface.interfacesBasedOnSelf returns all the descendants as well, so we
> would need to change that
Or rather add another thing tracking what we care about here.
> so we would need to find the right descriptor for the interface or something.
That's always doable, no? But we don't want to worry about concrete vs not, because all the HTML*Element things are in fact concrete....
| Assignee | ||
Comment 6•12 years ago
|
||
Attachment #724804 -
Attachment is obsolete: true
Attachment #724804 -
Flags: review?(bzbarsky)
Attachment #725584 -
Flags: review?(bzbarsky)
Comment 7•12 years ago
|
||
Comment on attachment 725584 [details] [diff] [review]
Patch
>+ interfacesImplementing |= d.interface.interfacesImplementing
s/interfacesImplementing/interfacesImplementingSelf/ please?
>+ return true;
>+ """ % self.descriptor.interface.identifier.name
I'd think the """ should come right after the "return true;" bit; otherwise the generated code has random weird whitespace.
>+ else:
This is an else after return, right? Better to not do that, imo.
r=me with those nits fixed. Thanks!
Attachment #725584 -
Flags: review?(bzbarsky) → review+
| Assignee | ||
Comment 8•12 years ago
|
||
Comment 9•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•