<?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>22646</bug_id>
          
          <creation_ts>2013-07-11 20:33:48 +0000</creation_ts>
          <short_desc>So if we want to say on a per-object basis whether it ought to be exposed to workers (which I think is useful) lets introduce &quot;exposed to document environments&quot;, &quot;exposed to worker environments&quot;, and  [...]</short_desc>
          <delta_ts>2017-12-06 11:29:20 +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>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>[v1]</status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>22705</blocked>
    
    <blocked>23780</blocked>
    
    <blocked>24218</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Cameron McCormack">cam</assigned_to>
          <cc>annevk</cc>
    
    <cc>cam</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>Ms2ger</cc>
    
    <cc>public-script-coord</cc>
    
    <cc>travil</cc>
    
    <cc>w3c</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>90648</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2013-07-11 20:33:48 +0000</bug_when>
    <thetext>Specification: http://www.whatwg.org/specs/web-apps/current-work/
Multipage: http://www.whatwg.org/C#exposed-to-javascript
Complete: http://www.whatwg.org/c#exposed-to-javascript
Referrer: 

Comment:
So if we want to say on a per-object basis whether it ought to be exposed to
workers (which I think is useful) lets introduce &quot;exposed to document
environments&quot;, &quot;exposed to worker environments&quot;, and &quot;exposed to document and
worker environments&quot; as shorthands.

Posted from: 66.207.208.98
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.3 Safari/537.36</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90649</commentid>
    <comment_count>1</comment_count>
    <who name="Marcos Caceres">w3c</who>
    <bug_when>2013-07-11 20:37:36 +0000</bug_when>
    <thetext>sounds useful.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90653</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-07-11 21:29:17 +0000</bug_when>
    <thetext>we could just have [Exposed=Worker], [Exposed=Window] (default), [Exposed=Window,Worker]</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>91167</commentid>
    <comment_count>3</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-07-23 22:54:52 +0000</bug_when>
    <thetext>Reassigning to heycam for consideration in WebIDL. Please reassign to me once either there is WebIDL syntax for this or it&apos;s been decided to only do this in prose, not WebIDL. Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>91171</commentid>
    <comment_count>4</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-07-23 23:06:32 +0000</bug_when>
    <thetext>Comment 2 can be tied with the new [Global] extended attribute I think.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96633</commentid>
    <comment_count>5</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-11-21 12:48:51 +0000</bug_when>
    <thetext>This should also support having a class exposed on both and then have a partial class supported on just one.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98928</commentid>
    <comment_count>6</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2014-01-23 03:35:49 +0000</bug_when>
    <thetext>Just looking at this again now.  Would [Exposed] only control whether an interface object is visible or not?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98946</commentid>
    <comment_count>7</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-01-23 15:43:16 +0000</bug_when>
    <thetext>What I have been wanting to do is things like this:

[Exposed=Window,Worker] interface XMLHttpRequest { ... }

[Exposed=Window] partial interface XMLHttpRequest { ... responseXML ... }

So it would be more than that if I had my way.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98956</commentid>
    <comment_count>8</comment_count>
    <who name="Travis Leithead [MSFT]">travil</who>
    <bug_when>2014-01-23 19:29:03 +0000</bug_when>
    <thetext>Do we need more fine-grained management? For example, the Web Perf WG asked about including only _some_ APIs on their window.performance object, but not others (e.g., performance.now() everywhere, but not necessarily the statistics objects...)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98958</commentid>
    <comment_count>9</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2014-01-23 21:01:20 +0000</bug_when>
    <thetext>It should be fine to allow [Exposed] on partial interfaces, as well as on individual interface members if that&apos;s needed.  But in terms of actual concrete effects, is hiding/exposing the interface object property on the global the only thing that needs to be done?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98959</commentid>
    <comment_count>10</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-01-23 21:18:53 +0000</bug_when>
    <thetext>Yeah I think so. That&apos;s all that interface XMLHttpRequest {} does after all. This is just a way to scope that to particular globals.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98984</commentid>
    <comment_count>11</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2014-01-24 07:05:18 +0000</bug_when>
    <thetext>https://github.com/heycam/webidl/commit/b38006ce3682fc07c1be52a49130bea5e42e7c78

Summary:
  * Window should change its [Global] to [PrimaryGlobal]
  * the [Global] on SharedWorkerGlobalScope and DedicatedWorkerGlobalScope
    should become [Global=Worker]
  * you can use [Exposed=Worker] or [Exposed=Window,Worker] as appropriate
    on interfaces, interface members, partial interfaces, and dictionaries
    that have constructors.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99018</commentid>
    <comment_count>12</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-01-24 18:05:54 +0000</bug_when>
    <thetext>Cameron, can we tag [Global=Worker,DedicatedWorker]? It seems we need granularity like that for certain features. Especially with the new ServiceWorkerGlobalScope.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99092</commentid>
    <comment_count>13</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2014-01-25 23:29:26 +0000</bug_when>
    <thetext>Sure:

https://github.com/heycam/webidl/commit/3aa9313b571b7f4b86846cc025d0f7e967eea1b1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99183</commentid>
    <comment_count>14</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-01-27 19:45:18 +0000</bug_when>
    <thetext>heycam: Why do you have this restriction?:

