001package Torello.Browser;
002
003import java.util.*;
004import javax.json.*;
005import javax.json.stream.*;
006import java.io.*;
007
008import java.lang.reflect.Method;
009import java.lang.reflect.Parameter;
010import java.util.function.Function;
011
012import Torello.Java.Additional.*;
013import Torello.Java.JSON.*;
014
015import static Torello.Java.JSON.JFlag.*;
016
017import Torello.Java.StrCmpr;
018import Torello.JavaDoc.StaticFunctional;
019import Torello.JavaDoc.JDHeaderBackgroundImg;
020import Torello.JavaDoc.Excuse;
021
022/**
023 * <SPAN CLASS=COPIEDJDK><B>This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object
024 * that has an <CODE>id</CODE>. This <CODE>id</CODE> can be used to get additional information on the Node, resolve it into
025 * the JavaScript object wrapper, etc. It is important that client receives DOM events only for the
026 * nodes that are known to the client. Backend keeps track of the nodes that were sent to the client
027 * and never sends the same node twice. It is client's responsibility to collect information about
028 * the nodes that were sent to the client.<p>Note that <CODE>iframe</CODE> owner elements will return
029 * corresponding document elements as their child nodes.</p></B></SPAN>
030 * 
031 * <EMBED CLASS='external-html' DATA-FILE-ID=CODE_GEN_NOTE>
032 */
033@StaticFunctional(Excused={"counter"}, Excuses={Excuse.CONFIGURATION})
034@JDHeaderBackgroundImg(EmbedTagFileID="WOOD_PLANK_NOTE")
035public class DOM
036{
037    // ********************************************************************************************
038    // ********************************************************************************************
039    // Class Header Stuff
040    // ********************************************************************************************
041    // ********************************************************************************************
042
043
044    // No Pubic Constructors
045    private DOM () { }
046
047    // These two Vector's are used by all the "Methods" exported by this class.  java.lang.reflect
048    // is used to generate the JSON String's.  It saves thousands of lines of Auto-Generated Code.
049    private static final Map<String, Vector<String>>    parameterNames = new HashMap<>();
050    private static final Map<String, Vector<Class<?>>>  parameterTypes = new HashMap<>();
051
052    // Some Methods do not take any parameters - for instance all the "enable()" and "disable()"
053    // I simply could not get ride of RAW-TYPES and UNCHECKED warnings... so there are now,
054    // offically, two empty-vectors.  One for String's, and the other for Classes.
055
056    private static final Vector<String>     EMPTY_VEC_STR = new Vector<>();
057    private static final Vector<Class<?>>   EMPTY_VEC_CLASS = new Vector<>();
058
059    static
060    {
061        for (Method m : DOM.class.getMethods())
062        {
063            // This doesn't work!  The parameter names are all "arg0" ... "argN"
064            // It works for java.lang.reflect.Field, BUT NOT java.lang.reflect.Parameter!
065            //
066            // Vector<String> parameterNamesList = new Vector<>(); -- NOPE!
067
068            Vector<Class<?>> parameterTypesList = new Vector<>();
069        
070            for (Parameter p : m.getParameters()) parameterTypesList.add(p.getType());
071
072            parameterTypes.put(
073                m.getName(),
074                (parameterTypesList.size() > 0) ? parameterTypesList : EMPTY_VEC_CLASS
075            );
076        }
077    }
078
079    static
080    {
081        Vector<String> v = null;
082
083        v = new Vector<String>(1);
084        parameterNames.put("collectClassNamesFromSubtree", v);
085        Collections.addAll(v, new String[]
086        { "nodeId", });
087
088        v = new Vector<String>(3);
089        parameterNames.put("copyTo", v);
090        Collections.addAll(v, new String[]
091        { "nodeId", "targetNodeId", "insertBeforeNodeId", });
092
093        v = new Vector<String>(5);
094        parameterNames.put("describeNode", v);
095        Collections.addAll(v, new String[]
096        { "nodeId", "backendNodeId", "objectId", "depth", "pierce", });
097
098        v = new Vector<String>(4);
099        parameterNames.put("scrollIntoViewIfNeeded", v);
100        Collections.addAll(v, new String[]
101        { "nodeId", "backendNodeId", "objectId", "rect", });
102
103        parameterNames.put("disable", EMPTY_VEC_STR);
104
105        v = new Vector<String>(1);
106        parameterNames.put("discardSearchResults", v);
107        Collections.addAll(v, new String[]
108        { "searchId", });
109
110        parameterNames.put("enable", EMPTY_VEC_STR);
111
112        v = new Vector<String>(3);
113        parameterNames.put("focus", v);
114        Collections.addAll(v, new String[]
115        { "nodeId", "backendNodeId", "objectId", });
116
117        v = new Vector<String>(1);
118        parameterNames.put("getAttributes", v);
119        Collections.addAll(v, new String[]
120        { "nodeId", });
121
122        v = new Vector<String>(3);
123        parameterNames.put("getBoxModel", v);
124        Collections.addAll(v, new String[]
125        { "nodeId", "backendNodeId", "objectId", });
126
127        v = new Vector<String>(3);
128        parameterNames.put("getContentQuads", v);
129        Collections.addAll(v, new String[]
130        { "nodeId", "backendNodeId", "objectId", });
131
132        v = new Vector<String>(2);
133        parameterNames.put("getDocument", v);
134        Collections.addAll(v, new String[]
135        { "depth", "pierce", });
136
137        v = new Vector<String>(2);
138        parameterNames.put("getFlattenedDocument", v);
139        Collections.addAll(v, new String[]
140        { "depth", "pierce", });
141
142        v = new Vector<String>(3);
143        parameterNames.put("getNodesForSubtreeByStyle", v);
144        Collections.addAll(v, new String[]
145        { "nodeId", "computedStyles", "pierce", });
146
147        v = new Vector<String>(4);
148        parameterNames.put("getNodeForLocation", v);
149        Collections.addAll(v, new String[]
150        { "x", "y", "includeUserAgentShadowDOM", "ignorePointerEventsNone", });
151
152        v = new Vector<String>(3);
153        parameterNames.put("getOuterHTML", v);
154        Collections.addAll(v, new String[]
155        { "nodeId", "backendNodeId", "objectId", });
156
157        v = new Vector<String>(1);
158        parameterNames.put("getRelayoutBoundary", v);
159        Collections.addAll(v, new String[]
160        { "nodeId", });
161
162        v = new Vector<String>(3);
163        parameterNames.put("getSearchResults", v);
164        Collections.addAll(v, new String[]
165        { "searchId", "fromIndex", "toIndex", });
166
167        parameterNames.put("hideHighlight", EMPTY_VEC_STR);
168
169        parameterNames.put("highlightNode", EMPTY_VEC_STR);
170
171        parameterNames.put("highlightRect", EMPTY_VEC_STR);
172
173        parameterNames.put("markUndoableState", EMPTY_VEC_STR);
174
175        v = new Vector<String>(3);
176        parameterNames.put("moveTo", v);
177        Collections.addAll(v, new String[]
178        { "nodeId", "targetNodeId", "insertBeforeNodeId", });
179
180        v = new Vector<String>(2);
181        parameterNames.put("performSearch", v);
182        Collections.addAll(v, new String[]
183        { "query", "includeUserAgentShadowDOM", });
184
185        v = new Vector<String>(1);
186        parameterNames.put("pushNodeByPathToFrontend", v);
187        Collections.addAll(v, new String[]
188        { "path", });
189
190        v = new Vector<String>(1);
191        parameterNames.put("pushNodesByBackendIdsToFrontend", v);
192        Collections.addAll(v, new String[]
193        { "backendNodeIds", });
194
195        v = new Vector<String>(2);
196        parameterNames.put("querySelector", v);
197        Collections.addAll(v, new String[]
198        { "nodeId", "selector", });
199
200        v = new Vector<String>(2);
201        parameterNames.put("querySelectorAll", v);
202        Collections.addAll(v, new String[]
203        { "nodeId", "selector", });
204
205        parameterNames.put("redo", EMPTY_VEC_STR);
206
207        v = new Vector<String>(2);
208        parameterNames.put("removeAttribute", v);
209        Collections.addAll(v, new String[]
210        { "nodeId", "name", });
211
212        v = new Vector<String>(1);
213        parameterNames.put("removeNode", v);
214        Collections.addAll(v, new String[]
215        { "nodeId", });
216
217        v = new Vector<String>(3);
218        parameterNames.put("requestChildNodes", v);
219        Collections.addAll(v, new String[]
220        { "nodeId", "depth", "pierce", });
221
222        v = new Vector<String>(1);
223        parameterNames.put("requestNode", v);
224        Collections.addAll(v, new String[]
225        { "objectId", });
226
227        v = new Vector<String>(4);
228        parameterNames.put("resolveNode", v);
229        Collections.addAll(v, new String[]
230        { "nodeId", "backendNodeId", "objectGroup", "executionContextId", });
231
232        v = new Vector<String>(3);
233        parameterNames.put("setAttributeValue", v);
234        Collections.addAll(v, new String[]
235        { "nodeId", "name", "value", });
236
237        v = new Vector<String>(3);
238        parameterNames.put("setAttributesAsText", v);
239        Collections.addAll(v, new String[]
240        { "nodeId", "text", "name", });
241
242        v = new Vector<String>(4);
243        parameterNames.put("setFileInputFiles", v);
244        Collections.addAll(v, new String[]
245        { "files", "nodeId", "backendNodeId", "objectId", });
246
247        v = new Vector<String>(1);
248        parameterNames.put("setNodeStackTracesEnabled", v);
249        Collections.addAll(v, new String[]
250        { "enable", });
251
252        v = new Vector<String>(1);
253        parameterNames.put("getNodeStackTraces", v);
254        Collections.addAll(v, new String[]
255        { "nodeId", });
256
257        v = new Vector<String>(1);
258        parameterNames.put("getFileInfo", v);
259        Collections.addAll(v, new String[]
260        { "objectId", });
261
262        v = new Vector<String>(1);
263        parameterNames.put("setInspectedNode", v);
264        Collections.addAll(v, new String[]
265        { "nodeId", });
266
267        v = new Vector<String>(2);
268        parameterNames.put("setNodeName", v);
269        Collections.addAll(v, new String[]
270        { "nodeId", "name", });
271
272        v = new Vector<String>(2);
273        parameterNames.put("setNodeValue", v);
274        Collections.addAll(v, new String[]
275        { "nodeId", "value", });
276
277        v = new Vector<String>(2);
278        parameterNames.put("setOuterHTML", v);
279        Collections.addAll(v, new String[]
280        { "nodeId", "outerHTML", });
281
282        parameterNames.put("undo", EMPTY_VEC_STR);
283
284        v = new Vector<String>(1);
285        parameterNames.put("getFrameOwner", v);
286        Collections.addAll(v, new String[]
287        { "frameId", });
288
289        v = new Vector<String>(2);
290        parameterNames.put("getContainerForNode", v);
291        Collections.addAll(v, new String[]
292        { "nodeId", "containerName", });
293
294        v = new Vector<String>(1);
295        parameterNames.put("getQueryingDescendantsForContainer", v);
296        Collections.addAll(v, new String[]
297        { "nodeId", });
298    }
299
300
301    // ********************************************************************************************
302    // ********************************************************************************************
303    // Types - Static Inner Classes
304    // ********************************************************************************************
305    // ********************************************************************************************
306
307    // public static class NodeId => Integer
308    
309    // public static class BackendNodeId => Integer
310    
311    // public static class Quad => Number[]
312    
313    /** Pseudo element type. */
314    public static final String[] PseudoType =
315    { 
316        "first-line", "first-letter", "before", "after", "marker", "backdrop", "selection", 
317        "target-text", "spelling-error", "grammar-error", "highlight", "first-line-inherited", 
318        "scrollbar", "scrollbar-thumb", "scrollbar-button", "scrollbar-track", 
319        "scrollbar-track-piece", "scrollbar-corner", "resizer", "input-list-button", 
320    };
321    
322    /** Shadow root type. */
323    public static final String[] ShadowRootType =
324    { "user-agent", "open", "closed", };
325    
326    /** Document compatibility mode. */
327    public static final String[] CompatibilityMode =
328    { "QuirksMode", "LimitedQuirksMode", "NoQuirksMode", };
329    
330    /** Backend node with a friendly name. */
331    public static class BackendNode
332        extends BaseType
333        implements java.io.Serializable
334    {
335        /** For Object Serialization.  java.io.Serializable */
336        protected static final long serialVersionUID = 1;
337        
338        public boolean[] optionals()
339        { return new boolean[] { false, false, false, }; }
340        
341        /** <CODE>Node</CODE>'s nodeType. */
342        public final int nodeType;
343        
344        /** <CODE>Node</CODE>'s nodeName. */
345        public final String nodeName;
346        
347        /** <CODE>[No Description Provided by Google]</CODE> */
348        public final int backendNodeId;
349        
350        /**
351         * Constructor
352         *
353         * @param nodeType <CODE>Node</CODE>'s nodeType.
354         * 
355         * @param nodeName <CODE>Node</CODE>'s nodeName.
356         * 
357         * @param backendNodeId -
358         */
359        public BackendNode(int nodeType, String nodeName, int backendNodeId)
360        {
361            // Exception-Check(s) to ensure that if any parameters which are not declared as
362            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
363            
364            if (nodeName == null) BRDPC.throwNPE("nodeName");
365            
366            this.nodeType       = nodeType;
367            this.nodeName       = nodeName;
368            this.backendNodeId  = backendNodeId;
369        }
370        
371        /**
372         * JSON Object Constructor
373         * @param jo A Json-Object having data about an instance of {@code 'BackendNode'}.
374         */
375        public BackendNode (JsonObject jo)
376        {
377            this.nodeType       = ReadPrimJSON.getInt(jo, "nodeType");
378            this.nodeName       = ReadJSON.getString(jo, "nodeName", false, true);
379            this.backendNodeId  = ReadPrimJSON.getInt(jo, "backendNodeId");
380        }
381        
382        
383        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
384        public boolean equals(Object other)
385        {
386            if (other == null)                       return false;
387            if (other.getClass() != this.getClass()) return false;
388        
389            BackendNode o = (BackendNode) other;
390        
391            return
392                    (this.nodeType == o.nodeType)
393                &&  Objects.equals(this.nodeName, o.nodeName)
394                &&  Objects.equals(this.backendNodeId, o.backendNodeId);
395        }
396        
397        /** Generates a Hash-Code for {@code 'this'} instance */
398        public int hashCode()
399        {
400            return
401                    this.nodeType
402                +   Objects.hashCode(this.nodeName)
403                +   this.backendNodeId;
404        }
405    }
406    
407    /**
408     * DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes.
409     * DOMNode is a base node mirror type.
410     */
411    public static class Node
412        extends BaseType
413        implements java.io.Serializable
414    {
415        /** For Object Serialization.  java.io.Serializable */
416        protected static final long serialVersionUID = 1;
417        
418        public boolean[] optionals()
419        { return new boolean[] { false, true, false, false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, }; }
420        
421        /**
422         * Node identifier that is passed into the rest of the DOM messages as the <CODE>nodeId</CODE>. Backend
423         * will only push node with given <CODE>id</CODE> once. It is aware of all requested nodes and will only
424         * fire DOM events for nodes known to the client.
425         */
426        public final int nodeId;
427        
428        /**
429         * The id of the parent node if any.
430         * <BR />
431         * <BR /><B>OPTIONAL</B>
432         */
433        public final Integer parentId;
434        
435        /** The BackendNodeId for this node. */
436        public final int backendNodeId;
437        
438        /** <CODE>Node</CODE>'s nodeType. */
439        public final int nodeType;
440        
441        /** <CODE>Node</CODE>'s nodeName. */
442        public final String nodeName;
443        
444        /** <CODE>Node</CODE>'s localName. */
445        public final String localName;
446        
447        /** <CODE>Node</CODE>'s nodeValue. */
448        public final String nodeValue;
449        
450        /**
451         * Child count for <CODE>Container</CODE> nodes.
452         * <BR />
453         * <BR /><B>OPTIONAL</B>
454         */
455        public final Integer childNodeCount;
456        
457        /**
458         * Child nodes of this node when requested with children.
459         * <BR />
460         * <BR /><B>OPTIONAL</B>
461         */
462        public final DOM.Node[] children;
463        
464        /**
465         * Attributes of the <CODE>Element</CODE> node in the form of flat array <CODE>[name1, value1, name2, value2]</CODE>.
466         * <BR />
467         * <BR /><B>OPTIONAL</B>
468         */
469        public final String[] attributes;
470        
471        /**
472         * Document URL that <CODE>Document</CODE> or <CODE>FrameOwner</CODE> node points to.
473         * <BR />
474         * <BR /><B>OPTIONAL</B>
475         */
476        public final String documentURL;
477        
478        /**
479         * Base URL that <CODE>Document</CODE> or <CODE>FrameOwner</CODE> node uses for URL completion.
480         * <BR />
481         * <BR /><B>OPTIONAL</B>
482         */
483        public final String baseURL;
484        
485        /**
486         * <CODE>DocumentType</CODE>'s publicId.
487         * <BR />
488         * <BR /><B>OPTIONAL</B>
489         */
490        public final String publicId;
491        
492        /**
493         * <CODE>DocumentType</CODE>'s systemId.
494         * <BR />
495         * <BR /><B>OPTIONAL</B>
496         */
497        public final String systemId;
498        
499        /**
500         * <CODE>DocumentType</CODE>'s internalSubset.
501         * <BR />
502         * <BR /><B>OPTIONAL</B>
503         */
504        public final String internalSubset;
505        
506        /**
507         * <CODE>Document</CODE>'s XML version in case of XML documents.
508         * <BR />
509         * <BR /><B>OPTIONAL</B>
510         */
511        public final String xmlVersion;
512        
513        /**
514         * <CODE>Attr</CODE>'s name.
515         * <BR />
516         * <BR /><B>OPTIONAL</B>
517         */
518        public final String name;
519        
520        /**
521         * <CODE>Attr</CODE>'s value.
522         * <BR />
523         * <BR /><B>OPTIONAL</B>
524         */
525        public final String value;
526        
527        /**
528         * Pseudo element type for this node.
529         * <BR />
530         * <BR /><B>OPTIONAL</B>
531         */
532        public final String pseudoType;
533        
534        /**
535         * Shadow root type.
536         * <BR />
537         * <BR /><B>OPTIONAL</B>
538         */
539        public final String shadowRootType;
540        
541        /**
542         * Frame ID for frame owner elements.
543         * <BR />
544         * <BR /><B>OPTIONAL</B>
545         */
546        public final String frameId;
547        
548        /**
549         * Content document for frame owner elements.
550         * <BR />
551         * <BR /><B>OPTIONAL</B>
552         */
553        public final DOM.Node contentDocument;
554        
555        /**
556         * Shadow root list for given element host.
557         * <BR />
558         * <BR /><B>OPTIONAL</B>
559         */
560        public final DOM.Node[] shadowRoots;
561        
562        /**
563         * Content document fragment for template elements.
564         * <BR />
565         * <BR /><B>OPTIONAL</B>
566         */
567        public final DOM.Node templateContent;
568        
569        /**
570         * Pseudo elements associated with this node.
571         * <BR />
572         * <BR /><B>OPTIONAL</B>
573         */
574        public final DOM.Node[] pseudoElements;
575        
576        /**
577         * Deprecated, as the HTML Imports API has been removed (crbug.com/937746).
578         * This property used to return the imported document for the HTMLImport links.
579         * The property is always undefined now.
580         * <BR />
581         * <BR /><B>OPTIONAL</B>
582         * <BR /><B>DEPRECATED</B>
583         */
584        public final DOM.Node importedDocument;
585        
586        /**
587         * Distributed nodes for given insertion point.
588         * <BR />
589         * <BR /><B>OPTIONAL</B>
590         */
591        public final DOM.BackendNode[] distributedNodes;
592        
593        /**
594         * Whether the node is SVG.
595         * <BR />
596         * <BR /><B>OPTIONAL</B>
597         */
598        public final Boolean isSVG;
599        
600        /**
601         * <CODE>[No Description Provided by Google]</CODE>
602         * <BR />
603         * <BR /><B>OPTIONAL</B>
604         */
605        public final String compatibilityMode;
606        
607        /**
608         * Constructor
609         *
610         * @param nodeId 
611         * Node identifier that is passed into the rest of the DOM messages as the <CODE>nodeId</CODE>. Backend
612         * will only push node with given <CODE>id</CODE> once. It is aware of all requested nodes and will only
613         * fire DOM events for nodes known to the client.
614         * 
615         * @param parentId The id of the parent node if any.
616         * <BR /><B>OPTIONAL</B>
617         * 
618         * @param backendNodeId The BackendNodeId for this node.
619         * 
620         * @param nodeType <CODE>Node</CODE>'s nodeType.
621         * 
622         * @param nodeName <CODE>Node</CODE>'s nodeName.
623         * 
624         * @param localName <CODE>Node</CODE>'s localName.
625         * 
626         * @param nodeValue <CODE>Node</CODE>'s nodeValue.
627         * 
628         * @param childNodeCount Child count for <CODE>Container</CODE> nodes.
629         * <BR /><B>OPTIONAL</B>
630         * 
631         * @param children Child nodes of this node when requested with children.
632         * <BR /><B>OPTIONAL</B>
633         * 
634         * @param attributes Attributes of the <CODE>Element</CODE> node in the form of flat array <CODE>[name1, value1, name2, value2]</CODE>.
635         * <BR /><B>OPTIONAL</B>
636         * 
637         * @param documentURL Document URL that <CODE>Document</CODE> or <CODE>FrameOwner</CODE> node points to.
638         * <BR /><B>OPTIONAL</B>
639         * 
640         * @param baseURL Base URL that <CODE>Document</CODE> or <CODE>FrameOwner</CODE> node uses for URL completion.
641         * <BR /><B>OPTIONAL</B>
642         * 
643         * @param publicId <CODE>DocumentType</CODE>'s publicId.
644         * <BR /><B>OPTIONAL</B>
645         * 
646         * @param systemId <CODE>DocumentType</CODE>'s systemId.
647         * <BR /><B>OPTIONAL</B>
648         * 
649         * @param internalSubset <CODE>DocumentType</CODE>'s internalSubset.
650         * <BR /><B>OPTIONAL</B>
651         * 
652         * @param xmlVersion <CODE>Document</CODE>'s XML version in case of XML documents.
653         * <BR /><B>OPTIONAL</B>
654         * 
655         * @param name <CODE>Attr</CODE>'s name.
656         * <BR /><B>OPTIONAL</B>
657         * 
658         * @param value <CODE>Attr</CODE>'s value.
659         * <BR /><B>OPTIONAL</B>
660         * 
661         * @param pseudoType Pseudo element type for this node.
662         * <BR /><B>OPTIONAL</B>
663         * 
664         * @param shadowRootType Shadow root type.
665         * <BR /><B>OPTIONAL</B>
666         * 
667         * @param frameId Frame ID for frame owner elements.
668         * <BR /><B>OPTIONAL</B>
669         * 
670         * @param contentDocument Content document for frame owner elements.
671         * <BR /><B>OPTIONAL</B>
672         * 
673         * @param shadowRoots Shadow root list for given element host.
674         * <BR /><B>OPTIONAL</B>
675         * 
676         * @param templateContent Content document fragment for template elements.
677         * <BR /><B>OPTIONAL</B>
678         * 
679         * @param pseudoElements Pseudo elements associated with this node.
680         * <BR /><B>OPTIONAL</B>
681         * 
682         * @param importedDocument 
683         * Deprecated, as the HTML Imports API has been removed (crbug.com/937746).
684         * This property used to return the imported document for the HTMLImport links.
685         * The property is always undefined now.
686         * <BR /><B>OPTIONAL</B>
687         * <BR /><B>DEPRECATED</B>
688         * 
689         * @param distributedNodes Distributed nodes for given insertion point.
690         * <BR /><B>OPTIONAL</B>
691         * 
692         * @param isSVG Whether the node is SVG.
693         * <BR /><B>OPTIONAL</B>
694         * 
695         * @param compatibilityMode -
696         * <BR /><B>OPTIONAL</B>
697         */
698        public Node(
699                int nodeId, Integer parentId, int backendNodeId, int nodeType, String nodeName, 
700                String localName, String nodeValue, Integer childNodeCount, DOM.Node[] children, 
701                String[] attributes, String documentURL, String baseURL, String publicId, 
702                String systemId, String internalSubset, String xmlVersion, String name, 
703                String value, String pseudoType, String shadowRootType, String frameId, 
704                DOM.Node contentDocument, DOM.Node[] shadowRoots, DOM.Node templateContent, 
705                DOM.Node[] pseudoElements, DOM.Node importedDocument, 
706                DOM.BackendNode[] distributedNodes, Boolean isSVG, String compatibilityMode
707            )
708        {
709            // Exception-Check(s) to ensure that if any parameters which are not declared as
710            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
711            
712            if (nodeName == null)  BRDPC.throwNPE("nodeName");
713            if (localName == null) BRDPC.throwNPE("localName");
714            if (nodeValue == null) BRDPC.throwNPE("nodeValue");
715            
716            // Exception-Check(s) to ensure that if any parameters which must adhere to a
717            // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
718            
719            BRDPC.checkIAE("pseudoType", pseudoType, "DOM.PseudoType", DOM.PseudoType);
720            BRDPC.checkIAE("shadowRootType", shadowRootType, "DOM.ShadowRootType", DOM.ShadowRootType);
721            BRDPC.checkIAE("compatibilityMode", compatibilityMode, "DOM.CompatibilityMode", DOM.CompatibilityMode);
722            
723            this.nodeId             = nodeId;
724            this.parentId           = parentId;
725            this.backendNodeId      = backendNodeId;
726            this.nodeType           = nodeType;
727            this.nodeName           = nodeName;
728            this.localName          = localName;
729            this.nodeValue          = nodeValue;
730            this.childNodeCount     = childNodeCount;
731            this.children           = children;
732            this.attributes         = attributes;
733            this.documentURL        = documentURL;
734            this.baseURL            = baseURL;
735            this.publicId           = publicId;
736            this.systemId           = systemId;
737            this.internalSubset     = internalSubset;
738            this.xmlVersion         = xmlVersion;
739            this.name               = name;
740            this.value              = value;
741            this.pseudoType         = pseudoType;
742            this.shadowRootType     = shadowRootType;
743            this.frameId            = frameId;
744            this.contentDocument    = contentDocument;
745            this.shadowRoots        = shadowRoots;
746            this.templateContent    = templateContent;
747            this.pseudoElements     = pseudoElements;
748            this.importedDocument   = importedDocument;
749            this.distributedNodes   = distributedNodes;
750            this.isSVG              = isSVG;
751            this.compatibilityMode  = compatibilityMode;
752        }
753        
754        /**
755         * JSON Object Constructor
756         * @param jo A Json-Object having data about an instance of {@code 'Node'}.
757         */
758        public Node (JsonObject jo)
759        {
760            this.nodeId             = ReadPrimJSON.getInt(jo, "nodeId");
761            this.parentId           = ReadBoxedJSON.getInteger(jo, "parentId", true);
762            this.backendNodeId      = ReadPrimJSON.getInt(jo, "backendNodeId");
763            this.nodeType           = ReadPrimJSON.getInt(jo, "nodeType");
764            this.nodeName           = ReadJSON.getString(jo, "nodeName", false, true);
765            this.localName          = ReadJSON.getString(jo, "localName", false, true);
766            this.nodeValue          = ReadJSON.getString(jo, "nodeValue", false, true);
767            this.childNodeCount     = ReadBoxedJSON.getInteger(jo, "childNodeCount", true);
768            this.children = (jo.getJsonArray("children") == null)
769                ? null
770                : RJArrDimN.objArr(jo.getJsonArray("children"), null, 0, DOM.Node[].class);
771        
772            this.attributes = (jo.getJsonArray("attributes") == null)
773                ? null
774                : RJArrIntoStream.strArr(jo.getJsonArray("attributes"), null, 0).toArray(String[]::new);
775        
776            this.documentURL        = ReadJSON.getString(jo, "documentURL", true, false);
777            this.baseURL            = ReadJSON.getString(jo, "baseURL", true, false);
778            this.publicId           = ReadJSON.getString(jo, "publicId", true, false);
779            this.systemId           = ReadJSON.getString(jo, "systemId", true, false);
780            this.internalSubset     = ReadJSON.getString(jo, "internalSubset", true, false);
781            this.xmlVersion         = ReadJSON.getString(jo, "xmlVersion", true, false);
782            this.name               = ReadJSON.getString(jo, "name", true, false);
783            this.value              = ReadJSON.getString(jo, "value", true, false);
784            this.pseudoType         = ReadJSON.getString(jo, "pseudoType", true, false);
785            this.shadowRootType     = ReadJSON.getString(jo, "shadowRootType", true, false);
786            this.frameId            = ReadJSON.getString(jo, "frameId", true, false);
787            this.contentDocument    = ReadJSON.getObject(jo, "contentDocument", DOM.Node.class, true, false);
788            this.shadowRoots = (jo.getJsonArray("shadowRoots") == null)
789                ? null
790                : RJArrDimN.objArr(jo.getJsonArray("shadowRoots"), null, 0, DOM.Node[].class);
791        
792            this.templateContent    = ReadJSON.getObject(jo, "templateContent", DOM.Node.class, true, false);
793            this.pseudoElements = (jo.getJsonArray("pseudoElements") == null)
794                ? null
795                : RJArrDimN.objArr(jo.getJsonArray("pseudoElements"), null, 0, DOM.Node[].class);
796        
797            this.importedDocument   = ReadJSON.getObject(jo, "importedDocument", DOM.Node.class, true, false);
798            this.distributedNodes = (jo.getJsonArray("distributedNodes") == null)
799                ? null
800                : RJArrDimN.objArr(jo.getJsonArray("distributedNodes"), null, 0, DOM.BackendNode[].class);
801        
802            this.isSVG              = ReadBoxedJSON.getBoolean(jo, "isSVG", true);
803            this.compatibilityMode  = ReadJSON.getString(jo, "compatibilityMode", true, false);
804        }
805        
806        
807        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
808        public boolean equals(Object other)
809        {
810            if (other == null)                       return false;
811            if (other.getClass() != this.getClass()) return false;
812        
813            Node o = (Node) other;
814        
815            return
816                    Objects.equals(this.nodeId, o.nodeId)
817                &&  Objects.equals(this.parentId, o.parentId)
818                &&  Objects.equals(this.backendNodeId, o.backendNodeId)
819                &&  (this.nodeType == o.nodeType)
820                &&  Objects.equals(this.nodeName, o.nodeName)
821                &&  Objects.equals(this.localName, o.localName)
822                &&  Objects.equals(this.nodeValue, o.nodeValue)
823                &&  Objects.equals(this.childNodeCount, o.childNodeCount)
824                &&  Arrays.deepEquals(this.children, o.children)
825                &&  Arrays.deepEquals(this.attributes, o.attributes)
826                &&  Objects.equals(this.documentURL, o.documentURL)
827                &&  Objects.equals(this.baseURL, o.baseURL)
828                &&  Objects.equals(this.publicId, o.publicId)
829                &&  Objects.equals(this.systemId, o.systemId)
830                &&  Objects.equals(this.internalSubset, o.internalSubset)
831                &&  Objects.equals(this.xmlVersion, o.xmlVersion)
832                &&  Objects.equals(this.name, o.name)
833                &&  Objects.equals(this.value, o.value)
834                &&  Objects.equals(this.pseudoType, o.pseudoType)
835                &&  Objects.equals(this.shadowRootType, o.shadowRootType)
836                &&  Objects.equals(this.frameId, o.frameId)
837                &&  Objects.equals(this.contentDocument, o.contentDocument)
838                &&  Arrays.deepEquals(this.shadowRoots, o.shadowRoots)
839                &&  Objects.equals(this.templateContent, o.templateContent)
840                &&  Arrays.deepEquals(this.pseudoElements, o.pseudoElements)
841                &&  Objects.equals(this.importedDocument, o.importedDocument)
842                &&  Arrays.deepEquals(this.distributedNodes, o.distributedNodes)
843                &&  Objects.equals(this.isSVG, o.isSVG)
844                &&  Objects.equals(this.compatibilityMode, o.compatibilityMode);
845        }
846        
847        /** Generates a Hash-Code for {@code 'this'} instance */
848        public int hashCode()
849        {
850            return
851                    this.nodeId
852                +   Objects.hashCode(this.parentId)
853                +   this.backendNodeId
854                +   this.nodeType
855                +   Objects.hashCode(this.nodeName)
856                +   Objects.hashCode(this.localName)
857                +   Objects.hashCode(this.nodeValue)
858                +   Objects.hashCode(this.childNodeCount)
859                +   Arrays.deepHashCode(this.children)
860                +   Arrays.deepHashCode(this.attributes)
861                +   Objects.hashCode(this.documentURL)
862                +   Objects.hashCode(this.baseURL)
863                +   Objects.hashCode(this.publicId)
864                +   Objects.hashCode(this.systemId)
865                +   Objects.hashCode(this.internalSubset)
866                +   Objects.hashCode(this.xmlVersion)
867                +   Objects.hashCode(this.name)
868                +   Objects.hashCode(this.value)
869                +   Objects.hashCode(this.pseudoType)
870                +   Objects.hashCode(this.shadowRootType)
871                +   Objects.hashCode(this.frameId)
872                +   this.contentDocument.hashCode()
873                +   Arrays.deepHashCode(this.shadowRoots)
874                +   this.templateContent.hashCode()
875                +   Arrays.deepHashCode(this.pseudoElements)
876                +   this.importedDocument.hashCode()
877                +   Arrays.deepHashCode(this.distributedNodes)
878                +   Objects.hashCode(this.isSVG)
879                +   Objects.hashCode(this.compatibilityMode);
880        }
881    }
882    
883    /** A structure holding an RGBA color. */
884    public static class RGBA
885        extends BaseType
886        implements java.io.Serializable
887    {
888        /** For Object Serialization.  java.io.Serializable */
889        protected static final long serialVersionUID = 1;
890        
891        public boolean[] optionals()
892        { return new boolean[] { false, false, false, true, }; }
893        
894        /** The red component, in the [0-255] range. */
895        public final int r;
896        
897        /** The green component, in the [0-255] range. */
898        public final int g;
899        
900        /** The blue component, in the [0-255] range. */
901        public final int b;
902        
903        /**
904         * The alpha component, in the [0-1] range (default: 1).
905         * <BR />
906         * <BR /><B>OPTIONAL</B>
907         */
908        public final Number a;
909        
910        /**
911         * Constructor
912         *
913         * @param r The red component, in the [0-255] range.
914         * 
915         * @param g The green component, in the [0-255] range.
916         * 
917         * @param b The blue component, in the [0-255] range.
918         * 
919         * @param a The alpha component, in the [0-1] range (default: 1).
920         * <BR /><B>OPTIONAL</B>
921         */
922        public RGBA(int r, int g, int b, Number a)
923        {
924            this.r  = r;
925            this.g  = g;
926            this.b  = b;
927            this.a  = a;
928        }
929        
930        /**
931         * JSON Object Constructor
932         * @param jo A Json-Object having data about an instance of {@code 'RGBA'}.
933         */
934        public RGBA (JsonObject jo)
935        {
936            this.r  = ReadPrimJSON.getInt(jo, "r");
937            this.g  = ReadPrimJSON.getInt(jo, "g");
938            this.b  = ReadPrimJSON.getInt(jo, "b");
939            this.a  = ReadNumberJSON.get(jo, "a", true, false);
940        }
941        
942        
943        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
944        public boolean equals(Object other)
945        {
946            if (other == null)                       return false;
947            if (other.getClass() != this.getClass()) return false;
948        
949            RGBA o = (RGBA) other;
950        
951            return
952                    (this.r == o.r)
953                &&  (this.g == o.g)
954                &&  (this.b == o.b)
955                &&  Objects.equals(this.a, o.a);
956        }
957        
958        /** Generates a Hash-Code for {@code 'this'} instance */
959        public int hashCode()
960        {
961            return
962                    this.r
963                +   this.g
964                +   this.b
965                +   Objects.hashCode(this.a);
966        }
967    }
968    
969    /** Box model. */
970    public static class BoxModel
971        extends BaseType
972        implements java.io.Serializable
973    {
974        /** For Object Serialization.  java.io.Serializable */
975        protected static final long serialVersionUID = 1;
976        
977        public boolean[] optionals()
978        { return new boolean[] { false, false, false, false, false, false, true, }; }
979        
980        /** Content box */
981        public final Number[] content;
982        
983        /** Padding box */
984        public final Number[] padding;
985        
986        /** Border box */
987        public final Number[] border;
988        
989        /** Margin box */
990        public final Number[] margin;
991        
992        /** Node width */
993        public final int width;
994        
995        /** Node height */
996        public final int height;
997        
998        /**
999         * Shape outside coordinates
1000         * <BR />
1001         * <BR /><B>OPTIONAL</B>
1002         */
1003        public final DOM.ShapeOutsideInfo shapeOutside;
1004        
1005        /**
1006         * Constructor
1007         *
1008         * @param content Content box
1009         * 
1010         * @param padding Padding box
1011         * 
1012         * @param border Border box
1013         * 
1014         * @param margin Margin box
1015         * 
1016         * @param width Node width
1017         * 
1018         * @param height Node height
1019         * 
1020         * @param shapeOutside Shape outside coordinates
1021         * <BR /><B>OPTIONAL</B>
1022         */
1023        public BoxModel(
1024                Number[] content, Number[] padding, Number[] border, Number[] margin, int width, 
1025                int height, DOM.ShapeOutsideInfo shapeOutside
1026            )
1027        {
1028            // Exception-Check(s) to ensure that if any parameters which are not declared as
1029            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1030            
1031            if (content == null) BRDPC.throwNPE("content");
1032            if (padding == null) BRDPC.throwNPE("padding");
1033            if (border == null)  BRDPC.throwNPE("border");
1034            if (margin == null)  BRDPC.throwNPE("margin");
1035            
1036            this.content       = content;
1037            this.padding       = padding;
1038            this.border        = border;
1039            this.margin        = margin;
1040            this.width         = width;
1041            this.height        = height;
1042            this.shapeOutside  = shapeOutside;
1043        }
1044        
1045        /**
1046         * JSON Object Constructor
1047         * @param jo A Json-Object having data about an instance of {@code 'BoxModel'}.
1048         */
1049        public BoxModel (JsonObject jo)
1050        {
1051            this.content = (jo.getJsonArray("content") == null)
1052                ? null
1053                : RJArrIntoBoxedStream.numberArr(jo.getJsonArray("content"), -1, 0, null).toArray(Number[]::new);
1054        
1055            this.padding = (jo.getJsonArray("padding") == null)
1056                ? null
1057                : RJArrIntoBoxedStream.numberArr(jo.getJsonArray("padding"), -1, 0, null).toArray(Number[]::new);
1058        
1059            this.border = (jo.getJsonArray("border") == null)
1060                ? null
1061                : RJArrIntoBoxedStream.numberArr(jo.getJsonArray("border"), -1, 0, null).toArray(Number[]::new);
1062        
1063            this.margin = (jo.getJsonArray("margin") == null)
1064                ? null
1065                : RJArrIntoBoxedStream.numberArr(jo.getJsonArray("margin"), -1, 0, null).toArray(Number[]::new);
1066        
1067            this.width         = ReadPrimJSON.getInt(jo, "width");
1068            this.height        = ReadPrimJSON.getInt(jo, "height");
1069            this.shapeOutside  = ReadJSON.getObject(jo, "shapeOutside", DOM.ShapeOutsideInfo.class, true, false);
1070        }
1071        
1072        
1073        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
1074        public boolean equals(Object other)
1075        {
1076            if (other == null)                       return false;
1077            if (other.getClass() != this.getClass()) return false;
1078        
1079            BoxModel o = (BoxModel) other;
1080        
1081            return
1082                    Objects.equals(this.content, o.content)
1083                &&  Objects.equals(this.padding, o.padding)
1084                &&  Objects.equals(this.border, o.border)
1085                &&  Objects.equals(this.margin, o.margin)
1086                &&  (this.width == o.width)
1087                &&  (this.height == o.height)
1088                &&  Objects.equals(this.shapeOutside, o.shapeOutside);
1089        }
1090        
1091        /** Generates a Hash-Code for {@code 'this'} instance */
1092        public int hashCode()
1093        {
1094            return
1095                    Arrays.deepHashCode(this.content)
1096                +   Arrays.deepHashCode(this.padding)
1097                +   Arrays.deepHashCode(this.border)
1098                +   Arrays.deepHashCode(this.margin)
1099                +   this.width
1100                +   this.height
1101                +   this.shapeOutside.hashCode();
1102        }
1103    }
1104    
1105    /** CSS Shape Outside details. */
1106    public static class ShapeOutsideInfo
1107        extends BaseType
1108        implements java.io.Serializable
1109    {
1110        /** For Object Serialization.  java.io.Serializable */
1111        protected static final long serialVersionUID = 1;
1112        
1113        public boolean[] optionals()
1114        { return new boolean[] { false, false, false, }; }
1115        
1116        /** Shape bounds */
1117        public final Number[] bounds;
1118        
1119        /** Shape coordinate details */
1120        public final JsonArray shape;
1121        
1122        /** Margin shape bounds */
1123        public final JsonArray marginShape;
1124        
1125        /**
1126         * Constructor
1127         *
1128         * @param bounds Shape bounds
1129         * 
1130         * @param shape Shape coordinate details
1131         * 
1132         * @param marginShape Margin shape bounds
1133         */
1134        public ShapeOutsideInfo(Number[] bounds, JsonArray shape, JsonArray marginShape)
1135        {
1136            // Exception-Check(s) to ensure that if any parameters which are not declared as
1137            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1138            
1139            if (bounds == null)      BRDPC.throwNPE("bounds");
1140            if (shape == null)       BRDPC.throwNPE("shape");
1141            if (marginShape == null) BRDPC.throwNPE("marginShape");
1142            
1143            this.bounds       = bounds;
1144            this.shape        = shape;
1145            this.marginShape  = marginShape;
1146        }
1147        
1148        /**
1149         * JSON Object Constructor
1150         * @param jo A Json-Object having data about an instance of {@code 'ShapeOutsideInfo'}.
1151         */
1152        public ShapeOutsideInfo (JsonObject jo)
1153        {
1154            this.bounds = (jo.getJsonArray("bounds") == null)
1155                ? null
1156                : RJArrIntoBoxedStream.numberArr(jo.getJsonArray("bounds"), -1, 0, null).toArray(Number[]::new);
1157        
1158            this.shape        = jo.getJsonArray("shape");
1159            this.marginShape  = jo.getJsonArray("marginShape");
1160        }
1161        
1162        
1163        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
1164        public boolean equals(Object other)
1165        {
1166            if (other == null)                       return false;
1167            if (other.getClass() != this.getClass()) return false;
1168        
1169            ShapeOutsideInfo o = (ShapeOutsideInfo) other;
1170        
1171            return
1172                    Objects.equals(this.bounds, o.bounds)
1173                &&  Objects.equals(this.shape, o.shape)
1174                &&  Objects.equals(this.marginShape, o.marginShape);
1175        }
1176        
1177        /** Generates a Hash-Code for {@code 'this'} instance */
1178        public int hashCode()
1179        {
1180            return
1181                    Arrays.deepHashCode(this.bounds)
1182                +   Objects.hashCode(this.shape)
1183                +   Objects.hashCode(this.marginShape);
1184        }
1185    }
1186    
1187    /** Rectangle. */
1188    public static class Rect
1189        extends BaseType
1190        implements java.io.Serializable
1191    {
1192        /** For Object Serialization.  java.io.Serializable */
1193        protected static final long serialVersionUID = 1;
1194        
1195        public boolean[] optionals()
1196        { return new boolean[] { false, false, false, false, }; }
1197        
1198        /** X coordinate */
1199        public final Number x;
1200        
1201        /** Y coordinate */
1202        public final Number y;
1203        
1204        /** Rectangle width */
1205        public final Number width;
1206        
1207        /** Rectangle height */
1208        public final Number height;
1209        
1210        /**
1211         * Constructor
1212         *
1213         * @param x X coordinate
1214         * 
1215         * @param y Y coordinate
1216         * 
1217         * @param width Rectangle width
1218         * 
1219         * @param height Rectangle height
1220         */
1221        public Rect(Number x, Number y, Number width, Number height)
1222        {
1223            // Exception-Check(s) to ensure that if any parameters which are not declared as
1224            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1225            
1226            if (x == null)      BRDPC.throwNPE("x");
1227            if (y == null)      BRDPC.throwNPE("y");
1228            if (width == null)  BRDPC.throwNPE("width");
1229            if (height == null) BRDPC.throwNPE("height");
1230            
1231            this.x       = x;
1232            this.y       = y;
1233            this.width   = width;
1234            this.height  = height;
1235        }
1236        
1237        /**
1238         * JSON Object Constructor
1239         * @param jo A Json-Object having data about an instance of {@code 'Rect'}.
1240         */
1241        public Rect (JsonObject jo)
1242        {
1243            this.x       = ReadNumberJSON.get(jo, "x", false, true);
1244            this.y       = ReadNumberJSON.get(jo, "y", false, true);
1245            this.width   = ReadNumberJSON.get(jo, "width", false, true);
1246            this.height  = ReadNumberJSON.get(jo, "height", false, true);
1247        }
1248        
1249        
1250        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
1251        public boolean equals(Object other)
1252        {
1253            if (other == null)                       return false;
1254            if (other.getClass() != this.getClass()) return false;
1255        
1256            Rect o = (Rect) other;
1257        
1258            return
1259                    Objects.equals(this.x, o.x)
1260                &&  Objects.equals(this.y, o.y)
1261                &&  Objects.equals(this.width, o.width)
1262                &&  Objects.equals(this.height, o.height);
1263        }
1264        
1265        /** Generates a Hash-Code for {@code 'this'} instance */
1266        public int hashCode()
1267        {
1268            return
1269                    Objects.hashCode(this.x)
1270                +   Objects.hashCode(this.y)
1271                +   Objects.hashCode(this.width)
1272                +   Objects.hashCode(this.height);
1273        }
1274    }
1275    
1276    /** <CODE>[No Description Provided by Google]</CODE> */
1277    public static class CSSComputedStyleProperty
1278        extends BaseType
1279        implements java.io.Serializable
1280    {
1281        /** For Object Serialization.  java.io.Serializable */
1282        protected static final long serialVersionUID = 1;
1283        
1284        public boolean[] optionals()
1285        { return new boolean[] { false, false, }; }
1286        
1287        /** Computed style property name. */
1288        public final String name;
1289        
1290        /** Computed style property value. */
1291        public final String value;
1292        
1293        /**
1294         * Constructor
1295         *
1296         * @param name Computed style property name.
1297         * 
1298         * @param value Computed style property value.
1299         */
1300        public CSSComputedStyleProperty(String name, String value)
1301        {
1302            // Exception-Check(s) to ensure that if any parameters which are not declared as
1303            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1304            
1305            if (name == null)  BRDPC.throwNPE("name");
1306            if (value == null) BRDPC.throwNPE("value");
1307            
1308            this.name   = name;
1309            this.value  = value;
1310        }
1311        
1312        /**
1313         * JSON Object Constructor
1314         * @param jo A Json-Object having data about an instance of {@code 'CSSComputedStyleProperty'}.
1315         */
1316        public CSSComputedStyleProperty (JsonObject jo)
1317        {
1318            this.name   = ReadJSON.getString(jo, "name", false, true);
1319            this.value  = ReadJSON.getString(jo, "value", false, true);
1320        }
1321        
1322        
1323        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
1324        public boolean equals(Object other)
1325        {
1326            if (other == null)                       return false;
1327            if (other.getClass() != this.getClass()) return false;
1328        
1329            CSSComputedStyleProperty o = (CSSComputedStyleProperty) other;
1330        
1331            return
1332                    Objects.equals(this.name, o.name)
1333                &&  Objects.equals(this.value, o.value);
1334        }
1335        
1336        /** Generates a Hash-Code for {@code 'this'} instance */
1337        public int hashCode()
1338        {
1339            return
1340                    Objects.hashCode(this.name)
1341                +   Objects.hashCode(this.value);
1342        }
1343    }
1344    
1345    /**
1346     * Fired when <CODE>Document</CODE> has been totally updated. Node ids are no longer valid.
1347     *
1348     * <BR /><BR />This is Marker-Event.  Marker-Event's are Events that do not posses
1349     * any data, fields or state.  When they are fired, only the event name is supplied.
1350     */
1351    public static class documentUpdated
1352        extends BrowserEvent
1353        implements java.io.Serializable
1354    {
1355        /** For Object Serialization.  java.io.Serializable */
1356        protected static final long serialVersionUID = 1;
1357    
1358        public boolean[] optionals() { return new boolean[0]; }
1359    
1360        /** JSON Object Constructor */
1361        public documentUpdated(JsonObject jo)
1362        { super("DOM", "documentUpdated", 0); }
1363    
1364        @Override
1365        public String toString() { return "DOM.documentUpdated Marker Event\n"; }
1366    }
1367    
1368    /** Fired when <CODE>Element</CODE>'s attribute is modified. */
1369    public static class attributeModified
1370        extends BrowserEvent
1371        implements java.io.Serializable
1372    {
1373        /** For Object Serialization.  java.io.Serializable */
1374        protected static final long serialVersionUID = 1;
1375        
1376        public boolean[] optionals()
1377        { return new boolean[] { false, false, false, }; }
1378        
1379        /** Id of the node that has changed. */
1380        public final int nodeId;
1381        
1382        /** Attribute name. */
1383        public final String name;
1384        
1385        /** Attribute value. */
1386        public final String value;
1387        
1388        /**
1389         * Constructor
1390         *
1391         * @param nodeId Id of the node that has changed.
1392         * 
1393         * @param name Attribute name.
1394         * 
1395         * @param value Attribute value.
1396         */
1397        public attributeModified(int nodeId, String name, String value)
1398        {
1399            super("DOM", "attributeModified", 3);
1400            
1401            // Exception-Check(s) to ensure that if any parameters which are not declared as
1402            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1403            
1404            if (name == null)  BRDPC.throwNPE("name");
1405            if (value == null) BRDPC.throwNPE("value");
1406            
1407            this.nodeId  = nodeId;
1408            this.name    = name;
1409            this.value   = value;
1410        }
1411        
1412        /**
1413         * JSON Object Constructor
1414         * @param jo A Json-Object having data about an instance of {@code 'attributeModified'}.
1415         */
1416        public attributeModified (JsonObject jo)
1417        {
1418            super("DOM", "attributeModified", 3);
1419        
1420            this.nodeId  = ReadPrimJSON.getInt(jo, "nodeId");
1421            this.name    = ReadJSON.getString(jo, "name", false, true);
1422            this.value   = ReadJSON.getString(jo, "value", false, true);
1423        }
1424        
1425        
1426        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
1427        public boolean equals(Object other)
1428        {
1429            if (other == null)                       return false;
1430            if (other.getClass() != this.getClass()) return false;
1431        
1432            attributeModified o = (attributeModified) other;
1433        
1434            return
1435                    Objects.equals(this.nodeId, o.nodeId)
1436                &&  Objects.equals(this.name, o.name)
1437                &&  Objects.equals(this.value, o.value);
1438        }
1439        
1440        /** Generates a Hash-Code for {@code 'this'} instance */
1441        public int hashCode()
1442        {
1443            return
1444                    this.nodeId
1445                +   Objects.hashCode(this.name)
1446                +   Objects.hashCode(this.value);
1447        }
1448    }
1449    
1450    /** Fired when <CODE>Element</CODE>'s attribute is removed. */
1451    public static class attributeRemoved
1452        extends BrowserEvent
1453        implements java.io.Serializable
1454    {
1455        /** For Object Serialization.  java.io.Serializable */
1456        protected static final long serialVersionUID = 1;
1457        
1458        public boolean[] optionals()
1459        { return new boolean[] { false, false, }; }
1460        
1461        /** Id of the node that has changed. */
1462        public final int nodeId;
1463        
1464        /** A ttribute name. */
1465        public final String name;
1466        
1467        /**
1468         * Constructor
1469         *
1470         * @param nodeId Id of the node that has changed.
1471         * 
1472         * @param name A ttribute name.
1473         */
1474        public attributeRemoved(int nodeId, String name)
1475        {
1476            super("DOM", "attributeRemoved", 2);
1477            
1478            // Exception-Check(s) to ensure that if any parameters which are not declared as
1479            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1480            
1481            if (name == null) BRDPC.throwNPE("name");
1482            
1483            this.nodeId  = nodeId;
1484            this.name    = name;
1485        }
1486        
1487        /**
1488         * JSON Object Constructor
1489         * @param jo A Json-Object having data about an instance of {@code 'attributeRemoved'}.
1490         */
1491        public attributeRemoved (JsonObject jo)
1492        {
1493            super("DOM", "attributeRemoved", 2);
1494        
1495            this.nodeId  = ReadPrimJSON.getInt(jo, "nodeId");
1496            this.name    = ReadJSON.getString(jo, "name", false, true);
1497        }
1498        
1499        
1500        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
1501        public boolean equals(Object other)
1502        {
1503            if (other == null)                       return false;
1504            if (other.getClass() != this.getClass()) return false;
1505        
1506            attributeRemoved o = (attributeRemoved) other;
1507        
1508            return
1509                    Objects.equals(this.nodeId, o.nodeId)
1510                &&  Objects.equals(this.name, o.name);
1511        }
1512        
1513        /** Generates a Hash-Code for {@code 'this'} instance */
1514        public int hashCode()
1515        {
1516            return
1517                    this.nodeId
1518                +   Objects.hashCode(this.name);
1519        }
1520    }
1521    
1522    /** Mirrors <CODE>DOMCharacterDataModified</CODE> event. */
1523    public static class characterDataModified
1524        extends BrowserEvent
1525        implements java.io.Serializable
1526    {
1527        /** For Object Serialization.  java.io.Serializable */
1528        protected static final long serialVersionUID = 1;
1529        
1530        public boolean[] optionals()
1531        { return new boolean[] { false, false, }; }
1532        
1533        /** Id of the node that has changed. */
1534        public final int nodeId;
1535        
1536        /** New text value. */
1537        public final String characterData;
1538        
1539        /**
1540         * Constructor
1541         *
1542         * @param nodeId Id of the node that has changed.
1543         * 
1544         * @param characterData New text value.
1545         */
1546        public characterDataModified(int nodeId, String characterData)
1547        {
1548            super("DOM", "characterDataModified", 2);
1549            
1550            // Exception-Check(s) to ensure that if any parameters which are not declared as
1551            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1552            
1553            if (characterData == null) BRDPC.throwNPE("characterData");
1554            
1555            this.nodeId         = nodeId;
1556            this.characterData  = characterData;
1557        }
1558        
1559        /**
1560         * JSON Object Constructor
1561         * @param jo A Json-Object having data about an instance of {@code 'characterDataModified'}.
1562         */
1563        public characterDataModified (JsonObject jo)
1564        {
1565            super("DOM", "characterDataModified", 2);
1566        
1567            this.nodeId         = ReadPrimJSON.getInt(jo, "nodeId");
1568            this.characterData  = ReadJSON.getString(jo, "characterData", false, true);
1569        }
1570        
1571        
1572        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
1573        public boolean equals(Object other)
1574        {
1575            if (other == null)                       return false;
1576            if (other.getClass() != this.getClass()) return false;
1577        
1578            characterDataModified o = (characterDataModified) other;
1579        
1580            return
1581                    Objects.equals(this.nodeId, o.nodeId)
1582                &&  Objects.equals(this.characterData, o.characterData);
1583        }
1584        
1585        /** Generates a Hash-Code for {@code 'this'} instance */
1586        public int hashCode()
1587        {
1588            return
1589                    this.nodeId
1590                +   Objects.hashCode(this.characterData);
1591        }
1592    }
1593    
1594    /** Fired when <CODE>Container</CODE>'s child node count has changed. */
1595    public static class childNodeCountUpdated
1596        extends BrowserEvent
1597        implements java.io.Serializable
1598    {
1599        /** For Object Serialization.  java.io.Serializable */
1600        protected static final long serialVersionUID = 1;
1601        
1602        public boolean[] optionals()
1603        { return new boolean[] { false, false, }; }
1604        
1605        /** Id of the node that has changed. */
1606        public final int nodeId;
1607        
1608        /** New node count. */
1609        public final int childNodeCount;
1610        
1611        /**
1612         * Constructor
1613         *
1614         * @param nodeId Id of the node that has changed.
1615         * 
1616         * @param childNodeCount New node count.
1617         */
1618        public childNodeCountUpdated(int nodeId, int childNodeCount)
1619        {
1620            super("DOM", "childNodeCountUpdated", 2);
1621            
1622            this.nodeId          = nodeId;
1623            this.childNodeCount  = childNodeCount;
1624        }
1625        
1626        /**
1627         * JSON Object Constructor
1628         * @param jo A Json-Object having data about an instance of {@code 'childNodeCountUpdated'}.
1629         */
1630        public childNodeCountUpdated (JsonObject jo)
1631        {
1632            super("DOM", "childNodeCountUpdated", 2);
1633        
1634            this.nodeId          = ReadPrimJSON.getInt(jo, "nodeId");
1635            this.childNodeCount  = ReadPrimJSON.getInt(jo, "childNodeCount");
1636        }
1637        
1638        
1639        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
1640        public boolean equals(Object other)
1641        {
1642            if (other == null)                       return false;
1643            if (other.getClass() != this.getClass()) return false;
1644        
1645            childNodeCountUpdated o = (childNodeCountUpdated) other;
1646        
1647            return
1648                    Objects.equals(this.nodeId, o.nodeId)
1649                &&  (this.childNodeCount == o.childNodeCount);
1650        }
1651        
1652        /** Generates a Hash-Code for {@code 'this'} instance */
1653        public int hashCode()
1654        {
1655            return
1656                    this.nodeId
1657                +   this.childNodeCount;
1658        }
1659    }
1660    
1661    /** Mirrors <CODE>DOMNodeInserted</CODE> event. */
1662    public static class childNodeInserted
1663        extends BrowserEvent
1664        implements java.io.Serializable
1665    {
1666        /** For Object Serialization.  java.io.Serializable */
1667        protected static final long serialVersionUID = 1;
1668        
1669        public boolean[] optionals()
1670        { return new boolean[] { false, false, false, }; }
1671        
1672        /** Id of the node that has changed. */
1673        public final int parentNodeId;
1674        
1675        /** If of the previous siblint. */
1676        public final int previousNodeId;
1677        
1678        /** Inserted node data. */
1679        public final DOM.Node node;
1680        
1681        /**
1682         * Constructor
1683         *
1684         * @param parentNodeId Id of the node that has changed.
1685         * 
1686         * @param previousNodeId If of the previous siblint.
1687         * 
1688         * @param node Inserted node data.
1689         */
1690        public childNodeInserted(int parentNodeId, int previousNodeId, DOM.Node node)
1691        {
1692            super("DOM", "childNodeInserted", 3);
1693            
1694            // Exception-Check(s) to ensure that if any parameters which are not declared as
1695            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1696            
1697            if (node == null) BRDPC.throwNPE("node");
1698            
1699            this.parentNodeId    = parentNodeId;
1700            this.previousNodeId  = previousNodeId;
1701            this.node            = node;
1702        }
1703        
1704        /**
1705         * JSON Object Constructor
1706         * @param jo A Json-Object having data about an instance of {@code 'childNodeInserted'}.
1707         */
1708        public childNodeInserted (JsonObject jo)
1709        {
1710            super("DOM", "childNodeInserted", 3);
1711        
1712            this.parentNodeId    = ReadPrimJSON.getInt(jo, "parentNodeId");
1713            this.previousNodeId  = ReadPrimJSON.getInt(jo, "previousNodeId");
1714            this.node            = ReadJSON.getObject(jo, "node", DOM.Node.class, false, true);
1715        }
1716        
1717        
1718        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
1719        public boolean equals(Object other)
1720        {
1721            if (other == null)                       return false;
1722            if (other.getClass() != this.getClass()) return false;
1723        
1724            childNodeInserted o = (childNodeInserted) other;
1725        
1726            return
1727                    Objects.equals(this.parentNodeId, o.parentNodeId)
1728                &&  Objects.equals(this.previousNodeId, o.previousNodeId)
1729                &&  Objects.equals(this.node, o.node);
1730        }
1731        
1732        /** Generates a Hash-Code for {@code 'this'} instance */
1733        public int hashCode()
1734        {
1735            return
1736                    this.parentNodeId
1737                +   this.previousNodeId
1738                +   this.node.hashCode();
1739        }
1740    }
1741    
1742    /** Mirrors <CODE>DOMNodeRemoved</CODE> event. */
1743    public static class childNodeRemoved
1744        extends BrowserEvent
1745        implements java.io.Serializable
1746    {
1747        /** For Object Serialization.  java.io.Serializable */
1748        protected static final long serialVersionUID = 1;
1749        
1750        public boolean[] optionals()
1751        { return new boolean[] { false, false, }; }
1752        
1753        /** Parent id. */
1754        public final int parentNodeId;
1755        
1756        /** Id of the node that has been removed. */
1757        public final int nodeId;
1758        
1759        /**
1760         * Constructor
1761         *
1762         * @param parentNodeId Parent id.
1763         * 
1764         * @param nodeId Id of the node that has been removed.
1765         */
1766        public childNodeRemoved(int parentNodeId, int nodeId)
1767        {
1768            super("DOM", "childNodeRemoved", 2);
1769            
1770            this.parentNodeId  = parentNodeId;
1771            this.nodeId        = nodeId;
1772        }
1773        
1774        /**
1775         * JSON Object Constructor
1776         * @param jo A Json-Object having data about an instance of {@code 'childNodeRemoved'}.
1777         */
1778        public childNodeRemoved (JsonObject jo)
1779        {
1780            super("DOM", "childNodeRemoved", 2);
1781        
1782            this.parentNodeId  = ReadPrimJSON.getInt(jo, "parentNodeId");
1783            this.nodeId        = ReadPrimJSON.getInt(jo, "nodeId");
1784        }
1785        
1786        
1787        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
1788        public boolean equals(Object other)
1789        {
1790            if (other == null)                       return false;
1791            if (other.getClass() != this.getClass()) return false;
1792        
1793            childNodeRemoved o = (childNodeRemoved) other;
1794        
1795            return
1796                    Objects.equals(this.parentNodeId, o.parentNodeId)
1797                &&  Objects.equals(this.nodeId, o.nodeId);
1798        }
1799        
1800        /** Generates a Hash-Code for {@code 'this'} instance */
1801        public int hashCode()
1802        {
1803            return
1804                    this.parentNodeId
1805                +   this.nodeId;
1806        }
1807    }
1808    
1809    /**
1810     * Called when distribution is changed.
1811     * <BR />
1812     * <BR /><B>EXPERIMENTAL</B>
1813     */
1814    public static class distributedNodesUpdated
1815        extends BrowserEvent
1816        implements java.io.Serializable
1817    {
1818        /** For Object Serialization.  java.io.Serializable */
1819        protected static final long serialVersionUID = 1;
1820        
1821        public boolean[] optionals()
1822        { return new boolean[] { false, false, }; }
1823        
1824        /** Insertion point where distributed nodes were updated. */
1825        public final int insertionPointId;
1826        
1827        /** Distributed nodes for given insertion point. */
1828        public final DOM.BackendNode[] distributedNodes;
1829        
1830        /**
1831         * Constructor
1832         *
1833         * @param insertionPointId Insertion point where distributed nodes were updated.
1834         * 
1835         * @param distributedNodes Distributed nodes for given insertion point.
1836         */
1837        public distributedNodesUpdated(int insertionPointId, DOM.BackendNode[] distributedNodes)
1838        {
1839            super("DOM", "distributedNodesUpdated", 2);
1840            
1841            // Exception-Check(s) to ensure that if any parameters which are not declared as
1842            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1843            
1844            if (distributedNodes == null) BRDPC.throwNPE("distributedNodes");
1845            
1846            this.insertionPointId  = insertionPointId;
1847            this.distributedNodes  = distributedNodes;
1848        }
1849        
1850        /**
1851         * JSON Object Constructor
1852         * @param jo A Json-Object having data about an instance of {@code 'distributedNodesUpdated'}.
1853         */
1854        public distributedNodesUpdated (JsonObject jo)
1855        {
1856            super("DOM", "distributedNodesUpdated", 2);
1857        
1858            this.insertionPointId  = ReadPrimJSON.getInt(jo, "insertionPointId");
1859            this.distributedNodes = (jo.getJsonArray("distributedNodes") == null)
1860                ? null
1861                : RJArrDimN.objArr(jo.getJsonArray("distributedNodes"), null, 0, DOM.BackendNode[].class);
1862        
1863        }
1864        
1865        
1866        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
1867        public boolean equals(Object other)
1868        {
1869            if (other == null)                       return false;
1870            if (other.getClass() != this.getClass()) return false;
1871        
1872            distributedNodesUpdated o = (distributedNodesUpdated) other;
1873        
1874            return
1875                    Objects.equals(this.insertionPointId, o.insertionPointId)
1876                &&  Arrays.deepEquals(this.distributedNodes, o.distributedNodes);
1877        }
1878        
1879        /** Generates a Hash-Code for {@code 'this'} instance */
1880        public int hashCode()
1881        {
1882            return
1883                    this.insertionPointId
1884                +   Arrays.deepHashCode(this.distributedNodes);
1885        }
1886    }
1887    
1888    /**
1889     * Fired when <CODE>Element</CODE>'s inline style is modified via a CSS property modification.
1890     * <BR />
1891     * <BR /><B>EXPERIMENTAL</B>
1892     */
1893    public static class inlineStyleInvalidated
1894        extends BrowserEvent
1895        implements java.io.Serializable
1896    {
1897        /** For Object Serialization.  java.io.Serializable */
1898        protected static final long serialVersionUID = 1;
1899        
1900        public boolean[] optionals()
1901        { return new boolean[] { false, }; }
1902        
1903        /** Ids of the nodes for which the inline styles have been invalidated. */
1904        public final int[] nodeIds;
1905        
1906        /**
1907         * Constructor
1908         *
1909         * @param nodeIds Ids of the nodes for which the inline styles have been invalidated.
1910         */
1911        public inlineStyleInvalidated(int[] nodeIds)
1912        {
1913            super("DOM", "inlineStyleInvalidated", 1);
1914            
1915            // Exception-Check(s) to ensure that if any parameters which are not declared as
1916            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1917            
1918            if (nodeIds == null) BRDPC.throwNPE("nodeIds");
1919            
1920            this.nodeIds  = nodeIds;
1921        }
1922        
1923        /**
1924         * JSON Object Constructor
1925         * @param jo A Json-Object having data about an instance of {@code 'inlineStyleInvalidated'}.
1926         */
1927        public inlineStyleInvalidated (JsonObject jo)
1928        {
1929            super("DOM", "inlineStyleInvalidated", 1);
1930        
1931            this.nodeIds = (jo.getJsonArray("nodeIds") == null)
1932                ? null
1933                : RJArrIntoPrimArray.intArr(jo.getJsonArray("nodeIds"), -1, 0, null);
1934        
1935        }
1936        
1937        
1938        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
1939        public boolean equals(Object other)
1940        {
1941            if (other == null)                       return false;
1942            if (other.getClass() != this.getClass()) return false;
1943        
1944            inlineStyleInvalidated o = (inlineStyleInvalidated) other;
1945        
1946            return
1947                    Arrays.equals(this.nodeIds, o.nodeIds);
1948        }
1949        
1950        /** Generates a Hash-Code for {@code 'this'} instance */
1951        public int hashCode()
1952        {
1953            return
1954                    Arrays.hashCode(this.nodeIds);
1955        }
1956    }
1957    
1958    /**
1959     * Called when a pseudo element is added to an element.
1960     * <BR />
1961     * <BR /><B>EXPERIMENTAL</B>
1962     */
1963    public static class pseudoElementAdded
1964        extends BrowserEvent
1965        implements java.io.Serializable
1966    {
1967        /** For Object Serialization.  java.io.Serializable */
1968        protected static final long serialVersionUID = 1;
1969        
1970        public boolean[] optionals()
1971        { return new boolean[] { false, false, }; }
1972        
1973        /** Pseudo element's parent element id. */
1974        public final int parentId;
1975        
1976        /** The added pseudo element. */
1977        public final DOM.Node pseudoElement;
1978        
1979        /**
1980         * Constructor
1981         *
1982         * @param parentId Pseudo element's parent element id.
1983         * 
1984         * @param pseudoElement The added pseudo element.
1985         */
1986        public pseudoElementAdded(int parentId, DOM.Node pseudoElement)
1987        {
1988            super("DOM", "pseudoElementAdded", 2);
1989            
1990            // Exception-Check(s) to ensure that if any parameters which are not declared as
1991            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1992            
1993            if (pseudoElement == null) BRDPC.throwNPE("pseudoElement");
1994            
1995            this.parentId       = parentId;
1996            this.pseudoElement  = pseudoElement;
1997        }
1998        
1999        /**
2000         * JSON Object Constructor
2001         * @param jo A Json-Object having data about an instance of {@code 'pseudoElementAdded'}.
2002         */
2003        public pseudoElementAdded (JsonObject jo)
2004        {
2005            super("DOM", "pseudoElementAdded", 2);
2006        
2007            this.parentId       = ReadPrimJSON.getInt(jo, "parentId");
2008            this.pseudoElement  = ReadJSON.getObject(jo, "pseudoElement", DOM.Node.class, false, true);
2009        }
2010        
2011        
2012        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
2013        public boolean equals(Object other)
2014        {
2015            if (other == null)                       return false;
2016            if (other.getClass() != this.getClass()) return false;
2017        
2018            pseudoElementAdded o = (pseudoElementAdded) other;
2019        
2020            return
2021                    Objects.equals(this.parentId, o.parentId)
2022                &&  Objects.equals(this.pseudoElement, o.pseudoElement);
2023        }
2024        
2025        /** Generates a Hash-Code for {@code 'this'} instance */
2026        public int hashCode()
2027        {
2028            return
2029                    this.parentId
2030                +   this.pseudoElement.hashCode();
2031        }
2032    }
2033    
2034    /**
2035     * Called when a pseudo element is removed from an element.
2036     * <BR />
2037     * <BR /><B>EXPERIMENTAL</B>
2038     */
2039    public static class pseudoElementRemoved
2040        extends BrowserEvent
2041        implements java.io.Serializable
2042    {
2043        /** For Object Serialization.  java.io.Serializable */
2044        protected static final long serialVersionUID = 1;
2045        
2046        public boolean[] optionals()
2047        { return new boolean[] { false, false, }; }
2048        
2049        /** Pseudo element's parent element id. */
2050        public final int parentId;
2051        
2052        /** The removed pseudo element id. */
2053        public final int pseudoElementId;
2054        
2055        /**
2056         * Constructor
2057         *
2058         * @param parentId Pseudo element's parent element id.
2059         * 
2060         * @param pseudoElementId The removed pseudo element id.
2061         */
2062        public pseudoElementRemoved(int parentId, int pseudoElementId)
2063        {
2064            super("DOM", "pseudoElementRemoved", 2);
2065            
2066            this.parentId         = parentId;
2067            this.pseudoElementId  = pseudoElementId;
2068        }
2069        
2070        /**
2071         * JSON Object Constructor
2072         * @param jo A Json-Object having data about an instance of {@code 'pseudoElementRemoved'}.
2073         */
2074        public pseudoElementRemoved (JsonObject jo)
2075        {
2076            super("DOM", "pseudoElementRemoved", 2);
2077        
2078            this.parentId         = ReadPrimJSON.getInt(jo, "parentId");
2079            this.pseudoElementId  = ReadPrimJSON.getInt(jo, "pseudoElementId");
2080        }
2081        
2082        
2083        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
2084        public boolean equals(Object other)
2085        {
2086            if (other == null)                       return false;
2087            if (other.getClass() != this.getClass()) return false;
2088        
2089            pseudoElementRemoved o = (pseudoElementRemoved) other;
2090        
2091            return
2092                    Objects.equals(this.parentId, o.parentId)
2093                &&  Objects.equals(this.pseudoElementId, o.pseudoElementId);
2094        }
2095        
2096        /** Generates a Hash-Code for {@code 'this'} instance */
2097        public int hashCode()
2098        {
2099            return
2100                    this.parentId
2101                +   this.pseudoElementId;
2102        }
2103    }
2104    
2105    /**
2106     * Fired when backend wants to provide client with the missing DOM structure. This happens upon
2107     * most of the calls requesting node ids.
2108     */
2109    public static class setChildNodes
2110        extends BrowserEvent
2111        implements java.io.Serializable
2112    {
2113        /** For Object Serialization.  java.io.Serializable */
2114        protected static final long serialVersionUID = 1;
2115        
2116        public boolean[] optionals()
2117        { return new boolean[] { false, false, }; }
2118        
2119        /** Parent node id to populate with children. */
2120        public final int parentId;
2121        
2122        /** Child nodes array. */
2123        public final DOM.Node[] nodes;
2124        
2125        /**
2126         * Constructor
2127         *
2128         * @param parentId Parent node id to populate with children.
2129         * 
2130         * @param nodes Child nodes array.
2131         */
2132        public setChildNodes(int parentId, DOM.Node[] nodes)
2133        {
2134            super("DOM", "setChildNodes", 2);
2135            
2136            // Exception-Check(s) to ensure that if any parameters which are not declared as
2137            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2138            
2139            if (nodes == null) BRDPC.throwNPE("nodes");
2140            
2141            this.parentId  = parentId;
2142            this.nodes     = nodes;
2143        }
2144        
2145        /**
2146         * JSON Object Constructor
2147         * @param jo A Json-Object having data about an instance of {@code 'setChildNodes'}.
2148         */
2149        public setChildNodes (JsonObject jo)
2150        {
2151            super("DOM", "setChildNodes", 2);
2152        
2153            this.parentId  = ReadPrimJSON.getInt(jo, "parentId");
2154            this.nodes = (jo.getJsonArray("nodes") == null)
2155                ? null
2156                : RJArrDimN.objArr(jo.getJsonArray("nodes"), null, 0, DOM.Node[].class);
2157        
2158        }
2159        
2160        
2161        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
2162        public boolean equals(Object other)
2163        {
2164            if (other == null)                       return false;
2165            if (other.getClass() != this.getClass()) return false;
2166        
2167            setChildNodes o = (setChildNodes) other;
2168        
2169            return
2170                    Objects.equals(this.parentId, o.parentId)
2171                &&  Arrays.deepEquals(this.nodes, o.nodes);
2172        }
2173        
2174        /** Generates a Hash-Code for {@code 'this'} instance */
2175        public int hashCode()
2176        {
2177            return
2178                    this.parentId
2179                +   Arrays.deepHashCode(this.nodes);
2180        }
2181    }
2182    
2183    /**
2184     * Called when shadow root is popped from the element.
2185     * <BR />
2186     * <BR /><B>EXPERIMENTAL</B>
2187     */
2188    public static class shadowRootPopped
2189        extends BrowserEvent
2190        implements java.io.Serializable
2191    {
2192        /** For Object Serialization.  java.io.Serializable */
2193        protected static final long serialVersionUID = 1;
2194        
2195        public boolean[] optionals()
2196        { return new boolean[] { false, false, }; }
2197        
2198        /** Host element id. */
2199        public final int hostId;
2200        
2201        /** Shadow root id. */
2202        public final int rootId;
2203        
2204        /**
2205         * Constructor
2206         *
2207         * @param hostId Host element id.
2208         * 
2209         * @param rootId Shadow root id.
2210         */
2211        public shadowRootPopped(int hostId, int rootId)
2212        {
2213            super("DOM", "shadowRootPopped", 2);
2214            
2215            this.hostId  = hostId;
2216            this.rootId  = rootId;
2217        }
2218        
2219        /**
2220         * JSON Object Constructor
2221         * @param jo A Json-Object having data about an instance of {@code 'shadowRootPopped'}.
2222         */
2223        public shadowRootPopped (JsonObject jo)
2224        {
2225            super("DOM", "shadowRootPopped", 2);
2226        
2227            this.hostId  = ReadPrimJSON.getInt(jo, "hostId");
2228            this.rootId  = ReadPrimJSON.getInt(jo, "rootId");
2229        }
2230        
2231        
2232        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
2233        public boolean equals(Object other)
2234        {
2235            if (other == null)                       return false;
2236            if (other.getClass() != this.getClass()) return false;
2237        
2238            shadowRootPopped o = (shadowRootPopped) other;
2239        
2240            return
2241                    Objects.equals(this.hostId, o.hostId)
2242                &&  Objects.equals(this.rootId, o.rootId);
2243        }
2244        
2245        /** Generates a Hash-Code for {@code 'this'} instance */
2246        public int hashCode()
2247        {
2248            return
2249                    this.hostId
2250                +   this.rootId;
2251        }
2252    }
2253    
2254    /**
2255     * Called when shadow root is pushed into the element.
2256     * <BR />
2257     * <BR /><B>EXPERIMENTAL</B>
2258     */
2259    public static class shadowRootPushed
2260        extends BrowserEvent
2261        implements java.io.Serializable
2262    {
2263        /** For Object Serialization.  java.io.Serializable */
2264        protected static final long serialVersionUID = 1;
2265        
2266        public boolean[] optionals()
2267        { return new boolean[] { false, false, }; }
2268        
2269        /** Host element id. */
2270        public final int hostId;
2271        
2272        /** Shadow root. */
2273        public final DOM.Node root;
2274        
2275        /**
2276         * Constructor
2277         *
2278         * @param hostId Host element id.
2279         * 
2280         * @param root Shadow root.
2281         */
2282        public shadowRootPushed(int hostId, DOM.Node root)
2283        {
2284            super("DOM", "shadowRootPushed", 2);
2285            
2286            // Exception-Check(s) to ensure that if any parameters which are not declared as
2287            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2288            
2289            if (root == null) BRDPC.throwNPE("root");
2290            
2291            this.hostId  = hostId;
2292            this.root    = root;
2293        }
2294        
2295        /**
2296         * JSON Object Constructor
2297         * @param jo A Json-Object having data about an instance of {@code 'shadowRootPushed'}.
2298         */
2299        public shadowRootPushed (JsonObject jo)
2300        {
2301            super("DOM", "shadowRootPushed", 2);
2302        
2303            this.hostId  = ReadPrimJSON.getInt(jo, "hostId");
2304            this.root    = ReadJSON.getObject(jo, "root", DOM.Node.class, false, true);
2305        }
2306        
2307        
2308        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
2309        public boolean equals(Object other)
2310        {
2311            if (other == null)                       return false;
2312            if (other.getClass() != this.getClass()) return false;
2313        
2314            shadowRootPushed o = (shadowRootPushed) other;
2315        
2316            return
2317                    Objects.equals(this.hostId, o.hostId)
2318                &&  Objects.equals(this.root, o.root);
2319        }
2320        
2321        /** Generates a Hash-Code for {@code 'this'} instance */
2322        public int hashCode()
2323        {
2324            return
2325                    this.hostId
2326                +   this.root.hashCode();
2327        }
2328    }
2329    
2330    
2331    // Counter for keeping the WebSocket Request ID's distinct.
2332    private static int counter = 1;
2333    
2334    /**
2335     * Collects class names for the node with given id and all of it's child nodes.
2336     * <BR /><B>EXPERIMENTAL</B>
2337     * 
2338     * @param nodeId Id of the node to collect class names.
2339     * 
2340     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2341     * String[]&gt;</CODE>
2342     * 
2343     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
2344     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
2345     * String[]&gt;</CODE> will be returned.
2346     *
2347     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
2348     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
2349      * may be retrieved.</I>
2350     *
2351     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
2352     * <BR /><BR /><UL CLASS=JDUL>
2353     * <LI><CODE>String[] (<B>classNames</B></CODE>)
2354     *     <BR />Class name list.
2355     * </LI>
2356     * </UL> */
2357    public static Script<String, JsonObject, String[]> collectClassNamesFromSubtree(int nodeId)
2358    {
2359        final int       webSocketID = 15000000 + counter++;
2360        final boolean[] optionals   = { false, };
2361        
2362        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2363        String requestJSON = WriteJSON.get(
2364            parameterTypes.get("collectClassNamesFromSubtree"),
2365            parameterNames.get("collectClassNamesFromSubtree"),
2366            optionals, webSocketID,
2367            "DOM.collectClassNamesFromSubtree",
2368            nodeId
2369        );
2370        
2371        // 'JSON Binding' ... Converts Browser Response-JSON to 'String[]'
2372        Function<JsonObject, String[]> responseProcessor = (JsonObject jo) ->
2373            (jo.getJsonArray("classNames") == null)
2374                ? null
2375                : RJArrIntoStream.strArr(jo.getJsonArray("classNames"), null, 0).toArray(String[]::new);
2376        
2377        // Pass the 'defaultSender' to Script-Constructor
2378        // The sender that is used can be changed before executing script.
2379        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2380    }
2381    
2382    /**
2383     * Creates a deep copy of the specified node and places it into the target container before the
2384     * given anchor.
2385     * <BR /><B>EXPERIMENTAL</B>
2386     * 
2387     * @param nodeId Id of the node to copy.
2388     * 
2389     * @param targetNodeId Id of the element to drop the copy into.
2390     * 
2391     * @param insertBeforeNodeId 
2392     * Drop the copy before this node (if absent, the copy becomes the last child of
2393     * <CODE>targetNodeId</CODE>).
2394     * <BR /><B>OPTIONAL</B>
2395     * 
2396     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2397     * Integer&gt;</CODE>
2398     * 
2399     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
2400     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
2401     * Integer&gt;</CODE> will be returned.
2402     *
2403     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
2404     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
2405      * may be retrieved.</I>
2406     *
2407     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
2408     * <BR /><BR /><UL CLASS=JDUL>
2409     * <LI><CODE>Integer (<B>nodeId</B></CODE>)
2410     *     <BR />Id of the node clone.
2411     * </LI>
2412     * </UL> */
2413    public static Script<String, JsonObject, Integer> copyTo
2414        (int nodeId, int targetNodeId, Integer insertBeforeNodeId)
2415    {
2416        final int       webSocketID = 15001000 + counter++;
2417        final boolean[] optionals   = { false, false, true, };
2418        
2419        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2420        String requestJSON = WriteJSON.get(
2421            parameterTypes.get("copyTo"),
2422            parameterNames.get("copyTo"),
2423            optionals, webSocketID,
2424            "DOM.copyTo",
2425            nodeId, targetNodeId, insertBeforeNodeId
2426        );
2427        
2428        // 'JSON Binding' ... Converts Browser Response-JSON to 'Integer'
2429        Function<JsonObject, Integer> responseProcessor = (JsonObject jo) ->
2430            ReadBoxedJSON.getInteger(jo, "nodeId", true);
2431        
2432        // Pass the 'defaultSender' to Script-Constructor
2433        // The sender that is used can be changed before executing script.
2434        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2435    }
2436    
2437    /**
2438     * Describes node given its id, does not require domain to be enabled. Does not start tracking any
2439     * objects, can be used for automation.
2440     * 
2441     * @param nodeId Identifier of the node.
2442     * <BR /><B>OPTIONAL</B>
2443     * 
2444     * @param backendNodeId Identifier of the backend node.
2445     * <BR /><B>OPTIONAL</B>
2446     * 
2447     * @param objectId JavaScript object id of the node wrapper.
2448     * <BR /><B>OPTIONAL</B>
2449     * 
2450     * @param depth 
2451     * The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the
2452     * entire subtree or provide an integer larger than 0.
2453     * <BR /><B>OPTIONAL</B>
2454     * 
2455     * @param pierce 
2456     * Whether or not iframes and shadow roots should be traversed when returning the subtree
2457     * (default is false).
2458     * <BR /><B>OPTIONAL</B>
2459     * 
2460     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2461     * {@link DOM.Node}&gt;</CODE>
2462     * 
2463     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
2464     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
2465     * {@link DOM.Node}&gt;</CODE> will be returned.
2466     *
2467     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
2468     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
2469      * may be retrieved.</I>
2470     *
2471     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
2472     * <BR /><BR /><UL CLASS=JDUL>
2473     * <LI><CODE>{@link DOM.Node} (<B>node</B></CODE>)
2474     *     <BR />Node description.
2475     * </LI>
2476     * </UL> */
2477    public static Script<String, JsonObject, DOM.Node> describeNode
2478        (Integer nodeId, Integer backendNodeId, String objectId, Integer depth, Boolean pierce)
2479    {
2480        final int       webSocketID = 15002000 + counter++;
2481        final boolean[] optionals   = { true, true, true, true, true, };
2482        
2483        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2484        String requestJSON = WriteJSON.get(
2485            parameterTypes.get("describeNode"),
2486            parameterNames.get("describeNode"),
2487            optionals, webSocketID,
2488            "DOM.describeNode",
2489            nodeId, backendNodeId, objectId, depth, pierce
2490        );
2491        
2492        // 'JSON Binding' ... Converts Browser Response-JSON to 'DOM.Node'
2493        Function<JsonObject, DOM.Node> responseProcessor = (JsonObject jo) ->
2494            ReadJSON.getObject(jo, "node", DOM.Node.class, false, true);
2495        
2496        // Pass the 'defaultSender' to Script-Constructor
2497        // The sender that is used can be changed before executing script.
2498        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2499    }
2500    
2501    /**
2502     * Scrolls the specified rect of the given node into view if not already visible.
2503     * Note: exactly one between nodeId, backendNodeId and objectId should be passed
2504     * to identify the node.
2505     * <BR /><B>EXPERIMENTAL</B>
2506     * 
2507     * @param nodeId Identifier of the node.
2508     * <BR /><B>OPTIONAL</B>
2509     * 
2510     * @param backendNodeId Identifier of the backend node.
2511     * <BR /><B>OPTIONAL</B>
2512     * 
2513     * @param objectId JavaScript object id of the node wrapper.
2514     * <BR /><B>OPTIONAL</B>
2515     * 
2516     * @param rect 
2517     * The rect to be scrolled into view, relative to the node's border box, in CSS pixels.
2518     * When omitted, center of the node will be used, similar to Element.scrollIntoView.
2519     * <BR /><B>OPTIONAL</B>
2520     * 
2521     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2522     * {@link Ret0}&gt;</CODE>
2523     *
2524     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
2525     * browser receives the invocation-request.
2526     *
2527     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
2528     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
2529     * {@code >} to ensure the Browser Function has run to completion.
2530     */
2531    public static Script<String, JsonObject, Ret0> scrollIntoViewIfNeeded
2532        (Integer nodeId, Integer backendNodeId, String objectId, DOM.Rect rect)
2533    {
2534        final int       webSocketID = 15003000 + counter++;
2535        final boolean[] optionals   = { true, true, true, true, };
2536        
2537        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2538        String requestJSON = WriteJSON.get(
2539            parameterTypes.get("scrollIntoViewIfNeeded"),
2540            parameterNames.get("scrollIntoViewIfNeeded"),
2541            optionals, webSocketID,
2542            "DOM.scrollIntoViewIfNeeded",
2543            nodeId, backendNodeId, objectId, rect
2544        );
2545        
2546        // This Remote Command does not have a Return-Value.
2547        return new Script<>
2548            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
2549    }
2550    
2551    /**
2552     * Disables DOM agent for the given page.
2553     * 
2554     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2555     * {@link Ret0}&gt;</CODE>
2556     *
2557     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
2558     * browser receives the invocation-request.
2559     *
2560     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
2561     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
2562     * {@code >} to ensure the Browser Function has run to completion.
2563     */
2564    public static Script<String, JsonObject, Ret0> disable()
2565    {
2566        final int          webSocketID = 15004000 + counter++;
2567        final boolean[]    optionals   = new boolean[0];
2568        
2569        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2570        String requestJSON = WriteJSON.get(
2571            parameterTypes.get("disable"),
2572            parameterNames.get("disable"),
2573            optionals, webSocketID,
2574            "DOM.disable"
2575        );
2576        
2577        // This Remote Command does not have a Return-Value.
2578        return new Script<>
2579            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
2580    }
2581    
2582    /**
2583     * Discards search results from the session with the given id. <CODE>getSearchResults</CODE> should no longer
2584     * be called for that search.
2585     * <BR /><B>EXPERIMENTAL</B>
2586     * 
2587     * @param searchId Unique search session identifier.
2588     * 
2589     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2590     * {@link Ret0}&gt;</CODE>
2591     *
2592     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
2593     * browser receives the invocation-request.
2594     *
2595     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
2596     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
2597     * {@code >} to ensure the Browser Function has run to completion.
2598     */
2599    public static Script<String, JsonObject, Ret0> discardSearchResults(String searchId)
2600    {
2601        // Exception-Check(s) to ensure that if any parameters which are not declared as
2602        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2603        
2604        if (searchId == null) BRDPC.throwNPE("searchId");
2605        
2606        final int       webSocketID = 15005000 + counter++;
2607        final boolean[] optionals   = { false, };
2608        
2609        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2610        String requestJSON = WriteJSON.get(
2611            parameterTypes.get("discardSearchResults"),
2612            parameterNames.get("discardSearchResults"),
2613            optionals, webSocketID,
2614            "DOM.discardSearchResults",
2615            searchId
2616        );
2617        
2618        // This Remote Command does not have a Return-Value.
2619        return new Script<>
2620            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
2621    }
2622    
2623    /**
2624     * Enables DOM agent for the given page.
2625     * 
2626     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2627     * {@link Ret0}&gt;</CODE>
2628     *
2629     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
2630     * browser receives the invocation-request.
2631     *
2632     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
2633     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
2634     * {@code >} to ensure the Browser Function has run to completion.
2635     */
2636    public static Script<String, JsonObject, Ret0> enable()
2637    {
2638        final int          webSocketID = 15006000 + counter++;
2639        final boolean[]    optionals   = new boolean[0];
2640        
2641        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2642        String requestJSON = WriteJSON.get(
2643            parameterTypes.get("enable"),
2644            parameterNames.get("enable"),
2645            optionals, webSocketID,
2646            "DOM.enable"
2647        );
2648        
2649        // This Remote Command does not have a Return-Value.
2650        return new Script<>
2651            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
2652    }
2653    
2654    /**
2655     * Focuses the given element.
2656     * 
2657     * @param nodeId Identifier of the node.
2658     * <BR /><B>OPTIONAL</B>
2659     * 
2660     * @param backendNodeId Identifier of the backend node.
2661     * <BR /><B>OPTIONAL</B>
2662     * 
2663     * @param objectId JavaScript object id of the node wrapper.
2664     * <BR /><B>OPTIONAL</B>
2665     * 
2666     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2667     * {@link Ret0}&gt;</CODE>
2668     *
2669     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
2670     * browser receives the invocation-request.
2671     *
2672     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
2673     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
2674     * {@code >} to ensure the Browser Function has run to completion.
2675     */
2676    public static Script<String, JsonObject, Ret0> focus
2677        (Integer nodeId, Integer backendNodeId, String objectId)
2678    {
2679        final int       webSocketID = 15007000 + counter++;
2680        final boolean[] optionals   = { true, true, true, };
2681        
2682        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2683        String requestJSON = WriteJSON.get(
2684            parameterTypes.get("focus"),
2685            parameterNames.get("focus"),
2686            optionals, webSocketID,
2687            "DOM.focus",
2688            nodeId, backendNodeId, objectId
2689        );
2690        
2691        // This Remote Command does not have a Return-Value.
2692        return new Script<>
2693            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
2694    }
2695    
2696    /**
2697     * Returns attributes for the specified node.
2698     * 
2699     * @param nodeId Id of the node to retrieve attibutes for.
2700     * 
2701     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2702     * String[]&gt;</CODE>
2703     * 
2704     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
2705     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
2706     * String[]&gt;</CODE> will be returned.
2707     *
2708     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
2709     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
2710      * may be retrieved.</I>
2711     *
2712     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
2713     * <BR /><BR /><UL CLASS=JDUL>
2714     * <LI><CODE>String[] (<B>attributes</B></CODE>)
2715     *     <BR />An interleaved array of node attribute names and values.
2716     * </LI>
2717     * </UL> */
2718    public static Script<String, JsonObject, String[]> getAttributes(int nodeId)
2719    {
2720        final int       webSocketID = 15008000 + counter++;
2721        final boolean[] optionals   = { false, };
2722        
2723        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2724        String requestJSON = WriteJSON.get(
2725            parameterTypes.get("getAttributes"),
2726            parameterNames.get("getAttributes"),
2727            optionals, webSocketID,
2728            "DOM.getAttributes",
2729            nodeId
2730        );
2731        
2732        // 'JSON Binding' ... Converts Browser Response-JSON to 'String[]'
2733        Function<JsonObject, String[]> responseProcessor = (JsonObject jo) ->
2734            (jo.getJsonArray("attributes") == null)
2735                ? null
2736                : RJArrIntoStream.strArr(jo.getJsonArray("attributes"), null, 0).toArray(String[]::new);
2737        
2738        // Pass the 'defaultSender' to Script-Constructor
2739        // The sender that is used can be changed before executing script.
2740        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2741    }
2742    
2743    /**
2744     * Returns boxes for the given node.
2745     * 
2746     * @param nodeId Identifier of the node.
2747     * <BR /><B>OPTIONAL</B>
2748     * 
2749     * @param backendNodeId Identifier of the backend node.
2750     * <BR /><B>OPTIONAL</B>
2751     * 
2752     * @param objectId JavaScript object id of the node wrapper.
2753     * <BR /><B>OPTIONAL</B>
2754     * 
2755     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2756     * {@link DOM.BoxModel}&gt;</CODE>
2757     * 
2758     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
2759     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
2760     * {@link DOM.BoxModel}&gt;</CODE> will be returned.
2761     *
2762     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
2763     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
2764      * may be retrieved.</I>
2765     *
2766     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
2767     * <BR /><BR /><UL CLASS=JDUL>
2768     * <LI><CODE>{@link DOM.BoxModel} (<B>model</B></CODE>)
2769     *     <BR />Box model for the node.
2770     * </LI>
2771     * </UL> */
2772    public static Script<String, JsonObject, DOM.BoxModel> getBoxModel
2773        (Integer nodeId, Integer backendNodeId, String objectId)
2774    {
2775        final int       webSocketID = 15009000 + counter++;
2776        final boolean[] optionals   = { true, true, true, };
2777        
2778        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2779        String requestJSON = WriteJSON.get(
2780            parameterTypes.get("getBoxModel"),
2781            parameterNames.get("getBoxModel"),
2782            optionals, webSocketID,
2783            "DOM.getBoxModel",
2784            nodeId, backendNodeId, objectId
2785        );
2786        
2787        // 'JSON Binding' ... Converts Browser Response-JSON to 'DOM.BoxModel'
2788        Function<JsonObject, DOM.BoxModel> responseProcessor = (JsonObject jo) ->
2789            ReadJSON.getObject(jo, "model", DOM.BoxModel.class, false, true);
2790        
2791        // Pass the 'defaultSender' to Script-Constructor
2792        // The sender that is used can be changed before executing script.
2793        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2794    }
2795    
2796    /**
2797     * Returns quads that describe node position on the page. This method
2798     * might return multiple quads for inline nodes.
2799     * <BR /><B>EXPERIMENTAL</B>
2800     * 
2801     * @param nodeId Identifier of the node.
2802     * <BR /><B>OPTIONAL</B>
2803     * 
2804     * @param backendNodeId Identifier of the backend node.
2805     * <BR /><B>OPTIONAL</B>
2806     * 
2807     * @param objectId JavaScript object id of the node wrapper.
2808     * <BR /><B>OPTIONAL</B>
2809     * 
2810     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2811     * Number[][]&gt;</CODE>
2812     * 
2813     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
2814     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
2815     * Number[][]&gt;</CODE> will be returned.
2816     *
2817     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
2818     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
2819      * may be retrieved.</I>
2820     *
2821     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
2822     * <BR /><BR /><UL CLASS=JDUL>
2823     * <LI><CODE>Number[][] (<B>quads</B></CODE>)
2824     *     <BR />Quads that describe node layout relative to viewport.
2825     * </LI>
2826     * </UL> */
2827    public static Script<String, JsonObject, Number[][]> getContentQuads
2828        (Integer nodeId, Integer backendNodeId, String objectId)
2829    {
2830        final int       webSocketID = 15010000 + counter++;
2831        final boolean[] optionals   = { true, true, true, };
2832        
2833        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2834        String requestJSON = WriteJSON.get(
2835            parameterTypes.get("getContentQuads"),
2836            parameterNames.get("getContentQuads"),
2837            optionals, webSocketID,
2838            "DOM.getContentQuads",
2839            nodeId, backendNodeId, objectId
2840        );
2841        
2842        // 'JSON Binding' ... Converts Browser Response-JSON to 'Number[][]'
2843        Function<JsonObject, Number[][]> responseProcessor = (JsonObject jo) ->
2844            (jo.getJsonArray("quads") == null)
2845                ? null
2846                : RJArrDimN.arrNumber(jo.getJsonArray("quads"), -1, 0, null, Number[][].class);
2847        
2848        // Pass the 'defaultSender' to Script-Constructor
2849        // The sender that is used can be changed before executing script.
2850        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2851    }
2852    
2853    /**
2854     * Returns the root DOM node (and optionally the subtree) to the caller.
2855     * 
2856     * @param depth 
2857     * The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the
2858     * entire subtree or provide an integer larger than 0.
2859     * <BR /><B>OPTIONAL</B>
2860     * 
2861     * @param pierce 
2862     * Whether or not iframes and shadow roots should be traversed when returning the subtree
2863     * (default is false).
2864     * <BR /><B>OPTIONAL</B>
2865     * 
2866     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2867     * {@link DOM.Node}&gt;</CODE>
2868     * 
2869     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
2870     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
2871     * {@link DOM.Node}&gt;</CODE> will be returned.
2872     *
2873     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
2874     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
2875      * may be retrieved.</I>
2876     *
2877     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
2878     * <BR /><BR /><UL CLASS=JDUL>
2879     * <LI><CODE>{@link DOM.Node} (<B>root</B></CODE>)
2880     *     <BR />Resulting node.
2881     * </LI>
2882     * </UL> */
2883    public static Script<String, JsonObject, DOM.Node> getDocument
2884        (Integer depth, Boolean pierce)
2885    {
2886        final int       webSocketID = 15011000 + counter++;
2887        final boolean[] optionals   = { true, true, };
2888        
2889        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2890        String requestJSON = WriteJSON.get(
2891            parameterTypes.get("getDocument"),
2892            parameterNames.get("getDocument"),
2893            optionals, webSocketID,
2894            "DOM.getDocument",
2895            depth, pierce
2896        );
2897        
2898        // 'JSON Binding' ... Converts Browser Response-JSON to 'DOM.Node'
2899        Function<JsonObject, DOM.Node> responseProcessor = (JsonObject jo) ->
2900            ReadJSON.getObject(jo, "root", DOM.Node.class, false, true);
2901        
2902        // Pass the 'defaultSender' to Script-Constructor
2903        // The sender that is used can be changed before executing script.
2904        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2905    }
2906    
2907    /**
2908     * Returns the root DOM node (and optionally the subtree) to the caller.
2909     * Deprecated, as it is not designed to work well with the rest of the DOM agent.
2910     * Use DOMSnapshot.captureSnapshot instead.
2911     * <BR /><B>DEPRECATED</B>
2912     * 
2913     * @param depth 
2914     * The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the
2915     * entire subtree or provide an integer larger than 0.
2916     * <BR /><B>OPTIONAL</B>
2917     * 
2918     * @param pierce 
2919     * Whether or not iframes and shadow roots should be traversed when returning the subtree
2920     * (default is false).
2921     * <BR /><B>OPTIONAL</B>
2922     * 
2923     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2924     * {@link DOM.Node}[]&gt;</CODE>
2925     * 
2926     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
2927     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
2928     * {@link DOM.Node}[]&gt;</CODE> will be returned.
2929     *
2930     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
2931     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
2932      * may be retrieved.</I>
2933     *
2934     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
2935     * <BR /><BR /><UL CLASS=JDUL>
2936     * <LI><CODE>{@link DOM.Node}[] (<B>nodes</B></CODE>)
2937     *     <BR />Resulting node.
2938     * </LI>
2939     * </UL> */
2940    public static Script<String, JsonObject, DOM.Node[]> getFlattenedDocument
2941        (Integer depth, Boolean pierce)
2942    {
2943        final int       webSocketID = 15012000 + counter++;
2944        final boolean[] optionals   = { true, true, };
2945        
2946        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2947        String requestJSON = WriteJSON.get(
2948            parameterTypes.get("getFlattenedDocument"),
2949            parameterNames.get("getFlattenedDocument"),
2950            optionals, webSocketID,
2951            "DOM.getFlattenedDocument",
2952            depth, pierce
2953        );
2954        
2955        // 'JSON Binding' ... Converts Browser Response-JSON to 'DOM.Node[]'
2956        Function<JsonObject, DOM.Node[]> responseProcessor = (JsonObject jo) ->
2957            (jo.getJsonArray("nodes") == null)
2958                ? null
2959                : RJArrDimN.objArr(jo.getJsonArray("nodes"), null, 0, DOM.Node[].class);
2960        
2961        // Pass the 'defaultSender' to Script-Constructor
2962        // The sender that is used can be changed before executing script.
2963        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2964    }
2965    
2966    /**
2967     * Finds nodes with a given computed style in a subtree.
2968     * <BR /><B>EXPERIMENTAL</B>
2969     * 
2970     * @param nodeId Node ID pointing to the root of a subtree.
2971     * 
2972     * @param computedStyles The style to filter nodes by (includes nodes if any of properties matches).
2973     * 
2974     * @param pierce 
2975     * Whether or not iframes and shadow roots in the same target should be traversed when returning the
2976     * results (default is false).
2977     * <BR /><B>OPTIONAL</B>
2978     * 
2979     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2980     * int[]&gt;</CODE>
2981     * 
2982     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
2983     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
2984     * int[]&gt;</CODE> will be returned.
2985     *
2986     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
2987     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
2988      * may be retrieved.</I>
2989     *
2990     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
2991     * <BR /><BR /><UL CLASS=JDUL>
2992     * <LI><CODE>int[] (<B>nodeIds</B></CODE>)
2993     *     <BR />Resulting nodes.
2994     * </LI>
2995     * </UL> */
2996    public static Script<String, JsonObject, int[]> getNodesForSubtreeByStyle
2997        (int nodeId, DOM.CSSComputedStyleProperty[] computedStyles, Boolean pierce)
2998    {
2999        // Exception-Check(s) to ensure that if any parameters which are not declared as
3000        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
3001        
3002        if (computedStyles == null) BRDPC.throwNPE("computedStyles");
3003        
3004        final int       webSocketID = 15013000 + counter++;
3005        final boolean[] optionals   = { false, false, true, };
3006        
3007        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3008        String requestJSON = WriteJSON.get(
3009            parameterTypes.get("getNodesForSubtreeByStyle"),
3010            parameterNames.get("getNodesForSubtreeByStyle"),
3011            optionals, webSocketID,
3012            "DOM.getNodesForSubtreeByStyle",
3013            nodeId, computedStyles, pierce
3014        );
3015        
3016        // 'JSON Binding' ... Converts Browser Response-JSON to 'int[]'
3017        Function<JsonObject, int[]> responseProcessor = (JsonObject jo) ->
3018            (jo.getJsonArray("nodeIds") == null)
3019                ? null
3020                : RJArrIntoPrimArray.intArr(jo.getJsonArray("nodeIds"), -1, 0, null);
3021        
3022        // Pass the 'defaultSender' to Script-Constructor
3023        // The sender that is used can be changed before executing script.
3024        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
3025    }
3026    
3027    /**
3028     * Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is
3029     * either returned or not.
3030     * 
3031     * @param x X coordinate.
3032     * 
3033     * @param y Y coordinate.
3034     * 
3035     * @param includeUserAgentShadowDOM False to skip to the nearest non-UA shadow root ancestor (default: false).
3036     * <BR /><B>OPTIONAL</B>
3037     * 
3038     * @param ignorePointerEventsNone Whether to ignore pointer-events: none on elements and hit test them.
3039     * <BR /><B>OPTIONAL</B>
3040     * 
3041     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3042     * {@link Ret3}&gt;</CODE>
3043     *
3044     * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 
3045     * {@link Script#exec()}), and a {@link Promise} returned.
3046     *
3047     * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B>
3048     * (using {@link Promise#await()}), the {@code Ret3} will subsequently
3049     * be returned from that call.
3050     * 
3051     * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated
3052     * in an instance of <B>{@link Ret3}</B>
3053     *
3054     * <BR /><BR /><UL CLASS=JDUL>
3055     * <LI><CODE><B>Ret3.a:</B> Integer (<B>backendNodeId</B>)</CODE>
3056     *     <BR />Resulting node.
3057     *     <BR /><BR /></LI>
3058     * <LI><CODE><B>Ret3.b:</B> String (<B>frameId</B>)</CODE>
3059     *     <BR />Frame this node belongs to.
3060     *     <BR /><BR /></LI>
3061     * <LI><CODE><B>Ret3.c:</B> Integer (<B>nodeId</B>)</CODE>
3062     *     <BR />Id of the node at given coordinates, only when enabled and requested document.
3063     *     </LI>
3064     * </UL>
3065     */
3066    public static Script<String, JsonObject, Ret3<Integer, String, Integer>> getNodeForLocation
3067        (int x, int y, Boolean includeUserAgentShadowDOM, Boolean ignorePointerEventsNone)
3068    {
3069        final int       webSocketID = 15014000 + counter++;
3070        final boolean[] optionals   = { false, false, true, true, };
3071        
3072        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3073        String requestJSON = WriteJSON.get(
3074            parameterTypes.get("getNodeForLocation"),
3075            parameterNames.get("getNodeForLocation"),
3076            optionals, webSocketID,
3077            "DOM.getNodeForLocation",
3078            x, y, includeUserAgentShadowDOM, ignorePointerEventsNone
3079        );
3080        
3081        // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret3'
3082        Function<JsonObject, Ret3<Integer, String, Integer>> 
3083            responseProcessor = (JsonObject jo) -> new Ret3<>(
3084                ReadBoxedJSON.getInteger(jo, "backendNodeId", true),
3085                ReadJSON.getString(jo, "frameId", false, true),
3086                ReadBoxedJSON.getInteger(jo, "nodeId", true)
3087            );
3088        
3089        // Pass the 'defaultSender' to Script-Constructor
3090        // The sender that is used can be changed before executing script.
3091        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
3092    }
3093    
3094    /**
3095     * Returns node's HTML markup.
3096     * 
3097     * @param nodeId Identifier of the node.
3098     * <BR /><B>OPTIONAL</B>
3099     * 
3100     * @param backendNodeId Identifier of the backend node.
3101     * <BR /><B>OPTIONAL</B>
3102     * 
3103     * @param objectId JavaScript object id of the node wrapper.
3104     * <BR /><B>OPTIONAL</B>
3105     * 
3106     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3107     * String&gt;</CODE>
3108     * 
3109     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
3110     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
3111     * String&gt;</CODE> will be returned.
3112     *
3113     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
3114     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
3115      * may be retrieved.</I>
3116     *
3117     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
3118     * <BR /><BR /><UL CLASS=JDUL>
3119     * <LI><CODE>String (<B>outerHTML</B></CODE>)
3120     *     <BR />Outer HTML markup.
3121     * </LI>
3122     * </UL> */
3123    public static Script<String, JsonObject, String> getOuterHTML
3124        (Integer nodeId, Integer backendNodeId, String objectId)
3125    {
3126        final int       webSocketID = 15015000 + counter++;
3127        final boolean[] optionals   = { true, true, true, };
3128        
3129        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3130        String requestJSON = WriteJSON.get(
3131            parameterTypes.get("getOuterHTML"),
3132            parameterNames.get("getOuterHTML"),
3133            optionals, webSocketID,
3134            "DOM.getOuterHTML",
3135            nodeId, backendNodeId, objectId
3136        );
3137        
3138        // 'JSON Binding' ... Converts Browser Response-JSON to 'String'
3139        Function<JsonObject, String> responseProcessor = (JsonObject jo) ->
3140            ReadJSON.getString(jo, "outerHTML", false, true);
3141        
3142        // Pass the 'defaultSender' to Script-Constructor
3143        // The sender that is used can be changed before executing script.
3144        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
3145    }
3146    
3147    /**
3148     * Returns the id of the nearest ancestor that is a relayout boundary.
3149     * <BR /><B>EXPERIMENTAL</B>
3150     * 
3151     * @param nodeId Id of the node.
3152     * 
3153     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3154     * Integer&gt;</CODE>
3155     * 
3156     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
3157     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
3158     * Integer&gt;</CODE> will be returned.
3159     *
3160     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
3161     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
3162      * may be retrieved.</I>
3163     *
3164     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
3165     * <BR /><BR /><UL CLASS=JDUL>
3166     * <LI><CODE>Integer (<B>nodeId</B></CODE>)
3167     *     <BR />Relayout boundary node id for the given node.
3168     * </LI>
3169     * </UL> */
3170    public static Script<String, JsonObject, Integer> getRelayoutBoundary(int nodeId)
3171    {
3172        final int       webSocketID = 15016000 + counter++;
3173        final boolean[] optionals   = { false, };
3174        
3175        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3176        String requestJSON = WriteJSON.get(
3177            parameterTypes.get("getRelayoutBoundary"),
3178            parameterNames.get("getRelayoutBoundary"),
3179            optionals, webSocketID,
3180            "DOM.getRelayoutBoundary",
3181            nodeId
3182        );
3183        
3184        // 'JSON Binding' ... Converts Browser Response-JSON to 'Integer'
3185        Function<JsonObject, Integer> responseProcessor = (JsonObject jo) ->
3186            ReadBoxedJSON.getInteger(jo, "nodeId", true);
3187        
3188        // Pass the 'defaultSender' to Script-Constructor
3189        // The sender that is used can be changed before executing script.
3190        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
3191    }
3192    
3193    /**
3194     * Returns search results from given <CODE>fromIndex</CODE> to given <CODE>toIndex</CODE> from the search with the given
3195     * identifier.
3196     * <BR /><B>EXPERIMENTAL</B>
3197     * 
3198     * @param searchId Unique search session identifier.
3199     * 
3200     * @param fromIndex Start index of the search result to be returned.
3201     * 
3202     * @param toIndex End index of the search result to be returned.
3203     * 
3204     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3205     * int[]&gt;</CODE>
3206     * 
3207     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
3208     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
3209     * int[]&gt;</CODE> will be returned.
3210     *
3211     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
3212     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
3213      * may be retrieved.</I>
3214     *
3215     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
3216     * <BR /><BR /><UL CLASS=JDUL>
3217     * <LI><CODE>int[] (<B>nodeIds</B></CODE>)
3218     *     <BR />Ids of the search result nodes.
3219     * </LI>
3220     * </UL> */
3221    public static Script<String, JsonObject, int[]> getSearchResults
3222        (String searchId, int fromIndex, int toIndex)
3223    {
3224        // Exception-Check(s) to ensure that if any parameters which are not declared as
3225        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
3226        
3227        if (searchId == null) BRDPC.throwNPE("searchId");
3228        
3229        final int       webSocketID = 15017000 + counter++;
3230        final boolean[] optionals   = { false, false, false, };
3231        
3232        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3233        String requestJSON = WriteJSON.get(
3234            parameterTypes.get("getSearchResults"),
3235            parameterNames.get("getSearchResults"),
3236            optionals, webSocketID,
3237            "DOM.getSearchResults",
3238            searchId, fromIndex, toIndex
3239        );
3240        
3241        // 'JSON Binding' ... Converts Browser Response-JSON to 'int[]'
3242        Function<JsonObject, int[]> responseProcessor = (JsonObject jo) ->
3243            (jo.getJsonArray("nodeIds") == null)
3244                ? null
3245                : RJArrIntoPrimArray.intArr(jo.getJsonArray("nodeIds"), -1, 0, null);
3246        
3247        // Pass the 'defaultSender' to Script-Constructor
3248        // The sender that is used can be changed before executing script.
3249        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
3250    }
3251    
3252    /**
3253     * Hides any highlight.
3254     * 
3255     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3256     * {@link Ret0}&gt;</CODE>
3257     *
3258     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
3259     * browser receives the invocation-request.
3260     *
3261     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
3262     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
3263     * {@code >} to ensure the Browser Function has run to completion.
3264     */
3265    public static Script<String, JsonObject, Ret0> hideHighlight()
3266    {
3267        final int          webSocketID = 15018000 + counter++;
3268        final boolean[]    optionals   = new boolean[0];
3269        
3270        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3271        String requestJSON = WriteJSON.get(
3272            parameterTypes.get("hideHighlight"),
3273            parameterNames.get("hideHighlight"),
3274            optionals, webSocketID,
3275            "DOM.hideHighlight"
3276        );
3277        
3278        // This Remote Command does not have a Return-Value.
3279        return new Script<>
3280            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
3281    }
3282    
3283    /**
3284     * Highlights DOM node.
3285     * 
3286     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3287     * {@link Ret0}&gt;</CODE>
3288     *
3289     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
3290     * browser receives the invocation-request.
3291     *
3292     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
3293     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
3294     * {@code >} to ensure the Browser Function has run to completion.
3295     */
3296    public static Script<String, JsonObject, Ret0> highlightNode()
3297    {
3298        final int          webSocketID = 15019000 + counter++;
3299        final boolean[]    optionals   = new boolean[0];
3300        
3301        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3302        String requestJSON = WriteJSON.get(
3303            parameterTypes.get("highlightNode"),
3304            parameterNames.get("highlightNode"),
3305            optionals, webSocketID,
3306            "DOM.highlightNode"
3307        );
3308        
3309        // This Remote Command does not have a Return-Value.
3310        return new Script<>
3311            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
3312    }
3313    
3314    /**
3315     * Highlights given rectangle.
3316     * 
3317     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3318     * {@link Ret0}&gt;</CODE>
3319     *
3320     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
3321     * browser receives the invocation-request.
3322     *
3323     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
3324     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
3325     * {@code >} to ensure the Browser Function has run to completion.
3326     */
3327    public static Script<String, JsonObject, Ret0> highlightRect()
3328    {
3329        final int          webSocketID = 15020000 + counter++;
3330        final boolean[]    optionals   = new boolean[0];
3331        
3332        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3333        String requestJSON = WriteJSON.get(
3334            parameterTypes.get("highlightRect"),
3335            parameterNames.get("highlightRect"),
3336            optionals, webSocketID,
3337            "DOM.highlightRect"
3338        );
3339        
3340        // This Remote Command does not have a Return-Value.
3341        return new Script<>
3342            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
3343    }
3344    
3345    /**
3346     * Marks last undoable state.
3347     * <BR /><B>EXPERIMENTAL</B>
3348     * 
3349     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3350     * {@link Ret0}&gt;</CODE>
3351     *
3352     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
3353     * browser receives the invocation-request.
3354     *
3355     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
3356     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
3357     * {@code >} to ensure the Browser Function has run to completion.
3358     */
3359    public static Script<String, JsonObject, Ret0> markUndoableState()
3360    {
3361        final int          webSocketID = 15021000 + counter++;
3362        final boolean[]    optionals   = new boolean[0];
3363        
3364        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3365        String requestJSON = WriteJSON.get(
3366            parameterTypes.get("markUndoableState"),
3367            parameterNames.get("markUndoableState"),
3368            optionals, webSocketID,
3369            "DOM.markUndoableState"
3370        );
3371        
3372        // This Remote Command does not have a Return-Value.
3373        return new Script<>
3374            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
3375    }
3376    
3377    /**
3378     * Moves node into the new container, places it before the given anchor.
3379     * 
3380     * @param nodeId Id of the node to move.
3381     * 
3382     * @param targetNodeId Id of the element to drop the moved node into.
3383     * 
3384     * @param insertBeforeNodeId 
3385     * Drop node before this one (if absent, the moved node becomes the last child of
3386     * <CODE>targetNodeId</CODE>).
3387     * <BR /><B>OPTIONAL</B>
3388     * 
3389     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3390     * Integer&gt;</CODE>
3391     * 
3392     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
3393     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
3394     * Integer&gt;</CODE> will be returned.
3395     *
3396     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
3397     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
3398      * may be retrieved.</I>
3399     *
3400     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
3401     * <BR /><BR /><UL CLASS=JDUL>
3402     * <LI><CODE>Integer (<B>nodeId</B></CODE>)
3403     *     <BR />New id of the moved node.
3404     * </LI>
3405     * </UL> */
3406    public static Script<String, JsonObject, Integer> moveTo
3407        (int nodeId, int targetNodeId, Integer insertBeforeNodeId)
3408    {
3409        final int       webSocketID = 15022000 + counter++;
3410        final boolean[] optionals   = { false, false, true, };
3411        
3412        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3413        String requestJSON = WriteJSON.get(
3414            parameterTypes.get("moveTo"),
3415            parameterNames.get("moveTo"),
3416            optionals, webSocketID,
3417            "DOM.moveTo",
3418            nodeId, targetNodeId, insertBeforeNodeId
3419        );
3420        
3421        // 'JSON Binding' ... Converts Browser Response-JSON to 'Integer'
3422        Function<JsonObject, Integer> responseProcessor = (JsonObject jo) ->
3423            ReadBoxedJSON.getInteger(jo, "nodeId", true);
3424        
3425        // Pass the 'defaultSender' to Script-Constructor
3426        // The sender that is used can be changed before executing script.
3427        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
3428    }
3429    
3430    /**
3431     * Searches for a given string in the DOM tree. Use <CODE>getSearchResults</CODE> to access search results or
3432     * <CODE>cancelSearch</CODE> to end this search session.
3433     * <BR /><B>EXPERIMENTAL</B>
3434     * 
3435     * @param query Plain text or query selector or XPath search query.
3436     * 
3437     * @param includeUserAgentShadowDOM True to search in user agent shadow DOM.
3438     * <BR /><B>OPTIONAL</B>
3439     * 
3440     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3441     * {@link Ret2}&gt;</CODE>
3442     *
3443     * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 
3444     * {@link Script#exec()}), and a {@link Promise} returned.
3445     *
3446     * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B>
3447     * (using {@link Promise#await()}), the {@code Ret2} will subsequently
3448     * be returned from that call.
3449     * 
3450     * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated
3451     * in an instance of <B>{@link Ret2}</B>
3452     *
3453     * <BR /><BR /><UL CLASS=JDUL>
3454     * <LI><CODE><B>Ret2.a:</B> String (<B>searchId</B>)</CODE>
3455     *     <BR />Unique search session identifier.
3456     *     <BR /><BR /></LI>
3457     * <LI><CODE><B>Ret2.b:</B> Integer (<B>resultCount</B>)</CODE>
3458     *     <BR />Number of search results.
3459     *     </LI>
3460     * </UL>
3461     */
3462    public static Script<String, JsonObject, Ret2<String, Integer>> performSearch
3463        (String query, Boolean includeUserAgentShadowDOM)
3464    {
3465        // Exception-Check(s) to ensure that if any parameters which are not declared as
3466        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
3467        
3468        if (query == null) BRDPC.throwNPE("query");
3469        
3470        final int       webSocketID = 15023000 + counter++;
3471        final boolean[] optionals   = { false, true, };
3472        
3473        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3474        String requestJSON = WriteJSON.get(
3475            parameterTypes.get("performSearch"),
3476            parameterNames.get("performSearch"),
3477            optionals, webSocketID,
3478            "DOM.performSearch",
3479            query, includeUserAgentShadowDOM
3480        );
3481        
3482        // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret2'
3483        Function<JsonObject, Ret2<String, Integer>> 
3484            responseProcessor = (JsonObject jo) -> new Ret2<>(
3485                ReadJSON.getString(jo, "searchId", false, true),
3486                ReadBoxedJSON.getInteger(jo, "resultCount", true)
3487            );
3488        
3489        // Pass the 'defaultSender' to Script-Constructor
3490        // The sender that is used can be changed before executing script.
3491        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
3492    }
3493    
3494    /**
3495     * Requests that the node is sent to the caller given its path. // FIXME, use XPath
3496     * <BR /><B>EXPERIMENTAL</B>
3497     * 
3498     * @param path Path to node in the proprietary format.
3499     * 
3500     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3501     * Integer&gt;</CODE>
3502     * 
3503     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
3504     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
3505     * Integer&gt;</CODE> will be returned.
3506     *
3507     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
3508     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
3509      * may be retrieved.</I>
3510     *
3511     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
3512     * <BR /><BR /><UL CLASS=JDUL>
3513     * <LI><CODE>Integer (<B>nodeId</B></CODE>)
3514     *     <BR />Id of the node for given path.
3515     * </LI>
3516     * </UL> */
3517    public static Script<String, JsonObject, Integer> pushNodeByPathToFrontend(String path)
3518    {
3519        // Exception-Check(s) to ensure that if any parameters which are not declared as
3520        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
3521        
3522        if (path == null) BRDPC.throwNPE("path");
3523        
3524        final int       webSocketID = 15024000 + counter++;
3525        final boolean[] optionals   = { false, };
3526        
3527        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3528        String requestJSON = WriteJSON.get(
3529            parameterTypes.get("pushNodeByPathToFrontend"),
3530            parameterNames.get("pushNodeByPathToFrontend"),
3531            optionals, webSocketID,
3532            "DOM.pushNodeByPathToFrontend",
3533            path
3534        );
3535        
3536        // 'JSON Binding' ... Converts Browser Response-JSON to 'Integer'
3537        Function<JsonObject, Integer> responseProcessor = (JsonObject jo) ->
3538            ReadBoxedJSON.getInteger(jo, "nodeId", true);
3539        
3540        // Pass the 'defaultSender' to Script-Constructor
3541        // The sender that is used can be changed before executing script.
3542        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
3543    }
3544    
3545    /**
3546     * Requests that a batch of nodes is sent to the caller given their backend node ids.
3547     * <BR /><B>EXPERIMENTAL</B>
3548     * 
3549     * @param backendNodeIds The array of backend node ids.
3550     * 
3551     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3552     * int[]&gt;</CODE>
3553     * 
3554     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
3555     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
3556     * int[]&gt;</CODE> will be returned.
3557     *
3558     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
3559     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
3560      * may be retrieved.</I>
3561     *
3562     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
3563     * <BR /><BR /><UL CLASS=JDUL>
3564     * <LI><CODE>int[] (<B>nodeIds</B></CODE>)
3565     *     <BR />The array of ids of pushed nodes that correspond to the backend ids specified in
3566     *     backendNodeIds.
3567     * </LI>
3568     * </UL> */
3569    public static Script<String, JsonObject, int[]> pushNodesByBackendIdsToFrontend
3570        (int[] backendNodeIds)
3571    {
3572        // Exception-Check(s) to ensure that if any parameters which are not declared as
3573        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
3574        
3575        if (backendNodeIds == null) BRDPC.throwNPE("backendNodeIds");
3576        
3577        final int       webSocketID = 15025000 + counter++;
3578        final boolean[] optionals   = { false, };
3579        
3580        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3581        String requestJSON = WriteJSON.get(
3582            parameterTypes.get("pushNodesByBackendIdsToFrontend"),
3583            parameterNames.get("pushNodesByBackendIdsToFrontend"),
3584            optionals, webSocketID,
3585            "DOM.pushNodesByBackendIdsToFrontend",
3586            (Object) backendNodeIds
3587        );
3588        
3589        // 'JSON Binding' ... Converts Browser Response-JSON to 'int[]'
3590        Function<JsonObject, int[]> responseProcessor = (JsonObject jo) ->
3591            (jo.getJsonArray("nodeIds") == null)
3592                ? null
3593                : RJArrIntoPrimArray.intArr(jo.getJsonArray("nodeIds"), -1, 0, null);
3594        
3595        // Pass the 'defaultSender' to Script-Constructor
3596        // The sender that is used can be changed before executing script.
3597        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
3598    }
3599    
3600    /**
3601     * Executes <CODE>querySelector</CODE> on a given node.
3602     * 
3603     * @param nodeId Id of the node to query upon.
3604     * 
3605     * @param selector Selector string.
3606     * 
3607     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3608     * Integer&gt;</CODE>
3609     * 
3610     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
3611     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
3612     * Integer&gt;</CODE> will be returned.
3613     *
3614     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
3615     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
3616      * may be retrieved.</I>
3617     *
3618     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
3619     * <BR /><BR /><UL CLASS=JDUL>
3620     * <LI><CODE>Integer (<B>nodeId</B></CODE>)
3621     *     <BR />Query selector result.
3622     * </LI>
3623     * </UL> */
3624    public static Script<String, JsonObject, Integer> querySelector(int nodeId, String selector)
3625    {
3626        // Exception-Check(s) to ensure that if any parameters which are not declared as
3627        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
3628        
3629        if (selector == null) BRDPC.throwNPE("selector");
3630        
3631        final int       webSocketID = 15026000 + counter++;
3632        final boolean[] optionals   = { false, false, };
3633        
3634        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3635        String requestJSON = WriteJSON.get(
3636            parameterTypes.get("querySelector"),
3637            parameterNames.get("querySelector"),
3638            optionals, webSocketID,
3639            "DOM.querySelector",
3640            nodeId, selector
3641        );
3642        
3643        // 'JSON Binding' ... Converts Browser Response-JSON to 'Integer'
3644        Function<JsonObject, Integer> responseProcessor = (JsonObject jo) ->
3645            ReadBoxedJSON.getInteger(jo, "nodeId", true);
3646        
3647        // Pass the 'defaultSender' to Script-Constructor
3648        // The sender that is used can be changed before executing script.
3649        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
3650    }
3651    
3652    /**
3653     * Executes <CODE>querySelectorAll</CODE> on a given node.
3654     * 
3655     * @param nodeId Id of the node to query upon.
3656     * 
3657     * @param selector Selector string.
3658     * 
3659     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3660     * int[]&gt;</CODE>
3661     * 
3662     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
3663     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
3664     * int[]&gt;</CODE> will be returned.
3665     *
3666     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
3667     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
3668      * may be retrieved.</I>
3669     *
3670     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
3671     * <BR /><BR /><UL CLASS=JDUL>
3672     * <LI><CODE>int[] (<B>nodeIds</B></CODE>)
3673     *     <BR />Query selector result.
3674     * </LI>
3675     * </UL> */
3676    public static Script<String, JsonObject, int[]> querySelectorAll
3677        (int nodeId, String selector)
3678    {
3679        // Exception-Check(s) to ensure that if any parameters which are not declared as
3680        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
3681        
3682        if (selector == null) BRDPC.throwNPE("selector");
3683        
3684        final int       webSocketID = 15027000 + counter++;
3685        final boolean[] optionals   = { false, false, };
3686        
3687        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3688        String requestJSON = WriteJSON.get(
3689            parameterTypes.get("querySelectorAll"),
3690            parameterNames.get("querySelectorAll"),
3691            optionals, webSocketID,
3692            "DOM.querySelectorAll",
3693            nodeId, selector
3694        );
3695        
3696        // 'JSON Binding' ... Converts Browser Response-JSON to 'int[]'
3697        Function<JsonObject, int[]> responseProcessor = (JsonObject jo) ->
3698            (jo.getJsonArray("nodeIds") == null)
3699                ? null
3700                : RJArrIntoPrimArray.intArr(jo.getJsonArray("nodeIds"), -1, 0, null);
3701        
3702        // Pass the 'defaultSender' to Script-Constructor
3703        // The sender that is used can be changed before executing script.
3704        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
3705    }
3706    
3707    /**
3708     * Re-does the last undone action.
3709     * <BR /><B>EXPERIMENTAL</B>
3710     * 
3711     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3712     * {@link Ret0}&gt;</CODE>
3713     *
3714     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
3715     * browser receives the invocation-request.
3716     *
3717     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
3718     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
3719     * {@code >} to ensure the Browser Function has run to completion.
3720     */
3721    public static Script<String, JsonObject, Ret0> redo()
3722    {
3723        final int          webSocketID = 15028000 + counter++;
3724        final boolean[]    optionals   = new boolean[0];
3725        
3726        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3727        String requestJSON = WriteJSON.get(
3728            parameterTypes.get("redo"),
3729            parameterNames.get("redo"),
3730            optionals, webSocketID,
3731            "DOM.redo"
3732        );
3733        
3734        // This Remote Command does not have a Return-Value.
3735        return new Script<>
3736            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
3737    }
3738    
3739    /**
3740     * Removes attribute with given name from an element with given id.
3741     * 
3742     * @param nodeId Id of the element to remove attribute from.
3743     * 
3744     * @param name Name of the attribute to remove.
3745     * 
3746     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3747     * {@link Ret0}&gt;</CODE>
3748     *
3749     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
3750     * browser receives the invocation-request.
3751     *
3752     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
3753     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
3754     * {@code >} to ensure the Browser Function has run to completion.
3755     */
3756    public static Script<String, JsonObject, Ret0> removeAttribute(int nodeId, String name)
3757    {
3758        // Exception-Check(s) to ensure that if any parameters which are not declared as
3759        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
3760        
3761        if (name == null) BRDPC.throwNPE("name");
3762        
3763        final int       webSocketID = 15029000 + counter++;
3764        final boolean[] optionals   = { false, false, };
3765        
3766        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3767        String requestJSON = WriteJSON.get(
3768            parameterTypes.get("removeAttribute"),
3769            parameterNames.get("removeAttribute"),
3770            optionals, webSocketID,
3771            "DOM.removeAttribute",
3772            nodeId, name
3773        );
3774        
3775        // This Remote Command does not have a Return-Value.
3776        return new Script<>
3777            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
3778    }
3779    
3780    /**
3781     * Removes node with given id.
3782     * 
3783     * @param nodeId Id of the node to remove.
3784     * 
3785     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3786     * {@link Ret0}&gt;</CODE>
3787     *
3788     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
3789     * browser receives the invocation-request.
3790     *
3791     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
3792     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
3793     * {@code >} to ensure the Browser Function has run to completion.
3794     */
3795    public static Script<String, JsonObject, Ret0> removeNode(int nodeId)
3796    {
3797        final int       webSocketID = 15030000 + counter++;
3798        final boolean[] optionals   = { false, };
3799        
3800        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3801        String requestJSON = WriteJSON.get(
3802            parameterTypes.get("removeNode"),
3803            parameterNames.get("removeNode"),
3804            optionals, webSocketID,
3805            "DOM.removeNode",
3806            nodeId
3807        );
3808        
3809        // This Remote Command does not have a Return-Value.
3810        return new Script<>
3811            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
3812    }
3813    
3814    /**
3815     * Requests that children of the node with given id are returned to the caller in form of
3816     * <CODE>setChildNodes</CODE> events where not only immediate children are retrieved, but all children down to
3817     * the specified depth.
3818     * 
3819     * @param nodeId Id of the node to get children for.
3820     * 
3821     * @param depth 
3822     * The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the
3823     * entire subtree or provide an integer larger than 0.
3824     * <BR /><B>OPTIONAL</B>
3825     * 
3826     * @param pierce 
3827     * Whether or not iframes and shadow roots should be traversed when returning the sub-tree
3828     * (default is false).
3829     * <BR /><B>OPTIONAL</B>
3830     * 
3831     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3832     * {@link Ret0}&gt;</CODE>
3833     *
3834     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
3835     * browser receives the invocation-request.
3836     *
3837     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
3838     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
3839     * {@code >} to ensure the Browser Function has run to completion.
3840     */
3841    public static Script<String, JsonObject, Ret0> requestChildNodes
3842        (int nodeId, Integer depth, Boolean pierce)
3843    {
3844        final int       webSocketID = 15031000 + counter++;
3845        final boolean[] optionals   = { false, true, true, };
3846        
3847        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3848        String requestJSON = WriteJSON.get(
3849            parameterTypes.get("requestChildNodes"),
3850            parameterNames.get("requestChildNodes"),
3851            optionals, webSocketID,
3852            "DOM.requestChildNodes",
3853            nodeId, depth, pierce
3854        );
3855        
3856        // This Remote Command does not have a Return-Value.
3857        return new Script<>
3858            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
3859    }
3860    
3861    /**
3862     * Requests that the node is sent to the caller given the JavaScript node object reference. All
3863     * nodes that form the path from the node to the root are also sent to the client as a series of
3864     * <CODE>setChildNodes</CODE> notifications.
3865     * 
3866     * @param objectId JavaScript object id to convert into node.
3867     * 
3868     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3869     * Integer&gt;</CODE>
3870     * 
3871     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
3872     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
3873     * Integer&gt;</CODE> will be returned.
3874     *
3875     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
3876     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
3877      * may be retrieved.</I>
3878     *
3879     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
3880     * <BR /><BR /><UL CLASS=JDUL>
3881     * <LI><CODE>Integer (<B>nodeId</B></CODE>)
3882     *     <BR />Node id for given object.
3883     * </LI>
3884     * </UL> */
3885    public static Script<String, JsonObject, Integer> requestNode(String objectId)
3886    {
3887        // Exception-Check(s) to ensure that if any parameters which are not declared as
3888        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
3889        
3890        if (objectId == null) BRDPC.throwNPE("objectId");
3891        
3892        final int       webSocketID = 15032000 + counter++;
3893        final boolean[] optionals   = { false, };
3894        
3895        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3896        String requestJSON = WriteJSON.get(
3897            parameterTypes.get("requestNode"),
3898            parameterNames.get("requestNode"),
3899            optionals, webSocketID,
3900            "DOM.requestNode",
3901            objectId
3902        );
3903        
3904        // 'JSON Binding' ... Converts Browser Response-JSON to 'Integer'
3905        Function<JsonObject, Integer> responseProcessor = (JsonObject jo) ->
3906            ReadBoxedJSON.getInteger(jo, "nodeId", true);
3907        
3908        // Pass the 'defaultSender' to Script-Constructor
3909        // The sender that is used can be changed before executing script.
3910        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
3911    }
3912    
3913    /**
3914     * Resolves the JavaScript node object for a given NodeId or BackendNodeId.
3915     * 
3916     * @param nodeId Id of the node to resolve.
3917     * <BR /><B>OPTIONAL</B>
3918     * 
3919     * @param backendNodeId Backend identifier of the node to resolve.
3920     * <BR /><B>OPTIONAL</B>
3921     * 
3922     * @param objectGroup Symbolic group name that can be used to release multiple objects.
3923     * <BR /><B>OPTIONAL</B>
3924     * 
3925     * @param executionContextId Execution context in which to resolve the node.
3926     * <BR /><B>OPTIONAL</B>
3927     * 
3928     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3929     * {@link RunTime.RemoteObject}&gt;</CODE>
3930     * 
3931     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
3932     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
3933     * {@link RunTime.RemoteObject}&gt;</CODE> will be returned.
3934     *
3935     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
3936     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
3937      * may be retrieved.</I>
3938     *
3939     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
3940     * <BR /><BR /><UL CLASS=JDUL>
3941     * <LI><CODE>{@link RunTime.RemoteObject} (<B>object</B></CODE>)
3942     *     <BR />JavaScript object wrapper for given node.
3943     * </LI>
3944     * </UL> */
3945    public static Script<String, JsonObject, RunTime.RemoteObject> resolveNode
3946        (Integer nodeId, Integer backendNodeId, String objectGroup, Integer executionContextId)
3947    {
3948        final int       webSocketID = 15033000 + counter++;
3949        final boolean[] optionals   = { true, true, true, true, };
3950        
3951        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3952        String requestJSON = WriteJSON.get(
3953            parameterTypes.get("resolveNode"),
3954            parameterNames.get("resolveNode"),
3955            optionals, webSocketID,
3956            "DOM.resolveNode",
3957            nodeId, backendNodeId, objectGroup, executionContextId
3958        );
3959        
3960        // 'JSON Binding' ... Converts Browser Response-JSON to 'RunTime.RemoteObject'
3961        Function<JsonObject, RunTime.RemoteObject> responseProcessor = (JsonObject jo) ->
3962            ReadJSON.getObject(jo, "object", RunTime.RemoteObject.class, false, true);
3963        
3964        // Pass the 'defaultSender' to Script-Constructor
3965        // The sender that is used can be changed before executing script.
3966        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
3967    }
3968    
3969    /**
3970     * Sets attribute for an element with given id.
3971     * 
3972     * @param nodeId Id of the element to set attribute for.
3973     * 
3974     * @param name Attribute name.
3975     * 
3976     * @param value Attribute value.
3977     * 
3978     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3979     * {@link Ret0}&gt;</CODE>
3980     *
3981     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
3982     * browser receives the invocation-request.
3983     *
3984     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
3985     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
3986     * {@code >} to ensure the Browser Function has run to completion.
3987     */
3988    public static Script<String, JsonObject, Ret0> setAttributeValue
3989        (int nodeId, String name, String value)
3990    {
3991        // Exception-Check(s) to ensure that if any parameters which are not declared as
3992        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
3993        
3994        if (name == null)  BRDPC.throwNPE("name");
3995        if (value == null) BRDPC.throwNPE("value");
3996        
3997        final int       webSocketID = 15034000 + counter++;
3998        final boolean[] optionals   = { false, false, false, };
3999        
4000        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
4001        String requestJSON = WriteJSON.get(
4002            parameterTypes.get("setAttributeValue"),
4003            parameterNames.get("setAttributeValue"),
4004            optionals, webSocketID,
4005            "DOM.setAttributeValue",
4006            nodeId, name, value
4007        );
4008        
4009        // This Remote Command does not have a Return-Value.
4010        return new Script<>
4011            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
4012    }
4013    
4014    /**
4015     * Sets attributes on element with given id. This method is useful when user edits some existing
4016     * attribute value and types in several attribute name/value pairs.
4017     * 
4018     * @param nodeId Id of the element to set attributes for.
4019     * 
4020     * @param text Text with a number of attributes. Will parse this text using HTML parser.
4021     * 
4022     * @param name 
4023     * Attribute name to replace with new attributes derived from text in case text parsed
4024     * successfully.
4025     * <BR /><B>OPTIONAL</B>
4026     * 
4027     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
4028     * {@link Ret0}&gt;</CODE>
4029     *
4030     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
4031     * browser receives the invocation-request.
4032     *
4033     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
4034     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
4035     * {@code >} to ensure the Browser Function has run to completion.
4036     */
4037    public static Script<String, JsonObject, Ret0> setAttributesAsText
4038        (int nodeId, String text, String name)
4039    {
4040        // Exception-Check(s) to ensure that if any parameters which are not declared as
4041        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
4042        
4043        if (text == null) BRDPC.throwNPE("text");
4044        
4045        final int       webSocketID = 15035000 + counter++;
4046        final boolean[] optionals   = { false, false, true, };
4047        
4048        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
4049        String requestJSON = WriteJSON.get(
4050            parameterTypes.get("setAttributesAsText"),
4051            parameterNames.get("setAttributesAsText"),
4052            optionals, webSocketID,
4053            "DOM.setAttributesAsText",
4054            nodeId, text, name
4055        );
4056        
4057        // This Remote Command does not have a Return-Value.
4058        return new Script<>
4059            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
4060    }
4061    
4062    /**
4063     * Sets files for the given file input element.
4064     * 
4065     * @param files Array of file paths to set.
4066     * 
4067     * @param nodeId Identifier of the node.
4068     * <BR /><B>OPTIONAL</B>
4069     * 
4070     * @param backendNodeId Identifier of the backend node.
4071     * <BR /><B>OPTIONAL</B>
4072     * 
4073     * @param objectId JavaScript object id of the node wrapper.
4074     * <BR /><B>OPTIONAL</B>
4075     * 
4076     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
4077     * {@link Ret0}&gt;</CODE>
4078     *
4079     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
4080     * browser receives the invocation-request.
4081     *
4082     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
4083     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
4084     * {@code >} to ensure the Browser Function has run to completion.
4085     */
4086    public static Script<String, JsonObject, Ret0> setFileInputFiles
4087        (String[] files, Integer nodeId, Integer backendNodeId, String objectId)
4088    {
4089        // Exception-Check(s) to ensure that if any parameters which are not declared as
4090        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
4091        
4092        if (files == null) BRDPC.throwNPE("files");
4093        
4094        final int       webSocketID = 15036000 + counter++;
4095        final boolean[] optionals   = { false, true, true, true, };
4096        
4097        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
4098        String requestJSON = WriteJSON.get(
4099            parameterTypes.get("setFileInputFiles"),
4100            parameterNames.get("setFileInputFiles"),
4101            optionals, webSocketID,
4102            "DOM.setFileInputFiles",
4103            files, nodeId, backendNodeId, objectId
4104        );
4105        
4106        // This Remote Command does not have a Return-Value.
4107        return new Script<>
4108            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
4109    }
4110    
4111    /**
4112     * Sets if stack traces should be captured for Nodes. See <CODE>Node.getNodeStackTraces</CODE>. Default is disabled.
4113     * <BR /><B>EXPERIMENTAL</B>
4114     * 
4115     * @param enable Enable or disable.
4116     * 
4117     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
4118     * {@link Ret0}&gt;</CODE>
4119     *
4120     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
4121     * browser receives the invocation-request.
4122     *
4123     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
4124     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
4125     * {@code >} to ensure the Browser Function has run to completion.
4126     */
4127    public static Script<String, JsonObject, Ret0> setNodeStackTracesEnabled(boolean enable)
4128    {
4129        final int       webSocketID = 15037000 + counter++;
4130        final boolean[] optionals   = { false, };
4131        
4132        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
4133        String requestJSON = WriteJSON.get(
4134            parameterTypes.get("setNodeStackTracesEnabled"),
4135            parameterNames.get("setNodeStackTracesEnabled"),
4136            optionals, webSocketID,
4137            "DOM.setNodeStackTracesEnabled",
4138            enable
4139        );
4140        
4141        // This Remote Command does not have a Return-Value.
4142        return new Script<>
4143            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
4144    }
4145    
4146    /**
4147     * Gets stack traces associated with a Node. As of now, only provides stack trace for Node creation.
4148     * <BR /><B>EXPERIMENTAL</B>
4149     * 
4150     * @param nodeId Id of the node to get stack traces for.
4151     * 
4152     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
4153     * {@link RunTime.StackTrace}&gt;</CODE>
4154     * 
4155     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
4156     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
4157     * {@link RunTime.StackTrace}&gt;</CODE> will be returned.
4158     *
4159     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
4160     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
4161      * may be retrieved.</I>
4162     *
4163     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
4164     * <BR /><BR /><UL CLASS=JDUL>
4165     * <LI><CODE>{@link RunTime.StackTrace} (<B>creation</B></CODE>)
4166     *     <BR />Creation stack trace, if available.
4167     * </LI>
4168     * </UL> */
4169    public static Script<String, JsonObject, RunTime.StackTrace> getNodeStackTraces(int nodeId)
4170    {
4171        final int       webSocketID = 15038000 + counter++;
4172        final boolean[] optionals   = { false, };
4173        
4174        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
4175        String requestJSON = WriteJSON.get(
4176            parameterTypes.get("getNodeStackTraces"),
4177            parameterNames.get("getNodeStackTraces"),
4178            optionals, webSocketID,
4179            "DOM.getNodeStackTraces",
4180            nodeId
4181        );
4182        
4183        // 'JSON Binding' ... Converts Browser Response-JSON to 'RunTime.StackTrace'
4184        Function<JsonObject, RunTime.StackTrace> responseProcessor = (JsonObject jo) ->
4185            ReadJSON.getObject(jo, "creation", RunTime.StackTrace.class, true, false);
4186        
4187        // Pass the 'defaultSender' to Script-Constructor
4188        // The sender that is used can be changed before executing script.
4189        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
4190    }
4191    
4192    /**
4193     * Returns file information for the given
4194     * File wrapper.
4195     * <BR /><B>EXPERIMENTAL</B>
4196     * 
4197     * @param objectId JavaScript object id of the node wrapper.
4198     * 
4199     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
4200     * String&gt;</CODE>
4201     * 
4202     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
4203     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
4204     * String&gt;</CODE> will be returned.
4205     *
4206     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
4207     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
4208      * may be retrieved.</I>
4209     *
4210     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
4211     * <BR /><BR /><UL CLASS=JDUL>
4212     * <LI><CODE>String (<B>path</B></CODE>)
4213     *     <BR />-
4214     * </LI>
4215     * </UL> */
4216    public static Script<String, JsonObject, String> getFileInfo(String objectId)
4217    {
4218        // Exception-Check(s) to ensure that if any parameters which are not declared as
4219        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
4220        
4221        if (objectId == null) BRDPC.throwNPE("objectId");
4222        
4223        final int       webSocketID = 15039000 + counter++;
4224        final boolean[] optionals   = { false, };
4225        
4226        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
4227        String requestJSON = WriteJSON.get(
4228            parameterTypes.get("getFileInfo"),
4229            parameterNames.get("getFileInfo"),
4230            optionals, webSocketID,
4231            "DOM.getFileInfo",
4232            objectId
4233        );
4234        
4235        // 'JSON Binding' ... Converts Browser Response-JSON to 'String'
4236        Function<JsonObject, String> responseProcessor = (JsonObject jo) ->
4237            ReadJSON.getString(jo, "path", false, true);
4238        
4239        // Pass the 'defaultSender' to Script-Constructor
4240        // The sender that is used can be changed before executing script.
4241        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
4242    }
4243    
4244    /**
4245     * Enables console to refer to the node with given id via $x (see Command Line API for more details
4246     * $x functions).
4247     * <BR /><B>EXPERIMENTAL</B>
4248     * 
4249     * @param nodeId DOM node id to be accessible by means of $x command line API.
4250     * 
4251     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
4252     * {@link Ret0}&gt;</CODE>
4253     *
4254     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
4255     * browser receives the invocation-request.
4256     *
4257     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
4258     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
4259     * {@code >} to ensure the Browser Function has run to completion.
4260     */
4261    public static Script<String, JsonObject, Ret0> setInspectedNode(int nodeId)
4262    {
4263        final int       webSocketID = 15040000 + counter++;
4264        final boolean[] optionals   = { false, };
4265        
4266        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
4267        String requestJSON = WriteJSON.get(
4268            parameterTypes.get("setInspectedNode"),
4269            parameterNames.get("setInspectedNode"),
4270            optionals, webSocketID,
4271            "DOM.setInspectedNode",
4272            nodeId
4273        );
4274        
4275        // This Remote Command does not have a Return-Value.
4276        return new Script<>
4277            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
4278    }
4279    
4280    /**
4281     * Sets node name for a node with given id.
4282     * 
4283     * @param nodeId Id of the node to set name for.
4284     * 
4285     * @param name New node's name.
4286     * 
4287     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
4288     * Integer&gt;</CODE>
4289     * 
4290     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
4291     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
4292     * Integer&gt;</CODE> will be returned.
4293     *
4294     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
4295     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
4296      * may be retrieved.</I>
4297     *
4298     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
4299     * <BR /><BR /><UL CLASS=JDUL>
4300     * <LI><CODE>Integer (<B>nodeId</B></CODE>)
4301     *     <BR />New node's id.
4302     * </LI>
4303     * </UL> */
4304    public static Script<String, JsonObject, Integer> setNodeName(int nodeId, String name)
4305    {
4306        // Exception-Check(s) to ensure that if any parameters which are not declared as
4307        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
4308        
4309        if (name == null) BRDPC.throwNPE("name");
4310        
4311        final int       webSocketID = 15041000 + counter++;
4312        final boolean[] optionals   = { false, false, };
4313        
4314        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
4315        String requestJSON = WriteJSON.get(
4316            parameterTypes.get("setNodeName"),
4317            parameterNames.get("setNodeName"),
4318            optionals, webSocketID,
4319            "DOM.setNodeName",
4320            nodeId, name
4321        );
4322        
4323        // 'JSON Binding' ... Converts Browser Response-JSON to 'Integer'
4324        Function<JsonObject, Integer> responseProcessor = (JsonObject jo) ->
4325            ReadBoxedJSON.getInteger(jo, "nodeId", true);
4326        
4327        // Pass the 'defaultSender' to Script-Constructor
4328        // The sender that is used can be changed before executing script.
4329        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
4330    }
4331    
4332    /**
4333     * Sets node value for a node with given id.
4334     * 
4335     * @param nodeId Id of the node to set value for.
4336     * 
4337     * @param value New node's value.
4338     * 
4339     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
4340     * {@link Ret0}&gt;</CODE>
4341     *
4342     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
4343     * browser receives the invocation-request.
4344     *
4345     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
4346     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
4347     * {@code >} to ensure the Browser Function has run to completion.
4348     */
4349    public static Script<String, JsonObject, Ret0> setNodeValue(int nodeId, String value)
4350    {
4351        // Exception-Check(s) to ensure that if any parameters which are not declared as
4352        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
4353        
4354        if (value == null) BRDPC.throwNPE("value");
4355        
4356        final int       webSocketID = 15042000 + counter++;
4357        final boolean[] optionals   = { false, false, };
4358        
4359        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
4360        String requestJSON = WriteJSON.get(
4361            parameterTypes.get("setNodeValue"),
4362            parameterNames.get("setNodeValue"),
4363            optionals, webSocketID,
4364            "DOM.setNodeValue",
4365            nodeId, value
4366        );
4367        
4368        // This Remote Command does not have a Return-Value.
4369        return new Script<>
4370            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
4371    }
4372    
4373    /**
4374     * Sets node HTML markup, returns new node id.
4375     * 
4376     * @param nodeId Id of the node to set markup for.
4377     * 
4378     * @param outerHTML Outer HTML markup to set.
4379     * 
4380     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
4381     * {@link Ret0}&gt;</CODE>
4382     *
4383     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
4384     * browser receives the invocation-request.
4385     *
4386     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
4387     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
4388     * {@code >} to ensure the Browser Function has run to completion.
4389     */
4390    public static Script<String, JsonObject, Ret0> setOuterHTML(int nodeId, String outerHTML)
4391    {
4392        // Exception-Check(s) to ensure that if any parameters which are not declared as
4393        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
4394        
4395        if (outerHTML == null) BRDPC.throwNPE("outerHTML");
4396        
4397        final int       webSocketID = 15043000 + counter++;
4398        final boolean[] optionals   = { false, false, };
4399        
4400        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
4401        String requestJSON = WriteJSON.get(
4402            parameterTypes.get("setOuterHTML"),
4403            parameterNames.get("setOuterHTML"),
4404            optionals, webSocketID,
4405            "DOM.setOuterHTML",
4406            nodeId, outerHTML
4407        );
4408        
4409        // This Remote Command does not have a Return-Value.
4410        return new Script<>
4411            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
4412    }
4413    
4414    /**
4415     * Undoes the last performed action.
4416     * <BR /><B>EXPERIMENTAL</B>
4417     * 
4418     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
4419     * {@link Ret0}&gt;</CODE>
4420     *
4421     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
4422     * browser receives the invocation-request.
4423     *
4424     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
4425     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
4426     * {@code >} to ensure the Browser Function has run to completion.
4427     */
4428    public static Script<String, JsonObject, Ret0> undo()
4429    {
4430        final int          webSocketID = 15044000 + counter++;
4431        final boolean[]    optionals   = new boolean[0];
4432        
4433        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
4434        String requestJSON = WriteJSON.get(
4435            parameterTypes.get("undo"),
4436            parameterNames.get("undo"),
4437            optionals, webSocketID,
4438            "DOM.undo"
4439        );
4440        
4441        // This Remote Command does not have a Return-Value.
4442        return new Script<>
4443            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
4444    }
4445    
4446    /**
4447     * Returns iframe node that owns iframe with the given domain.
4448     * <BR /><B>EXPERIMENTAL</B>
4449     * 
4450     * @param frameId -
4451     * 
4452     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
4453     * {@link Ret2}&gt;</CODE>
4454     *
4455     * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 
4456     * {@link Script#exec()}), and a {@link Promise} returned.
4457     *
4458     * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B>
4459     * (using {@link Promise#await()}), the {@code Ret2} will subsequently
4460     * be returned from that call.
4461     * 
4462     * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated
4463     * in an instance of <B>{@link Ret2}</B>
4464     *
4465     * <BR /><BR /><UL CLASS=JDUL>
4466     * <LI><CODE><B>Ret2.a:</B> Integer (<B>backendNodeId</B>)</CODE>
4467     *     <BR />Resulting node.
4468     *     <BR /><BR /></LI>
4469     * <LI><CODE><B>Ret2.b:</B> Integer (<B>nodeId</B>)</CODE>
4470     *     <BR />Id of the node at given coordinates, only when enabled and requested document.
4471     *     </LI>
4472     * </UL>
4473     */
4474    public static Script<String, JsonObject, Ret2<Integer, Integer>> getFrameOwner
4475        (String frameId)
4476    {
4477        // Exception-Check(s) to ensure that if any parameters which are not declared as
4478        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
4479        
4480        if (frameId == null) BRDPC.throwNPE("frameId");
4481        
4482        final int       webSocketID = 15045000 + counter++;
4483        final boolean[] optionals   = { false, };
4484        
4485        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
4486        String requestJSON = WriteJSON.get(
4487            parameterTypes.get("getFrameOwner"),
4488            parameterNames.get("getFrameOwner"),
4489            optionals, webSocketID,
4490            "DOM.getFrameOwner",
4491            frameId
4492        );
4493        
4494        // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret2'
4495        Function<JsonObject, Ret2<Integer, Integer>> 
4496            responseProcessor = (JsonObject jo) -> new Ret2<>(
4497                ReadBoxedJSON.getInteger(jo, "backendNodeId", true),
4498                ReadBoxedJSON.getInteger(jo, "nodeId", true)
4499            );
4500        
4501        // Pass the 'defaultSender' to Script-Constructor
4502        // The sender that is used can be changed before executing script.
4503        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
4504    }
4505    
4506    /**
4507     * Returns the container of the given node based on container query conditions.
4508     * If containerName is given, it will find the nearest container with a matching name;
4509     * otherwise it will find the nearest container regardless of its container name.
4510     * <BR /><B>EXPERIMENTAL</B>
4511     * 
4512     * @param nodeId -
4513     * 
4514     * @param containerName -
4515     * <BR /><B>OPTIONAL</B>
4516     * 
4517     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
4518     * Integer&gt;</CODE>
4519     * 
4520     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
4521     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
4522     * Integer&gt;</CODE> will be returned.
4523     *
4524     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
4525     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
4526      * may be retrieved.</I>
4527     *
4528     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
4529     * <BR /><BR /><UL CLASS=JDUL>
4530     * <LI><CODE>Integer (<B>nodeId</B></CODE>)
4531     *     <BR />The container node for the given node, or null if not found.
4532     * </LI>
4533     * </UL> */
4534    public static Script<String, JsonObject, Integer> getContainerForNode
4535        (int nodeId, String containerName)
4536    {
4537        final int       webSocketID = 15046000 + counter++;
4538        final boolean[] optionals   = { false, true, };
4539        
4540        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
4541        String requestJSON = WriteJSON.get(
4542            parameterTypes.get("getContainerForNode"),
4543            parameterNames.get("getContainerForNode"),
4544            optionals, webSocketID,
4545            "DOM.getContainerForNode",
4546            nodeId, containerName
4547        );
4548        
4549        // 'JSON Binding' ... Converts Browser Response-JSON to 'Integer'
4550        Function<JsonObject, Integer> responseProcessor = (JsonObject jo) ->
4551            ReadBoxedJSON.getInteger(jo, "nodeId", true);
4552        
4553        // Pass the 'defaultSender' to Script-Constructor
4554        // The sender that is used can be changed before executing script.
4555        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
4556    }
4557    
4558    /**
4559     * Returns the descendants of a container query container that have
4560     * container queries against this container.
4561     * <BR /><B>EXPERIMENTAL</B>
4562     * 
4563     * @param nodeId Id of the container node to find querying descendants from.
4564     * 
4565     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
4566     * int[]&gt;</CODE>
4567     * 
4568     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
4569     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
4570     * int[]&gt;</CODE> will be returned.
4571     *
4572     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
4573     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
4574      * may be retrieved.</I>
4575     *
4576     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
4577     * <BR /><BR /><UL CLASS=JDUL>
4578     * <LI><CODE>int[] (<B>nodeIds</B></CODE>)
4579     *     <BR />Descendant nodes with container queries against the given container.
4580     * </LI>
4581     * </UL> */
4582    public static Script<String, JsonObject, int[]> getQueryingDescendantsForContainer
4583        (int nodeId)
4584    {
4585        final int       webSocketID = 15047000 + counter++;
4586        final boolean[] optionals   = { false, };
4587        
4588        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
4589        String requestJSON = WriteJSON.get(
4590            parameterTypes.get("getQueryingDescendantsForContainer"),
4591            parameterNames.get("getQueryingDescendantsForContainer"),
4592            optionals, webSocketID,
4593            "DOM.getQueryingDescendantsForContainer",
4594            nodeId
4595        );
4596        
4597        // 'JSON Binding' ... Converts Browser Response-JSON to 'int[]'
4598        Function<JsonObject, int[]> responseProcessor = (JsonObject jo) ->
4599            (jo.getJsonArray("nodeIds") == null)
4600                ? null
4601                : RJArrIntoPrimArray.intArr(jo.getJsonArray("nodeIds"), -1, 0, null);
4602        
4603        // Pass the 'defaultSender' to Script-Constructor
4604        // The sender that is used can be changed before executing script.
4605        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
4606    }
4607    
4608}