[whatwg] SharedWorkers and the name parameter

Jonas Sicking jonas at sicking.cc
Tue Aug 18 19:01:24 PDT 2009


On Tue, Aug 18, 2009 at 3:08 PM, Jeremy Orlow<jorlow at chromium.org> wrote:
> On Tue, Aug 18, 2009 at 1:22 PM, Jonas Sicking <jonas at sicking.cc> wrote:
>>
>> On Tue, Aug 18, 2009 at 12:00 AM, Darin Fisher<darin at chromium.org> wrote:
>> > I agree.  Moreover, since a shared worker identified by a given name
>> > cannot
>> > be "navigated" elsewhere, the name isn't all that synonymous with other
>> > usages of names (e.g., window.open).  At the very least, it would seem
>> > helpful to scope the name to the URL to avoid the name conflict issue.
>> > -Darin
>>
>> Technically, that can already be done by using the current the current
>> URL as the name.
>
> I don't quite understand.  Are you suggesting that you can work around this
> by passing the same parameter twice when creating a shared worker?  If so,
> that seems ugly...and a sign that it should be changed.

No, what I mean is that if you want to create a worker shared with
other instances of the same page, without having to worry about
collisions from other pages on your site, you can do:

worker = new SharedWorker("/scripts/workerJSFile.js", document.location);

This way you can be sure that no other page on your site happen to use
the same name.

/ Jonas



More information about the whatwg mailing list