<?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>19491</bug_id>
          
          <creation_ts>2012-10-12 01:04:27 +0000</creation_ts>
          <short_desc>There doesn&apos;t appear to be a way to create a worker by name. SharedWorker constructor requires always providing a correct URL.</short_desc>
          <delta_ts>2013-01-29 00:48:58 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#shared-workers</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>ap</cc>
    
    <cc>bugs</cc>
    
    <cc>bzbarsky</cc>
    
    <cc>ian</cc>
    
    <cc>james</cc>
    
    <cc>mike</cc>
    
    <cc>mjs</cc>
    
    <cc>w3c</cc>
    
    <cc>zcorpan</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>76059</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2012-10-12 01:04:27 +0000</bug_when>
    <thetext>Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html
Multipage: http://www.whatwg.org/C#shared-workers
Complete: http://www.whatwg.org/c#shared-workers

Comment:
There doesn&apos;t appear to be a way to create a worker by name. SharedWorker
constructor requires always providing a correct URL.

Posted from: 17.245.107.141
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/536.26.14 (KHTML, like Gecko) Version/6.0.1 Safari/536.26.14</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76060</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2012-10-12 01:05:31 +0000</bug_when>
    <thetext>There is non-normative text that implies that this should be possible: &quot;Shared workers are identified in one of two ways: either by the URL of the script used to create it, or by explicit name. When created by name, the URL used by the first page to create the worker with that name is the URL of the script that will be used for that worker. This allows multiple applications on a domain to all use a single shared worker to provide a common service, without the applications having to keep track of a common URL for the script used to provide the service.&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76532</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-10-17 23:11:29 +0000</bug_when>
    <thetext>Well you have to provide a URL so that if the shared worker doesn&apos;t exist, it can be started, but as far as I can tell what is suggested above works fine. Can you elaborate on what you want to do but can&apos;t do?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76557</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2012-10-18 05:39:34 +0000</bug_when>
    <thetext>Well, it&apos;s just what is quoted from the spec in comment 2: &quot;This allows multiple applications on a domain to all use a single shared worker to provide a common service, without the applications having to keep track of a common URL for the script used to provide the service&quot;

This is not what name is for - AFAICT is sole purpose is to create multiple workers from the same source, not to use a single one without knowing its URL.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76602</commentid>
    <comment_count>4</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-10-18 18:46:20 +0000</bug_when>
    <thetext>As far as I can tell, the purpose is to let multiple applications on the same origin share a common service, with each application having their own copy of the service&apos;s script so that you don&apos;t need to put the service in its own URL space and give that URL to everyone, instead each app can just launch it with their own copy of the service&apos;s script and whichever one is launched first is the one that is used in case multiple apps try to launch it in turn.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76610</commentid>
    <comment_count>5</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2012-10-18 20:03:04 +0000</bug_when>
    <thetext>Step 7.1 says: &quot;If worker global scope&apos;s location attribute represents an absolute URL that is not exactly equal to scriptURL, then throw a URLMismatchError exception and abort all these steps.&quot;

So, we&apos;ll just get an exception in this scenario.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76747</commentid>
    <comment_count>6</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-10-19 20:06:38 +0000</bug_when>
    <thetext>Ah, yes, missed that. You&apos;re saying you want that removed? So long as it&apos;s same-origin, it should work?

(That&apos;s actually the last mention of URLMismatchError, so if we remove that we can also drop that error code.)


Anyone else have an opinion? Should it be possible for two different attempts to start a shared worker to get the same worker even though they used different URLs?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76755</commentid>
    <comment_count>7</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2012-10-19 20:35:45 +0000</bug_when>
    <thetext>I don&apos;t care much. Slightly less work if this doesn&apos;t need to be supported.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82248</commentid>
    <comment_count>8</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2013-01-29 00:31:39 +0000</bug_when>
    <thetext>I think I&apos;d prefer requiring the same URL.
That would lead less surprising results - the &quot;service&quot; ends up running 
the same script always.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82249</commentid>
    <comment_count>9</comment_count>
    <who name="">contributor</who>
    <bug_when>2013-01-29 00:48:58 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r7663.
Check-in comment: Make tutorial match actual requirements.
http://html5.org/tools/web-apps-tracker?from=7662&amp;to=7663</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>