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.*; 013 014import static Torello.Java.Additional.JFlag.*; 015 016import Torello.Java.StrCmpr; 017import Torello.JavaDoc.StaticFunctional; 018import Torello.JavaDoc.JDHeaderBackgroundImg; 019import Torello.JavaDoc.Excuse; 020 021/** 022 * <SPAN CLASS=CopiedJDK><B>Network domain allows tracking network activities of the page. It exposes information about http, 023 * file, data and other requests and responses, their headers, bodies, timing, etc.</B></SPAN> 024 * 025 * <EMBED CLASS='external-html' DATA-FILE-ID=CODE_GEN_NOTE> 026 */ 027@StaticFunctional(Excused={"counter"}, Excuses={Excuse.CONFIGURATION}) 028@JDHeaderBackgroundImg(EmbedTagFileID="WOOD_PLANK_NOTE") 029public class Network 030{ 031 // ******************************************************************************************** 032 // ******************************************************************************************** 033 // Class Header Stuff 034 // ******************************************************************************************** 035 // ******************************************************************************************** 036 037 038 // No Pubic Constructors 039 private Network () { } 040 041 // These two Vector's are used by all the "Methods" exported by this class. java.lang.reflect 042 // is used to generate the JSON String's. It saves thousands of lines of Auto-Generated Code. 043 private static final Map<String, Vector<String>> parameterNames = new HashMap<>(); 044 private static final Map<String, Vector<Class<?>>> parameterTypes = new HashMap<>(); 045 046 // Some Methods do not take any parameters - for instance all the "enable()" and "disable()" 047 // I simply could not get ride of RAW-TYPES and UNCHECKED warnings... so there are now, 048 // offically, two empty-vectors. One for String's, and the other for Classes. 049 050 private static final Vector<String> EMPTY_VEC_STR = new Vector<>(); 051 private static final Vector<Class<?>> EMPTY_VEC_CLASS = new Vector<>(); 052 053 static 054 { 055 for (Method m : Network.class.getMethods()) 056 { 057 // This doesn't work! The parameter names are all "arg0" ... "argN" 058 // It works for java.lang.reflect.Field, BUT NOT java.lang.reflect.Parameter! 059 // 060 // Vector<String> parameterNamesList = new Vector<>(); -- NOPE! 061 062 Vector<Class<?>> parameterTypesList = new Vector<>(); 063 064 for (Parameter p : m.getParameters()) parameterTypesList.add(p.getType()); 065 066 parameterTypes.put( 067 m.getName(), 068 (parameterTypesList.size() > 0) ? parameterTypesList : EMPTY_VEC_CLASS 069 ); 070 } 071 } 072 073 static 074 { 075 Vector<String> v = null; 076 077 v = new Vector<String>(1); 078 parameterNames.put("setAcceptedEncodings", v); 079 Collections.addAll(v, new String[] 080 { "encodings", }); 081 082 parameterNames.put("clearAcceptedEncodingsOverride", EMPTY_VEC_STR); 083 084 parameterNames.put("canClearBrowserCache", EMPTY_VEC_STR); 085 086 parameterNames.put("canClearBrowserCookies", EMPTY_VEC_STR); 087 088 parameterNames.put("canEmulateNetworkConditions", EMPTY_VEC_STR); 089 090 parameterNames.put("clearBrowserCache", EMPTY_VEC_STR); 091 092 parameterNames.put("clearBrowserCookies", EMPTY_VEC_STR); 093 094 v = new Vector<String>(8); 095 parameterNames.put("continueInterceptedRequest", v); 096 Collections.addAll(v, new String[] 097 { "interceptionId", "errorReason", "rawResponse", "url", "method", "postData", "headers", "authChallengeResponse", }); 098 099 v = new Vector<String>(4); 100 parameterNames.put("deleteCookies", v); 101 Collections.addAll(v, new String[] 102 { "name", "url", "domain", "path", }); 103 104 parameterNames.put("disable", EMPTY_VEC_STR); 105 106 v = new Vector<String>(5); 107 parameterNames.put("emulateNetworkConditions", v); 108 Collections.addAll(v, new String[] 109 { "offline", "latency", "downloadThroughput", "uploadThroughput", "connectionType", }); 110 111 v = new Vector<String>(3); 112 parameterNames.put("enable", v); 113 Collections.addAll(v, new String[] 114 { "maxTotalBufferSize", "maxResourceBufferSize", "maxPostDataSize", }); 115 116 parameterNames.put("getAllCookies", EMPTY_VEC_STR); 117 118 v = new Vector<String>(1); 119 parameterNames.put("getCertificate", v); 120 Collections.addAll(v, new String[] 121 { "origin", }); 122 123 v = new Vector<String>(1); 124 parameterNames.put("getCookies", v); 125 Collections.addAll(v, new String[] 126 { "urls", }); 127 128 v = new Vector<String>(1); 129 parameterNames.put("getResponseBody", v); 130 Collections.addAll(v, new String[] 131 { "requestId", }); 132 133 v = new Vector<String>(1); 134 parameterNames.put("getRequestPostData", v); 135 Collections.addAll(v, new String[] 136 { "requestId", }); 137 138 v = new Vector<String>(1); 139 parameterNames.put("getResponseBodyForInterception", v); 140 Collections.addAll(v, new String[] 141 { "interceptionId", }); 142 143 v = new Vector<String>(1); 144 parameterNames.put("takeResponseBodyForInterceptionAsStream", v); 145 Collections.addAll(v, new String[] 146 { "interceptionId", }); 147 148 v = new Vector<String>(1); 149 parameterNames.put("replayXHR", v); 150 Collections.addAll(v, new String[] 151 { "requestId", }); 152 153 v = new Vector<String>(4); 154 parameterNames.put("searchInResponseBody", v); 155 Collections.addAll(v, new String[] 156 { "requestId", "query", "caseSensitive", "isRegex", }); 157 158 v = new Vector<String>(1); 159 parameterNames.put("setBlockedURLs", v); 160 Collections.addAll(v, new String[] 161 { "urls", }); 162 163 v = new Vector<String>(1); 164 parameterNames.put("setBypassServiceWorker", v); 165 Collections.addAll(v, new String[] 166 { "bypass", }); 167 168 v = new Vector<String>(1); 169 parameterNames.put("setCacheDisabled", v); 170 Collections.addAll(v, new String[] 171 { "cacheDisabled", }); 172 173 v = new Vector<String>(13); 174 parameterNames.put("setCookie", v); 175 Collections.addAll(v, new String[] 176 { "name", "value", "url", "domain", "path", "secure", "httpOnly", "sameSite", "expires", "priority", "sameParty", "sourceScheme", "sourcePort", }); 177 178 v = new Vector<String>(1); 179 parameterNames.put("setCookies", v); 180 Collections.addAll(v, new String[] 181 { "cookies", }); 182 183 v = new Vector<String>(1); 184 parameterNames.put("setExtraHTTPHeaders", v); 185 Collections.addAll(v, new String[] 186 { "headers", }); 187 188 v = new Vector<String>(1); 189 parameterNames.put("setAttachDebugStack", v); 190 Collections.addAll(v, new String[] 191 { "enabled", }); 192 193 v = new Vector<String>(1); 194 parameterNames.put("setRequestInterception", v); 195 Collections.addAll(v, new String[] 196 { "patterns", }); 197 198 v = new Vector<String>(4); 199 parameterNames.put("setUserAgentOverride", v); 200 Collections.addAll(v, new String[] 201 { "userAgent", "acceptLanguage", "platform", "userAgentMetadata", }); 202 203 v = new Vector<String>(1); 204 parameterNames.put("getSecurityIsolationStatus", v); 205 Collections.addAll(v, new String[] 206 { "frameId", }); 207 208 v = new Vector<String>(1); 209 parameterNames.put("enableReportingApi", v); 210 Collections.addAll(v, new String[] 211 { "enable", }); 212 213 v = new Vector<String>(3); 214 parameterNames.put("loadNetworkResource", v); 215 Collections.addAll(v, new String[] 216 { "frameId", "url", "options", }); 217 } 218 219 220 // ******************************************************************************************** 221 // ******************************************************************************************** 222 // Types - Static Inner Classes 223 // ******************************************************************************************** 224 // ******************************************************************************************** 225 226 // public static class LoaderId => String 227 228 // public static class RequestId => String 229 230 // public static class InterceptionId => String 231 232 // public static class TimeSinceEpoch => Number 233 234 // public static class MonotonicTime => Number 235 236 // public static class Headers => JsonObject 237 238 // public static class ReportId => String 239 240 /** Resource type as it was perceived by the rendering engine. */ 241 public static final String[] ResourceType = 242 { 243 "Document", "Stylesheet", "Image", "Media", "Font", "Script", "TextTrack", "XHR", "Fetch", 244 "EventSource", "WebSocket", "Manifest", "SignedExchange", "Ping", "CSPViolationReport", 245 "Preflight", "Other", 246 }; 247 248 /** Network level fetch failure reason. */ 249 public static final String[] ErrorReason = 250 { 251 "Failed", "Aborted", "TimedOut", "AccessDenied", "ConnectionClosed", "ConnectionReset", 252 "ConnectionRefused", "ConnectionAborted", "ConnectionFailed", "NameNotResolved", 253 "InternetDisconnected", "AddressUnreachable", "BlockedByClient", "BlockedByResponse", 254 }; 255 256 /** The underlying connection technology that the browser is supposedly using. */ 257 public static final String[] ConnectionType = 258 { 259 "none", "cellular2g", "cellular3g", "cellular4g", "bluetooth", "ethernet", "wifi", "wimax", 260 "other", 261 }; 262 263 /** 264 * Represents the cookie's 'SameSite' status: 265 * https://tools.ietf.org/html/draft-west-first-party-cookies 266 */ 267 public static final String[] CookieSameSite = 268 { "Strict", "Lax", "None", }; 269 270 /** 271 * Represents the cookie's 'Priority' status: 272 * https://tools.ietf.org/html/draft-west-cookie-priority-00 273 * <BR /> 274 * <BR /><B>EXPERIMENTAL</B> 275 */ 276 public static final String[] CookiePriority = 277 { "Low", "Medium", "High", }; 278 279 /** 280 * Represents the source scheme of the origin that originally set the cookie. 281 * A value of "Unset" allows protocol clients to emulate legacy cookie scope for the scheme. 282 * This is a temporary ability and it will be removed in the future. 283 * <BR /> 284 * <BR /><B>EXPERIMENTAL</B> 285 */ 286 public static final String[] CookieSourceScheme = 287 { "Unset", "NonSecure", "Secure", }; 288 289 /** Loading priority of a resource request. */ 290 public static final String[] ResourcePriority = 291 { "VeryLow", "Low", "Medium", "High", "VeryHigh", }; 292 293 /** Whether the request complied with Certificate Transparency policy. */ 294 public static final String[] CertificateTransparencyCompliance = 295 { "unknown", "not-compliant", "compliant", }; 296 297 /** The reason why request was blocked. */ 298 public static final String[] BlockedReason = 299 { 300 "other", "csp", "mixed-content", "origin", "inspector", "subresource-filter", 301 "content-type", "coep-frame-resource-needs-coep-header", 302 "coop-sandboxed-iframe-cannot-navigate-to-coop-page", "corp-not-same-origin", 303 "corp-not-same-origin-after-defaulted-to-same-origin-by-coep", "corp-not-same-site", 304 }; 305 306 /** The reason why request was blocked. */ 307 public static final String[] CorsError = 308 { 309 "DisallowedByMode", "InvalidResponse", "WildcardOriginNotAllowed", 310 "MissingAllowOriginHeader", "MultipleAllowOriginValues", "InvalidAllowOriginValue", 311 "AllowOriginMismatch", "InvalidAllowCredentials", "CorsDisabledScheme", 312 "PreflightInvalidStatus", "PreflightDisallowedRedirect", 313 "PreflightWildcardOriginNotAllowed", "PreflightMissingAllowOriginHeader", 314 "PreflightMultipleAllowOriginValues", "PreflightInvalidAllowOriginValue", 315 "PreflightAllowOriginMismatch", "PreflightInvalidAllowCredentials", 316 "PreflightMissingAllowExternal", "PreflightInvalidAllowExternal", 317 "InvalidAllowMethodsPreflightResponse", "InvalidAllowHeadersPreflightResponse", 318 "MethodDisallowedByPreflightResponse", "HeaderDisallowedByPreflightResponse", 319 "RedirectContainsCredentials", "InsecurePrivateNetwork", "InvalidPrivateNetworkAccess", 320 "UnexpectedPrivateNetworkAccess", "NoCorsRedirectModeNotFollow", 321 }; 322 323 /** Source of serviceworker response. */ 324 public static final String[] ServiceWorkerResponseSource = 325 { "cache-storage", "http-cache", "fallback-code", "network", }; 326 327 /** 328 * <CODE>[No Description Provided by Google]</CODE> 329 * <BR /> 330 * <BR /><B>EXPERIMENTAL</B> 331 */ 332 public static final String[] TrustTokenOperationType = 333 { "Issuance", "Redemption", "Signing", }; 334 335 /** 336 * Types of reasons why a cookie may not be stored from a response. 337 * <BR /> 338 * <BR /><B>EXPERIMENTAL</B> 339 */ 340 public static final String[] SetCookieBlockedReason = 341 { 342 "SecureOnly", "SameSiteStrict", "SameSiteLax", "SameSiteUnspecifiedTreatedAsLax", 343 "SameSiteNoneInsecure", "UserPreferences", "SyntaxError", "SchemeNotSupported", 344 "OverwriteSecure", "InvalidDomain", "InvalidPrefix", "UnknownError", 345 "SchemefulSameSiteStrict", "SchemefulSameSiteLax", 346 "SchemefulSameSiteUnspecifiedTreatedAsLax", "SamePartyFromCrossPartyContext", 347 "SamePartyConflictsWithOtherAttributes", "NameValuePairExceedsMaxSize", 348 }; 349 350 /** 351 * Types of reasons why a cookie may not be sent with a request. 352 * <BR /> 353 * <BR /><B>EXPERIMENTAL</B> 354 */ 355 public static final String[] CookieBlockedReason = 356 { 357 "SecureOnly", "NotOnPath", "DomainMismatch", "SameSiteStrict", "SameSiteLax", 358 "SameSiteUnspecifiedTreatedAsLax", "SameSiteNoneInsecure", "UserPreferences", 359 "UnknownError", "SchemefulSameSiteStrict", "SchemefulSameSiteLax", 360 "SchemefulSameSiteUnspecifiedTreatedAsLax", "SamePartyFromCrossPartyContext", 361 "NameValuePairExceedsMaxSize", 362 }; 363 364 /** 365 * Stages of the interception to begin intercepting. Request will intercept before the request is 366 * sent. Response will intercept after the response is received. 367 * <BR /> 368 * <BR /><B>EXPERIMENTAL</B> 369 */ 370 public static final String[] InterceptionStage = 371 { "Request", "HeadersReceived", }; 372 373 /** 374 * Field type for a signed exchange related error. 375 * <BR /> 376 * <BR /><B>EXPERIMENTAL</B> 377 */ 378 public static final String[] SignedExchangeErrorField = 379 { 380 "signatureSig", "signatureIntegrity", "signatureCertUrl", "signatureCertSha256", 381 "signatureValidityUrl", "signatureTimestamps", 382 }; 383 384 /** 385 * List of content encodings supported by the backend. 386 * <BR /> 387 * <BR /><B>EXPERIMENTAL</B> 388 */ 389 public static final String[] ContentEncoding = 390 { "deflate", "gzip", "br", }; 391 392 /** 393 * <CODE>[No Description Provided by Google]</CODE> 394 * <BR /> 395 * <BR /><B>EXPERIMENTAL</B> 396 */ 397 public static final String[] PrivateNetworkRequestPolicy = 398 { 399 "Allow", "BlockFromInsecureToMorePrivate", "WarnFromInsecureToMorePrivate", 400 "PreflightBlock", "PreflightWarn", 401 }; 402 403 /** 404 * <CODE>[No Description Provided by Google]</CODE> 405 * <BR /> 406 * <BR /><B>EXPERIMENTAL</B> 407 */ 408 public static final String[] IPAddressSpace = 409 { "Local", "Private", "Public", "Unknown", }; 410 411 /** 412 * <CODE>[No Description Provided by Google]</CODE> 413 * <BR /> 414 * <BR /><B>EXPERIMENTAL</B> 415 */ 416 public static final String[] CrossOriginOpenerPolicyValue = 417 { "SameOrigin", "SameOriginAllowPopups", "UnsafeNone", "SameOriginPlusCoep", }; 418 419 /** 420 * <CODE>[No Description Provided by Google]</CODE> 421 * <BR /> 422 * <BR /><B>EXPERIMENTAL</B> 423 */ 424 public static final String[] CrossOriginEmbedderPolicyValue = 425 { "None", "Credentialless", "RequireCorp", }; 426 427 /** 428 * The status of a Reporting API report. 429 * <BR /> 430 * <BR /><B>EXPERIMENTAL</B> 431 */ 432 public static final String[] ReportStatus = 433 { "Queued", "Pending", "MarkedForRemoval", "Success", }; 434 435 /** Timing information for the request. */ 436 public static class ResourceTiming extends BaseType 437 { 438 /** For Object Serialization. java.io.Serializable */ 439 protected static final long serialVersionUID = 1; 440 441 public boolean[] optionals() 442 { return new boolean[] { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, }; } 443 444 /** 445 * Timing's requestTime is a baseline in seconds, while the other numbers are ticks in 446 * milliseconds relatively to this requestTime. 447 */ 448 public final Number requestTime; 449 450 /** Started resolving proxy. */ 451 public final Number proxyStart; 452 453 /** Finished resolving proxy. */ 454 public final Number proxyEnd; 455 456 /** Started DNS address resolve. */ 457 public final Number dnsStart; 458 459 /** Finished DNS address resolve. */ 460 public final Number dnsEnd; 461 462 /** Started connecting to the remote host. */ 463 public final Number connectStart; 464 465 /** Connected to the remote host. */ 466 public final Number connectEnd; 467 468 /** Started SSL handshake. */ 469 public final Number sslStart; 470 471 /** Finished SSL handshake. */ 472 public final Number sslEnd; 473 474 /** 475 * Started running ServiceWorker. 476 * <BR /> 477 * <BR /><B>EXPERIMENTAL</B> 478 */ 479 public final Number workerStart; 480 481 /** 482 * Finished Starting ServiceWorker. 483 * <BR /> 484 * <BR /><B>EXPERIMENTAL</B> 485 */ 486 public final Number workerReady; 487 488 /** 489 * Started fetch event. 490 * <BR /> 491 * <BR /><B>EXPERIMENTAL</B> 492 */ 493 public final Number workerFetchStart; 494 495 /** 496 * Settled fetch event respondWith promise. 497 * <BR /> 498 * <BR /><B>EXPERIMENTAL</B> 499 */ 500 public final Number workerRespondWithSettled; 501 502 /** Started sending request. */ 503 public final Number sendStart; 504 505 /** Finished sending request. */ 506 public final Number sendEnd; 507 508 /** 509 * Time the server started pushing request. 510 * <BR /> 511 * <BR /><B>EXPERIMENTAL</B> 512 */ 513 public final Number pushStart; 514 515 /** 516 * Time the server finished pushing request. 517 * <BR /> 518 * <BR /><B>EXPERIMENTAL</B> 519 */ 520 public final Number pushEnd; 521 522 /** Finished receiving response headers. */ 523 public final Number receiveHeadersEnd; 524 525 /** 526 * Constructor 527 * 528 * @param requestTime 529 * Timing's requestTime is a baseline in seconds, while the other numbers are ticks in 530 * milliseconds relatively to this requestTime. 531 * 532 * @param proxyStart Started resolving proxy. 533 * 534 * @param proxyEnd Finished resolving proxy. 535 * 536 * @param dnsStart Started DNS address resolve. 537 * 538 * @param dnsEnd Finished DNS address resolve. 539 * 540 * @param connectStart Started connecting to the remote host. 541 * 542 * @param connectEnd Connected to the remote host. 543 * 544 * @param sslStart Started SSL handshake. 545 * 546 * @param sslEnd Finished SSL handshake. 547 * 548 * @param workerStart Started running ServiceWorker. 549 * <BR /><B>EXPERIMENTAL</B> 550 * 551 * @param workerReady Finished Starting ServiceWorker. 552 * <BR /><B>EXPERIMENTAL</B> 553 * 554 * @param workerFetchStart Started fetch event. 555 * <BR /><B>EXPERIMENTAL</B> 556 * 557 * @param workerRespondWithSettled Settled fetch event respondWith promise. 558 * <BR /><B>EXPERIMENTAL</B> 559 * 560 * @param sendStart Started sending request. 561 * 562 * @param sendEnd Finished sending request. 563 * 564 * @param pushStart Time the server started pushing request. 565 * <BR /><B>EXPERIMENTAL</B> 566 * 567 * @param pushEnd Time the server finished pushing request. 568 * <BR /><B>EXPERIMENTAL</B> 569 * 570 * @param receiveHeadersEnd Finished receiving response headers. 571 */ 572 public ResourceTiming( 573 Number requestTime, Number proxyStart, Number proxyEnd, Number dnsStart, 574 Number dnsEnd, Number connectStart, Number connectEnd, Number sslStart, 575 Number sslEnd, Number workerStart, Number workerReady, Number workerFetchStart, 576 Number workerRespondWithSettled, Number sendStart, Number sendEnd, Number pushStart, 577 Number pushEnd, Number receiveHeadersEnd 578 ) 579 { 580 // Exception-Check(s) to ensure that if any parameters which are not declared as 581 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 582 583 if (requestTime == null) BRDPC.throwNPE("requestTime"); 584 if (proxyStart == null) BRDPC.throwNPE("proxyStart"); 585 if (proxyEnd == null) BRDPC.throwNPE("proxyEnd"); 586 if (dnsStart == null) BRDPC.throwNPE("dnsStart"); 587 if (dnsEnd == null) BRDPC.throwNPE("dnsEnd"); 588 if (connectStart == null) BRDPC.throwNPE("connectStart"); 589 if (connectEnd == null) BRDPC.throwNPE("connectEnd"); 590 if (sslStart == null) BRDPC.throwNPE("sslStart"); 591 if (sslEnd == null) BRDPC.throwNPE("sslEnd"); 592 if (workerStart == null) BRDPC.throwNPE("workerStart"); 593 if (workerReady == null) BRDPC.throwNPE("workerReady"); 594 if (workerFetchStart == null) BRDPC.throwNPE("workerFetchStart"); 595 if (workerRespondWithSettled == null) BRDPC.throwNPE("workerRespondWithSettled"); 596 if (sendStart == null) BRDPC.throwNPE("sendStart"); 597 if (sendEnd == null) BRDPC.throwNPE("sendEnd"); 598 if (pushStart == null) BRDPC.throwNPE("pushStart"); 599 if (pushEnd == null) BRDPC.throwNPE("pushEnd"); 600 if (receiveHeadersEnd == null) BRDPC.throwNPE("receiveHeadersEnd"); 601 602 this.requestTime = requestTime; 603 this.proxyStart = proxyStart; 604 this.proxyEnd = proxyEnd; 605 this.dnsStart = dnsStart; 606 this.dnsEnd = dnsEnd; 607 this.connectStart = connectStart; 608 this.connectEnd = connectEnd; 609 this.sslStart = sslStart; 610 this.sslEnd = sslEnd; 611 this.workerStart = workerStart; 612 this.workerReady = workerReady; 613 this.workerFetchStart = workerFetchStart; 614 this.workerRespondWithSettled = workerRespondWithSettled; 615 this.sendStart = sendStart; 616 this.sendEnd = sendEnd; 617 this.pushStart = pushStart; 618 this.pushEnd = pushEnd; 619 this.receiveHeadersEnd = receiveHeadersEnd; 620 } 621 622 /** 623 * JSON Object Constructor 624 * @param jo A Json-Object having data about an instance of {@code 'ResourceTiming'}. 625 */ 626 public ResourceTiming (JsonObject jo) 627 { 628 this.requestTime = ReadJSON.getNUMBER(jo, "requestTime", false, true); 629 this.proxyStart = ReadJSON.getNUMBER(jo, "proxyStart", false, true); 630 this.proxyEnd = ReadJSON.getNUMBER(jo, "proxyEnd", false, true); 631 this.dnsStart = ReadJSON.getNUMBER(jo, "dnsStart", false, true); 632 this.dnsEnd = ReadJSON.getNUMBER(jo, "dnsEnd", false, true); 633 this.connectStart = ReadJSON.getNUMBER(jo, "connectStart", false, true); 634 this.connectEnd = ReadJSON.getNUMBER(jo, "connectEnd", false, true); 635 this.sslStart = ReadJSON.getNUMBER(jo, "sslStart", false, true); 636 this.sslEnd = ReadJSON.getNUMBER(jo, "sslEnd", false, true); 637 this.workerStart = ReadJSON.getNUMBER(jo, "workerStart", false, true); 638 this.workerReady = ReadJSON.getNUMBER(jo, "workerReady", false, true); 639 this.workerFetchStart = ReadJSON.getNUMBER(jo, "workerFetchStart", false, true); 640 this.workerRespondWithSettled = ReadJSON.getNUMBER(jo, "workerRespondWithSettled", false, true); 641 this.sendStart = ReadJSON.getNUMBER(jo, "sendStart", false, true); 642 this.sendEnd = ReadJSON.getNUMBER(jo, "sendEnd", false, true); 643 this.pushStart = ReadJSON.getNUMBER(jo, "pushStart", false, true); 644 this.pushEnd = ReadJSON.getNUMBER(jo, "pushEnd", false, true); 645 this.receiveHeadersEnd = ReadJSON.getNUMBER(jo, "receiveHeadersEnd", false, true); 646 } 647 648 } 649 650 /** Post data entry for HTTP request */ 651 public static class PostDataEntry extends BaseType 652 { 653 /** For Object Serialization. java.io.Serializable */ 654 protected static final long serialVersionUID = 1; 655 656 public boolean[] optionals() 657 { return new boolean[] { true, }; } 658 659 /** 660 * <CODE>[No Description Provided by Google]</CODE> 661 * <BR /> 662 * <BR /><B>OPTIONAL</B> 663 */ 664 public final String bytes; 665 666 /** 667 * Constructor 668 * 669 * @param bytes - 670 * <BR /><B>OPTIONAL</B> 671 */ 672 public PostDataEntry(String bytes) 673 { 674 this.bytes = bytes; 675 } 676 677 /** 678 * JSON Object Constructor 679 * @param jo A Json-Object having data about an instance of {@code 'PostDataEntry'}. 680 */ 681 public PostDataEntry (JsonObject jo) 682 { 683 this.bytes = ReadJSON.getString(jo, "bytes", true, false); 684 } 685 686 } 687 688 /** HTTP request data. */ 689 public static class Request extends BaseType 690 { 691 /** For Object Serialization. java.io.Serializable */ 692 protected static final long serialVersionUID = 1; 693 694 public boolean[] optionals() 695 { return new boolean[] { false, true, false, false, true, true, true, true, false, false, true, true, true, }; } 696 697 /** Request URL (without fragment). */ 698 public final String url; 699 700 /** 701 * Fragment of the requested URL starting with hash, if present. 702 * <BR /> 703 * <BR /><B>OPTIONAL</B> 704 */ 705 public final String urlFragment; 706 707 /** HTTP request method. */ 708 public final String method; 709 710 /** HTTP request headers. */ 711 public final JsonObject headers; 712 713 /** 714 * HTTP POST request data. 715 * <BR /> 716 * <BR /><B>OPTIONAL</B> 717 */ 718 public final String postData; 719 720 /** 721 * True when the request has POST data. Note that postData might still be omitted when this flag is true when the data is too long. 722 * <BR /> 723 * <BR /><B>OPTIONAL</B> 724 */ 725 public final Boolean hasPostData; 726 727 /** 728 * Request body elements. This will be converted from base64 to binary 729 * <BR /> 730 * <BR /><B>OPTIONAL</B> 731 * <BR /><B>EXPERIMENTAL</B> 732 */ 733 public final Network.PostDataEntry[] postDataEntries; 734 735 /** 736 * The mixed content type of the request. 737 * <BR /> 738 * <BR /><B>OPTIONAL</B> 739 */ 740 public final String mixedContentType; 741 742 /** Priority of the resource request at the time request is sent. */ 743 public final String initialPriority; 744 745 /** The referrer policy of the request, as defined in https://www.w3.org/TR/referrer-policy/ */ 746 public final String referrerPolicy; 747 748 /** 749 * Whether is loaded via link preload. 750 * <BR /> 751 * <BR /><B>OPTIONAL</B> 752 */ 753 public final Boolean isLinkPreload; 754 755 /** 756 * Set for requests when the TrustToken API is used. Contains the parameters 757 * passed by the developer (e.g. via "fetch") as understood by the backend. 758 * <BR /> 759 * <BR /><B>OPTIONAL</B> 760 * <BR /><B>EXPERIMENTAL</B> 761 */ 762 public final Network.TrustTokenParams trustTokenParams; 763 764 /** 765 * True if this resource request is considered to be the 'same site' as the 766 * request correspondinfg to the main frame. 767 * <BR /> 768 * <BR /><B>OPTIONAL</B> 769 * <BR /><B>EXPERIMENTAL</B> 770 */ 771 public final Boolean isSameSite; 772 773 /** 774 * Constructor 775 * 776 * @param url Request URL (without fragment). 777 * 778 * @param urlFragment Fragment of the requested URL starting with hash, if present. 779 * <BR /><B>OPTIONAL</B> 780 * 781 * @param method HTTP request method. 782 * 783 * @param headers HTTP request headers. 784 * 785 * @param postData HTTP POST request data. 786 * <BR /><B>OPTIONAL</B> 787 * 788 * @param hasPostData True when the request has POST data. Note that postData might still be omitted when this flag is true when the data is too long. 789 * <BR /><B>OPTIONAL</B> 790 * 791 * @param postDataEntries Request body elements. This will be converted from base64 to binary 792 * <BR /><B>OPTIONAL</B> 793 * <BR /><B>EXPERIMENTAL</B> 794 * 795 * @param mixedContentType The mixed content type of the request. 796 * <BR /><B>OPTIONAL</B> 797 * 798 * @param initialPriority Priority of the resource request at the time request is sent. 799 * 800 * @param referrerPolicy The referrer policy of the request, as defined in https://www.w3.org/TR/referrer-policy/ 801 * <BR />Acceptable Values: ["unsafe-url", "no-referrer-when-downgrade", "no-referrer", "origin", "origin-when-cross-origin", "same-origin", "strict-origin", "strict-origin-when-cross-origin"] 802 * 803 * @param isLinkPreload Whether is loaded via link preload. 804 * <BR /><B>OPTIONAL</B> 805 * 806 * @param trustTokenParams 807 * Set for requests when the TrustToken API is used. Contains the parameters 808 * passed by the developer (e.g. via "fetch") as understood by the backend. 809 * <BR /><B>OPTIONAL</B> 810 * <BR /><B>EXPERIMENTAL</B> 811 * 812 * @param isSameSite 813 * True if this resource request is considered to be the 'same site' as the 814 * request correspondinfg to the main frame. 815 * <BR /><B>OPTIONAL</B> 816 * <BR /><B>EXPERIMENTAL</B> 817 */ 818 public Request( 819 String url, String urlFragment, String method, JsonObject headers, String postData, 820 Boolean hasPostData, Network.PostDataEntry[] postDataEntries, 821 String mixedContentType, String initialPriority, String referrerPolicy, 822 Boolean isLinkPreload, Network.TrustTokenParams trustTokenParams, Boolean isSameSite 823 ) 824 { 825 // Exception-Check(s) to ensure that if any parameters which are not declared as 826 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 827 828 if (url == null) BRDPC.throwNPE("url"); 829 if (method == null) BRDPC.throwNPE("method"); 830 if (headers == null) BRDPC.throwNPE("headers"); 831 if (initialPriority == null) BRDPC.throwNPE("initialPriority"); 832 if (referrerPolicy == null) BRDPC.throwNPE("referrerPolicy"); 833 834 // Exception-Check(s) to ensure that if any parameters which must adhere to a 835 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 836 837 BRDPC.checkIAE("mixedContentType", mixedContentType, "Security.MixedContentType", Security.MixedContentType); 838 BRDPC.checkIAE("initialPriority", initialPriority, "Network.ResourcePriority", Network.ResourcePriority); 839 BRDPC.checkIAE( 840 "referrerPolicy", referrerPolicy, 841 "unsafe-url", "no-referrer-when-downgrade", "no-referrer", "origin", "origin-when-cross-origin", "same-origin", "strict-origin", "strict-origin-when-cross-origin" 842 ); 843 844 this.url = url; 845 this.urlFragment = urlFragment; 846 this.method = method; 847 this.headers = headers; 848 this.postData = postData; 849 this.hasPostData = hasPostData; 850 this.postDataEntries = postDataEntries; 851 this.mixedContentType = mixedContentType; 852 this.initialPriority = initialPriority; 853 this.referrerPolicy = referrerPolicy; 854 this.isLinkPreload = isLinkPreload; 855 this.trustTokenParams = trustTokenParams; 856 this.isSameSite = isSameSite; 857 } 858 859 /** 860 * JSON Object Constructor 861 * @param jo A Json-Object having data about an instance of {@code 'Request'}. 862 */ 863 public Request (JsonObject jo) 864 { 865 this.url = ReadJSON.getString(jo, "url", false, true); 866 this.urlFragment = ReadJSON.getString(jo, "urlFragment", true, false); 867 this.method = ReadJSON.getString(jo, "method", false, true); 868 this.headers = jo.getJsonObject("headers"); 869 this.postData = ReadJSON.getString(jo, "postData", true, false); 870 this.hasPostData = ReadJSON.getBOOLEAN(jo, "hasPostData", true); 871 this.postDataEntries = (jo.getJsonArray("postDataEntries") == null) 872 ? null 873 : ReadArrJSON.DimN.objArr(jo.getJsonArray("postDataEntries"), null, 0, Network.PostDataEntry[].class); 874 this.mixedContentType = ReadJSON.getString(jo, "mixedContentType", true, false); 875 this.initialPriority = ReadJSON.getString(jo, "initialPriority", false, true); 876 this.referrerPolicy = ReadJSON.getString(jo, "referrerPolicy", false, true); 877 this.isLinkPreload = ReadJSON.getBOOLEAN(jo, "isLinkPreload", true); 878 this.trustTokenParams = ReadJSON.XL.getObject(jo, "trustTokenParams", Network.TrustTokenParams.class, true, false); 879 this.isSameSite = ReadJSON.getBOOLEAN(jo, "isSameSite", true); 880 } 881 882 } 883 884 /** Details of a signed certificate timestamp (SCT). */ 885 public static class SignedCertificateTimestamp extends BaseType 886 { 887 /** For Object Serialization. java.io.Serializable */ 888 protected static final long serialVersionUID = 1; 889 890 public boolean[] optionals() 891 { return new boolean[] { false, false, false, false, false, false, false, false, }; } 892 893 /** Validation status. */ 894 public final String status; 895 896 /** Origin. */ 897 public final String origin; 898 899 /** Log name / description. */ 900 public final String logDescription; 901 902 /** Log ID. */ 903 public final String logId; 904 905 /** Issuance date. */ 906 public final Number timestamp; 907 908 /** Hash algorithm. */ 909 public final String hashAlgorithm; 910 911 /** Signature algorithm. */ 912 public final String signatureAlgorithm; 913 914 /** Signature data. */ 915 public final String signatureData; 916 917 /** 918 * Constructor 919 * 920 * @param status Validation status. 921 * 922 * @param origin Origin. 923 * 924 * @param logDescription Log name / description. 925 * 926 * @param logId Log ID. 927 * 928 * @param timestamp Issuance date. 929 * 930 * @param hashAlgorithm Hash algorithm. 931 * 932 * @param signatureAlgorithm Signature algorithm. 933 * 934 * @param signatureData Signature data. 935 */ 936 public SignedCertificateTimestamp( 937 String status, String origin, String logDescription, String logId, Number timestamp, 938 String hashAlgorithm, String signatureAlgorithm, String signatureData 939 ) 940 { 941 // Exception-Check(s) to ensure that if any parameters which are not declared as 942 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 943 944 if (status == null) BRDPC.throwNPE("status"); 945 if (origin == null) BRDPC.throwNPE("origin"); 946 if (logDescription == null) BRDPC.throwNPE("logDescription"); 947 if (logId == null) BRDPC.throwNPE("logId"); 948 if (timestamp == null) BRDPC.throwNPE("timestamp"); 949 if (hashAlgorithm == null) BRDPC.throwNPE("hashAlgorithm"); 950 if (signatureAlgorithm == null) BRDPC.throwNPE("signatureAlgorithm"); 951 if (signatureData == null) BRDPC.throwNPE("signatureData"); 952 953 this.status = status; 954 this.origin = origin; 955 this.logDescription = logDescription; 956 this.logId = logId; 957 this.timestamp = timestamp; 958 this.hashAlgorithm = hashAlgorithm; 959 this.signatureAlgorithm = signatureAlgorithm; 960 this.signatureData = signatureData; 961 } 962 963 /** 964 * JSON Object Constructor 965 * @param jo A Json-Object having data about an instance of {@code 'SignedCertificateTimestamp'}. 966 */ 967 public SignedCertificateTimestamp (JsonObject jo) 968 { 969 this.status = ReadJSON.getString(jo, "status", false, true); 970 this.origin = ReadJSON.getString(jo, "origin", false, true); 971 this.logDescription = ReadJSON.getString(jo, "logDescription", false, true); 972 this.logId = ReadJSON.getString(jo, "logId", false, true); 973 this.timestamp = ReadJSON.getNUMBER(jo, "timestamp", false, true); 974 this.hashAlgorithm = ReadJSON.getString(jo, "hashAlgorithm", false, true); 975 this.signatureAlgorithm = ReadJSON.getString(jo, "signatureAlgorithm", false, true); 976 this.signatureData = ReadJSON.getString(jo, "signatureData", false, true); 977 } 978 979 } 980 981 /** Security details about a request. */ 982 public static class SecurityDetails extends BaseType 983 { 984 /** For Object Serialization. java.io.Serializable */ 985 protected static final long serialVersionUID = 1; 986 987 public boolean[] optionals() 988 { return new boolean[] { false, false, true, false, true, false, false, false, false, false, false, false, false, }; } 989 990 /** Protocol name (e.g. "TLS 1.2" or "QUIC"). */ 991 public final String protocol; 992 993 /** Key Exchange used by the connection, or the empty string if not applicable. */ 994 public final String keyExchange; 995 996 /** 997 * (EC)DH group used by the connection, if applicable. 998 * <BR /> 999 * <BR /><B>OPTIONAL</B> 1000 */ 1001 public final String keyExchangeGroup; 1002 1003 /** Cipher name. */ 1004 public final String cipher; 1005 1006 /** 1007 * TLS MAC. Note that AEAD ciphers do not have separate MACs. 1008 * <BR /> 1009 * <BR /><B>OPTIONAL</B> 1010 */ 1011 public final String mac; 1012 1013 /** Certificate ID value. */ 1014 public final int certificateId; 1015 1016 /** Certificate subject name. */ 1017 public final String subjectName; 1018 1019 /** Subject Alternative Name (SAN) DNS names and IP addresses. */ 1020 public final String[] sanList; 1021 1022 /** Name of the issuing CA. */ 1023 public final String issuer; 1024 1025 /** Certificate valid from date. */ 1026 public final Number validFrom; 1027 1028 /** Certificate valid to (expiration) date */ 1029 public final Number validTo; 1030 1031 /** List of signed certificate timestamps (SCTs). */ 1032 public final Network.SignedCertificateTimestamp[] signedCertificateTimestampList; 1033 1034 /** Whether the request complied with Certificate Transparency policy */ 1035 public final String certificateTransparencyCompliance; 1036 1037 /** 1038 * Constructor 1039 * 1040 * @param protocol Protocol name (e.g. "TLS 1.2" or "QUIC"). 1041 * 1042 * @param keyExchange Key Exchange used by the connection, or the empty string if not applicable. 1043 * 1044 * @param keyExchangeGroup (EC)DH group used by the connection, if applicable. 1045 * <BR /><B>OPTIONAL</B> 1046 * 1047 * @param cipher Cipher name. 1048 * 1049 * @param mac TLS MAC. Note that AEAD ciphers do not have separate MACs. 1050 * <BR /><B>OPTIONAL</B> 1051 * 1052 * @param certificateId Certificate ID value. 1053 * 1054 * @param subjectName Certificate subject name. 1055 * 1056 * @param sanList Subject Alternative Name (SAN) DNS names and IP addresses. 1057 * 1058 * @param issuer Name of the issuing CA. 1059 * 1060 * @param validFrom Certificate valid from date. 1061 * 1062 * @param validTo Certificate valid to (expiration) date 1063 * 1064 * @param signedCertificateTimestampList List of signed certificate timestamps (SCTs). 1065 * 1066 * @param certificateTransparencyCompliance Whether the request complied with Certificate Transparency policy 1067 */ 1068 public SecurityDetails( 1069 String protocol, String keyExchange, String keyExchangeGroup, String cipher, 1070 String mac, int certificateId, String subjectName, String[] sanList, String issuer, 1071 Number validFrom, Number validTo, 1072 Network.SignedCertificateTimestamp[] signedCertificateTimestampList, 1073 String certificateTransparencyCompliance 1074 ) 1075 { 1076 // Exception-Check(s) to ensure that if any parameters which are not declared as 1077 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1078 1079 if (protocol == null) BRDPC.throwNPE("protocol"); 1080 if (keyExchange == null) BRDPC.throwNPE("keyExchange"); 1081 if (cipher == null) BRDPC.throwNPE("cipher"); 1082 if (subjectName == null) BRDPC.throwNPE("subjectName"); 1083 if (sanList == null) BRDPC.throwNPE("sanList"); 1084 if (issuer == null) BRDPC.throwNPE("issuer"); 1085 if (validFrom == null) BRDPC.throwNPE("validFrom"); 1086 if (validTo == null) BRDPC.throwNPE("validTo"); 1087 if (signedCertificateTimestampList == null) BRDPC.throwNPE("signedCertificateTimestampList"); 1088 if (certificateTransparencyCompliance == null) BRDPC.throwNPE("certificateTransparencyCompliance"); 1089 1090 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1091 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1092 1093 BRDPC.checkIAE("certificateTransparencyCompliance", certificateTransparencyCompliance, "Network.CertificateTransparencyCompliance", Network.CertificateTransparencyCompliance); 1094 1095 this.protocol = protocol; 1096 this.keyExchange = keyExchange; 1097 this.keyExchangeGroup = keyExchangeGroup; 1098 this.cipher = cipher; 1099 this.mac = mac; 1100 this.certificateId = certificateId; 1101 this.subjectName = subjectName; 1102 this.sanList = sanList; 1103 this.issuer = issuer; 1104 this.validFrom = validFrom; 1105 this.validTo = validTo; 1106 this.signedCertificateTimestampList = signedCertificateTimestampList; 1107 this.certificateTransparencyCompliance = certificateTransparencyCompliance; 1108 } 1109 1110 /** 1111 * JSON Object Constructor 1112 * @param jo A Json-Object having data about an instance of {@code 'SecurityDetails'}. 1113 */ 1114 public SecurityDetails (JsonObject jo) 1115 { 1116 this.protocol = ReadJSON.getString(jo, "protocol", false, true); 1117 this.keyExchange = ReadJSON.getString(jo, "keyExchange", false, true); 1118 this.keyExchangeGroup = ReadJSON.getString(jo, "keyExchangeGroup", true, false); 1119 this.cipher = ReadJSON.getString(jo, "cipher", false, true); 1120 this.mac = ReadJSON.getString(jo, "mac", true, false); 1121 this.certificateId = ReadJSON.getInt(jo, "certificateId"); 1122 this.subjectName = ReadJSON.getString(jo, "subjectName", false, true); 1123 this.sanList = (jo.getJsonArray("sanList") == null) 1124 ? null 1125 : ReadArrJSON.DimN.strArr(jo.getJsonArray("sanList"), null, 0, String[].class); 1126 this.issuer = ReadJSON.getString(jo, "issuer", false, true); 1127 this.validFrom = ReadJSON.getNUMBER(jo, "validFrom", false, true); 1128 this.validTo = ReadJSON.getNUMBER(jo, "validTo", false, true); 1129 this.signedCertificateTimestampList = (jo.getJsonArray("signedCertificateTimestampList") == null) 1130 ? null 1131 : ReadArrJSON.DimN.objArr(jo.getJsonArray("signedCertificateTimestampList"), null, 0, Network.SignedCertificateTimestamp[].class); 1132 this.certificateTransparencyCompliance = ReadJSON.getString(jo, "certificateTransparencyCompliance", false, true); 1133 } 1134 1135 } 1136 1137 /** <CODE>[No Description Provided by Google]</CODE> */ 1138 public static class CorsErrorStatus extends BaseType 1139 { 1140 /** For Object Serialization. java.io.Serializable */ 1141 protected static final long serialVersionUID = 1; 1142 1143 public boolean[] optionals() 1144 { return new boolean[] { false, false, }; } 1145 1146 /** <CODE>[No Description Provided by Google]</CODE> */ 1147 public final String corsError; 1148 1149 /** <CODE>[No Description Provided by Google]</CODE> */ 1150 public final String failedParameter; 1151 1152 /** 1153 * Constructor 1154 * 1155 * @param corsError - 1156 * 1157 * @param failedParameter - 1158 */ 1159 public CorsErrorStatus(String corsError, String failedParameter) 1160 { 1161 // Exception-Check(s) to ensure that if any parameters which are not declared as 1162 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1163 1164 if (corsError == null) BRDPC.throwNPE("corsError"); 1165 if (failedParameter == null) BRDPC.throwNPE("failedParameter"); 1166 1167 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1168 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1169 1170 BRDPC.checkIAE("corsError", corsError, "Network.CorsError", Network.CorsError); 1171 1172 this.corsError = corsError; 1173 this.failedParameter = failedParameter; 1174 } 1175 1176 /** 1177 * JSON Object Constructor 1178 * @param jo A Json-Object having data about an instance of {@code 'CorsErrorStatus'}. 1179 */ 1180 public CorsErrorStatus (JsonObject jo) 1181 { 1182 this.corsError = ReadJSON.getString(jo, "corsError", false, true); 1183 this.failedParameter = ReadJSON.getString(jo, "failedParameter", false, true); 1184 } 1185 1186 } 1187 1188 /** 1189 * Determines what type of Trust Token operation is executed and 1190 * depending on the type, some additional parameters. The values 1191 * are specified in third_party/blink/renderer/core/fetch/trust_token.idl. 1192 * <BR /> 1193 * <BR /><B>EXPERIMENTAL</B> 1194 */ 1195 public static class TrustTokenParams extends BaseType 1196 { 1197 /** For Object Serialization. java.io.Serializable */ 1198 protected static final long serialVersionUID = 1; 1199 1200 public boolean[] optionals() 1201 { return new boolean[] { false, false, true, }; } 1202 1203 /** <CODE>[No Description Provided by Google]</CODE> */ 1204 public final String type; 1205 1206 /** 1207 * Only set for "token-redemption" type and determine whether 1208 * to request a fresh SRR or use a still valid cached SRR. 1209 */ 1210 public final String refreshPolicy; 1211 1212 /** 1213 * Origins of issuers from whom to request tokens or redemption 1214 * records. 1215 * <BR /> 1216 * <BR /><B>OPTIONAL</B> 1217 */ 1218 public final String[] issuers; 1219 1220 /** 1221 * Constructor 1222 * 1223 * @param type - 1224 * 1225 * @param refreshPolicy 1226 * Only set for "token-redemption" type and determine whether 1227 * to request a fresh SRR or use a still valid cached SRR. 1228 * <BR />Acceptable Values: ["UseCached", "Refresh"] 1229 * 1230 * @param issuers 1231 * Origins of issuers from whom to request tokens or redemption 1232 * records. 1233 * <BR /><B>OPTIONAL</B> 1234 */ 1235 public TrustTokenParams(String type, String refreshPolicy, String[] issuers) 1236 { 1237 // Exception-Check(s) to ensure that if any parameters which are not declared as 1238 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1239 1240 if (type == null) BRDPC.throwNPE("type"); 1241 if (refreshPolicy == null) BRDPC.throwNPE("refreshPolicy"); 1242 1243 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1244 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1245 1246 BRDPC.checkIAE("type", type, "Network.TrustTokenOperationType", Network.TrustTokenOperationType); 1247 BRDPC.checkIAE( 1248 "refreshPolicy", refreshPolicy, 1249 "UseCached", "Refresh" 1250 ); 1251 1252 this.type = type; 1253 this.refreshPolicy = refreshPolicy; 1254 this.issuers = issuers; 1255 } 1256 1257 /** 1258 * JSON Object Constructor 1259 * @param jo A Json-Object having data about an instance of {@code 'TrustTokenParams'}. 1260 */ 1261 public TrustTokenParams (JsonObject jo) 1262 { 1263 this.type = ReadJSON.getString(jo, "type", false, true); 1264 this.refreshPolicy = ReadJSON.getString(jo, "refreshPolicy", false, true); 1265 this.issuers = (jo.getJsonArray("issuers") == null) 1266 ? null 1267 : ReadArrJSON.DimN.strArr(jo.getJsonArray("issuers"), null, 0, String[].class); 1268 } 1269 1270 } 1271 1272 /** HTTP response data. */ 1273 public static class Response extends BaseType 1274 { 1275 /** For Object Serialization. java.io.Serializable */ 1276 protected static final long serialVersionUID = 1; 1277 1278 public boolean[] optionals() 1279 { return new boolean[] { false, false, false, false, true, false, true, true, false, false, true, true, true, true, true, false, true, true, true, true, true, false, true, }; } 1280 1281 /** Response URL. This URL can be different from CachedResource.url in case of redirect. */ 1282 public final String url; 1283 1284 /** HTTP response status code. */ 1285 public final int status; 1286 1287 /** HTTP response status text. */ 1288 public final String statusText; 1289 1290 /** HTTP response headers. */ 1291 public final JsonObject headers; 1292 1293 /** 1294 * HTTP response headers text. This has been replaced by the headers in Network.responseReceivedExtraInfo. 1295 * <BR /> 1296 * <BR /><B>OPTIONAL</B> 1297 * <BR /><B>DEPRECATED</B> 1298 */ 1299 public final String headersText; 1300 1301 /** Resource mimeType as determined by the browser. */ 1302 public final String mimeType; 1303 1304 /** 1305 * Refined HTTP request headers that were actually transmitted over the network. 1306 * <BR /> 1307 * <BR /><B>OPTIONAL</B> 1308 */ 1309 public final JsonObject requestHeaders; 1310 1311 /** 1312 * HTTP request headers text. This has been replaced by the headers in Network.requestWillBeSentExtraInfo. 1313 * <BR /> 1314 * <BR /><B>OPTIONAL</B> 1315 * <BR /><B>DEPRECATED</B> 1316 */ 1317 public final String requestHeadersText; 1318 1319 /** Specifies whether physical connection was actually reused for this request. */ 1320 public final boolean connectionReused; 1321 1322 /** Physical connection id that was actually used for this request. */ 1323 public final Number connectionId; 1324 1325 /** 1326 * Remote IP address. 1327 * <BR /> 1328 * <BR /><B>OPTIONAL</B> 1329 */ 1330 public final String remoteIPAddress; 1331 1332 /** 1333 * Remote port. 1334 * <BR /> 1335 * <BR /><B>OPTIONAL</B> 1336 */ 1337 public final Integer remotePort; 1338 1339 /** 1340 * Specifies that the request was served from the disk cache. 1341 * <BR /> 1342 * <BR /><B>OPTIONAL</B> 1343 */ 1344 public final Boolean fromDiskCache; 1345 1346 /** 1347 * Specifies that the request was served from the ServiceWorker. 1348 * <BR /> 1349 * <BR /><B>OPTIONAL</B> 1350 */ 1351 public final Boolean fromServiceWorker; 1352 1353 /** 1354 * Specifies that the request was served from the prefetch cache. 1355 * <BR /> 1356 * <BR /><B>OPTIONAL</B> 1357 */ 1358 public final Boolean fromPrefetchCache; 1359 1360 /** Total number of bytes received for this request so far. */ 1361 public final Number encodedDataLength; 1362 1363 /** 1364 * Timing information for the given request. 1365 * <BR /> 1366 * <BR /><B>OPTIONAL</B> 1367 */ 1368 public final Network.ResourceTiming timing; 1369 1370 /** 1371 * Response source of response from ServiceWorker. 1372 * <BR /> 1373 * <BR /><B>OPTIONAL</B> 1374 */ 1375 public final String serviceWorkerResponseSource; 1376 1377 /** 1378 * The time at which the returned response was generated. 1379 * <BR /> 1380 * <BR /><B>OPTIONAL</B> 1381 */ 1382 public final Number responseTime; 1383 1384 /** 1385 * Cache Storage Cache Name. 1386 * <BR /> 1387 * <BR /><B>OPTIONAL</B> 1388 */ 1389 public final String cacheStorageCacheName; 1390 1391 /** 1392 * Protocol used to fetch this request. 1393 * <BR /> 1394 * <BR /><B>OPTIONAL</B> 1395 */ 1396 public final String protocol; 1397 1398 /** Security state of the request resource. */ 1399 public final String securityState; 1400 1401 /** 1402 * Security details for the request. 1403 * <BR /> 1404 * <BR /><B>OPTIONAL</B> 1405 */ 1406 public final Network.SecurityDetails securityDetails; 1407 1408 /** 1409 * Constructor 1410 * 1411 * @param url Response URL. This URL can be different from CachedResource.url in case of redirect. 1412 * 1413 * @param status HTTP response status code. 1414 * 1415 * @param statusText HTTP response status text. 1416 * 1417 * @param headers HTTP response headers. 1418 * 1419 * @param headersText HTTP response headers text. This has been replaced by the headers in Network.responseReceivedExtraInfo. 1420 * <BR /><B>OPTIONAL</B> 1421 * <BR /><B>DEPRECATED</B> 1422 * 1423 * @param mimeType Resource mimeType as determined by the browser. 1424 * 1425 * @param requestHeaders Refined HTTP request headers that were actually transmitted over the network. 1426 * <BR /><B>OPTIONAL</B> 1427 * 1428 * @param requestHeadersText HTTP request headers text. This has been replaced by the headers in Network.requestWillBeSentExtraInfo. 1429 * <BR /><B>OPTIONAL</B> 1430 * <BR /><B>DEPRECATED</B> 1431 * 1432 * @param connectionReused Specifies whether physical connection was actually reused for this request. 1433 * 1434 * @param connectionId Physical connection id that was actually used for this request. 1435 * 1436 * @param remoteIPAddress Remote IP address. 1437 * <BR /><B>OPTIONAL</B> 1438 * 1439 * @param remotePort Remote port. 1440 * <BR /><B>OPTIONAL</B> 1441 * 1442 * @param fromDiskCache Specifies that the request was served from the disk cache. 1443 * <BR /><B>OPTIONAL</B> 1444 * 1445 * @param fromServiceWorker Specifies that the request was served from the ServiceWorker. 1446 * <BR /><B>OPTIONAL</B> 1447 * 1448 * @param fromPrefetchCache Specifies that the request was served from the prefetch cache. 1449 * <BR /><B>OPTIONAL</B> 1450 * 1451 * @param encodedDataLength Total number of bytes received for this request so far. 1452 * 1453 * @param timing Timing information for the given request. 1454 * <BR /><B>OPTIONAL</B> 1455 * 1456 * @param serviceWorkerResponseSource Response source of response from ServiceWorker. 1457 * <BR /><B>OPTIONAL</B> 1458 * 1459 * @param responseTime The time at which the returned response was generated. 1460 * <BR /><B>OPTIONAL</B> 1461 * 1462 * @param cacheStorageCacheName Cache Storage Cache Name. 1463 * <BR /><B>OPTIONAL</B> 1464 * 1465 * @param protocol Protocol used to fetch this request. 1466 * <BR /><B>OPTIONAL</B> 1467 * 1468 * @param securityState Security state of the request resource. 1469 * 1470 * @param securityDetails Security details for the request. 1471 * <BR /><B>OPTIONAL</B> 1472 */ 1473 public Response( 1474 String url, int status, String statusText, JsonObject headers, String headersText, 1475 String mimeType, JsonObject requestHeaders, String requestHeadersText, 1476 boolean connectionReused, Number connectionId, String remoteIPAddress, 1477 Integer remotePort, Boolean fromDiskCache, Boolean fromServiceWorker, 1478 Boolean fromPrefetchCache, Number encodedDataLength, Network.ResourceTiming timing, 1479 String serviceWorkerResponseSource, Number responseTime, 1480 String cacheStorageCacheName, String protocol, String securityState, 1481 Network.SecurityDetails securityDetails 1482 ) 1483 { 1484 // Exception-Check(s) to ensure that if any parameters which are not declared as 1485 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1486 1487 if (url == null) BRDPC.throwNPE("url"); 1488 if (statusText == null) BRDPC.throwNPE("statusText"); 1489 if (headers == null) BRDPC.throwNPE("headers"); 1490 if (mimeType == null) BRDPC.throwNPE("mimeType"); 1491 if (connectionId == null) BRDPC.throwNPE("connectionId"); 1492 if (encodedDataLength == null) BRDPC.throwNPE("encodedDataLength"); 1493 if (securityState == null) BRDPC.throwNPE("securityState"); 1494 1495 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1496 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1497 1498 BRDPC.checkIAE("serviceWorkerResponseSource", serviceWorkerResponseSource, "Network.ServiceWorkerResponseSource", Network.ServiceWorkerResponseSource); 1499 BRDPC.checkIAE("securityState", securityState, "Security.SecurityState", Security.SecurityState); 1500 1501 this.url = url; 1502 this.status = status; 1503 this.statusText = statusText; 1504 this.headers = headers; 1505 this.headersText = headersText; 1506 this.mimeType = mimeType; 1507 this.requestHeaders = requestHeaders; 1508 this.requestHeadersText = requestHeadersText; 1509 this.connectionReused = connectionReused; 1510 this.connectionId = connectionId; 1511 this.remoteIPAddress = remoteIPAddress; 1512 this.remotePort = remotePort; 1513 this.fromDiskCache = fromDiskCache; 1514 this.fromServiceWorker = fromServiceWorker; 1515 this.fromPrefetchCache = fromPrefetchCache; 1516 this.encodedDataLength = encodedDataLength; 1517 this.timing = timing; 1518 this.serviceWorkerResponseSource = serviceWorkerResponseSource; 1519 this.responseTime = responseTime; 1520 this.cacheStorageCacheName = cacheStorageCacheName; 1521 this.protocol = protocol; 1522 this.securityState = securityState; 1523 this.securityDetails = securityDetails; 1524 } 1525 1526 /** 1527 * JSON Object Constructor 1528 * @param jo A Json-Object having data about an instance of {@code 'Response'}. 1529 */ 1530 public Response (JsonObject jo) 1531 { 1532 this.url = ReadJSON.getString(jo, "url", false, true); 1533 this.status = ReadJSON.getInt(jo, "status"); 1534 this.statusText = ReadJSON.getString(jo, "statusText", false, true); 1535 this.headers = jo.getJsonObject("headers"); 1536 this.headersText = ReadJSON.getString(jo, "headersText", true, false); 1537 this.mimeType = ReadJSON.getString(jo, "mimeType", false, true); 1538 this.requestHeaders = jo.getJsonObject("requestHeaders"); 1539 this.requestHeadersText = ReadJSON.getString(jo, "requestHeadersText", true, false); 1540 this.connectionReused = ReadJSON.getBoolean(jo, "connectionReused"); 1541 this.connectionId = ReadJSON.getNUMBER(jo, "connectionId", false, true); 1542 this.remoteIPAddress = ReadJSON.getString(jo, "remoteIPAddress", true, false); 1543 this.remotePort = ReadJSON.getINTEGER(jo, "remotePort", true); 1544 this.fromDiskCache = ReadJSON.getBOOLEAN(jo, "fromDiskCache", true); 1545 this.fromServiceWorker = ReadJSON.getBOOLEAN(jo, "fromServiceWorker", true); 1546 this.fromPrefetchCache = ReadJSON.getBOOLEAN(jo, "fromPrefetchCache", true); 1547 this.encodedDataLength = ReadJSON.getNUMBER(jo, "encodedDataLength", false, true); 1548 this.timing = ReadJSON.XL.getObject(jo, "timing", Network.ResourceTiming.class, true, false); 1549 this.serviceWorkerResponseSource = ReadJSON.getString(jo, "serviceWorkerResponseSource", true, false); 1550 this.responseTime = ReadJSON.getNUMBER(jo, "responseTime", true, false); 1551 this.cacheStorageCacheName = ReadJSON.getString(jo, "cacheStorageCacheName", true, false); 1552 this.protocol = ReadJSON.getString(jo, "protocol", true, false); 1553 this.securityState = ReadJSON.getString(jo, "securityState", false, true); 1554 this.securityDetails = ReadJSON.XL.getObject(jo, "securityDetails", Network.SecurityDetails.class, true, false); 1555 } 1556 1557 } 1558 1559 /** WebSocket request data. */ 1560 public static class WebSocketRequest extends BaseType 1561 { 1562 /** For Object Serialization. java.io.Serializable */ 1563 protected static final long serialVersionUID = 1; 1564 1565 public boolean[] optionals() 1566 { return new boolean[] { false, }; } 1567 1568 /** HTTP request headers. */ 1569 public final JsonObject headers; 1570 1571 /** 1572 * Constructor 1573 * 1574 * @param headers HTTP request headers. 1575 */ 1576 public WebSocketRequest(JsonObject headers) 1577 { 1578 // Exception-Check(s) to ensure that if any parameters which are not declared as 1579 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1580 1581 if (headers == null) BRDPC.throwNPE("headers"); 1582 1583 this.headers = headers; 1584 } 1585 1586 } 1587 1588 /** WebSocket response data. */ 1589 public static class WebSocketResponse extends BaseType 1590 { 1591 /** For Object Serialization. java.io.Serializable */ 1592 protected static final long serialVersionUID = 1; 1593 1594 public boolean[] optionals() 1595 { return new boolean[] { false, false, false, true, true, true, }; } 1596 1597 /** HTTP response status code. */ 1598 public final int status; 1599 1600 /** HTTP response status text. */ 1601 public final String statusText; 1602 1603 /** HTTP response headers. */ 1604 public final JsonObject headers; 1605 1606 /** 1607 * HTTP response headers text. 1608 * <BR /> 1609 * <BR /><B>OPTIONAL</B> 1610 */ 1611 public final String headersText; 1612 1613 /** 1614 * HTTP request headers. 1615 * <BR /> 1616 * <BR /><B>OPTIONAL</B> 1617 */ 1618 public final JsonObject requestHeaders; 1619 1620 /** 1621 * HTTP request headers text. 1622 * <BR /> 1623 * <BR /><B>OPTIONAL</B> 1624 */ 1625 public final String requestHeadersText; 1626 1627 /** 1628 * Constructor 1629 * 1630 * @param status HTTP response status code. 1631 * 1632 * @param statusText HTTP response status text. 1633 * 1634 * @param headers HTTP response headers. 1635 * 1636 * @param headersText HTTP response headers text. 1637 * <BR /><B>OPTIONAL</B> 1638 * 1639 * @param requestHeaders HTTP request headers. 1640 * <BR /><B>OPTIONAL</B> 1641 * 1642 * @param requestHeadersText HTTP request headers text. 1643 * <BR /><B>OPTIONAL</B> 1644 */ 1645 public WebSocketResponse( 1646 int status, String statusText, JsonObject headers, String headersText, 1647 JsonObject requestHeaders, String requestHeadersText 1648 ) 1649 { 1650 // Exception-Check(s) to ensure that if any parameters which are not declared as 1651 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1652 1653 if (statusText == null) BRDPC.throwNPE("statusText"); 1654 if (headers == null) BRDPC.throwNPE("headers"); 1655 1656 this.status = status; 1657 this.statusText = statusText; 1658 this.headers = headers; 1659 this.headersText = headersText; 1660 this.requestHeaders = requestHeaders; 1661 this.requestHeadersText = requestHeadersText; 1662 } 1663 1664 /** 1665 * JSON Object Constructor 1666 * @param jo A Json-Object having data about an instance of {@code 'WebSocketResponse'}. 1667 */ 1668 public WebSocketResponse (JsonObject jo) 1669 { 1670 this.status = ReadJSON.getInt(jo, "status"); 1671 this.statusText = ReadJSON.getString(jo, "statusText", false, true); 1672 this.headers = jo.getJsonObject("headers"); 1673 this.headersText = ReadJSON.getString(jo, "headersText", true, false); 1674 this.requestHeaders = jo.getJsonObject("requestHeaders"); 1675 this.requestHeadersText = ReadJSON.getString(jo, "requestHeadersText", true, false); 1676 } 1677 1678 } 1679 1680 /** WebSocket message data. This represents an entire WebSocket message, not just a fragmented frame as the name suggests. */ 1681 public static class WebSocketFrame extends BaseType 1682 { 1683 /** For Object Serialization. java.io.Serializable */ 1684 protected static final long serialVersionUID = 1; 1685 1686 public boolean[] optionals() 1687 { return new boolean[] { false, false, false, }; } 1688 1689 /** WebSocket message opcode. */ 1690 public final Number opcode; 1691 1692 /** WebSocket message mask. */ 1693 public final boolean mask; 1694 1695 /** 1696 * WebSocket message payload data. 1697 * If the opcode is 1, this is a text message and payloadData is a UTF-8 string. 1698 * If the opcode isn't 1, then payloadData is a base64 encoded string representing binary data. 1699 */ 1700 public final String payloadData; 1701 1702 /** 1703 * Constructor 1704 * 1705 * @param opcode WebSocket message opcode. 1706 * 1707 * @param mask WebSocket message mask. 1708 * 1709 * @param payloadData 1710 * WebSocket message payload data. 1711 * If the opcode is 1, this is a text message and payloadData is a UTF-8 string. 1712 * If the opcode isn't 1, then payloadData is a base64 encoded string representing binary data. 1713 */ 1714 public WebSocketFrame(Number opcode, boolean mask, String payloadData) 1715 { 1716 // Exception-Check(s) to ensure that if any parameters which are not declared as 1717 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1718 1719 if (opcode == null) BRDPC.throwNPE("opcode"); 1720 if (payloadData == null) BRDPC.throwNPE("payloadData"); 1721 1722 this.opcode = opcode; 1723 this.mask = mask; 1724 this.payloadData = payloadData; 1725 } 1726 1727 /** 1728 * JSON Object Constructor 1729 * @param jo A Json-Object having data about an instance of {@code 'WebSocketFrame'}. 1730 */ 1731 public WebSocketFrame (JsonObject jo) 1732 { 1733 this.opcode = ReadJSON.getNUMBER(jo, "opcode", false, true); 1734 this.mask = ReadJSON.getBoolean(jo, "mask"); 1735 this.payloadData = ReadJSON.getString(jo, "payloadData", false, true); 1736 } 1737 1738 } 1739 1740 /** Information about the cached resource. */ 1741 public static class CachedResource extends BaseType 1742 { 1743 /** For Object Serialization. java.io.Serializable */ 1744 protected static final long serialVersionUID = 1; 1745 1746 public boolean[] optionals() 1747 { return new boolean[] { false, false, true, false, }; } 1748 1749 /** Resource URL. This is the url of the original network request. */ 1750 public final String url; 1751 1752 /** Type of this resource. */ 1753 public final String type; 1754 1755 /** 1756 * Cached response data. 1757 * <BR /> 1758 * <BR /><B>OPTIONAL</B> 1759 */ 1760 public final Network.Response response; 1761 1762 /** Cached response body size. */ 1763 public final Number bodySize; 1764 1765 /** 1766 * Constructor 1767 * 1768 * @param url Resource URL. This is the url of the original network request. 1769 * 1770 * @param type Type of this resource. 1771 * 1772 * @param response Cached response data. 1773 * <BR /><B>OPTIONAL</B> 1774 * 1775 * @param bodySize Cached response body size. 1776 */ 1777 public CachedResource 1778 (String url, String type, Network.Response response, Number bodySize) 1779 { 1780 // Exception-Check(s) to ensure that if any parameters which are not declared as 1781 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1782 1783 if (url == null) BRDPC.throwNPE("url"); 1784 if (type == null) BRDPC.throwNPE("type"); 1785 if (bodySize == null) BRDPC.throwNPE("bodySize"); 1786 1787 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1788 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1789 1790 BRDPC.checkIAE("type", type, "Network.ResourceType", Network.ResourceType); 1791 1792 this.url = url; 1793 this.type = type; 1794 this.response = response; 1795 this.bodySize = bodySize; 1796 } 1797 1798 /** 1799 * JSON Object Constructor 1800 * @param jo A Json-Object having data about an instance of {@code 'CachedResource'}. 1801 */ 1802 public CachedResource (JsonObject jo) 1803 { 1804 this.url = ReadJSON.getString(jo, "url", false, true); 1805 this.type = ReadJSON.getString(jo, "type", false, true); 1806 this.response = ReadJSON.XL.getObject(jo, "response", Network.Response.class, true, false); 1807 this.bodySize = ReadJSON.getNUMBER(jo, "bodySize", false, true); 1808 } 1809 1810 } 1811 1812 /** Information about the request initiator. */ 1813 public static class Initiator extends BaseType 1814 { 1815 /** For Object Serialization. java.io.Serializable */ 1816 protected static final long serialVersionUID = 1; 1817 1818 public boolean[] optionals() 1819 { return new boolean[] { false, true, true, true, true, true, }; } 1820 1821 /** Type of this initiator. */ 1822 public final String type; 1823 1824 /** 1825 * Initiator JavaScript stack trace, set for Script only. 1826 * <BR /> 1827 * <BR /><B>OPTIONAL</B> 1828 */ 1829 public final RunTime.StackTrace stack; 1830 1831 /** 1832 * Initiator URL, set for Parser type or for Script type (when script is importing module) or for SignedExchange type. 1833 * <BR /> 1834 * <BR /><B>OPTIONAL</B> 1835 */ 1836 public final String url; 1837 1838 /** 1839 * Initiator line number, set for Parser type or for Script type (when script is importing 1840 * module) (0-based). 1841 * <BR /> 1842 * <BR /><B>OPTIONAL</B> 1843 */ 1844 public final Number lineNumber; 1845 1846 /** 1847 * Initiator column number, set for Parser type or for Script type (when script is importing 1848 * module) (0-based). 1849 * <BR /> 1850 * <BR /><B>OPTIONAL</B> 1851 */ 1852 public final Number columnNumber; 1853 1854 /** 1855 * Set if another request triggered this request (e.g. preflight). 1856 * <BR /> 1857 * <BR /><B>OPTIONAL</B> 1858 */ 1859 public final String requestId; 1860 1861 /** 1862 * Constructor 1863 * 1864 * @param type Type of this initiator. 1865 * <BR />Acceptable Values: ["parser", "script", "preload", "SignedExchange", "preflight", "other"] 1866 * 1867 * @param stack Initiator JavaScript stack trace, set for Script only. 1868 * <BR /><B>OPTIONAL</B> 1869 * 1870 * @param url Initiator URL, set for Parser type or for Script type (when script is importing module) or for SignedExchange type. 1871 * <BR /><B>OPTIONAL</B> 1872 * 1873 * @param lineNumber 1874 * Initiator line number, set for Parser type or for Script type (when script is importing 1875 * module) (0-based). 1876 * <BR /><B>OPTIONAL</B> 1877 * 1878 * @param columnNumber 1879 * Initiator column number, set for Parser type or for Script type (when script is importing 1880 * module) (0-based). 1881 * <BR /><B>OPTIONAL</B> 1882 * 1883 * @param requestId Set if another request triggered this request (e.g. preflight). 1884 * <BR /><B>OPTIONAL</B> 1885 */ 1886 public Initiator( 1887 String type, RunTime.StackTrace stack, String url, Number lineNumber, 1888 Number columnNumber, String requestId 1889 ) 1890 { 1891 // Exception-Check(s) to ensure that if any parameters which are not declared as 1892 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1893 1894 if (type == null) BRDPC.throwNPE("type"); 1895 1896 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1897 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1898 1899 BRDPC.checkIAE( 1900 "type", type, 1901 "parser", "script", "preload", "SignedExchange", "preflight", "other" 1902 ); 1903 1904 this.type = type; 1905 this.stack = stack; 1906 this.url = url; 1907 this.lineNumber = lineNumber; 1908 this.columnNumber = columnNumber; 1909 this.requestId = requestId; 1910 } 1911 1912 /** 1913 * JSON Object Constructor 1914 * @param jo A Json-Object having data about an instance of {@code 'Initiator'}. 1915 */ 1916 public Initiator (JsonObject jo) 1917 { 1918 this.type = ReadJSON.getString(jo, "type", false, true); 1919 this.stack = ReadJSON.XL.getObject(jo, "stack", RunTime.StackTrace.class, true, false); 1920 this.url = ReadJSON.getString(jo, "url", true, false); 1921 this.lineNumber = ReadJSON.getNUMBER(jo, "lineNumber", true, false); 1922 this.columnNumber = ReadJSON.getNUMBER(jo, "columnNumber", true, false); 1923 this.requestId = ReadJSON.getString(jo, "requestId", true, false); 1924 } 1925 1926 } 1927 1928 /** Cookie object */ 1929 public static class Cookie extends BaseType 1930 { 1931 /** For Object Serialization. java.io.Serializable */ 1932 protected static final long serialVersionUID = 1; 1933 1934 public boolean[] optionals() 1935 { return new boolean[] { false, false, false, false, false, false, false, false, false, true, false, false, false, false, }; } 1936 1937 /** Cookie name. */ 1938 public final String name; 1939 1940 /** Cookie value. */ 1941 public final String value; 1942 1943 /** Cookie domain. */ 1944 public final String domain; 1945 1946 /** Cookie path. */ 1947 public final String path; 1948 1949 /** Cookie expiration date as the number of seconds since the UNIX epoch. */ 1950 public final Number expires; 1951 1952 /** Cookie size. */ 1953 public final int size; 1954 1955 /** True if cookie is http-only. */ 1956 public final boolean httpOnly; 1957 1958 /** True if cookie is secure. */ 1959 public final boolean secure; 1960 1961 /** True in case of session cookie. */ 1962 public final boolean session; 1963 1964 /** 1965 * Cookie SameSite type. 1966 * <BR /> 1967 * <BR /><B>OPTIONAL</B> 1968 */ 1969 public final String sameSite; 1970 1971 /** 1972 * Cookie Priority 1973 * <BR /> 1974 * <BR /><B>EXPERIMENTAL</B> 1975 */ 1976 public final String priority; 1977 1978 /** 1979 * True if cookie is SameParty. 1980 * <BR /> 1981 * <BR /><B>EXPERIMENTAL</B> 1982 */ 1983 public final boolean sameParty; 1984 1985 /** 1986 * Cookie source scheme type. 1987 * <BR /> 1988 * <BR /><B>EXPERIMENTAL</B> 1989 */ 1990 public final String sourceScheme; 1991 1992 /** 1993 * Cookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port. 1994 * An unspecified port value allows protocol clients to emulate legacy cookie scope for the port. 1995 * This is a temporary ability and it will be removed in the future. 1996 * <BR /> 1997 * <BR /><B>EXPERIMENTAL</B> 1998 */ 1999 public final int sourcePort; 2000 2001 /** 2002 * Constructor 2003 * 2004 * @param name Cookie name. 2005 * 2006 * @param value Cookie value. 2007 * 2008 * @param domain Cookie domain. 2009 * 2010 * @param path Cookie path. 2011 * 2012 * @param expires Cookie expiration date as the number of seconds since the UNIX epoch. 2013 * 2014 * @param size Cookie size. 2015 * 2016 * @param httpOnly True if cookie is http-only. 2017 * 2018 * @param secure True if cookie is secure. 2019 * 2020 * @param session True in case of session cookie. 2021 * 2022 * @param sameSite Cookie SameSite type. 2023 * <BR /><B>OPTIONAL</B> 2024 * 2025 * @param priority Cookie Priority 2026 * <BR /><B>EXPERIMENTAL</B> 2027 * 2028 * @param sameParty True if cookie is SameParty. 2029 * <BR /><B>EXPERIMENTAL</B> 2030 * 2031 * @param sourceScheme Cookie source scheme type. 2032 * <BR /><B>EXPERIMENTAL</B> 2033 * 2034 * @param sourcePort 2035 * Cookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port. 2036 * An unspecified port value allows protocol clients to emulate legacy cookie scope for the port. 2037 * This is a temporary ability and it will be removed in the future. 2038 * <BR /><B>EXPERIMENTAL</B> 2039 */ 2040 public Cookie( 2041 String name, String value, String domain, String path, Number expires, int size, 2042 boolean httpOnly, boolean secure, boolean session, String sameSite, String priority, 2043 boolean sameParty, String sourceScheme, int sourcePort 2044 ) 2045 { 2046 // Exception-Check(s) to ensure that if any parameters which are not declared as 2047 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2048 2049 if (name == null) BRDPC.throwNPE("name"); 2050 if (value == null) BRDPC.throwNPE("value"); 2051 if (domain == null) BRDPC.throwNPE("domain"); 2052 if (path == null) BRDPC.throwNPE("path"); 2053 if (expires == null) BRDPC.throwNPE("expires"); 2054 if (priority == null) BRDPC.throwNPE("priority"); 2055 if (sourceScheme == null) BRDPC.throwNPE("sourceScheme"); 2056 2057 // Exception-Check(s) to ensure that if any parameters which must adhere to a 2058 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 2059 2060 BRDPC.checkIAE("sameSite", sameSite, "Network.CookieSameSite", Network.CookieSameSite); 2061 BRDPC.checkIAE("priority", priority, "Network.CookiePriority", Network.CookiePriority); 2062 BRDPC.checkIAE("sourceScheme", sourceScheme, "Network.CookieSourceScheme", Network.CookieSourceScheme); 2063 2064 this.name = name; 2065 this.value = value; 2066 this.domain = domain; 2067 this.path = path; 2068 this.expires = expires; 2069 this.size = size; 2070 this.httpOnly = httpOnly; 2071 this.secure = secure; 2072 this.session = session; 2073 this.sameSite = sameSite; 2074 this.priority = priority; 2075 this.sameParty = sameParty; 2076 this.sourceScheme = sourceScheme; 2077 this.sourcePort = sourcePort; 2078 } 2079 2080 /** 2081 * JSON Object Constructor 2082 * @param jo A Json-Object having data about an instance of {@code 'Cookie'}. 2083 */ 2084 public Cookie (JsonObject jo) 2085 { 2086 this.name = ReadJSON.getString(jo, "name", false, true); 2087 this.value = ReadJSON.getString(jo, "value", false, true); 2088 this.domain = ReadJSON.getString(jo, "domain", false, true); 2089 this.path = ReadJSON.getString(jo, "path", false, true); 2090 this.expires = ReadJSON.getNUMBER(jo, "expires", false, true); 2091 this.size = ReadJSON.getInt(jo, "size"); 2092 this.httpOnly = ReadJSON.getBoolean(jo, "httpOnly"); 2093 this.secure = ReadJSON.getBoolean(jo, "secure"); 2094 this.session = ReadJSON.getBoolean(jo, "session"); 2095 this.sameSite = ReadJSON.getString(jo, "sameSite", true, false); 2096 this.priority = ReadJSON.getString(jo, "priority", false, true); 2097 this.sameParty = ReadJSON.getBoolean(jo, "sameParty"); 2098 this.sourceScheme = ReadJSON.getString(jo, "sourceScheme", false, true); 2099 this.sourcePort = ReadJSON.getInt(jo, "sourcePort"); 2100 } 2101 2102 } 2103 2104 /** 2105 * A cookie which was not stored from a response with the corresponding reason. 2106 * <BR /> 2107 * <BR /><B>EXPERIMENTAL</B> 2108 */ 2109 public static class BlockedSetCookieWithReason extends BaseType 2110 { 2111 /** For Object Serialization. java.io.Serializable */ 2112 protected static final long serialVersionUID = 1; 2113 2114 public boolean[] optionals() 2115 { return new boolean[] { false, false, true, }; } 2116 2117 /** The reason(s) this cookie was blocked. */ 2118 public final String[] blockedReasons; 2119 2120 /** 2121 * The string representing this individual cookie as it would appear in the header. 2122 * This is not the entire "cookie" or "set-cookie" header which could have multiple cookies. 2123 */ 2124 public final String cookieLine; 2125 2126 /** 2127 * The cookie object which represents the cookie which was not stored. It is optional because 2128 * sometimes complete cookie information is not available, such as in the case of parsing 2129 * errors. 2130 * <BR /> 2131 * <BR /><B>OPTIONAL</B> 2132 */ 2133 public final Network.Cookie cookie; 2134 2135 /** 2136 * Constructor 2137 * 2138 * @param blockedReasons The reason(s) this cookie was blocked. 2139 * 2140 * @param cookieLine 2141 * The string representing this individual cookie as it would appear in the header. 2142 * This is not the entire "cookie" or "set-cookie" header which could have multiple cookies. 2143 * 2144 * @param cookie 2145 * The cookie object which represents the cookie which was not stored. It is optional because 2146 * sometimes complete cookie information is not available, such as in the case of parsing 2147 * errors. 2148 * <BR /><B>OPTIONAL</B> 2149 */ 2150 public BlockedSetCookieWithReason 2151 (String[] blockedReasons, String cookieLine, Network.Cookie cookie) 2152 { 2153 // Exception-Check(s) to ensure that if any parameters which are not declared as 2154 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2155 2156 if (blockedReasons == null) BRDPC.throwNPE("blockedReasons"); 2157 if (cookieLine == null) BRDPC.throwNPE("cookieLine"); 2158 2159 this.blockedReasons = blockedReasons; 2160 this.cookieLine = cookieLine; 2161 this.cookie = cookie; 2162 } 2163 2164 /** 2165 * JSON Object Constructor 2166 * @param jo A Json-Object having data about an instance of {@code 'BlockedSetCookieWithReason'}. 2167 */ 2168 public BlockedSetCookieWithReason (JsonObject jo) 2169 { 2170 this.blockedReasons = (jo.getJsonArray("blockedReasons") == null) 2171 ? null 2172 : ReadArrJSON.DimN.strArr(jo.getJsonArray("blockedReasons"), null, 0, String[].class); 2173 this.cookieLine = ReadJSON.getString(jo, "cookieLine", false, true); 2174 this.cookie = ReadJSON.XL.getObject(jo, "cookie", Network.Cookie.class, true, false); 2175 } 2176 2177 } 2178 2179 /** 2180 * A cookie with was not sent with a request with the corresponding reason. 2181 * <BR /> 2182 * <BR /><B>EXPERIMENTAL</B> 2183 */ 2184 public static class BlockedCookieWithReason extends BaseType 2185 { 2186 /** For Object Serialization. java.io.Serializable */ 2187 protected static final long serialVersionUID = 1; 2188 2189 public boolean[] optionals() 2190 { return new boolean[] { false, false, }; } 2191 2192 /** The reason(s) the cookie was blocked. */ 2193 public final String[] blockedReasons; 2194 2195 /** The cookie object representing the cookie which was not sent. */ 2196 public final Network.Cookie cookie; 2197 2198 /** 2199 * Constructor 2200 * 2201 * @param blockedReasons The reason(s) the cookie was blocked. 2202 * 2203 * @param cookie The cookie object representing the cookie which was not sent. 2204 */ 2205 public BlockedCookieWithReason(String[] blockedReasons, Network.Cookie cookie) 2206 { 2207 // Exception-Check(s) to ensure that if any parameters which are not declared as 2208 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2209 2210 if (blockedReasons == null) BRDPC.throwNPE("blockedReasons"); 2211 if (cookie == null) BRDPC.throwNPE("cookie"); 2212 2213 this.blockedReasons = blockedReasons; 2214 this.cookie = cookie; 2215 } 2216 2217 /** 2218 * JSON Object Constructor 2219 * @param jo A Json-Object having data about an instance of {@code 'BlockedCookieWithReason'}. 2220 */ 2221 public BlockedCookieWithReason (JsonObject jo) 2222 { 2223 this.blockedReasons = (jo.getJsonArray("blockedReasons") == null) 2224 ? null 2225 : ReadArrJSON.DimN.strArr(jo.getJsonArray("blockedReasons"), null, 0, String[].class); 2226 this.cookie = ReadJSON.XL.getObject(jo, "cookie", Network.Cookie.class, false, true); 2227 } 2228 2229 } 2230 2231 /** Cookie parameter object */ 2232 public static class CookieParam extends BaseType 2233 { 2234 /** For Object Serialization. java.io.Serializable */ 2235 protected static final long serialVersionUID = 1; 2236 2237 public boolean[] optionals() 2238 { return new boolean[] { false, false, true, true, true, true, true, true, true, true, true, true, true, }; } 2239 2240 /** Cookie name. */ 2241 public final String name; 2242 2243 /** Cookie value. */ 2244 public final String value; 2245 2246 /** 2247 * The request-URI to associate with the setting of the cookie. This value can affect the 2248 * default domain, path, source port, and source scheme values of the created cookie. 2249 * <BR /> 2250 * <BR /><B>OPTIONAL</B> 2251 */ 2252 public final String url; 2253 2254 /** 2255 * Cookie domain. 2256 * <BR /> 2257 * <BR /><B>OPTIONAL</B> 2258 */ 2259 public final String domain; 2260 2261 /** 2262 * Cookie path. 2263 * <BR /> 2264 * <BR /><B>OPTIONAL</B> 2265 */ 2266 public final String path; 2267 2268 /** 2269 * True if cookie is secure. 2270 * <BR /> 2271 * <BR /><B>OPTIONAL</B> 2272 */ 2273 public final Boolean secure; 2274 2275 /** 2276 * True if cookie is http-only. 2277 * <BR /> 2278 * <BR /><B>OPTIONAL</B> 2279 */ 2280 public final Boolean httpOnly; 2281 2282 /** 2283 * Cookie SameSite type. 2284 * <BR /> 2285 * <BR /><B>OPTIONAL</B> 2286 */ 2287 public final String sameSite; 2288 2289 /** 2290 * Cookie expiration date, session cookie if not set 2291 * <BR /> 2292 * <BR /><B>OPTIONAL</B> 2293 */ 2294 public final Number expires; 2295 2296 /** 2297 * Cookie Priority. 2298 * <BR /> 2299 * <BR /><B>OPTIONAL</B> 2300 * <BR /><B>EXPERIMENTAL</B> 2301 */ 2302 public final String priority; 2303 2304 /** 2305 * True if cookie is SameParty. 2306 * <BR /> 2307 * <BR /><B>OPTIONAL</B> 2308 * <BR /><B>EXPERIMENTAL</B> 2309 */ 2310 public final Boolean sameParty; 2311 2312 /** 2313 * Cookie source scheme type. 2314 * <BR /> 2315 * <BR /><B>OPTIONAL</B> 2316 * <BR /><B>EXPERIMENTAL</B> 2317 */ 2318 public final String sourceScheme; 2319 2320 /** 2321 * Cookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port. 2322 * An unspecified port value allows protocol clients to emulate legacy cookie scope for the port. 2323 * This is a temporary ability and it will be removed in the future. 2324 * <BR /> 2325 * <BR /><B>OPTIONAL</B> 2326 * <BR /><B>EXPERIMENTAL</B> 2327 */ 2328 public final Integer sourcePort; 2329 2330 /** 2331 * Constructor 2332 * 2333 * @param name Cookie name. 2334 * 2335 * @param value Cookie value. 2336 * 2337 * @param url 2338 * The request-URI to associate with the setting of the cookie. This value can affect the 2339 * default domain, path, source port, and source scheme values of the created cookie. 2340 * <BR /><B>OPTIONAL</B> 2341 * 2342 * @param domain Cookie domain. 2343 * <BR /><B>OPTIONAL</B> 2344 * 2345 * @param path Cookie path. 2346 * <BR /><B>OPTIONAL</B> 2347 * 2348 * @param secure True if cookie is secure. 2349 * <BR /><B>OPTIONAL</B> 2350 * 2351 * @param httpOnly True if cookie is http-only. 2352 * <BR /><B>OPTIONAL</B> 2353 * 2354 * @param sameSite Cookie SameSite type. 2355 * <BR /><B>OPTIONAL</B> 2356 * 2357 * @param expires Cookie expiration date, session cookie if not set 2358 * <BR /><B>OPTIONAL</B> 2359 * 2360 * @param priority Cookie Priority. 2361 * <BR /><B>OPTIONAL</B> 2362 * <BR /><B>EXPERIMENTAL</B> 2363 * 2364 * @param sameParty True if cookie is SameParty. 2365 * <BR /><B>OPTIONAL</B> 2366 * <BR /><B>EXPERIMENTAL</B> 2367 * 2368 * @param sourceScheme Cookie source scheme type. 2369 * <BR /><B>OPTIONAL</B> 2370 * <BR /><B>EXPERIMENTAL</B> 2371 * 2372 * @param sourcePort 2373 * Cookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port. 2374 * An unspecified port value allows protocol clients to emulate legacy cookie scope for the port. 2375 * This is a temporary ability and it will be removed in the future. 2376 * <BR /><B>OPTIONAL</B> 2377 * <BR /><B>EXPERIMENTAL</B> 2378 */ 2379 public CookieParam( 2380 String name, String value, String url, String domain, String path, Boolean secure, 2381 Boolean httpOnly, String sameSite, Number expires, String priority, 2382 Boolean sameParty, String sourceScheme, Integer sourcePort 2383 ) 2384 { 2385 // Exception-Check(s) to ensure that if any parameters which are not declared as 2386 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2387 2388 if (name == null) BRDPC.throwNPE("name"); 2389 if (value == null) BRDPC.throwNPE("value"); 2390 2391 // Exception-Check(s) to ensure that if any parameters which must adhere to a 2392 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 2393 2394 BRDPC.checkIAE("sameSite", sameSite, "Network.CookieSameSite", Network.CookieSameSite); 2395 BRDPC.checkIAE("priority", priority, "Network.CookiePriority", Network.CookiePriority); 2396 BRDPC.checkIAE("sourceScheme", sourceScheme, "Network.CookieSourceScheme", Network.CookieSourceScheme); 2397 2398 this.name = name; 2399 this.value = value; 2400 this.url = url; 2401 this.domain = domain; 2402 this.path = path; 2403 this.secure = secure; 2404 this.httpOnly = httpOnly; 2405 this.sameSite = sameSite; 2406 this.expires = expires; 2407 this.priority = priority; 2408 this.sameParty = sameParty; 2409 this.sourceScheme = sourceScheme; 2410 this.sourcePort = sourcePort; 2411 } 2412 2413 /** 2414 * JSON Object Constructor 2415 * @param jo A Json-Object having data about an instance of {@code 'CookieParam'}. 2416 */ 2417 public CookieParam (JsonObject jo) 2418 { 2419 this.name = ReadJSON.getString(jo, "name", false, true); 2420 this.value = ReadJSON.getString(jo, "value", false, true); 2421 this.url = ReadJSON.getString(jo, "url", true, false); 2422 this.domain = ReadJSON.getString(jo, "domain", true, false); 2423 this.path = ReadJSON.getString(jo, "path", true, false); 2424 this.secure = ReadJSON.getBOOLEAN(jo, "secure", true); 2425 this.httpOnly = ReadJSON.getBOOLEAN(jo, "httpOnly", true); 2426 this.sameSite = ReadJSON.getString(jo, "sameSite", true, false); 2427 this.expires = ReadJSON.getNUMBER(jo, "expires", true, false); 2428 this.priority = ReadJSON.getString(jo, "priority", true, false); 2429 this.sameParty = ReadJSON.getBOOLEAN(jo, "sameParty", true); 2430 this.sourceScheme = ReadJSON.getString(jo, "sourceScheme", true, false); 2431 this.sourcePort = ReadJSON.getINTEGER(jo, "sourcePort", true); 2432 } 2433 2434 } 2435 2436 /** 2437 * Authorization challenge for HTTP status code 401 or 407. 2438 * <BR /> 2439 * <BR /><B>EXPERIMENTAL</B> 2440 */ 2441 public static class AuthChallenge extends BaseType 2442 { 2443 /** For Object Serialization. java.io.Serializable */ 2444 protected static final long serialVersionUID = 1; 2445 2446 public boolean[] optionals() 2447 { return new boolean[] { true, false, false, false, }; } 2448 2449 /** 2450 * Source of the authentication challenge. 2451 * <BR /> 2452 * <BR /><B>OPTIONAL</B> 2453 */ 2454 public final String source; 2455 2456 /** Origin of the challenger. */ 2457 public final String origin; 2458 2459 /** The authentication scheme used, such as basic or digest */ 2460 public final String scheme; 2461 2462 /** The realm of the challenge. May be empty. */ 2463 public final String realm; 2464 2465 /** 2466 * Constructor 2467 * 2468 * @param source Source of the authentication challenge. 2469 * <BR />Acceptable Values: ["Server", "Proxy"] 2470 * <BR /><B>OPTIONAL</B> 2471 * 2472 * @param origin Origin of the challenger. 2473 * 2474 * @param scheme The authentication scheme used, such as basic or digest 2475 * 2476 * @param realm The realm of the challenge. May be empty. 2477 */ 2478 public AuthChallenge(String source, String origin, String scheme, String realm) 2479 { 2480 // Exception-Check(s) to ensure that if any parameters which are not declared as 2481 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2482 2483 if (origin == null) BRDPC.throwNPE("origin"); 2484 if (scheme == null) BRDPC.throwNPE("scheme"); 2485 if (realm == null) BRDPC.throwNPE("realm"); 2486 2487 // Exception-Check(s) to ensure that if any parameters which must adhere to a 2488 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 2489 2490 BRDPC.checkIAE( 2491 "source", source, 2492 "Server", "Proxy" 2493 ); 2494 2495 this.source = source; 2496 this.origin = origin; 2497 this.scheme = scheme; 2498 this.realm = realm; 2499 } 2500 2501 /** 2502 * JSON Object Constructor 2503 * @param jo A Json-Object having data about an instance of {@code 'AuthChallenge'}. 2504 */ 2505 public AuthChallenge (JsonObject jo) 2506 { 2507 this.source = ReadJSON.getString(jo, "source", true, false); 2508 this.origin = ReadJSON.getString(jo, "origin", false, true); 2509 this.scheme = ReadJSON.getString(jo, "scheme", false, true); 2510 this.realm = ReadJSON.getString(jo, "realm", false, true); 2511 } 2512 2513 } 2514 2515 /** 2516 * Response to an AuthChallenge. 2517 * <BR /> 2518 * <BR /><B>EXPERIMENTAL</B> 2519 */ 2520 public static class AuthChallengeResponse extends BaseType 2521 { 2522 /** For Object Serialization. java.io.Serializable */ 2523 protected static final long serialVersionUID = 1; 2524 2525 public boolean[] optionals() 2526 { return new boolean[] { false, true, true, }; } 2527 2528 /** 2529 * The decision on what to do in response to the authorization challenge. Default means 2530 * deferring to the default behavior of the net stack, which will likely either the Cancel 2531 * authentication or display a popup dialog box. 2532 */ 2533 public final String response; 2534 2535 /** 2536 * The username to provide, possibly empty. Should only be set if response is 2537 * ProvideCredentials. 2538 * <BR /> 2539 * <BR /><B>OPTIONAL</B> 2540 */ 2541 public final String username; 2542 2543 /** 2544 * The password to provide, possibly empty. Should only be set if response is 2545 * ProvideCredentials. 2546 * <BR /> 2547 * <BR /><B>OPTIONAL</B> 2548 */ 2549 public final String password; 2550 2551 /** 2552 * Constructor 2553 * 2554 * @param response 2555 * The decision on what to do in response to the authorization challenge. Default means 2556 * deferring to the default behavior of the net stack, which will likely either the Cancel 2557 * authentication or display a popup dialog box. 2558 * <BR />Acceptable Values: ["Default", "CancelAuth", "ProvideCredentials"] 2559 * 2560 * @param username 2561 * The username to provide, possibly empty. Should only be set if response is 2562 * ProvideCredentials. 2563 * <BR /><B>OPTIONAL</B> 2564 * 2565 * @param password 2566 * The password to provide, possibly empty. Should only be set if response is 2567 * ProvideCredentials. 2568 * <BR /><B>OPTIONAL</B> 2569 */ 2570 public AuthChallengeResponse(String response, String username, String password) 2571 { 2572 // Exception-Check(s) to ensure that if any parameters which are not declared as 2573 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2574 2575 if (response == null) BRDPC.throwNPE("response"); 2576 2577 // Exception-Check(s) to ensure that if any parameters which must adhere to a 2578 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 2579 2580 BRDPC.checkIAE( 2581 "response", response, 2582 "Default", "CancelAuth", "ProvideCredentials" 2583 ); 2584 2585 this.response = response; 2586 this.username = username; 2587 this.password = password; 2588 } 2589 2590 /** 2591 * JSON Object Constructor 2592 * @param jo A Json-Object having data about an instance of {@code 'AuthChallengeResponse'}. 2593 */ 2594 public AuthChallengeResponse (JsonObject jo) 2595 { 2596 this.response = ReadJSON.getString(jo, "response", false, true); 2597 this.username = ReadJSON.getString(jo, "username", true, false); 2598 this.password = ReadJSON.getString(jo, "password", true, false); 2599 } 2600 2601 } 2602 2603 /** 2604 * Request pattern for interception. 2605 * <BR /> 2606 * <BR /><B>EXPERIMENTAL</B> 2607 */ 2608 public static class RequestPattern extends BaseType 2609 { 2610 /** For Object Serialization. java.io.Serializable */ 2611 protected static final long serialVersionUID = 1; 2612 2613 public boolean[] optionals() 2614 { return new boolean[] { true, true, true, }; } 2615 2616 /** 2617 * Wildcards (<CODE>'*'</CODE> -> zero or more, <CODE>'?'</CODE> -> exactly one) are allowed. Escape character is 2618 * backslash. Omitting is equivalent to <CODE>"*"</CODE>. 2619 * <BR /> 2620 * <BR /><B>OPTIONAL</B> 2621 */ 2622 public final String urlPattern; 2623 2624 /** 2625 * If set, only requests for matching resource types will be intercepted. 2626 * <BR /> 2627 * <BR /><B>OPTIONAL</B> 2628 */ 2629 public final String resourceType; 2630 2631 /** 2632 * Stage at which to begin intercepting requests. Default is Request. 2633 * <BR /> 2634 * <BR /><B>OPTIONAL</B> 2635 */ 2636 public final String interceptionStage; 2637 2638 /** 2639 * Constructor 2640 * 2641 * @param urlPattern 2642 * Wildcards (<CODE>'*'</CODE> -> zero or more, <CODE>'?'</CODE> -> exactly one) are allowed. Escape character is 2643 * backslash. Omitting is equivalent to <CODE>"*"</CODE>. 2644 * <BR /><B>OPTIONAL</B> 2645 * 2646 * @param resourceType If set, only requests for matching resource types will be intercepted. 2647 * <BR /><B>OPTIONAL</B> 2648 * 2649 * @param interceptionStage Stage at which to begin intercepting requests. Default is Request. 2650 * <BR /><B>OPTIONAL</B> 2651 */ 2652 public RequestPattern(String urlPattern, String resourceType, String interceptionStage) 2653 { 2654 // Exception-Check(s) to ensure that if any parameters which must adhere to a 2655 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 2656 2657 BRDPC.checkIAE("resourceType", resourceType, "Network.ResourceType", Network.ResourceType); 2658 BRDPC.checkIAE("interceptionStage", interceptionStage, "Network.InterceptionStage", Network.InterceptionStage); 2659 2660 this.urlPattern = urlPattern; 2661 this.resourceType = resourceType; 2662 this.interceptionStage = interceptionStage; 2663 } 2664 2665 /** 2666 * JSON Object Constructor 2667 * @param jo A Json-Object having data about an instance of {@code 'RequestPattern'}. 2668 */ 2669 public RequestPattern (JsonObject jo) 2670 { 2671 this.urlPattern = ReadJSON.getString(jo, "urlPattern", true, false); 2672 this.resourceType = ReadJSON.getString(jo, "resourceType", true, false); 2673 this.interceptionStage = ReadJSON.getString(jo, "interceptionStage", true, false); 2674 } 2675 2676 } 2677 2678 /** 2679 * Information about a signed exchange signature. 2680 * https://wicg.github.io/webpackage/draft-yasskin-httpbis-origin-signed-exchanges-impl.html#rfc.section.3.1 2681 * <BR /> 2682 * <BR /><B>EXPERIMENTAL</B> 2683 */ 2684 public static class SignedExchangeSignature extends BaseType 2685 { 2686 /** For Object Serialization. java.io.Serializable */ 2687 protected static final long serialVersionUID = 1; 2688 2689 public boolean[] optionals() 2690 { return new boolean[] { false, false, false, true, true, false, false, false, true, }; } 2691 2692 /** Signed exchange signature label. */ 2693 public final String label; 2694 2695 /** The hex string of signed exchange signature. */ 2696 public final String signature; 2697 2698 /** Signed exchange signature integrity. */ 2699 public final String integrity; 2700 2701 /** 2702 * Signed exchange signature cert Url. 2703 * <BR /> 2704 * <BR /><B>OPTIONAL</B> 2705 */ 2706 public final String certUrl; 2707 2708 /** 2709 * The hex string of signed exchange signature cert sha256. 2710 * <BR /> 2711 * <BR /><B>OPTIONAL</B> 2712 */ 2713 public final String certSha256; 2714 2715 /** Signed exchange signature validity Url. */ 2716 public final String validityUrl; 2717 2718 /** Signed exchange signature date. */ 2719 public final int date; 2720 2721 /** Signed exchange signature expires. */ 2722 public final int expires; 2723 2724 /** 2725 * The encoded certificates. 2726 * <BR /> 2727 * <BR /><B>OPTIONAL</B> 2728 */ 2729 public final String[] certificates; 2730 2731 /** 2732 * Constructor 2733 * 2734 * @param label Signed exchange signature label. 2735 * 2736 * @param signature The hex string of signed exchange signature. 2737 * 2738 * @param integrity Signed exchange signature integrity. 2739 * 2740 * @param certUrl Signed exchange signature cert Url. 2741 * <BR /><B>OPTIONAL</B> 2742 * 2743 * @param certSha256 The hex string of signed exchange signature cert sha256. 2744 * <BR /><B>OPTIONAL</B> 2745 * 2746 * @param validityUrl Signed exchange signature validity Url. 2747 * 2748 * @param date Signed exchange signature date. 2749 * 2750 * @param expires Signed exchange signature expires. 2751 * 2752 * @param certificates The encoded certificates. 2753 * <BR /><B>OPTIONAL</B> 2754 */ 2755 public SignedExchangeSignature( 2756 String label, String signature, String integrity, String certUrl, String certSha256, 2757 String validityUrl, int date, int expires, String[] certificates 2758 ) 2759 { 2760 // Exception-Check(s) to ensure that if any parameters which are not declared as 2761 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2762 2763 if (label == null) BRDPC.throwNPE("label"); 2764 if (signature == null) BRDPC.throwNPE("signature"); 2765 if (integrity == null) BRDPC.throwNPE("integrity"); 2766 if (validityUrl == null) BRDPC.throwNPE("validityUrl"); 2767 2768 this.label = label; 2769 this.signature = signature; 2770 this.integrity = integrity; 2771 this.certUrl = certUrl; 2772 this.certSha256 = certSha256; 2773 this.validityUrl = validityUrl; 2774 this.date = date; 2775 this.expires = expires; 2776 this.certificates = certificates; 2777 } 2778 2779 /** 2780 * JSON Object Constructor 2781 * @param jo A Json-Object having data about an instance of {@code 'SignedExchangeSignature'}. 2782 */ 2783 public SignedExchangeSignature (JsonObject jo) 2784 { 2785 this.label = ReadJSON.getString(jo, "label", false, true); 2786 this.signature = ReadJSON.getString(jo, "signature", false, true); 2787 this.integrity = ReadJSON.getString(jo, "integrity", false, true); 2788 this.certUrl = ReadJSON.getString(jo, "certUrl", true, false); 2789 this.certSha256 = ReadJSON.getString(jo, "certSha256", true, false); 2790 this.validityUrl = ReadJSON.getString(jo, "validityUrl", false, true); 2791 this.date = ReadJSON.getInt(jo, "date"); 2792 this.expires = ReadJSON.getInt(jo, "expires"); 2793 this.certificates = (jo.getJsonArray("certificates") == null) 2794 ? null 2795 : ReadArrJSON.DimN.strArr(jo.getJsonArray("certificates"), null, 0, String[].class); 2796 } 2797 2798 } 2799 2800 /** 2801 * Information about a signed exchange header. 2802 * https://wicg.github.io/webpackage/draft-yasskin-httpbis-origin-signed-exchanges-impl.html#cbor-representation 2803 * <BR /> 2804 * <BR /><B>EXPERIMENTAL</B> 2805 */ 2806 public static class SignedExchangeHeader extends BaseType 2807 { 2808 /** For Object Serialization. java.io.Serializable */ 2809 protected static final long serialVersionUID = 1; 2810 2811 public boolean[] optionals() 2812 { return new boolean[] { false, false, false, false, false, }; } 2813 2814 /** Signed exchange request URL. */ 2815 public final String requestUrl; 2816 2817 /** Signed exchange response code. */ 2818 public final int responseCode; 2819 2820 /** Signed exchange response headers. */ 2821 public final JsonObject responseHeaders; 2822 2823 /** Signed exchange response signature. */ 2824 public final Network.SignedExchangeSignature[] signatures; 2825 2826 /** Signed exchange header integrity hash in the form of "sha256-<base64-hash-value>". */ 2827 public final String headerIntegrity; 2828 2829 /** 2830 * Constructor 2831 * 2832 * @param requestUrl Signed exchange request URL. 2833 * 2834 * @param responseCode Signed exchange response code. 2835 * 2836 * @param responseHeaders Signed exchange response headers. 2837 * 2838 * @param signatures Signed exchange response signature. 2839 * 2840 * @param headerIntegrity Signed exchange header integrity hash in the form of "sha256-<base64-hash-value>". 2841 */ 2842 public SignedExchangeHeader( 2843 String requestUrl, int responseCode, JsonObject responseHeaders, 2844 Network.SignedExchangeSignature[] signatures, String headerIntegrity 2845 ) 2846 { 2847 // Exception-Check(s) to ensure that if any parameters which are not declared as 2848 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2849 2850 if (requestUrl == null) BRDPC.throwNPE("requestUrl"); 2851 if (responseHeaders == null) BRDPC.throwNPE("responseHeaders"); 2852 if (signatures == null) BRDPC.throwNPE("signatures"); 2853 if (headerIntegrity == null) BRDPC.throwNPE("headerIntegrity"); 2854 2855 this.requestUrl = requestUrl; 2856 this.responseCode = responseCode; 2857 this.responseHeaders = responseHeaders; 2858 this.signatures = signatures; 2859 this.headerIntegrity = headerIntegrity; 2860 } 2861 2862 /** 2863 * JSON Object Constructor 2864 * @param jo A Json-Object having data about an instance of {@code 'SignedExchangeHeader'}. 2865 */ 2866 public SignedExchangeHeader (JsonObject jo) 2867 { 2868 this.requestUrl = ReadJSON.getString(jo, "requestUrl", false, true); 2869 this.responseCode = ReadJSON.getInt(jo, "responseCode"); 2870 this.responseHeaders = jo.getJsonObject("responseHeaders"); 2871 this.signatures = (jo.getJsonArray("signatures") == null) 2872 ? null 2873 : ReadArrJSON.DimN.objArr(jo.getJsonArray("signatures"), null, 0, Network.SignedExchangeSignature[].class); 2874 this.headerIntegrity = ReadJSON.getString(jo, "headerIntegrity", false, true); 2875 } 2876 2877 } 2878 2879 /** 2880 * Information about a signed exchange response. 2881 * <BR /> 2882 * <BR /><B>EXPERIMENTAL</B> 2883 */ 2884 public static class SignedExchangeError extends BaseType 2885 { 2886 /** For Object Serialization. java.io.Serializable */ 2887 protected static final long serialVersionUID = 1; 2888 2889 public boolean[] optionals() 2890 { return new boolean[] { false, true, true, }; } 2891 2892 /** Error message. */ 2893 public final String message; 2894 2895 /** 2896 * The index of the signature which caused the error. 2897 * <BR /> 2898 * <BR /><B>OPTIONAL</B> 2899 */ 2900 public final Integer signatureIndex; 2901 2902 /** 2903 * The field which caused the error. 2904 * <BR /> 2905 * <BR /><B>OPTIONAL</B> 2906 */ 2907 public final String errorField; 2908 2909 /** 2910 * Constructor 2911 * 2912 * @param message Error message. 2913 * 2914 * @param signatureIndex The index of the signature which caused the error. 2915 * <BR /><B>OPTIONAL</B> 2916 * 2917 * @param errorField The field which caused the error. 2918 * <BR /><B>OPTIONAL</B> 2919 */ 2920 public SignedExchangeError(String message, Integer signatureIndex, String errorField) 2921 { 2922 // Exception-Check(s) to ensure that if any parameters which are not declared as 2923 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2924 2925 if (message == null) BRDPC.throwNPE("message"); 2926 2927 // Exception-Check(s) to ensure that if any parameters which must adhere to a 2928 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 2929 2930 BRDPC.checkIAE("errorField", errorField, "Network.SignedExchangeErrorField", Network.SignedExchangeErrorField); 2931 2932 this.message = message; 2933 this.signatureIndex = signatureIndex; 2934 this.errorField = errorField; 2935 } 2936 2937 /** 2938 * JSON Object Constructor 2939 * @param jo A Json-Object having data about an instance of {@code 'SignedExchangeError'}. 2940 */ 2941 public SignedExchangeError (JsonObject jo) 2942 { 2943 this.message = ReadJSON.getString(jo, "message", false, true); 2944 this.signatureIndex = ReadJSON.getINTEGER(jo, "signatureIndex", true); 2945 this.errorField = ReadJSON.getString(jo, "errorField", true, false); 2946 } 2947 2948 } 2949 2950 /** 2951 * Information about a signed exchange response. 2952 * <BR /> 2953 * <BR /><B>EXPERIMENTAL</B> 2954 */ 2955 public static class SignedExchangeInfo extends BaseType 2956 { 2957 /** For Object Serialization. java.io.Serializable */ 2958 protected static final long serialVersionUID = 1; 2959 2960 public boolean[] optionals() 2961 { return new boolean[] { false, true, true, true, }; } 2962 2963 /** The outer response of signed HTTP exchange which was received from network. */ 2964 public final Network.Response outerResponse; 2965 2966 /** 2967 * Information about the signed exchange header. 2968 * <BR /> 2969 * <BR /><B>OPTIONAL</B> 2970 */ 2971 public final Network.SignedExchangeHeader header; 2972 2973 /** 2974 * Security details for the signed exchange header. 2975 * <BR /> 2976 * <BR /><B>OPTIONAL</B> 2977 */ 2978 public final Network.SecurityDetails securityDetails; 2979 2980 /** 2981 * Errors occurred while handling the signed exchagne. 2982 * <BR /> 2983 * <BR /><B>OPTIONAL</B> 2984 */ 2985 public final Network.SignedExchangeError[] errors; 2986 2987 /** 2988 * Constructor 2989 * 2990 * @param outerResponse The outer response of signed HTTP exchange which was received from network. 2991 * 2992 * @param header Information about the signed exchange header. 2993 * <BR /><B>OPTIONAL</B> 2994 * 2995 * @param securityDetails Security details for the signed exchange header. 2996 * <BR /><B>OPTIONAL</B> 2997 * 2998 * @param errors Errors occurred while handling the signed exchagne. 2999 * <BR /><B>OPTIONAL</B> 3000 */ 3001 public SignedExchangeInfo( 3002 Network.Response outerResponse, Network.SignedExchangeHeader header, 3003 Network.SecurityDetails securityDetails, Network.SignedExchangeError[] errors 3004 ) 3005 { 3006 // Exception-Check(s) to ensure that if any parameters which are not declared as 3007 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3008 3009 if (outerResponse == null) BRDPC.throwNPE("outerResponse"); 3010 3011 this.outerResponse = outerResponse; 3012 this.header = header; 3013 this.securityDetails = securityDetails; 3014 this.errors = errors; 3015 } 3016 3017 /** 3018 * JSON Object Constructor 3019 * @param jo A Json-Object having data about an instance of {@code 'SignedExchangeInfo'}. 3020 */ 3021 public SignedExchangeInfo (JsonObject jo) 3022 { 3023 this.outerResponse = ReadJSON.XL.getObject(jo, "outerResponse", Network.Response.class, false, true); 3024 this.header = ReadJSON.XL.getObject(jo, "header", Network.SignedExchangeHeader.class, true, false); 3025 this.securityDetails = ReadJSON.XL.getObject(jo, "securityDetails", Network.SecurityDetails.class, true, false); 3026 this.errors = (jo.getJsonArray("errors") == null) 3027 ? null 3028 : ReadArrJSON.DimN.objArr(jo.getJsonArray("errors"), null, 0, Network.SignedExchangeError[].class); 3029 } 3030 3031 } 3032 3033 /** 3034 * <CODE>[No Description Provided by Google]</CODE> 3035 * <BR /> 3036 * <BR /><B>EXPERIMENTAL</B> 3037 */ 3038 public static class ConnectTiming extends BaseType 3039 { 3040 /** For Object Serialization. java.io.Serializable */ 3041 protected static final long serialVersionUID = 1; 3042 3043 public boolean[] optionals() 3044 { return new boolean[] { false, }; } 3045 3046 /** 3047 * Timing's requestTime is a baseline in seconds, while the other numbers are ticks in 3048 * milliseconds relatively to this requestTime. Matches ResourceTiming's requestTime for 3049 * the same request (but not for redirected requests). 3050 */ 3051 public final Number requestTime; 3052 3053 /** 3054 * Constructor 3055 * 3056 * @param requestTime 3057 * Timing's requestTime is a baseline in seconds, while the other numbers are ticks in 3058 * milliseconds relatively to this requestTime. Matches ResourceTiming's requestTime for 3059 * the same request (but not for redirected requests). 3060 */ 3061 public ConnectTiming(Number requestTime) 3062 { 3063 // Exception-Check(s) to ensure that if any parameters which are not declared as 3064 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3065 3066 if (requestTime == null) BRDPC.throwNPE("requestTime"); 3067 3068 this.requestTime = requestTime; 3069 } 3070 3071 /** 3072 * JSON Object Constructor 3073 * @param jo A Json-Object having data about an instance of {@code 'ConnectTiming'}. 3074 */ 3075 public ConnectTiming (JsonObject jo) 3076 { 3077 this.requestTime = ReadJSON.getNUMBER(jo, "requestTime", false, true); 3078 } 3079 3080 } 3081 3082 /** 3083 * <CODE>[No Description Provided by Google]</CODE> 3084 * <BR /> 3085 * <BR /><B>EXPERIMENTAL</B> 3086 */ 3087 public static class ClientSecurityState extends BaseType 3088 { 3089 /** For Object Serialization. java.io.Serializable */ 3090 protected static final long serialVersionUID = 1; 3091 3092 public boolean[] optionals() 3093 { return new boolean[] { false, false, false, }; } 3094 3095 /** <CODE>[No Description Provided by Google]</CODE> */ 3096 public final boolean initiatorIsSecureContext; 3097 3098 /** <CODE>[No Description Provided by Google]</CODE> */ 3099 public final String initiatorIPAddressSpace; 3100 3101 /** <CODE>[No Description Provided by Google]</CODE> */ 3102 public final String privateNetworkRequestPolicy; 3103 3104 /** 3105 * Constructor 3106 * 3107 * @param initiatorIsSecureContext - 3108 * 3109 * @param initiatorIPAddressSpace - 3110 * 3111 * @param privateNetworkRequestPolicy - 3112 */ 3113 public ClientSecurityState( 3114 boolean initiatorIsSecureContext, String initiatorIPAddressSpace, 3115 String privateNetworkRequestPolicy 3116 ) 3117 { 3118 // Exception-Check(s) to ensure that if any parameters which are not declared as 3119 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3120 3121 if (initiatorIPAddressSpace == null) BRDPC.throwNPE("initiatorIPAddressSpace"); 3122 if (privateNetworkRequestPolicy == null) BRDPC.throwNPE("privateNetworkRequestPolicy"); 3123 3124 // Exception-Check(s) to ensure that if any parameters which must adhere to a 3125 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 3126 3127 BRDPC.checkIAE("initiatorIPAddressSpace", initiatorIPAddressSpace, "Network.IPAddressSpace", Network.IPAddressSpace); 3128 BRDPC.checkIAE("privateNetworkRequestPolicy", privateNetworkRequestPolicy, "Network.PrivateNetworkRequestPolicy", Network.PrivateNetworkRequestPolicy); 3129 3130 this.initiatorIsSecureContext = initiatorIsSecureContext; 3131 this.initiatorIPAddressSpace = initiatorIPAddressSpace; 3132 this.privateNetworkRequestPolicy = privateNetworkRequestPolicy; 3133 } 3134 3135 /** 3136 * JSON Object Constructor 3137 * @param jo A Json-Object having data about an instance of {@code 'ClientSecurityState'}. 3138 */ 3139 public ClientSecurityState (JsonObject jo) 3140 { 3141 this.initiatorIsSecureContext = ReadJSON.getBoolean(jo, "initiatorIsSecureContext"); 3142 this.initiatorIPAddressSpace = ReadJSON.getString(jo, "initiatorIPAddressSpace", false, true); 3143 this.privateNetworkRequestPolicy = ReadJSON.getString(jo, "privateNetworkRequestPolicy", false, true); 3144 } 3145 3146 } 3147 3148 /** 3149 * <CODE>[No Description Provided by Google]</CODE> 3150 * <BR /> 3151 * <BR /><B>EXPERIMENTAL</B> 3152 */ 3153 public static class CrossOriginOpenerPolicyStatus extends BaseType 3154 { 3155 /** For Object Serialization. java.io.Serializable */ 3156 protected static final long serialVersionUID = 1; 3157 3158 public boolean[] optionals() 3159 { return new boolean[] { false, false, true, true, }; } 3160 3161 /** <CODE>[No Description Provided by Google]</CODE> */ 3162 public final String value; 3163 3164 /** <CODE>[No Description Provided by Google]</CODE> */ 3165 public final String reportOnlyValue; 3166 3167 /** 3168 * <CODE>[No Description Provided by Google]</CODE> 3169 * <BR /> 3170 * <BR /><B>OPTIONAL</B> 3171 */ 3172 public final String reportingEndpoint; 3173 3174 /** 3175 * <CODE>[No Description Provided by Google]</CODE> 3176 * <BR /> 3177 * <BR /><B>OPTIONAL</B> 3178 */ 3179 public final String reportOnlyReportingEndpoint; 3180 3181 /** 3182 * Constructor 3183 * 3184 * @param value - 3185 * 3186 * @param reportOnlyValue - 3187 * 3188 * @param reportingEndpoint - 3189 * <BR /><B>OPTIONAL</B> 3190 * 3191 * @param reportOnlyReportingEndpoint - 3192 * <BR /><B>OPTIONAL</B> 3193 */ 3194 public CrossOriginOpenerPolicyStatus( 3195 String value, String reportOnlyValue, String reportingEndpoint, 3196 String reportOnlyReportingEndpoint 3197 ) 3198 { 3199 // Exception-Check(s) to ensure that if any parameters which are not declared as 3200 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3201 3202 if (value == null) BRDPC.throwNPE("value"); 3203 if (reportOnlyValue == null) BRDPC.throwNPE("reportOnlyValue"); 3204 3205 // Exception-Check(s) to ensure that if any parameters which must adhere to a 3206 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 3207 3208 BRDPC.checkIAE("value", value, "Network.CrossOriginOpenerPolicyValue", Network.CrossOriginOpenerPolicyValue); 3209 BRDPC.checkIAE("reportOnlyValue", reportOnlyValue, "Network.CrossOriginOpenerPolicyValue", Network.CrossOriginOpenerPolicyValue); 3210 3211 this.value = value; 3212 this.reportOnlyValue = reportOnlyValue; 3213 this.reportingEndpoint = reportingEndpoint; 3214 this.reportOnlyReportingEndpoint = reportOnlyReportingEndpoint; 3215 } 3216 3217 /** 3218 * JSON Object Constructor 3219 * @param jo A Json-Object having data about an instance of {@code 'CrossOriginOpenerPolicyStatus'}. 3220 */ 3221 public CrossOriginOpenerPolicyStatus (JsonObject jo) 3222 { 3223 this.value = ReadJSON.getString(jo, "value", false, true); 3224 this.reportOnlyValue = ReadJSON.getString(jo, "reportOnlyValue", false, true); 3225 this.reportingEndpoint = ReadJSON.getString(jo, "reportingEndpoint", true, false); 3226 this.reportOnlyReportingEndpoint = ReadJSON.getString(jo, "reportOnlyReportingEndpoint", true, false); 3227 } 3228 3229 } 3230 3231 /** 3232 * <CODE>[No Description Provided by Google]</CODE> 3233 * <BR /> 3234 * <BR /><B>EXPERIMENTAL</B> 3235 */ 3236 public static class CrossOriginEmbedderPolicyStatus extends BaseType 3237 { 3238 /** For Object Serialization. java.io.Serializable */ 3239 protected static final long serialVersionUID = 1; 3240 3241 public boolean[] optionals() 3242 { return new boolean[] { false, false, true, true, }; } 3243 3244 /** <CODE>[No Description Provided by Google]</CODE> */ 3245 public final String value; 3246 3247 /** <CODE>[No Description Provided by Google]</CODE> */ 3248 public final String reportOnlyValue; 3249 3250 /** 3251 * <CODE>[No Description Provided by Google]</CODE> 3252 * <BR /> 3253 * <BR /><B>OPTIONAL</B> 3254 */ 3255 public final String reportingEndpoint; 3256 3257 /** 3258 * <CODE>[No Description Provided by Google]</CODE> 3259 * <BR /> 3260 * <BR /><B>OPTIONAL</B> 3261 */ 3262 public final String reportOnlyReportingEndpoint; 3263 3264 /** 3265 * Constructor 3266 * 3267 * @param value - 3268 * 3269 * @param reportOnlyValue - 3270 * 3271 * @param reportingEndpoint - 3272 * <BR /><B>OPTIONAL</B> 3273 * 3274 * @param reportOnlyReportingEndpoint - 3275 * <BR /><B>OPTIONAL</B> 3276 */ 3277 public CrossOriginEmbedderPolicyStatus( 3278 String value, String reportOnlyValue, String reportingEndpoint, 3279 String reportOnlyReportingEndpoint 3280 ) 3281 { 3282 // Exception-Check(s) to ensure that if any parameters which are not declared as 3283 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3284 3285 if (value == null) BRDPC.throwNPE("value"); 3286 if (reportOnlyValue == null) BRDPC.throwNPE("reportOnlyValue"); 3287 3288 // Exception-Check(s) to ensure that if any parameters which must adhere to a 3289 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 3290 3291 BRDPC.checkIAE("value", value, "Network.CrossOriginEmbedderPolicyValue", Network.CrossOriginEmbedderPolicyValue); 3292 BRDPC.checkIAE("reportOnlyValue", reportOnlyValue, "Network.CrossOriginEmbedderPolicyValue", Network.CrossOriginEmbedderPolicyValue); 3293 3294 this.value = value; 3295 this.reportOnlyValue = reportOnlyValue; 3296 this.reportingEndpoint = reportingEndpoint; 3297 this.reportOnlyReportingEndpoint = reportOnlyReportingEndpoint; 3298 } 3299 3300 /** 3301 * JSON Object Constructor 3302 * @param jo A Json-Object having data about an instance of {@code 'CrossOriginEmbedderPolicyStatus'}. 3303 */ 3304 public CrossOriginEmbedderPolicyStatus (JsonObject jo) 3305 { 3306 this.value = ReadJSON.getString(jo, "value", false, true); 3307 this.reportOnlyValue = ReadJSON.getString(jo, "reportOnlyValue", false, true); 3308 this.reportingEndpoint = ReadJSON.getString(jo, "reportingEndpoint", true, false); 3309 this.reportOnlyReportingEndpoint = ReadJSON.getString(jo, "reportOnlyReportingEndpoint", true, false); 3310 } 3311 3312 } 3313 3314 /** 3315 * <CODE>[No Description Provided by Google]</CODE> 3316 * <BR /> 3317 * <BR /><B>EXPERIMENTAL</B> 3318 */ 3319 public static class SecurityIsolationStatus extends BaseType 3320 { 3321 /** For Object Serialization. java.io.Serializable */ 3322 protected static final long serialVersionUID = 1; 3323 3324 public boolean[] optionals() 3325 { return new boolean[] { true, true, }; } 3326 3327 /** 3328 * <CODE>[No Description Provided by Google]</CODE> 3329 * <BR /> 3330 * <BR /><B>OPTIONAL</B> 3331 */ 3332 public final Network.CrossOriginOpenerPolicyStatus coop; 3333 3334 /** 3335 * <CODE>[No Description Provided by Google]</CODE> 3336 * <BR /> 3337 * <BR /><B>OPTIONAL</B> 3338 */ 3339 public final Network.CrossOriginEmbedderPolicyStatus coep; 3340 3341 /** 3342 * Constructor 3343 * 3344 * @param coop - 3345 * <BR /><B>OPTIONAL</B> 3346 * 3347 * @param coep - 3348 * <BR /><B>OPTIONAL</B> 3349 */ 3350 public SecurityIsolationStatus( 3351 Network.CrossOriginOpenerPolicyStatus coop, 3352 Network.CrossOriginEmbedderPolicyStatus coep 3353 ) 3354 { 3355 this.coop = coop; 3356 this.coep = coep; 3357 } 3358 3359 /** 3360 * JSON Object Constructor 3361 * @param jo A Json-Object having data about an instance of {@code 'SecurityIsolationStatus'}. 3362 */ 3363 public SecurityIsolationStatus (JsonObject jo) 3364 { 3365 this.coop = ReadJSON.XL.getObject(jo, "coop", Network.CrossOriginOpenerPolicyStatus.class, true, false); 3366 this.coep = ReadJSON.XL.getObject(jo, "coep", Network.CrossOriginEmbedderPolicyStatus.class, true, false); 3367 } 3368 3369 } 3370 3371 /** 3372 * An object representing a report generated by the Reporting API. 3373 * <BR /> 3374 * <BR /><B>EXPERIMENTAL</B> 3375 */ 3376 public static class ReportingApiReport extends BaseType 3377 { 3378 /** For Object Serialization. java.io.Serializable */ 3379 protected static final long serialVersionUID = 1; 3380 3381 public boolean[] optionals() 3382 { return new boolean[] { false, false, false, false, false, false, false, false, false, }; } 3383 3384 /** <CODE>[No Description Provided by Google]</CODE> */ 3385 public final String id; 3386 3387 /** The URL of the document that triggered the report. */ 3388 public final String initiatorUrl; 3389 3390 /** The name of the endpoint group that should be used to deliver the report. */ 3391 public final String destination; 3392 3393 /** The type of the report (specifies the set of data that is contained in the report body). */ 3394 public final String type; 3395 3396 /** When the report was generated. */ 3397 public final Number timestamp; 3398 3399 /** How many uploads deep the related request was. */ 3400 public final int depth; 3401 3402 /** The number of delivery attempts made so far, not including an active attempt. */ 3403 public final int completedAttempts; 3404 3405 /** <CODE>[No Description Provided by Google]</CODE> */ 3406 public final JsonObject body; 3407 3408 /** <CODE>[No Description Provided by Google]</CODE> */ 3409 public final String status; 3410 3411 /** 3412 * Constructor 3413 * 3414 * @param id - 3415 * 3416 * @param initiatorUrl The URL of the document that triggered the report. 3417 * 3418 * @param destination The name of the endpoint group that should be used to deliver the report. 3419 * 3420 * @param type The type of the report (specifies the set of data that is contained in the report body). 3421 * 3422 * @param timestamp When the report was generated. 3423 * 3424 * @param depth How many uploads deep the related request was. 3425 * 3426 * @param completedAttempts The number of delivery attempts made so far, not including an active attempt. 3427 * 3428 * @param body - 3429 * 3430 * @param status - 3431 */ 3432 public ReportingApiReport( 3433 String id, String initiatorUrl, String destination, String type, Number timestamp, 3434 int depth, int completedAttempts, JsonObject body, String status 3435 ) 3436 { 3437 // Exception-Check(s) to ensure that if any parameters which are not declared as 3438 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3439 3440 if (id == null) BRDPC.throwNPE("id"); 3441 if (initiatorUrl == null) BRDPC.throwNPE("initiatorUrl"); 3442 if (destination == null) BRDPC.throwNPE("destination"); 3443 if (type == null) BRDPC.throwNPE("type"); 3444 if (timestamp == null) BRDPC.throwNPE("timestamp"); 3445 if (body == null) BRDPC.throwNPE("body"); 3446 if (status == null) BRDPC.throwNPE("status"); 3447 3448 // Exception-Check(s) to ensure that if any parameters which must adhere to a 3449 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 3450 3451 BRDPC.checkIAE("status", status, "Network.ReportStatus", Network.ReportStatus); 3452 3453 this.id = id; 3454 this.initiatorUrl = initiatorUrl; 3455 this.destination = destination; 3456 this.type = type; 3457 this.timestamp = timestamp; 3458 this.depth = depth; 3459 this.completedAttempts = completedAttempts; 3460 this.body = body; 3461 this.status = status; 3462 } 3463 3464 /** 3465 * JSON Object Constructor 3466 * @param jo A Json-Object having data about an instance of {@code 'ReportingApiReport'}. 3467 */ 3468 public ReportingApiReport (JsonObject jo) 3469 { 3470 this.id = ReadJSON.getString(jo, "id", false, true); 3471 this.initiatorUrl = ReadJSON.getString(jo, "initiatorUrl", false, true); 3472 this.destination = ReadJSON.getString(jo, "destination", false, true); 3473 this.type = ReadJSON.getString(jo, "type", false, true); 3474 this.timestamp = ReadJSON.getNUMBER(jo, "timestamp", false, true); 3475 this.depth = ReadJSON.getInt(jo, "depth"); 3476 this.completedAttempts = ReadJSON.getInt(jo, "completedAttempts"); 3477 this.body = jo.getJsonObject("body"); 3478 this.status = ReadJSON.getString(jo, "status", false, true); 3479 } 3480 3481 } 3482 3483 /** 3484 * An object providing the result of a network resource load. 3485 * <BR /> 3486 * <BR /><B>EXPERIMENTAL</B> 3487 */ 3488 public static class LoadNetworkResourcePageResult extends BaseType 3489 { 3490 /** For Object Serialization. java.io.Serializable */ 3491 protected static final long serialVersionUID = 1; 3492 3493 public boolean[] optionals() 3494 { return new boolean[] { false, true, true, true, true, true, }; } 3495 3496 /** <CODE>[No Description Provided by Google]</CODE> */ 3497 public final boolean success; 3498 3499 /** 3500 * Optional values used for error reporting. 3501 * <BR /> 3502 * <BR /><B>OPTIONAL</B> 3503 */ 3504 public final Number netError; 3505 3506 /** 3507 * <CODE>[No Description Provided by Google]</CODE> 3508 * <BR /> 3509 * <BR /><B>OPTIONAL</B> 3510 */ 3511 public final String netErrorName; 3512 3513 /** 3514 * <CODE>[No Description Provided by Google]</CODE> 3515 * <BR /> 3516 * <BR /><B>OPTIONAL</B> 3517 */ 3518 public final Number httpStatusCode; 3519 3520 /** 3521 * If successful, one of the following two fields holds the result. 3522 * <BR /> 3523 * <BR /><B>OPTIONAL</B> 3524 */ 3525 public final String stream; 3526 3527 /** 3528 * Response headers. 3529 * <BR /> 3530 * <BR /><B>OPTIONAL</B> 3531 */ 3532 public final JsonObject headers; 3533 3534 /** 3535 * Constructor 3536 * 3537 * @param success - 3538 * 3539 * @param netError Optional values used for error reporting. 3540 * <BR /><B>OPTIONAL</B> 3541 * 3542 * @param netErrorName - 3543 * <BR /><B>OPTIONAL</B> 3544 * 3545 * @param httpStatusCode - 3546 * <BR /><B>OPTIONAL</B> 3547 * 3548 * @param stream If successful, one of the following two fields holds the result. 3549 * <BR /><B>OPTIONAL</B> 3550 * 3551 * @param headers Response headers. 3552 * <BR /><B>OPTIONAL</B> 3553 */ 3554 public LoadNetworkResourcePageResult( 3555 boolean success, Number netError, String netErrorName, Number httpStatusCode, 3556 String stream, JsonObject headers 3557 ) 3558 { 3559 this.success = success; 3560 this.netError = netError; 3561 this.netErrorName = netErrorName; 3562 this.httpStatusCode = httpStatusCode; 3563 this.stream = stream; 3564 this.headers = headers; 3565 } 3566 3567 /** 3568 * JSON Object Constructor 3569 * @param jo A Json-Object having data about an instance of {@code 'LoadNetworkResourcePageResult'}. 3570 */ 3571 public LoadNetworkResourcePageResult (JsonObject jo) 3572 { 3573 this.success = ReadJSON.getBoolean(jo, "success"); 3574 this.netError = ReadJSON.getNUMBER(jo, "netError", true, false); 3575 this.netErrorName = ReadJSON.getString(jo, "netErrorName", true, false); 3576 this.httpStatusCode = ReadJSON.getNUMBER(jo, "httpStatusCode", true, false); 3577 this.stream = ReadJSON.getString(jo, "stream", true, false); 3578 this.headers = jo.getJsonObject("headers"); 3579 } 3580 3581 } 3582 3583 /** 3584 * An options object that may be extended later to better support CORS, 3585 * CORB and streaming. 3586 * <BR /> 3587 * <BR /><B>EXPERIMENTAL</B> 3588 */ 3589 public static class LoadNetworkResourceOptions extends BaseType 3590 { 3591 /** For Object Serialization. java.io.Serializable */ 3592 protected static final long serialVersionUID = 1; 3593 3594 public boolean[] optionals() 3595 { return new boolean[] { false, false, }; } 3596 3597 /** <CODE>[No Description Provided by Google]</CODE> */ 3598 public final boolean disableCache; 3599 3600 /** <CODE>[No Description Provided by Google]</CODE> */ 3601 public final boolean includeCredentials; 3602 3603 /** 3604 * Constructor 3605 * 3606 * @param disableCache - 3607 * 3608 * @param includeCredentials - 3609 */ 3610 public LoadNetworkResourceOptions(boolean disableCache, boolean includeCredentials) 3611 { 3612 this.disableCache = disableCache; 3613 this.includeCredentials = includeCredentials; 3614 } 3615 3616 /** 3617 * JSON Object Constructor 3618 * @param jo A Json-Object having data about an instance of {@code 'LoadNetworkResourceOptions'}. 3619 */ 3620 public LoadNetworkResourceOptions (JsonObject jo) 3621 { 3622 this.disableCache = ReadJSON.getBoolean(jo, "disableCache"); 3623 this.includeCredentials = ReadJSON.getBoolean(jo, "includeCredentials"); 3624 } 3625 3626 } 3627 3628 /** Fired when data chunk was received over the network. */ 3629 public static class dataReceived extends BrowserEvent 3630 { 3631 /** For Object Serialization. java.io.Serializable */ 3632 protected static final long serialVersionUID = 1; 3633 3634 public boolean[] optionals() 3635 { return new boolean[] { false, false, false, false, }; } 3636 3637 /** Request identifier. */ 3638 public final String requestId; 3639 3640 /** Timestamp. */ 3641 public final Number timestamp; 3642 3643 /** Data chunk length. */ 3644 public final int dataLength; 3645 3646 /** Actual bytes received (might be less than dataLength for compressed encodings). */ 3647 public final int encodedDataLength; 3648 3649 /** 3650 * Constructor 3651 * 3652 * @param requestId Request identifier. 3653 * 3654 * @param timestamp Timestamp. 3655 * 3656 * @param dataLength Data chunk length. 3657 * 3658 * @param encodedDataLength Actual bytes received (might be less than dataLength for compressed encodings). 3659 */ 3660 public dataReceived 3661 (String requestId, Number timestamp, int dataLength, int encodedDataLength) 3662 { 3663 super("Network", "dataReceived", 4); 3664 3665 // Exception-Check(s) to ensure that if any parameters which are not declared as 3666 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3667 3668 if (requestId == null) BRDPC.throwNPE("requestId"); 3669 if (timestamp == null) BRDPC.throwNPE("timestamp"); 3670 3671 this.requestId = requestId; 3672 this.timestamp = timestamp; 3673 this.dataLength = dataLength; 3674 this.encodedDataLength = encodedDataLength; 3675 } 3676 3677 /** 3678 * JSON Object Constructor 3679 * @param jo A Json-Object having data about an instance of {@code 'dataReceived'}. 3680 */ 3681 public dataReceived (JsonObject jo) 3682 { 3683 super("Network", "dataReceived", 4); 3684 3685 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 3686 this.timestamp = ReadJSON.getNUMBER(jo, "timestamp", false, true); 3687 this.dataLength = ReadJSON.getInt(jo, "dataLength"); 3688 this.encodedDataLength = ReadJSON.getInt(jo, "encodedDataLength"); 3689 } 3690 3691 } 3692 3693 /** Fired when EventSource message is received. */ 3694 public static class eventSourceMessageReceived extends BrowserEvent 3695 { 3696 /** For Object Serialization. java.io.Serializable */ 3697 protected static final long serialVersionUID = 1; 3698 3699 public boolean[] optionals() 3700 { return new boolean[] { false, false, false, false, false, }; } 3701 3702 /** Request identifier. */ 3703 public final String requestId; 3704 3705 /** Timestamp. */ 3706 public final Number timestamp; 3707 3708 /** Message type. */ 3709 public final String eventName; 3710 3711 /** Message identifier. */ 3712 public final String eventId; 3713 3714 /** Message content. */ 3715 public final String data; 3716 3717 /** 3718 * Constructor 3719 * 3720 * @param requestId Request identifier. 3721 * 3722 * @param timestamp Timestamp. 3723 * 3724 * @param eventName Message type. 3725 * 3726 * @param eventId Message identifier. 3727 * 3728 * @param data Message content. 3729 */ 3730 public eventSourceMessageReceived 3731 (String requestId, Number timestamp, String eventName, String eventId, String data) 3732 { 3733 super("Network", "eventSourceMessageReceived", 5); 3734 3735 // Exception-Check(s) to ensure that if any parameters which are not declared as 3736 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3737 3738 if (requestId == null) BRDPC.throwNPE("requestId"); 3739 if (timestamp == null) BRDPC.throwNPE("timestamp"); 3740 if (eventName == null) BRDPC.throwNPE("eventName"); 3741 if (eventId == null) BRDPC.throwNPE("eventId"); 3742 if (data == null) BRDPC.throwNPE("data"); 3743 3744 this.requestId = requestId; 3745 this.timestamp = timestamp; 3746 this.eventName = eventName; 3747 this.eventId = eventId; 3748 this.data = data; 3749 } 3750 3751 /** 3752 * JSON Object Constructor 3753 * @param jo A Json-Object having data about an instance of {@code 'eventSourceMessageReceived'}. 3754 */ 3755 public eventSourceMessageReceived (JsonObject jo) 3756 { 3757 super("Network", "eventSourceMessageReceived", 5); 3758 3759 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 3760 this.timestamp = ReadJSON.getNUMBER(jo, "timestamp", false, true); 3761 this.eventName = ReadJSON.getString(jo, "eventName", false, true); 3762 this.eventId = ReadJSON.getString(jo, "eventId", false, true); 3763 this.data = ReadJSON.getString(jo, "data", false, true); 3764 } 3765 3766 } 3767 3768 /** Fired when HTTP request has failed to load. */ 3769 public static class loadingFailed extends BrowserEvent 3770 { 3771 /** For Object Serialization. java.io.Serializable */ 3772 protected static final long serialVersionUID = 1; 3773 3774 public boolean[] optionals() 3775 { return new boolean[] { false, false, false, false, true, true, true, }; } 3776 3777 /** Request identifier. */ 3778 public final String requestId; 3779 3780 /** Timestamp. */ 3781 public final Number timestamp; 3782 3783 /** Resource type. */ 3784 public final String type; 3785 3786 /** User friendly error message. */ 3787 public final String errorText; 3788 3789 /** 3790 * True if loading was canceled. 3791 * <BR /> 3792 * <BR /><B>OPTIONAL</B> 3793 */ 3794 public final Boolean canceled; 3795 3796 /** 3797 * The reason why loading was blocked, if any. 3798 * <BR /> 3799 * <BR /><B>OPTIONAL</B> 3800 */ 3801 public final String blockedReason; 3802 3803 /** 3804 * The reason why loading was blocked by CORS, if any. 3805 * <BR /> 3806 * <BR /><B>OPTIONAL</B> 3807 */ 3808 public final Network.CorsErrorStatus corsErrorStatus; 3809 3810 /** 3811 * Constructor 3812 * 3813 * @param requestId Request identifier. 3814 * 3815 * @param timestamp Timestamp. 3816 * 3817 * @param type Resource type. 3818 * 3819 * @param errorText User friendly error message. 3820 * 3821 * @param canceled True if loading was canceled. 3822 * <BR /><B>OPTIONAL</B> 3823 * 3824 * @param blockedReason The reason why loading was blocked, if any. 3825 * <BR /><B>OPTIONAL</B> 3826 * 3827 * @param corsErrorStatus The reason why loading was blocked by CORS, if any. 3828 * <BR /><B>OPTIONAL</B> 3829 */ 3830 public loadingFailed( 3831 String requestId, Number timestamp, String type, String errorText, Boolean canceled, 3832 String blockedReason, Network.CorsErrorStatus corsErrorStatus 3833 ) 3834 { 3835 super("Network", "loadingFailed", 7); 3836 3837 // Exception-Check(s) to ensure that if any parameters which are not declared as 3838 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3839 3840 if (requestId == null) BRDPC.throwNPE("requestId"); 3841 if (timestamp == null) BRDPC.throwNPE("timestamp"); 3842 if (type == null) BRDPC.throwNPE("type"); 3843 if (errorText == null) BRDPC.throwNPE("errorText"); 3844 3845 // Exception-Check(s) to ensure that if any parameters which must adhere to a 3846 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 3847 3848 BRDPC.checkIAE("type", type, "Network.ResourceType", Network.ResourceType); 3849 BRDPC.checkIAE("blockedReason", blockedReason, "Network.BlockedReason", Network.BlockedReason); 3850 3851 this.requestId = requestId; 3852 this.timestamp = timestamp; 3853 this.type = type; 3854 this.errorText = errorText; 3855 this.canceled = canceled; 3856 this.blockedReason = blockedReason; 3857 this.corsErrorStatus = corsErrorStatus; 3858 } 3859 3860 /** 3861 * JSON Object Constructor 3862 * @param jo A Json-Object having data about an instance of {@code 'loadingFailed'}. 3863 */ 3864 public loadingFailed (JsonObject jo) 3865 { 3866 super("Network", "loadingFailed", 7); 3867 3868 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 3869 this.timestamp = ReadJSON.getNUMBER(jo, "timestamp", false, true); 3870 this.type = ReadJSON.getString(jo, "type", false, true); 3871 this.errorText = ReadJSON.getString(jo, "errorText", false, true); 3872 this.canceled = ReadJSON.getBOOLEAN(jo, "canceled", true); 3873 this.blockedReason = ReadJSON.getString(jo, "blockedReason", true, false); 3874 this.corsErrorStatus = ReadJSON.XL.getObject(jo, "corsErrorStatus", Network.CorsErrorStatus.class, true, false); 3875 } 3876 3877 } 3878 3879 /** Fired when HTTP request has finished loading. */ 3880 public static class loadingFinished extends BrowserEvent 3881 { 3882 /** For Object Serialization. java.io.Serializable */ 3883 protected static final long serialVersionUID = 1; 3884 3885 public boolean[] optionals() 3886 { return new boolean[] { false, false, false, true, }; } 3887 3888 /** Request identifier. */ 3889 public final String requestId; 3890 3891 /** Timestamp. */ 3892 public final Number timestamp; 3893 3894 /** Total number of bytes received for this request. */ 3895 public final Number encodedDataLength; 3896 3897 /** 3898 * Set when 1) response was blocked by Cross-Origin Read Blocking and also 3899 * 2) this needs to be reported to the DevTools console. 3900 * <BR /> 3901 * <BR /><B>OPTIONAL</B> 3902 */ 3903 public final Boolean shouldReportCorbBlocking; 3904 3905 /** 3906 * Constructor 3907 * 3908 * @param requestId Request identifier. 3909 * 3910 * @param timestamp Timestamp. 3911 * 3912 * @param encodedDataLength Total number of bytes received for this request. 3913 * 3914 * @param shouldReportCorbBlocking 3915 * Set when 1) response was blocked by Cross-Origin Read Blocking and also 3916 * 2) this needs to be reported to the DevTools console. 3917 * <BR /><B>OPTIONAL</B> 3918 */ 3919 public loadingFinished( 3920 String requestId, Number timestamp, Number encodedDataLength, 3921 Boolean shouldReportCorbBlocking 3922 ) 3923 { 3924 super("Network", "loadingFinished", 4); 3925 3926 // Exception-Check(s) to ensure that if any parameters which are not declared as 3927 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3928 3929 if (requestId == null) BRDPC.throwNPE("requestId"); 3930 if (timestamp == null) BRDPC.throwNPE("timestamp"); 3931 if (encodedDataLength == null) BRDPC.throwNPE("encodedDataLength"); 3932 3933 this.requestId = requestId; 3934 this.timestamp = timestamp; 3935 this.encodedDataLength = encodedDataLength; 3936 this.shouldReportCorbBlocking = shouldReportCorbBlocking; 3937 } 3938 3939 /** 3940 * JSON Object Constructor 3941 * @param jo A Json-Object having data about an instance of {@code 'loadingFinished'}. 3942 */ 3943 public loadingFinished (JsonObject jo) 3944 { 3945 super("Network", "loadingFinished", 4); 3946 3947 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 3948 this.timestamp = ReadJSON.getNUMBER(jo, "timestamp", false, true); 3949 this.encodedDataLength = ReadJSON.getNUMBER(jo, "encodedDataLength", false, true); 3950 this.shouldReportCorbBlocking = ReadJSON.getBOOLEAN(jo, "shouldReportCorbBlocking", true); 3951 } 3952 3953 } 3954 3955 /** 3956 * Details of an intercepted HTTP request, which must be either allowed, blocked, modified or 3957 * mocked. 3958 * Deprecated, use Fetch.requestPaused instead. 3959 * <BR /> 3960 * <BR /><B>EXPERIMENTAL</B> 3961 * <BR /><B>DEPRECATED</B> 3962 */ 3963 public static class requestIntercepted extends BrowserEvent 3964 { 3965 /** For Object Serialization. java.io.Serializable */ 3966 protected static final long serialVersionUID = 1; 3967 3968 public boolean[] optionals() 3969 { return new boolean[] { false, false, false, false, false, true, true, true, true, true, true, true, }; } 3970 3971 /** 3972 * Each request the page makes will have a unique id, however if any redirects are encountered 3973 * while processing that fetch, they will be reported with the same id as the original fetch. 3974 * Likewise if HTTP authentication is needed then the same fetch id will be used. 3975 */ 3976 public final String interceptionId; 3977 3978 /** <CODE>[No Description Provided by Google]</CODE> */ 3979 public final Network.Request request; 3980 3981 /** The id of the frame that initiated the request. */ 3982 public final String frameId; 3983 3984 /** How the requested resource will be used. */ 3985 public final String resourceType; 3986 3987 /** Whether this is a navigation request, which can abort the navigation completely. */ 3988 public final boolean isNavigationRequest; 3989 3990 /** 3991 * Set if the request is a navigation that will result in a download. 3992 * Only present after response is received from the server (i.e. HeadersReceived stage). 3993 * <BR /> 3994 * <BR /><B>OPTIONAL</B> 3995 */ 3996 public final Boolean isDownload; 3997 3998 /** 3999 * Redirect location, only sent if a redirect was intercepted. 4000 * <BR /> 4001 * <BR /><B>OPTIONAL</B> 4002 */ 4003 public final String redirectUrl; 4004 4005 /** 4006 * Details of the Authorization Challenge encountered. If this is set then 4007 * continueInterceptedRequest must contain an authChallengeResponse. 4008 * <BR /> 4009 * <BR /><B>OPTIONAL</B> 4010 */ 4011 public final Network.AuthChallenge authChallenge; 4012 4013 /** 4014 * Response error if intercepted at response stage or if redirect occurred while intercepting 4015 * request. 4016 * <BR /> 4017 * <BR /><B>OPTIONAL</B> 4018 */ 4019 public final String responseErrorReason; 4020 4021 /** 4022 * Response code if intercepted at response stage or if redirect occurred while intercepting 4023 * request or auth retry occurred. 4024 * <BR /> 4025 * <BR /><B>OPTIONAL</B> 4026 */ 4027 public final Integer responseStatusCode; 4028 4029 /** 4030 * Response headers if intercepted at the response stage or if redirect occurred while 4031 * intercepting request or auth retry occurred. 4032 * <BR /> 4033 * <BR /><B>OPTIONAL</B> 4034 */ 4035 public final JsonObject responseHeaders; 4036 4037 /** 4038 * If the intercepted request had a corresponding requestWillBeSent event fired for it, then 4039 * this requestId will be the same as the requestId present in the requestWillBeSent event. 4040 * <BR /> 4041 * <BR /><B>OPTIONAL</B> 4042 */ 4043 public final String requestId; 4044 4045 /** 4046 * Constructor 4047 * 4048 * @param interceptionId 4049 * Each request the page makes will have a unique id, however if any redirects are encountered 4050 * while processing that fetch, they will be reported with the same id as the original fetch. 4051 * Likewise if HTTP authentication is needed then the same fetch id will be used. 4052 * 4053 * @param request - 4054 * 4055 * @param frameId The id of the frame that initiated the request. 4056 * 4057 * @param resourceType How the requested resource will be used. 4058 * 4059 * @param isNavigationRequest Whether this is a navigation request, which can abort the navigation completely. 4060 * 4061 * @param isDownload 4062 * Set if the request is a navigation that will result in a download. 4063 * Only present after response is received from the server (i.e. HeadersReceived stage). 4064 * <BR /><B>OPTIONAL</B> 4065 * 4066 * @param redirectUrl Redirect location, only sent if a redirect was intercepted. 4067 * <BR /><B>OPTIONAL</B> 4068 * 4069 * @param authChallenge 4070 * Details of the Authorization Challenge encountered. If this is set then 4071 * continueInterceptedRequest must contain an authChallengeResponse. 4072 * <BR /><B>OPTIONAL</B> 4073 * 4074 * @param responseErrorReason 4075 * Response error if intercepted at response stage or if redirect occurred while intercepting 4076 * request. 4077 * <BR /><B>OPTIONAL</B> 4078 * 4079 * @param responseStatusCode 4080 * Response code if intercepted at response stage or if redirect occurred while intercepting 4081 * request or auth retry occurred. 4082 * <BR /><B>OPTIONAL</B> 4083 * 4084 * @param responseHeaders 4085 * Response headers if intercepted at the response stage or if redirect occurred while 4086 * intercepting request or auth retry occurred. 4087 * <BR /><B>OPTIONAL</B> 4088 * 4089 * @param requestId 4090 * If the intercepted request had a corresponding requestWillBeSent event fired for it, then 4091 * this requestId will be the same as the requestId present in the requestWillBeSent event. 4092 * <BR /><B>OPTIONAL</B> 4093 */ 4094 public requestIntercepted( 4095 String interceptionId, Network.Request request, String frameId, String resourceType, 4096 boolean isNavigationRequest, Boolean isDownload, String redirectUrl, 4097 Network.AuthChallenge authChallenge, String responseErrorReason, 4098 Integer responseStatusCode, JsonObject responseHeaders, String requestId 4099 ) 4100 { 4101 super("Network", "requestIntercepted", 12); 4102 4103 // Exception-Check(s) to ensure that if any parameters which are not declared as 4104 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4105 4106 if (interceptionId == null) BRDPC.throwNPE("interceptionId"); 4107 if (request == null) BRDPC.throwNPE("request"); 4108 if (frameId == null) BRDPC.throwNPE("frameId"); 4109 if (resourceType == null) BRDPC.throwNPE("resourceType"); 4110 4111 // Exception-Check(s) to ensure that if any parameters which must adhere to a 4112 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 4113 4114 BRDPC.checkIAE("resourceType", resourceType, "Network.ResourceType", Network.ResourceType); 4115 BRDPC.checkIAE("responseErrorReason", responseErrorReason, "Network.ErrorReason", Network.ErrorReason); 4116 4117 this.interceptionId = interceptionId; 4118 this.request = request; 4119 this.frameId = frameId; 4120 this.resourceType = resourceType; 4121 this.isNavigationRequest = isNavigationRequest; 4122 this.isDownload = isDownload; 4123 this.redirectUrl = redirectUrl; 4124 this.authChallenge = authChallenge; 4125 this.responseErrorReason = responseErrorReason; 4126 this.responseStatusCode = responseStatusCode; 4127 this.responseHeaders = responseHeaders; 4128 this.requestId = requestId; 4129 } 4130 4131 /** 4132 * JSON Object Constructor 4133 * @param jo A Json-Object having data about an instance of {@code 'requestIntercepted'}. 4134 */ 4135 public requestIntercepted (JsonObject jo) 4136 { 4137 super("Network", "requestIntercepted", 12); 4138 4139 this.interceptionId = ReadJSON.getString(jo, "interceptionId", false, true); 4140 this.request = ReadJSON.XL.getObject(jo, "request", Network.Request.class, false, true); 4141 this.frameId = ReadJSON.getString(jo, "frameId", false, true); 4142 this.resourceType = ReadJSON.getString(jo, "resourceType", false, true); 4143 this.isNavigationRequest = ReadJSON.getBoolean(jo, "isNavigationRequest"); 4144 this.isDownload = ReadJSON.getBOOLEAN(jo, "isDownload", true); 4145 this.redirectUrl = ReadJSON.getString(jo, "redirectUrl", true, false); 4146 this.authChallenge = ReadJSON.XL.getObject(jo, "authChallenge", Network.AuthChallenge.class, true, false); 4147 this.responseErrorReason = ReadJSON.getString(jo, "responseErrorReason", true, false); 4148 this.responseStatusCode = ReadJSON.getINTEGER(jo, "responseStatusCode", true); 4149 this.responseHeaders = jo.getJsonObject("responseHeaders"); 4150 this.requestId = ReadJSON.getString(jo, "requestId", true, false); 4151 } 4152 4153 } 4154 4155 /** Fired if request ended up loading from cache. */ 4156 public static class requestServedFromCache extends BrowserEvent 4157 { 4158 /** For Object Serialization. java.io.Serializable */ 4159 protected static final long serialVersionUID = 1; 4160 4161 public boolean[] optionals() 4162 { return new boolean[] { false, }; } 4163 4164 /** Request identifier. */ 4165 public final String requestId; 4166 4167 /** 4168 * Constructor 4169 * 4170 * @param requestId Request identifier. 4171 */ 4172 public requestServedFromCache(String requestId) 4173 { 4174 super("Network", "requestServedFromCache", 1); 4175 4176 // Exception-Check(s) to ensure that if any parameters which are not declared as 4177 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4178 4179 if (requestId == null) BRDPC.throwNPE("requestId"); 4180 4181 this.requestId = requestId; 4182 } 4183 4184 /** 4185 * JSON Object Constructor 4186 * @param jo A Json-Object having data about an instance of {@code 'requestServedFromCache'}. 4187 */ 4188 public requestServedFromCache (JsonObject jo) 4189 { 4190 super("Network", "requestServedFromCache", 1); 4191 4192 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 4193 } 4194 4195 } 4196 4197 /** Fired when page is about to send HTTP request. */ 4198 public static class requestWillBeSent extends BrowserEvent 4199 { 4200 /** For Object Serialization. java.io.Serializable */ 4201 protected static final long serialVersionUID = 1; 4202 4203 public boolean[] optionals() 4204 { return new boolean[] { false, false, false, false, false, false, false, false, true, true, true, true, }; } 4205 4206 /** Request identifier. */ 4207 public final String requestId; 4208 4209 /** Loader identifier. Empty string if the request is fetched from worker. */ 4210 public final String loaderId; 4211 4212 /** URL of the document this request is loaded for. */ 4213 public final String documentURL; 4214 4215 /** Request data. */ 4216 public final Network.Request request; 4217 4218 /** Timestamp. */ 4219 public final Number timestamp; 4220 4221 /** Timestamp. */ 4222 public final Number wallTime; 4223 4224 /** Request initiator. */ 4225 public final Network.Initiator initiator; 4226 4227 /** 4228 * In the case that redirectResponse is populated, this flag indicates whether 4229 * requestWillBeSentExtraInfo and responseReceivedExtraInfo events will be or were emitted 4230 * for the request which was just redirected. 4231 * <BR /> 4232 * <BR /><B>EXPERIMENTAL</B> 4233 */ 4234 public final boolean redirectHasExtraInfo; 4235 4236 /** 4237 * Redirect response data. 4238 * <BR /> 4239 * <BR /><B>OPTIONAL</B> 4240 */ 4241 public final Network.Response redirectResponse; 4242 4243 /** 4244 * Type of this resource. 4245 * <BR /> 4246 * <BR /><B>OPTIONAL</B> 4247 */ 4248 public final String type; 4249 4250 /** 4251 * Frame identifier. 4252 * <BR /> 4253 * <BR /><B>OPTIONAL</B> 4254 */ 4255 public final String frameId; 4256 4257 /** 4258 * Whether the request is initiated by a user gesture. Defaults to false. 4259 * <BR /> 4260 * <BR /><B>OPTIONAL</B> 4261 */ 4262 public final Boolean hasUserGesture; 4263 4264 /** 4265 * Constructor 4266 * 4267 * @param requestId Request identifier. 4268 * 4269 * @param loaderId Loader identifier. Empty string if the request is fetched from worker. 4270 * 4271 * @param documentURL URL of the document this request is loaded for. 4272 * 4273 * @param request Request data. 4274 * 4275 * @param timestamp Timestamp. 4276 * 4277 * @param wallTime Timestamp. 4278 * 4279 * @param initiator Request initiator. 4280 * 4281 * @param redirectHasExtraInfo 4282 * In the case that redirectResponse is populated, this flag indicates whether 4283 * requestWillBeSentExtraInfo and responseReceivedExtraInfo events will be or were emitted 4284 * for the request which was just redirected. 4285 * <BR /><B>EXPERIMENTAL</B> 4286 * 4287 * @param redirectResponse Redirect response data. 4288 * <BR /><B>OPTIONAL</B> 4289 * 4290 * @param type Type of this resource. 4291 * <BR /><B>OPTIONAL</B> 4292 * 4293 * @param frameId Frame identifier. 4294 * <BR /><B>OPTIONAL</B> 4295 * 4296 * @param hasUserGesture Whether the request is initiated by a user gesture. Defaults to false. 4297 * <BR /><B>OPTIONAL</B> 4298 */ 4299 public requestWillBeSent( 4300 String requestId, String loaderId, String documentURL, Network.Request request, 4301 Number timestamp, Number wallTime, Network.Initiator initiator, 4302 boolean redirectHasExtraInfo, Network.Response redirectResponse, String type, 4303 String frameId, Boolean hasUserGesture 4304 ) 4305 { 4306 super("Network", "requestWillBeSent", 12); 4307 4308 // Exception-Check(s) to ensure that if any parameters which are not declared as 4309 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4310 4311 if (requestId == null) BRDPC.throwNPE("requestId"); 4312 if (loaderId == null) BRDPC.throwNPE("loaderId"); 4313 if (documentURL == null) BRDPC.throwNPE("documentURL"); 4314 if (request == null) BRDPC.throwNPE("request"); 4315 if (timestamp == null) BRDPC.throwNPE("timestamp"); 4316 if (wallTime == null) BRDPC.throwNPE("wallTime"); 4317 if (initiator == null) BRDPC.throwNPE("initiator"); 4318 4319 // Exception-Check(s) to ensure that if any parameters which must adhere to a 4320 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 4321 4322 BRDPC.checkIAE("type", type, "Network.ResourceType", Network.ResourceType); 4323 4324 this.requestId = requestId; 4325 this.loaderId = loaderId; 4326 this.documentURL = documentURL; 4327 this.request = request; 4328 this.timestamp = timestamp; 4329 this.wallTime = wallTime; 4330 this.initiator = initiator; 4331 this.redirectHasExtraInfo = redirectHasExtraInfo; 4332 this.redirectResponse = redirectResponse; 4333 this.type = type; 4334 this.frameId = frameId; 4335 this.hasUserGesture = hasUserGesture; 4336 } 4337 4338 /** 4339 * JSON Object Constructor 4340 * @param jo A Json-Object having data about an instance of {@code 'requestWillBeSent'}. 4341 */ 4342 public requestWillBeSent (JsonObject jo) 4343 { 4344 super("Network", "requestWillBeSent", 12); 4345 4346 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 4347 this.loaderId = ReadJSON.getString(jo, "loaderId", false, true); 4348 this.documentURL = ReadJSON.getString(jo, "documentURL", false, true); 4349 this.request = ReadJSON.XL.getObject(jo, "request", Network.Request.class, false, true); 4350 this.timestamp = ReadJSON.getNUMBER(jo, "timestamp", false, true); 4351 this.wallTime = ReadJSON.getNUMBER(jo, "wallTime", false, true); 4352 this.initiator = ReadJSON.XL.getObject(jo, "initiator", Network.Initiator.class, false, true); 4353 this.redirectHasExtraInfo = ReadJSON.getBoolean(jo, "redirectHasExtraInfo"); 4354 this.redirectResponse = ReadJSON.XL.getObject(jo, "redirectResponse", Network.Response.class, true, false); 4355 this.type = ReadJSON.getString(jo, "type", true, false); 4356 this.frameId = ReadJSON.getString(jo, "frameId", true, false); 4357 this.hasUserGesture = ReadJSON.getBOOLEAN(jo, "hasUserGesture", true); 4358 } 4359 4360 } 4361 4362 /** 4363 * Fired when resource loading priority is changed 4364 * <BR /> 4365 * <BR /><B>EXPERIMENTAL</B> 4366 */ 4367 public static class resourceChangedPriority extends BrowserEvent 4368 { 4369 /** For Object Serialization. java.io.Serializable */ 4370 protected static final long serialVersionUID = 1; 4371 4372 public boolean[] optionals() 4373 { return new boolean[] { false, false, false, }; } 4374 4375 /** Request identifier. */ 4376 public final String requestId; 4377 4378 /** New priority */ 4379 public final String newPriority; 4380 4381 /** Timestamp. */ 4382 public final Number timestamp; 4383 4384 /** 4385 * Constructor 4386 * 4387 * @param requestId Request identifier. 4388 * 4389 * @param newPriority New priority 4390 * 4391 * @param timestamp Timestamp. 4392 */ 4393 public resourceChangedPriority(String requestId, String newPriority, Number timestamp) 4394 { 4395 super("Network", "resourceChangedPriority", 3); 4396 4397 // Exception-Check(s) to ensure that if any parameters which are not declared as 4398 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4399 4400 if (requestId == null) BRDPC.throwNPE("requestId"); 4401 if (newPriority == null) BRDPC.throwNPE("newPriority"); 4402 if (timestamp == null) BRDPC.throwNPE("timestamp"); 4403 4404 // Exception-Check(s) to ensure that if any parameters which must adhere to a 4405 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 4406 4407 BRDPC.checkIAE("newPriority", newPriority, "Network.ResourcePriority", Network.ResourcePriority); 4408 4409 this.requestId = requestId; 4410 this.newPriority = newPriority; 4411 this.timestamp = timestamp; 4412 } 4413 4414 /** 4415 * JSON Object Constructor 4416 * @param jo A Json-Object having data about an instance of {@code 'resourceChangedPriority'}. 4417 */ 4418 public resourceChangedPriority (JsonObject jo) 4419 { 4420 super("Network", "resourceChangedPriority", 3); 4421 4422 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 4423 this.newPriority = ReadJSON.getString(jo, "newPriority", false, true); 4424 this.timestamp = ReadJSON.getNUMBER(jo, "timestamp", false, true); 4425 } 4426 4427 } 4428 4429 /** 4430 * Fired when a signed exchange was received over the network 4431 * <BR /> 4432 * <BR /><B>EXPERIMENTAL</B> 4433 */ 4434 public static class signedExchangeReceived extends BrowserEvent 4435 { 4436 /** For Object Serialization. java.io.Serializable */ 4437 protected static final long serialVersionUID = 1; 4438 4439 public boolean[] optionals() 4440 { return new boolean[] { false, false, }; } 4441 4442 /** Request identifier. */ 4443 public final String requestId; 4444 4445 /** Information about the signed exchange response. */ 4446 public final Network.SignedExchangeInfo info; 4447 4448 /** 4449 * Constructor 4450 * 4451 * @param requestId Request identifier. 4452 * 4453 * @param info Information about the signed exchange response. 4454 */ 4455 public signedExchangeReceived(String requestId, Network.SignedExchangeInfo info) 4456 { 4457 super("Network", "signedExchangeReceived", 2); 4458 4459 // Exception-Check(s) to ensure that if any parameters which are not declared as 4460 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4461 4462 if (requestId == null) BRDPC.throwNPE("requestId"); 4463 if (info == null) BRDPC.throwNPE("info"); 4464 4465 this.requestId = requestId; 4466 this.info = info; 4467 } 4468 4469 /** 4470 * JSON Object Constructor 4471 * @param jo A Json-Object having data about an instance of {@code 'signedExchangeReceived'}. 4472 */ 4473 public signedExchangeReceived (JsonObject jo) 4474 { 4475 super("Network", "signedExchangeReceived", 2); 4476 4477 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 4478 this.info = ReadJSON.XL.getObject(jo, "info", Network.SignedExchangeInfo.class, false, true); 4479 } 4480 4481 } 4482 4483 /** Fired when HTTP response is available. */ 4484 public static class responseReceived extends BrowserEvent 4485 { 4486 /** For Object Serialization. java.io.Serializable */ 4487 protected static final long serialVersionUID = 1; 4488 4489 public boolean[] optionals() 4490 { return new boolean[] { false, false, false, false, false, false, true, }; } 4491 4492 /** Request identifier. */ 4493 public final String requestId; 4494 4495 /** Loader identifier. Empty string if the request is fetched from worker. */ 4496 public final String loaderId; 4497 4498 /** Timestamp. */ 4499 public final Number timestamp; 4500 4501 /** Resource type. */ 4502 public final String type; 4503 4504 /** Response data. */ 4505 public final Network.Response response; 4506 4507 /** 4508 * Indicates whether requestWillBeSentExtraInfo and responseReceivedExtraInfo events will be 4509 * or were emitted for this request. 4510 * <BR /> 4511 * <BR /><B>EXPERIMENTAL</B> 4512 */ 4513 public final boolean hasExtraInfo; 4514 4515 /** 4516 * Frame identifier. 4517 * <BR /> 4518 * <BR /><B>OPTIONAL</B> 4519 */ 4520 public final String frameId; 4521 4522 /** 4523 * Constructor 4524 * 4525 * @param requestId Request identifier. 4526 * 4527 * @param loaderId Loader identifier. Empty string if the request is fetched from worker. 4528 * 4529 * @param timestamp Timestamp. 4530 * 4531 * @param type Resource type. 4532 * 4533 * @param response Response data. 4534 * 4535 * @param hasExtraInfo 4536 * Indicates whether requestWillBeSentExtraInfo and responseReceivedExtraInfo events will be 4537 * or were emitted for this request. 4538 * <BR /><B>EXPERIMENTAL</B> 4539 * 4540 * @param frameId Frame identifier. 4541 * <BR /><B>OPTIONAL</B> 4542 */ 4543 public responseReceived( 4544 String requestId, String loaderId, Number timestamp, String type, 4545 Network.Response response, boolean hasExtraInfo, String frameId 4546 ) 4547 { 4548 super("Network", "responseReceived", 7); 4549 4550 // Exception-Check(s) to ensure that if any parameters which are not declared as 4551 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4552 4553 if (requestId == null) BRDPC.throwNPE("requestId"); 4554 if (loaderId == null) BRDPC.throwNPE("loaderId"); 4555 if (timestamp == null) BRDPC.throwNPE("timestamp"); 4556 if (type == null) BRDPC.throwNPE("type"); 4557 if (response == null) BRDPC.throwNPE("response"); 4558 4559 // Exception-Check(s) to ensure that if any parameters which must adhere to a 4560 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 4561 4562 BRDPC.checkIAE("type", type, "Network.ResourceType", Network.ResourceType); 4563 4564 this.requestId = requestId; 4565 this.loaderId = loaderId; 4566 this.timestamp = timestamp; 4567 this.type = type; 4568 this.response = response; 4569 this.hasExtraInfo = hasExtraInfo; 4570 this.frameId = frameId; 4571 } 4572 4573 /** 4574 * JSON Object Constructor 4575 * @param jo A Json-Object having data about an instance of {@code 'responseReceived'}. 4576 */ 4577 public responseReceived (JsonObject jo) 4578 { 4579 super("Network", "responseReceived", 7); 4580 4581 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 4582 this.loaderId = ReadJSON.getString(jo, "loaderId", false, true); 4583 this.timestamp = ReadJSON.getNUMBER(jo, "timestamp", false, true); 4584 this.type = ReadJSON.getString(jo, "type", false, true); 4585 this.response = ReadJSON.XL.getObject(jo, "response", Network.Response.class, false, true); 4586 this.hasExtraInfo = ReadJSON.getBoolean(jo, "hasExtraInfo"); 4587 this.frameId = ReadJSON.getString(jo, "frameId", true, false); 4588 } 4589 4590 } 4591 4592 /** Fired when WebSocket is closed. */ 4593 public static class webSocketClosed extends BrowserEvent 4594 { 4595 /** For Object Serialization. java.io.Serializable */ 4596 protected static final long serialVersionUID = 1; 4597 4598 public boolean[] optionals() 4599 { return new boolean[] { false, false, }; } 4600 4601 /** Request identifier. */ 4602 public final String requestId; 4603 4604 /** Timestamp. */ 4605 public final Number timestamp; 4606 4607 /** 4608 * Constructor 4609 * 4610 * @param requestId Request identifier. 4611 * 4612 * @param timestamp Timestamp. 4613 */ 4614 public webSocketClosed(String requestId, Number timestamp) 4615 { 4616 super("Network", "webSocketClosed", 2); 4617 4618 // Exception-Check(s) to ensure that if any parameters which are not declared as 4619 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4620 4621 if (requestId == null) BRDPC.throwNPE("requestId"); 4622 if (timestamp == null) BRDPC.throwNPE("timestamp"); 4623 4624 this.requestId = requestId; 4625 this.timestamp = timestamp; 4626 } 4627 4628 /** 4629 * JSON Object Constructor 4630 * @param jo A Json-Object having data about an instance of {@code 'webSocketClosed'}. 4631 */ 4632 public webSocketClosed (JsonObject jo) 4633 { 4634 super("Network", "webSocketClosed", 2); 4635 4636 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 4637 this.timestamp = ReadJSON.getNUMBER(jo, "timestamp", false, true); 4638 } 4639 4640 } 4641 4642 /** Fired upon WebSocket creation. */ 4643 public static class webSocketCreated extends BrowserEvent 4644 { 4645 /** For Object Serialization. java.io.Serializable */ 4646 protected static final long serialVersionUID = 1; 4647 4648 public boolean[] optionals() 4649 { return new boolean[] { false, false, true, }; } 4650 4651 /** Request identifier. */ 4652 public final String requestId; 4653 4654 /** WebSocket request URL. */ 4655 public final String url; 4656 4657 /** 4658 * Request initiator. 4659 * <BR /> 4660 * <BR /><B>OPTIONAL</B> 4661 */ 4662 public final Network.Initiator initiator; 4663 4664 /** 4665 * Constructor 4666 * 4667 * @param requestId Request identifier. 4668 * 4669 * @param url WebSocket request URL. 4670 * 4671 * @param initiator Request initiator. 4672 * <BR /><B>OPTIONAL</B> 4673 */ 4674 public webSocketCreated(String requestId, String url, Network.Initiator initiator) 4675 { 4676 super("Network", "webSocketCreated", 3); 4677 4678 // Exception-Check(s) to ensure that if any parameters which are not declared as 4679 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4680 4681 if (requestId == null) BRDPC.throwNPE("requestId"); 4682 if (url == null) BRDPC.throwNPE("url"); 4683 4684 this.requestId = requestId; 4685 this.url = url; 4686 this.initiator = initiator; 4687 } 4688 4689 /** 4690 * JSON Object Constructor 4691 * @param jo A Json-Object having data about an instance of {@code 'webSocketCreated'}. 4692 */ 4693 public webSocketCreated (JsonObject jo) 4694 { 4695 super("Network", "webSocketCreated", 3); 4696 4697 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 4698 this.url = ReadJSON.getString(jo, "url", false, true); 4699 this.initiator = ReadJSON.XL.getObject(jo, "initiator", Network.Initiator.class, true, false); 4700 } 4701 4702 } 4703 4704 /** Fired when WebSocket message error occurs. */ 4705 public static class webSocketFrameError extends BrowserEvent 4706 { 4707 /** For Object Serialization. java.io.Serializable */ 4708 protected static final long serialVersionUID = 1; 4709 4710 public boolean[] optionals() 4711 { return new boolean[] { false, false, false, }; } 4712 4713 /** Request identifier. */ 4714 public final String requestId; 4715 4716 /** Timestamp. */ 4717 public final Number timestamp; 4718 4719 /** WebSocket error message. */ 4720 public final String errorMessage; 4721 4722 /** 4723 * Constructor 4724 * 4725 * @param requestId Request identifier. 4726 * 4727 * @param timestamp Timestamp. 4728 * 4729 * @param errorMessage WebSocket error message. 4730 */ 4731 public webSocketFrameError(String requestId, Number timestamp, String errorMessage) 4732 { 4733 super("Network", "webSocketFrameError", 3); 4734 4735 // Exception-Check(s) to ensure that if any parameters which are not declared as 4736 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4737 4738 if (requestId == null) BRDPC.throwNPE("requestId"); 4739 if (timestamp == null) BRDPC.throwNPE("timestamp"); 4740 if (errorMessage == null) BRDPC.throwNPE("errorMessage"); 4741 4742 this.requestId = requestId; 4743 this.timestamp = timestamp; 4744 this.errorMessage = errorMessage; 4745 } 4746 4747 /** 4748 * JSON Object Constructor 4749 * @param jo A Json-Object having data about an instance of {@code 'webSocketFrameError'}. 4750 */ 4751 public webSocketFrameError (JsonObject jo) 4752 { 4753 super("Network", "webSocketFrameError", 3); 4754 4755 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 4756 this.timestamp = ReadJSON.getNUMBER(jo, "timestamp", false, true); 4757 this.errorMessage = ReadJSON.getString(jo, "errorMessage", false, true); 4758 } 4759 4760 } 4761 4762 /** Fired when WebSocket message is received. */ 4763 public static class webSocketFrameReceived extends BrowserEvent 4764 { 4765 /** For Object Serialization. java.io.Serializable */ 4766 protected static final long serialVersionUID = 1; 4767 4768 public boolean[] optionals() 4769 { return new boolean[] { false, false, false, }; } 4770 4771 /** Request identifier. */ 4772 public final String requestId; 4773 4774 /** Timestamp. */ 4775 public final Number timestamp; 4776 4777 /** WebSocket response data. */ 4778 public final Network.WebSocketFrame response; 4779 4780 /** 4781 * Constructor 4782 * 4783 * @param requestId Request identifier. 4784 * 4785 * @param timestamp Timestamp. 4786 * 4787 * @param response WebSocket response data. 4788 */ 4789 public webSocketFrameReceived 4790 (String requestId, Number timestamp, Network.WebSocketFrame response) 4791 { 4792 super("Network", "webSocketFrameReceived", 3); 4793 4794 // Exception-Check(s) to ensure that if any parameters which are not declared as 4795 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4796 4797 if (requestId == null) BRDPC.throwNPE("requestId"); 4798 if (timestamp == null) BRDPC.throwNPE("timestamp"); 4799 if (response == null) BRDPC.throwNPE("response"); 4800 4801 this.requestId = requestId; 4802 this.timestamp = timestamp; 4803 this.response = response; 4804 } 4805 4806 /** 4807 * JSON Object Constructor 4808 * @param jo A Json-Object having data about an instance of {@code 'webSocketFrameReceived'}. 4809 */ 4810 public webSocketFrameReceived (JsonObject jo) 4811 { 4812 super("Network", "webSocketFrameReceived", 3); 4813 4814 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 4815 this.timestamp = ReadJSON.getNUMBER(jo, "timestamp", false, true); 4816 this.response = ReadJSON.XL.getObject(jo, "response", Network.WebSocketFrame.class, false, true); 4817 } 4818 4819 } 4820 4821 /** Fired when WebSocket message is sent. */ 4822 public static class webSocketFrameSent extends BrowserEvent 4823 { 4824 /** For Object Serialization. java.io.Serializable */ 4825 protected static final long serialVersionUID = 1; 4826 4827 public boolean[] optionals() 4828 { return new boolean[] { false, false, false, }; } 4829 4830 /** Request identifier. */ 4831 public final String requestId; 4832 4833 /** Timestamp. */ 4834 public final Number timestamp; 4835 4836 /** WebSocket response data. */ 4837 public final Network.WebSocketFrame response; 4838 4839 /** 4840 * Constructor 4841 * 4842 * @param requestId Request identifier. 4843 * 4844 * @param timestamp Timestamp. 4845 * 4846 * @param response WebSocket response data. 4847 */ 4848 public webSocketFrameSent 4849 (String requestId, Number timestamp, Network.WebSocketFrame response) 4850 { 4851 super("Network", "webSocketFrameSent", 3); 4852 4853 // Exception-Check(s) to ensure that if any parameters which are not declared as 4854 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4855 4856 if (requestId == null) BRDPC.throwNPE("requestId"); 4857 if (timestamp == null) BRDPC.throwNPE("timestamp"); 4858 if (response == null) BRDPC.throwNPE("response"); 4859 4860 this.requestId = requestId; 4861 this.timestamp = timestamp; 4862 this.response = response; 4863 } 4864 4865 /** 4866 * JSON Object Constructor 4867 * @param jo A Json-Object having data about an instance of {@code 'webSocketFrameSent'}. 4868 */ 4869 public webSocketFrameSent (JsonObject jo) 4870 { 4871 super("Network", "webSocketFrameSent", 3); 4872 4873 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 4874 this.timestamp = ReadJSON.getNUMBER(jo, "timestamp", false, true); 4875 this.response = ReadJSON.XL.getObject(jo, "response", Network.WebSocketFrame.class, false, true); 4876 } 4877 4878 } 4879 4880 /** Fired when WebSocket handshake response becomes available. */ 4881 public static class webSocketHandshakeResponseReceived extends BrowserEvent 4882 { 4883 /** For Object Serialization. java.io.Serializable */ 4884 protected static final long serialVersionUID = 1; 4885 4886 public boolean[] optionals() 4887 { return new boolean[] { false, false, false, }; } 4888 4889 /** Request identifier. */ 4890 public final String requestId; 4891 4892 /** Timestamp. */ 4893 public final Number timestamp; 4894 4895 /** WebSocket response data. */ 4896 public final Network.WebSocketResponse response; 4897 4898 /** 4899 * Constructor 4900 * 4901 * @param requestId Request identifier. 4902 * 4903 * @param timestamp Timestamp. 4904 * 4905 * @param response WebSocket response data. 4906 */ 4907 public webSocketHandshakeResponseReceived 4908 (String requestId, Number timestamp, Network.WebSocketResponse response) 4909 { 4910 super("Network", "webSocketHandshakeResponseReceived", 3); 4911 4912 // Exception-Check(s) to ensure that if any parameters which are not declared as 4913 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4914 4915 if (requestId == null) BRDPC.throwNPE("requestId"); 4916 if (timestamp == null) BRDPC.throwNPE("timestamp"); 4917 if (response == null) BRDPC.throwNPE("response"); 4918 4919 this.requestId = requestId; 4920 this.timestamp = timestamp; 4921 this.response = response; 4922 } 4923 4924 /** 4925 * JSON Object Constructor 4926 * @param jo A Json-Object having data about an instance of {@code 'webSocketHandshakeResponseReceived'}. 4927 */ 4928 public webSocketHandshakeResponseReceived (JsonObject jo) 4929 { 4930 super("Network", "webSocketHandshakeResponseReceived", 3); 4931 4932 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 4933 this.timestamp = ReadJSON.getNUMBER(jo, "timestamp", false, true); 4934 this.response = ReadJSON.XL.getObject(jo, "response", Network.WebSocketResponse.class, false, true); 4935 } 4936 4937 } 4938 4939 /** Fired when WebSocket is about to initiate handshake. */ 4940 public static class webSocketWillSendHandshakeRequest extends BrowserEvent 4941 { 4942 /** For Object Serialization. java.io.Serializable */ 4943 protected static final long serialVersionUID = 1; 4944 4945 public boolean[] optionals() 4946 { return new boolean[] { false, false, false, false, }; } 4947 4948 /** Request identifier. */ 4949 public final String requestId; 4950 4951 /** Timestamp. */ 4952 public final Number timestamp; 4953 4954 /** UTC Timestamp. */ 4955 public final Number wallTime; 4956 4957 /** WebSocket request data. */ 4958 public final Network.WebSocketRequest request; 4959 4960 /** 4961 * Constructor 4962 * 4963 * @param requestId Request identifier. 4964 * 4965 * @param timestamp Timestamp. 4966 * 4967 * @param wallTime UTC Timestamp. 4968 * 4969 * @param request WebSocket request data. 4970 */ 4971 public webSocketWillSendHandshakeRequest 4972 (String requestId, Number timestamp, Number wallTime, Network.WebSocketRequest request) 4973 { 4974 super("Network", "webSocketWillSendHandshakeRequest", 4); 4975 4976 // Exception-Check(s) to ensure that if any parameters which are not declared as 4977 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4978 4979 if (requestId == null) BRDPC.throwNPE("requestId"); 4980 if (timestamp == null) BRDPC.throwNPE("timestamp"); 4981 if (wallTime == null) BRDPC.throwNPE("wallTime"); 4982 if (request == null) BRDPC.throwNPE("request"); 4983 4984 this.requestId = requestId; 4985 this.timestamp = timestamp; 4986 this.wallTime = wallTime; 4987 this.request = request; 4988 } 4989 4990 /** 4991 * JSON Object Constructor 4992 * @param jo A Json-Object having data about an instance of {@code 'webSocketWillSendHandshakeRequest'}. 4993 */ 4994 public webSocketWillSendHandshakeRequest (JsonObject jo) 4995 { 4996 super("Network", "webSocketWillSendHandshakeRequest", 4); 4997 4998 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 4999 this.timestamp = ReadJSON.getNUMBER(jo, "timestamp", false, true); 5000 this.wallTime = ReadJSON.getNUMBER(jo, "wallTime", false, true); 5001 this.request = ReadJSON.XL.getObject(jo, "request", Network.WebSocketRequest.class, false, true); 5002 } 5003 5004 } 5005 5006 /** Fired upon WebTransport creation. */ 5007 public static class webTransportCreated extends BrowserEvent 5008 { 5009 /** For Object Serialization. java.io.Serializable */ 5010 protected static final long serialVersionUID = 1; 5011 5012 public boolean[] optionals() 5013 { return new boolean[] { false, false, false, true, }; } 5014 5015 /** WebTransport identifier. */ 5016 public final String transportId; 5017 5018 /** WebTransport request URL. */ 5019 public final String url; 5020 5021 /** Timestamp. */ 5022 public final Number timestamp; 5023 5024 /** 5025 * Request initiator. 5026 * <BR /> 5027 * <BR /><B>OPTIONAL</B> 5028 */ 5029 public final Network.Initiator initiator; 5030 5031 /** 5032 * Constructor 5033 * 5034 * @param transportId WebTransport identifier. 5035 * 5036 * @param url WebTransport request URL. 5037 * 5038 * @param timestamp Timestamp. 5039 * 5040 * @param initiator Request initiator. 5041 * <BR /><B>OPTIONAL</B> 5042 */ 5043 public webTransportCreated 5044 (String transportId, String url, Number timestamp, Network.Initiator initiator) 5045 { 5046 super("Network", "webTransportCreated", 4); 5047 5048 // Exception-Check(s) to ensure that if any parameters which are not declared as 5049 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5050 5051 if (transportId == null) BRDPC.throwNPE("transportId"); 5052 if (url == null) BRDPC.throwNPE("url"); 5053 if (timestamp == null) BRDPC.throwNPE("timestamp"); 5054 5055 this.transportId = transportId; 5056 this.url = url; 5057 this.timestamp = timestamp; 5058 this.initiator = initiator; 5059 } 5060 5061 /** 5062 * JSON Object Constructor 5063 * @param jo A Json-Object having data about an instance of {@code 'webTransportCreated'}. 5064 */ 5065 public webTransportCreated (JsonObject jo) 5066 { 5067 super("Network", "webTransportCreated", 4); 5068 5069 this.transportId = ReadJSON.getString(jo, "transportId", false, true); 5070 this.url = ReadJSON.getString(jo, "url", false, true); 5071 this.timestamp = ReadJSON.getNUMBER(jo, "timestamp", false, true); 5072 this.initiator = ReadJSON.XL.getObject(jo, "initiator", Network.Initiator.class, true, false); 5073 } 5074 5075 } 5076 5077 /** Fired when WebTransport handshake is finished. */ 5078 public static class webTransportConnectionEstablished extends BrowserEvent 5079 { 5080 /** For Object Serialization. java.io.Serializable */ 5081 protected static final long serialVersionUID = 1; 5082 5083 public boolean[] optionals() 5084 { return new boolean[] { false, false, }; } 5085 5086 /** WebTransport identifier. */ 5087 public final String transportId; 5088 5089 /** Timestamp. */ 5090 public final Number timestamp; 5091 5092 /** 5093 * Constructor 5094 * 5095 * @param transportId WebTransport identifier. 5096 * 5097 * @param timestamp Timestamp. 5098 */ 5099 public webTransportConnectionEstablished(String transportId, Number timestamp) 5100 { 5101 super("Network", "webTransportConnectionEstablished", 2); 5102 5103 // Exception-Check(s) to ensure that if any parameters which are not declared as 5104 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5105 5106 if (transportId == null) BRDPC.throwNPE("transportId"); 5107 if (timestamp == null) BRDPC.throwNPE("timestamp"); 5108 5109 this.transportId = transportId; 5110 this.timestamp = timestamp; 5111 } 5112 5113 /** 5114 * JSON Object Constructor 5115 * @param jo A Json-Object having data about an instance of {@code 'webTransportConnectionEstablished'}. 5116 */ 5117 public webTransportConnectionEstablished (JsonObject jo) 5118 { 5119 super("Network", "webTransportConnectionEstablished", 2); 5120 5121 this.transportId = ReadJSON.getString(jo, "transportId", false, true); 5122 this.timestamp = ReadJSON.getNUMBER(jo, "timestamp", false, true); 5123 } 5124 5125 } 5126 5127 /** Fired when WebTransport is disposed. */ 5128 public static class webTransportClosed extends BrowserEvent 5129 { 5130 /** For Object Serialization. java.io.Serializable */ 5131 protected static final long serialVersionUID = 1; 5132 5133 public boolean[] optionals() 5134 { return new boolean[] { false, false, }; } 5135 5136 /** WebTransport identifier. */ 5137 public final String transportId; 5138 5139 /** Timestamp. */ 5140 public final Number timestamp; 5141 5142 /** 5143 * Constructor 5144 * 5145 * @param transportId WebTransport identifier. 5146 * 5147 * @param timestamp Timestamp. 5148 */ 5149 public webTransportClosed(String transportId, Number timestamp) 5150 { 5151 super("Network", "webTransportClosed", 2); 5152 5153 // Exception-Check(s) to ensure that if any parameters which are not declared as 5154 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5155 5156 if (transportId == null) BRDPC.throwNPE("transportId"); 5157 if (timestamp == null) BRDPC.throwNPE("timestamp"); 5158 5159 this.transportId = transportId; 5160 this.timestamp = timestamp; 5161 } 5162 5163 /** 5164 * JSON Object Constructor 5165 * @param jo A Json-Object having data about an instance of {@code 'webTransportClosed'}. 5166 */ 5167 public webTransportClosed (JsonObject jo) 5168 { 5169 super("Network", "webTransportClosed", 2); 5170 5171 this.transportId = ReadJSON.getString(jo, "transportId", false, true); 5172 this.timestamp = ReadJSON.getNUMBER(jo, "timestamp", false, true); 5173 } 5174 5175 } 5176 5177 /** 5178 * Fired when additional information about a requestWillBeSent event is available from the 5179 * network stack. Not every requestWillBeSent event will have an additional 5180 * requestWillBeSentExtraInfo fired for it, and there is no guarantee whether requestWillBeSent 5181 * or requestWillBeSentExtraInfo will be fired first for the same request. 5182 * <BR /> 5183 * <BR /><B>EXPERIMENTAL</B> 5184 */ 5185 public static class requestWillBeSentExtraInfo extends BrowserEvent 5186 { 5187 /** For Object Serialization. java.io.Serializable */ 5188 protected static final long serialVersionUID = 1; 5189 5190 public boolean[] optionals() 5191 { return new boolean[] { false, false, false, false, true, }; } 5192 5193 /** Request identifier. Used to match this information to an existing requestWillBeSent event. */ 5194 public final String requestId; 5195 5196 /** 5197 * A list of cookies potentially associated to the requested URL. This includes both cookies sent with 5198 * the request and the ones not sent; the latter are distinguished by having blockedReason field set. 5199 */ 5200 public final Network.BlockedCookieWithReason[] associatedCookies; 5201 5202 /** Raw request headers as they will be sent over the wire. */ 5203 public final JsonObject headers; 5204 5205 /** 5206 * Connection timing information for the request. 5207 * <BR /> 5208 * <BR /><B>EXPERIMENTAL</B> 5209 */ 5210 public final Network.ConnectTiming connectTiming; 5211 5212 /** 5213 * The client security state set for the request. 5214 * <BR /> 5215 * <BR /><B>OPTIONAL</B> 5216 */ 5217 public final Network.ClientSecurityState clientSecurityState; 5218 5219 /** 5220 * Constructor 5221 * 5222 * @param requestId Request identifier. Used to match this information to an existing requestWillBeSent event. 5223 * 5224 * @param associatedCookies 5225 * A list of cookies potentially associated to the requested URL. This includes both cookies sent with 5226 * the request and the ones not sent; the latter are distinguished by having blockedReason field set. 5227 * 5228 * @param headers Raw request headers as they will be sent over the wire. 5229 * 5230 * @param connectTiming Connection timing information for the request. 5231 * <BR /><B>EXPERIMENTAL</B> 5232 * 5233 * @param clientSecurityState The client security state set for the request. 5234 * <BR /><B>OPTIONAL</B> 5235 */ 5236 public requestWillBeSentExtraInfo( 5237 String requestId, Network.BlockedCookieWithReason[] associatedCookies, 5238 JsonObject headers, Network.ConnectTiming connectTiming, 5239 Network.ClientSecurityState clientSecurityState 5240 ) 5241 { 5242 super("Network", "requestWillBeSentExtraInfo", 5); 5243 5244 // Exception-Check(s) to ensure that if any parameters which are not declared as 5245 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5246 5247 if (requestId == null) BRDPC.throwNPE("requestId"); 5248 if (associatedCookies == null) BRDPC.throwNPE("associatedCookies"); 5249 if (headers == null) BRDPC.throwNPE("headers"); 5250 if (connectTiming == null) BRDPC.throwNPE("connectTiming"); 5251 5252 this.requestId = requestId; 5253 this.associatedCookies = associatedCookies; 5254 this.headers = headers; 5255 this.connectTiming = connectTiming; 5256 this.clientSecurityState = clientSecurityState; 5257 } 5258 5259 /** 5260 * JSON Object Constructor 5261 * @param jo A Json-Object having data about an instance of {@code 'requestWillBeSentExtraInfo'}. 5262 */ 5263 public requestWillBeSentExtraInfo (JsonObject jo) 5264 { 5265 super("Network", "requestWillBeSentExtraInfo", 5); 5266 5267 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 5268 this.associatedCookies = (jo.getJsonArray("associatedCookies") == null) 5269 ? null 5270 : ReadArrJSON.DimN.objArr(jo.getJsonArray("associatedCookies"), null, 0, Network.BlockedCookieWithReason[].class); 5271 this.headers = jo.getJsonObject("headers"); 5272 this.connectTiming = ReadJSON.XL.getObject(jo, "connectTiming", Network.ConnectTiming.class, false, true); 5273 this.clientSecurityState = ReadJSON.XL.getObject(jo, "clientSecurityState", Network.ClientSecurityState.class, true, false); 5274 } 5275 5276 } 5277 5278 /** 5279 * Fired when additional information about a responseReceived event is available from the network 5280 * stack. Not every responseReceived event will have an additional responseReceivedExtraInfo for 5281 * it, and responseReceivedExtraInfo may be fired before or after responseReceived. 5282 * <BR /> 5283 * <BR /><B>EXPERIMENTAL</B> 5284 */ 5285 public static class responseReceivedExtraInfo extends BrowserEvent 5286 { 5287 /** For Object Serialization. java.io.Serializable */ 5288 protected static final long serialVersionUID = 1; 5289 5290 public boolean[] optionals() 5291 { return new boolean[] { false, false, false, false, false, true, }; } 5292 5293 /** Request identifier. Used to match this information to another responseReceived event. */ 5294 public final String requestId; 5295 5296 /** 5297 * A list of cookies which were not stored from the response along with the corresponding 5298 * reasons for blocking. The cookies here may not be valid due to syntax errors, which 5299 * are represented by the invalid cookie line string instead of a proper cookie. 5300 */ 5301 public final Network.BlockedSetCookieWithReason[] blockedCookies; 5302 5303 /** Raw response headers as they were received over the wire. */ 5304 public final JsonObject headers; 5305 5306 /** 5307 * The IP address space of the resource. The address space can only be determined once the transport 5308 * established the connection, so we can't send it in <CODE>requestWillBeSentExtraInfo</CODE>. 5309 */ 5310 public final String resourceIPAddressSpace; 5311 5312 /** 5313 * The status code of the response. This is useful in cases the request failed and no responseReceived 5314 * event is triggered, which is the case for, e.g., CORS errors. This is also the correct status code 5315 * for cached requests, where the status in responseReceived is a 200 and this will be 304. 5316 */ 5317 public final int statusCode; 5318 5319 /** 5320 * Raw response header text as it was received over the wire. The raw text may not always be 5321 * available, such as in the case of HTTP/2 or QUIC. 5322 * <BR /> 5323 * <BR /><B>OPTIONAL</B> 5324 */ 5325 public final String headersText; 5326 5327 /** 5328 * Constructor 5329 * 5330 * @param requestId Request identifier. Used to match this information to another responseReceived event. 5331 * 5332 * @param blockedCookies 5333 * A list of cookies which were not stored from the response along with the corresponding 5334 * reasons for blocking. The cookies here may not be valid due to syntax errors, which 5335 * are represented by the invalid cookie line string instead of a proper cookie. 5336 * 5337 * @param headers Raw response headers as they were received over the wire. 5338 * 5339 * @param resourceIPAddressSpace 5340 * The IP address space of the resource. The address space can only be determined once the transport 5341 * established the connection, so we can't send it in <CODE>requestWillBeSentExtraInfo</CODE>. 5342 * 5343 * @param statusCode 5344 * The status code of the response. This is useful in cases the request failed and no responseReceived 5345 * event is triggered, which is the case for, e.g., CORS errors. This is also the correct status code 5346 * for cached requests, where the status in responseReceived is a 200 and this will be 304. 5347 * 5348 * @param headersText 5349 * Raw response header text as it was received over the wire. The raw text may not always be 5350 * available, such as in the case of HTTP/2 or QUIC. 5351 * <BR /><B>OPTIONAL</B> 5352 */ 5353 public responseReceivedExtraInfo( 5354 String requestId, Network.BlockedSetCookieWithReason[] blockedCookies, 5355 JsonObject headers, String resourceIPAddressSpace, int statusCode, String headersText 5356 ) 5357 { 5358 super("Network", "responseReceivedExtraInfo", 6); 5359 5360 // Exception-Check(s) to ensure that if any parameters which are not declared as 5361 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5362 5363 if (requestId == null) BRDPC.throwNPE("requestId"); 5364 if (blockedCookies == null) BRDPC.throwNPE("blockedCookies"); 5365 if (headers == null) BRDPC.throwNPE("headers"); 5366 if (resourceIPAddressSpace == null) BRDPC.throwNPE("resourceIPAddressSpace"); 5367 5368 // Exception-Check(s) to ensure that if any parameters which must adhere to a 5369 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 5370 5371 BRDPC.checkIAE("resourceIPAddressSpace", resourceIPAddressSpace, "Network.IPAddressSpace", Network.IPAddressSpace); 5372 5373 this.requestId = requestId; 5374 this.blockedCookies = blockedCookies; 5375 this.headers = headers; 5376 this.resourceIPAddressSpace = resourceIPAddressSpace; 5377 this.statusCode = statusCode; 5378 this.headersText = headersText; 5379 } 5380 5381 /** 5382 * JSON Object Constructor 5383 * @param jo A Json-Object having data about an instance of {@code 'responseReceivedExtraInfo'}. 5384 */ 5385 public responseReceivedExtraInfo (JsonObject jo) 5386 { 5387 super("Network", "responseReceivedExtraInfo", 6); 5388 5389 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 5390 this.blockedCookies = (jo.getJsonArray("blockedCookies") == null) 5391 ? null 5392 : ReadArrJSON.DimN.objArr(jo.getJsonArray("blockedCookies"), null, 0, Network.BlockedSetCookieWithReason[].class); 5393 this.headers = jo.getJsonObject("headers"); 5394 this.resourceIPAddressSpace = ReadJSON.getString(jo, "resourceIPAddressSpace", false, true); 5395 this.statusCode = ReadJSON.getInt(jo, "statusCode"); 5396 this.headersText = ReadJSON.getString(jo, "headersText", true, false); 5397 } 5398 5399 } 5400 5401 /** 5402 * Fired exactly once for each Trust Token operation. Depending on 5403 * the type of the operation and whether the operation succeeded or 5404 * failed, the event is fired before the corresponding request was sent 5405 * or after the response was received. 5406 * <BR /> 5407 * <BR /><B>EXPERIMENTAL</B> 5408 */ 5409 public static class trustTokenOperationDone extends BrowserEvent 5410 { 5411 /** For Object Serialization. java.io.Serializable */ 5412 protected static final long serialVersionUID = 1; 5413 5414 public boolean[] optionals() 5415 { return new boolean[] { false, false, false, true, true, true, }; } 5416 5417 /** 5418 * Detailed success or error status of the operation. 5419 * 'AlreadyExists' also signifies a successful operation, as the result 5420 * of the operation already exists und thus, the operation was abort 5421 * preemptively (e.g. a cache hit). 5422 */ 5423 public final String status; 5424 5425 /** <CODE>[No Description Provided by Google]</CODE> */ 5426 public final String type; 5427 5428 /** <CODE>[No Description Provided by Google]</CODE> */ 5429 public final String requestId; 5430 5431 /** 5432 * Top level origin. The context in which the operation was attempted. 5433 * <BR /> 5434 * <BR /><B>OPTIONAL</B> 5435 */ 5436 public final String topLevelOrigin; 5437 5438 /** 5439 * Origin of the issuer in case of a "Issuance" or "Redemption" operation. 5440 * <BR /> 5441 * <BR /><B>OPTIONAL</B> 5442 */ 5443 public final String issuerOrigin; 5444 5445 /** 5446 * The number of obtained Trust Tokens on a successful "Issuance" operation. 5447 * <BR /> 5448 * <BR /><B>OPTIONAL</B> 5449 */ 5450 public final Integer issuedTokenCount; 5451 5452 /** 5453 * Constructor 5454 * 5455 * @param status 5456 * Detailed success or error status of the operation. 5457 * 'AlreadyExists' also signifies a successful operation, as the result 5458 * of the operation already exists und thus, the operation was abort 5459 * preemptively (e.g. a cache hit). 5460 * <BR />Acceptable Values: ["Ok", "InvalidArgument", "FailedPrecondition", "ResourceExhausted", "AlreadyExists", "Unavailable", "BadResponse", "InternalError", "UnknownError", "FulfilledLocally"] 5461 * 5462 * @param type - 5463 * 5464 * @param requestId - 5465 * 5466 * @param topLevelOrigin Top level origin. The context in which the operation was attempted. 5467 * <BR /><B>OPTIONAL</B> 5468 * 5469 * @param issuerOrigin Origin of the issuer in case of a "Issuance" or "Redemption" operation. 5470 * <BR /><B>OPTIONAL</B> 5471 * 5472 * @param issuedTokenCount The number of obtained Trust Tokens on a successful "Issuance" operation. 5473 * <BR /><B>OPTIONAL</B> 5474 */ 5475 public trustTokenOperationDone( 5476 String status, String type, String requestId, String topLevelOrigin, 5477 String issuerOrigin, Integer issuedTokenCount 5478 ) 5479 { 5480 super("Network", "trustTokenOperationDone", 6); 5481 5482 // Exception-Check(s) to ensure that if any parameters which are not declared as 5483 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5484 5485 if (status == null) BRDPC.throwNPE("status"); 5486 if (type == null) BRDPC.throwNPE("type"); 5487 if (requestId == null) BRDPC.throwNPE("requestId"); 5488 5489 // Exception-Check(s) to ensure that if any parameters which must adhere to a 5490 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 5491 5492 BRDPC.checkIAE( 5493 "status", status, 5494 "Ok", "InvalidArgument", "FailedPrecondition", "ResourceExhausted", "AlreadyExists", "Unavailable", "BadResponse", "InternalError", "UnknownError", "FulfilledLocally" 5495 ); 5496 BRDPC.checkIAE("type", type, "Network.TrustTokenOperationType", Network.TrustTokenOperationType); 5497 5498 this.status = status; 5499 this.type = type; 5500 this.requestId = requestId; 5501 this.topLevelOrigin = topLevelOrigin; 5502 this.issuerOrigin = issuerOrigin; 5503 this.issuedTokenCount = issuedTokenCount; 5504 } 5505 5506 /** 5507 * JSON Object Constructor 5508 * @param jo A Json-Object having data about an instance of {@code 'trustTokenOperationDone'}. 5509 */ 5510 public trustTokenOperationDone (JsonObject jo) 5511 { 5512 super("Network", "trustTokenOperationDone", 6); 5513 5514 this.status = ReadJSON.getString(jo, "status", false, true); 5515 this.type = ReadJSON.getString(jo, "type", false, true); 5516 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 5517 this.topLevelOrigin = ReadJSON.getString(jo, "topLevelOrigin", true, false); 5518 this.issuerOrigin = ReadJSON.getString(jo, "issuerOrigin", true, false); 5519 this.issuedTokenCount = ReadJSON.getINTEGER(jo, "issuedTokenCount", true); 5520 } 5521 5522 } 5523 5524 /** 5525 * Fired once when parsing the .wbn file has succeeded. 5526 * The event contains the information about the web bundle contents. 5527 * <BR /> 5528 * <BR /><B>EXPERIMENTAL</B> 5529 */ 5530 public static class subresourceWebBundleMetadataReceived extends BrowserEvent 5531 { 5532 /** For Object Serialization. java.io.Serializable */ 5533 protected static final long serialVersionUID = 1; 5534 5535 public boolean[] optionals() 5536 { return new boolean[] { false, false, }; } 5537 5538 /** Request identifier. Used to match this information to another event. */ 5539 public final String requestId; 5540 5541 /** A list of URLs of resources in the subresource Web Bundle. */ 5542 public final String[] urls; 5543 5544 /** 5545 * Constructor 5546 * 5547 * @param requestId Request identifier. Used to match this information to another event. 5548 * 5549 * @param urls A list of URLs of resources in the subresource Web Bundle. 5550 */ 5551 public subresourceWebBundleMetadataReceived(String requestId, String[] urls) 5552 { 5553 super("Network", "subresourceWebBundleMetadataReceived", 2); 5554 5555 // Exception-Check(s) to ensure that if any parameters which are not declared as 5556 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5557 5558 if (requestId == null) BRDPC.throwNPE("requestId"); 5559 if (urls == null) BRDPC.throwNPE("urls"); 5560 5561 this.requestId = requestId; 5562 this.urls = urls; 5563 } 5564 5565 /** 5566 * JSON Object Constructor 5567 * @param jo A Json-Object having data about an instance of {@code 'subresourceWebBundleMetadataReceived'}. 5568 */ 5569 public subresourceWebBundleMetadataReceived (JsonObject jo) 5570 { 5571 super("Network", "subresourceWebBundleMetadataReceived", 2); 5572 5573 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 5574 this.urls = (jo.getJsonArray("urls") == null) 5575 ? null 5576 : ReadArrJSON.DimN.strArr(jo.getJsonArray("urls"), null, 0, String[].class); 5577 } 5578 5579 } 5580 5581 /** 5582 * Fired once when parsing the .wbn file has failed. 5583 * <BR /> 5584 * <BR /><B>EXPERIMENTAL</B> 5585 */ 5586 public static class subresourceWebBundleMetadataError extends BrowserEvent 5587 { 5588 /** For Object Serialization. java.io.Serializable */ 5589 protected static final long serialVersionUID = 1; 5590 5591 public boolean[] optionals() 5592 { return new boolean[] { false, false, }; } 5593 5594 /** Request identifier. Used to match this information to another event. */ 5595 public final String requestId; 5596 5597 /** Error message */ 5598 public final String errorMessage; 5599 5600 /** 5601 * Constructor 5602 * 5603 * @param requestId Request identifier. Used to match this information to another event. 5604 * 5605 * @param errorMessage Error message 5606 */ 5607 public subresourceWebBundleMetadataError(String requestId, String errorMessage) 5608 { 5609 super("Network", "subresourceWebBundleMetadataError", 2); 5610 5611 // Exception-Check(s) to ensure that if any parameters which are not declared as 5612 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5613 5614 if (requestId == null) BRDPC.throwNPE("requestId"); 5615 if (errorMessage == null) BRDPC.throwNPE("errorMessage"); 5616 5617 this.requestId = requestId; 5618 this.errorMessage = errorMessage; 5619 } 5620 5621 /** 5622 * JSON Object Constructor 5623 * @param jo A Json-Object having data about an instance of {@code 'subresourceWebBundleMetadataError'}. 5624 */ 5625 public subresourceWebBundleMetadataError (JsonObject jo) 5626 { 5627 super("Network", "subresourceWebBundleMetadataError", 2); 5628 5629 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 5630 this.errorMessage = ReadJSON.getString(jo, "errorMessage", false, true); 5631 } 5632 5633 } 5634 5635 /** 5636 * Fired when handling requests for resources within a .wbn file. 5637 * Note: this will only be fired for resources that are requested by the webpage. 5638 * <BR /> 5639 * <BR /><B>EXPERIMENTAL</B> 5640 */ 5641 public static class subresourceWebBundleInnerResponseParsed extends BrowserEvent 5642 { 5643 /** For Object Serialization. java.io.Serializable */ 5644 protected static final long serialVersionUID = 1; 5645 5646 public boolean[] optionals() 5647 { return new boolean[] { false, false, true, }; } 5648 5649 /** Request identifier of the subresource request */ 5650 public final String innerRequestId; 5651 5652 /** URL of the subresource resource. */ 5653 public final String innerRequestURL; 5654 5655 /** 5656 * Bundle request identifier. Used to match this information to another event. 5657 * This made be absent in case when the instrumentation was enabled only 5658 * after webbundle was parsed. 5659 * <BR /> 5660 * <BR /><B>OPTIONAL</B> 5661 */ 5662 public final String bundleRequestId; 5663 5664 /** 5665 * Constructor 5666 * 5667 * @param innerRequestId Request identifier of the subresource request 5668 * 5669 * @param innerRequestURL URL of the subresource resource. 5670 * 5671 * @param bundleRequestId 5672 * Bundle request identifier. Used to match this information to another event. 5673 * This made be absent in case when the instrumentation was enabled only 5674 * after webbundle was parsed. 5675 * <BR /><B>OPTIONAL</B> 5676 */ 5677 public subresourceWebBundleInnerResponseParsed 5678 (String innerRequestId, String innerRequestURL, String bundleRequestId) 5679 { 5680 super("Network", "subresourceWebBundleInnerResponseParsed", 3); 5681 5682 // Exception-Check(s) to ensure that if any parameters which are not declared as 5683 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5684 5685 if (innerRequestId == null) BRDPC.throwNPE("innerRequestId"); 5686 if (innerRequestURL == null) BRDPC.throwNPE("innerRequestURL"); 5687 5688 this.innerRequestId = innerRequestId; 5689 this.innerRequestURL = innerRequestURL; 5690 this.bundleRequestId = bundleRequestId; 5691 } 5692 5693 /** 5694 * JSON Object Constructor 5695 * @param jo A Json-Object having data about an instance of {@code 'subresourceWebBundleInnerResponseParsed'}. 5696 */ 5697 public subresourceWebBundleInnerResponseParsed (JsonObject jo) 5698 { 5699 super("Network", "subresourceWebBundleInnerResponseParsed", 3); 5700 5701 this.innerRequestId = ReadJSON.getString(jo, "innerRequestId", false, true); 5702 this.innerRequestURL = ReadJSON.getString(jo, "innerRequestURL", false, true); 5703 this.bundleRequestId = ReadJSON.getString(jo, "bundleRequestId", true, false); 5704 } 5705 5706 } 5707 5708 /** 5709 * Fired when request for resources within a .wbn file failed. 5710 * <BR /> 5711 * <BR /><B>EXPERIMENTAL</B> 5712 */ 5713 public static class subresourceWebBundleInnerResponseError extends BrowserEvent 5714 { 5715 /** For Object Serialization. java.io.Serializable */ 5716 protected static final long serialVersionUID = 1; 5717 5718 public boolean[] optionals() 5719 { return new boolean[] { false, false, false, true, }; } 5720 5721 /** Request identifier of the subresource request */ 5722 public final String innerRequestId; 5723 5724 /** URL of the subresource resource. */ 5725 public final String innerRequestURL; 5726 5727 /** Error message */ 5728 public final String errorMessage; 5729 5730 /** 5731 * Bundle request identifier. Used to match this information to another event. 5732 * This made be absent in case when the instrumentation was enabled only 5733 * after webbundle was parsed. 5734 * <BR /> 5735 * <BR /><B>OPTIONAL</B> 5736 */ 5737 public final String bundleRequestId; 5738 5739 /** 5740 * Constructor 5741 * 5742 * @param innerRequestId Request identifier of the subresource request 5743 * 5744 * @param innerRequestURL URL of the subresource resource. 5745 * 5746 * @param errorMessage Error message 5747 * 5748 * @param bundleRequestId 5749 * Bundle request identifier. Used to match this information to another event. 5750 * This made be absent in case when the instrumentation was enabled only 5751 * after webbundle was parsed. 5752 * <BR /><B>OPTIONAL</B> 5753 */ 5754 public subresourceWebBundleInnerResponseError( 5755 String innerRequestId, String innerRequestURL, String errorMessage, 5756 String bundleRequestId 5757 ) 5758 { 5759 super("Network", "subresourceWebBundleInnerResponseError", 4); 5760 5761 // Exception-Check(s) to ensure that if any parameters which are not declared as 5762 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5763 5764 if (innerRequestId == null) BRDPC.throwNPE("innerRequestId"); 5765 if (innerRequestURL == null) BRDPC.throwNPE("innerRequestURL"); 5766 if (errorMessage == null) BRDPC.throwNPE("errorMessage"); 5767 5768 this.innerRequestId = innerRequestId; 5769 this.innerRequestURL = innerRequestURL; 5770 this.errorMessage = errorMessage; 5771 this.bundleRequestId = bundleRequestId; 5772 } 5773 5774 /** 5775 * JSON Object Constructor 5776 * @param jo A Json-Object having data about an instance of {@code 'subresourceWebBundleInnerResponseError'}. 5777 */ 5778 public subresourceWebBundleInnerResponseError (JsonObject jo) 5779 { 5780 super("Network", "subresourceWebBundleInnerResponseError", 4); 5781 5782 this.innerRequestId = ReadJSON.getString(jo, "innerRequestId", false, true); 5783 this.innerRequestURL = ReadJSON.getString(jo, "innerRequestURL", false, true); 5784 this.errorMessage = ReadJSON.getString(jo, "errorMessage", false, true); 5785 this.bundleRequestId = ReadJSON.getString(jo, "bundleRequestId", true, false); 5786 } 5787 5788 } 5789 5790 /** 5791 * Is sent whenever a new report is added. 5792 * And after 'enableReportingApi' for all existing reports. 5793 * <BR /> 5794 * <BR /><B>EXPERIMENTAL</B> 5795 */ 5796 public static class reportingApiReportAdded extends BrowserEvent 5797 { 5798 /** For Object Serialization. java.io.Serializable */ 5799 protected static final long serialVersionUID = 1; 5800 5801 public boolean[] optionals() 5802 { return new boolean[] { false, }; } 5803 5804 /** <CODE>[No Description Provided by Google]</CODE> */ 5805 public final Network.ReportingApiReport report; 5806 5807 /** 5808 * Constructor 5809 * 5810 * @param report - 5811 */ 5812 public reportingApiReportAdded(Network.ReportingApiReport report) 5813 { 5814 super("Network", "reportingApiReportAdded", 1); 5815 5816 // Exception-Check(s) to ensure that if any parameters which are not declared as 5817 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5818 5819 if (report == null) BRDPC.throwNPE("report"); 5820 5821 this.report = report; 5822 } 5823 5824 /** 5825 * JSON Object Constructor 5826 * @param jo A Json-Object having data about an instance of {@code 'reportingApiReportAdded'}. 5827 */ 5828 public reportingApiReportAdded (JsonObject jo) 5829 { 5830 super("Network", "reportingApiReportAdded", 1); 5831 5832 this.report = ReadJSON.XL.getObject(jo, "report", Network.ReportingApiReport.class, false, true); 5833 } 5834 5835 } 5836 5837 /** 5838 * <CODE>[No Description Provided by Google]</CODE> 5839 * <BR /> 5840 * <BR /><B>EXPERIMENTAL</B> 5841 */ 5842 public static class reportingApiReportUpdated extends BrowserEvent 5843 { 5844 /** For Object Serialization. java.io.Serializable */ 5845 protected static final long serialVersionUID = 1; 5846 5847 public boolean[] optionals() 5848 { return new boolean[] { false, }; } 5849 5850 /** <CODE>[No Description Provided by Google]</CODE> */ 5851 public final Network.ReportingApiReport report; 5852 5853 /** 5854 * Constructor 5855 * 5856 * @param report - 5857 */ 5858 public reportingApiReportUpdated(Network.ReportingApiReport report) 5859 { 5860 super("Network", "reportingApiReportUpdated", 1); 5861 5862 // Exception-Check(s) to ensure that if any parameters which are not declared as 5863 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5864 5865 if (report == null) BRDPC.throwNPE("report"); 5866 5867 this.report = report; 5868 } 5869 5870 /** 5871 * JSON Object Constructor 5872 * @param jo A Json-Object having data about an instance of {@code 'reportingApiReportUpdated'}. 5873 */ 5874 public reportingApiReportUpdated (JsonObject jo) 5875 { 5876 super("Network", "reportingApiReportUpdated", 1); 5877 5878 this.report = ReadJSON.XL.getObject(jo, "report", Network.ReportingApiReport.class, false, true); 5879 } 5880 5881 } 5882 5883 5884 // Counter for keeping the WebSocket Request ID's distinct. 5885 private static int counter = 1; 5886 5887 /** 5888 * Sets a list of content encodings that will be accepted. Empty list means no encoding is accepted. 5889 * <BR /><B>EXPERIMENTAL</B> 5890 * 5891 * @param encodings List of accepted content encodings. 5892 * 5893 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5894 * {@link Ret0}></CODE> 5895 * 5896 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 5897 * browser receives the invocation-request. 5898 * 5899 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 5900 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 5901 * {@code >} to ensure the Browser Function has run to completion. 5902 */ 5903 public static Script<String, JsonObject, Ret0> setAcceptedEncodings(String[] encodings) 5904 { 5905 // Exception-Check(s) to ensure that if any parameters which are not declared as 5906 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5907 5908 if (encodings == null) BRDPC.throwNPE("encodings"); 5909 5910 final int webSocketID = 30000000 + counter++; 5911 final boolean[] optionals = { false, }; 5912 5913 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5914 String requestJSON = WriteJSON.get( 5915 parameterTypes.get("setAcceptedEncodings"), 5916 parameterNames.get("setAcceptedEncodings"), 5917 optionals, webSocketID, 5918 "Network.setAcceptedEncodings", 5919 (Object) encodings 5920 ); 5921 5922 // This Remote Command does not have a Return-Value. 5923 return new Script<> 5924 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 5925 } 5926 5927 /** 5928 * Clears accepted encodings set by setAcceptedEncodings 5929 * <BR /><B>EXPERIMENTAL</B> 5930 * 5931 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5932 * {@link Ret0}></CODE> 5933 * 5934 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 5935 * browser receives the invocation-request. 5936 * 5937 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 5938 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 5939 * {@code >} to ensure the Browser Function has run to completion. 5940 */ 5941 public static Script<String, JsonObject, Ret0> clearAcceptedEncodingsOverride() 5942 { 5943 final int webSocketID = 30001000 + counter++; 5944 final boolean[] optionals = new boolean[0]; 5945 5946 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5947 String requestJSON = WriteJSON.get( 5948 parameterTypes.get("clearAcceptedEncodingsOverride"), 5949 parameterNames.get("clearAcceptedEncodingsOverride"), 5950 optionals, webSocketID, 5951 "Network.clearAcceptedEncodingsOverride" 5952 ); 5953 5954 // This Remote Command does not have a Return-Value. 5955 return new Script<> 5956 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 5957 } 5958 5959 /** 5960 * Tells whether clearing browser cache is supported. 5961 * <BR /><B>DEPRECATED</B> 5962 * 5963 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5964 * Boolean></CODE> 5965 * 5966 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 5967 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 5968 * Boolean></CODE> will be returned. 5969 * 5970 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 5971 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 5972 * may be retrieved.</I> 5973 * 5974 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 5975 * <BR /><BR /><UL CLASS=JDUL> 5976 * <LI><CODE>Boolean (<B>result</B></CODE>) 5977 * <BR />True if browser cache can be cleared. 5978 * </LI> 5979 * </UL> */ 5980 public static Script<String, JsonObject, Boolean> canClearBrowserCache() 5981 { 5982 final int webSocketID = 30002000 + counter++; 5983 final boolean[] optionals = new boolean[0]; 5984 5985 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5986 String requestJSON = WriteJSON.get( 5987 parameterTypes.get("canClearBrowserCache"), 5988 parameterNames.get("canClearBrowserCache"), 5989 optionals, webSocketID, 5990 "Network.canClearBrowserCache" 5991 ); 5992 5993 // 'JSON Binding' ... Converts Browser Response-JSON to 'Boolean' 5994 Function<JsonObject, Boolean> responseProcessor = (JsonObject jo) -> 5995 ReadJSON.getBoolean(jo, "result"); 5996 5997 // Pass the 'defaultSender' to Script-Constructor 5998 // The sender that is used can be changed before executing script. 5999 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 6000 } 6001 6002 /** 6003 * Tells whether clearing browser cookies is supported. 6004 * <BR /><B>DEPRECATED</B> 6005 * 6006 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6007 * Boolean></CODE> 6008 * 6009 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 6010 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 6011 * Boolean></CODE> will be returned. 6012 * 6013 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 6014 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 6015 * may be retrieved.</I> 6016 * 6017 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 6018 * <BR /><BR /><UL CLASS=JDUL> 6019 * <LI><CODE>Boolean (<B>result</B></CODE>) 6020 * <BR />True if browser cookies can be cleared. 6021 * </LI> 6022 * </UL> */ 6023 public static Script<String, JsonObject, Boolean> canClearBrowserCookies() 6024 { 6025 final int webSocketID = 30003000 + counter++; 6026 final boolean[] optionals = new boolean[0]; 6027 6028 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6029 String requestJSON = WriteJSON.get( 6030 parameterTypes.get("canClearBrowserCookies"), 6031 parameterNames.get("canClearBrowserCookies"), 6032 optionals, webSocketID, 6033 "Network.canClearBrowserCookies" 6034 ); 6035 6036 // 'JSON Binding' ... Converts Browser Response-JSON to 'Boolean' 6037 Function<JsonObject, Boolean> responseProcessor = (JsonObject jo) -> 6038 ReadJSON.getBoolean(jo, "result"); 6039 6040 // Pass the 'defaultSender' to Script-Constructor 6041 // The sender that is used can be changed before executing script. 6042 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 6043 } 6044 6045 /** 6046 * Tells whether emulation of network conditions is supported. 6047 * <BR /><B>DEPRECATED</B> 6048 * 6049 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6050 * Boolean></CODE> 6051 * 6052 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 6053 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 6054 * Boolean></CODE> will be returned. 6055 * 6056 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 6057 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 6058 * may be retrieved.</I> 6059 * 6060 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 6061 * <BR /><BR /><UL CLASS=JDUL> 6062 * <LI><CODE>Boolean (<B>result</B></CODE>) 6063 * <BR />True if emulation of network conditions is supported. 6064 * </LI> 6065 * </UL> */ 6066 public static Script<String, JsonObject, Boolean> canEmulateNetworkConditions() 6067 { 6068 final int webSocketID = 30004000 + counter++; 6069 final boolean[] optionals = new boolean[0]; 6070 6071 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6072 String requestJSON = WriteJSON.get( 6073 parameterTypes.get("canEmulateNetworkConditions"), 6074 parameterNames.get("canEmulateNetworkConditions"), 6075 optionals, webSocketID, 6076 "Network.canEmulateNetworkConditions" 6077 ); 6078 6079 // 'JSON Binding' ... Converts Browser Response-JSON to 'Boolean' 6080 Function<JsonObject, Boolean> responseProcessor = (JsonObject jo) -> 6081 ReadJSON.getBoolean(jo, "result"); 6082 6083 // Pass the 'defaultSender' to Script-Constructor 6084 // The sender that is used can be changed before executing script. 6085 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 6086 } 6087 6088 /** 6089 * Clears browser cache. 6090 * 6091 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6092 * {@link Ret0}></CODE> 6093 * 6094 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6095 * browser receives the invocation-request. 6096 * 6097 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6098 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6099 * {@code >} to ensure the Browser Function has run to completion. 6100 */ 6101 public static Script<String, JsonObject, Ret0> clearBrowserCache() 6102 { 6103 final int webSocketID = 30005000 + counter++; 6104 final boolean[] optionals = new boolean[0]; 6105 6106 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6107 String requestJSON = WriteJSON.get( 6108 parameterTypes.get("clearBrowserCache"), 6109 parameterNames.get("clearBrowserCache"), 6110 optionals, webSocketID, 6111 "Network.clearBrowserCache" 6112 ); 6113 6114 // This Remote Command does not have a Return-Value. 6115 return new Script<> 6116 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 6117 } 6118 6119 /** 6120 * Clears browser cookies. 6121 * 6122 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6123 * {@link Ret0}></CODE> 6124 * 6125 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6126 * browser receives the invocation-request. 6127 * 6128 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6129 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6130 * {@code >} to ensure the Browser Function has run to completion. 6131 */ 6132 public static Script<String, JsonObject, Ret0> clearBrowserCookies() 6133 { 6134 final int webSocketID = 30006000 + counter++; 6135 final boolean[] optionals = new boolean[0]; 6136 6137 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6138 String requestJSON = WriteJSON.get( 6139 parameterTypes.get("clearBrowserCookies"), 6140 parameterNames.get("clearBrowserCookies"), 6141 optionals, webSocketID, 6142 "Network.clearBrowserCookies" 6143 ); 6144 6145 // This Remote Command does not have a Return-Value. 6146 return new Script<> 6147 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 6148 } 6149 6150 /** 6151 * Response to Network.requestIntercepted which either modifies the request to continue with any 6152 * modifications, or blocks it, or completes it with the provided response bytes. If a network 6153 * fetch occurs as a result which encounters a redirect an additional Network.requestIntercepted 6154 * event will be sent with the same InterceptionId. 6155 * Deprecated, use Fetch.continueRequest, Fetch.fulfillRequest and Fetch.failRequest instead. 6156 * <BR /><B>EXPERIMENTAL</B> 6157 * <BR /><B>DEPRECATED</B> 6158 * 6159 * @param interceptionId - 6160 * 6161 * @param errorReason 6162 * If set this causes the request to fail with the given reason. Passing <CODE>Aborted</CODE> for requests 6163 * marked with <CODE>isNavigationRequest</CODE> also cancels the navigation. Must not be set in response 6164 * to an authChallenge. 6165 * <BR /><B>OPTIONAL</B> 6166 * 6167 * @param rawResponse 6168 * If set the requests completes using with the provided base64 encoded raw response, including 6169 * HTTP status line and headers etc... Must not be set in response to an authChallenge. (Encoded as a base64 string when passed over JSON) 6170 * <BR /><B>OPTIONAL</B> 6171 * 6172 * @param url 6173 * If set the request url will be modified in a way that's not observable by page. Must not be 6174 * set in response to an authChallenge. 6175 * <BR /><B>OPTIONAL</B> 6176 * 6177 * @param method 6178 * If set this allows the request method to be overridden. Must not be set in response to an 6179 * authChallenge. 6180 * <BR /><B>OPTIONAL</B> 6181 * 6182 * @param postData If set this allows postData to be set. Must not be set in response to an authChallenge. 6183 * <BR /><B>OPTIONAL</B> 6184 * 6185 * @param headers 6186 * If set this allows the request headers to be changed. Must not be set in response to an 6187 * authChallenge. 6188 * <BR /><B>OPTIONAL</B> 6189 * 6190 * @param authChallengeResponse Response to a requestIntercepted with an authChallenge. Must not be set otherwise. 6191 * <BR /><B>OPTIONAL</B> 6192 * 6193 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6194 * {@link Ret0}></CODE> 6195 * 6196 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6197 * browser receives the invocation-request. 6198 * 6199 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6200 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6201 * {@code >} to ensure the Browser Function has run to completion. 6202 */ 6203 public static Script<String, JsonObject, Ret0> continueInterceptedRequest( 6204 String interceptionId, String errorReason, String rawResponse, String url, 6205 String method, String postData, JsonObject headers, 6206 Network.AuthChallengeResponse authChallengeResponse 6207 ) 6208 { 6209 // Exception-Check(s) to ensure that if any parameters which are not declared as 6210 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6211 6212 if (interceptionId == null) BRDPC.throwNPE("interceptionId"); 6213 6214 // Exception-Check(s) to ensure that if any parameters which must adhere to a 6215 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 6216 6217 BRDPC.checkIAE("errorReason", errorReason, "Network.ErrorReason", Network.ErrorReason); 6218 6219 final int webSocketID = 30007000 + counter++; 6220 final boolean[] optionals = { false, true, true, true, true, true, true, true, }; 6221 6222 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6223 String requestJSON = WriteJSON.get( 6224 parameterTypes.get("continueInterceptedRequest"), 6225 parameterNames.get("continueInterceptedRequest"), 6226 optionals, webSocketID, 6227 "Network.continueInterceptedRequest", 6228 interceptionId, errorReason, rawResponse, url, method, postData, headers, 6229 authChallengeResponse 6230 ); 6231 6232 // This Remote Command does not have a Return-Value. 6233 return new Script<> 6234 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 6235 } 6236 6237 /** 6238 * Deletes browser cookies with matching name and url or domain/path pair. 6239 * 6240 * @param name Name of the cookies to remove. 6241 * 6242 * @param url 6243 * If specified, deletes all the cookies with the given name where domain and path match 6244 * provided URL. 6245 * <BR /><B>OPTIONAL</B> 6246 * 6247 * @param domain If specified, deletes only cookies with the exact domain. 6248 * <BR /><B>OPTIONAL</B> 6249 * 6250 * @param path If specified, deletes only cookies with the exact path. 6251 * <BR /><B>OPTIONAL</B> 6252 * 6253 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6254 * {@link Ret0}></CODE> 6255 * 6256 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6257 * browser receives the invocation-request. 6258 * 6259 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6260 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6261 * {@code >} to ensure the Browser Function has run to completion. 6262 */ 6263 public static Script<String, JsonObject, Ret0> deleteCookies 6264 (String name, String url, String domain, String path) 6265 { 6266 // Exception-Check(s) to ensure that if any parameters which are not declared as 6267 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6268 6269 if (name == null) BRDPC.throwNPE("name"); 6270 6271 final int webSocketID = 30008000 + counter++; 6272 final boolean[] optionals = { false, true, true, true, }; 6273 6274 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6275 String requestJSON = WriteJSON.get( 6276 parameterTypes.get("deleteCookies"), 6277 parameterNames.get("deleteCookies"), 6278 optionals, webSocketID, 6279 "Network.deleteCookies", 6280 name, url, domain, path 6281 ); 6282 6283 // This Remote Command does not have a Return-Value. 6284 return new Script<> 6285 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 6286 } 6287 6288 /** 6289 * Disables network tracking, prevents network events from being sent to the client. 6290 * 6291 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6292 * {@link Ret0}></CODE> 6293 * 6294 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6295 * browser receives the invocation-request. 6296 * 6297 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6298 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6299 * {@code >} to ensure the Browser Function has run to completion. 6300 */ 6301 public static Script<String, JsonObject, Ret0> disable() 6302 { 6303 final int webSocketID = 30009000 + counter++; 6304 final boolean[] optionals = new boolean[0]; 6305 6306 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6307 String requestJSON = WriteJSON.get( 6308 parameterTypes.get("disable"), 6309 parameterNames.get("disable"), 6310 optionals, webSocketID, 6311 "Network.disable" 6312 ); 6313 6314 // This Remote Command does not have a Return-Value. 6315 return new Script<> 6316 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 6317 } 6318 6319 /** 6320 * Activates emulation of network conditions. 6321 * 6322 * @param offline True to emulate internet disconnection. 6323 * 6324 * @param latency Minimum latency from request sent to response headers received (ms). 6325 * 6326 * @param downloadThroughput Maximal aggregated download throughput (bytes/sec). -1 disables download throttling. 6327 * 6328 * @param uploadThroughput Maximal aggregated upload throughput (bytes/sec). -1 disables upload throttling. 6329 * 6330 * @param connectionType Connection type if known. 6331 * <BR /><B>OPTIONAL</B> 6332 * 6333 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6334 * {@link Ret0}></CODE> 6335 * 6336 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6337 * browser receives the invocation-request. 6338 * 6339 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6340 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6341 * {@code >} to ensure the Browser Function has run to completion. 6342 */ 6343 public static Script<String, JsonObject, Ret0> emulateNetworkConditions( 6344 boolean offline, Number latency, Number downloadThroughput, Number uploadThroughput, 6345 String connectionType 6346 ) 6347 { 6348 // Exception-Check(s) to ensure that if any parameters which are not declared as 6349 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6350 6351 if (latency == null) BRDPC.throwNPE("latency"); 6352 if (downloadThroughput == null) BRDPC.throwNPE("downloadThroughput"); 6353 if (uploadThroughput == null) BRDPC.throwNPE("uploadThroughput"); 6354 6355 // Exception-Check(s) to ensure that if any parameters which must adhere to a 6356 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 6357 6358 BRDPC.checkIAE("connectionType", connectionType, "Network.ConnectionType", Network.ConnectionType); 6359 6360 final int webSocketID = 30010000 + counter++; 6361 final boolean[] optionals = { false, false, false, false, true, }; 6362 6363 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6364 String requestJSON = WriteJSON.get( 6365 parameterTypes.get("emulateNetworkConditions"), 6366 parameterNames.get("emulateNetworkConditions"), 6367 optionals, webSocketID, 6368 "Network.emulateNetworkConditions", 6369 offline, latency, downloadThroughput, uploadThroughput, connectionType 6370 ); 6371 6372 // This Remote Command does not have a Return-Value. 6373 return new Script<> 6374 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 6375 } 6376 6377 /** 6378 * Enables network tracking, network events will now be delivered to the client. 6379 * 6380 * @param maxTotalBufferSize Buffer size in bytes to use when preserving network payloads (XHRs, etc). 6381 * <BR /><B>OPTIONAL</B> 6382 * <BR /><B>EXPERIMENTAL</B> 6383 * 6384 * @param maxResourceBufferSize Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc). 6385 * <BR /><B>OPTIONAL</B> 6386 * <BR /><B>EXPERIMENTAL</B> 6387 * 6388 * @param maxPostDataSize Longest post body size (in bytes) that would be included in requestWillBeSent notification 6389 * <BR /><B>OPTIONAL</B> 6390 * 6391 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6392 * {@link Ret0}></CODE> 6393 * 6394 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6395 * browser receives the invocation-request. 6396 * 6397 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6398 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6399 * {@code >} to ensure the Browser Function has run to completion. 6400 */ 6401 public static Script<String, JsonObject, Ret0> enable 6402 (Integer maxTotalBufferSize, Integer maxResourceBufferSize, Integer maxPostDataSize) 6403 { 6404 final int webSocketID = 30011000 + counter++; 6405 final boolean[] optionals = { true, true, true, }; 6406 6407 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6408 String requestJSON = WriteJSON.get( 6409 parameterTypes.get("enable"), 6410 parameterNames.get("enable"), 6411 optionals, webSocketID, 6412 "Network.enable", 6413 maxTotalBufferSize, maxResourceBufferSize, maxPostDataSize 6414 ); 6415 6416 // This Remote Command does not have a Return-Value. 6417 return new Script<> 6418 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 6419 } 6420 6421 /** 6422 * Returns all browser cookies. Depending on the backend support, will return detailed cookie 6423 * information in the <CODE>cookies</CODE> field. 6424 * 6425 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6426 * {@link Network.Cookie}[]></CODE> 6427 * 6428 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 6429 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 6430 * {@link Network.Cookie}[]></CODE> will be returned. 6431 * 6432 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 6433 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 6434 * may be retrieved.</I> 6435 * 6436 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 6437 * <BR /><BR /><UL CLASS=JDUL> 6438 * <LI><CODE>{@link Network.Cookie}[] (<B>cookies</B></CODE>) 6439 * <BR />Array of cookie objects. 6440 * </LI> 6441 * </UL> */ 6442 public static Script<String, JsonObject, Network.Cookie[]> getAllCookies() 6443 { 6444 final int webSocketID = 30012000 + counter++; 6445 final boolean[] optionals = new boolean[0]; 6446 6447 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6448 String requestJSON = WriteJSON.get( 6449 parameterTypes.get("getAllCookies"), 6450 parameterNames.get("getAllCookies"), 6451 optionals, webSocketID, 6452 "Network.getAllCookies" 6453 ); 6454 6455 // 'JSON Binding' ... Converts Browser Response-JSON to 'Network.Cookie[]' 6456 Function<JsonObject, Network.Cookie[]> responseProcessor = (JsonObject jo) -> 6457 (jo.getJsonArray("cookies") == null) 6458 ? null 6459 : ReadArrJSON.DimN.objArr(jo.getJsonArray("cookies"), null, 0, Network.Cookie[].class); 6460 6461 // Pass the 'defaultSender' to Script-Constructor 6462 // The sender that is used can be changed before executing script. 6463 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 6464 } 6465 6466 /** 6467 * Returns the DER-encoded certificate. 6468 * <BR /><B>EXPERIMENTAL</B> 6469 * 6470 * @param origin Origin to get certificate for. 6471 * 6472 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6473 * String[]></CODE> 6474 * 6475 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 6476 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 6477 * String[]></CODE> will be returned. 6478 * 6479 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 6480 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 6481 * may be retrieved.</I> 6482 * 6483 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 6484 * <BR /><BR /><UL CLASS=JDUL> 6485 * <LI><CODE>String[] (<B>tableNames</B></CODE>) 6486 * <BR />- 6487 * </LI> 6488 * </UL> */ 6489 public static Script<String, JsonObject, String[]> getCertificate(String origin) 6490 { 6491 // Exception-Check(s) to ensure that if any parameters which are not declared as 6492 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6493 6494 if (origin == null) BRDPC.throwNPE("origin"); 6495 6496 final int webSocketID = 30013000 + counter++; 6497 final boolean[] optionals = { false, }; 6498 6499 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6500 String requestJSON = WriteJSON.get( 6501 parameterTypes.get("getCertificate"), 6502 parameterNames.get("getCertificate"), 6503 optionals, webSocketID, 6504 "Network.getCertificate", 6505 origin 6506 ); 6507 6508 // 'JSON Binding' ... Converts Browser Response-JSON to 'String[]' 6509 Function<JsonObject, String[]> responseProcessor = (JsonObject jo) -> 6510 (jo.getJsonArray("tableNames") == null) 6511 ? null 6512 : ReadArrJSON.DimN.strArr(jo.getJsonArray("tableNames"), null, 0, String[].class); 6513 6514 // Pass the 'defaultSender' to Script-Constructor 6515 // The sender that is used can be changed before executing script. 6516 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 6517 } 6518 6519 /** 6520 * Returns all browser cookies for the current URL. Depending on the backend support, will return 6521 * detailed cookie information in the <CODE>cookies</CODE> field. 6522 * 6523 * @param urls 6524 * The list of URLs for which applicable cookies will be fetched. 6525 * If not specified, it's assumed to be set to the list containing 6526 * the URLs of the page and all of its subframes. 6527 * <BR /><B>OPTIONAL</B> 6528 * 6529 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6530 * {@link Network.Cookie}[]></CODE> 6531 * 6532 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 6533 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 6534 * {@link Network.Cookie}[]></CODE> will be returned. 6535 * 6536 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 6537 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 6538 * may be retrieved.</I> 6539 * 6540 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 6541 * <BR /><BR /><UL CLASS=JDUL> 6542 * <LI><CODE>{@link Network.Cookie}[] (<B>cookies</B></CODE>) 6543 * <BR />Array of cookie objects. 6544 * </LI> 6545 * </UL> */ 6546 public static Script<String, JsonObject, Network.Cookie[]> getCookies(String[] urls) 6547 { 6548 final int webSocketID = 30014000 + counter++; 6549 final boolean[] optionals = { true, }; 6550 6551 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6552 String requestJSON = WriteJSON.get( 6553 parameterTypes.get("getCookies"), 6554 parameterNames.get("getCookies"), 6555 optionals, webSocketID, 6556 "Network.getCookies", 6557 (Object) urls 6558 ); 6559 6560 // 'JSON Binding' ... Converts Browser Response-JSON to 'Network.Cookie[]' 6561 Function<JsonObject, Network.Cookie[]> responseProcessor = (JsonObject jo) -> 6562 (jo.getJsonArray("cookies") == null) 6563 ? null 6564 : ReadArrJSON.DimN.objArr(jo.getJsonArray("cookies"), null, 0, Network.Cookie[].class); 6565 6566 // Pass the 'defaultSender' to Script-Constructor 6567 // The sender that is used can be changed before executing script. 6568 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 6569 } 6570 6571 /** 6572 * Returns content served for the given request. 6573 * 6574 * @param requestId Identifier of the network request to get content for. 6575 * 6576 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6577 * {@link Ret2}></CODE> 6578 * 6579 * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 6580 * {@link Script#exec()}), and a {@link Promise} returned. 6581 * 6582 * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B> 6583 * (using {@link Promise#await()}), the {@code Ret2} will subsequently 6584 * be returned from that call. 6585 * 6586 * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated 6587 * in an instance of <B>{@link Ret2}</B> 6588 * 6589 * <BR /><BR /><UL CLASS=JDUL> 6590 * <LI><CODE><B>Ret2.a:</B> String (<B>body</B>)</CODE> 6591 * <BR />Response body. 6592 * <BR /><BR /></LI> 6593 * <LI><CODE><B>Ret2.b:</B> Boolean (<B>base64Encoded</B>)</CODE> 6594 * <BR />True, if content was sent as base64. 6595 * </LI> 6596 * </UL> 6597 */ 6598 public static Script<String, JsonObject, Ret2<String, Boolean>> getResponseBody 6599 (String requestId) 6600 { 6601 // Exception-Check(s) to ensure that if any parameters which are not declared as 6602 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6603 6604 if (requestId == null) BRDPC.throwNPE("requestId"); 6605 6606 final int webSocketID = 30015000 + counter++; 6607 final boolean[] optionals = { false, }; 6608 6609 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6610 String requestJSON = WriteJSON.get( 6611 parameterTypes.get("getResponseBody"), 6612 parameterNames.get("getResponseBody"), 6613 optionals, webSocketID, 6614 "Network.getResponseBody", 6615 requestId 6616 ); 6617 6618 // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret2' 6619 Function<JsonObject, Ret2<String, Boolean>> 6620 responseProcessor = (JsonObject jo) -> new Ret2<>( 6621 ReadJSON.getString(jo, "body", false, true), 6622 ReadJSON.getBOOLEAN(jo, "base64Encoded", true) 6623 ); 6624 6625 // Pass the 'defaultSender' to Script-Constructor 6626 // The sender that is used can be changed before executing script. 6627 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 6628 } 6629 6630 /** 6631 * Returns post data sent with the request. Returns an error when no data was sent with the request. 6632 * 6633 * @param requestId Identifier of the network request to get content for. 6634 * 6635 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6636 * String></CODE> 6637 * 6638 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 6639 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 6640 * String></CODE> will be returned. 6641 * 6642 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 6643 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 6644 * may be retrieved.</I> 6645 * 6646 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 6647 * <BR /><BR /><UL CLASS=JDUL> 6648 * <LI><CODE>String (<B>postData</B></CODE>) 6649 * <BR />Request body string, omitting files from multipart requests 6650 * </LI> 6651 * </UL> */ 6652 public static Script<String, JsonObject, String> getRequestPostData(String requestId) 6653 { 6654 // Exception-Check(s) to ensure that if any parameters which are not declared as 6655 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6656 6657 if (requestId == null) BRDPC.throwNPE("requestId"); 6658 6659 final int webSocketID = 30016000 + counter++; 6660 final boolean[] optionals = { false, }; 6661 6662 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6663 String requestJSON = WriteJSON.get( 6664 parameterTypes.get("getRequestPostData"), 6665 parameterNames.get("getRequestPostData"), 6666 optionals, webSocketID, 6667 "Network.getRequestPostData", 6668 requestId 6669 ); 6670 6671 // 'JSON Binding' ... Converts Browser Response-JSON to 'String' 6672 Function<JsonObject, String> responseProcessor = (JsonObject jo) -> 6673 ReadJSON.getString(jo, "postData", false, true); 6674 6675 // Pass the 'defaultSender' to Script-Constructor 6676 // The sender that is used can be changed before executing script. 6677 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 6678 } 6679 6680 /** 6681 * Returns content served for the given currently intercepted request. 6682 * <BR /><B>EXPERIMENTAL</B> 6683 * 6684 * @param interceptionId Identifier for the intercepted request to get body for. 6685 * 6686 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6687 * {@link Ret2}></CODE> 6688 * 6689 * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 6690 * {@link Script#exec()}), and a {@link Promise} returned. 6691 * 6692 * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B> 6693 * (using {@link Promise#await()}), the {@code Ret2} will subsequently 6694 * be returned from that call. 6695 * 6696 * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated 6697 * in an instance of <B>{@link Ret2}</B> 6698 * 6699 * <BR /><BR /><UL CLASS=JDUL> 6700 * <LI><CODE><B>Ret2.a:</B> String (<B>body</B>)</CODE> 6701 * <BR />Response body. 6702 * <BR /><BR /></LI> 6703 * <LI><CODE><B>Ret2.b:</B> Boolean (<B>base64Encoded</B>)</CODE> 6704 * <BR />True, if content was sent as base64. 6705 * </LI> 6706 * </UL> 6707 */ 6708 public static Script<String, JsonObject, Ret2<String, Boolean>> getResponseBodyForInterception 6709 (String interceptionId) 6710 { 6711 // Exception-Check(s) to ensure that if any parameters which are not declared as 6712 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6713 6714 if (interceptionId == null) BRDPC.throwNPE("interceptionId"); 6715 6716 final int webSocketID = 30017000 + counter++; 6717 final boolean[] optionals = { false, }; 6718 6719 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6720 String requestJSON = WriteJSON.get( 6721 parameterTypes.get("getResponseBodyForInterception"), 6722 parameterNames.get("getResponseBodyForInterception"), 6723 optionals, webSocketID, 6724 "Network.getResponseBodyForInterception", 6725 interceptionId 6726 ); 6727 6728 // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret2' 6729 Function<JsonObject, Ret2<String, Boolean>> 6730 responseProcessor = (JsonObject jo) -> new Ret2<>( 6731 ReadJSON.getString(jo, "body", false, true), 6732 ReadJSON.getBOOLEAN(jo, "base64Encoded", true) 6733 ); 6734 6735 // Pass the 'defaultSender' to Script-Constructor 6736 // The sender that is used can be changed before executing script. 6737 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 6738 } 6739 6740 /** 6741 * Returns a handle to the stream representing the response body. Note that after this command, 6742 * the intercepted request can't be continued as is -- you either need to cancel it or to provide 6743 * the response body. The stream only supports sequential read, IO.read will fail if the position 6744 * is specified. 6745 * <BR /><B>EXPERIMENTAL</B> 6746 * 6747 * @param interceptionId - 6748 * 6749 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6750 * String></CODE> 6751 * 6752 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 6753 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 6754 * String></CODE> will be returned. 6755 * 6756 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 6757 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 6758 * may be retrieved.</I> 6759 * 6760 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 6761 * <BR /><BR /><UL CLASS=JDUL> 6762 * <LI><CODE>String (<B>stream</B></CODE>) 6763 * <BR />- 6764 * </LI> 6765 * </UL> */ 6766 public static Script<String, JsonObject, String> takeResponseBodyForInterceptionAsStream 6767 (String interceptionId) 6768 { 6769 // Exception-Check(s) to ensure that if any parameters which are not declared as 6770 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6771 6772 if (interceptionId == null) BRDPC.throwNPE("interceptionId"); 6773 6774 final int webSocketID = 30018000 + counter++; 6775 final boolean[] optionals = { false, }; 6776 6777 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6778 String requestJSON = WriteJSON.get( 6779 parameterTypes.get("takeResponseBodyForInterceptionAsStream"), 6780 parameterNames.get("takeResponseBodyForInterceptionAsStream"), 6781 optionals, webSocketID, 6782 "Network.takeResponseBodyForInterceptionAsStream", 6783 interceptionId 6784 ); 6785 6786 // 'JSON Binding' ... Converts Browser Response-JSON to 'String' 6787 Function<JsonObject, String> responseProcessor = (JsonObject jo) -> 6788 ReadJSON.getString(jo, "stream", false, true); 6789 6790 // Pass the 'defaultSender' to Script-Constructor 6791 // The sender that is used can be changed before executing script. 6792 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 6793 } 6794 6795 /** 6796 * This method sends a new XMLHttpRequest which is identical to the original one. The following 6797 * parameters should be identical: method, url, async, request body, extra headers, withCredentials 6798 * attribute, user, password. 6799 * <BR /><B>EXPERIMENTAL</B> 6800 * 6801 * @param requestId Identifier of XHR to replay. 6802 * 6803 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6804 * {@link Ret0}></CODE> 6805 * 6806 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6807 * browser receives the invocation-request. 6808 * 6809 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6810 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6811 * {@code >} to ensure the Browser Function has run to completion. 6812 */ 6813 public static Script<String, JsonObject, Ret0> replayXHR(String requestId) 6814 { 6815 // Exception-Check(s) to ensure that if any parameters which are not declared as 6816 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6817 6818 if (requestId == null) BRDPC.throwNPE("requestId"); 6819 6820 final int webSocketID = 30019000 + counter++; 6821 final boolean[] optionals = { false, }; 6822 6823 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6824 String requestJSON = WriteJSON.get( 6825 parameterTypes.get("replayXHR"), 6826 parameterNames.get("replayXHR"), 6827 optionals, webSocketID, 6828 "Network.replayXHR", 6829 requestId 6830 ); 6831 6832 // This Remote Command does not have a Return-Value. 6833 return new Script<> 6834 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 6835 } 6836 6837 /** 6838 * Searches for given string in response content. 6839 * <BR /><B>EXPERIMENTAL</B> 6840 * 6841 * @param requestId Identifier of the network response to search. 6842 * 6843 * @param query String to search for. 6844 * 6845 * @param caseSensitive If true, search is case sensitive. 6846 * <BR /><B>OPTIONAL</B> 6847 * 6848 * @param isRegex If true, treats string parameter as regex. 6849 * <BR /><B>OPTIONAL</B> 6850 * 6851 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6852 * {@link Debugger.SearchMatch}[]></CODE> 6853 * 6854 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 6855 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 6856 * {@link Debugger.SearchMatch}[]></CODE> will be returned. 6857 * 6858 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 6859 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 6860 * may be retrieved.</I> 6861 * 6862 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 6863 * <BR /><BR /><UL CLASS=JDUL> 6864 * <LI><CODE>{@link Debugger.SearchMatch}[] (<B>result</B></CODE>) 6865 * <BR />List of search matches. 6866 * </LI> 6867 * </UL> */ 6868 public static Script<String, JsonObject, Debugger.SearchMatch[]> searchInResponseBody 6869 (String requestId, String query, Boolean caseSensitive, Boolean isRegex) 6870 { 6871 // Exception-Check(s) to ensure that if any parameters which are not declared as 6872 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6873 6874 if (requestId == null) BRDPC.throwNPE("requestId"); 6875 if (query == null) BRDPC.throwNPE("query"); 6876 6877 final int webSocketID = 30020000 + counter++; 6878 final boolean[] optionals = { false, false, true, true, }; 6879 6880 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6881 String requestJSON = WriteJSON.get( 6882 parameterTypes.get("searchInResponseBody"), 6883 parameterNames.get("searchInResponseBody"), 6884 optionals, webSocketID, 6885 "Network.searchInResponseBody", 6886 requestId, query, caseSensitive, isRegex 6887 ); 6888 6889 // 'JSON Binding' ... Converts Browser Response-JSON to 'Debugger.SearchMatch[]' 6890 Function<JsonObject, Debugger.SearchMatch[]> responseProcessor = (JsonObject jo) -> 6891 (jo.getJsonArray("result") == null) 6892 ? null 6893 : ReadArrJSON.DimN.objArr(jo.getJsonArray("result"), null, 0, Debugger.SearchMatch[].class); 6894 6895 // Pass the 'defaultSender' to Script-Constructor 6896 // The sender that is used can be changed before executing script. 6897 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 6898 } 6899 6900 /** 6901 * Blocks URLs from loading. 6902 * <BR /><B>EXPERIMENTAL</B> 6903 * 6904 * @param urls URL patterns to block. Wildcards ('*') are allowed. 6905 * 6906 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6907 * {@link Ret0}></CODE> 6908 * 6909 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6910 * browser receives the invocation-request. 6911 * 6912 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6913 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6914 * {@code >} to ensure the Browser Function has run to completion. 6915 */ 6916 public static Script<String, JsonObject, Ret0> setBlockedURLs(String[] urls) 6917 { 6918 // Exception-Check(s) to ensure that if any parameters which are not declared as 6919 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6920 6921 if (urls == null) BRDPC.throwNPE("urls"); 6922 6923 final int webSocketID = 30021000 + counter++; 6924 final boolean[] optionals = { false, }; 6925 6926 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6927 String requestJSON = WriteJSON.get( 6928 parameterTypes.get("setBlockedURLs"), 6929 parameterNames.get("setBlockedURLs"), 6930 optionals, webSocketID, 6931 "Network.setBlockedURLs", 6932 (Object) urls 6933 ); 6934 6935 // This Remote Command does not have a Return-Value. 6936 return new Script<> 6937 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 6938 } 6939 6940 /** 6941 * Toggles ignoring of service worker for each request. 6942 * <BR /><B>EXPERIMENTAL</B> 6943 * 6944 * @param bypass Bypass service worker and load from network. 6945 * 6946 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6947 * {@link Ret0}></CODE> 6948 * 6949 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6950 * browser receives the invocation-request. 6951 * 6952 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6953 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6954 * {@code >} to ensure the Browser Function has run to completion. 6955 */ 6956 public static Script<String, JsonObject, Ret0> setBypassServiceWorker(boolean bypass) 6957 { 6958 final int webSocketID = 30022000 + counter++; 6959 final boolean[] optionals = { false, }; 6960 6961 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6962 String requestJSON = WriteJSON.get( 6963 parameterTypes.get("setBypassServiceWorker"), 6964 parameterNames.get("setBypassServiceWorker"), 6965 optionals, webSocketID, 6966 "Network.setBypassServiceWorker", 6967 bypass 6968 ); 6969 6970 // This Remote Command does not have a Return-Value. 6971 return new Script<> 6972 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 6973 } 6974 6975 /** 6976 * Toggles ignoring cache for each request. If <CODE>true</CODE>, cache will not be used. 6977 * 6978 * @param cacheDisabled Cache disabled state. 6979 * 6980 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6981 * {@link Ret0}></CODE> 6982 * 6983 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6984 * browser receives the invocation-request. 6985 * 6986 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6987 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6988 * {@code >} to ensure the Browser Function has run to completion. 6989 */ 6990 public static Script<String, JsonObject, Ret0> setCacheDisabled(boolean cacheDisabled) 6991 { 6992 final int webSocketID = 30023000 + counter++; 6993 final boolean[] optionals = { false, }; 6994 6995 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6996 String requestJSON = WriteJSON.get( 6997 parameterTypes.get("setCacheDisabled"), 6998 parameterNames.get("setCacheDisabled"), 6999 optionals, webSocketID, 7000 "Network.setCacheDisabled", 7001 cacheDisabled 7002 ); 7003 7004 // This Remote Command does not have a Return-Value. 7005 return new Script<> 7006 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 7007 } 7008 7009 /** 7010 * Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist. 7011 * 7012 * @param name Cookie name. 7013 * 7014 * @param value Cookie value. 7015 * 7016 * @param url 7017 * The request-URI to associate with the setting of the cookie. This value can affect the 7018 * default domain, path, source port, and source scheme values of the created cookie. 7019 * <BR /><B>OPTIONAL</B> 7020 * 7021 * @param domain Cookie domain. 7022 * <BR /><B>OPTIONAL</B> 7023 * 7024 * @param path Cookie path. 7025 * <BR /><B>OPTIONAL</B> 7026 * 7027 * @param secure True if cookie is secure. 7028 * <BR /><B>OPTIONAL</B> 7029 * 7030 * @param httpOnly True if cookie is http-only. 7031 * <BR /><B>OPTIONAL</B> 7032 * 7033 * @param sameSite Cookie SameSite type. 7034 * <BR /><B>OPTIONAL</B> 7035 * 7036 * @param expires Cookie expiration date, session cookie if not set 7037 * <BR /><B>OPTIONAL</B> 7038 * 7039 * @param priority Cookie Priority type. 7040 * <BR /><B>OPTIONAL</B> 7041 * <BR /><B>EXPERIMENTAL</B> 7042 * 7043 * @param sameParty True if cookie is SameParty. 7044 * <BR /><B>OPTIONAL</B> 7045 * <BR /><B>EXPERIMENTAL</B> 7046 * 7047 * @param sourceScheme Cookie source scheme type. 7048 * <BR /><B>OPTIONAL</B> 7049 * <BR /><B>EXPERIMENTAL</B> 7050 * 7051 * @param sourcePort 7052 * Cookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port. 7053 * An unspecified port value allows protocol clients to emulate legacy cookie scope for the port. 7054 * This is a temporary ability and it will be removed in the future. 7055 * <BR /><B>OPTIONAL</B> 7056 * <BR /><B>EXPERIMENTAL</B> 7057 * 7058 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 7059 * Boolean></CODE> 7060 * 7061 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 7062 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 7063 * Boolean></CODE> will be returned. 7064 * 7065 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 7066 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 7067 * may be retrieved.</I> 7068 * 7069 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 7070 * <BR /><BR /><UL CLASS=JDUL> 7071 * <LI><CODE>Boolean (<B>success</B></CODE>) 7072 * <BR />Always set to true. If an error occurs, the response indicates protocol error. 7073 * </LI> 7074 * </UL> */ 7075 public static Script<String, JsonObject, Boolean> setCookie( 7076 String name, String value, String url, String domain, String path, Boolean secure, 7077 Boolean httpOnly, String sameSite, Number expires, String priority, Boolean sameParty, 7078 String sourceScheme, Integer sourcePort 7079 ) 7080 { 7081 // Exception-Check(s) to ensure that if any parameters which are not declared as 7082 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 7083 7084 if (name == null) BRDPC.throwNPE("name"); 7085 if (value == null) BRDPC.throwNPE("value"); 7086 7087 // Exception-Check(s) to ensure that if any parameters which must adhere to a 7088 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 7089 7090 BRDPC.checkIAE("sameSite", sameSite, "Network.CookieSameSite", Network.CookieSameSite); 7091 BRDPC.checkIAE("priority", priority, "Network.CookiePriority", Network.CookiePriority); 7092 BRDPC.checkIAE("sourceScheme", sourceScheme, "Network.CookieSourceScheme", Network.CookieSourceScheme); 7093 7094 final int webSocketID = 30024000 + counter++; 7095 final boolean[] optionals = { false, false, true, true, true, true, true, true, true, true, true, true, true, }; 7096 7097 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 7098 String requestJSON = WriteJSON.get( 7099 parameterTypes.get("setCookie"), 7100 parameterNames.get("setCookie"), 7101 optionals, webSocketID, 7102 "Network.setCookie", 7103 name, value, url, domain, path, secure, httpOnly, sameSite, expires, priority, 7104 sameParty, sourceScheme, sourcePort 7105 ); 7106 7107 // 'JSON Binding' ... Converts Browser Response-JSON to 'Boolean' 7108 Function<JsonObject, Boolean> responseProcessor = (JsonObject jo) -> 7109 ReadJSON.getBoolean(jo, "success"); 7110 7111 // Pass the 'defaultSender' to Script-Constructor 7112 // The sender that is used can be changed before executing script. 7113 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 7114 } 7115 7116 /** 7117 * Sets given cookies. 7118 * 7119 * @param cookies Cookies to be set. 7120 * 7121 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 7122 * {@link Ret0}></CODE> 7123 * 7124 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 7125 * browser receives the invocation-request. 7126 * 7127 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 7128 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 7129 * {@code >} to ensure the Browser Function has run to completion. 7130 */ 7131 public static Script<String, JsonObject, Ret0> setCookies(Network.CookieParam[] cookies) 7132 { 7133 // Exception-Check(s) to ensure that if any parameters which are not declared as 7134 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 7135 7136 if (cookies == null) BRDPC.throwNPE("cookies"); 7137 7138 final int webSocketID = 30025000 + counter++; 7139 final boolean[] optionals = { false, }; 7140 7141 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 7142 String requestJSON = WriteJSON.get( 7143 parameterTypes.get("setCookies"), 7144 parameterNames.get("setCookies"), 7145 optionals, webSocketID, 7146 "Network.setCookies", 7147 (Object) cookies 7148 ); 7149 7150 // This Remote Command does not have a Return-Value. 7151 return new Script<> 7152 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 7153 } 7154 7155 /** 7156 * Specifies whether to always send extra HTTP headers with the requests from this page. 7157 * 7158 * @param headers Map with extra HTTP headers. 7159 * 7160 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 7161 * {@link Ret0}></CODE> 7162 * 7163 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 7164 * browser receives the invocation-request. 7165 * 7166 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 7167 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 7168 * {@code >} to ensure the Browser Function has run to completion. 7169 */ 7170 public static Script<String, JsonObject, Ret0> setExtraHTTPHeaders(JsonObject headers) 7171 { 7172 // Exception-Check(s) to ensure that if any parameters which are not declared as 7173 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 7174 7175 if (headers == null) BRDPC.throwNPE("headers"); 7176 7177 final int webSocketID = 30026000 + counter++; 7178 final boolean[] optionals = { false, }; 7179 7180 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 7181 String requestJSON = WriteJSON.get( 7182 parameterTypes.get("setExtraHTTPHeaders"), 7183 parameterNames.get("setExtraHTTPHeaders"), 7184 optionals, webSocketID, 7185 "Network.setExtraHTTPHeaders", 7186 headers 7187 ); 7188 7189 // This Remote Command does not have a Return-Value. 7190 return new Script<> 7191 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 7192 } 7193 7194 /** 7195 * Specifies whether to attach a page script stack id in requests 7196 * <BR /><B>EXPERIMENTAL</B> 7197 * 7198 * @param enabled Whether to attach a page script stack for debugging purpose. 7199 * 7200 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 7201 * {@link Ret0}></CODE> 7202 * 7203 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 7204 * browser receives the invocation-request. 7205 * 7206 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 7207 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 7208 * {@code >} to ensure the Browser Function has run to completion. 7209 */ 7210 public static Script<String, JsonObject, Ret0> setAttachDebugStack(boolean enabled) 7211 { 7212 final int webSocketID = 30027000 + counter++; 7213 final boolean[] optionals = { false, }; 7214 7215 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 7216 String requestJSON = WriteJSON.get( 7217 parameterTypes.get("setAttachDebugStack"), 7218 parameterNames.get("setAttachDebugStack"), 7219 optionals, webSocketID, 7220 "Network.setAttachDebugStack", 7221 enabled 7222 ); 7223 7224 // This Remote Command does not have a Return-Value. 7225 return new Script<> 7226 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 7227 } 7228 7229 /** 7230 * Sets the requests to intercept that match the provided patterns and optionally resource types. 7231 * Deprecated, please use Fetch.enable instead. 7232 * <BR /><B>EXPERIMENTAL</B> 7233 * <BR /><B>DEPRECATED</B> 7234 * 7235 * @param patterns 7236 * Requests matching any of these patterns will be forwarded and wait for the corresponding 7237 * continueInterceptedRequest call. 7238 * 7239 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 7240 * {@link Ret0}></CODE> 7241 * 7242 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 7243 * browser receives the invocation-request. 7244 * 7245 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 7246 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 7247 * {@code >} to ensure the Browser Function has run to completion. 7248 */ 7249 public static Script<String, JsonObject, Ret0> setRequestInterception 7250 (Network.RequestPattern[] patterns) 7251 { 7252 // Exception-Check(s) to ensure that if any parameters which are not declared as 7253 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 7254 7255 if (patterns == null) BRDPC.throwNPE("patterns"); 7256 7257 final int webSocketID = 30028000 + counter++; 7258 final boolean[] optionals = { false, }; 7259 7260 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 7261 String requestJSON = WriteJSON.get( 7262 parameterTypes.get("setRequestInterception"), 7263 parameterNames.get("setRequestInterception"), 7264 optionals, webSocketID, 7265 "Network.setRequestInterception", 7266 (Object) patterns 7267 ); 7268 7269 // This Remote Command does not have a Return-Value. 7270 return new Script<> 7271 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 7272 } 7273 7274 /** 7275 * Allows overriding user agent with the given string. 7276 * 7277 * @param userAgent User agent to use. 7278 * 7279 * @param acceptLanguage Browser langugage to emulate. 7280 * <BR /><B>OPTIONAL</B> 7281 * 7282 * @param platform The platform navigator.platform should return. 7283 * <BR /><B>OPTIONAL</B> 7284 * 7285 * @param userAgentMetadata To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData 7286 * <BR /><B>OPTIONAL</B> 7287 * <BR /><B>EXPERIMENTAL</B> 7288 * 7289 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 7290 * {@link Ret0}></CODE> 7291 * 7292 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 7293 * browser receives the invocation-request. 7294 * 7295 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 7296 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 7297 * {@code >} to ensure the Browser Function has run to completion. 7298 */ 7299 public static Script<String, JsonObject, Ret0> setUserAgentOverride( 7300 String userAgent, String acceptLanguage, String platform, 7301 Emulation.UserAgentMetadata userAgentMetadata 7302 ) 7303 { 7304 // Exception-Check(s) to ensure that if any parameters which are not declared as 7305 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 7306 7307 if (userAgent == null) BRDPC.throwNPE("userAgent"); 7308 7309 final int webSocketID = 30029000 + counter++; 7310 final boolean[] optionals = { false, true, true, true, }; 7311 7312 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 7313 String requestJSON = WriteJSON.get( 7314 parameterTypes.get("setUserAgentOverride"), 7315 parameterNames.get("setUserAgentOverride"), 7316 optionals, webSocketID, 7317 "Network.setUserAgentOverride", 7318 userAgent, acceptLanguage, platform, userAgentMetadata 7319 ); 7320 7321 // This Remote Command does not have a Return-Value. 7322 return new Script<> 7323 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 7324 } 7325 7326 /** 7327 * Returns information about the COEP/COOP isolation status. 7328 * <BR /><B>EXPERIMENTAL</B> 7329 * 7330 * @param frameId If no frameId is provided, the status of the target is provided. 7331 * <BR /><B>OPTIONAL</B> 7332 * 7333 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 7334 * {@link Network.SecurityIsolationStatus}></CODE> 7335 * 7336 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 7337 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 7338 * {@link Network.SecurityIsolationStatus}></CODE> will be returned. 7339 * 7340 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 7341 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 7342 * may be retrieved.</I> 7343 * 7344 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 7345 * <BR /><BR /><UL CLASS=JDUL> 7346 * <LI><CODE>{@link Network.SecurityIsolationStatus} (<B>status</B></CODE>) 7347 * <BR />- 7348 * </LI> 7349 * </UL> */ 7350 public static Script<String, JsonObject, Network.SecurityIsolationStatus> getSecurityIsolationStatus 7351 (String frameId) 7352 { 7353 final int webSocketID = 30030000 + counter++; 7354 final boolean[] optionals = { true, }; 7355 7356 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 7357 String requestJSON = WriteJSON.get( 7358 parameterTypes.get("getSecurityIsolationStatus"), 7359 parameterNames.get("getSecurityIsolationStatus"), 7360 optionals, webSocketID, 7361 "Network.getSecurityIsolationStatus", 7362 frameId 7363 ); 7364 7365 // 'JSON Binding' ... Converts Browser Response-JSON to 'Network.SecurityIsolationStatus' 7366 Function<JsonObject, Network.SecurityIsolationStatus> responseProcessor = (JsonObject jo) -> 7367 ReadJSON.XL.getObject(jo, "status", Network.SecurityIsolationStatus.class, false, true); 7368 7369 // Pass the 'defaultSender' to Script-Constructor 7370 // The sender that is used can be changed before executing script. 7371 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 7372 } 7373 7374 /** 7375 * Enables tracking for the Reporting API, events generated by the Reporting API will now be delivered to the client. 7376 * Enabling triggers 'reportingApiReportAdded' for all existing reports. 7377 * <BR /><B>EXPERIMENTAL</B> 7378 * 7379 * @param enable Whether to enable or disable events for the Reporting API 7380 * 7381 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 7382 * {@link Ret0}></CODE> 7383 * 7384 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 7385 * browser receives the invocation-request. 7386 * 7387 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 7388 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 7389 * {@code >} to ensure the Browser Function has run to completion. 7390 */ 7391 public static Script<String, JsonObject, Ret0> enableReportingApi(boolean enable) 7392 { 7393 final int webSocketID = 30031000 + counter++; 7394 final boolean[] optionals = { false, }; 7395 7396 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 7397 String requestJSON = WriteJSON.get( 7398 parameterTypes.get("enableReportingApi"), 7399 parameterNames.get("enableReportingApi"), 7400 optionals, webSocketID, 7401 "Network.enableReportingApi", 7402 enable 7403 ); 7404 7405 // This Remote Command does not have a Return-Value. 7406 return new Script<> 7407 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 7408 } 7409 7410 /** 7411 * Fetches the resource and returns the content. 7412 * <BR /><B>EXPERIMENTAL</B> 7413 * 7414 * @param frameId 7415 * Frame id to get the resource for. Mandatory for frame targets, and 7416 * should be omitted for worker targets. 7417 * <BR /><B>OPTIONAL</B> 7418 * 7419 * @param url URL of the resource to get content for. 7420 * 7421 * @param options Options for the request. 7422 * 7423 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 7424 * {@link Network.LoadNetworkResourcePageResult}></CODE> 7425 * 7426 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 7427 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 7428 * {@link Network.LoadNetworkResourcePageResult}></CODE> will be returned. 7429 * 7430 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 7431 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 7432 * may be retrieved.</I> 7433 * 7434 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 7435 * <BR /><BR /><UL CLASS=JDUL> 7436 * <LI><CODE>{@link Network.LoadNetworkResourcePageResult} (<B>resource</B></CODE>) 7437 * <BR />- 7438 * </LI> 7439 * </UL> */ 7440 public static Script<String, JsonObject, Network.LoadNetworkResourcePageResult> loadNetworkResource 7441 (String frameId, String url, Network.LoadNetworkResourceOptions options) 7442 { 7443 // Exception-Check(s) to ensure that if any parameters which are not declared as 7444 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 7445 7446 if (url == null) BRDPC.throwNPE("url"); 7447 if (options == null) BRDPC.throwNPE("options"); 7448 7449 final int webSocketID = 30032000 + counter++; 7450 final boolean[] optionals = { true, false, false, }; 7451 7452 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 7453 String requestJSON = WriteJSON.get( 7454 parameterTypes.get("loadNetworkResource"), 7455 parameterNames.get("loadNetworkResource"), 7456 optionals, webSocketID, 7457 "Network.loadNetworkResource", 7458 frameId, url, options 7459 ); 7460 7461 // 'JSON Binding' ... Converts Browser Response-JSON to 'Network.LoadNetworkResourcePageResult' 7462 Function<JsonObject, Network.LoadNetworkResourcePageResult> responseProcessor = (JsonObject jo) -> 7463 ReadJSON.XL.getObject(jo, "resource", Network.LoadNetworkResourcePageResult.class, false, true); 7464 7465 // Pass the 'defaultSender' to Script-Constructor 7466 // The sender that is used can be changed before executing script. 7467 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 7468 } 7469 7470}