do any host object implementations define [[DefaultValue]]??

Boris Zbarsky bzbarsky at MIT.EDU
Wed Feb 9 14:53:33 PST 2011


On 2/9/11 4:20 PM, Allen Wirfs-Brock wrote:
> If any browser host objects implementation do have unique  [[DefaultValue]] implementations do they do anything other than the equivalent of calling their toString or valueOf methods?

If I'm reading the code right (and I could well not be!), Gecko's JS 
reflections of NPAPI-provided stuff have a [[DefaultValue]] that 
purposefully does not call valueOf (see 
http://hg.mozilla.org/mozilla-central/file/280e978fc6fb/modules/plugin/base/src/nsJSNPRuntime.cpp#l1686).

There's also some weirdness with NPAPI stuff at 
<http://hg.mozilla.org/mozilla-central/file/280e978fc6fb/modules/plugin/base/src/nsJSNPRuntime.cpp#l2177>.

Also, arbitrary XPConnect objects could define a custom [[DefaultValue]] 
via their classinfo in Gecko (though as far as I can tell none of the 
ones we ship in the browser by default do; who knows about extensions).

XPConnect objects without classinfo also use a custom [[DefaultValue]] 
defined at 
http://hg.mozilla.org/mozilla-central/file/280e978fc6fb/js/src/xpconnect/src/xpcwrappednativejsops.cpp#l540

I don't know what other host objects we might have around that use a 
non-default [[DefaultValue]]; it's a little hard to look through the 
code for this in Gecko, unfortunately.  :(

Of the above, I believe the NPAPI bits are web-exposed and the rest are 
not (again, modulo whatever extensions do).

-Boris


More information about the es-discuss mailing list