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

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>25495</bug_id>
          
          <creation_ts>2014-04-29 04:01:46 +0000</creation_ts>
          <short_desc>Behavior of no [Exposed] on interface members is weird</short_desc>
          <delta_ts>2017-10-11 21:18:03 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>WebIDL</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></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="Boris Zbarsky">bzbarsky</reporter>
          <assigned_to name="Cameron McCormack">cam</assigned_to>
          <cc>annevk</cc>
    
    <cc>cam</cc>
    
    <cc>ehsan</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>public-script-coord</cc>
    
    <cc>tobie.langel</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>104655</commentid>
    <comment_count>0</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-04-29 04:01:46 +0000</bug_when>
    <thetext>The behavior of interface members with no explicit annotation is:

  the interface member – or a partial interface definition the interface member
  was declared on – was not declared with an [Exposed] extended attribute, and
  the ECMAScript global object implements the primary global interface.

That means that if some interface is exposed in workers, all its members _also_ need to be annotated with [Exposed=Workers] (or be in a partial interface thus annotated).  It would make more sense to me to make exposure be true by default for interface members, so you only need to annotate the ones that shouldn&apos;t be exposed somewhere, no?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107012</commentid>
    <comment_count>1</comment_count>
    <who name="Ehsan Akhgari [:ehsan]">ehsan</who>
    <bug_when>2014-05-30 03:34:50 +0000</bug_when>
    <thetext>I agree with Boris here, I think the current prose results in a weird behavior.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107014</commentid>
    <comment_count>2</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-05-30 04:32:32 +0000</bug_when>
    <thetext>Also, note that we disallow [Exposed] on both a partial interface and one of its members, but do allow it on both an interface and one of its members.

That seems fine to me, for what it&apos;s worth; it means we can expose an interface on both Window and Worker but restrict some of the members to one or the other, while for partial interfaces that sort of thing is not needed because we can just use separate partials for different [Exposed] values.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107015</commentid>
    <comment_count>3</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-05-30 04:44:37 +0000</bug_when>
    <thetext>https://github.com/heycam/webidl/pull/12</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109295</commentid>
    <comment_count>4</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-07-25 20:05:14 +0000</bug_when>
    <thetext>Also, it probably makes no sense to support this:

  [Exposed=Worker]
  interface Foo {
    [Exposed=Window]
    void method();
  };

in that the [Exposed] on interface members should be a subset of the [Exposed] of the interface itself, I believe.  Similarly for:

  [Exposed=Worker]
  interface Foo {};

  [Exposed=Window]
  partial interface Foo {
    void method();
  };</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109399</commentid>
    <comment_count>5</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-07-28 18:25:38 +0000</bug_when>
    <thetext>Also, how should this stuff interact with &quot;implements&quot;?  See NavigatorOnLine.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109416</commentid>
    <comment_count>6</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-07-28 20:27:19 +0000</bug_when>
    <thetext>My preference for this would be that [Exposed] on an interface applies to the interface, that everything on an interface that isn&apos;t annotated with its own [Exposed] is always visible on that interface, and that the UA additionally adds any &quot;implements&quot; and &quot;partial&quot; interfaces that are themselves Exposed appropriately.

So:

  [Exposed=A,B]
  interface Foo {
    void f1();
  };
  Foo implements Bar;

  [Exposed=A]
  partial interface Foo {
    void F2();
  };

  [Exposed=B]
  partial interface Foo {
    void F3();
  };

  [Exposed=A]
  interface Bar {
    void f4();
  };

...would result in an interface Foo in contexts A and B but not C, and in A it would have f1, f2, and f4, while in B it would have f2 and f3.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109458</commentid>
    <comment_count>7</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-07-29 02:48:21 +0000</bug_when>
    <thetext>The simplest way to describe that is probably as follows:

1)  Every interface member has a set of globals where it&apos;s exposed.  If it has an [Exposed] extended attribute this is the set specified in that extended attribute.  Otherwise, if the interface or partial interface it was originally defined on has an [Exposed] extended attribute it is the set specified in that extended attribute.  Otherwise, this set is { &quot;Window&quot; } (though I think ms2ger would prefer to nix this defaulting behavior and just make it an error to not have [Exposed] on an interface).

2)  Every interface that is not [NoInterfaceObject] has a set of globals where it its interface object is a property of the global.  This is given by the [Exposed] extended attribute on the interface, or { &quot;Window&quot; } if there is no such extended attribute.

3)  Optionally, make it an error to have a member of an interface, or one of its consequential interfaces, that is exposed in a global the interface itself is not exposed in.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109466</commentid>
    <comment_count>8</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2014-07-29 07:22:40 +0000</bug_when>
    <thetext>That all sounds good.  How does this look?

https://github.com/heycam/webidl/commit/71a44ff9e1dcb1f467656f71b78f77abbf9427bf
http://heycam.github.io/webidl/#Exposed

The name &quot;exposure set&quot; sounds a bit silly but oh well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109497</commentid>
    <comment_count>9</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-07-29 15:50:04 +0000</bug_when>
    <thetext>&quot;exposure set&quot; seems fine.

The new setup looks great with two caveats:

1)  This bit:

  If [Exposed] appears on both an interface and one of its interface
  members, then the interface member&apos;s exposure set MUST be a subset of
  the interface&apos;s exposure set.

should not require [Exposed] to appear on the interface itself.  In other words, this:

  interface Foo {
    [Exposed=Worker] void method();
  };

should be invalid.

2)  Would it makes sense to require that if A inherits from B then the exposure set of A is a subset of the one for B?  This is not covered by the consequential interfaces bit, since B is not a consequential interface of A.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128917</commentid>
    <comment_count>10</comment_count>
    <who name="Tobie Langel">tobie.langel</who>
    <bug_when>2017-10-11 21:18:03 +0000</bug_when>
    <thetext>This should be fixed in https://github.com/heycam/webidl/pull/433/commits/8900c39</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>