Skip to content

Commit a5d866c

Browse files
authored
feat(devtool): add Runtime.* reference (#23)
1 parent 725e44a commit a5d866c

11 files changed

+103
-0
lines changed

packages/skills/devtool/references/cdp/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ This document lists all Chrome DevTools Protocol (CDP) methods supported by Lynx
1111
- [Overlay Methods](overlay/index.md)
1212
- [Lynx Specific Methods](lynx/index.md)
1313
- [Debugger Methods](debugger/index.md)
14+
- [Runtime Methods](runtime/index.md)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Runtime.callFunctionOn
2+
3+
- `Runtime.callFunctionOn` - Calls function with given declaration on the given object. Object group of the result is inherited from the target object.
4+
- Input:
5+
- `functionDeclaration` (string): Required. Declaration of the function to call (e.g., `"function() { return this.x; }"`).
6+
- `objectId` (string, optional): Optional. Specified `this` object. If provided, `this` is bound to this object during execution; if omitted, it will attempt to use the `executionContextId` below to execute with the global object.
7+
- `executionContextId` (integer, optional): Optional. If `objectId` is not provided, this ID specifies the global context to use.
8+
- `arguments` (array of CallArgument, optional): Implicitly supported. Call arguments arrays to pass to the function.
9+
- `returnByValue` (boolean, optional): Implicitly supported. Whether the result is expected to be a JSON object which should be sent by value.
10+
- Output:
11+
- `result` (RemoteObject): Call result.
12+
- `exceptionDetails` (ExceptionDetails, optional): Exception details.
13+
- Description: Calls a specified function declaration using a target object as the `this` context (or the global scope).
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Runtime.compileScript
2+
3+
- `Runtime.compileScript` - Compiles expression.
4+
- Input:
5+
- `expression` (string): Required. The JavaScript source string to compile.
6+
- `sourceURL` (string): Required. Source url to be set for the script, convenient for subsequent identification in the Source panel.
7+
- `persistScript` (boolean): Required. Specifies whether the compiled script should be persisted in the engine (kept for subsequent repeated calls via runScript).
8+
- `executionContextId` (integer, optional): Optional. Specifies in which execution context to perform script compilation.
9+
- Output:
10+
- `scriptId` (ScriptId, optional): Id of the script.
11+
- `exceptionDetails` (ExceptionDetails, optional): Exception details.
12+
- Description: Compiles a JavaScript script string into bytecode without immediately executing it, typically used to pre-check syntax errors and generate a `scriptId`.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Runtime.discardConsoleEntries
2+
3+
- `Runtime.discardConsoleEntries` - Discards collected exceptions and console API calls.
4+
- Input: None
5+
- Output: None
6+
- Description: Discards all collected console log messages (commonly used when the frontend DevTools clicks to clear the console).
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Runtime.evaluate
2+
3+
- `Runtime.evaluate` - Evaluates expression on global object
4+
- Input:
5+
- `expression` (string): Required. Expression to evaluate.
6+
- `silent` (boolean, optional): Optional. In silent mode exceptions thrown during evaluation are not reported and do not pause execution.
7+
- `contextId` (integer, optional): Optional. Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page.
8+
- `throwOnSideEffect` (boolean, optional): Optional. Whether to throw an exception if side effect cannot be ruled out during evaluation (commonly used for side-effect-free evaluation in debugger preview/hover).
9+
- `generatePreview` (boolean, optional): Optional. Whether preview should be generated for the result.
10+
- `objectGroup` (string, optional): Optional. Symbolic group name that can be used to release multiple objects.
11+
12+
> Note: If Lynx runs on the V8 or JSC engine, it is taken over by the native Inspector of these engines. In addition to the above common parameters, they natively support the complete set of standard CDP parameters (e.g., returnByValue, awaitPromise, includeCommandLineAPI, etc.).
13+
- Output: `{result: RemoteObject, exceptionDetails?: ExceptionDetails}`
14+
- Description: Evaluates a JavaScript expression and returns the result
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Runtime.getHeapUsage
2+
3+
- `Runtime.getHeapUsage` - Returns the JavaScript engine's heap usage.
4+
- Input: None
5+
- Output:
6+
- `usedSize` (number): Used heap size in bytes.
7+
- `totalSize` (number): Allocated heap size in bytes.
8+
- Description: Gets the heap memory usage of the current JavaScript engine (such as used memory size and memory limit).
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Runtime.getProperties
2+
3+
- `Runtime.getProperties` - Returns properties of a given object. Object group of the result is inherited from the target object.
4+
- Input:
5+
- `objectId` (string): Required. Identifier of the target object to query properties for (e.g., a RemoteObject ID returned by evaluate).
6+
- `ownProperties` (boolean, optional): Optional. If true, returns properties belonging only to the object itself, not its prototype chain. If true, it will also additionally return the engine's internal properties (Internal Property Descriptor).
7+
- Output:
8+
- `result` (array of PropertyDescriptor): Object properties.
9+
- `internalProperties` (array of InternalPropertyDescriptor, optional): Internal object properties.
10+
- `privateProperties` (array of PrivatePropertyDescriptor, optional): Object private properties.
11+
- `exceptionDetails` (ExceptionDetails, optional): Exception details.
12+
- Description: Retrieves the properties of a specified object. Commonly used in the debugger panel to expand object trees.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Runtime.globalLexicalScopeNames
2+
3+
- `Runtime.globalLexicalScopeNames` - Returns all let, const and class variables from global scope.
4+
- Input:
5+
- `executionContextId` (integer, optional): Required (or defaults). Specifies in which execution context to lookup global scope variables (such as global variables defined by let/const).
6+
- Output:
7+
- `names` (array of string): Names of the global lexical scope variables.
8+
- Description: Returns all variable names in the global lexical scope.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Runtime.runScript
2+
3+
- `Runtime.runScript` - Runs script with given id in a given context.
4+
- Input:
5+
- `scriptId` (string | integer): Required. Id of the script to run (generated previously by compileScript).
6+
- `executionContextId` (integer, optional): Optional. Specifies in which execution context to perform script run.
7+
- `silent` (boolean, optional): Optional. In silent mode exceptions thrown during evaluation are not reported and do not pause execution.
8+
- `generatePreview` (boolean, optional): Optional. Whether preview should be generated for the result.
9+
- Output:
10+
- `result` (RemoteObject): Run result.
11+
- `exceptionDetails` (ExceptionDetails, optional): Exception details.
12+
- Description: Runs a previously compiled and persisted script using its `scriptId`.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Runtime.setAsyncCallStackDepth
2+
3+
- `Runtime.setAsyncCallStackDepth` - Enables or disables async call stacks tracking.
4+
- Input:
5+
- `maxDepth` (integer): Maximum depth of async call stacks. Setting to `0` will effectively disable collecting async call stacks (default).
6+
- Output: None
7+
- Description: Sets the depth limit for capturing asynchronous call stacks. Passing 0 turns off async call stack tracking.

0 commit comments

Comments
 (0)