<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>114465</bug_id>
          
          <creation_ts>2013-04-11 14:21:44 -0700</creation_ts>
          <short_desc>[DOM] Non-callback interface objects without [NoInterfaceObject] should be instanceof Function</short_desc>
          <delta_ts>2022-08-15 02:32:26 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>CONFIGURATION CHANGED</resolution>
          
          
          <bug_file_loc>http://dev.w3.org/2006/webapi/WebIDL/#interface-object</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Glenn Adams">glenn</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>apavlov</cc>
    
    <cc>ap</cc>
    
    <cc>arv</cc>
    
    <cc>ashvayka</cc>
    
    <cc>bfulgham</cc>
    
    <cc>cdumez</cc>
    
    <cc>ggaren</cc>
    
    <cc>heycam</cc>
    
    <cc>oliver</cc>
    
    <cc>rniwa</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>874159</commentid>
    <comment_count>0</comment_count>
    <who name="Glenn Adams">glenn</who>
    <bug_when>2013-04-11 14:21:44 -0700</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>874176</commentid>
    <comment_count>1</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2013-04-11 14:40:53 -0700</bug_when>
    <thetext>http://dev.w3.org/2006/webapi/WebIDL/#interface-object

&quot;The internal [[Prototype]] property of an interface object for a callback interface must be the Object.prototype object.&quot;

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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>874189</commentid>
    <comment_count>2</comment_count>
    <who name="Glenn Adams">glenn</who>
    <bug_when>2013-04-11 14:54:34 -0700</bug_when>
    <thetext>(In reply to comment #1)
&gt; http://dev.w3.org/2006/webapi/WebIDL/#interface-object
&gt; 
&gt; &quot;The internal [[Prototype]] property of an interface object for a callback interface must be the Object.prototype object.&quot;
&gt; 
&gt; 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&apos;t seem to apply. What applies is:

(1) &quot;The interface object for a given non-callback interface is a function object.&quot;

(2) &quot;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.&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>874201</commentid>
    <comment_count>3</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2013-04-11 15:08:27 -0700</bug_when>
    <thetext>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&apos;ll file some WebIDL bugs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>874221</commentid>
    <comment_count>4</comment_count>
    <who name="Cameron McCormack (:heycam)">heycam</who>
    <bug_when>2013-04-11 15:23:00 -0700</bug_when>
    <thetext>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 &quot;implement&quot; the interface.

All non-callback interface objects (&quot;non-callback interface&quot; = &quot;interfaces that platform objects can implement&quot;), whether they are declared with [Constructor] or not, are Function objects and are thus callable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>874228</commentid>
    <comment_count>5</comment_count>
    <who name="Cameron McCormack (:heycam)">heycam</who>
    <bug_when>2013-04-11 15:35:04 -0700</bug_when>
    <thetext>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 &quot;x&quot;.  window.Something is not a Function object.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1888435</commentid>
    <comment_count>6</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-08-02 10:23:40 -0700</bug_when>
    <thetext>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!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1891304</commentid>
    <comment_count>7</comment_count>
    <who name="Alexey Shvayka">ashvayka</who>
    <bug_when>2022-08-15 02:32:26 -0700</bug_when>
    <thetext>(In reply to Ahmad Saleem from comment #6)
&gt; Plus Chrome has marked related bug as WONTFIX:
&gt; 
&gt; 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.

&gt; I can see a bug in WPT to add these test but it is still open:
&gt; 
&gt; https://github.com/web-platform-tests/wpt/issues/7184

I&apos;m sure we have a tests of own for this.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>