Ecma262: Implementation-defined typeof still necessary?

Created on 7 Feb 2019  路  7Comments  路  Source: tc39/ecma262

Now that we have the HTML document.all object defined, including its typeof document.all = "undefined" behavior, do we still need to permit non-standard, non-callable exotic objects to have implementation-defined typeof, as defined in https://tc39.github.io/ecma262/#sec-typeof-operator-runtime-semantics-evaluation ? I'm not aware of any use cases for this in the Web; do other embedding environments need it?

See related discussion at https://github.com/heycam/webidl/issues/512 @annevk @TimothyGu

Most helpful comment

From IE10,

>> window.external.AddSearchProvider
undefined
>> window.external.IsSearchProviderInstalled
undefined
>> typeof window.external.AddSearchProvider
"unknown"
>> typeof window.external.IsSearchProviderInstalled
"unknown"
>> var x = window.external.AddSearchProvider
>> typeof x
"undefined"

All 7 comments

Fun fact: old versions of I.E, up to I believe 8, return "unknown" for the typeof certain properties, but since those are already not attempting to conform to the latest version of the spec I don't think that's an issue. I don't think that behavior was carried over to Edge, though it's possible I'm mistaken.

From IE10,

>> window.external.AddSearchProvider
undefined
>> window.external.IsSearchProviderInstalled
undefined
>> typeof window.external.AddSearchProvider
"unknown"
>> typeof window.external.IsSearchProviderInstalled
"unknown"
>> var x = window.external.AddSearchProvider
>> typeof x
"undefined"

Both of those appear to be object in latest edge, whether direct or stored in a variable.

Let's phase out this phaseout strategy!

Regardless of if Edge actually returns "unknown" anywhere, the infrastructure for returning "unknown" on typeof is certainly still there in ChakraCore: https://github.com/Microsoft/ChakraCore/blob/87249a17a484d54980c3823577acd66c2824eaa4/lib/Runtime/Types/RecyclableObject.cpp#L797-L800

It also has support for something called a "variant Date" that returns "date" when typeof is called on it, though I doubt it's used anywhere.

Interesting. It'd be great to hear from ChakraCore folks to understand if this behavior is important to them, cc @zenparsing.

I'm currently digging into this with respect to CC and will report what I find.

Was this page helpful?
0 / 5 - 0 ratings