<?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>25390</bug_id>
          
          <creation_ts>2014-04-18 08:42:04 +0000</creation_ts>
          <short_desc>Use [Exposed] in IDL</short_desc>
          <delta_ts>2014-10-22 20:51:28 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Web Cryptography</product>
          <component>Web Cryptography API Document</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="Anne">annevk</reporter>
          <assigned_to name="Ryan Sleevi">sleevi</assigned_to>
          <cc>bzbarsky</cc>
    
    <cc>public-webcrypto</cc>
    
    <cc>virginie.galindo</cc>
    
    <cc>watsonm</cc>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>104075</commentid>
    <comment_count>0</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-04-18 08:42:04 +0000</bug_when>
    <thetext>Instead of Crypto, WorkerCrypto, and RandomSource, have this:

[Exposed=Window,Worker]
interface Crypto {
  readonly attribute SubtleCrypto subtle;
  ArrayBufferView getRandomValues(ArrayBufferView array);
};</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104076</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-04-18 08:42:48 +0000</bug_when>
    <thetext>You probably also need [Exposed] for various other interfaces to make sure they are exposed in workers.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104635</commentid>
    <comment_count>2</comment_count>
    <who name="Ryan Sleevi">sleevi</who>
    <bug_when>2014-04-28 23:59:13 +0000</bug_when>
    <thetext>(In reply to Anne from comment #0)
&gt; Instead of Crypto, WorkerCrypto, and RandomSource, have this:
&gt; 
&gt; [Exposed=Window,Worker]
&gt; interface Crypto {
&gt;   readonly attribute SubtleCrypto subtle;
&gt;   ArrayBufferView getRandomValues(ArrayBufferView array);
&gt; };

This is not equivalent to what is in the spec. According to http://heycam.github.io/webidl/#Exposed , Exposed only applies to an interface if it&apos;s part of the global scope (eg: exposed on the global scope)

Your proposed modifications mean it&apos;s no longer &quot;window.crypto.subtle&quot; or &quot;worker.crypto.subtle&quot;, but instead, &quot;window.subtle&quot;, which is not the same, nor necessarily desirable.

If Crypto was a Constructable-object, yes, it would mean you could do &quot;new Crypto&quot; from the context of a worker - except it&apos;s not.

Unless I&apos;m missing something, isn&apos;t this a WontFix?

(In reply to Anne from comment #1)
&gt; You probably also need [Exposed] for various other interfaces to make sure
&gt; they are exposed in workers.

Did you have any interfaces in mind? None of the interfaces are constructible, which would be the only thing that exposing them would seem of value.

Even still, using [Exposed] would seem wrong, because the global object does *not* implement the interfaces specified.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104656</commentid>
    <comment_count>3</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-04-29 04:01:58 +0000</bug_when>
    <thetext>The behavior of [Exposed] depends on what it&apos;s specified on.

If specified on an interface, then it affects whether the corresponding interface object can be retrieved via a property on the global.

So this:

  [Exposed=Window,Worker]
  interface SubtleCrypto {
   // stuff
  };

would mean that &quot;SubtleCrypto&quot; at global scope gives the relevant interface object in both window scopes and workers.

If specified on an interface member, it controls whether the member is visible in instances of the interface that have the corresponding global.  So:

  interface Crypto {
    [Exposed=Window,Worker]
    readonly attribute SubtleCrypto subtle;
  };

would mean that Crypto instances in both windows and workers would have a .subtle property.

That said, I&apos;m not a huge fan of the way webidl handles lack [Exposed] on interface members right now.  I filed bug 25495 on that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104670</commentid>
    <comment_count>4</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-04-29 09:39:46 +0000</bug_when>
    <thetext>Ryan, [Exposed] != implements.

[Exposed] indicates whether the class/interface is available within a global environment.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105680</commentid>
    <comment_count>5</comment_count>
    <who name="Ryan Sleevi">sleevi</who>
    <bug_when>2014-05-12 06:08:27 +0000</bug_when>
    <thetext>The resolution of Bug 25626 will ultimately leave this as a syntactic sugar between WorkerCrypto, RandomSource, and Crypto, since the only interface remaining will be those three.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105681</commentid>
    <comment_count>6</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-05-12 06:11:17 +0000</bug_when>
    <thetext>It&apos;s not quite syntactic sugar, since Crypto vs WorkerCrypto is easily detectable, right?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113073</commentid>
    <comment_count>7</comment_count>
    <who name="">virginie.galindo</who>
    <bug_when>2014-10-14 09:12:20 +0000</bug_when>
    <thetext>In order to progress towards exit to Last Call for the Web Crypto API, the chair suggests the following resolution for that bug. 

Resolution : Bug RESOLVED as WONTFIX. Based on the estimation that this change would be synthetic sugar. 

If none objects before the 20th of Oct @20:00 UTC, this resolution will be endorsed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113077</commentid>
    <comment_count>8</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-10-14 09:24:47 +0000</bug_when>
    <thetext>Comment 6 pointed out that interpretation was false. Also, you need Exposed if you want anything to appear in workers at all.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113099</commentid>
    <comment_count>9</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-10-14 12:06:44 +0000</bug_when>
    <thetext>Anne is correct.  The spec as written doesn&apos;t actually have any APIs at all in workers.  In Gecko this hasn&apos;t been an issue so far because we don&apos;t support this API in workers yet, but once we start implementing that we will simply be unable to do what the spec currently says.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113100</commentid>
    <comment_count>10</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-10-14 12:12:50 +0000</bug_when>
    <thetext>Here is an updated version of comment 0 to make this easier for the WG:

[NoInterfaceObject]
interface GlobalCrypto {
  readonly attribute Crypto crypto;
};
Window implements GlobalCrypto;
WorkerGlobalScope implements GlobalCrypto;

[Exposed=(Window,Worker)]
interface Crypto {
  readonly attribute SubtleCrypto subtle;
  ArrayBufferView getRandomValues(ArrayBufferView array);
};

[Exposed=(Window,Worker)]
interface SubtleCrypto {
  ...
};

[Exposed=(Window,Worker)]
interface CryptoKey {
  ...
};</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113263</commentid>
    <comment_count>11</comment_count>
    <who name="Mark Watson">watsonm</who>
    <bug_when>2014-10-16 00:18:47 +0000</bug_when>
    <thetext>This makes sense to me. I suggest we go with the proposal in comment#10.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113312</commentid>
    <comment_count>12</comment_count>
    <who name="">virginie.galindo</who>
    <bug_when>2014-10-16 15:07:21 +0000</bug_when>
    <thetext>In order to progress towards exit to Last Call for the Web Crypto API, the chair suggests the following resolution for that bug. 

Resolution : Bug Closed. The editors will implement the suggestion edited in https://www.w3.org/Bugs/Public/show_bug.cgi?id=25390#c10 

If none objects before the 20th of Oct @20:00 UTC, this resolution will be endorsed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113343</commentid>
    <comment_count>13</comment_count>
    <who name="Mark Watson">watsonm</who>
    <bug_when>2014-10-16 18:48:40 +0000</bug_when>
    <thetext>https://dvcs.w3.org/hg/webcrypto-api/rev/810285715051</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>