public class ScopeEcmascriptDebugger extends AbstractEcmascriptService implements EcmascriptDebugger
activeWindowId, currentFramePath, driver, retries, sleepDuration, windowManagerservicesSERVICE_NAME| Constructor and Description |
|---|
ScopeEcmascriptDebugger(ScopeServices services,
String requiredVersion) |
| Modifier and Type | Method and Description |
|---|---|
void |
addRuntime(EsdbgProtos.RuntimeInfo runtime)
Adds a runtime to the list of runtimes maintained in the service (STP/1 only)
|
protected EsdbgProtos.EvalData.Builder |
buildEval(String using,
int runtimeId) |
protected EsdbgProtos.EvalData.Variable |
buildVariable(String name,
int objectId) |
String |
callFunctionOnObject(String using,
int objectId)
The script to be executed on/using an object
|
Object |
callFunctionOnObject(String using,
int objectId,
boolean responseExpected) |
void |
changeRuntime(int index)
Changes the frame by index
|
void |
changeRuntime(String frameName)
Changes the frame by frame name address nested frames by dot (first.second)
|
void |
cleanUpRuntimes(int windowId)
Cleanup possible dead/suspended runtimes on runtime-started or window-closed
|
protected void |
createAllRuntimes()
Gets a list of runtimes and keeps the list, create runtimes for all pages so even if the pages
don't have script we can still inject to a "fake" runtime.
|
protected UmsProtos.Response |
eval(String using,
EsdbgProtos.EvalData.Variable... variables) |
protected UmsProtos.Response |
eval(String using,
int runtimeId,
EsdbgProtos.EvalData.Variable... variables) |
List<Integer> |
examineObjects(Integer id)
Request additional information about an object, such as its prototype or its properties.
|
Object |
examineScriptResult(Integer id)
Recursively iterates through the property hierarchies of underneath the given object and
unwraps the node elements into suitable types.
|
String |
executeJavascript(String using,
Integer windowId)
Executes an arbitrary block of JavaScript on a given window, and returns the result of the
evaluation.
|
Object |
executeScript(String using,
boolean responseExpected)
Executes a script and returns the response (based on responseExpected)
|
Object |
executeScript(String using,
boolean responseExpected,
int runtimeId) |
Integer |
executeScriptOnObject(String using,
int objectId) |
protected EsdbgProtos.RuntimeInfo |
findRuntime()
Find the runtime for injection (default) Typically this is _top runtime with the active window
that has focus
|
protected EsdbgProtos.RuntimeInfo |
findRuntime(int windowId) |
Integer |
getObject(String using)
Gets the object id using a script
|
protected Integer |
getObject(String using,
int runtimeId) |
int |
getRuntimeId()
Get the current runtime ID.
|
void |
init()
Initialize the debugger, set the configuration to NOT stop on error, exception, script or abort
Create all runtimes and find a suitable runtime for injection (Currently has a workaround or
'return 1;' for GOGI dialog at opera:debug)
|
List<String> |
listFramePaths()
Lists the frame paths of available runtimes
|
protected List<EsdbgProtos.RuntimeInfo> |
listRuntimes(boolean allRuntimes) |
protected Object |
parseEvalReply(EsdbgProtos.EvalResult result)
Parses a reply and returns the following types String presentation of number, boolean or
string.
|
protected Object |
parseValue(String dataType,
String value) |
void |
readyStateChanged(EcmascriptProtos.ReadyStateChange change)
Triggered on the ecmascript service when the state of a runtime changes
|
void |
releaseObject(int objectId)
Releases a specific object
|
void |
releaseObjects()
Makes objects available to gc, this doesn't free the objects immediately
|
void |
removeRuntime(int runtimeId)
Removes a runtime from the list, doesnt get called often due to runtime-stopped being sent late
(runtimes get suspended)
|
void |
resetFramePath()
Resets the frame path context to the top level frame and reinitializes the debugger runtime.
|
void |
resetRuntimesList()
Resets the list of runtimes and fetches a fresh list from Opera, this can be used to recover in
cases where runtimes go out of sync
|
Object |
scriptExecutor(String script,
Object... params)
Executes the given javascript via eval call
|
void |
setFormElementValue(int objectId,
String value)
Set value of a form element.
|
void |
setRuntime(EsdbgProtos.RuntimeInfo runtime)
Sets the runtime to be used in injection required for event handler (STP/1 only)
|
boolean |
updateRuntime()
Finds a valid runtime and updates the runtime reference (active runtime)
|
buildEvalString, cleanUpRuntimes, executeJavascript, executeJavascript, isNumber, isScriptInjectable, parseNumber, processArgument, recover, resetCounters, setDriverbuildPayload, executeMessage, executeMessage, executeMessage, getServiceName, getServiceVersion, isVersionInRange, sleep, toString, xpathIterator, xpathPointerclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcleanUpRuntimes, executeJavascript, executeJavascript, isScriptInjectable, setDrivergetServiceName, getServiceVersionpublic ScopeEcmascriptDebugger(ScopeServices services, String requiredVersion)
public int getRuntimeId()
DebuggergetRuntimeId in interface Debuggerpublic void setRuntime(EsdbgProtos.RuntimeInfo runtime)
DebuggersetRuntime in interface Debuggerpublic void addRuntime(EsdbgProtos.RuntimeInfo runtime)
DebuggeraddRuntime in interface Debuggerpublic void removeRuntime(int runtimeId)
DebuggerremoveRuntime in interface Debuggerpublic void init()
public boolean updateRuntime()
DebuggerupdateRuntime in interface Debuggerprotected List<EsdbgProtos.RuntimeInfo> listRuntimes(boolean allRuntimes)
protected void createAllRuntimes()
public Object scriptExecutor(String script, Object... params)
DebuggerscriptExecutor in interface Debuggerscript - the script to be executed on hostparams - array of params, can be string, long or web element(s)protected final EsdbgProtos.EvalData.Builder buildEval(String using, int runtimeId)
protected final EsdbgProtos.EvalData.Variable buildVariable(String name, int objectId)
protected UmsProtos.Response eval(String using, int runtimeId, EsdbgProtos.EvalData.Variable... variables)
protected UmsProtos.Response eval(String using, EsdbgProtos.EvalData.Variable... variables)
public Object executeScript(String using, boolean responseExpected)
DebuggerexecuteScript in interface Debuggerusing - the script to be injectedresponseExpected - the flag to enable/disable parsing responsenull otherwisepublic Integer getObject(String using)
Debuggerpublic String callFunctionOnObject(String using, int objectId)
DebuggercallFunctionOnObject in interface Debuggerusing - script with reference to the object "locator"objectId - the object to be used for injectionpublic Object callFunctionOnObject(String using, int objectId, boolean responseExpected)
callFunctionOnObject in interface Debuggerpublic Integer executeScriptOnObject(String using, int objectId)
executeScriptOnObject in interface Debuggerprotected Object parseEvalReply(EsdbgProtos.EvalResult result)
protected EsdbgProtos.RuntimeInfo findRuntime()
protected EsdbgProtos.RuntimeInfo findRuntime(int windowId)
public void changeRuntime(int index)
DebuggerchangeRuntime in interface Debuggerpublic void changeRuntime(String frameName)
DebuggerchangeRuntime in interface Debuggerpublic void cleanUpRuntimes(int windowId)
DebuggercleanUpRuntimes in interface Debuggerpublic List<Integer> examineObjects(Integer id)
DebuggerexamineObjects in interface Debuggerid - object ID previously returned from an eval call to the debuggerpublic List<String> listFramePaths()
DebuggerlistFramePaths in interface DebuggerList of String framepathspublic void releaseObjects()
DebuggerreleaseObjects in interface Debuggerpublic void resetRuntimesList()
DebuggerresetRuntimesList in interface Debuggerpublic void readyStateChanged(EcmascriptProtos.ReadyStateChange change)
DebuggerreadyStateChanged in interface Debuggerchange - EcmascriptProtos.ReadyStateChange
object with runtime infopublic void releaseObject(int objectId)
DebuggerreleaseObject in interface DebuggerobjectId - Id of the object to be releasedpublic void resetFramePath()
DebuggerresetFramePath in interface Debuggerpublic String executeJavascript(String using, Integer windowId)
DebuggerexecuteJavascript in interface Debuggerusing - the code to evaluatewindowId - the runtime ID, previously retrieved from the WindowManagerpublic Object examineScriptResult(Integer id)
DebuggerOperaWebElement's, arrays into
Java List's, hashes into Map's, numbers into Integer's, and
the remaining properties into String's.examineScriptResult in interface Debuggerid - the object to examine the hierarchy ofpublic void setFormElementValue(int objectId,
String value)
DebuggersetFormElementValue in interface DebuggerobjectId - the ID of the object to set valuevalue - the value to setCopyright © 2013. All Rights Reserved.