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