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