Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-22 Thread Boris Zbarsky
On 9/4/17 4:51 AM, Anne van Kesteren wrote: Also, do we need this for Promise, Map, Set, etc., or just IDL-defined objects? For the moment, just the latter, I think, in that we have no one who is trying to do if for the former... -Boris ___

Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-17 Thread Stanimir Stamenkov via dev-platform
On Fri, 1 Sep 2017 10:13:55 -0700, Bobby Holley wrote: On Fri, Sep 1, 2017 at 9:59 AM, Botond Ballo wrote: On Fri, Sep 1, 2017 at 12:11 PM, Ehsan Akhgari wrote: How about this slight variation: HTMLEmbedElement.isInstanceOf(obj) instead of "is"? Isn't that backwards, though?

Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-15 Thread Boris Zbarsky
On 9/15/17 9:58 AM, David Bruant wrote: Maybe @@toStringTag will end up not working well enough for your need anyway. Not least because its use is kinda ugly, no? But another solution could be to define a chromeonly symbol for the brand. obj[Symbol.brand] === 'HTMLEmbedElement'

Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-15 Thread David Bruant
Hi, Sorry, arriving a bit late to the party. I was about to propose something related to @@toStringTag, but reading the discussions about how it may/will work [1][2][3], i realize it may not be your preferred solution. Maybe @@toStringTag will end up not working well enough for your need

Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-04 Thread Anne van Kesteren
On Fri, Sep 1, 2017 at 5:01 PM, Boris Zbarsky wrote: > Thoughts? It really would be nice to get rid of some of this stuff going > forward. And since the web platform seems to be punting on branding, > there's no existing solution we can use. It's punting on exposing it to web

Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-01 Thread Boris Zbarsky
On 9/1/17 4:54 PM, Kris Maglione wrote: The other potential issue is that the `instanceof Ci.nsIDOM...` checks tend to appear in places like JSMs, where we don't have direct access to constructors for DOM interfaces by default. Right, if we used one of the things that use constructors, we'd

Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-01 Thread Kris Maglione
On Fri, Sep 01, 2017 at 04:43:31PM -0400, Ehsan Akhgari wrote: On 09/01/2017 01:18 PM, Boris Zbarsky wrote: 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. We could add a hasClassName if we wanted.

Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-01 Thread Ehsan Akhgari
On 09/01/2017 01:18 PM, Boris Zbarsky wrote: 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. We could add a hasClassName if we wanted. I'm kind of missing what's better about this compared to the

Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-01 Thread Kris Maglione
On Fri, Sep 01, 2017 at 01:18:12PM -0400, Boris Zbarsky wrote: 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. We could add a hasClassName if we wanted. That's an interesting idea. It would also

Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-01 Thread Boris Zbarsky
On 9/1/17 1:06 PM, Kris Maglione wrote:  if (ChromeUtils.getClassName(element) == "HTMLEmbedElement") Ah, that works. Though I think spidermonkey wants to maybe get rid of classnames and on the flip side it's not clear whether HTMLEmbedElement.prototype will end up with the same

Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-01 Thread Bobby Holley
On Fri, Sep 1, 2017 at 9:59 AM, Botond Ballo wrote: > On Fri, Sep 1, 2017 at 12:11 PM, Ehsan Akhgari > wrote: > > How about this slight variation: > > > > HTMLEmbedElement.isInstanceOf(obj) > > > > instead of "is"? > > Isn't that backwards, though?

Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-01 Thread Kris Maglione
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

Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-01 Thread Botond Ballo
On Fri, Sep 1, 2017 at 12:11 PM, Ehsan Akhgari wrote: > How about this slight variation: > > HTMLEmbedElement.isInstanceOf(obj) > > instead of "is"? Isn't that backwards, though? HTMLEmbedElement isn't an instance of 'obj', 'obj' is an instance of HTMLEmbedElement :)

Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-01 Thread Michael Layzell
Accidentally sent this off-list. On Fri, Sep 1, 2017 at 12:14 PM, Michael Layzell wrote: > I personally like the style of (2) the most, The isWhatever style methods > are too verbose, and I don't think that adding more code which depends on > behavior we might want to

Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-01 Thread Ehsan Akhgari
On 09/01/2017 11:01 AM, Boris Zbarsky wrote: Anyway, we need a replacement. Some possible options: 1) Use "obj instanceof Whatever". The problem is that we'd like to maybe kill off the cross-global instanceof behavior we have now for DOM constructors. 2) Introduce chromeonly "is"

Eiminating nsIDOM* interfaces and brand checks

2017-09-01 Thread Boris Zbarsky
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