Class DedicatedWorkerGlobalScope
java.lang.Object
org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.javascript.HtmlUnitScriptable
org.htmlunit.javascript.host.event.EventTarget
org.htmlunit.javascript.host.worker.DedicatedWorkerGlobalScope
- All Implemented Interfaces:
Serializable, Cloneable, org.htmlunit.corejs.javascript.ConstProperties, org.htmlunit.corejs.javascript.debug.DebuggableObject, org.htmlunit.corejs.javascript.Scriptable, org.htmlunit.corejs.javascript.SymbolScriptable, WindowOrWorkerGlobalScope
The scope for the execution of
Workers.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.apache.commons.logging.Logprivate final Stringprivate final Windowprivate final WorkerFields inherited from class org.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONSTFields inherited from interface org.htmlunit.corejs.javascript.Scriptable
NOT_FOUND -
Constructor Summary
ConstructorsConstructorDescriptionFor prototype instantiation.DedicatedWorkerGlobalScope(Window owningWindow, org.htmlunit.corejs.javascript.Context context, WebClient webClient, Worker worker) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionDecodes a string of data which has been encoded using base-64 encoding.Creates a base-64 encoded ASCII string from a string of binary data.(package private) voidexecuteEvent(org.htmlunit.corejs.javascript.Context cx, MessageEvent event) org.htmlunit.corejs.javascript.FunctionReturns theonmessageevent handler.getSelf()Get the scope itself.static voidimportScripts(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function funObj) Import external script(s).(package private) voidloadAndExecute(WebClient webClient, String url, org.htmlunit.corejs.javascript.Context context, boolean checkMimeType) (package private) voidmessagePosted(Object message) voidpostMessage(Object message) Posts a message to theWorkerin the page's context.static ObjectsetInterval(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function function) Sets a chunk of JavaScript to be invoked each time a specified number of milliseconds has elapsed.voidsetOnmessage(Object onmessage) Sets theonmessageevent handler.static ObjectsetTimeout(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function function) Sets a chunk of JavaScript to be invoked at some specified time later.Methods inherited from class EventTarget
addEventListener, clearEventListenersContainer, dispatchEvent, executeEventLocally, fireEvent, getEventHandler, getEventListenersContainer, hasEventHandlers, isEventHandlerOnWindow, jsConstructor, removeEventListener, setEventHandlerMethods inherited from class HtmlUnitScriptable
clone, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getWindow, getWindow, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setDomNode, setParentScope, setupPromise, setupRejectedPromiseMethods inherited from class org.htmlunit.corejs.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setPrototype, size
-
Field Details
-
LOG
private static final org.apache.commons.logging.Log LOG -
owningWindow_
-
origin_
-
worker_
-
-
Constructor Details
-
DedicatedWorkerGlobalScope
public DedicatedWorkerGlobalScope()For prototype instantiation. -
DedicatedWorkerGlobalScope
-
-
Method Details
-
getSelf
-
getOnmessage
public org.htmlunit.corejs.javascript.Function getOnmessage()Returns theonmessageevent handler.- Returns:
- the
onmessageevent handler
-
setOnmessage
Sets theonmessageevent handler.- Parameters:
onmessage- theonmessageevent handler
-
btoa
Creates a base-64 encoded ASCII string from a string of binary data.- Specified by:
btoain interfaceWindowOrWorkerGlobalScope- Parameters:
stringToEncode- string to encode- Returns:
- the encoded string
-
atob
Decodes a string of data which has been encoded using base-64 encoding.- Specified by:
atobin interfaceWindowOrWorkerGlobalScope- Parameters:
encodedData- the encoded string- Returns:
- the decoded value
-
postMessage
-
messagePosted
-
executeEvent
-
importScripts
public static void importScripts(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function funObj) throws IOException Import external script(s).- Parameters:
cx- the current contextscope- the scopethisObj- this objectargs- the script(s) to importfunObj- the JS function called- Throws:
IOException- in case of problem loading/executing the scripts
-
loadAndExecute
void loadAndExecute(WebClient webClient, String url, org.htmlunit.corejs.javascript.Context context, boolean checkMimeType) throws IOException - Throws:
IOException
-
setTimeout
public static Object setTimeout(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function function) Sets a chunk of JavaScript to be invoked at some specified time later. The invocation occurs only if the window is opened after the delay and does not contain another page than the one that originated the setTimeout.- Parameters:
context- the JavaScript contextscope- the scopethisObj- the scriptableargs- the arguments passed into the methodfunction- the function- Returns:
- the id of the created timer
- See Also:
-
setInterval
public static Object setInterval(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function function) Sets a chunk of JavaScript to be invoked each time a specified number of milliseconds has elapsed.- Parameters:
context- the JavaScript contextscope- the scopethisObj- the scriptableargs- the arguments passed into the methodfunction- the function- Returns:
- the id of the created interval
- See Also:
-