|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.opera.core.systems.scope.AbstractService
com.opera.core.systems.scope.services.ums.EcmaScriptDebugger
public class EcmaScriptDebugger
Manages the ecmascript-debugger service Handles runtime management and script injection
| Field Summary | |
|---|---|
protected int |
activeWindowId
|
protected OperaDriver |
driver
|
protected IWindowManager |
windowManager
|
| Fields inherited from class com.opera.core.systems.scope.AbstractService |
|---|
services |
| Constructor Summary | |
|---|---|
EcmaScriptDebugger(ScopeServices services,
java.lang.String version)
|
|
| Method Summary | |
|---|---|
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(java.lang.String using,
int runtimeId)
|
protected EsdbgProtos.EvalData.Variable |
buildVariable(java.lang.String name,
int objectId)
|
java.lang.String |
callFunctionOnObject(java.lang.String using,
int objectId)
The script to be executed on/using an object |
java.lang.Object |
callFunctionOnObject(java.lang.String using,
int objectId,
boolean responseExpected)
|
void |
changeRuntime(int index)
Changes the frame by index |
void |
changeRuntime(java.lang.String frameName)
Changes the frame by frame name address nested frames by dot (first.second) |
void |
cleanUpRuntimes()
Cleanup runtimes with the active window id |
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 dont have script we can still inject to a 'fake' runtime |
protected UmsProtos.Response |
eval(java.lang.String using,
EsdbgProtos.EvalData.Variable... variables)
|
protected UmsProtos.Response |
eval(java.lang.String using,
int runtimeId,
EsdbgProtos.EvalData.Variable... variables)
|
java.util.List<java.lang.Integer> |
examineObjects(java.lang.Integer id)
|
java.lang.Object |
examineScriptResult(java.lang.Integer id)
|
java.lang.String |
executeJavascript(java.lang.String using)
Execute a script and wait for response |
java.lang.String |
executeJavascript(java.lang.String using,
boolean responseExpected)
Execute a script, this method allows fine tuning of responses, we are not interested in return value in some injections |
java.lang.String |
executeJavascript(java.lang.String using,
java.lang.Integer windowId)
|
java.lang.Object |
executeScript(java.lang.String using,
boolean responseExpected)
Executes a script and returns the response (based on responseExpected) |
java.lang.Object |
executeScript(java.lang.String using,
boolean responseExpected,
int runtimeId)
|
java.lang.Integer |
executeScriptOnObject(java.lang.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)
|
java.lang.Integer |
getObject(java.lang.String using)
Gets the object id using a script |
protected java.lang.Integer |
getObject(java.lang.String using,
int runtimeId)
|
int |
getRuntimeId()
|
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) |
java.util.List<java.lang.String> |
listFramePaths()
Lists the frame paths of available runtimes |
protected java.util.List<EsdbgProtos.RuntimeInfo> |
listRuntimes(boolean allRuntimes)
|
protected java.lang.Object |
parseEvalReply(EsdbgProtos.EvalResult result)
Parses a reply and returns the following types String presentation of number, boolean or string |
protected java.lang.Object |
parseNumber(java.lang.String value)
|
protected java.lang.Object |
parseValue(java.lang.String dataType,
java.lang.String value)
|
protected void |
processArgument(java.lang.Object object,
java.lang.StringBuilder builder,
java.util.List<org.openqa.selenium.WebElement> elements)
|
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()
|
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 |
java.lang.Object |
scriptExecutor(java.lang.String script,
java.lang.Object... params)
Executes the given javascript via eval call |
void |
setDriver(OperaDriver driver)
Set the driver this service belongs to. |
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) |
| Methods inherited from class com.opera.core.systems.scope.AbstractService |
|---|
buildPayload, executeCommand, executeCommand, getVersion, isVersionInRange, sleep, xpathIterator, xpathPointer, xpathQuery |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int activeWindowId
protected final IWindowManager windowManager
protected OperaDriver driver
| Constructor Detail |
|---|
public EcmaScriptDebugger(ScopeServices services,
java.lang.String version)
| Method Detail |
|---|
public void setDriver(OperaDriver driver)
IEcmaScriptDebugger
setDriver in interface IEcmaScriptDebuggerpublic int getRuntimeId()
getRuntimeId in interface IEcmaScriptDebuggerpublic void setRuntime(EsdbgProtos.RuntimeInfo runtime)
IEcmaScriptDebugger
setRuntime in interface IEcmaScriptDebuggerpublic void addRuntime(EsdbgProtos.RuntimeInfo runtime)
IEcmaScriptDebugger
addRuntime in interface IEcmaScriptDebuggerpublic void removeRuntime(int runtimeId)
IEcmaScriptDebugger
removeRuntime in interface IEcmaScriptDebuggerpublic void init()
IEcmaScriptDebugger
init in interface IEcmaScriptDebuggerpublic boolean updateRuntime()
IEcmaScriptDebugger
updateRuntime in interface IEcmaScriptDebuggerprotected java.util.List<EsdbgProtos.RuntimeInfo> listRuntimes(boolean allRuntimes)
protected void createAllRuntimes()
public java.lang.Object scriptExecutor(java.lang.String script,
java.lang.Object... params)
IEcmaScriptDebugger
scriptExecutor in interface IEcmaScriptDebuggerscript - The script to be executed on hostparams - Array of params, can be string, long or web element(s)
protected void processArgument(java.lang.Object object,
java.lang.StringBuilder builder,
java.util.List<org.openqa.selenium.WebElement> elements)
public java.lang.String executeJavascript(java.lang.String using)
IEcmaScriptDebugger
executeJavascript in interface IEcmaScriptDebuggerusing - script to execute
public java.lang.String executeJavascript(java.lang.String using,
boolean responseExpected)
IEcmaScriptDebugger
executeJavascript in interface IEcmaScriptDebuggerusing - script to executeresponseExpected - if true parse the response
protected final EsdbgProtos.EvalData.Builder buildEval(java.lang.String using,
int runtimeId)
protected final EsdbgProtos.EvalData.Variable buildVariable(java.lang.String name,
int objectId)
protected UmsProtos.Response eval(java.lang.String using,
int runtimeId,
EsdbgProtos.EvalData.Variable... variables)
protected UmsProtos.Response eval(java.lang.String using,
EsdbgProtos.EvalData.Variable... variables)
public java.lang.Object executeScript(java.lang.String using,
boolean responseExpected)
IEcmaScriptDebugger
executeScript in interface IEcmaScriptDebuggerusing - The script to be injectedresponseExpected - The flag to enable/disable parsing response
null otherwise
public java.lang.Object executeScript(java.lang.String using,
boolean responseExpected,
int runtimeId)
public java.lang.Integer getObject(java.lang.String using)
IEcmaScriptDebugger
getObject in interface IEcmaScriptDebuggerusing - the script to find the object
protected java.lang.Integer getObject(java.lang.String using,
int runtimeId)
public java.lang.String callFunctionOnObject(java.lang.String using,
int objectId)
IEcmaScriptDebugger
callFunctionOnObject in interface IEcmaScriptDebuggerusing - Script with reference to the object "locator"objectId - The object to be used for injection
public java.lang.Object callFunctionOnObject(java.lang.String using,
int objectId,
boolean responseExpected)
callFunctionOnObject in interface IEcmaScriptDebugger
public java.lang.Integer executeScriptOnObject(java.lang.String using,
int objectId)
executeScriptOnObject in interface IEcmaScriptDebuggerprotected java.lang.Object parseEvalReply(EsdbgProtos.EvalResult result)
protected java.lang.Object parseValue(java.lang.String dataType,
java.lang.String value)
protected java.lang.Object parseNumber(java.lang.String value)
protected EsdbgProtos.RuntimeInfo findRuntime()
protected EsdbgProtos.RuntimeInfo findRuntime(int windowId)
public void changeRuntime(int index)
IEcmaScriptDebugger
changeRuntime in interface IEcmaScriptDebuggerpublic void changeRuntime(java.lang.String frameName)
IEcmaScriptDebugger
changeRuntime in interface IEcmaScriptDebuggerpublic void cleanUpRuntimes(int windowId)
IEcmaScriptDebugger
cleanUpRuntimes in interface IEcmaScriptDebuggerpublic void cleanUpRuntimes()
IEcmaScriptDebugger
cleanUpRuntimes in interface IEcmaScriptDebuggerpublic java.util.List<java.lang.Integer> examineObjects(java.lang.Integer id)
examineObjects in interface IEcmaScriptDebuggerpublic java.util.List<java.lang.String> listFramePaths()
IEcmaScriptDebugger
listFramePaths in interface IEcmaScriptDebuggerList of String framepathspublic void releaseObjects()
IEcmaScriptDebugger
releaseObjects in interface IEcmaScriptDebuggerpublic void resetRuntimesList()
IEcmaScriptDebugger
resetRuntimesList in interface IEcmaScriptDebuggerpublic void readyStateChanged(EcmascriptProtos.ReadyStateChange change)
IEcmaScriptDebugger
readyStateChanged in interface IEcmaScriptDebuggerchange - EcmascriptProtos.ReadyStateChange object with runtime infopublic void releaseObject(int objectId)
IEcmaScriptDebugger
releaseObject in interface IEcmaScriptDebuggerobjectId - Id of the object to be releasedpublic void resetFramePath()
resetFramePath in interface IEcmaScriptDebugger
public java.lang.String executeJavascript(java.lang.String using,
java.lang.Integer windowId)
executeJavascript in interface IEcmaScriptDebuggerpublic java.lang.Object examineScriptResult(java.lang.Integer id)
examineScriptResult in interface IEcmaScriptDebugger
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||