[whatwg] SharedWorkers and the name parameter

Laurence Ph. unkstar at 163.com
Sun Aug 16 19:10:50 PDT 2009


>... Additionally, a typo in one page (i.e. invoking
>SharedWorker("mypagescript?", "name") instead of
>SharedWorker("mypagescript", "name") will keep all subsequent pages in that
>domain from loading a worker under that name so long as the original page
>resides in the page cache.

In this case, if typo one is invoked after a correct one, an URL_MISMATCH_ERR will be thrown in SharedWorker constructor algorithm step 5.4.2.
In the other hand, a 404 will terminate the algorithm and no SharedWorker is created and nothing will be add to global namespace.
I think this example won't be a serious problem anyway, though I'm not sure will this cause other problem or not.

>Use
>    new SharedWorker("url.js#name");
>and if you want a duplicate, call it
>    new SharedWorker("url.js#name2");

This remind me of something:

From sec4.8.3, SharedWorker constructor algorithm step 5.4.2:
If worker global scope's location attribute represents an absolute URL that is not *exactly equal* to the resulting absolute URL, then throw a URL_MISMATCH_ERR exception and abort all these steps.

Seems the #name part will break this line and throw a URL_MISMATCH_ERR with the duplicated #name2 one.
Shall we ignore minor difference between urls? e.g # fragments?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20090817/21174277/attachment-0002.htm>


More information about the whatwg mailing list