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>Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing
024 * breakpoints, stepping through execution, exploring stack traces, etc.</B></SPAN>
025 * 
026 * <EMBED CLASS='external-html' DATA-FILE-ID=CODE_GEN_NOTE>
027 */
028@StaticFunctional(Excused={"counter"}, Excuses={Excuse.CONFIGURATION})
029@JDHeaderBackgroundImg(EmbedTagFileID="WOOD_PLANK_NOTE")
030public class Debugger
031{
032    // ********************************************************************************************
033    // ********************************************************************************************
034    // Class Header Stuff
035    // ********************************************************************************************
036    // ********************************************************************************************
037
038
039    // No Pubic Constructors
040    private Debugger () { }
041
042    // These two Vector's are used by all the "Methods" exported by this class.  java.lang.reflect
043    // is used to generate the JSON String's.  It saves thousands of lines of Auto-Generated Code.
044    private static final Map<String, Vector<String>>    parameterNames = new HashMap<>();
045    private static final Map<String, Vector<Class<?>>>  parameterTypes = new HashMap<>();
046
047    // Some Methods do not take any parameters - for instance all the "enable()" and "disable()"
048    // I simply could not get ride of RAW-TYPES and UNCHECKED warnings... so there are now,
049    // offically, two empty-vectors.  One for String's, and the other for Classes.
050
051    private static final Vector<String>     EMPTY_VEC_STR = new Vector<>();
052    private static final Vector<Class<?>>   EMPTY_VEC_CLASS = new Vector<>();
053
054    static
055    {
056        for (Method m : Debugger.class.getMethods())
057        {
058            // This doesn't work!  The parameter names are all "arg0" ... "argN"
059            // It works for java.lang.reflect.Field, BUT NOT java.lang.reflect.Parameter!
060            //
061            // Vector<String> parameterNamesList = new Vector<>(); -- NOPE!
062
063            Vector<Class<?>> parameterTypesList = new Vector<>();
064        
065            for (Parameter p : m.getParameters()) parameterTypesList.add(p.getType());
066
067            parameterTypes.put(
068                m.getName(),
069                (parameterTypesList.size() > 0) ? parameterTypesList : EMPTY_VEC_CLASS
070            );
071        }
072    }
073
074    static
075    {
076        Vector<String> v = null;
077
078        v = new Vector<String>(2);
079        parameterNames.put("continueToLocation", v);
080        Collections.addAll(v, new String[]
081        { "location", "targetCallFrames", });
082
083        parameterNames.put("disable", EMPTY_VEC_STR);
084
085        v = new Vector<String>(1);
086        parameterNames.put("enable", v);
087        Collections.addAll(v, new String[]
088        { "maxScriptsCacheSize", });
089
090        v = new Vector<String>(9);
091        parameterNames.put("evaluateOnCallFrame", v);
092        Collections.addAll(v, new String[]
093        { "callFrameId", "expression", "objectGroup", "includeCommandLineAPI", "silent", "returnByValue", "generatePreview", "throwOnSideEffect", "timeout", });
094
095        v = new Vector<String>(3);
096        parameterNames.put("getPossibleBreakpoints", v);
097        Collections.addAll(v, new String[]
098        { "start", "end", "restrictToFunction", });
099
100        v = new Vector<String>(1);
101        parameterNames.put("getScriptSource", v);
102        Collections.addAll(v, new String[]
103        { "scriptId", });
104
105        v = new Vector<String>(1);
106        parameterNames.put("getWasmBytecode", v);
107        Collections.addAll(v, new String[]
108        { "scriptId", });
109
110        v = new Vector<String>(1);
111        parameterNames.put("getStackTrace", v);
112        Collections.addAll(v, new String[]
113        { "stackTraceId", });
114
115        parameterNames.put("pause", EMPTY_VEC_STR);
116
117        v = new Vector<String>(1);
118        parameterNames.put("pauseOnAsyncCall", v);
119        Collections.addAll(v, new String[]
120        { "parentStackTraceId", });
121
122        v = new Vector<String>(1);
123        parameterNames.put("removeBreakpoint", v);
124        Collections.addAll(v, new String[]
125        { "breakpointId", });
126
127        v = new Vector<String>(1);
128        parameterNames.put("restartFrame", v);
129        Collections.addAll(v, new String[]
130        { "callFrameId", });
131
132        v = new Vector<String>(1);
133        parameterNames.put("resume", v);
134        Collections.addAll(v, new String[]
135        { "terminateOnResume", });
136
137        v = new Vector<String>(4);
138        parameterNames.put("searchInContent", v);
139        Collections.addAll(v, new String[]
140        { "scriptId", "query", "caseSensitive", "isRegex", });
141
142        v = new Vector<String>(1);
143        parameterNames.put("setAsyncCallStackDepth", v);
144        Collections.addAll(v, new String[]
145        { "maxDepth", });
146
147        v = new Vector<String>(1);
148        parameterNames.put("setBlackboxPatterns", v);
149        Collections.addAll(v, new String[]
150        { "patterns", });
151
152        v = new Vector<String>(2);
153        parameterNames.put("setBlackboxedRanges", v);
154        Collections.addAll(v, new String[]
155        { "scriptId", "positions", });
156
157        v = new Vector<String>(2);
158        parameterNames.put("setBreakpoint", v);
159        Collections.addAll(v, new String[]
160        { "location", "condition", });
161
162        v = new Vector<String>(1);
163        parameterNames.put("setInstrumentationBreakpoint", v);
164        Collections.addAll(v, new String[]
165        { "instrumentation", });
166
167        v = new Vector<String>(6);
168        parameterNames.put("setBreakpointByUrl", v);
169        Collections.addAll(v, new String[]
170        { "lineNumber", "url", "urlRegex", "scriptHash", "columnNumber", "condition", });
171
172        v = new Vector<String>(2);
173        parameterNames.put("setBreakpointOnFunctionCall", v);
174        Collections.addAll(v, new String[]
175        { "objectId", "condition", });
176
177        v = new Vector<String>(1);
178        parameterNames.put("setBreakpointsActive", v);
179        Collections.addAll(v, new String[]
180        { "active", });
181
182        v = new Vector<String>(1);
183        parameterNames.put("setPauseOnExceptions", v);
184        Collections.addAll(v, new String[]
185        { "state", });
186
187        v = new Vector<String>(1);
188        parameterNames.put("setReturnValue", v);
189        Collections.addAll(v, new String[]
190        { "newValue", });
191
192        v = new Vector<String>(3);
193        parameterNames.put("setScriptSource", v);
194        Collections.addAll(v, new String[]
195        { "scriptId", "scriptSource", "dryRun", });
196
197        v = new Vector<String>(1);
198        parameterNames.put("setSkipAllPauses", v);
199        Collections.addAll(v, new String[]
200        { "skip", });
201
202        v = new Vector<String>(4);
203        parameterNames.put("setVariableValue", v);
204        Collections.addAll(v, new String[]
205        { "scopeNumber", "variableName", "newValue", "callFrameId", });
206
207        v = new Vector<String>(2);
208        parameterNames.put("stepInto", v);
209        Collections.addAll(v, new String[]
210        { "breakOnAsyncCall", "skipList", });
211
212        parameterNames.put("stepOut", EMPTY_VEC_STR);
213
214        v = new Vector<String>(1);
215        parameterNames.put("stepOver", v);
216        Collections.addAll(v, new String[]
217        { "skipList", });
218    }
219
220
221    // ********************************************************************************************
222    // ********************************************************************************************
223    // Types - Static Inner Classes
224    // ********************************************************************************************
225    // ********************************************************************************************
226
227    // public static class BreakpointId => String
228    
229    // public static class CallFrameId => String
230    
231    /** Enum of possible script languages. */
232    public static final String[] ScriptLanguage =
233    { "JavaScript", "WebAssembly", };
234    
235    /** Location in the source code. */
236    public static class Location
237        extends BaseType
238        implements java.io.Serializable
239    {
240        /** For Object Serialization.  java.io.Serializable */
241        protected static final long serialVersionUID = 1;
242        
243        public boolean[] optionals()
244        { return new boolean[] { false, false, true, }; }
245        
246        /** Script identifier as reported in the <CODE>Debugger.scriptParsed</CODE>. */
247        public final String scriptId;
248        
249        /** Line number in the script (0-based). */
250        public final int lineNumber;
251        
252        /**
253         * Column number in the script (0-based).
254         * <BR />
255         * <BR /><B>OPTIONAL</B>
256         */
257        public final Integer columnNumber;
258        
259        /**
260         * Constructor
261         *
262         * @param scriptId Script identifier as reported in the <CODE>Debugger.scriptParsed</CODE>.
263         * 
264         * @param lineNumber Line number in the script (0-based).
265         * 
266         * @param columnNumber Column number in the script (0-based).
267         * <BR /><B>OPTIONAL</B>
268         */
269        public Location(String scriptId, int lineNumber, Integer columnNumber)
270        {
271            // Exception-Check(s) to ensure that if any parameters which are not declared as
272            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
273            
274            if (scriptId == null) BRDPC.throwNPE("scriptId");
275            
276            this.scriptId      = scriptId;
277            this.lineNumber    = lineNumber;
278            this.columnNumber  = columnNumber;
279        }
280        
281        /**
282         * JSON Object Constructor
283         * @param jo A Json-Object having data about an instance of {@code 'Location'}.
284         */
285        public Location (JsonObject jo)
286        {
287            this.scriptId      = ReadJSON.getString(jo, "scriptId", false, true);
288            this.lineNumber    = ReadPrimJSON.getInt(jo, "lineNumber");
289            this.columnNumber  = ReadBoxedJSON.getInteger(jo, "columnNumber", true);
290        }
291        
292        
293        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
294        public boolean equals(Object other)
295        {
296            if (other == null)                       return false;
297            if (other.getClass() != this.getClass()) return false;
298        
299            Location o = (Location) other;
300        
301            return
302                    Objects.equals(this.scriptId, o.scriptId)
303                &&  (this.lineNumber == o.lineNumber)
304                &&  Objects.equals(this.columnNumber, o.columnNumber);
305        }
306        
307        /** Generates a Hash-Code for {@code 'this'} instance */
308        public int hashCode()
309        {
310            return
311                    Objects.hashCode(this.scriptId)
312                +   this.lineNumber
313                +   Objects.hashCode(this.columnNumber);
314        }
315    }
316    
317    /**
318     * Location in the source code.
319     * <BR />
320     * <BR /><B>EXPERIMENTAL</B>
321     */
322    public static class ScriptPosition
323        extends BaseType
324        implements java.io.Serializable
325    {
326        /** For Object Serialization.  java.io.Serializable */
327        protected static final long serialVersionUID = 1;
328        
329        public boolean[] optionals()
330        { return new boolean[] { false, false, }; }
331        
332        /** <CODE>[No Description Provided by Google]</CODE> */
333        public final int lineNumber;
334        
335        /** <CODE>[No Description Provided by Google]</CODE> */
336        public final int columnNumber;
337        
338        /**
339         * Constructor
340         *
341         * @param lineNumber -
342         * 
343         * @param columnNumber -
344         */
345        public ScriptPosition(int lineNumber, int columnNumber)
346        {
347            this.lineNumber    = lineNumber;
348            this.columnNumber  = columnNumber;
349        }
350        
351        /**
352         * JSON Object Constructor
353         * @param jo A Json-Object having data about an instance of {@code 'ScriptPosition'}.
354         */
355        public ScriptPosition (JsonObject jo)
356        {
357            this.lineNumber    = ReadPrimJSON.getInt(jo, "lineNumber");
358            this.columnNumber  = ReadPrimJSON.getInt(jo, "columnNumber");
359        }
360        
361        
362        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
363        public boolean equals(Object other)
364        {
365            if (other == null)                       return false;
366            if (other.getClass() != this.getClass()) return false;
367        
368            ScriptPosition o = (ScriptPosition) other;
369        
370            return
371                    (this.lineNumber == o.lineNumber)
372                &&  (this.columnNumber == o.columnNumber);
373        }
374        
375        /** Generates a Hash-Code for {@code 'this'} instance */
376        public int hashCode()
377        {
378            return
379                    this.lineNumber
380                +   this.columnNumber;
381        }
382    }
383    
384    /**
385     * Location range within one script.
386     * <BR />
387     * <BR /><B>EXPERIMENTAL</B>
388     */
389    public static class LocationRange
390        extends BaseType
391        implements java.io.Serializable
392    {
393        /** For Object Serialization.  java.io.Serializable */
394        protected static final long serialVersionUID = 1;
395        
396        public boolean[] optionals()
397        { return new boolean[] { false, false, false, }; }
398        
399        /** <CODE>[No Description Provided by Google]</CODE> */
400        public final String scriptId;
401        
402        /** <CODE>[No Description Provided by Google]</CODE> */
403        public final Debugger.ScriptPosition start;
404        
405        /** <CODE>[No Description Provided by Google]</CODE> */
406        public final Debugger.ScriptPosition end;
407        
408        /**
409         * Constructor
410         *
411         * @param scriptId -
412         * 
413         * @param start -
414         * 
415         * @param end -
416         */
417        public LocationRange
418            (String scriptId, Debugger.ScriptPosition start, Debugger.ScriptPosition end)
419        {
420            // Exception-Check(s) to ensure that if any parameters which are not declared as
421            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
422            
423            if (scriptId == null) BRDPC.throwNPE("scriptId");
424            if (start == null)    BRDPC.throwNPE("start");
425            if (end == null)      BRDPC.throwNPE("end");
426            
427            this.scriptId  = scriptId;
428            this.start     = start;
429            this.end       = end;
430        }
431        
432        /**
433         * JSON Object Constructor
434         * @param jo A Json-Object having data about an instance of {@code 'LocationRange'}.
435         */
436        public LocationRange (JsonObject jo)
437        {
438            this.scriptId  = ReadJSON.getString(jo, "scriptId", false, true);
439            this.start     = ReadJSON.getObject(jo, "start", Debugger.ScriptPosition.class, false, true);
440            this.end       = ReadJSON.getObject(jo, "end", Debugger.ScriptPosition.class, false, true);
441        }
442        
443        
444        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
445        public boolean equals(Object other)
446        {
447            if (other == null)                       return false;
448            if (other.getClass() != this.getClass()) return false;
449        
450            LocationRange o = (LocationRange) other;
451        
452            return
453                    Objects.equals(this.scriptId, o.scriptId)
454                &&  Objects.equals(this.start, o.start)
455                &&  Objects.equals(this.end, o.end);
456        }
457        
458        /** Generates a Hash-Code for {@code 'this'} instance */
459        public int hashCode()
460        {
461            return
462                    Objects.hashCode(this.scriptId)
463                +   this.start.hashCode()
464                +   this.end.hashCode();
465        }
466    }
467    
468    /** JavaScript call frame. Array of call frames form the call stack. */
469    public static class CallFrame
470        extends BaseType
471        implements java.io.Serializable
472    {
473        /** For Object Serialization.  java.io.Serializable */
474        protected static final long serialVersionUID = 1;
475        
476        public boolean[] optionals()
477        { return new boolean[] { false, false, true, false, false, false, false, true, }; }
478        
479        /** Call frame identifier. This identifier is only valid while the virtual machine is paused. */
480        public final String callFrameId;
481        
482        /** Name of the JavaScript function called on this call frame. */
483        public final String functionName;
484        
485        /**
486         * Location in the source code.
487         * <BR />
488         * <BR /><B>OPTIONAL</B>
489         */
490        public final Debugger.Location functionLocation;
491        
492        /** Location in the source code. */
493        public final Debugger.Location location;
494        
495        /** JavaScript script name or url. */
496        public final String url;
497        
498        /** Scope chain for this call frame. */
499        public final Debugger.Scope[] scopeChain;
500        
501        /** <CODE>this</CODE> object for this call frame. */
502        public final RunTime.RemoteObject _this;
503        
504        /**
505         * The value being returned, if the function is at return point.
506         * <BR />
507         * <BR /><B>OPTIONAL</B>
508         */
509        public final RunTime.RemoteObject returnValue;
510        
511        /**
512         * Constructor
513         *
514         * @param callFrameId Call frame identifier. This identifier is only valid while the virtual machine is paused.
515         * 
516         * @param functionName Name of the JavaScript function called on this call frame.
517         * 
518         * @param functionLocation Location in the source code.
519         * <BR /><B>OPTIONAL</B>
520         * 
521         * @param location Location in the source code.
522         * 
523         * @param url JavaScript script name or url.
524         * 
525         * @param scopeChain Scope chain for this call frame.
526         * 
527         * @param _this <CODE>this</CODE> object for this call frame.
528         * 
529         * @param returnValue The value being returned, if the function is at return point.
530         * <BR /><B>OPTIONAL</B>
531         */
532        public CallFrame(
533                String callFrameId, String functionName, Debugger.Location functionLocation, 
534                Debugger.Location location, String url, Debugger.Scope[] scopeChain, 
535                RunTime.RemoteObject _this, RunTime.RemoteObject returnValue
536            )
537        {
538            // Exception-Check(s) to ensure that if any parameters which are not declared as
539            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
540            
541            if (callFrameId == null)  BRDPC.throwNPE("callFrameId");
542            if (functionName == null) BRDPC.throwNPE("functionName");
543            if (location == null)     BRDPC.throwNPE("location");
544            if (url == null)          BRDPC.throwNPE("url");
545            if (scopeChain == null)   BRDPC.throwNPE("scopeChain");
546            if (_this == null)        BRDPC.throwNPE("_this");
547            
548            this.callFrameId       = callFrameId;
549            this.functionName      = functionName;
550            this.functionLocation  = functionLocation;
551            this.location          = location;
552            this.url               = url;
553            this.scopeChain        = scopeChain;
554            this._this             = _this;
555            this.returnValue       = returnValue;
556        }
557        
558        /**
559         * JSON Object Constructor
560         * @param jo A Json-Object having data about an instance of {@code 'CallFrame'}.
561         */
562        public CallFrame (JsonObject jo)
563        {
564            this.callFrameId       = ReadJSON.getString(jo, "callFrameId", false, true);
565            this.functionName      = ReadJSON.getString(jo, "functionName", false, true);
566            this.functionLocation  = ReadJSON.getObject(jo, "functionLocation", Debugger.Location.class, true, false);
567            this.location          = ReadJSON.getObject(jo, "location", Debugger.Location.class, false, true);
568            this.url               = ReadJSON.getString(jo, "url", false, true);
569            this.scopeChain = (jo.getJsonArray("scopeChain") == null)
570                ? null
571                : ReadArrJSON.DimN.objArr(jo.getJsonArray("scopeChain"), null, 0, Debugger.Scope[].class);
572        
573            this._this             = ReadJSON.getObject(jo, "this", RunTime.RemoteObject.class, false, true);
574            this.returnValue       = ReadJSON.getObject(jo, "returnValue", RunTime.RemoteObject.class, true, false);
575        }
576        
577        
578        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
579        public boolean equals(Object other)
580        {
581            if (other == null)                       return false;
582            if (other.getClass() != this.getClass()) return false;
583        
584            CallFrame o = (CallFrame) other;
585        
586            return
587                    Objects.equals(this.callFrameId, o.callFrameId)
588                &&  Objects.equals(this.functionName, o.functionName)
589                &&  Objects.equals(this.functionLocation, o.functionLocation)
590                &&  Objects.equals(this.location, o.location)
591                &&  Objects.equals(this.url, o.url)
592                &&  Arrays.deepEquals(this.scopeChain, o.scopeChain)
593                &&  Objects.equals(this._this, o._this)
594                &&  Objects.equals(this.returnValue, o.returnValue);
595        }
596        
597        /** Generates a Hash-Code for {@code 'this'} instance */
598        public int hashCode()
599        {
600            return
601                    Objects.hashCode(this.callFrameId)
602                +   Objects.hashCode(this.functionName)
603                +   this.functionLocation.hashCode()
604                +   this.location.hashCode()
605                +   Objects.hashCode(this.url)
606                +   Arrays.deepHashCode(this.scopeChain)
607                +   this._this.hashCode()
608                +   this.returnValue.hashCode();
609        }
610    }
611    
612    /** Scope description. */
613    public static class Scope
614        extends BaseType
615        implements java.io.Serializable
616    {
617        /** For Object Serialization.  java.io.Serializable */
618        protected static final long serialVersionUID = 1;
619        
620        public boolean[] optionals()
621        { return new boolean[] { false, false, true, true, true, }; }
622        
623        /** Scope type. */
624        public final String type;
625        
626        /**
627         * Object representing the scope. For <CODE>global</CODE> and <CODE>with</CODE> scopes it represents the actual
628         * object; for the rest of the scopes, it is artificial transient object enumerating scope
629         * variables as its properties.
630         */
631        public final RunTime.RemoteObject object;
632        
633        /**
634         * <CODE>[No Description Provided by Google]</CODE>
635         * <BR />
636         * <BR /><B>OPTIONAL</B>
637         */
638        public final String name;
639        
640        /**
641         * Location in the source code where scope starts
642         * <BR />
643         * <BR /><B>OPTIONAL</B>
644         */
645        public final Debugger.Location startLocation;
646        
647        /**
648         * Location in the source code where scope ends
649         * <BR />
650         * <BR /><B>OPTIONAL</B>
651         */
652        public final Debugger.Location endLocation;
653        
654        /**
655         * Constructor
656         *
657         * @param type Scope type.
658         * <BR />Acceptable Values: ["global", "local", "with", "closure", "catch", "block", "script", "eval", "module", "wasm-expression-stack"]
659         * 
660         * @param object 
661         * Object representing the scope. For <CODE>global</CODE> and <CODE>with</CODE> scopes it represents the actual
662         * object; for the rest of the scopes, it is artificial transient object enumerating scope
663         * variables as its properties.
664         * 
665         * @param name -
666         * <BR /><B>OPTIONAL</B>
667         * 
668         * @param startLocation Location in the source code where scope starts
669         * <BR /><B>OPTIONAL</B>
670         * 
671         * @param endLocation Location in the source code where scope ends
672         * <BR /><B>OPTIONAL</B>
673         */
674        public Scope(
675                String type, RunTime.RemoteObject object, String name, 
676                Debugger.Location startLocation, Debugger.Location endLocation
677            )
678        {
679            // Exception-Check(s) to ensure that if any parameters which are not declared as
680            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
681            
682            if (type == null)   BRDPC.throwNPE("type");
683            if (object == null) BRDPC.throwNPE("object");
684            
685            // Exception-Check(s) to ensure that if any parameters which must adhere to a
686            // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
687            
688            BRDPC.checkIAE(
689                "type", type,
690                "global", "local", "with", "closure", "catch", "block", "script", "eval", "module", "wasm-expression-stack"
691            );
692            
693            this.type           = type;
694            this.object         = object;
695            this.name           = name;
696            this.startLocation  = startLocation;
697            this.endLocation    = endLocation;
698        }
699        
700        /**
701         * JSON Object Constructor
702         * @param jo A Json-Object having data about an instance of {@code 'Scope'}.
703         */
704        public Scope (JsonObject jo)
705        {
706            this.type           = ReadJSON.getString(jo, "type", false, true);
707            this.object         = ReadJSON.getObject(jo, "object", RunTime.RemoteObject.class, false, true);
708            this.name           = ReadJSON.getString(jo, "name", true, false);
709            this.startLocation  = ReadJSON.getObject(jo, "startLocation", Debugger.Location.class, true, false);
710            this.endLocation    = ReadJSON.getObject(jo, "endLocation", Debugger.Location.class, true, false);
711        }
712        
713        
714        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
715        public boolean equals(Object other)
716        {
717            if (other == null)                       return false;
718            if (other.getClass() != this.getClass()) return false;
719        
720            Scope o = (Scope) other;
721        
722            return
723                    Objects.equals(this.type, o.type)
724                &&  Objects.equals(this.object, o.object)
725                &&  Objects.equals(this.name, o.name)
726                &&  Objects.equals(this.startLocation, o.startLocation)
727                &&  Objects.equals(this.endLocation, o.endLocation);
728        }
729        
730        /** Generates a Hash-Code for {@code 'this'} instance */
731        public int hashCode()
732        {
733            return
734                    Objects.hashCode(this.type)
735                +   this.object.hashCode()
736                +   Objects.hashCode(this.name)
737                +   this.startLocation.hashCode()
738                +   this.endLocation.hashCode();
739        }
740    }
741    
742    /** Search match for resource. */
743    public static class SearchMatch
744        extends BaseType
745        implements java.io.Serializable
746    {
747        /** For Object Serialization.  java.io.Serializable */
748        protected static final long serialVersionUID = 1;
749        
750        public boolean[] optionals()
751        { return new boolean[] { false, false, }; }
752        
753        /** Line number in resource content. */
754        public final Number lineNumber;
755        
756        /** Line with match content. */
757        public final String lineContent;
758        
759        /**
760         * Constructor
761         *
762         * @param lineNumber Line number in resource content.
763         * 
764         * @param lineContent Line with match content.
765         */
766        public SearchMatch(Number lineNumber, String lineContent)
767        {
768            // Exception-Check(s) to ensure that if any parameters which are not declared as
769            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
770            
771            if (lineNumber == null)  BRDPC.throwNPE("lineNumber");
772            if (lineContent == null) BRDPC.throwNPE("lineContent");
773            
774            this.lineNumber   = lineNumber;
775            this.lineContent  = lineContent;
776        }
777        
778        /**
779         * JSON Object Constructor
780         * @param jo A Json-Object having data about an instance of {@code 'SearchMatch'}.
781         */
782        public SearchMatch (JsonObject jo)
783        {
784            this.lineNumber   = ReadNumberJSON.get(jo, "lineNumber", false, true);
785            this.lineContent  = ReadJSON.getString(jo, "lineContent", false, true);
786        }
787        
788        
789        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
790        public boolean equals(Object other)
791        {
792            if (other == null)                       return false;
793            if (other.getClass() != this.getClass()) return false;
794        
795            SearchMatch o = (SearchMatch) other;
796        
797            return
798                    Objects.equals(this.lineNumber, o.lineNumber)
799                &&  Objects.equals(this.lineContent, o.lineContent);
800        }
801        
802        /** Generates a Hash-Code for {@code 'this'} instance */
803        public int hashCode()
804        {
805            return
806                    Objects.hashCode(this.lineNumber)
807                +   Objects.hashCode(this.lineContent);
808        }
809    }
810    
811    /** <CODE>[No Description Provided by Google]</CODE> */
812    public static class BreakLocation
813        extends BaseType
814        implements java.io.Serializable
815    {
816        /** For Object Serialization.  java.io.Serializable */
817        protected static final long serialVersionUID = 1;
818        
819        public boolean[] optionals()
820        { return new boolean[] { false, false, true, true, }; }
821        
822        /** Script identifier as reported in the <CODE>Debugger.scriptParsed</CODE>. */
823        public final String scriptId;
824        
825        /** Line number in the script (0-based). */
826        public final int lineNumber;
827        
828        /**
829         * Column number in the script (0-based).
830         * <BR />
831         * <BR /><B>OPTIONAL</B>
832         */
833        public final Integer columnNumber;
834        
835        /**
836         * <CODE>[No Description Provided by Google]</CODE>
837         * <BR />
838         * <BR /><B>OPTIONAL</B>
839         */
840        public final String type;
841        
842        /**
843         * Constructor
844         *
845         * @param scriptId Script identifier as reported in the <CODE>Debugger.scriptParsed</CODE>.
846         * 
847         * @param lineNumber Line number in the script (0-based).
848         * 
849         * @param columnNumber Column number in the script (0-based).
850         * <BR /><B>OPTIONAL</B>
851         * 
852         * @param type -
853         * <BR />Acceptable Values: ["debuggerStatement", "call", "return"]
854         * <BR /><B>OPTIONAL</B>
855         */
856        public BreakLocation(String scriptId, int lineNumber, Integer columnNumber, String type)
857        {
858            // Exception-Check(s) to ensure that if any parameters which are not declared as
859            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
860            
861            if (scriptId == null) BRDPC.throwNPE("scriptId");
862            
863            // Exception-Check(s) to ensure that if any parameters which must adhere to a
864            // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
865            
866            BRDPC.checkIAE(
867                "type", type,
868                "debuggerStatement", "call", "return"
869            );
870            
871            this.scriptId      = scriptId;
872            this.lineNumber    = lineNumber;
873            this.columnNumber  = columnNumber;
874            this.type          = type;
875        }
876        
877        /**
878         * JSON Object Constructor
879         * @param jo A Json-Object having data about an instance of {@code 'BreakLocation'}.
880         */
881        public BreakLocation (JsonObject jo)
882        {
883            this.scriptId      = ReadJSON.getString(jo, "scriptId", false, true);
884            this.lineNumber    = ReadPrimJSON.getInt(jo, "lineNumber");
885            this.columnNumber  = ReadBoxedJSON.getInteger(jo, "columnNumber", true);
886            this.type          = ReadJSON.getString(jo, "type", true, false);
887        }
888        
889        
890        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
891        public boolean equals(Object other)
892        {
893            if (other == null)                       return false;
894            if (other.getClass() != this.getClass()) return false;
895        
896            BreakLocation o = (BreakLocation) other;
897        
898            return
899                    Objects.equals(this.scriptId, o.scriptId)
900                &&  (this.lineNumber == o.lineNumber)
901                &&  Objects.equals(this.columnNumber, o.columnNumber)
902                &&  Objects.equals(this.type, o.type);
903        }
904        
905        /** Generates a Hash-Code for {@code 'this'} instance */
906        public int hashCode()
907        {
908            return
909                    Objects.hashCode(this.scriptId)
910                +   this.lineNumber
911                +   Objects.hashCode(this.columnNumber)
912                +   Objects.hashCode(this.type);
913        }
914    }
915    
916    /** Debug symbols available for a wasm script. */
917    public static class DebugSymbols
918        extends BaseType
919        implements java.io.Serializable
920    {
921        /** For Object Serialization.  java.io.Serializable */
922        protected static final long serialVersionUID = 1;
923        
924        public boolean[] optionals()
925        { return new boolean[] { false, true, }; }
926        
927        /** Type of the debug symbols. */
928        public final String type;
929        
930        /**
931         * URL of the external symbol source.
932         * <BR />
933         * <BR /><B>OPTIONAL</B>
934         */
935        public final String externalURL;
936        
937        /**
938         * Constructor
939         *
940         * @param type Type of the debug symbols.
941         * <BR />Acceptable Values: ["None", "SourceMap", "EmbeddedDWARF", "ExternalDWARF"]
942         * 
943         * @param externalURL URL of the external symbol source.
944         * <BR /><B>OPTIONAL</B>
945         */
946        public DebugSymbols(String type, String externalURL)
947        {
948            // Exception-Check(s) to ensure that if any parameters which are not declared as
949            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
950            
951            if (type == null) BRDPC.throwNPE("type");
952            
953            // Exception-Check(s) to ensure that if any parameters which must adhere to a
954            // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
955            
956            BRDPC.checkIAE(
957                "type", type,
958                "None", "SourceMap", "EmbeddedDWARF", "ExternalDWARF"
959            );
960            
961            this.type         = type;
962            this.externalURL  = externalURL;
963        }
964        
965        /**
966         * JSON Object Constructor
967         * @param jo A Json-Object having data about an instance of {@code 'DebugSymbols'}.
968         */
969        public DebugSymbols (JsonObject jo)
970        {
971            this.type         = ReadJSON.getString(jo, "type", false, true);
972            this.externalURL  = ReadJSON.getString(jo, "externalURL", true, false);
973        }
974        
975        
976        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
977        public boolean equals(Object other)
978        {
979            if (other == null)                       return false;
980            if (other.getClass() != this.getClass()) return false;
981        
982            DebugSymbols o = (DebugSymbols) other;
983        
984            return
985                    Objects.equals(this.type, o.type)
986                &&  Objects.equals(this.externalURL, o.externalURL);
987        }
988        
989        /** Generates a Hash-Code for {@code 'this'} instance */
990        public int hashCode()
991        {
992            return
993                    Objects.hashCode(this.type)
994                +   Objects.hashCode(this.externalURL);
995        }
996    }
997    
998    /**
999     * Fired when the virtual machine resumed execution.
1000     *
1001     * <BR /><BR />This is Marker-Event.  Marker-Event's are Events that do not posses
1002     * any data, fields or state.  When they are fired, only the event name is supplied.
1003     */
1004    public static class resumed
1005        extends BrowserEvent
1006        implements java.io.Serializable
1007    {
1008        /** For Object Serialization.  java.io.Serializable */
1009        protected static final long serialVersionUID = 1;
1010    
1011        public boolean[] optionals() { return new boolean[0]; }
1012    
1013        /** JSON Object Constructor */
1014        public resumed(JsonObject jo)
1015        { super("Debugger", "resumed", 0); }
1016    
1017        @Override
1018        public String toString() { return "Debugger.resumed Marker Event\n"; }
1019    }
1020    
1021    /** Fired when breakpoint is resolved to an actual script and location. */
1022    public static class breakpointResolved
1023        extends BrowserEvent
1024        implements java.io.Serializable
1025    {
1026        /** For Object Serialization.  java.io.Serializable */
1027        protected static final long serialVersionUID = 1;
1028        
1029        public boolean[] optionals()
1030        { return new boolean[] { false, false, }; }
1031        
1032        /** Breakpoint unique identifier. */
1033        public final String breakpointId;
1034        
1035        /** Actual breakpoint location. */
1036        public final Debugger.Location location;
1037        
1038        /**
1039         * Constructor
1040         *
1041         * @param breakpointId Breakpoint unique identifier.
1042         * 
1043         * @param location Actual breakpoint location.
1044         */
1045        public breakpointResolved(String breakpointId, Debugger.Location location)
1046        {
1047            super("Debugger", "breakpointResolved", 2);
1048            
1049            // Exception-Check(s) to ensure that if any parameters which are not declared as
1050            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1051            
1052            if (breakpointId == null) BRDPC.throwNPE("breakpointId");
1053            if (location == null)     BRDPC.throwNPE("location");
1054            
1055            this.breakpointId  = breakpointId;
1056            this.location      = location;
1057        }
1058        
1059        /**
1060         * JSON Object Constructor
1061         * @param jo A Json-Object having data about an instance of {@code 'breakpointResolved'}.
1062         */
1063        public breakpointResolved (JsonObject jo)
1064        {
1065            super("Debugger", "breakpointResolved", 2);
1066        
1067            this.breakpointId  = ReadJSON.getString(jo, "breakpointId", false, true);
1068            this.location      = ReadJSON.getObject(jo, "location", Debugger.Location.class, false, true);
1069        }
1070        
1071        
1072        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
1073        public boolean equals(Object other)
1074        {
1075            if (other == null)                       return false;
1076            if (other.getClass() != this.getClass()) return false;
1077        
1078            breakpointResolved o = (breakpointResolved) other;
1079        
1080            return
1081                    Objects.equals(this.breakpointId, o.breakpointId)
1082                &&  Objects.equals(this.location, o.location);
1083        }
1084        
1085        /** Generates a Hash-Code for {@code 'this'} instance */
1086        public int hashCode()
1087        {
1088            return
1089                    Objects.hashCode(this.breakpointId)
1090                +   this.location.hashCode();
1091        }
1092    }
1093    
1094    /** Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. */
1095    public static class paused
1096        extends BrowserEvent
1097        implements java.io.Serializable
1098    {
1099        /** For Object Serialization.  java.io.Serializable */
1100        protected static final long serialVersionUID = 1;
1101        
1102        public boolean[] optionals()
1103        { return new boolean[] { false, false, true, true, true, true, true, }; }
1104        
1105        /** Call stack the virtual machine stopped on. */
1106        public final Debugger.CallFrame[] callFrames;
1107        
1108        /** Pause reason. */
1109        public final String reason;
1110        
1111        /**
1112         * Object containing break-specific auxiliary properties.
1113         * <BR />
1114         * <BR /><B>OPTIONAL</B>
1115         */
1116        public final JsonObject data;
1117        
1118        /**
1119         * Hit breakpoints IDs
1120         * <BR />
1121         * <BR /><B>OPTIONAL</B>
1122         */
1123        public final String[] hitBreakpoints;
1124        
1125        /**
1126         * Async stack trace, if any.
1127         * <BR />
1128         * <BR /><B>OPTIONAL</B>
1129         */
1130        public final RunTime.StackTrace asyncStackTrace;
1131        
1132        /**
1133         * Async stack trace, if any.
1134         * <BR />
1135         * <BR /><B>OPTIONAL</B>
1136         * <BR /><B>EXPERIMENTAL</B>
1137         */
1138        public final RunTime.StackTraceId asyncStackTraceId;
1139        
1140        /**
1141         * Never present, will be removed.
1142         * <BR />
1143         * <BR /><B>OPTIONAL</B>
1144         * <BR /><B>EXPERIMENTAL</B>
1145         * <BR /><B>DEPRECATED</B>
1146         */
1147        public final RunTime.StackTraceId asyncCallStackTraceId;
1148        
1149        /**
1150         * Constructor
1151         *
1152         * @param callFrames Call stack the virtual machine stopped on.
1153         * 
1154         * @param reason Pause reason.
1155         * <BR />Acceptable Values: ["ambiguous", "assert", "CSPViolation", "debugCommand", "DOM", "EventListener", "exception", "instrumentation", "OOM", "other", "promiseRejection", "XHR"]
1156         * 
1157         * @param data Object containing break-specific auxiliary properties.
1158         * <BR /><B>OPTIONAL</B>
1159         * 
1160         * @param hitBreakpoints Hit breakpoints IDs
1161         * <BR /><B>OPTIONAL</B>
1162         * 
1163         * @param asyncStackTrace Async stack trace, if any.
1164         * <BR /><B>OPTIONAL</B>
1165         * 
1166         * @param asyncStackTraceId Async stack trace, if any.
1167         * <BR /><B>OPTIONAL</B>
1168         * <BR /><B>EXPERIMENTAL</B>
1169         * 
1170         * @param asyncCallStackTraceId Never present, will be removed.
1171         * <BR /><B>OPTIONAL</B>
1172         * <BR /><B>EXPERIMENTAL</B>
1173         * <BR /><B>DEPRECATED</B>
1174         */
1175        public paused(
1176                Debugger.CallFrame[] callFrames, String reason, JsonObject data, 
1177                String[] hitBreakpoints, RunTime.StackTrace asyncStackTrace, 
1178                RunTime.StackTraceId asyncStackTraceId, RunTime.StackTraceId asyncCallStackTraceId
1179            )
1180        {
1181            super("Debugger", "paused", 7);
1182            
1183            // Exception-Check(s) to ensure that if any parameters which are not declared as
1184            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1185            
1186            if (callFrames == null) BRDPC.throwNPE("callFrames");
1187            if (reason == null)     BRDPC.throwNPE("reason");
1188            
1189            // Exception-Check(s) to ensure that if any parameters which must adhere to a
1190            // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
1191            
1192            BRDPC.checkIAE(
1193                "reason", reason,
1194                "ambiguous", "assert", "CSPViolation", "debugCommand", "DOM", "EventListener", "exception", "instrumentation", "OOM", "other", "promiseRejection", "XHR"
1195            );
1196            
1197            this.callFrames             = callFrames;
1198            this.reason                 = reason;
1199            this.data                   = data;
1200            this.hitBreakpoints         = hitBreakpoints;
1201            this.asyncStackTrace        = asyncStackTrace;
1202            this.asyncStackTraceId      = asyncStackTraceId;
1203            this.asyncCallStackTraceId  = asyncCallStackTraceId;
1204        }
1205        
1206        /**
1207         * JSON Object Constructor
1208         * @param jo A Json-Object having data about an instance of {@code 'paused'}.
1209         */
1210        public paused (JsonObject jo)
1211        {
1212            super("Debugger", "paused", 7);
1213        
1214            this.callFrames = (jo.getJsonArray("callFrames") == null)
1215                ? null
1216                : ReadArrJSON.DimN.objArr(jo.getJsonArray("callFrames"), null, 0, Debugger.CallFrame[].class);
1217        
1218            this.reason                 = ReadJSON.getString(jo, "reason", false, true);
1219            this.data                   = jo.getJsonObject("data");
1220            this.hitBreakpoints = (jo.getJsonArray("hitBreakpoints") == null)
1221                ? null
1222                : ReadArrJSON.DimN.strArr(jo.getJsonArray("hitBreakpoints"), null, 0, String[].class);
1223        
1224            this.asyncStackTrace        = ReadJSON.getObject(jo, "asyncStackTrace", RunTime.StackTrace.class, true, false);
1225            this.asyncStackTraceId      = ReadJSON.getObject(jo, "asyncStackTraceId", RunTime.StackTraceId.class, true, false);
1226            this.asyncCallStackTraceId  = ReadJSON.getObject(jo, "asyncCallStackTraceId", RunTime.StackTraceId.class, true, false);
1227        }
1228        
1229        
1230        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
1231        public boolean equals(Object other)
1232        {
1233            if (other == null)                       return false;
1234            if (other.getClass() != this.getClass()) return false;
1235        
1236            paused o = (paused) other;
1237        
1238            return
1239                    Arrays.deepEquals(this.callFrames, o.callFrames)
1240                &&  Objects.equals(this.reason, o.reason)
1241                &&  Objects.equals(this.data, o.data)
1242                &&  Arrays.deepEquals(this.hitBreakpoints, o.hitBreakpoints)
1243                &&  Objects.equals(this.asyncStackTrace, o.asyncStackTrace)
1244                &&  Objects.equals(this.asyncStackTraceId, o.asyncStackTraceId)
1245                &&  Objects.equals(this.asyncCallStackTraceId, o.asyncCallStackTraceId);
1246        }
1247        
1248        /** Generates a Hash-Code for {@code 'this'} instance */
1249        public int hashCode()
1250        {
1251            return
1252                    Arrays.deepHashCode(this.callFrames)
1253                +   Objects.hashCode(this.reason)
1254                +   Objects.hashCode(this.data)
1255                +   Arrays.deepHashCode(this.hitBreakpoints)
1256                +   this.asyncStackTrace.hashCode()
1257                +   this.asyncStackTraceId.hashCode()
1258                +   this.asyncCallStackTraceId.hashCode();
1259        }
1260    }
1261    
1262    /** Fired when virtual machine fails to parse the script. */
1263    public static class scriptFailedToParse
1264        extends BrowserEvent
1265        implements java.io.Serializable
1266    {
1267        /** For Object Serialization.  java.io.Serializable */
1268        protected static final long serialVersionUID = 1;
1269        
1270        public boolean[] optionals()
1271        { return new boolean[] { false, false, false, false, false, false, false, false, true, true, true, true, true, true, true, true, true, }; }
1272        
1273        /** Identifier of the script parsed. */
1274        public final String scriptId;
1275        
1276        /** URL or name of the script parsed (if any). */
1277        public final String url;
1278        
1279        /** Line offset of the script within the resource with given URL (for script tags). */
1280        public final int startLine;
1281        
1282        /** Column offset of the script within the resource with given URL. */
1283        public final int startColumn;
1284        
1285        /** Last line of the script. */
1286        public final int endLine;
1287        
1288        /** Length of the last line of the script. */
1289        public final int endColumn;
1290        
1291        /** Specifies script creation context. */
1292        public final int executionContextId;
1293        
1294        /** Content hash of the script. */
1295        public final String hash;
1296        
1297        /**
1298         * Embedder-specific auxiliary data.
1299         * <BR />
1300         * <BR /><B>OPTIONAL</B>
1301         */
1302        public final JsonObject executionContextAuxData;
1303        
1304        /**
1305         * URL of source map associated with script (if any).
1306         * <BR />
1307         * <BR /><B>OPTIONAL</B>
1308         */
1309        public final String sourceMapURL;
1310        
1311        /**
1312         * True, if this script has sourceURL.
1313         * <BR />
1314         * <BR /><B>OPTIONAL</B>
1315         */
1316        public final Boolean hasSourceURL;
1317        
1318        /**
1319         * True, if this script is ES6 module.
1320         * <BR />
1321         * <BR /><B>OPTIONAL</B>
1322         */
1323        public final Boolean isModule;
1324        
1325        /**
1326         * This script length.
1327         * <BR />
1328         * <BR /><B>OPTIONAL</B>
1329         */
1330        public final Integer length;
1331        
1332        /**
1333         * JavaScript top stack frame of where the script parsed event was triggered if available.
1334         * <BR />
1335         * <BR /><B>OPTIONAL</B>
1336         * <BR /><B>EXPERIMENTAL</B>
1337         */
1338        public final RunTime.StackTrace stackTrace;
1339        
1340        /**
1341         * If the scriptLanguage is WebAssembly, the code section offset in the module.
1342         * <BR />
1343         * <BR /><B>OPTIONAL</B>
1344         * <BR /><B>EXPERIMENTAL</B>
1345         */
1346        public final Integer codeOffset;
1347        
1348        /**
1349         * The language of the script.
1350         * <BR />
1351         * <BR /><B>OPTIONAL</B>
1352         * <BR /><B>EXPERIMENTAL</B>
1353         */
1354        public final String scriptLanguage;
1355        
1356        /**
1357         * The name the embedder supplied for this script.
1358         * <BR />
1359         * <BR /><B>OPTIONAL</B>
1360         * <BR /><B>EXPERIMENTAL</B>
1361         */
1362        public final String embedderName;
1363        
1364        /**
1365         * Constructor
1366         *
1367         * @param scriptId Identifier of the script parsed.
1368         * 
1369         * @param url URL or name of the script parsed (if any).
1370         * 
1371         * @param startLine Line offset of the script within the resource with given URL (for script tags).
1372         * 
1373         * @param startColumn Column offset of the script within the resource with given URL.
1374         * 
1375         * @param endLine Last line of the script.
1376         * 
1377         * @param endColumn Length of the last line of the script.
1378         * 
1379         * @param executionContextId Specifies script creation context.
1380         * 
1381         * @param hash Content hash of the script.
1382         * 
1383         * @param executionContextAuxData Embedder-specific auxiliary data.
1384         * <BR /><B>OPTIONAL</B>
1385         * 
1386         * @param sourceMapURL URL of source map associated with script (if any).
1387         * <BR /><B>OPTIONAL</B>
1388         * 
1389         * @param hasSourceURL True, if this script has sourceURL.
1390         * <BR /><B>OPTIONAL</B>
1391         * 
1392         * @param isModule True, if this script is ES6 module.
1393         * <BR /><B>OPTIONAL</B>
1394         * 
1395         * @param length This script length.
1396         * <BR /><B>OPTIONAL</B>
1397         * 
1398         * @param stackTrace JavaScript top stack frame of where the script parsed event was triggered if available.
1399         * <BR /><B>OPTIONAL</B>
1400         * <BR /><B>EXPERIMENTAL</B>
1401         * 
1402         * @param codeOffset If the scriptLanguage is WebAssembly, the code section offset in the module.
1403         * <BR /><B>OPTIONAL</B>
1404         * <BR /><B>EXPERIMENTAL</B>
1405         * 
1406         * @param scriptLanguage The language of the script.
1407         * <BR /><B>OPTIONAL</B>
1408         * <BR /><B>EXPERIMENTAL</B>
1409         * 
1410         * @param embedderName The name the embedder supplied for this script.
1411         * <BR /><B>OPTIONAL</B>
1412         * <BR /><B>EXPERIMENTAL</B>
1413         */
1414        public scriptFailedToParse(
1415                String scriptId, String url, int startLine, int startColumn, int endLine, 
1416                int endColumn, int executionContextId, String hash, 
1417                JsonObject executionContextAuxData, String sourceMapURL, Boolean hasSourceURL, 
1418                Boolean isModule, Integer length, RunTime.StackTrace stackTrace, Integer codeOffset, 
1419                String scriptLanguage, String embedderName
1420            )
1421        {
1422            super("Debugger", "scriptFailedToParse", 17);
1423            
1424            // Exception-Check(s) to ensure that if any parameters which are not declared as
1425            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1426            
1427            if (scriptId == null) BRDPC.throwNPE("scriptId");
1428            if (url == null)      BRDPC.throwNPE("url");
1429            if (hash == null)     BRDPC.throwNPE("hash");
1430            
1431            // Exception-Check(s) to ensure that if any parameters which must adhere to a
1432            // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
1433            
1434            BRDPC.checkIAE("scriptLanguage", scriptLanguage, "Debugger.ScriptLanguage", Debugger.ScriptLanguage);
1435            
1436            this.scriptId                 = scriptId;
1437            this.url                      = url;
1438            this.startLine                = startLine;
1439            this.startColumn              = startColumn;
1440            this.endLine                  = endLine;
1441            this.endColumn                = endColumn;
1442            this.executionContextId       = executionContextId;
1443            this.hash                     = hash;
1444            this.executionContextAuxData  = executionContextAuxData;
1445            this.sourceMapURL             = sourceMapURL;
1446            this.hasSourceURL             = hasSourceURL;
1447            this.isModule                 = isModule;
1448            this.length                   = length;
1449            this.stackTrace               = stackTrace;
1450            this.codeOffset               = codeOffset;
1451            this.scriptLanguage           = scriptLanguage;
1452            this.embedderName             = embedderName;
1453        }
1454        
1455        /**
1456         * JSON Object Constructor
1457         * @param jo A Json-Object having data about an instance of {@code 'scriptFailedToParse'}.
1458         */
1459        public scriptFailedToParse (JsonObject jo)
1460        {
1461            super("Debugger", "scriptFailedToParse", 17);
1462        
1463            this.scriptId                 = ReadJSON.getString(jo, "scriptId", false, true);
1464            this.url                      = ReadJSON.getString(jo, "url", false, true);
1465            this.startLine                = ReadPrimJSON.getInt(jo, "startLine");
1466            this.startColumn              = ReadPrimJSON.getInt(jo, "startColumn");
1467            this.endLine                  = ReadPrimJSON.getInt(jo, "endLine");
1468            this.endColumn                = ReadPrimJSON.getInt(jo, "endColumn");
1469            this.executionContextId       = ReadPrimJSON.getInt(jo, "executionContextId");
1470            this.hash                     = ReadJSON.getString(jo, "hash", false, true);
1471            this.executionContextAuxData  = jo.getJsonObject("executionContextAuxData");
1472            this.sourceMapURL             = ReadJSON.getString(jo, "sourceMapURL", true, false);
1473            this.hasSourceURL             = ReadBoxedJSON.getBoolean(jo, "hasSourceURL", true);
1474            this.isModule                 = ReadBoxedJSON.getBoolean(jo, "isModule", true);
1475            this.length                   = ReadBoxedJSON.getInteger(jo, "length", true);
1476            this.stackTrace               = ReadJSON.getObject(jo, "stackTrace", RunTime.StackTrace.class, true, false);
1477            this.codeOffset               = ReadBoxedJSON.getInteger(jo, "codeOffset", true);
1478            this.scriptLanguage           = ReadJSON.getString(jo, "scriptLanguage", true, false);
1479            this.embedderName             = ReadJSON.getString(jo, "embedderName", true, false);
1480        }
1481        
1482        
1483        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
1484        public boolean equals(Object other)
1485        {
1486            if (other == null)                       return false;
1487            if (other.getClass() != this.getClass()) return false;
1488        
1489            scriptFailedToParse o = (scriptFailedToParse) other;
1490        
1491            return
1492                    Objects.equals(this.scriptId, o.scriptId)
1493                &&  Objects.equals(this.url, o.url)
1494                &&  (this.startLine == o.startLine)
1495                &&  (this.startColumn == o.startColumn)
1496                &&  (this.endLine == o.endLine)
1497                &&  (this.endColumn == o.endColumn)
1498                &&  Objects.equals(this.executionContextId, o.executionContextId)
1499                &&  Objects.equals(this.hash, o.hash)
1500                &&  Objects.equals(this.executionContextAuxData, o.executionContextAuxData)
1501                &&  Objects.equals(this.sourceMapURL, o.sourceMapURL)
1502                &&  Objects.equals(this.hasSourceURL, o.hasSourceURL)
1503                &&  Objects.equals(this.isModule, o.isModule)
1504                &&  Objects.equals(this.length, o.length)
1505                &&  Objects.equals(this.stackTrace, o.stackTrace)
1506                &&  Objects.equals(this.codeOffset, o.codeOffset)
1507                &&  Objects.equals(this.scriptLanguage, o.scriptLanguage)
1508                &&  Objects.equals(this.embedderName, o.embedderName);
1509        }
1510        
1511        /** Generates a Hash-Code for {@code 'this'} instance */
1512        public int hashCode()
1513        {
1514            return
1515                    Objects.hashCode(this.scriptId)
1516                +   Objects.hashCode(this.url)
1517                +   this.startLine
1518                +   this.startColumn
1519                +   this.endLine
1520                +   this.endColumn
1521                +   this.executionContextId
1522                +   Objects.hashCode(this.hash)
1523                +   Objects.hashCode(this.executionContextAuxData)
1524                +   Objects.hashCode(this.sourceMapURL)
1525                +   Objects.hashCode(this.hasSourceURL)
1526                +   Objects.hashCode(this.isModule)
1527                +   Objects.hashCode(this.length)
1528                +   this.stackTrace.hashCode()
1529                +   Objects.hashCode(this.codeOffset)
1530                +   Objects.hashCode(this.scriptLanguage)
1531                +   Objects.hashCode(this.embedderName);
1532        }
1533    }
1534    
1535    /**
1536     * Fired when virtual machine parses script. This event is also fired for all known and uncollected
1537     * scripts upon enabling debugger.
1538     */
1539    public static class scriptParsed
1540        extends BrowserEvent
1541        implements java.io.Serializable
1542    {
1543        /** For Object Serialization.  java.io.Serializable */
1544        protected static final long serialVersionUID = 1;
1545        
1546        public boolean[] optionals()
1547        { return new boolean[] { false, false, false, false, false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, }; }
1548        
1549        /** Identifier of the script parsed. */
1550        public final String scriptId;
1551        
1552        /** URL or name of the script parsed (if any). */
1553        public final String url;
1554        
1555        /** Line offset of the script within the resource with given URL (for script tags). */
1556        public final int startLine;
1557        
1558        /** Column offset of the script within the resource with given URL. */
1559        public final int startColumn;
1560        
1561        /** Last line of the script. */
1562        public final int endLine;
1563        
1564        /** Length of the last line of the script. */
1565        public final int endColumn;
1566        
1567        /** Specifies script creation context. */
1568        public final int executionContextId;
1569        
1570        /** Content hash of the script. */
1571        public final String hash;
1572        
1573        /**
1574         * Embedder-specific auxiliary data.
1575         * <BR />
1576         * <BR /><B>OPTIONAL</B>
1577         */
1578        public final JsonObject executionContextAuxData;
1579        
1580        /**
1581         * True, if this script is generated as a result of the live edit operation.
1582         * <BR />
1583         * <BR /><B>OPTIONAL</B>
1584         * <BR /><B>EXPERIMENTAL</B>
1585         */
1586        public final Boolean isLiveEdit;
1587        
1588        /**
1589         * URL of source map associated with script (if any).
1590         * <BR />
1591         * <BR /><B>OPTIONAL</B>
1592         */
1593        public final String sourceMapURL;
1594        
1595        /**
1596         * True, if this script has sourceURL.
1597         * <BR />
1598         * <BR /><B>OPTIONAL</B>
1599         */
1600        public final Boolean hasSourceURL;
1601        
1602        /**
1603         * True, if this script is ES6 module.
1604         * <BR />
1605         * <BR /><B>OPTIONAL</B>
1606         */
1607        public final Boolean isModule;
1608        
1609        /**
1610         * This script length.
1611         * <BR />
1612         * <BR /><B>OPTIONAL</B>
1613         */
1614        public final Integer length;
1615        
1616        /**
1617         * JavaScript top stack frame of where the script parsed event was triggered if available.
1618         * <BR />
1619         * <BR /><B>OPTIONAL</B>
1620         * <BR /><B>EXPERIMENTAL</B>
1621         */
1622        public final RunTime.StackTrace stackTrace;
1623        
1624        /**
1625         * If the scriptLanguage is WebAssembly, the code section offset in the module.
1626         * <BR />
1627         * <BR /><B>OPTIONAL</B>
1628         * <BR /><B>EXPERIMENTAL</B>
1629         */
1630        public final Integer codeOffset;
1631        
1632        /**
1633         * The language of the script.
1634         * <BR />
1635         * <BR /><B>OPTIONAL</B>
1636         * <BR /><B>EXPERIMENTAL</B>
1637         */
1638        public final String scriptLanguage;
1639        
1640        /**
1641         * If the scriptLanguage is WebASsembly, the source of debug symbols for the module.
1642         * <BR />
1643         * <BR /><B>OPTIONAL</B>
1644         * <BR /><B>EXPERIMENTAL</B>
1645         */
1646        public final Debugger.DebugSymbols debugSymbols;
1647        
1648        /**
1649         * The name the embedder supplied for this script.
1650         * <BR />
1651         * <BR /><B>OPTIONAL</B>
1652         * <BR /><B>EXPERIMENTAL</B>
1653         */
1654        public final String embedderName;
1655        
1656        /**
1657         * Constructor
1658         *
1659         * @param scriptId Identifier of the script parsed.
1660         * 
1661         * @param url URL or name of the script parsed (if any).
1662         * 
1663         * @param startLine Line offset of the script within the resource with given URL (for script tags).
1664         * 
1665         * @param startColumn Column offset of the script within the resource with given URL.
1666         * 
1667         * @param endLine Last line of the script.
1668         * 
1669         * @param endColumn Length of the last line of the script.
1670         * 
1671         * @param executionContextId Specifies script creation context.
1672         * 
1673         * @param hash Content hash of the script.
1674         * 
1675         * @param executionContextAuxData Embedder-specific auxiliary data.
1676         * <BR /><B>OPTIONAL</B>
1677         * 
1678         * @param isLiveEdit True, if this script is generated as a result of the live edit operation.
1679         * <BR /><B>OPTIONAL</B>
1680         * <BR /><B>EXPERIMENTAL</B>
1681         * 
1682         * @param sourceMapURL URL of source map associated with script (if any).
1683         * <BR /><B>OPTIONAL</B>
1684         * 
1685         * @param hasSourceURL True, if this script has sourceURL.
1686         * <BR /><B>OPTIONAL</B>
1687         * 
1688         * @param isModule True, if this script is ES6 module.
1689         * <BR /><B>OPTIONAL</B>
1690         * 
1691         * @param length This script length.
1692         * <BR /><B>OPTIONAL</B>
1693         * 
1694         * @param stackTrace JavaScript top stack frame of where the script parsed event was triggered if available.
1695         * <BR /><B>OPTIONAL</B>
1696         * <BR /><B>EXPERIMENTAL</B>
1697         * 
1698         * @param codeOffset If the scriptLanguage is WebAssembly, the code section offset in the module.
1699         * <BR /><B>OPTIONAL</B>
1700         * <BR /><B>EXPERIMENTAL</B>
1701         * 
1702         * @param scriptLanguage The language of the script.
1703         * <BR /><B>OPTIONAL</B>
1704         * <BR /><B>EXPERIMENTAL</B>
1705         * 
1706         * @param debugSymbols If the scriptLanguage is WebASsembly, the source of debug symbols for the module.
1707         * <BR /><B>OPTIONAL</B>
1708         * <BR /><B>EXPERIMENTAL</B>
1709         * 
1710         * @param embedderName The name the embedder supplied for this script.
1711         * <BR /><B>OPTIONAL</B>
1712         * <BR /><B>EXPERIMENTAL</B>
1713         */
1714        public scriptParsed(
1715                String scriptId, String url, int startLine, int startColumn, int endLine, 
1716                int endColumn, int executionContextId, String hash, 
1717                JsonObject executionContextAuxData, Boolean isLiveEdit, String sourceMapURL, 
1718                Boolean hasSourceURL, Boolean isModule, Integer length, 
1719                RunTime.StackTrace stackTrace, Integer codeOffset, String scriptLanguage, 
1720                Debugger.DebugSymbols debugSymbols, String embedderName
1721            )
1722        {
1723            super("Debugger", "scriptParsed", 19);
1724            
1725            // Exception-Check(s) to ensure that if any parameters which are not declared as
1726            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1727            
1728            if (scriptId == null) BRDPC.throwNPE("scriptId");
1729            if (url == null)      BRDPC.throwNPE("url");
1730            if (hash == null)     BRDPC.throwNPE("hash");
1731            
1732            // Exception-Check(s) to ensure that if any parameters which must adhere to a
1733            // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
1734            
1735            BRDPC.checkIAE("scriptLanguage", scriptLanguage, "Debugger.ScriptLanguage", Debugger.ScriptLanguage);
1736            
1737            this.scriptId                 = scriptId;
1738            this.url                      = url;
1739            this.startLine                = startLine;
1740            this.startColumn              = startColumn;
1741            this.endLine                  = endLine;
1742            this.endColumn                = endColumn;
1743            this.executionContextId       = executionContextId;
1744            this.hash                     = hash;
1745            this.executionContextAuxData  = executionContextAuxData;
1746            this.isLiveEdit               = isLiveEdit;
1747            this.sourceMapURL             = sourceMapURL;
1748            this.hasSourceURL             = hasSourceURL;
1749            this.isModule                 = isModule;
1750            this.length                   = length;
1751            this.stackTrace               = stackTrace;
1752            this.codeOffset               = codeOffset;
1753            this.scriptLanguage           = scriptLanguage;
1754            this.debugSymbols             = debugSymbols;
1755            this.embedderName             = embedderName;
1756        }
1757        
1758        /**
1759         * JSON Object Constructor
1760         * @param jo A Json-Object having data about an instance of {@code 'scriptParsed'}.
1761         */
1762        public scriptParsed (JsonObject jo)
1763        {
1764            super("Debugger", "scriptParsed", 19);
1765        
1766            this.scriptId                 = ReadJSON.getString(jo, "scriptId", false, true);
1767            this.url                      = ReadJSON.getString(jo, "url", false, true);
1768            this.startLine                = ReadPrimJSON.getInt(jo, "startLine");
1769            this.startColumn              = ReadPrimJSON.getInt(jo, "startColumn");
1770            this.endLine                  = ReadPrimJSON.getInt(jo, "endLine");
1771            this.endColumn                = ReadPrimJSON.getInt(jo, "endColumn");
1772            this.executionContextId       = ReadPrimJSON.getInt(jo, "executionContextId");
1773            this.hash                     = ReadJSON.getString(jo, "hash", false, true);
1774            this.executionContextAuxData  = jo.getJsonObject("executionContextAuxData");
1775            this.isLiveEdit               = ReadBoxedJSON.getBoolean(jo, "isLiveEdit", true);
1776            this.sourceMapURL             = ReadJSON.getString(jo, "sourceMapURL", true, false);
1777            this.hasSourceURL             = ReadBoxedJSON.getBoolean(jo, "hasSourceURL", true);
1778            this.isModule                 = ReadBoxedJSON.getBoolean(jo, "isModule", true);
1779            this.length                   = ReadBoxedJSON.getInteger(jo, "length", true);
1780            this.stackTrace               = ReadJSON.getObject(jo, "stackTrace", RunTime.StackTrace.class, true, false);
1781            this.codeOffset               = ReadBoxedJSON.getInteger(jo, "codeOffset", true);
1782            this.scriptLanguage           = ReadJSON.getString(jo, "scriptLanguage", true, false);
1783            this.debugSymbols             = ReadJSON.getObject(jo, "debugSymbols", Debugger.DebugSymbols.class, true, false);
1784            this.embedderName             = ReadJSON.getString(jo, "embedderName", true, false);
1785        }
1786        
1787        
1788        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
1789        public boolean equals(Object other)
1790        {
1791            if (other == null)                       return false;
1792            if (other.getClass() != this.getClass()) return false;
1793        
1794            scriptParsed o = (scriptParsed) other;
1795        
1796            return
1797                    Objects.equals(this.scriptId, o.scriptId)
1798                &&  Objects.equals(this.url, o.url)
1799                &&  (this.startLine == o.startLine)
1800                &&  (this.startColumn == o.startColumn)
1801                &&  (this.endLine == o.endLine)
1802                &&  (this.endColumn == o.endColumn)
1803                &&  Objects.equals(this.executionContextId, o.executionContextId)
1804                &&  Objects.equals(this.hash, o.hash)
1805                &&  Objects.equals(this.executionContextAuxData, o.executionContextAuxData)
1806                &&  Objects.equals(this.isLiveEdit, o.isLiveEdit)
1807                &&  Objects.equals(this.sourceMapURL, o.sourceMapURL)
1808                &&  Objects.equals(this.hasSourceURL, o.hasSourceURL)
1809                &&  Objects.equals(this.isModule, o.isModule)
1810                &&  Objects.equals(this.length, o.length)
1811                &&  Objects.equals(this.stackTrace, o.stackTrace)
1812                &&  Objects.equals(this.codeOffset, o.codeOffset)
1813                &&  Objects.equals(this.scriptLanguage, o.scriptLanguage)
1814                &&  Objects.equals(this.debugSymbols, o.debugSymbols)
1815                &&  Objects.equals(this.embedderName, o.embedderName);
1816        }
1817        
1818        /** Generates a Hash-Code for {@code 'this'} instance */
1819        public int hashCode()
1820        {
1821            return
1822                    Objects.hashCode(this.scriptId)
1823                +   Objects.hashCode(this.url)
1824                +   this.startLine
1825                +   this.startColumn
1826                +   this.endLine
1827                +   this.endColumn
1828                +   this.executionContextId
1829                +   Objects.hashCode(this.hash)
1830                +   Objects.hashCode(this.executionContextAuxData)
1831                +   Objects.hashCode(this.isLiveEdit)
1832                +   Objects.hashCode(this.sourceMapURL)
1833                +   Objects.hashCode(this.hasSourceURL)
1834                +   Objects.hashCode(this.isModule)
1835                +   Objects.hashCode(this.length)
1836                +   this.stackTrace.hashCode()
1837                +   Objects.hashCode(this.codeOffset)
1838                +   Objects.hashCode(this.scriptLanguage)
1839                +   this.debugSymbols.hashCode()
1840                +   Objects.hashCode(this.embedderName);
1841        }
1842    }
1843    
1844    
1845    // Counter for keeping the WebSocket Request ID's distinct.
1846    private static int counter = 1;
1847    
1848    /**
1849     * Continues execution until specific location is reached.
1850     * 
1851     * @param location Location to continue to.
1852     * 
1853     * @param targetCallFrames -
1854     * <BR />Acceptable Values: ["any", "current"]
1855     * <BR /><B>OPTIONAL</B>
1856     * 
1857     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
1858     * {@link Ret0}&gt;</CODE>
1859     *
1860     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1861     * browser receives the invocation-request.
1862     *
1863     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
1864     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
1865     * {@code >} to ensure the Browser Function has run to completion.
1866     */
1867    public static Script<String, JsonObject, Ret0> continueToLocation
1868        (Debugger.Location location, String targetCallFrames)
1869    {
1870        // Exception-Check(s) to ensure that if any parameters which are not declared as
1871        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1872        
1873        if (location == null) BRDPC.throwNPE("location");
1874        
1875        // Exception-Check(s) to ensure that if any parameters which must adhere to a
1876        // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
1877        
1878        BRDPC.checkIAE(
1879            "targetCallFrames", targetCallFrames,
1880            "any", "current"
1881        );
1882        
1883        final int       webSocketID = 2000000 + counter++;
1884        final boolean[] optionals   = { false, true, };
1885        
1886        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1887        String requestJSON = WriteJSON.get(
1888            parameterTypes.get("continueToLocation"),
1889            parameterNames.get("continueToLocation"),
1890            optionals, webSocketID,
1891            "Debugger.continueToLocation",
1892            location, targetCallFrames
1893        );
1894        
1895        // This Remote Command does not have a Return-Value.
1896        return new Script<>
1897            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
1898    }
1899    
1900    /**
1901     * Disables debugger for given page.
1902     * 
1903     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
1904     * {@link Ret0}&gt;</CODE>
1905     *
1906     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
1907     * browser receives the invocation-request.
1908     *
1909     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
1910     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
1911     * {@code >} to ensure the Browser Function has run to completion.
1912     */
1913    public static Script<String, JsonObject, Ret0> disable()
1914    {
1915        final int          webSocketID = 2001000 + counter++;
1916        final boolean[]    optionals   = new boolean[0];
1917        
1918        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1919        String requestJSON = WriteJSON.get(
1920            parameterTypes.get("disable"),
1921            parameterNames.get("disable"),
1922            optionals, webSocketID,
1923            "Debugger.disable"
1924        );
1925        
1926        // This Remote Command does not have a Return-Value.
1927        return new Script<>
1928            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
1929    }
1930    
1931    /**
1932     * Enables debugger for the given page. Clients should not assume that the debugging has been
1933     * enabled until the result for this command is received.
1934     * 
1935     * @param maxScriptsCacheSize 
1936     * The maximum size in bytes of collected scripts (not referenced by other heap objects)
1937     * the debugger can hold. Puts no limit if parameter is omitted.
1938     * <BR /><B>OPTIONAL</B>
1939     * <BR /><B>EXPERIMENTAL</B>
1940     * 
1941     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
1942     * String&gt;</CODE>
1943     * 
1944     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
1945     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
1946     * String&gt;</CODE> will be returned.
1947     *
1948     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
1949     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
1950      * may be retrieved.</I>
1951     *
1952     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
1953     * <BR /><BR /><UL CLASS=JDUL>
1954     * <LI><CODE>String (<B>debuggerId</B></CODE>)
1955     *     <BR />Unique identifier of the debugger.
1956     * </LI>
1957     * </UL> */
1958    public static Script<String, JsonObject, String> enable(Number maxScriptsCacheSize)
1959    {
1960        final int       webSocketID = 2002000 + counter++;
1961        final boolean[] optionals   = { true, };
1962        
1963        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
1964        String requestJSON = WriteJSON.get(
1965            parameterTypes.get("enable"),
1966            parameterNames.get("enable"),
1967            optionals, webSocketID,
1968            "Debugger.enable",
1969            maxScriptsCacheSize
1970        );
1971        
1972        // 'JSON Binding' ... Converts Browser Response-JSON to 'String'
1973        Function<JsonObject, String> responseProcessor = (JsonObject jo) ->
1974            ReadJSON.getString(jo, "debuggerId", false, true);
1975        
1976        // Pass the 'defaultSender' to Script-Constructor
1977        // The sender that is used can be changed before executing script.
1978        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
1979    }
1980    
1981    /**
1982     * Evaluates expression on a given call frame.
1983     * 
1984     * @param callFrameId Call frame identifier to evaluate on.
1985     * 
1986     * @param expression Expression to evaluate.
1987     * 
1988     * @param objectGroup 
1989     * String object group name to put result into (allows rapid releasing resulting object handles
1990     * using <CODE>releaseObjectGroup</CODE>).
1991     * <BR /><B>OPTIONAL</B>
1992     * 
1993     * @param includeCommandLineAPI 
1994     * Specifies whether command line API should be available to the evaluated expression, defaults
1995     * to false.
1996     * <BR /><B>OPTIONAL</B>
1997     * 
1998     * @param silent 
1999     * In silent mode exceptions thrown during evaluation are not reported and do not pause
2000     * execution. Overrides <CODE>setPauseOnException</CODE> state.
2001     * <BR /><B>OPTIONAL</B>
2002     * 
2003     * @param returnByValue Whether the result is expected to be a JSON object that should be sent by value.
2004     * <BR /><B>OPTIONAL</B>
2005     * 
2006     * @param generatePreview Whether preview should be generated for the result.
2007     * <BR /><B>OPTIONAL</B>
2008     * <BR /><B>EXPERIMENTAL</B>
2009     * 
2010     * @param throwOnSideEffect Whether to throw an exception if side effect cannot be ruled out during evaluation.
2011     * <BR /><B>OPTIONAL</B>
2012     * 
2013     * @param timeout Terminate execution after timing out (number of milliseconds).
2014     * <BR /><B>OPTIONAL</B>
2015     * <BR /><B>EXPERIMENTAL</B>
2016     * 
2017     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2018     * {@link Ret2}&gt;</CODE>
2019     *
2020     * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 
2021     * {@link Script#exec()}), and a {@link Promise} returned.
2022     *
2023     * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B>
2024     * (using {@link Promise#await()}), the {@code Ret2} will subsequently
2025     * be returned from that call.
2026     * 
2027     * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated
2028     * in an instance of <B>{@link Ret2}</B>
2029     *
2030     * <BR /><BR /><UL CLASS=JDUL>
2031     * <LI><CODE><B>Ret2.a:</B> {@link RunTime.RemoteObject} (<B>result</B>)</CODE>
2032     *     <BR />Object wrapper for the evaluation result.
2033     *     <BR /><BR /></LI>
2034     * <LI><CODE><B>Ret2.b:</B> {@link RunTime.ExceptionDetails} (<B>exceptionDetails</B>)</CODE>
2035     *     <BR />Exception details.
2036     *     </LI>
2037     * </UL>
2038     */
2039    public static Script<String, JsonObject, Ret2<RunTime.RemoteObject, RunTime.ExceptionDetails>> evaluateOnCallFrame(
2040            String callFrameId, String expression, String objectGroup, 
2041            Boolean includeCommandLineAPI, Boolean silent, Boolean returnByValue, 
2042            Boolean generatePreview, Boolean throwOnSideEffect, Number timeout
2043        )
2044    {
2045        // Exception-Check(s) to ensure that if any parameters which are not declared as
2046        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2047        
2048        if (callFrameId == null) BRDPC.throwNPE("callFrameId");
2049        if (expression == null)  BRDPC.throwNPE("expression");
2050        
2051        final int       webSocketID = 2003000 + counter++;
2052        final boolean[] optionals   = { false, false, true, true, true, true, true, true, true, };
2053        
2054        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2055        String requestJSON = WriteJSON.get(
2056            parameterTypes.get("evaluateOnCallFrame"),
2057            parameterNames.get("evaluateOnCallFrame"),
2058            optionals, webSocketID,
2059            "Debugger.evaluateOnCallFrame",
2060            callFrameId, expression, objectGroup, includeCommandLineAPI, silent, returnByValue,
2061            generatePreview, throwOnSideEffect, timeout
2062        );
2063        
2064        // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret2'
2065        Function<JsonObject, Ret2<RunTime.RemoteObject, RunTime.ExceptionDetails>> 
2066            responseProcessor = (JsonObject jo) -> new Ret2<>(
2067                ReadJSON.getObject(jo, "result", RunTime.RemoteObject.class, false, true),
2068                ReadJSON.getObject(jo, "exceptionDetails", RunTime.ExceptionDetails.class, true, false)
2069            );
2070        
2071        // Pass the 'defaultSender' to Script-Constructor
2072        // The sender that is used can be changed before executing script.
2073        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2074    }
2075    
2076    /**
2077     * Returns possible locations for breakpoint. scriptId in start and end range locations should be
2078     * the same.
2079     * 
2080     * @param start Start of range to search possible breakpoint locations in.
2081     * 
2082     * @param end 
2083     * End of range to search possible breakpoint locations in (excluding). When not specified, end
2084     * of scripts is used as end of range.
2085     * <BR /><B>OPTIONAL</B>
2086     * 
2087     * @param restrictToFunction Only consider locations which are in the same (non-nested) function as start.
2088     * <BR /><B>OPTIONAL</B>
2089     * 
2090     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2091     * {@link Debugger.BreakLocation}[]&gt;</CODE>
2092     * 
2093     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
2094     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
2095     * {@link Debugger.BreakLocation}[]&gt;</CODE> will be returned.
2096     *
2097     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
2098     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
2099      * may be retrieved.</I>
2100     *
2101     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
2102     * <BR /><BR /><UL CLASS=JDUL>
2103     * <LI><CODE>{@link Debugger.BreakLocation}[] (<B>locations</B></CODE>)
2104     *     <BR />List of the possible breakpoint locations.
2105     * </LI>
2106     * </UL> */
2107    public static Script<String, JsonObject, Debugger.BreakLocation[]> getPossibleBreakpoints
2108        (Debugger.Location start, Debugger.Location end, Boolean restrictToFunction)
2109    {
2110        // Exception-Check(s) to ensure that if any parameters which are not declared as
2111        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2112        
2113        if (start == null) BRDPC.throwNPE("start");
2114        
2115        final int       webSocketID = 2004000 + counter++;
2116        final boolean[] optionals   = { false, true, true, };
2117        
2118        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2119        String requestJSON = WriteJSON.get(
2120            parameterTypes.get("getPossibleBreakpoints"),
2121            parameterNames.get("getPossibleBreakpoints"),
2122            optionals, webSocketID,
2123            "Debugger.getPossibleBreakpoints",
2124            start, end, restrictToFunction
2125        );
2126        
2127        // 'JSON Binding' ... Converts Browser Response-JSON to 'Debugger.BreakLocation[]'
2128        Function<JsonObject, Debugger.BreakLocation[]> responseProcessor = (JsonObject jo) ->
2129            (jo.getJsonArray("locations") == null)
2130                ? null
2131                : ReadArrJSON.DimN.objArr(jo.getJsonArray("locations"), null, 0, Debugger.BreakLocation[].class);
2132        
2133        // Pass the 'defaultSender' to Script-Constructor
2134        // The sender that is used can be changed before executing script.
2135        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2136    }
2137    
2138    /**
2139     * Returns source for the script with given id.
2140     * 
2141     * @param scriptId Id of the script to get source for.
2142     * 
2143     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2144     * {@link Ret2}&gt;</CODE>
2145     *
2146     * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 
2147     * {@link Script#exec()}), and a {@link Promise} returned.
2148     *
2149     * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B>
2150     * (using {@link Promise#await()}), the {@code Ret2} will subsequently
2151     * be returned from that call.
2152     * 
2153     * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated
2154     * in an instance of <B>{@link Ret2}</B>
2155     *
2156     * <BR /><BR /><UL CLASS=JDUL>
2157     * <LI><CODE><B>Ret2.a:</B> String (<B>scriptSource</B>)</CODE>
2158     *     <BR />Script source (empty in case of Wasm bytecode).
2159     *     <BR /><BR /></LI>
2160     * <LI><CODE><B>Ret2.b:</B> String (<B>bytecode</B>)</CODE>
2161     *     <BR />Wasm bytecode. (Encoded as a base64 string when passed over JSON)
2162     *     </LI>
2163     * </UL>
2164     */
2165    public static Script<String, JsonObject, Ret2<String, String>> getScriptSource
2166        (String scriptId)
2167    {
2168        // Exception-Check(s) to ensure that if any parameters which are not declared as
2169        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2170        
2171        if (scriptId == null) BRDPC.throwNPE("scriptId");
2172        
2173        final int       webSocketID = 2005000 + counter++;
2174        final boolean[] optionals   = { false, };
2175        
2176        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2177        String requestJSON = WriteJSON.get(
2178            parameterTypes.get("getScriptSource"),
2179            parameterNames.get("getScriptSource"),
2180            optionals, webSocketID,
2181            "Debugger.getScriptSource",
2182            scriptId
2183        );
2184        
2185        // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret2'
2186        Function<JsonObject, Ret2<String, String>> 
2187            responseProcessor = (JsonObject jo) -> new Ret2<>(
2188                ReadJSON.getString(jo, "scriptSource", false, true),
2189                ReadJSON.getString(jo, "bytecode", true, false)
2190            );
2191        
2192        // Pass the 'defaultSender' to Script-Constructor
2193        // The sender that is used can be changed before executing script.
2194        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2195    }
2196    
2197    /**
2198     * This command is deprecated. Use getScriptSource instead.
2199     * <BR /><B>DEPRECATED</B>
2200     * 
2201     * @param scriptId Id of the Wasm script to get source for.
2202     * 
2203     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2204     * String&gt;</CODE>
2205     * 
2206     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
2207     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
2208     * String&gt;</CODE> will be returned.
2209     *
2210     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
2211     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
2212      * may be retrieved.</I>
2213     *
2214     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
2215     * <BR /><BR /><UL CLASS=JDUL>
2216     * <LI><CODE>String (<B>bytecode</B></CODE>)
2217     *     <BR />Script source. (Encoded as a base64 string when passed over JSON)
2218     * </LI>
2219     * </UL> */
2220    public static Script<String, JsonObject, String> getWasmBytecode(String scriptId)
2221    {
2222        // Exception-Check(s) to ensure that if any parameters which are not declared as
2223        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2224        
2225        if (scriptId == null) BRDPC.throwNPE("scriptId");
2226        
2227        final int       webSocketID = 2006000 + counter++;
2228        final boolean[] optionals   = { false, };
2229        
2230        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2231        String requestJSON = WriteJSON.get(
2232            parameterTypes.get("getWasmBytecode"),
2233            parameterNames.get("getWasmBytecode"),
2234            optionals, webSocketID,
2235            "Debugger.getWasmBytecode",
2236            scriptId
2237        );
2238        
2239        // 'JSON Binding' ... Converts Browser Response-JSON to 'String'
2240        Function<JsonObject, String> responseProcessor = (JsonObject jo) ->
2241            ReadJSON.getString(jo, "bytecode", false, true);
2242        
2243        // Pass the 'defaultSender' to Script-Constructor
2244        // The sender that is used can be changed before executing script.
2245        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2246    }
2247    
2248    /**
2249     * Returns stack trace with given <CODE>stackTraceId</CODE>.
2250     * <BR /><B>EXPERIMENTAL</B>
2251     * 
2252     * @param stackTraceId -
2253     * 
2254     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2255     * {@link RunTime.StackTrace}&gt;</CODE>
2256     * 
2257     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
2258     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
2259     * {@link RunTime.StackTrace}&gt;</CODE> will be returned.
2260     *
2261     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
2262     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
2263      * may be retrieved.</I>
2264     *
2265     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
2266     * <BR /><BR /><UL CLASS=JDUL>
2267     * <LI><CODE>{@link RunTime.StackTrace} (<B>stackTrace</B></CODE>)
2268     *     <BR />-
2269     * </LI>
2270     * </UL> */
2271    public static Script<String, JsonObject, RunTime.StackTrace> getStackTrace
2272        (RunTime.StackTraceId stackTraceId)
2273    {
2274        // Exception-Check(s) to ensure that if any parameters which are not declared as
2275        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2276        
2277        if (stackTraceId == null) BRDPC.throwNPE("stackTraceId");
2278        
2279        final int       webSocketID = 2007000 + counter++;
2280        final boolean[] optionals   = { false, };
2281        
2282        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2283        String requestJSON = WriteJSON.get(
2284            parameterTypes.get("getStackTrace"),
2285            parameterNames.get("getStackTrace"),
2286            optionals, webSocketID,
2287            "Debugger.getStackTrace",
2288            stackTraceId
2289        );
2290        
2291        // 'JSON Binding' ... Converts Browser Response-JSON to 'RunTime.StackTrace'
2292        Function<JsonObject, RunTime.StackTrace> responseProcessor = (JsonObject jo) ->
2293            ReadJSON.getObject(jo, "stackTrace", RunTime.StackTrace.class, false, true);
2294        
2295        // Pass the 'defaultSender' to Script-Constructor
2296        // The sender that is used can be changed before executing script.
2297        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2298    }
2299    
2300    /**
2301     * Stops on the next JavaScript statement.
2302     * 
2303     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2304     * {@link Ret0}&gt;</CODE>
2305     *
2306     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
2307     * browser receives the invocation-request.
2308     *
2309     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
2310     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
2311     * {@code >} to ensure the Browser Function has run to completion.
2312     */
2313    public static Script<String, JsonObject, Ret0> pause()
2314    {
2315        final int          webSocketID = 2008000 + counter++;
2316        final boolean[]    optionals   = new boolean[0];
2317        
2318        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2319        String requestJSON = WriteJSON.get(
2320            parameterTypes.get("pause"),
2321            parameterNames.get("pause"),
2322            optionals, webSocketID,
2323            "Debugger.pause"
2324        );
2325        
2326        // This Remote Command does not have a Return-Value.
2327        return new Script<>
2328            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
2329    }
2330    
2331    /**
2332     * <CODE>[No Description Provided by Google]</CODE>
2333     * <BR /><B>EXPERIMENTAL</B>
2334     * <BR /><B>DEPRECATED</B>
2335     * 
2336     * @param parentStackTraceId Debugger will pause when async call with given stack trace is started.
2337     * 
2338     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2339     * {@link Ret0}&gt;</CODE>
2340     *
2341     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
2342     * browser receives the invocation-request.
2343     *
2344     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
2345     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
2346     * {@code >} to ensure the Browser Function has run to completion.
2347     */
2348    public static Script<String, JsonObject, Ret0> pauseOnAsyncCall
2349        (RunTime.StackTraceId parentStackTraceId)
2350    {
2351        // Exception-Check(s) to ensure that if any parameters which are not declared as
2352        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2353        
2354        if (parentStackTraceId == null) BRDPC.throwNPE("parentStackTraceId");
2355        
2356        final int       webSocketID = 2009000 + counter++;
2357        final boolean[] optionals   = { false, };
2358        
2359        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2360        String requestJSON = WriteJSON.get(
2361            parameterTypes.get("pauseOnAsyncCall"),
2362            parameterNames.get("pauseOnAsyncCall"),
2363            optionals, webSocketID,
2364            "Debugger.pauseOnAsyncCall",
2365            parentStackTraceId
2366        );
2367        
2368        // This Remote Command does not have a Return-Value.
2369        return new Script<>
2370            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
2371    }
2372    
2373    /**
2374     * Removes JavaScript breakpoint.
2375     * 
2376     * @param breakpointId -
2377     * 
2378     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2379     * {@link Ret0}&gt;</CODE>
2380     *
2381     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
2382     * browser receives the invocation-request.
2383     *
2384     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
2385     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
2386     * {@code >} to ensure the Browser Function has run to completion.
2387     */
2388    public static Script<String, JsonObject, Ret0> removeBreakpoint(String breakpointId)
2389    {
2390        // Exception-Check(s) to ensure that if any parameters which are not declared as
2391        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2392        
2393        if (breakpointId == null) BRDPC.throwNPE("breakpointId");
2394        
2395        final int       webSocketID = 2010000 + counter++;
2396        final boolean[] optionals   = { false, };
2397        
2398        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2399        String requestJSON = WriteJSON.get(
2400            parameterTypes.get("removeBreakpoint"),
2401            parameterNames.get("removeBreakpoint"),
2402            optionals, webSocketID,
2403            "Debugger.removeBreakpoint",
2404            breakpointId
2405        );
2406        
2407        // This Remote Command does not have a Return-Value.
2408        return new Script<>
2409            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
2410    }
2411    
2412    /**
2413     * Restarts particular call frame from the beginning.
2414     * <BR /><B>DEPRECATED</B>
2415     * 
2416     * @param callFrameId Call frame identifier to evaluate on.
2417     * 
2418     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2419     * {@link Ret3}&gt;</CODE>
2420     *
2421     * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 
2422     * {@link Script#exec()}), and a {@link Promise} returned.
2423     *
2424     * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B>
2425     * (using {@link Promise#await()}), the {@code Ret3} will subsequently
2426     * be returned from that call.
2427     * 
2428     * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated
2429     * in an instance of <B>{@link Ret3}</B>
2430     *
2431     * <BR /><BR /><UL CLASS=JDUL>
2432     * <LI><CODE><B>Ret3.a:</B> {@link Debugger.CallFrame}[] (<B>callFrames</B>)</CODE>
2433     *     <BR />New stack trace.
2434     *     <BR /><BR /></LI>
2435     * <LI><CODE><B>Ret3.b:</B> {@link RunTime.StackTrace} (<B>asyncStackTrace</B>)</CODE>
2436     *     <BR />Async stack trace, if any.
2437     *     <BR /><BR /></LI>
2438     * <LI><CODE><B>Ret3.c:</B> {@link RunTime.StackTraceId} (<B>asyncStackTraceId</B>)</CODE>
2439     *     <BR />Async stack trace, if any.
2440     *     </LI>
2441     * </UL>
2442     */
2443    public static Script<String, JsonObject, Ret3<Debugger.CallFrame[], RunTime.StackTrace, RunTime.StackTraceId>> 
2444        restartFrame(String callFrameId)
2445    {
2446        // Exception-Check(s) to ensure that if any parameters which are not declared as
2447        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2448        
2449        if (callFrameId == null) BRDPC.throwNPE("callFrameId");
2450        
2451        final int       webSocketID = 2011000 + counter++;
2452        final boolean[] optionals   = { false, };
2453        
2454        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2455        String requestJSON = WriteJSON.get(
2456            parameterTypes.get("restartFrame"),
2457            parameterNames.get("restartFrame"),
2458            optionals, webSocketID,
2459            "Debugger.restartFrame",
2460            callFrameId
2461        );
2462        
2463        // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret3'
2464        Function<JsonObject, Ret3<Debugger.CallFrame[], RunTime.StackTrace, RunTime.StackTraceId>> 
2465            responseProcessor = (JsonObject jo) -> new Ret3<>(
2466                (jo.getJsonArray("callFrames") == null)
2467                    ? null
2468                    : ReadArrJSON.DimN.objArr(jo.getJsonArray("callFrames"), null, 0, Debugger.CallFrame[].class),
2469                ReadJSON.getObject(jo, "asyncStackTrace", RunTime.StackTrace.class, true, false),
2470                ReadJSON.getObject(jo, "asyncStackTraceId", RunTime.StackTraceId.class, true, false)
2471            );
2472        
2473        // Pass the 'defaultSender' to Script-Constructor
2474        // The sender that is used can be changed before executing script.
2475        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2476    }
2477    
2478    /**
2479     * Resumes JavaScript execution.
2480     * 
2481     * @param terminateOnResume 
2482     * Set to true to terminate execution upon resuming execution. In contrast
2483     * to RunTime.terminateExecution, this will allows to execute further
2484     * JavaScript (i.e. via evaluation) until execution of the paused code
2485     * is actually resumed, at which point termination is triggered.
2486     * If execution is currently not paused, this parameter has no effect.
2487     * <BR /><B>OPTIONAL</B>
2488     * 
2489     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2490     * {@link Ret0}&gt;</CODE>
2491     *
2492     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
2493     * browser receives the invocation-request.
2494     *
2495     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
2496     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
2497     * {@code >} to ensure the Browser Function has run to completion.
2498     */
2499    public static Script<String, JsonObject, Ret0> resume(Boolean terminateOnResume)
2500    {
2501        final int       webSocketID = 2012000 + counter++;
2502        final boolean[] optionals   = { true, };
2503        
2504        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2505        String requestJSON = WriteJSON.get(
2506            parameterTypes.get("resume"),
2507            parameterNames.get("resume"),
2508            optionals, webSocketID,
2509            "Debugger.resume",
2510            terminateOnResume
2511        );
2512        
2513        // This Remote Command does not have a Return-Value.
2514        return new Script<>
2515            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
2516    }
2517    
2518    /**
2519     * Searches for given string in script content.
2520     * 
2521     * @param scriptId Id of the script to search in.
2522     * 
2523     * @param query String to search for.
2524     * 
2525     * @param caseSensitive If true, search is case sensitive.
2526     * <BR /><B>OPTIONAL</B>
2527     * 
2528     * @param isRegex If true, treats string parameter as regex.
2529     * <BR /><B>OPTIONAL</B>
2530     * 
2531     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2532     * {@link Debugger.SearchMatch}[]&gt;</CODE>
2533     * 
2534     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
2535     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
2536     * {@link Debugger.SearchMatch}[]&gt;</CODE> will be returned.
2537     *
2538     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
2539     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
2540      * may be retrieved.</I>
2541     *
2542     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
2543     * <BR /><BR /><UL CLASS=JDUL>
2544     * <LI><CODE>{@link Debugger.SearchMatch}[] (<B>result</B></CODE>)
2545     *     <BR />List of search matches.
2546     * </LI>
2547     * </UL> */
2548    public static Script<String, JsonObject, Debugger.SearchMatch[]> searchInContent
2549        (String scriptId, String query, Boolean caseSensitive, Boolean isRegex)
2550    {
2551        // Exception-Check(s) to ensure that if any parameters which are not declared as
2552        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2553        
2554        if (scriptId == null) BRDPC.throwNPE("scriptId");
2555        if (query == null)    BRDPC.throwNPE("query");
2556        
2557        final int       webSocketID = 2013000 + counter++;
2558        final boolean[] optionals   = { false, false, true, true, };
2559        
2560        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2561        String requestJSON = WriteJSON.get(
2562            parameterTypes.get("searchInContent"),
2563            parameterNames.get("searchInContent"),
2564            optionals, webSocketID,
2565            "Debugger.searchInContent",
2566            scriptId, query, caseSensitive, isRegex
2567        );
2568        
2569        // 'JSON Binding' ... Converts Browser Response-JSON to 'Debugger.SearchMatch[]'
2570        Function<JsonObject, Debugger.SearchMatch[]> responseProcessor = (JsonObject jo) ->
2571            (jo.getJsonArray("result") == null)
2572                ? null
2573                : ReadArrJSON.DimN.objArr(jo.getJsonArray("result"), null, 0, Debugger.SearchMatch[].class);
2574        
2575        // Pass the 'defaultSender' to Script-Constructor
2576        // The sender that is used can be changed before executing script.
2577        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2578    }
2579    
2580    /**
2581     * Enables or disables async call stacks tracking.
2582     * 
2583     * @param maxDepth 
2584     * Maximum depth of async call stacks. Setting to <CODE>0</CODE> will effectively disable collecting async
2585     * call stacks (default).
2586     * 
2587     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2588     * {@link Ret0}&gt;</CODE>
2589     *
2590     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
2591     * browser receives the invocation-request.
2592     *
2593     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
2594     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
2595     * {@code >} to ensure the Browser Function has run to completion.
2596     */
2597    public static Script<String, JsonObject, Ret0> setAsyncCallStackDepth(int maxDepth)
2598    {
2599        final int       webSocketID = 2014000 + counter++;
2600        final boolean[] optionals   = { false, };
2601        
2602        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2603        String requestJSON = WriteJSON.get(
2604            parameterTypes.get("setAsyncCallStackDepth"),
2605            parameterNames.get("setAsyncCallStackDepth"),
2606            optionals, webSocketID,
2607            "Debugger.setAsyncCallStackDepth",
2608            maxDepth
2609        );
2610        
2611        // This Remote Command does not have a Return-Value.
2612        return new Script<>
2613            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
2614    }
2615    
2616    /**
2617     * Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in
2618     * scripts with url matching one of the patterns. VM will try to leave blackboxed script by
2619     * performing 'step in' several times, finally resorting to 'step out' if unsuccessful.
2620     * <BR /><B>EXPERIMENTAL</B>
2621     * 
2622     * @param patterns Array of regexps that will be used to check script url for blackbox state.
2623     * 
2624     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2625     * {@link Ret0}&gt;</CODE>
2626     *
2627     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
2628     * browser receives the invocation-request.
2629     *
2630     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
2631     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
2632     * {@code >} to ensure the Browser Function has run to completion.
2633     */
2634    public static Script<String, JsonObject, Ret0> setBlackboxPatterns(String[] patterns)
2635    {
2636        // Exception-Check(s) to ensure that if any parameters which are not declared as
2637        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2638        
2639        if (patterns == null) BRDPC.throwNPE("patterns");
2640        
2641        final int       webSocketID = 2015000 + counter++;
2642        final boolean[] optionals   = { false, };
2643        
2644        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2645        String requestJSON = WriteJSON.get(
2646            parameterTypes.get("setBlackboxPatterns"),
2647            parameterNames.get("setBlackboxPatterns"),
2648            optionals, webSocketID,
2649            "Debugger.setBlackboxPatterns",
2650            (Object) patterns
2651        );
2652        
2653        // This Remote Command does not have a Return-Value.
2654        return new Script<>
2655            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
2656    }
2657    
2658    /**
2659     * Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted
2660     * scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful.
2661     * Positions array contains positions where blackbox state is changed. First interval isn't
2662     * blackboxed. Array should be sorted.
2663     * <BR /><B>EXPERIMENTAL</B>
2664     * 
2665     * @param scriptId Id of the script.
2666     * 
2667     * @param positions -
2668     * 
2669     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2670     * {@link Ret0}&gt;</CODE>
2671     *
2672     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
2673     * browser receives the invocation-request.
2674     *
2675     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
2676     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
2677     * {@code >} to ensure the Browser Function has run to completion.
2678     */
2679    public static Script<String, JsonObject, Ret0> setBlackboxedRanges
2680        (String scriptId, Debugger.ScriptPosition[] positions)
2681    {
2682        // Exception-Check(s) to ensure that if any parameters which are not declared as
2683        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2684        
2685        if (scriptId == null)  BRDPC.throwNPE("scriptId");
2686        if (positions == null) BRDPC.throwNPE("positions");
2687        
2688        final int       webSocketID = 2016000 + counter++;
2689        final boolean[] optionals   = { false, false, };
2690        
2691        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2692        String requestJSON = WriteJSON.get(
2693            parameterTypes.get("setBlackboxedRanges"),
2694            parameterNames.get("setBlackboxedRanges"),
2695            optionals, webSocketID,
2696            "Debugger.setBlackboxedRanges",
2697            scriptId, positions
2698        );
2699        
2700        // This Remote Command does not have a Return-Value.
2701        return new Script<>
2702            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
2703    }
2704    
2705    /**
2706     * Sets JavaScript breakpoint at a given location.
2707     * 
2708     * @param location Location to set breakpoint in.
2709     * 
2710     * @param condition 
2711     * Expression to use as a breakpoint condition. When specified, debugger will only stop on the
2712     * breakpoint if this expression evaluates to true.
2713     * <BR /><B>OPTIONAL</B>
2714     * 
2715     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2716     * {@link Ret2}&gt;</CODE>
2717     *
2718     * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 
2719     * {@link Script#exec()}), and a {@link Promise} returned.
2720     *
2721     * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B>
2722     * (using {@link Promise#await()}), the {@code Ret2} will subsequently
2723     * be returned from that call.
2724     * 
2725     * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated
2726     * in an instance of <B>{@link Ret2}</B>
2727     *
2728     * <BR /><BR /><UL CLASS=JDUL>
2729     * <LI><CODE><B>Ret2.a:</B> String (<B>breakpointId</B>)</CODE>
2730     *     <BR />Id of the created breakpoint for further reference.
2731     *     <BR /><BR /></LI>
2732     * <LI><CODE><B>Ret2.b:</B> {@link Debugger.Location} (<B>actualLocation</B>)</CODE>
2733     *     <BR />Location this breakpoint resolved into.
2734     *     </LI>
2735     * </UL>
2736     */
2737    public static Script<String, JsonObject, Ret2<String, Debugger.Location>> setBreakpoint
2738        (Debugger.Location location, String condition)
2739    {
2740        // Exception-Check(s) to ensure that if any parameters which are not declared as
2741        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2742        
2743        if (location == null) BRDPC.throwNPE("location");
2744        
2745        final int       webSocketID = 2017000 + counter++;
2746        final boolean[] optionals   = { false, true, };
2747        
2748        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2749        String requestJSON = WriteJSON.get(
2750            parameterTypes.get("setBreakpoint"),
2751            parameterNames.get("setBreakpoint"),
2752            optionals, webSocketID,
2753            "Debugger.setBreakpoint",
2754            location, condition
2755        );
2756        
2757        // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret2'
2758        Function<JsonObject, Ret2<String, Debugger.Location>> 
2759            responseProcessor = (JsonObject jo) -> new Ret2<>(
2760                ReadJSON.getString(jo, "breakpointId", false, true),
2761                ReadJSON.getObject(jo, "actualLocation", Debugger.Location.class, false, true)
2762            );
2763        
2764        // Pass the 'defaultSender' to Script-Constructor
2765        // The sender that is used can be changed before executing script.
2766        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2767    }
2768    
2769    /**
2770     * Sets instrumentation breakpoint.
2771     * 
2772     * @param instrumentation Instrumentation name.
2773     * <BR />Acceptable Values: ["beforeScriptExecution", "beforeScriptWithSourceMapExecution"]
2774     * 
2775     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2776     * String&gt;</CODE>
2777     * 
2778     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
2779     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
2780     * String&gt;</CODE> will be returned.
2781     *
2782     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
2783     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
2784      * may be retrieved.</I>
2785     *
2786     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
2787     * <BR /><BR /><UL CLASS=JDUL>
2788     * <LI><CODE>String (<B>breakpointId</B></CODE>)
2789     *     <BR />Id of the created breakpoint for further reference.
2790     * </LI>
2791     * </UL> */
2792    public static Script<String, JsonObject, String> setInstrumentationBreakpoint
2793        (String instrumentation)
2794    {
2795        // Exception-Check(s) to ensure that if any parameters which are not declared as
2796        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2797        
2798        if (instrumentation == null) BRDPC.throwNPE("instrumentation");
2799        
2800        // Exception-Check(s) to ensure that if any parameters which must adhere to a
2801        // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
2802        
2803        BRDPC.checkIAE(
2804            "instrumentation", instrumentation,
2805            "beforeScriptExecution", "beforeScriptWithSourceMapExecution"
2806        );
2807        
2808        final int       webSocketID = 2018000 + counter++;
2809        final boolean[] optionals   = { false, };
2810        
2811        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2812        String requestJSON = WriteJSON.get(
2813            parameterTypes.get("setInstrumentationBreakpoint"),
2814            parameterNames.get("setInstrumentationBreakpoint"),
2815            optionals, webSocketID,
2816            "Debugger.setInstrumentationBreakpoint",
2817            instrumentation
2818        );
2819        
2820        // 'JSON Binding' ... Converts Browser Response-JSON to 'String'
2821        Function<JsonObject, String> responseProcessor = (JsonObject jo) ->
2822            ReadJSON.getString(jo, "breakpointId", false, true);
2823        
2824        // Pass the 'defaultSender' to Script-Constructor
2825        // The sender that is used can be changed before executing script.
2826        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2827    }
2828    
2829    /**
2830     * Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this
2831     * command is issued, all existing parsed scripts will have breakpoints resolved and returned in
2832     * <CODE>locations</CODE> property. Further matching script parsing will result in subsequent
2833     * <CODE>breakpointResolved</CODE> events issued. This logical breakpoint will survive page reloads.
2834     * 
2835     * @param lineNumber Line number to set breakpoint at.
2836     * 
2837     * @param url URL of the resources to set breakpoint on.
2838     * <BR /><B>OPTIONAL</B>
2839     * 
2840     * @param urlRegex 
2841     * Regex pattern for the URLs of the resources to set breakpoints on. Either <CODE>url</CODE> or
2842     * <CODE>urlRegex</CODE> must be specified.
2843     * <BR /><B>OPTIONAL</B>
2844     * 
2845     * @param scriptHash Script hash of the resources to set breakpoint on.
2846     * <BR /><B>OPTIONAL</B>
2847     * 
2848     * @param columnNumber Offset in the line to set breakpoint at.
2849     * <BR /><B>OPTIONAL</B>
2850     * 
2851     * @param condition 
2852     * Expression to use as a breakpoint condition. When specified, debugger will only stop on the
2853     * breakpoint if this expression evaluates to true.
2854     * <BR /><B>OPTIONAL</B>
2855     * 
2856     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2857     * {@link Ret2}&gt;</CODE>
2858     *
2859     * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 
2860     * {@link Script#exec()}), and a {@link Promise} returned.
2861     *
2862     * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B>
2863     * (using {@link Promise#await()}), the {@code Ret2} will subsequently
2864     * be returned from that call.
2865     * 
2866     * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated
2867     * in an instance of <B>{@link Ret2}</B>
2868     *
2869     * <BR /><BR /><UL CLASS=JDUL>
2870     * <LI><CODE><B>Ret2.a:</B> String (<B>breakpointId</B>)</CODE>
2871     *     <BR />Id of the created breakpoint for further reference.
2872     *     <BR /><BR /></LI>
2873     * <LI><CODE><B>Ret2.b:</B> {@link Debugger.Location}[] (<B>locations</B>)</CODE>
2874     *     <BR />List of the locations this breakpoint resolved into upon addition.
2875     *     </LI>
2876     * </UL>
2877     */
2878    public static Script<String, JsonObject, Ret2<String, Debugger.Location[]>> setBreakpointByUrl(
2879            int lineNumber, String url, String urlRegex, String scriptHash, Integer columnNumber, 
2880            String condition
2881        )
2882    {
2883        final int       webSocketID = 2019000 + counter++;
2884        final boolean[] optionals   = { false, true, true, true, true, true, };
2885        
2886        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2887        String requestJSON = WriteJSON.get(
2888            parameterTypes.get("setBreakpointByUrl"),
2889            parameterNames.get("setBreakpointByUrl"),
2890            optionals, webSocketID,
2891            "Debugger.setBreakpointByUrl",
2892            lineNumber, url, urlRegex, scriptHash, columnNumber, condition
2893        );
2894        
2895        // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret2'
2896        Function<JsonObject, Ret2<String, Debugger.Location[]>> 
2897            responseProcessor = (JsonObject jo) -> new Ret2<>(
2898                ReadJSON.getString(jo, "breakpointId", false, true),
2899                (jo.getJsonArray("locations") == null)
2900                    ? null
2901                    : ReadArrJSON.DimN.objArr(jo.getJsonArray("locations"), null, 0, Debugger.Location[].class)
2902            );
2903        
2904        // Pass the 'defaultSender' to Script-Constructor
2905        // The sender that is used can be changed before executing script.
2906        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2907    }
2908    
2909    /**
2910     * Sets JavaScript breakpoint before each call to the given function.
2911     * If another function was created from the same source as a given one,
2912     * calling it will also trigger the breakpoint.
2913     * <BR /><B>EXPERIMENTAL</B>
2914     * 
2915     * @param objectId Function object id.
2916     * 
2917     * @param condition 
2918     * Expression to use as a breakpoint condition. When specified, debugger will
2919     * stop on the breakpoint if this expression evaluates to true.
2920     * <BR /><B>OPTIONAL</B>
2921     * 
2922     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2923     * String&gt;</CODE>
2924     * 
2925     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
2926     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
2927     * String&gt;</CODE> will be returned.
2928     *
2929     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
2930     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
2931      * may be retrieved.</I>
2932     *
2933     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
2934     * <BR /><BR /><UL CLASS=JDUL>
2935     * <LI><CODE>String (<B>breakpointId</B></CODE>)
2936     *     <BR />Id of the created breakpoint for further reference.
2937     * </LI>
2938     * </UL> */
2939    public static Script<String, JsonObject, String> setBreakpointOnFunctionCall
2940        (String objectId, String condition)
2941    {
2942        // Exception-Check(s) to ensure that if any parameters which are not declared as
2943        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2944        
2945        if (objectId == null) BRDPC.throwNPE("objectId");
2946        
2947        final int       webSocketID = 2020000 + counter++;
2948        final boolean[] optionals   = { false, true, };
2949        
2950        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2951        String requestJSON = WriteJSON.get(
2952            parameterTypes.get("setBreakpointOnFunctionCall"),
2953            parameterNames.get("setBreakpointOnFunctionCall"),
2954            optionals, webSocketID,
2955            "Debugger.setBreakpointOnFunctionCall",
2956            objectId, condition
2957        );
2958        
2959        // 'JSON Binding' ... Converts Browser Response-JSON to 'String'
2960        Function<JsonObject, String> responseProcessor = (JsonObject jo) ->
2961            ReadJSON.getString(jo, "breakpointId", false, true);
2962        
2963        // Pass the 'defaultSender' to Script-Constructor
2964        // The sender that is used can be changed before executing script.
2965        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2966    }
2967    
2968    /**
2969     * Activates / deactivates all breakpoints on the page.
2970     * 
2971     * @param active New value for breakpoints active state.
2972     * 
2973     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2974     * {@link Ret0}&gt;</CODE>
2975     *
2976     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
2977     * browser receives the invocation-request.
2978     *
2979     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
2980     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
2981     * {@code >} to ensure the Browser Function has run to completion.
2982     */
2983    public static Script<String, JsonObject, Ret0> setBreakpointsActive(boolean active)
2984    {
2985        final int       webSocketID = 2021000 + counter++;
2986        final boolean[] optionals   = { false, };
2987        
2988        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2989        String requestJSON = WriteJSON.get(
2990            parameterTypes.get("setBreakpointsActive"),
2991            parameterNames.get("setBreakpointsActive"),
2992            optionals, webSocketID,
2993            "Debugger.setBreakpointsActive",
2994            active
2995        );
2996        
2997        // This Remote Command does not have a Return-Value.
2998        return new Script<>
2999            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
3000    }
3001    
3002    /**
3003     * Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or
3004     * no exceptions. Initial pause on exceptions state is <CODE>none</CODE>.
3005     * 
3006     * @param state Pause on exceptions mode.
3007     * <BR />Acceptable Values: ["none", "uncaught", "all"]
3008     * 
3009     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3010     * {@link Ret0}&gt;</CODE>
3011     *
3012     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
3013     * browser receives the invocation-request.
3014     *
3015     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
3016     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
3017     * {@code >} to ensure the Browser Function has run to completion.
3018     */
3019    public static Script<String, JsonObject, Ret0> setPauseOnExceptions(String state)
3020    {
3021        // Exception-Check(s) to ensure that if any parameters which are not declared as
3022        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
3023        
3024        if (state == null) BRDPC.throwNPE("state");
3025        
3026        // Exception-Check(s) to ensure that if any parameters which must adhere to a
3027        // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
3028        
3029        BRDPC.checkIAE(
3030            "state", state,
3031            "none", "uncaught", "all"
3032        );
3033        
3034        final int       webSocketID = 2022000 + counter++;
3035        final boolean[] optionals   = { false, };
3036        
3037        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3038        String requestJSON = WriteJSON.get(
3039            parameterTypes.get("setPauseOnExceptions"),
3040            parameterNames.get("setPauseOnExceptions"),
3041            optionals, webSocketID,
3042            "Debugger.setPauseOnExceptions",
3043            state
3044        );
3045        
3046        // This Remote Command does not have a Return-Value.
3047        return new Script<>
3048            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
3049    }
3050    
3051    /**
3052     * Changes return value in top frame. Available only at return break position.
3053     * <BR /><B>EXPERIMENTAL</B>
3054     * 
3055     * @param newValue New return value.
3056     * 
3057     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3058     * {@link Ret0}&gt;</CODE>
3059     *
3060     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
3061     * browser receives the invocation-request.
3062     *
3063     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
3064     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
3065     * {@code >} to ensure the Browser Function has run to completion.
3066     */
3067    public static Script<String, JsonObject, Ret0> setReturnValue(RunTime.CallArgument newValue)
3068    {
3069        // Exception-Check(s) to ensure that if any parameters which are not declared as
3070        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
3071        
3072        if (newValue == null) BRDPC.throwNPE("newValue");
3073        
3074        final int       webSocketID = 2023000 + counter++;
3075        final boolean[] optionals   = { false, };
3076        
3077        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3078        String requestJSON = WriteJSON.get(
3079            parameterTypes.get("setReturnValue"),
3080            parameterNames.get("setReturnValue"),
3081            optionals, webSocketID,
3082            "Debugger.setReturnValue",
3083            newValue
3084        );
3085        
3086        // This Remote Command does not have a Return-Value.
3087        return new Script<>
3088            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
3089    }
3090    
3091    /**
3092     * Edits JavaScript source live.
3093     * 
3094     * @param scriptId Id of the script to edit.
3095     * 
3096     * @param scriptSource New content of the script.
3097     * 
3098     * @param dryRun 
3099     * If true the change will not actually be applied. Dry run may be used to get result
3100     * description without actually modifying the code.
3101     * <BR /><B>OPTIONAL</B>
3102     * 
3103     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3104     * {@link Ret5}&gt;</CODE>
3105     *
3106     * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 
3107     * {@link Script#exec()}), and a {@link Promise} returned.
3108     *
3109     * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B>
3110     * (using {@link Promise#await()}), the {@code Ret5} will subsequently
3111     * be returned from that call.
3112     * 
3113     * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated
3114     * in an instance of <B>{@link Ret5}</B>
3115     *
3116     * <BR /><BR /><UL CLASS=JDUL>
3117     * <LI><CODE><B>Ret5.a:</B> {@link Debugger.CallFrame}[] (<B>callFrames</B>)</CODE>
3118     *     <BR />New stack trace in case editing has happened while VM was stopped.
3119     *     <BR /><BR /></LI>
3120     * <LI><CODE><B>Ret5.b:</B> Boolean (<B>stackChanged</B>)</CODE>
3121     *     <BR />Whether current call stack  was modified after applying the changes.
3122     *     <BR /><BR /></LI>
3123     * <LI><CODE><B>Ret5.c:</B> {@link RunTime.StackTrace} (<B>asyncStackTrace</B>)</CODE>
3124     *     <BR />Async stack trace, if any.
3125     *     <BR /><BR /></LI>
3126     * <LI><CODE><B>Ret5.d:</B> {@link RunTime.StackTraceId} (<B>asyncStackTraceId</B>)</CODE>
3127     *     <BR />Async stack trace, if any.
3128     *     <BR /><BR /></LI>
3129     * <LI><CODE><B>Ret5.e:</B> {@link RunTime.ExceptionDetails} (<B>exceptionDetails</B>)</CODE>
3130     *     <BR />Exception details if any.
3131     *     </LI>
3132     * </UL>
3133     */
3134    public static Script<String, JsonObject, Ret5<Debugger.CallFrame[], Boolean, RunTime.StackTrace, RunTime.StackTraceId, RunTime.ExceptionDetails>> 
3135        setScriptSource(String scriptId, String scriptSource, Boolean dryRun)
3136    {
3137        // Exception-Check(s) to ensure that if any parameters which are not declared as
3138        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
3139        
3140        if (scriptId == null)     BRDPC.throwNPE("scriptId");
3141        if (scriptSource == null) BRDPC.throwNPE("scriptSource");
3142        
3143        final int       webSocketID = 2024000 + counter++;
3144        final boolean[] optionals   = { false, false, true, };
3145        
3146        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3147        String requestJSON = WriteJSON.get(
3148            parameterTypes.get("setScriptSource"),
3149            parameterNames.get("setScriptSource"),
3150            optionals, webSocketID,
3151            "Debugger.setScriptSource",
3152            scriptId, scriptSource, dryRun
3153        );
3154        
3155        // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret5'
3156        Function<JsonObject, Ret5<Debugger.CallFrame[], Boolean, RunTime.StackTrace, RunTime.StackTraceId, RunTime.ExceptionDetails>> 
3157            responseProcessor = (JsonObject jo) -> new Ret5<>(
3158                (jo.getJsonArray("callFrames") == null)
3159                    ? null
3160                    : ReadArrJSON.DimN.objArr(jo.getJsonArray("callFrames"), null, 0, Debugger.CallFrame[].class),
3161                ReadBoxedJSON.getBoolean(jo, "stackChanged", true),
3162                ReadJSON.getObject(jo, "asyncStackTrace", RunTime.StackTrace.class, true, false),
3163                ReadJSON.getObject(jo, "asyncStackTraceId", RunTime.StackTraceId.class, true, false),
3164                ReadJSON.getObject(jo, "exceptionDetails", RunTime.ExceptionDetails.class, true, false)
3165            );
3166        
3167        // Pass the 'defaultSender' to Script-Constructor
3168        // The sender that is used can be changed before executing script.
3169        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
3170    }
3171    
3172    /**
3173     * Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc).
3174     * 
3175     * @param skip New value for skip pauses state.
3176     * 
3177     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3178     * {@link Ret0}&gt;</CODE>
3179     *
3180     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
3181     * browser receives the invocation-request.
3182     *
3183     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
3184     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
3185     * {@code >} to ensure the Browser Function has run to completion.
3186     */
3187    public static Script<String, JsonObject, Ret0> setSkipAllPauses(boolean skip)
3188    {
3189        final int       webSocketID = 2025000 + counter++;
3190        final boolean[] optionals   = { false, };
3191        
3192        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3193        String requestJSON = WriteJSON.get(
3194            parameterTypes.get("setSkipAllPauses"),
3195            parameterNames.get("setSkipAllPauses"),
3196            optionals, webSocketID,
3197            "Debugger.setSkipAllPauses",
3198            skip
3199        );
3200        
3201        // This Remote Command does not have a Return-Value.
3202        return new Script<>
3203            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
3204    }
3205    
3206    /**
3207     * Changes value of variable in a callframe. Object-based scopes are not supported and must be
3208     * mutated manually.
3209     * 
3210     * @param scopeNumber 
3211     * 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch'
3212     * scope types are allowed. Other scopes could be manipulated manually.
3213     * 
3214     * @param variableName Variable name.
3215     * 
3216     * @param newValue New variable value.
3217     * 
3218     * @param callFrameId Id of callframe that holds variable.
3219     * 
3220     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3221     * {@link Ret0}&gt;</CODE>
3222     *
3223     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
3224     * browser receives the invocation-request.
3225     *
3226     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
3227     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
3228     * {@code >} to ensure the Browser Function has run to completion.
3229     */
3230    public static Script<String, JsonObject, Ret0> setVariableValue
3231        (int scopeNumber, String variableName, RunTime.CallArgument newValue, String callFrameId)
3232    {
3233        // Exception-Check(s) to ensure that if any parameters which are not declared as
3234        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
3235        
3236        if (variableName == null) BRDPC.throwNPE("variableName");
3237        if (newValue == null)     BRDPC.throwNPE("newValue");
3238        if (callFrameId == null)  BRDPC.throwNPE("callFrameId");
3239        
3240        final int       webSocketID = 2026000 + counter++;
3241        final boolean[] optionals   = { false, false, false, false, };
3242        
3243        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3244        String requestJSON = WriteJSON.get(
3245            parameterTypes.get("setVariableValue"),
3246            parameterNames.get("setVariableValue"),
3247            optionals, webSocketID,
3248            "Debugger.setVariableValue",
3249            scopeNumber, variableName, newValue, callFrameId
3250        );
3251        
3252        // This Remote Command does not have a Return-Value.
3253        return new Script<>
3254            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
3255    }
3256    
3257    /**
3258     * Steps into the function call.
3259     * 
3260     * @param breakOnAsyncCall 
3261     * Debugger will pause on the execution of the first async task which was scheduled
3262     * before next pause.
3263     * <BR /><B>OPTIONAL</B>
3264     * <BR /><B>EXPERIMENTAL</B>
3265     * 
3266     * @param skipList The skipList specifies location ranges that should be skipped on step into.
3267     * <BR /><B>OPTIONAL</B>
3268     * <BR /><B>EXPERIMENTAL</B>
3269     * 
3270     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3271     * {@link Ret0}&gt;</CODE>
3272     *
3273     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
3274     * browser receives the invocation-request.
3275     *
3276     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
3277     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
3278     * {@code >} to ensure the Browser Function has run to completion.
3279     */
3280    public static Script<String, JsonObject, Ret0> stepInto
3281        (Boolean breakOnAsyncCall, Debugger.LocationRange[] skipList)
3282    {
3283        final int       webSocketID = 2027000 + counter++;
3284        final boolean[] optionals   = { true, true, };
3285        
3286        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3287        String requestJSON = WriteJSON.get(
3288            parameterTypes.get("stepInto"),
3289            parameterNames.get("stepInto"),
3290            optionals, webSocketID,
3291            "Debugger.stepInto",
3292            breakOnAsyncCall, skipList
3293        );
3294        
3295        // This Remote Command does not have a Return-Value.
3296        return new Script<>
3297            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
3298    }
3299    
3300    /**
3301     * Steps out of the function call.
3302     * 
3303     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3304     * {@link Ret0}&gt;</CODE>
3305     *
3306     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
3307     * browser receives the invocation-request.
3308     *
3309     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
3310     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
3311     * {@code >} to ensure the Browser Function has run to completion.
3312     */
3313    public static Script<String, JsonObject, Ret0> stepOut()
3314    {
3315        final int          webSocketID = 2028000 + counter++;
3316        final boolean[]    optionals   = new boolean[0];
3317        
3318        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3319        String requestJSON = WriteJSON.get(
3320            parameterTypes.get("stepOut"),
3321            parameterNames.get("stepOut"),
3322            optionals, webSocketID,
3323            "Debugger.stepOut"
3324        );
3325        
3326        // This Remote Command does not have a Return-Value.
3327        return new Script<>
3328            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
3329    }
3330    
3331    /**
3332     * Steps over the statement.
3333     * 
3334     * @param skipList The skipList specifies location ranges that should be skipped on step over.
3335     * <BR /><B>OPTIONAL</B>
3336     * <BR /><B>EXPERIMENTAL</B>
3337     * 
3338     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3339     * {@link Ret0}&gt;</CODE>
3340     *
3341     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
3342     * browser receives the invocation-request.
3343     *
3344     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
3345     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
3346     * {@code >} to ensure the Browser Function has run to completion.
3347     */
3348    public static Script<String, JsonObject, Ret0> stepOver(Debugger.LocationRange[] skipList)
3349    {
3350        final int       webSocketID = 2029000 + counter++;
3351        final boolean[] optionals   = { true, };
3352        
3353        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3354        String requestJSON = WriteJSON.get(
3355            parameterTypes.get("stepOver"),
3356            parameterNames.get("stepOver"),
3357            optionals, webSocketID,
3358            "Debugger.stepOver",
3359            (Object) skipList
3360        );
3361        
3362        // This Remote Command does not have a Return-Value.
3363        return new Script<>
3364            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
3365    }
3366    
3367}