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