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:
java.io.Serializable
,java.lang.Cloneable
,org.htmlunit.corejs.javascript.ConstProperties
,org.htmlunit.corejs.javascript.debug.DebuggableObject
,org.htmlunit.corejs.javascript.Scriptable
,org.htmlunit.corejs.javascript.SymbolScriptable
,WindowOrWorkerGlobalScope
public class DedicatedWorkerGlobalScope extends EventTarget implements WindowOrWorkerGlobalScope
The scope for the execution ofWorker
s.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.commons.logging.Log
LOG
private java.lang.String
origin_
private Window
owningWindow_
private Worker
worker_
-
Constructor Summary
Constructors Constructor Description DedicatedWorkerGlobalScope()
For prototype instantiation.DedicatedWorkerGlobalScope(Window owningWindow, org.htmlunit.corejs.javascript.Context context, WebClient webClient, Worker worker)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
atob(java.lang.String encodedData)
Decodes a string of data which has been encoded using base-64 encoding.java.lang.String
btoa(java.lang.String stringToEncode)
Creates a base-64 encoded ASCII string from a string of binary data.(package private) void
executeEvent(org.htmlunit.corejs.javascript.Context cx, MessageEvent event)
org.htmlunit.corejs.javascript.Function
getOnmessage()
Returns theonmessage
event handler.java.lang.Object
getSelf()
Get the scope itself.static void
importScripts(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, java.lang.Object[] args, org.htmlunit.corejs.javascript.Function funObj)
Import external script(s).(package private) void
loadAndExecute(WebClient webClient, java.lang.String url, org.htmlunit.corejs.javascript.Context context, boolean checkMimeType)
(package private) void
messagePosted(java.lang.Object message)
void
postMessage(java.lang.Object message)
Posts a message to theWorker
in the page's context.static java.lang.Object
setInterval(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, java.lang.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.void
setOnmessage(java.lang.Object onmessage)
Sets theonmessage
event handler.static java.lang.Object
setTimeout(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, java.lang.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 org.htmlunit.javascript.host.event.EventTarget
addEventListener, clearEventListenersContainer, dispatchEvent, executeEventLocally, fireEvent, getEventHandler, getEventListenersContainer, hasEventHandlers, isEventHandlerOnWindow, jsConstructor, removeEventListener, setEventHandler
-
Methods inherited from class org.htmlunit.javascript.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, setupRejectedPromise
-
Methods 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
-
-
-
-
Constructor Detail
-
DedicatedWorkerGlobalScope
public DedicatedWorkerGlobalScope()
For prototype instantiation.
-
DedicatedWorkerGlobalScope
DedicatedWorkerGlobalScope(Window owningWindow, org.htmlunit.corejs.javascript.Context context, WebClient webClient, Worker worker) throws java.lang.Exception
Constructor.- Parameters:
webClient
- the WebClientworker
- the started worker- Throws:
java.lang.Exception
- in case of problem
-
-
Method Detail
-
getSelf
public java.lang.Object getSelf()
Get the scope itself.- Returns:
- this
-
getOnmessage
public org.htmlunit.corejs.javascript.Function getOnmessage()
Returns theonmessage
event handler.- Returns:
- the
onmessage
event handler
-
setOnmessage
public void setOnmessage(java.lang.Object onmessage)
Sets theonmessage
event handler.- Parameters:
onmessage
- theonmessage
event handler
-
btoa
public java.lang.String btoa(java.lang.String stringToEncode)
Creates a base-64 encoded ASCII string from a string of binary data.- Specified by:
btoa
in interfaceWindowOrWorkerGlobalScope
- Parameters:
stringToEncode
- string to encode- Returns:
- the encoded string
-
atob
public java.lang.String atob(java.lang.String encodedData)
Decodes a string of data which has been encoded using base-64 encoding.- Specified by:
atob
in interfaceWindowOrWorkerGlobalScope
- Parameters:
encodedData
- the encoded string- Returns:
- the decoded value
-
postMessage
public void postMessage(java.lang.Object message)
Posts a message to theWorker
in the page's context.- Parameters:
message
- the message
-
messagePosted
void messagePosted(java.lang.Object message)
-
executeEvent
void executeEvent(org.htmlunit.corejs.javascript.Context cx, MessageEvent event)
-
importScripts
public static void importScripts(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, java.lang.Object[] args, org.htmlunit.corejs.javascript.Function funObj) throws java.io.IOException
Import external script(s).- Parameters:
cx
- the current contextscope
- the scopethisObj
- this objectargs
- the script(s) to importfunObj
- the JS function called- Throws:
java.io.IOException
- in case of problem loading/executing the scripts
-
loadAndExecute
void loadAndExecute(WebClient webClient, java.lang.String url, org.htmlunit.corejs.javascript.Context context, boolean checkMimeType) throws java.io.IOException
- Throws:
java.io.IOException
-
setTimeout
public static java.lang.Object setTimeout(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, java.lang.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:
- MDN web docs
-
setInterval
public static java.lang.Object setInterval(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, java.lang.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:
- MDN web docs
-
-