On Fri, Sep 01, 2017 at 11:01:51AM -0400, Boris Zbarsky wrote:
Now that we control all the code that can attempt to touch Components.interfaces.nsIDOM*, we can try to get rid of these interfaces and their corresponding bloat.

The main issue is that we have consumers that use these for testing what sort of object we have, like so:

 if (obj instanceof Ci.nsIDOMWhatever)

and we'd need to find ways to make that work. In some cases various hacky workarounds are possible in terms of property names the object has and maybe their values, but they can end up pretty non-intuitive and fragile. For example, this:

 element instanceof Components.interfaces.nsIDOMHTMLEmbedElement

becomes:

 element.localName === "embed" &&
 element.namespaceURI === "http://www.w3.org/1999/xhtml";

One possibility that should work, but is slightly ugly:

 if (ChromeUtils.getClassName(element) == "HTMLEmbedElement")

That has the unfortunate side-effect of allocating a new JS string for every call, but we can probably optimize it if it becomes necessary.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to