Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation-defined typeof still necessary? #1440

Closed
littledan opened this issue Feb 7, 2019 · 7 comments
Closed

Implementation-defined typeof still necessary? #1440

littledan opened this issue Feb 7, 2019 · 7 comments

Comments

@littledan
Copy link
Member

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 whatwg/webidl#512 @annevk @TimothyGu

@bakkot
Copy link
Contributor

bakkot commented Feb 7, 2019

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.

littledan added a commit to littledan/ecma262 that referenced this issue Feb 7, 2019
Previously, the ECMAScript specification permitted non-callable
non-standard exotic objects to have implementation-defined typeof,
within certain limits. Although some ECMAScript implementations
may have taken advantage of this possibility historically, it's not
clear that anyone needs it anymore. Instead, @@toStringTag and other
mechanisms can be used by embedders to indicate aspects of objects.

Closes tc39#1440
@michaelficarra
Copy link
Member

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"

@ljharb
Copy link
Member

ljharb commented Feb 8, 2019

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

@littledan
Copy link
Member Author

Let's phase out this phaseout strategy!

@TimothyGu
Copy link
Member

TimothyGu commented Feb 9, 2019

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.

littledan added a commit to littledan/ecma262 that referenced this issue Feb 9, 2019
Previously, the ECMAScript specification permitted non-callable
non-standard exotic objects to have implementation-defined typeof,
within certain limits. Although some ECMAScript implementations
may have taken advantage of this possibility historically, it's not
clear that anyone needs it anymore. Instead, other mechanisms can
be used by embedders to indicate aspects of objects.

Closes tc39#1440
@littledan
Copy link
Member Author

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

@zenparsing
Copy link
Member

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

ljharb pushed a commit to littledan/ecma262 that referenced this issue Apr 10, 2019
Previously, the ECMAScript specification permitted non-callable
non-standard exotic objects to have implementation-defined typeof,
within certain limits. Although some ECMAScript implementations
may have taken advantage of this possibility historically, it's not
clear that anyone needs it anymore. Instead, other mechanisms can
be used by embedders to indicate aspects of objects.

Closes tc39#1440
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants