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