Closed Clayblockunova closed 3 years ago
This can be useful in IE 10 and 11, where the string representation of self
in web workers is actually "[object WorkerGlobalScope]". In most other browsers it is "[object DedicatedWorkerGlobalScope]".
sorry to bother you again. what is constructor of self
in web worker? is it WorkerGlobalScope()
or DedicatedWorkerGlobalScope
etc.?
It's WorkerGlobalScope
in IE 10+, and it's Object
in older versions of Safari (not sure when it changed). Most newer browsers recognize an additional type of web workers called shared workers. In these browsers, self.constructor
is DedicatedWorkerGlobalScope
in (regular) web workers and SharedWorkerGlobalScope
in shared workers.
Implemented in version 2.31.0.
Sorry to bother you again. In current code, only feature about global constructor
is added (which is OBJECT_W_CTOR
), and (RP_3_WA + self)[11]
still only work as "W" when WINDOW
active. When will you add new feature about existence of "W" at specified place in string representation of self
?
I think that DOMWINDOW
and WINDOW
cover the useful string representations of self
in a browser, including the two positions of "W". Am I missing something?
IE 10 and 11 web worker missing.
Ah okay. Actually the idea is that we don't create features just for web workers, only for the main thread, or for the main thread and web workers, or for the main thread in strict mode, etc. (those are all handles as restrictions to the feature set, not additions). Of course this mechanism could be changed if there is a use case, but it would require a lot of tweaks.
Currently,
(RP_3_WA + self)[11]
only work as "W" when featureWINDOW
available, i.e. outside web worker. if string representation ofself
in web worker is "[object WorkerGlobalScope]", you can add a new feature to make(RP_3_WA + self)[11]
available as "W" in web worker. but, if string representation ofself
in web worker is "[object DedicatedWorkerGlobalScope]" etc.,self
may not be so useful for "W" in web worker.