Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package com.hubspot.chrome.devtools.client.core.domdebugger;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.hubspot.chrome.devtools.base.ChromeRequest;
import com.hubspot.chrome.devtools.base.ChromeSessionCore;
import com.hubspot.chrome.devtools.client.core.dom.NodeId;
import com.hubspot.chrome.devtools.client.core.runtime.RemoteObjectId;
import java.util.List;
import java.util.concurrent.CompletableFuture;
/**
* DOM debugging allows setting breakpoints on particular DOM operations and events. JavaScript
* execution will stop on these operations as if there was a regular breakpoint set.
*/
public final class DOMDebugger {
ChromeSessionCore chromeSession;
ObjectMapper objectMapper;
public DOMDebugger(ChromeSessionCore chromeSession, ObjectMapper objectMapper) {
this.chromeSession = chromeSession;
this.objectMapper = objectMapper;
}
/**
* Returns event listeners of the given object.
*
* @param objectId Identifier of the object to return listeners for.
* @param depth [Optional] The maximum depth at which Node children should be retrieved, defaults to 1. Use -1 for the
* entire subtree or provide an integer larger than 0.
* @param pierce [Optional] Whether or not iframes and shadow roots should be traversed when returning the subtree
* (default is false). Reports listeners for all contexts if pierce is enabled.
*/
public List getEventListeners(RemoteObjectId objectId, Integer depth,
Boolean pierce) {
ChromeRequest chromeRequest = new ChromeRequest("DOMDebugger.getEventListeners");
chromeRequest
.putParams("objectId", objectId)
.putParams("depth", depth)
.putParams("pierce", pierce);
return chromeSession.send(chromeRequest, new TypeReference>(){});
}
/**
* Returns event listeners of the given object.
*
* @param objectId Identifier of the object to return listeners for.
* @param depth [Optional] The maximum depth at which Node children should be retrieved, defaults to 1. Use -1 for the
* entire subtree or provide an integer larger than 0.
* @param pierce [Optional] Whether or not iframes and shadow roots should be traversed when returning the subtree
* (default is false). Reports listeners for all contexts if pierce is enabled.
*/
public CompletableFuture> getEventListenersAsync(RemoteObjectId objectId,
Integer depth, Boolean pierce) {
ChromeRequest chromeRequest = new ChromeRequest("DOMDebugger.getEventListeners");
chromeRequest
.putParams("objectId", objectId)
.putParams("depth", depth)
.putParams("pierce", pierce);
return chromeSession.sendAsync(chromeRequest, new TypeReference>(){});
}
/**
* Removes DOM breakpoint that was set using `setDOMBreakpoint`.
*
* @param nodeId Identifier of the node to remove breakpoint from.
* @param type Type of the breakpoint to remove.
*/
public void removeDOMBreakpoint(NodeId nodeId, DOMBreakpointType type) {
ChromeRequest chromeRequest = new ChromeRequest("DOMDebugger.removeDOMBreakpoint");
chromeRequest
.putParams("nodeId", nodeId)
.putParams("type", type);
chromeSession.send(chromeRequest);
}
/**
* Removes DOM breakpoint that was set using `setDOMBreakpoint`.
*
* @param nodeId Identifier of the node to remove breakpoint from.
* @param type Type of the breakpoint to remove.
*/
public void removeDOMBreakpointAsync(NodeId nodeId, DOMBreakpointType type) {
ChromeRequest chromeRequest = new ChromeRequest("DOMDebugger.removeDOMBreakpoint");
chromeRequest
.putParams("nodeId", nodeId)
.putParams("type", type);
chromeSession.sendAsync(chromeRequest);
}
/**
* Removes breakpoint on particular DOM event.
*
* @param eventName Event name.
* @param targetName [Optional] EventTarget interface name.
*/
public void removeEventListenerBreakpoint(String eventName, String targetName) {
ChromeRequest chromeRequest = new ChromeRequest("DOMDebugger.removeEventListenerBreakpoint");
chromeRequest
.putParams("eventName", eventName)
.putParams("targetName", targetName);
chromeSession.send(chromeRequest);
}
/**
* Removes breakpoint on particular DOM event.
*
* @param eventName Event name.
* @param targetName [Optional] EventTarget interface name.
*/
public void removeEventListenerBreakpointAsync(String eventName, String targetName) {
ChromeRequest chromeRequest = new ChromeRequest("DOMDebugger.removeEventListenerBreakpoint");
chromeRequest
.putParams("eventName", eventName)
.putParams("targetName", targetName);
chromeSession.sendAsync(chromeRequest);
}
/**
* Removes breakpoint on particular native event.
*
* @param eventName Instrumentation name to stop on.
*/
public void removeInstrumentationBreakpoint(String eventName) {
ChromeRequest chromeRequest = new ChromeRequest("DOMDebugger.removeInstrumentationBreakpoint");
chromeRequest
.putParams("eventName", eventName);
chromeSession.send(chromeRequest);
}
/**
* Removes breakpoint on particular native event.
*
* @param eventName Instrumentation name to stop on.
*/
public void removeInstrumentationBreakpointAsync(String eventName) {
ChromeRequest chromeRequest = new ChromeRequest("DOMDebugger.removeInstrumentationBreakpoint");
chromeRequest
.putParams("eventName", eventName);
chromeSession.sendAsync(chromeRequest);
}
/**
* Removes breakpoint from XMLHttpRequest.
*
* @param url Resource URL substring.
*/
public void removeXHRBreakpoint(String url) {
ChromeRequest chromeRequest = new ChromeRequest("DOMDebugger.removeXHRBreakpoint");
chromeRequest
.putParams("url", url);
chromeSession.send(chromeRequest);
}
/**
* Removes breakpoint from XMLHttpRequest.
*
* @param url Resource URL substring.
*/
public void removeXHRBreakpointAsync(String url) {
ChromeRequest chromeRequest = new ChromeRequest("DOMDebugger.removeXHRBreakpoint");
chromeRequest
.putParams("url", url);
chromeSession.sendAsync(chromeRequest);
}
/**
* Sets breakpoint on particular operation with DOM.
*
* @param nodeId Identifier of the node to set breakpoint on.
* @param type Type of the operation to stop upon.
*/
public void setDOMBreakpoint(NodeId nodeId, DOMBreakpointType type) {
ChromeRequest chromeRequest = new ChromeRequest("DOMDebugger.setDOMBreakpoint");
chromeRequest
.putParams("nodeId", nodeId)
.putParams("type", type);
chromeSession.send(chromeRequest);
}
/**
* Sets breakpoint on particular operation with DOM.
*
* @param nodeId Identifier of the node to set breakpoint on.
* @param type Type of the operation to stop upon.
*/
public void setDOMBreakpointAsync(NodeId nodeId, DOMBreakpointType type) {
ChromeRequest chromeRequest = new ChromeRequest("DOMDebugger.setDOMBreakpoint");
chromeRequest
.putParams("nodeId", nodeId)
.putParams("type", type);
chromeSession.sendAsync(chromeRequest);
}
/**
* Sets breakpoint on particular DOM event.
*
* @param eventName DOM Event name to stop on (any DOM event will do).
* @param targetName [Optional] EventTarget interface name to stop on. If equal to `"*"` or not provided, will stop on any
* EventTarget.
*/
public void setEventListenerBreakpoint(String eventName, String targetName) {
ChromeRequest chromeRequest = new ChromeRequest("DOMDebugger.setEventListenerBreakpoint");
chromeRequest
.putParams("eventName", eventName)
.putParams("targetName", targetName);
chromeSession.send(chromeRequest);
}
/**
* Sets breakpoint on particular DOM event.
*
* @param eventName DOM Event name to stop on (any DOM event will do).
* @param targetName [Optional] EventTarget interface name to stop on. If equal to `"*"` or not provided, will stop on any
* EventTarget.
*/
public void setEventListenerBreakpointAsync(String eventName, String targetName) {
ChromeRequest chromeRequest = new ChromeRequest("DOMDebugger.setEventListenerBreakpoint");
chromeRequest
.putParams("eventName", eventName)
.putParams("targetName", targetName);
chromeSession.sendAsync(chromeRequest);
}
/**
* Sets breakpoint on particular native event.
*
* @param eventName Instrumentation name to stop on.
*/
public void setInstrumentationBreakpoint(String eventName) {
ChromeRequest chromeRequest = new ChromeRequest("DOMDebugger.setInstrumentationBreakpoint");
chromeRequest
.putParams("eventName", eventName);
chromeSession.send(chromeRequest);
}
/**
* Sets breakpoint on particular native event.
*
* @param eventName Instrumentation name to stop on.
*/
public void setInstrumentationBreakpointAsync(String eventName) {
ChromeRequest chromeRequest = new ChromeRequest("DOMDebugger.setInstrumentationBreakpoint");
chromeRequest
.putParams("eventName", eventName);
chromeSession.sendAsync(chromeRequest);
}
/**
* Sets breakpoint on XMLHttpRequest.
*
* @param url Resource URL substring. All XHRs having this substring in the URL will get stopped upon.
*/
public void setXHRBreakpoint(String url) {
ChromeRequest chromeRequest = new ChromeRequest("DOMDebugger.setXHRBreakpoint");
chromeRequest
.putParams("url", url);
chromeSession.send(chromeRequest);
}
/**
* Sets breakpoint on XMLHttpRequest.
*
* @param url Resource URL substring. All XHRs having this substring in the URL will get stopped upon.
*/
public void setXHRBreakpointAsync(String url) {
ChromeRequest chromeRequest = new ChromeRequest("DOMDebugger.setXHRBreakpoint");
chromeRequest
.putParams("url", url);
chromeSession.sendAsync(chromeRequest);
}
}