# If [Exposed] appears on an overloaded operation, then it must appear on all 
# overloads, with the same identifier list.

Consider e.g. APIs that in workers take a string or an integer, but in Windows take a string, an integer, or a DOM node.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99198</commentid>
    <comment_count>15</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2014-01-27 21:19:38 +0000</bug_when>
    <thetext>It would have been a bigger change to allow the set of operations that are involved in overloading to be different, so I decided to disallow it until we&apos;re sure we need it.  Do we need it? :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99213</commentid>
    <comment_count>16</comment_count>
    <who name="">contributor</who>
    <bug_when>2014-01-27 23:09:08 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r8425.
Check-in comment: Update the spec to say what&apos;s exposed to workers: take 1
http://html5.org/tools/web-apps-tracker?from=8424&amp;to=8425</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99214</commentid>
    <comment_count>17</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-01-27 23:14:48 +0000</bug_when>
    <thetext>Ok, I welcome review of the above. I&apos;m especially interested in how I used it here, where there&apos;s an attribute with a different definition for workers than it has for Window:

   http://whatwg.org/html/#the-messageevent-interfaces</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99233</commentid>
    <comment_count>18</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2014-01-28 00:44:05 +0000</bug_when>
    <thetext>(In reply to Ian &apos;Hixie&apos; Hickson from comment #17)
&gt; Ok, I welcome review of the above. I&apos;m especially interested in how I used
&gt; it here, where there&apos;s an attribute with a different definition for workers
&gt; than it has for Window:
&gt; 
&gt;    http://whatwg.org/html/#the-messageevent-interfaces

Ah so that is a problem, I guess.  Currently I disallow any duplicate attribute names on an interface, not looking at [Exposed].  Given that the dictionary still has the union, and that as with XHR.send() still having Document in the types is OK, do you need to split the attribute in two here?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99352</commentid>
    <comment_count>19</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-01-28 20:34:22 +0000</bug_when>
    <thetext>I guess not? But shouldn&apos;t it be non-conforming for me to have an attribute that returns an interface type that isn&apos;t exposed?

The dictionary is fine because the interface isn&apos;t exposed so you can&apos;t possibly set the dictionary to a value that uses the interface. But the attribute in theory could be used by a user agent in a way that returns that interface even in a worker, despite the interface not being exposed... I dunno, it just seemed like something that should be done for completeness.

How about this, is this ok?:</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99353</commentid>
    <comment_count>20</comment_count>
    <who name="">contributor</who>
    <bug_when>2014-01-28 20:34:34 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r8430.
Check-in comment: Try doing this a different way (MessageEvent.source exposure)
http://html5.org/tools/web-apps-tracker?from=8429&amp;to=8430</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99355</commentid>
    <comment_count>21</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-01-28 20:38:26 +0000</bug_when>
    <thetext>That approach does not work for FormData of which the constructor takes a HTMLFormElement. Given that FormData is exposed in Window and Worker I think it should be okay if HTMLFormElement ends up being impossible in the Worker context.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99356</commentid>
    <comment_count>22</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-01-28 21:35:46 +0000</bug_when>
    <thetext>For arguments, I don&apos;t think there&apos;s a problem with just exposing them everywhere. It&apos;s black-box indistinguishable from not exposing them (unless it&apos;s a constructor that only takes unexposed types, since then it&apos;d be uncallable, but I&apos;m not aware of any such cases). It&apos;s return values I&apos;m more worried about.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99379</commentid>
    <comment_count>23</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2014-01-29 00:56:01 +0000</bug_when>
    <thetext>(In reply to contributor from comment #20)
&gt; Checked in as WHATWG revision r8430.
&gt; Check-in comment: Try doing this a different way (MessageEvent.source
&gt; exposure)
&gt; http://html5.org/tools/web-apps-tracker?from=8429&amp;to=8430

This has the same problems; the checking of duplicate attribute (and operation) identifiers is done on the whole set of members, not looking at [Exposed].

How about I just add a conformance requirement that says for an object associated with a global with a particular global name, only objects with interfaces that are exposed in that global may be returned?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99426</commentid>
    <comment_count>24</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-01-29 17:55:37 +0000</bug_when>
    <thetext>That would work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99459</commentid>
    <comment_count>25</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-01-30 02:41:43 +0000</bug_when>
    <thetext>Ok, I&apos;ve moved MessageEvent.source back. I think that concludes everything that I need to do for this bug. Sending back to heycam for the comment 23 update.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99460</commentid>
    <comment_count>26</comment_count>
    <who name="">contributor</who>
    <bug_when>2014-01-30 02:41:55 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r8444.
Check-in comment: Ok, go back to exposing MessageEvent.source in one form everywhere, relying on WebIDL for the rest of the logic here
http://html5.org/tools/web-apps-tracker?from=8443&amp;to=8444</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129001</commentid>
    <comment_count>27</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2017-12-06 11:29:20 +0000</bug_when>
    <thetext>The way we do this is by checking the current global object, defined in HTML. See https://xhr.spec.whatwg.org/ for an example if you need this.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>