WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED CONFIGURATION CHANGED
114465
[DOM] Non-callback interface objects without [NoInterfaceObject] should be instanceof Function
https://bugs.webkit.org/show_bug.cgi?id=114465
Summary
[DOM] Non-callback interface objects without [NoInterfaceObject] should be in...
Glenn Adams
Reported
2013-04-11 14:21:44 PDT
WebIDL 4.4 [1] specifies that non-callback interfaces that are not declared with [NoInterfaceObject] should satisfy: (1) a corresponding property must exist on the ECMAScript global object; (2) the name of the property is the identifier of the interface; (3) its value is an object called the interface object; and (4) the interface object for a given non-callback interface is a function object. In some W3C CSSOM incoming tests [2], one can see how CSSStyleDeclaration is not instanceof Function on Safari, but works on FF and Opera. This extends to other HTML, etc interface types as well. [1]
http://www.w3.org/TR/WebIDL/#es-interfaces
[2]
http://hg.csswg.org/test/raw-file/default/contributors/gadams/incoming/cssom/cssstyledeclaration-interface.xht
See also comments in
bug 114457
.
Attachments
Add attachment
proposed patch, testcase, etc.
Erik Arvidsson
Comment 1
2013-04-11 14:40:53 PDT
http://dev.w3.org/2006/webapi/WebIDL/#interface-object
"The internal [[Prototype]] property of an interface object for a callback interface must be the Object.prototype object." We are plannin to change this in the spirit of ES6 so that the [[Prototype]] points to the super interface object and if there is no such interface object it will point to Function.prototype.
Glenn Adams
Comment 2
2013-04-11 14:54:34 PDT
(In reply to
comment #1
)
>
http://dev.w3.org/2006/webapi/WebIDL/#interface-object
> > "The internal [[Prototype]] property of an interface object for a callback interface must be the Object.prototype object." > > We are plannin to change this in the spirit of ES6 so that the [[Prototype]] points to the super interface object and if there is no such interface object it will point to Function.prototype.
This bug is about non-callback interfaces, so the above doesn't seem to apply. What applies is: (1) "The interface object for a given non-callback interface is a function object." (2) "If an object is defined to be a function object, then it has characteristics as follows: Its [[Prototype]] internal property is the Function prototype object."
Erik Arvidsson
Comment 3
2013-04-11 15:08:27 PDT
I agree that this is the desired behavior but clearly WebIDL has bugs here. The callable interface objects are not instanceof Function, but the non callable are??? I'll file some WebIDL bugs.
Cameron McCormack (:heycam)
Comment 4
2013-04-11 15:23:00 PDT
Maybe callback interfaces and callable interfaces are being confused here. Callback interfaces, i.e. callback interface Something { ... }; never have interface objects, so there is no need to define their interface objects are Function objects or not. Callback interfaces are used so that APIs can call back into native objects that "implement" the interface. All non-callback interface objects ("non-callback interface" = "interfaces that platform objects can implement"), whether they are declared with [Constructor] or not, are Function objects and are thus callable.
Cameron McCormack (:heycam)
Comment 5
2013-04-11 15:35:04 PDT
Sorry, callback interfaces *can* get interface objects, but only when there are consts declared on them. So: callback interface Something { const long x = 1; void f(); }; There exists window.Something, which has a single property "x". window.Something is not a Function object.
Ahmad Saleem
Comment 6
2022-08-02 10:23:40 PDT
I can see a bug in WPT to add these test but it is still open:
https://github.com/web-platform-tests/wpt/issues/7184
Plus Chrome has marked related bug as WONTFIX:
https://bugs.chromium.org/p/chromium/issues/detail?id=230610
Is something needed on Safari end? I jus wanted to update, appreciate if someone update and mark this bug according (similarly bug mentioned in
Comment 0
beside this one)? Thanks!
Alexey Shvayka
Comment 7
2022-08-15 02:32:26 PDT
(In reply to Ahmad Saleem from
comment #6
)
> Plus Chrome has marked related bug as WONTFIX: > >
https://bugs.chromium.org/p/chromium/issues/detail?id=230610
Same comment for WebKit: we match the updated spec (
https://github.com/whatwg/webidl/pull/313
). Even non-constructible interfaces are instances of a Function.
> I can see a bug in WPT to add these test but it is still open: > >
https://github.com/web-platform-tests/wpt/issues/7184
I'm sure we have a tests of own for this.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug