104
If the algorithm asynchronously completes with null,queue a taskp843
tofire a simple eventp854
namederrorp1154
atworker, and abort
these steps. Otherwise, continue the rest of these steps after the algorithm's asynchronous completion, withscriptbeing the
asynchronous completion value.
10. Associateworkerwithworker global scope.
11. Create a newMessagePortobjectp911
whoseownerp910
isinside settings. Letinside portbe this new object.
12. Associateinside portwithworker global scope.
13. Entanglep911
outside portandinside port.
14. Add toworker global scope's list ofthe worker'sDocumentsp933
theDocumentp103
objects indocs.
15. Ifparent worker global scopeis not null, addworker global scopeto the list ofthe worker's workersp933
ofparent worker global scope.
16. Setworker global scope'stypep930
to the value of thetypemember ofoptions.
17. Ifis sharedis true, and there are anyrelevant application cachesp808
that are identified by a manifest URL with thesame originp769
asurl
and that haveurlas one of their entries,notexcluding entries marked asforeignp807
, then associateworker global scopewith themost
appropriate application cachep808
of those that match.
18. Create a newWorkerLocationp942
object and associate it withworker global scope.
19. Closing orphan workers: Start monitoring the worker such that no sooner than it stops being aprotected workerp934
, and no later than it
stops being apermissible workerp933
,worker global scope'sclosingp933
flag is set to true.
20. Suspending workers: Start monitoring the worker, such that wheneverworker global scope'sclosingp933
flag is false and the worker is a
suspendable workerp934
, the user agent suspends execution of script in that worker until such time as either theclosingp933
flag switches
to true or the worker stops being asuspendable workerp934
.
21. Ifscriptis aclassic scriptp827
, thenrun the classic scriptp832
script. Otherwise, it is amodule scriptp828
;run the module scriptp833
script.
22. Enableoutside port'sport message queuep910
.
23. Ifis sharedis false, enable theport message queuep910
of the worker's implicit port.
24. Ifis sharedis true, create atrustedp44
event that uses theMessageEventp887
interface, with the nameconnectp1154
, which does not
bubble, is not cancelable, has no default action, has adatap887
attribute whose value is initialised to the empty string, has aportsp888
attribute whose value is initialised to a newfrozen array
containinginside port, has asourcep888
attribute whose value is initialised to
inside port.Queue a taskp843
, using theDOM manipulation task sourcep846
, todispatchp44
the event atworker global scope.
25. Event loop: Run theresponsible event loopp828
specified byinside settingsuntil it is destroyed.
26. Empty theworker global scope'slist of active timersp861
.
27. Disentangle all the ports in the list ofthe worker's portsp933
.
28. Empty the worker's list ofthe worker'sDocumentsp933
.
When a user agent is tokill a workerit must run the following stepsin parallelp42
with the worker's main loop (the "run a workerp934
" processing
model defined above):
1. Set the worker'sWorkerGlobalScopep930
object'sclosingp933
flag to true.
2. If there are anytasksp842
queued in theWorkerGlobalScopep930
object'sevent loopp842
'stask queuesp842
, discard them without
processing them.
In addition to the usual possibilities of returning a value or failing due to an exception, this could beprematurely abortedp837
by
the "kill a workerp935
" or "terminate a workerp936
" algorithms defined below.
Note
The handling of events or the execution of callbacks bytasksp842
run by theevent loopp842
might getprematurely abortedp837
by
the "kill a workerp935
" or "terminate a workerp936
" algorithms defined below.
Note
The worker processing model remains on this step until the event loop is destroyed, which happens after theclosingp933
flag is
set to true, as described in theevent loopp842
processing model.
Note
935
Data Matrix C#.NET Integration Tutorial to print Data Matrix using C# BarCode datamatrix.generateBarcodeToByteArray(); //Generate Data Matrix barcodes & Document Imaging SDK and Java Document Imaging
export pdf form data to excel spreadsheet; exporting pdf data to excel
84
3. Wait a user-agent-defined amount of time.
4. Abort the scriptp837
currently running in the worker.
User agents may invoke the "kill a workerp935
" processing model on a worker at any time, e.g. in response to user requests, in response to CPU
quota management, or when a worker stops being anactive needed workerp934
if the worker continues executing even after itsclosingp933
flag was
set to true.
When a user agent is toterminate a workerit must run the following stepsin parallelp42
with the worker's main loop (the "run a workerp934
"
processing model defined above):
1. Set the worker'sWorkerGlobalScopep930
object'sclosingp933
flag to true.
2. If there are anytasksp842
queued in theWorkerGlobalScopep930
object'sevent loopp842
'stask queuesp842
, discard them without
processing them.
3. Abort the scriptp837
currently running in the worker.
4. If the worker'sWorkerGlobalScopep930
object is actually aDedicatedWorkerGlobalScopep931
object (i.e. the worker is a
dedicated worker), then empty theport message queuep910
of the port that the worker's implicit port is entangled with.
Thetask sourcep843
for the tasks mentioned above is theDOM manipulation task sourcep846
.
Whenever an uncaught runtime script error occurs in one of the worker's scripts, if the error did not occur while handling a previous script error, the
user agent mustreport the errorp839
for thatscriptp827
, with the position (line number and column number) where the error occurred, using the
WorkerGlobalScopep930
object as the target.
For shared workers, if the error is stillnot handledp839
afterwards, the error may be reported to a developer console.
For dedicated workers, if the error is stillnot handledp839
afterwards, the user agent mustqueue a taskp843
tofirep44
atrustedp44
event that uses the
ErrorEventp840
interface, with the nameerrorp1154
, that doesn't bubble and is cancelable, with itsmessagep840
,filenamep840
,linenop840
,
colnop840
, attributes initialised appropriately, and with theerrorp840
attribute initialised to null, at theWorkerp938
object associated with the
worker. If the event is not canceled, the user agent must act as if the uncaught runtime script error had occurred in the global scope that the
Workerp938
object is in, thus repeating the entire runtime script error reporting process one level up.
If the implicit port connecting the worker to itsWorkerp938
object has been disentangled (i.e. if the parent worker has been terminated), then the
user agent must act as if theWorkerp938
object had noerrorp1154
event handler and as if that worker'sonerrorp931
attribute was null, but must
otherwise act as described above.
Thetask sourcep843
for the task mentioned above is theDOM manipulation task sourcep846
.
10.2.6.1 TheAbstractWorkerp936
abstract interface
[NoInterfaceObject, Exposed=(Window,Worker)]
interface AbstractWorker {
attribute EventHandler
onerror
;
};
Thus, error reports propagate up to the chain of dedicated workers up to the originalDocumentp103
, even if some of the workers along this
chain have been terminated and garbage collected.
Note
IDL
10.2.5 Runtime script errors
10.2.6 Creating workers
936
Data Matrix Web Server Control for ASP.NET Server Control in IIS (without using Visual Studio Port/datamatrix/datamatrix.aspx? DATA=YourDatainDataMatrix NET Document Imaging SDK and Java Document Imaging
save data in pdf form reader; pdf form field recognition .NET JBIG 2 SDK | Encode & Decode JBIG 2 Images Highly-efficient data/image compression, 2-5 times than CCITT G3, CCITT G4; Simple to reduce PDF file size using JBIG2 compression within PDF;
filling out pdf forms with reader; extract data from pdf form fields
60
The following are theevent handlersp846
(and their correspondingevent handler event typesp847
) that must be supported, asevent handler IDL
attributesp847
, by objects implementing theAbstractWorkerp936
interface:
Event handlerp846
Event handler event typep847
onerror
errorp1154
10.2.6.2 Script settings for workers
When the user agent is required toset up a worker environment settings object, given aJavaScript execution context
execution context, it must
run the following steps:
1. Letinherited responsible browsing contextbe theresponsible browsing contextp828
specified by theincumbent settings objectp836
.
2. Letinherited originbe theoriginp767
specified by theincumbent settings objectp836
.
3. Letworker event loopbe a newly createdevent loopp842
.
4. Letrealmbe the value ofexecution context's Realm component.
5. Letworker global scopeberealm'sglobal objectp834
.
6. Letsettings objectbe a newenvironment settings objectp828
whose algorithms are defined as follows:
Therealm execution contextp828
Returnexecution context.
Themodule mapp838
Returnworker global scope'smodule mapp930
.
Theresponsible browsing contextp828
Returninherited responsible browsing context.
Theresponsible event loopp828
Returnworker event loop.
Theresponsible documentp828
Not applicable (theresponsible event loopp828
is not abrowsing contextp748
event loopp842
).
TheAPI URL character encodingp828
Return UTF-8.
TheAPI base URLp828
Returnworker global scope'surlp930
.
Theoriginp767
Returninherited origin.
Thecreation URLp828
Returnworker global scope'surlp930
.
TheHTTPS statep829
Returnworker global scope'sHTTPS statep930
.
Thereferrer policy
Returnworker global scope'sreferrer policyp930
.
7. Setrealm's [[HostDefined]] field tosettings object.
8. Returnsettings object.
937
69
10.2.6.3 Dedicated workers and theWorkerp938
interface
[Constructor
(DOMString scriptURL, optional l WorkerOptions
options), Exposed=(Window,Worker)]
interface Worker : EventTarget
{
void terminate
();
void postMessage
(any message, optional sequence<object
> transfer = []);
attribute EventHandler
onmessage
;
};
dictionary WorkerOptions {
WorkerType
type = "classic";
RequestCredentials
credentials = "omit"; // credentials is only used if type is "module"
};
enum WorkerType { "classic", "module" };
Worker
implements AbstractWorker
;
Theterminate()method, when invoked, must cause the "terminate a workerp936
" algorithm to be run on the worker with which the object is
associated.
Workerp938
objects act as if they had an implicitMessagePortp910
associated with them. This port is part of a channel that is set up when the
worker is created, but it is not exposed. This object must never be garbage collected before theWorkerp938
object.
All messages received by that port must immediately be retargeted at theWorkerp938
object.
ThepostMessage()method onWorkerp938
objects must act as if, when invoked, it immediately invokedthe method of the same namep911
on the
port, with the same arguments, and returned the same return value.
The following are theevent handlersp846
(and their correspondingevent handler event typesp847
) that must be supported, asevent handler IDL
attributesp847
, by objects implementing theWorkerp938
interface:
Event handlerp846
Event handler event typep847
onmessage
messagep1155
When theWorker(scriptURL, options)constructor is invoked, the user agent must run the following steps:
worker= newWorkerp938(scriptURL[,options])
Returns a newWorkerp938
object.scriptURLwill be fetched and executed in the background, creating a new global environment for
whichworkerrepresents the communication channel.optionscan be used to ensure this new global environment supports JavaScript
modules (specifytype: "module") and if that is specified, can also be used to specify howscriptURLis fetched through the
credentialsoption.
worker.terminatep938()
Abortsworker's associated global environment.
worker.postMessagep938(message[,transfer])
Clonesmessageand transmits it toworker's global environment.transfercan be passed as a list of objects that are to be transfered
rather than cloned.
Note
ThepostMessage()p938
method's first argument can be structured data:
worker.postMessage({opcode: 'activate', device: 1938, parameters: [23, 102]});
Example
IDL
938
79
1. The user agent may throw a"SecurityError"
DOMException
and abort these steps if the request violates a policy decision (e.g. if
the user agent is configured to not allow the page to start dedicated workers).
2. Parsep87
thescriptURLargument relative to theentry settings objectp836
.
3. If this fails, throw a"SyntaxError"
DOMException
and abort these steps.
4. Letworker URLbe theresulting URL recordp87
.
5. Letoutside settingsbe theincumbent settings objectp836
.
6. Letworkerbe a newWorkerp938
object.
7. Create a newMessagePortobjectp911
whoseownerp910
isoutside settings. Let this be theoutside port.
8. Associate theoutside portwithworker.
9. Letdocsbe thelist of relevantDocumentobjects to addp933
givenoutside settings.
10. Returnworker, and run the following stepin parallelp42
.
11. Run a workerp934
givenworker,worker URL,outside settings,outside port, andoptions.
10.2.6.4 Shared workers and theSharedWorkerp939
interface
[Constructor
(DOMString scriptURL, optional DOMString name = "", optional l WorkerOptions
options),
Exposed=(Window,Worker)]
interface SharedWorker : : EventTarget
{
readonly attribute MessagePort
port
;
};
SharedWorker
implements AbstractWorker
;
Theportattribute must return the value it was assigned by the object's constructor. It represents theMessagePortp910
for communicating with the
shared worker.
When theSharedWorker(scriptURL, name, options)constructor is invoked, the user agent must run the following steps:
1. The user agent may throw a"SecurityError"
DOMException
and abort these steps if the request violates a policy decision (e.g. if
the user agent is configured to not allow the page to start shared workers).
2. Parsep87
scriptURLrelative to theentry settings objectp836
.
3. If this fails, throw a"SyntaxError"
DOMException
and abort these steps.
4. LeturlStringbe theresulting URL stringp87
andurlRecordbe theresulting URL recordp87
.
Anysame-originp769
URL will do, includingblob:
URLs.
Note
sharedWorker= newSharedWorkerp939(scriptURL[,name[,options]])
Returns a newSharedWorkerp939
object.scriptURLwill be fetched and executed in the background, creating a new global environment
for whichsharedWorkerrepresents the communication channel.namecan be used to define thenamep932
of that global environment.
optionscan be used to ensure this new global environment supports JavaScript modules (specifytype: "module") and if that is
specified, can also be used to specify howscriptURLis fetched through thecredentialsoption.
sharedWorker.portp939
ReturnssharedWorker'sMessagePortp910
object which can be used to communicate with the global environment.
Note
Anysame-originp769
URL will do, includingblob:
URLs.
Note
IDL
939
75
5. Letoutside settingsbe theincumbent settings objectp836
.
6. Execute the following substeps atomically:
1. Letworkerbe a newSharedWorkerp939
object.
2. Create a newMessagePortobjectp911
whoseownerp910
isoutside settings. Let this be theoutside port.
3. Assignoutside portto theportp939
attribute ofworker.
4. Letworker global scopebe null.
5. If there exists aSharedWorkerGlobalScopep932
object whoseclosingp933
flag is false, whosenamep932
is exactly equal to
name, and whoseconstructor urlp932
is equal tourlString, then letworker global scopebe that
SharedWorkerGlobalScopep932
object.
6. Ifworker global scopeis not null, but the user agent has been configured to disallow communication between the worker
represented by theworker global scopeand thescriptsp827
whosesettings objectp827
isoutside settings, then setworker
global scopeto null.
7. Ifworker global scopeis not null, then run these steps:
1. Associateworkerwithworker global scope.
2. Letsettings objectbe therelevant settings objectp837
forworker global scope.
3. Create a newMessagePortobjectp911
whoseownerp910
issettings object. Let this be theinside port.
4. Entanglep911
outside portandinside port.
5. Create atrustedp44
event that uses theMessageEventp887
interface, with the nameconnectp1154
, which does
not bubble, is not cancelable, has no default action, has adatap887
attribute whose value is initialised to the
empty string, has aportsp888
attribute whose value is initialised to a newfrozen array
containing only the newly
created port, and has asourcep888
attribute whose value is initialised to the newly created port.Queue a
taskp843
, using theDOM manipulation task sourcep846
, todispatchp44
the event atworker global scope.
6. Add toworker global scope's list ofthe worker'sDocumentsp933
thelist of relevantDocumentobjects to addp933
givenoutside settings.
7. Ifoutside settings'sglobal objectp834
is aWorkerGlobalScopep930
object, addworker global scopeto the list of
the worker's workersp933
ofoutside settings'sglobal objectp834
.
8. Returnworkerand abort all these steps.
7. Returnworkerand perform the remaining stepsin parallelp42
.
8. Run a workerp934
givenworker,urlRecord,outside settings,outside port, andoptions.
[NoInterfaceObject, Exposed=(Window,Worker)]
interface NavigatorConcurrentHardware {
readonly attribute unsigned long long g hardwareConcurrency
;
};
For example, a user agent could have a development mode that isolates a particulartop-level browsing contextp749
from all other pages, and scripts in that development mode could be blocked from connecting to shared workers
running in the normal browser mode.
Note
Note
IDL
10.2.7 Concurrent hardware capabilities
940
Documents you may be interested
Documents you may be interested