Skip to content

Commit 4e1a3ad

Browse files
authored
Merge pull request kklisura#62 from sinaa/master
Update to latest devtools protocol
2 parents 7e72e6c + 3b96123 commit 4e1a3ad

File tree

177 files changed

+7448
-598
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+7448
-598
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ For more information on DevTools, see https://chromedevtools.github.io/devtools-
1010

1111
[v2.1.0](https://github.com/kklisura/chrome-devtools-java-client/tree/v2.1.0) tested on Google Chrome Version 76.0.3809.100. Protocol files from [dev-tools-protocol#e1fb93bd76](https://github.com/ChromeDevTools/devtools-protocol/tree/e1fb93bd76f99cdf401b949757c874c579e15434/json)
1212

13-
[v3.0.0](https://github.com/kklisura/chrome-devtools-java-client/tree/vx.x.x) tested on Google Chrome Version 86.0.4240.111. Protocol files from [dev-tools-protocol#fcb68d10bc](https://github.com/ChromeDevTools/devtools-protocol/tree/fcb68d10bc5258ebf96121caf57200069f6e6731/json)
13+
[v3.0.0](https://github.com/kklisura/chrome-devtools-java-client/tree/v3.0.0) tested on Google Chrome Version 86.0.4240.111. Protocol files from [dev-tools-protocol#fcb68d10bc](https://github.com/ChromeDevTools/devtools-protocol/tree/fcb68d10bc5258ebf96121caf57200069f6e6731/json)
1414

1515
[1] https://chromedevtools.github.io/devtools-protocol/.
1616

browser_protocol.json

Lines changed: 1639 additions & 101 deletions
Large diffs are not rendered by default.

cdt-java-client/src/main/java/com/github/kklisura/cdt/protocol/ChromeDevTools.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import com.github.kklisura.cdt.protocol.commands.Overlay;
5454
import com.github.kklisura.cdt.protocol.commands.Page;
5555
import com.github.kklisura.cdt.protocol.commands.Performance;
56+
import com.github.kklisura.cdt.protocol.commands.PerformanceTimeline;
5657
import com.github.kklisura.cdt.protocol.commands.Profiler;
5758
import com.github.kklisura.cdt.protocol.commands.Runtime;
5859
import com.github.kklisura.cdt.protocol.commands.Schema;
@@ -170,6 +171,9 @@ public interface ChromeDevTools {
170171
/** Returns the Performance command. */
171172
Performance getPerformance();
172173

174+
/** Returns the PerformanceTimeline command. */
175+
PerformanceTimeline getPerformanceTimeline();
176+
173177
/** Returns the Security command. */
174178
Security getSecurity();
175179

cdt-java-client/src/main/java/com/github/kklisura/cdt/protocol/commands/Accessibility.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,34 @@ List<AXNode> getPartialAXTree(
6868
@Optional @ParamName("objectId") String objectId,
6969
@Optional @ParamName("fetchRelatives") Boolean fetchRelatives);
7070

71-
/** Fetches the entire accessibility tree */
71+
/** Fetches the entire accessibility tree for the root Document */
7272
@Experimental
7373
@Returns("nodes")
7474
@ReturnTypeParameter(AXNode.class)
7575
List<AXNode> getFullAXTree();
7676

77+
/**
78+
* Fetches the entire accessibility tree for the root Document
79+
*
80+
* @param max_depth The maximum depth at which descendants of the root node should be retrieved.
81+
* If omitted, the full tree is returned.
82+
*/
83+
@Experimental
84+
@Returns("nodes")
85+
@ReturnTypeParameter(AXNode.class)
86+
List<AXNode> getFullAXTree(@Optional @ParamName("max_depth") Integer max_depth);
87+
88+
/**
89+
* Fetches a particular accessibility node by AXNodeId. Requires `enable()` to have been called
90+
* previously.
91+
*
92+
* @param id
93+
*/
94+
@Experimental
95+
@Returns("nodes")
96+
@ReturnTypeParameter(AXNode.class)
97+
List<AXNode> getChildAXNodes(@ParamName("id") String id);
98+
7799
/**
78100
* Query a DOM node's accessibility subtree for accessible name and role. This command computes
79101
* the name and role for all nodes in the subtree, including those that are ignored for

cdt-java-client/src/main/java/com/github/kklisura/cdt/protocol/commands/Audits.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,20 @@ EncodedResponse getEncodedResponse(
6969
*/
7070
void enable();
7171

72+
/**
73+
* Runs the contrast check for the target page. Found issues are reported using Audits.issueAdded
74+
* event.
75+
*/
76+
void checkContrast();
77+
78+
/**
79+
* Runs the contrast check for the target page. Found issues are reported using Audits.issueAdded
80+
* event.
81+
*
82+
* @param reportAAA Whether to report WCAG AAA level issues. Default is false.
83+
*/
84+
void checkContrast(@Optional @ParamName("reportAAA") Boolean reportAAA);
85+
7286
@EventName("issueAdded")
7387
EventListener onIssueAdded(EventHandler<IssueAdded> eventListener);
7488
}

cdt-java-client/src/main/java/com/github/kklisura/cdt/protocol/commands/Browser.java

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,16 @@
2020
* #L%
2121
*/
2222

23+
import com.github.kklisura.cdt.protocol.events.browser.DownloadProgress;
24+
import com.github.kklisura.cdt.protocol.events.browser.DownloadWillBegin;
25+
import com.github.kklisura.cdt.protocol.support.annotations.EventName;
2326
import com.github.kklisura.cdt.protocol.support.annotations.Experimental;
2427
import com.github.kklisura.cdt.protocol.support.annotations.Optional;
2528
import com.github.kklisura.cdt.protocol.support.annotations.ParamName;
2629
import com.github.kklisura.cdt.protocol.support.annotations.ReturnTypeParameter;
2730
import com.github.kklisura.cdt.protocol.support.annotations.Returns;
31+
import com.github.kklisura.cdt.protocol.support.types.EventHandler;
32+
import com.github.kklisura.cdt.protocol.support.types.EventListener;
2833
import com.github.kklisura.cdt.protocol.types.browser.Bounds;
2934
import com.github.kklisura.cdt.protocol.types.browser.BrowserCommandId;
3035
import com.github.kklisura.cdt.protocol.types.browser.Histogram;
@@ -118,14 +123,36 @@ void grantPermissions(
118123
* according to their dowmload guids.
119124
* @param browserContextId BrowserContext to set download behavior. When omitted, default browser
120125
* context is used.
121-
* @param downloadPath The default path to save downloaded files to. This is requred if behavior
126+
* @param downloadPath The default path to save downloaded files to. This is required if behavior
122127
* is set to 'allow' or 'allowAndName'.
128+
* @param eventsEnabled Whether to emit download events (defaults to false).
123129
*/
124130
@Experimental
125131
void setDownloadBehavior(
126132
@ParamName("behavior") SetDownloadBehaviorBehavior behavior,
127133
@Optional @ParamName("browserContextId") String browserContextId,
128-
@Optional @ParamName("downloadPath") String downloadPath);
134+
@Optional @ParamName("downloadPath") String downloadPath,
135+
@Optional @ParamName("eventsEnabled") Boolean eventsEnabled);
136+
137+
/**
138+
* Cancel a download if in progress
139+
*
140+
* @param guid Global unique identifier of the download.
141+
*/
142+
@Experimental
143+
void cancelDownload(@ParamName("guid") String guid);
144+
145+
/**
146+
* Cancel a download if in progress
147+
*
148+
* @param guid Global unique identifier of the download.
149+
* @param browserContextId BrowserContext to perform the action in. When omitted, default browser
150+
* context is used.
151+
*/
152+
@Experimental
153+
void cancelDownload(
154+
@ParamName("guid") String guid,
155+
@Optional @ParamName("browserContextId") String browserContextId);
129156

130157
/** Close browser gracefully. */
131158
void close();
@@ -229,7 +256,7 @@ Histogram getHistogram(
229256
* Set dock tile details, platform-specific.
230257
*
231258
* @param badgeLabel
232-
* @param image Png encoded image.
259+
* @param image Png encoded image. (Encoded as a base64 string when passed over JSON)
233260
*/
234261
@Experimental
235262
void setDockTile(
@@ -243,4 +270,14 @@ void setDockTile(
243270
*/
244271
@Experimental
245272
void executeBrowserCommand(@ParamName("commandId") BrowserCommandId commandId);
273+
274+
/** Fired when page is about to start a download. */
275+
@EventName("downloadWillBegin")
276+
@Experimental
277+
EventListener onDownloadWillBegin(EventHandler<DownloadWillBegin> eventListener);
278+
279+
/** Fired when download makes progress. Last call has |done| == true. */
280+
@EventName("downloadProgress")
281+
@Experimental
282+
EventListener onDownloadProgress(EventHandler<DownloadProgress> eventListener);
246283
}

cdt-java-client/src/main/java/com/github/kklisura/cdt/protocol/commands/DOM.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ void setFileInputFiles(
692692
@EventName("childNodeRemoved")
693693
EventListener onChildNodeRemoved(EventHandler<ChildNodeRemoved> eventListener);
694694

695-
/** Called when distrubution is changed. */
695+
/** Called when distribution is changed. */
696696
@EventName("distributedNodesUpdated")
697697
@Experimental
698698
EventListener onDistributedNodesUpdated(EventHandler<DistributedNodesUpdated> eventListener);

cdt-java-client/src/main/java/com/github/kklisura/cdt/protocol/commands/DOMDebugger.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.github.kklisura.cdt.protocol.support.annotations.ParamName;
2626
import com.github.kklisura.cdt.protocol.support.annotations.ReturnTypeParameter;
2727
import com.github.kklisura.cdt.protocol.support.annotations.Returns;
28+
import com.github.kklisura.cdt.protocol.types.domdebugger.CSPViolationType;
2829
import com.github.kklisura.cdt.protocol.types.domdebugger.DOMBreakpointType;
2930
import com.github.kklisura.cdt.protocol.types.domdebugger.EventListener;
3031
import java.util.List;
@@ -101,6 +102,14 @@ void removeEventListenerBreakpoint(
101102
*/
102103
void removeXHRBreakpoint(@ParamName("url") String url);
103104

105+
/**
106+
* Sets breakpoint on particular CSP violations.
107+
*
108+
* @param violationTypes CSP Violations to stop upon.
109+
*/
110+
@Experimental
111+
void setBreakOnCSPViolation(@ParamName("violationTypes") List<CSPViolationType> violationTypes);
112+
104113
/**
105114
* Sets breakpoint on particular operation with DOM.
106115
*

cdt-java-client/src/main/java/com/github/kklisura/cdt/protocol/commands/DOMSnapshot.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,20 @@ Snapshot getSnapshot(
8989
* @param includePaintOrder Whether to include layout object paint orders into the snapshot.
9090
* @param includeDOMRects Whether to include DOM rectangles (offsetRects, clientRects,
9191
* scrollRects) into the snapshot
92+
* @param includeBlendedBackgroundColors Whether to include blended background colors in the
93+
* snapshot (default: false). Blended background color is achieved by blending background
94+
* colors of all elements that overlap with the current element.
95+
* @param includeTextColorOpacities Whether to include text color opacity in the snapshot
96+
* (default: false). An element might have the opacity property set that affects the text
97+
* color of the element. The final text color opacity is computed based on the opacity of all
98+
* overlapping elements.
9299
*/
93100
CaptureSnapshot captureSnapshot(
94101
@ParamName("computedStyles") List<String> computedStyles,
95102
@Optional @ParamName("includePaintOrder") Boolean includePaintOrder,
96-
@Optional @ParamName("includeDOMRects") Boolean includeDOMRects);
103+
@Optional @ParamName("includeDOMRects") Boolean includeDOMRects,
104+
@Experimental @Optional @ParamName("includeBlendedBackgroundColors")
105+
Boolean includeBlendedBackgroundColors,
106+
@Experimental @Optional @ParamName("includeTextColorOpacities")
107+
Boolean includeTextColorOpacities);
97108
}

cdt-java-client/src/main/java/com/github/kklisura/cdt/protocol/commands/Debugger.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import com.github.kklisura.cdt.protocol.types.debugger.BreakLocation;
3737
import com.github.kklisura.cdt.protocol.types.debugger.ContinueToLocationTargetCallFrames;
3838
import com.github.kklisura.cdt.protocol.types.debugger.EvaluateOnCallFrame;
39-
import com.github.kklisura.cdt.protocol.types.debugger.ExecuteWasmEvaluator;
4039
import com.github.kklisura.cdt.protocol.types.debugger.Location;
4140
import com.github.kklisura.cdt.protocol.types.debugger.LocationRange;
4241
import com.github.kklisura.cdt.protocol.types.debugger.RestartFrame;
@@ -135,29 +134,6 @@ EvaluateOnCallFrame evaluateOnCallFrame(
135134
@Optional @ParamName("throwOnSideEffect") Boolean throwOnSideEffect,
136135
@Experimental @Optional @ParamName("timeout") Double timeout);
137136

138-
/**
139-
* Execute a Wasm Evaluator module on a given call frame.
140-
*
141-
* @param callFrameId WebAssembly call frame identifier to evaluate on.
142-
* @param evaluator Code of the evaluator module.
143-
*/
144-
@Experimental
145-
ExecuteWasmEvaluator executeWasmEvaluator(
146-
@ParamName("callFrameId") String callFrameId, @ParamName("evaluator") String evaluator);
147-
148-
/**
149-
* Execute a Wasm Evaluator module on a given call frame.
150-
*
151-
* @param callFrameId WebAssembly call frame identifier to evaluate on.
152-
* @param evaluator Code of the evaluator module.
153-
* @param timeout Terminate execution after timing out (number of milliseconds).
154-
*/
155-
@Experimental
156-
ExecuteWasmEvaluator executeWasmEvaluator(
157-
@ParamName("callFrameId") String callFrameId,
158-
@ParamName("evaluator") String evaluator,
159-
@Experimental @Optional @ParamName("timeout") Double timeout);
160-
161137
/**
162138
* Returns possible locations for breakpoint. scriptId in start and end range locations should be
163139
* the same.

0 commit comments

Comments
 (0)