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>Audits domain allows investigation of page violations and possible improvements.</B></SPAN> 024 * 025 * <EMBED CLASS='external-html' DATA-FILE-ID=CODE_GEN_NOTE> 026 */ 027@StaticFunctional(Excused={"counter"}, Excuses={Excuse.CONFIGURATION}) 028@JDHeaderBackgroundImg(EmbedTagFileID="WOOD_PLANK_NOTE") 029public class Audits 030{ 031 // ******************************************************************************************** 032 // ******************************************************************************************** 033 // Class Header Stuff 034 // ******************************************************************************************** 035 // ******************************************************************************************** 036 037 038 // No Pubic Constructors 039 private Audits () { } 040 041 // These two Vector's are used by all the "Methods" exported by this class. java.lang.reflect 042 // is used to generate the JSON String's. It saves thousands of lines of Auto-Generated Code. 043 private static final Map<String, Vector<String>> parameterNames = new HashMap<>(); 044 private static final Map<String, Vector<Class<?>>> parameterTypes = new HashMap<>(); 045 046 // Some Methods do not take any parameters - for instance all the "enable()" and "disable()" 047 // I simply could not get ride of RAW-TYPES and UNCHECKED warnings... so there are now, 048 // offically, two empty-vectors. One for String's, and the other for Classes. 049 050 private static final Vector<String> EMPTY_VEC_STR = new Vector<>(); 051 private static final Vector<Class<?>> EMPTY_VEC_CLASS = new Vector<>(); 052 053 static 054 { 055 for (Method m : Audits.class.getMethods()) 056 { 057 // This doesn't work! The parameter names are all "arg0" ... "argN" 058 // It works for java.lang.reflect.Field, BUT NOT java.lang.reflect.Parameter! 059 // 060 // Vector<String> parameterNamesList = new Vector<>(); -- NOPE! 061 062 Vector<Class<?>> parameterTypesList = new Vector<>(); 063 064 for (Parameter p : m.getParameters()) parameterTypesList.add(p.getType()); 065 066 parameterTypes.put( 067 m.getName(), 068 (parameterTypesList.size() > 0) ? parameterTypesList : EMPTY_VEC_CLASS 069 ); 070 } 071 } 072 073 static 074 { 075 Vector<String> v = null; 076 077 v = new Vector<String>(4); 078 parameterNames.put("getEncodedResponse", v); 079 Collections.addAll(v, new String[] 080 { "requestId", "encoding", "quality", "sizeOnly", }); 081 082 parameterNames.put("disable", EMPTY_VEC_STR); 083 084 parameterNames.put("enable", EMPTY_VEC_STR); 085 086 v = new Vector<String>(1); 087 parameterNames.put("checkContrast", v); 088 Collections.addAll(v, new String[] 089 { "reportAAA", }); 090 } 091 092 093 // ******************************************************************************************** 094 // ******************************************************************************************** 095 // Types - Static Inner Classes 096 // ******************************************************************************************** 097 // ******************************************************************************************** 098 099 // public static class IssueId => String 100 101 /** <CODE>[No Description Provided by Google]</CODE> */ 102 public static final String[] SameSiteCookieExclusionReason = 103 { 104 "ExcludeSameSiteUnspecifiedTreatedAsLax", "ExcludeSameSiteNoneInsecure", 105 "ExcludeSameSiteLax", "ExcludeSameSiteStrict", "ExcludeInvalidSameParty", 106 "ExcludeSamePartyCrossPartyContext", 107 }; 108 109 /** <CODE>[No Description Provided by Google]</CODE> */ 110 public static final String[] SameSiteCookieWarningReason = 111 { 112 "WarnSameSiteUnspecifiedCrossSiteContext", "WarnSameSiteNoneInsecure", 113 "WarnSameSiteUnspecifiedLaxAllowUnsafe", "WarnSameSiteStrictLaxDowngradeStrict", 114 "WarnSameSiteStrictCrossDowngradeStrict", "WarnSameSiteStrictCrossDowngradeLax", 115 "WarnSameSiteLaxCrossDowngradeStrict", "WarnSameSiteLaxCrossDowngradeLax", 116 }; 117 118 /** <CODE>[No Description Provided by Google]</CODE> */ 119 public static final String[] SameSiteCookieOperation = 120 { "SetCookie", "ReadCookie", }; 121 122 /** <CODE>[No Description Provided by Google]</CODE> */ 123 public static final String[] MixedContentResolutionStatus = 124 { "MixedContentBlocked", "MixedContentAutomaticallyUpgraded", "MixedContentWarning", }; 125 126 /** <CODE>[No Description Provided by Google]</CODE> */ 127 public static final String[] MixedContentResourceType = 128 { 129 "Audio", "Beacon", "CSPReport", "Download", "EventSource", "Favicon", "Font", "Form", 130 "Frame", "Image", "Import", "Manifest", "Ping", "PluginData", "PluginResource", "Prefetch", 131 "Resource", "Script", "ServiceWorker", "SharedWorker", "Stylesheet", "Track", "Video", 132 "Worker", "XMLHttpRequest", "XSLT", 133 }; 134 135 /** 136 * Enum indicating the reason a response has been blocked. These reasons are 137 * refinements of the net error BLOCKED_BY_RESPONSE. 138 */ 139 public static final String[] BlockedByResponseReason = 140 { 141 "CoepFrameResourceNeedsCoepHeader", "CoopSandboxedIFrameCannotNavigateToCoopPage", 142 "CorpNotSameOrigin", "CorpNotSameOriginAfterDefaultedToSameOriginByCoep", 143 "CorpNotSameSite", 144 }; 145 146 /** <CODE>[No Description Provided by Google]</CODE> */ 147 public static final String[] HeavyAdResolutionStatus = 148 { "HeavyAdBlocked", "HeavyAdWarning", }; 149 150 /** <CODE>[No Description Provided by Google]</CODE> */ 151 public static final String[] HeavyAdReason = 152 { "NetworkTotalLimit", "CpuTotalLimit", "CpuPeakLimit", }; 153 154 /** <CODE>[No Description Provided by Google]</CODE> */ 155 public static final String[] ContentSecurityPolicyViolationType = 156 { 157 "kInlineViolation", "kEvalViolation", "kURLViolation", "kTrustedTypesSinkViolation", 158 "kTrustedTypesPolicyViolation", "kWasmEvalViolation", 159 }; 160 161 /** <CODE>[No Description Provided by Google]</CODE> */ 162 public static final String[] SharedArrayBufferIssueType = 163 { "TransferIssue", "CreationIssue", }; 164 165 /** <CODE>[No Description Provided by Google]</CODE> */ 166 public static final String[] TwaQualityEnforcementViolationType = 167 { "kHttpError", "kUnavailableOffline", "kDigitalAssetLinks", }; 168 169 /** <CODE>[No Description Provided by Google]</CODE> */ 170 public static final String[] AttributionReportingIssueType = 171 { 172 "PermissionPolicyDisabled", "InvalidAttributionSourceEventId", "InvalidAttributionData", 173 "AttributionSourceUntrustworthyOrigin", "AttributionUntrustworthyOrigin", 174 "AttributionTriggerDataTooLarge", "AttributionEventSourceTriggerDataTooLarge", 175 }; 176 177 /** <CODE>[No Description Provided by Google]</CODE> */ 178 public static final String[] GenericIssueErrorType = 179 { "CrossOriginPortalPostMessageError", }; 180 181 /** 182 * A unique identifier for the type of issue. Each type may use one of the 183 * optional fields in InspectorIssueDetails to convey more specific 184 * information about the kind of issue. 185 */ 186 public static final String[] InspectorIssueCode = 187 { 188 "SameSiteCookieIssue", "MixedContentIssue", "BlockedByResponseIssue", "HeavyAdIssue", 189 "ContentSecurityPolicyIssue", "SharedArrayBufferIssue", "TrustedWebActivityIssue", 190 "LowTextContrastIssue", "CorsIssue", "AttributionReportingIssue", "QuirksModeIssue", 191 "NavigatorUserAgentIssue", "WasmCrossOriginModuleSharingIssue", "GenericIssue", 192 }; 193 194 /** Information about a cookie that is affected by an inspector issue. */ 195 public static class AffectedCookie 196 extends BaseType 197 implements java.io.Serializable 198 { 199 /** For Object Serialization. java.io.Serializable */ 200 protected static final long serialVersionUID = 1; 201 202 public boolean[] optionals() 203 { return new boolean[] { false, false, false, }; } 204 205 /** The following three properties uniquely identify a cookie */ 206 public final String name; 207 208 /** <CODE>[No Description Provided by Google]</CODE> */ 209 public final String path; 210 211 /** <CODE>[No Description Provided by Google]</CODE> */ 212 public final String domain; 213 214 /** 215 * Constructor 216 * 217 * @param name The following three properties uniquely identify a cookie 218 * 219 * @param path - 220 * 221 * @param domain - 222 */ 223 public AffectedCookie(String name, String path, String domain) 224 { 225 // Exception-Check(s) to ensure that if any parameters which are not declared as 226 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 227 228 if (name == null) THROWS.throwNPE("name"); 229 if (path == null) THROWS.throwNPE("path"); 230 if (domain == null) THROWS.throwNPE("domain"); 231 232 this.name = name; 233 this.path = path; 234 this.domain = domain; 235 } 236 237 /** 238 * JSON Object Constructor 239 * @param jo A Json-Object having data about an instance of {@code 'AffectedCookie'}. 240 */ 241 public AffectedCookie (JsonObject jo) 242 { 243 this.name = ReadJSON.getString(jo, "name", false, true); 244 this.path = ReadJSON.getString(jo, "path", false, true); 245 this.domain = ReadJSON.getString(jo, "domain", false, true); 246 } 247 248 249 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 250 public boolean equals(Object other) 251 { 252 if (this == other) return true; 253 if (other == null) return false; 254 if (other.getClass() != this.getClass()) return false; 255 256 AffectedCookie o = (AffectedCookie) other; 257 258 return 259 Objects.equals(this.name, o.name) 260 && Objects.equals(this.path, o.path) 261 && Objects.equals(this.domain, o.domain); 262 } 263 264 /** Generates a Hash-Code for {@code 'this'} instance */ 265 public int hashCode() 266 { 267 return 268 Objects.hashCode(this.name) 269 + Objects.hashCode(this.path) 270 + Objects.hashCode(this.domain); 271 } 272 } 273 274 /** Information about a request that is affected by an inspector issue. */ 275 public static class AffectedRequest 276 extends BaseType 277 implements java.io.Serializable 278 { 279 /** For Object Serialization. java.io.Serializable */ 280 protected static final long serialVersionUID = 1; 281 282 public boolean[] optionals() 283 { return new boolean[] { false, true, }; } 284 285 /** The unique request id. */ 286 public final String requestId; 287 288 /** 289 * <CODE>[No Description Provided by Google]</CODE> 290 * <BR /> 291 * <BR /><B>OPTIONAL</B> 292 */ 293 public final String url; 294 295 /** 296 * Constructor 297 * 298 * @param requestId The unique request id. 299 * 300 * @param url - 301 * <BR /><B>OPTIONAL</B> 302 */ 303 public AffectedRequest(String requestId, String url) 304 { 305 // Exception-Check(s) to ensure that if any parameters which are not declared as 306 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 307 308 if (requestId == null) THROWS.throwNPE("requestId"); 309 310 this.requestId = requestId; 311 this.url = url; 312 } 313 314 /** 315 * JSON Object Constructor 316 * @param jo A Json-Object having data about an instance of {@code 'AffectedRequest'}. 317 */ 318 public AffectedRequest (JsonObject jo) 319 { 320 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 321 this.url = ReadJSON.getString(jo, "url", true, false); 322 } 323 324 325 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 326 public boolean equals(Object other) 327 { 328 if (this == other) return true; 329 if (other == null) return false; 330 if (other.getClass() != this.getClass()) return false; 331 332 AffectedRequest o = (AffectedRequest) other; 333 334 return 335 Objects.equals(this.requestId, o.requestId) 336 && Objects.equals(this.url, o.url); 337 } 338 339 /** Generates a Hash-Code for {@code 'this'} instance */ 340 public int hashCode() 341 { 342 return 343 Objects.hashCode(this.requestId) 344 + Objects.hashCode(this.url); 345 } 346 } 347 348 /** Information about the frame affected by an inspector issue. */ 349 public static class AffectedFrame 350 extends BaseType 351 implements java.io.Serializable 352 { 353 /** For Object Serialization. java.io.Serializable */ 354 protected static final long serialVersionUID = 1; 355 356 public boolean[] optionals() 357 { return new boolean[] { false, }; } 358 359 /** <CODE>[No Description Provided by Google]</CODE> */ 360 public final String frameId; 361 362 /** 363 * Constructor 364 * 365 * @param frameId - 366 */ 367 public AffectedFrame(String frameId) 368 { 369 // Exception-Check(s) to ensure that if any parameters which are not declared as 370 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 371 372 if (frameId == null) THROWS.throwNPE("frameId"); 373 374 this.frameId = frameId; 375 } 376 377 /** 378 * JSON Object Constructor 379 * @param jo A Json-Object having data about an instance of {@code 'AffectedFrame'}. 380 */ 381 public AffectedFrame (JsonObject jo) 382 { 383 this.frameId = ReadJSON.getString(jo, "frameId", false, true); 384 } 385 386 387 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 388 public boolean equals(Object other) 389 { 390 if (this == other) return true; 391 if (other == null) return false; 392 if (other.getClass() != this.getClass()) return false; 393 394 AffectedFrame o = (AffectedFrame) other; 395 396 return 397 Objects.equals(this.frameId, o.frameId); 398 } 399 400 /** Generates a Hash-Code for {@code 'this'} instance */ 401 public int hashCode() 402 { 403 return 404 Objects.hashCode(this.frameId); 405 } 406 } 407 408 /** 409 * This information is currently necessary, as the front-end has a difficult 410 * time finding a specific cookie. With this, we can convey specific error 411 * information without the cookie. 412 */ 413 public static class SameSiteCookieIssueDetails 414 extends BaseType 415 implements java.io.Serializable 416 { 417 /** For Object Serialization. java.io.Serializable */ 418 protected static final long serialVersionUID = 1; 419 420 public boolean[] optionals() 421 { return new boolean[] { true, true, false, false, false, true, true, true, }; } 422 423 /** 424 * If AffectedCookie is not set then rawCookieLine contains the raw 425 * Set-Cookie header string. This hints at a problem where the 426 * cookie line is syntactically or semantically malformed in a way 427 * that no valid cookie could be created. 428 * <BR /> 429 * <BR /><B>OPTIONAL</B> 430 */ 431 public final Audits.AffectedCookie cookie; 432 433 /** 434 * <CODE>[No Description Provided by Google]</CODE> 435 * <BR /> 436 * <BR /><B>OPTIONAL</B> 437 */ 438 public final String rawCookieLine; 439 440 /** <CODE>[No Description Provided by Google]</CODE> */ 441 public final String[] cookieWarningReasons; 442 443 /** <CODE>[No Description Provided by Google]</CODE> */ 444 public final String[] cookieExclusionReasons; 445 446 /** 447 * Optionally identifies the site-for-cookies and the cookie url, which 448 * may be used by the front-end as additional context. 449 */ 450 public final String operation; 451 452 /** 453 * <CODE>[No Description Provided by Google]</CODE> 454 * <BR /> 455 * <BR /><B>OPTIONAL</B> 456 */ 457 public final String siteForCookies; 458 459 /** 460 * <CODE>[No Description Provided by Google]</CODE> 461 * <BR /> 462 * <BR /><B>OPTIONAL</B> 463 */ 464 public final String cookieUrl; 465 466 /** 467 * <CODE>[No Description Provided by Google]</CODE> 468 * <BR /> 469 * <BR /><B>OPTIONAL</B> 470 */ 471 public final Audits.AffectedRequest request; 472 473 /** 474 * Constructor 475 * 476 * @param cookie 477 * If AffectedCookie is not set then rawCookieLine contains the raw 478 * Set-Cookie header string. This hints at a problem where the 479 * cookie line is syntactically or semantically malformed in a way 480 * that no valid cookie could be created. 481 * <BR /><B>OPTIONAL</B> 482 * 483 * @param rawCookieLine - 484 * <BR /><B>OPTIONAL</B> 485 * 486 * @param cookieWarningReasons - 487 * 488 * @param cookieExclusionReasons - 489 * 490 * @param operation 491 * Optionally identifies the site-for-cookies and the cookie url, which 492 * may be used by the front-end as additional context. 493 * 494 * @param siteForCookies - 495 * <BR /><B>OPTIONAL</B> 496 * 497 * @param cookieUrl - 498 * <BR /><B>OPTIONAL</B> 499 * 500 * @param request - 501 * <BR /><B>OPTIONAL</B> 502 */ 503 public SameSiteCookieIssueDetails( 504 Audits.AffectedCookie cookie, String rawCookieLine, String[] cookieWarningReasons, 505 String[] cookieExclusionReasons, String operation, String siteForCookies, 506 String cookieUrl, Audits.AffectedRequest request 507 ) 508 { 509 // Exception-Check(s) to ensure that if any parameters which are not declared as 510 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 511 512 if (cookieWarningReasons == null) THROWS.throwNPE("cookieWarningReasons"); 513 if (cookieExclusionReasons == null) THROWS.throwNPE("cookieExclusionReasons"); 514 if (operation == null) THROWS.throwNPE("operation"); 515 516 // Exception-Check(s) to ensure that if any parameters which must adhere to a 517 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 518 519 THROWS.checkIAE("operation", operation, "Audits.SameSiteCookieOperation", Audits.SameSiteCookieOperation); 520 521 this.cookie = cookie; 522 this.rawCookieLine = rawCookieLine; 523 this.cookieWarningReasons = cookieWarningReasons; 524 this.cookieExclusionReasons = cookieExclusionReasons; 525 this.operation = operation; 526 this.siteForCookies = siteForCookies; 527 this.cookieUrl = cookieUrl; 528 this.request = request; 529 } 530 531 /** 532 * JSON Object Constructor 533 * @param jo A Json-Object having data about an instance of {@code 'SameSiteCookieIssueDetails'}. 534 */ 535 public SameSiteCookieIssueDetails (JsonObject jo) 536 { 537 this.cookie = ReadJSON.getObject(jo, "cookie", Audits.AffectedCookie.class, true, false); 538 this.rawCookieLine = ReadJSON.getString(jo, "rawCookieLine", true, false); 539 this.cookieWarningReasons = (jo.getJsonArray("cookieWarningReasons") == null) 540 ? null 541 : RJArrIntoStream.strArr(jo.getJsonArray("cookieWarningReasons"), null, 0).toArray(String[]::new); 542 543 this.cookieExclusionReasons = (jo.getJsonArray("cookieExclusionReasons") == null) 544 ? null 545 : RJArrIntoStream.strArr(jo.getJsonArray("cookieExclusionReasons"), null, 0).toArray(String[]::new); 546 547 this.operation = ReadJSON.getString(jo, "operation", false, true); 548 this.siteForCookies = ReadJSON.getString(jo, "siteForCookies", true, false); 549 this.cookieUrl = ReadJSON.getString(jo, "cookieUrl", true, false); 550 this.request = ReadJSON.getObject(jo, "request", Audits.AffectedRequest.class, true, false); 551 } 552 553 554 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 555 public boolean equals(Object other) 556 { 557 if (this == other) return true; 558 if (other == null) return false; 559 if (other.getClass() != this.getClass()) return false; 560 561 SameSiteCookieIssueDetails o = (SameSiteCookieIssueDetails) other; 562 563 return 564 Objects.equals(this.cookie, o.cookie) 565 && Objects.equals(this.rawCookieLine, o.rawCookieLine) 566 && Arrays.deepEquals(this.cookieWarningReasons, o.cookieWarningReasons) 567 && Arrays.deepEquals(this.cookieExclusionReasons, o.cookieExclusionReasons) 568 && Objects.equals(this.operation, o.operation) 569 && Objects.equals(this.siteForCookies, o.siteForCookies) 570 && Objects.equals(this.cookieUrl, o.cookieUrl) 571 && Objects.equals(this.request, o.request); 572 } 573 574 /** Generates a Hash-Code for {@code 'this'} instance */ 575 public int hashCode() 576 { 577 return 578 this.cookie.hashCode() 579 + Objects.hashCode(this.rawCookieLine) 580 + Arrays.deepHashCode(this.cookieWarningReasons) 581 + Arrays.deepHashCode(this.cookieExclusionReasons) 582 + Objects.hashCode(this.operation) 583 + Objects.hashCode(this.siteForCookies) 584 + Objects.hashCode(this.cookieUrl) 585 + this.request.hashCode(); 586 } 587 } 588 589 /** <CODE>[No Description Provided by Google]</CODE> */ 590 public static class MixedContentIssueDetails 591 extends BaseType 592 implements java.io.Serializable 593 { 594 /** For Object Serialization. java.io.Serializable */ 595 protected static final long serialVersionUID = 1; 596 597 public boolean[] optionals() 598 { return new boolean[] { true, false, false, false, true, true, }; } 599 600 /** 601 * The type of resource causing the mixed content issue (css, js, iframe, 602 * form,...). Marked as optional because it is mapped to from 603 * blink::mojom::RequestContextType, which will be replaced 604 * by network::mojom::RequestDestination 605 * <BR /> 606 * <BR /><B>OPTIONAL</B> 607 */ 608 public final String resourceType; 609 610 /** The way the mixed content issue is being resolved. */ 611 public final String resolutionStatus; 612 613 /** The unsafe http url causing the mixed content issue. */ 614 public final String insecureURL; 615 616 /** The url responsible for the call to an unsafe url. */ 617 public final String mainResourceURL; 618 619 /** 620 * The mixed content request. 621 * Does not always exist (e.g. for unsafe form submission urls). 622 * <BR /> 623 * <BR /><B>OPTIONAL</B> 624 */ 625 public final Audits.AffectedRequest request; 626 627 /** 628 * Optional because not every mixed content issue is necessarily linked to a frame. 629 * <BR /> 630 * <BR /><B>OPTIONAL</B> 631 */ 632 public final Audits.AffectedFrame frame; 633 634 /** 635 * Constructor 636 * 637 * @param resourceType 638 * The type of resource causing the mixed content issue (css, js, iframe, 639 * form,...). Marked as optional because it is mapped to from 640 * blink::mojom::RequestContextType, which will be replaced 641 * by network::mojom::RequestDestination 642 * <BR /><B>OPTIONAL</B> 643 * 644 * @param resolutionStatus The way the mixed content issue is being resolved. 645 * 646 * @param insecureURL The unsafe http url causing the mixed content issue. 647 * 648 * @param mainResourceURL The url responsible for the call to an unsafe url. 649 * 650 * @param request 651 * The mixed content request. 652 * Does not always exist (e.g. for unsafe form submission urls). 653 * <BR /><B>OPTIONAL</B> 654 * 655 * @param frame Optional because not every mixed content issue is necessarily linked to a frame. 656 * <BR /><B>OPTIONAL</B> 657 */ 658 public MixedContentIssueDetails( 659 String resourceType, String resolutionStatus, String insecureURL, 660 String mainResourceURL, Audits.AffectedRequest request, Audits.AffectedFrame frame 661 ) 662 { 663 // Exception-Check(s) to ensure that if any parameters which are not declared as 664 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 665 666 if (resolutionStatus == null) THROWS.throwNPE("resolutionStatus"); 667 if (insecureURL == null) THROWS.throwNPE("insecureURL"); 668 if (mainResourceURL == null) THROWS.throwNPE("mainResourceURL"); 669 670 // Exception-Check(s) to ensure that if any parameters which must adhere to a 671 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 672 673 THROWS.checkIAE("resourceType", resourceType, "Audits.MixedContentResourceType", Audits.MixedContentResourceType); 674 THROWS.checkIAE("resolutionStatus", resolutionStatus, "Audits.MixedContentResolutionStatus", Audits.MixedContentResolutionStatus); 675 676 this.resourceType = resourceType; 677 this.resolutionStatus = resolutionStatus; 678 this.insecureURL = insecureURL; 679 this.mainResourceURL = mainResourceURL; 680 this.request = request; 681 this.frame = frame; 682 } 683 684 /** 685 * JSON Object Constructor 686 * @param jo A Json-Object having data about an instance of {@code 'MixedContentIssueDetails'}. 687 */ 688 public MixedContentIssueDetails (JsonObject jo) 689 { 690 this.resourceType = ReadJSON.getString(jo, "resourceType", true, false); 691 this.resolutionStatus = ReadJSON.getString(jo, "resolutionStatus", false, true); 692 this.insecureURL = ReadJSON.getString(jo, "insecureURL", false, true); 693 this.mainResourceURL = ReadJSON.getString(jo, "mainResourceURL", false, true); 694 this.request = ReadJSON.getObject(jo, "request", Audits.AffectedRequest.class, true, false); 695 this.frame = ReadJSON.getObject(jo, "frame", Audits.AffectedFrame.class, true, false); 696 } 697 698 699 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 700 public boolean equals(Object other) 701 { 702 if (this == other) return true; 703 if (other == null) return false; 704 if (other.getClass() != this.getClass()) return false; 705 706 MixedContentIssueDetails o = (MixedContentIssueDetails) other; 707 708 return 709 Objects.equals(this.resourceType, o.resourceType) 710 && Objects.equals(this.resolutionStatus, o.resolutionStatus) 711 && Objects.equals(this.insecureURL, o.insecureURL) 712 && Objects.equals(this.mainResourceURL, o.mainResourceURL) 713 && Objects.equals(this.request, o.request) 714 && Objects.equals(this.frame, o.frame); 715 } 716 717 /** Generates a Hash-Code for {@code 'this'} instance */ 718 public int hashCode() 719 { 720 return 721 Objects.hashCode(this.resourceType) 722 + Objects.hashCode(this.resolutionStatus) 723 + Objects.hashCode(this.insecureURL) 724 + Objects.hashCode(this.mainResourceURL) 725 + this.request.hashCode() 726 + this.frame.hashCode(); 727 } 728 } 729 730 /** 731 * Details for a request that has been blocked with the BLOCKED_BY_RESPONSE 732 * code. Currently only used for COEP/COOP, but may be extended to include 733 * some CSP errors in the future. 734 */ 735 public static class BlockedByResponseIssueDetails 736 extends BaseType 737 implements java.io.Serializable 738 { 739 /** For Object Serialization. java.io.Serializable */ 740 protected static final long serialVersionUID = 1; 741 742 public boolean[] optionals() 743 { return new boolean[] { false, true, true, false, }; } 744 745 /** <CODE>[No Description Provided by Google]</CODE> */ 746 public final Audits.AffectedRequest request; 747 748 /** 749 * <CODE>[No Description Provided by Google]</CODE> 750 * <BR /> 751 * <BR /><B>OPTIONAL</B> 752 */ 753 public final Audits.AffectedFrame parentFrame; 754 755 /** 756 * <CODE>[No Description Provided by Google]</CODE> 757 * <BR /> 758 * <BR /><B>OPTIONAL</B> 759 */ 760 public final Audits.AffectedFrame blockedFrame; 761 762 /** <CODE>[No Description Provided by Google]</CODE> */ 763 public final String reason; 764 765 /** 766 * Constructor 767 * 768 * @param request - 769 * 770 * @param parentFrame - 771 * <BR /><B>OPTIONAL</B> 772 * 773 * @param blockedFrame - 774 * <BR /><B>OPTIONAL</B> 775 * 776 * @param reason - 777 */ 778 public BlockedByResponseIssueDetails( 779 Audits.AffectedRequest request, Audits.AffectedFrame parentFrame, 780 Audits.AffectedFrame blockedFrame, String reason 781 ) 782 { 783 // Exception-Check(s) to ensure that if any parameters which are not declared as 784 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 785 786 if (request == null) THROWS.throwNPE("request"); 787 if (reason == null) THROWS.throwNPE("reason"); 788 789 // Exception-Check(s) to ensure that if any parameters which must adhere to a 790 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 791 792 THROWS.checkIAE("reason", reason, "Audits.BlockedByResponseReason", Audits.BlockedByResponseReason); 793 794 this.request = request; 795 this.parentFrame = parentFrame; 796 this.blockedFrame = blockedFrame; 797 this.reason = reason; 798 } 799 800 /** 801 * JSON Object Constructor 802 * @param jo A Json-Object having data about an instance of {@code 'BlockedByResponseIssueDetails'}. 803 */ 804 public BlockedByResponseIssueDetails (JsonObject jo) 805 { 806 this.request = ReadJSON.getObject(jo, "request", Audits.AffectedRequest.class, false, true); 807 this.parentFrame = ReadJSON.getObject(jo, "parentFrame", Audits.AffectedFrame.class, true, false); 808 this.blockedFrame = ReadJSON.getObject(jo, "blockedFrame", Audits.AffectedFrame.class, true, false); 809 this.reason = ReadJSON.getString(jo, "reason", false, true); 810 } 811 812 813 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 814 public boolean equals(Object other) 815 { 816 if (this == other) return true; 817 if (other == null) return false; 818 if (other.getClass() != this.getClass()) return false; 819 820 BlockedByResponseIssueDetails o = (BlockedByResponseIssueDetails) other; 821 822 return 823 Objects.equals(this.request, o.request) 824 && Objects.equals(this.parentFrame, o.parentFrame) 825 && Objects.equals(this.blockedFrame, o.blockedFrame) 826 && Objects.equals(this.reason, o.reason); 827 } 828 829 /** Generates a Hash-Code for {@code 'this'} instance */ 830 public int hashCode() 831 { 832 return 833 this.request.hashCode() 834 + this.parentFrame.hashCode() 835 + this.blockedFrame.hashCode() 836 + Objects.hashCode(this.reason); 837 } 838 } 839 840 /** <CODE>[No Description Provided by Google]</CODE> */ 841 public static class HeavyAdIssueDetails 842 extends BaseType 843 implements java.io.Serializable 844 { 845 /** For Object Serialization. java.io.Serializable */ 846 protected static final long serialVersionUID = 1; 847 848 public boolean[] optionals() 849 { return new boolean[] { false, false, false, }; } 850 851 /** The resolution status, either blocking the content or warning. */ 852 public final String resolution; 853 854 /** The reason the ad was blocked, total network or cpu or peak cpu. */ 855 public final String reason; 856 857 /** The frame that was blocked. */ 858 public final Audits.AffectedFrame frame; 859 860 /** 861 * Constructor 862 * 863 * @param resolution The resolution status, either blocking the content or warning. 864 * 865 * @param reason The reason the ad was blocked, total network or cpu or peak cpu. 866 * 867 * @param frame The frame that was blocked. 868 */ 869 public HeavyAdIssueDetails(String resolution, String reason, Audits.AffectedFrame frame) 870 { 871 // Exception-Check(s) to ensure that if any parameters which are not declared as 872 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 873 874 if (resolution == null) THROWS.throwNPE("resolution"); 875 if (reason == null) THROWS.throwNPE("reason"); 876 if (frame == null) THROWS.throwNPE("frame"); 877 878 // Exception-Check(s) to ensure that if any parameters which must adhere to a 879 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 880 881 THROWS.checkIAE("resolution", resolution, "Audits.HeavyAdResolutionStatus", Audits.HeavyAdResolutionStatus); 882 THROWS.checkIAE("reason", reason, "Audits.HeavyAdReason", Audits.HeavyAdReason); 883 884 this.resolution = resolution; 885 this.reason = reason; 886 this.frame = frame; 887 } 888 889 /** 890 * JSON Object Constructor 891 * @param jo A Json-Object having data about an instance of {@code 'HeavyAdIssueDetails'}. 892 */ 893 public HeavyAdIssueDetails (JsonObject jo) 894 { 895 this.resolution = ReadJSON.getString(jo, "resolution", false, true); 896 this.reason = ReadJSON.getString(jo, "reason", false, true); 897 this.frame = ReadJSON.getObject(jo, "frame", Audits.AffectedFrame.class, false, true); 898 } 899 900 901 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 902 public boolean equals(Object other) 903 { 904 if (this == other) return true; 905 if (other == null) return false; 906 if (other.getClass() != this.getClass()) return false; 907 908 HeavyAdIssueDetails o = (HeavyAdIssueDetails) other; 909 910 return 911 Objects.equals(this.resolution, o.resolution) 912 && Objects.equals(this.reason, o.reason) 913 && Objects.equals(this.frame, o.frame); 914 } 915 916 /** Generates a Hash-Code for {@code 'this'} instance */ 917 public int hashCode() 918 { 919 return 920 Objects.hashCode(this.resolution) 921 + Objects.hashCode(this.reason) 922 + this.frame.hashCode(); 923 } 924 } 925 926 /** <CODE>[No Description Provided by Google]</CODE> */ 927 public static class SourceCodeLocation 928 extends BaseType 929 implements java.io.Serializable 930 { 931 /** For Object Serialization. java.io.Serializable */ 932 protected static final long serialVersionUID = 1; 933 934 public boolean[] optionals() 935 { return new boolean[] { true, false, false, false, }; } 936 937 /** 938 * <CODE>[No Description Provided by Google]</CODE> 939 * <BR /> 940 * <BR /><B>OPTIONAL</B> 941 */ 942 public final String scriptId; 943 944 /** <CODE>[No Description Provided by Google]</CODE> */ 945 public final String url; 946 947 /** <CODE>[No Description Provided by Google]</CODE> */ 948 public final int lineNumber; 949 950 /** <CODE>[No Description Provided by Google]</CODE> */ 951 public final int columnNumber; 952 953 /** 954 * Constructor 955 * 956 * @param scriptId - 957 * <BR /><B>OPTIONAL</B> 958 * 959 * @param url - 960 * 961 * @param lineNumber - 962 * 963 * @param columnNumber - 964 */ 965 public SourceCodeLocation(String scriptId, String url, int lineNumber, int columnNumber) 966 { 967 // Exception-Check(s) to ensure that if any parameters which are not declared as 968 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 969 970 if (url == null) THROWS.throwNPE("url"); 971 972 this.scriptId = scriptId; 973 this.url = url; 974 this.lineNumber = lineNumber; 975 this.columnNumber = columnNumber; 976 } 977 978 /** 979 * JSON Object Constructor 980 * @param jo A Json-Object having data about an instance of {@code 'SourceCodeLocation'}. 981 */ 982 public SourceCodeLocation (JsonObject jo) 983 { 984 this.scriptId = ReadJSON.getString(jo, "scriptId", true, false); 985 this.url = ReadJSON.getString(jo, "url", false, true); 986 this.lineNumber = ReadPrimJSON.getInt(jo, "lineNumber"); 987 this.columnNumber = ReadPrimJSON.getInt(jo, "columnNumber"); 988 } 989 990 991 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 992 public boolean equals(Object other) 993 { 994 if (this == other) return true; 995 if (other == null) return false; 996 if (other.getClass() != this.getClass()) return false; 997 998 SourceCodeLocation o = (SourceCodeLocation) other; 999 1000 return 1001 Objects.equals(this.scriptId, o.scriptId) 1002 && Objects.equals(this.url, o.url) 1003 && (this.lineNumber == o.lineNumber) 1004 && (this.columnNumber == o.columnNumber); 1005 } 1006 1007 /** Generates a Hash-Code for {@code 'this'} instance */ 1008 public int hashCode() 1009 { 1010 return 1011 Objects.hashCode(this.scriptId) 1012 + Objects.hashCode(this.url) 1013 + this.lineNumber 1014 + this.columnNumber; 1015 } 1016 } 1017 1018 /** <CODE>[No Description Provided by Google]</CODE> */ 1019 public static class ContentSecurityPolicyIssueDetails 1020 extends BaseType 1021 implements java.io.Serializable 1022 { 1023 /** For Object Serialization. java.io.Serializable */ 1024 protected static final long serialVersionUID = 1; 1025 1026 public boolean[] optionals() 1027 { return new boolean[] { true, false, false, false, true, true, true, }; } 1028 1029 /** 1030 * The url not included in allowed sources. 1031 * <BR /> 1032 * <BR /><B>OPTIONAL</B> 1033 */ 1034 public final String blockedURL; 1035 1036 /** Specific directive that is violated, causing the CSP issue. */ 1037 public final String violatedDirective; 1038 1039 /** <CODE>[No Description Provided by Google]</CODE> */ 1040 public final boolean isReportOnly; 1041 1042 /** <CODE>[No Description Provided by Google]</CODE> */ 1043 public final String contentSecurityPolicyViolationType; 1044 1045 /** 1046 * <CODE>[No Description Provided by Google]</CODE> 1047 * <BR /> 1048 * <BR /><B>OPTIONAL</B> 1049 */ 1050 public final Audits.AffectedFrame frameAncestor; 1051 1052 /** 1053 * <CODE>[No Description Provided by Google]</CODE> 1054 * <BR /> 1055 * <BR /><B>OPTIONAL</B> 1056 */ 1057 public final Audits.SourceCodeLocation sourceCodeLocation; 1058 1059 /** 1060 * <CODE>[No Description Provided by Google]</CODE> 1061 * <BR /> 1062 * <BR /><B>OPTIONAL</B> 1063 */ 1064 public final Integer violatingNodeId; 1065 1066 /** 1067 * Constructor 1068 * 1069 * @param blockedURL The url not included in allowed sources. 1070 * <BR /><B>OPTIONAL</B> 1071 * 1072 * @param violatedDirective Specific directive that is violated, causing the CSP issue. 1073 * 1074 * @param isReportOnly - 1075 * 1076 * @param contentSecurityPolicyViolationType - 1077 * 1078 * @param frameAncestor - 1079 * <BR /><B>OPTIONAL</B> 1080 * 1081 * @param sourceCodeLocation - 1082 * <BR /><B>OPTIONAL</B> 1083 * 1084 * @param violatingNodeId - 1085 * <BR /><B>OPTIONAL</B> 1086 */ 1087 public ContentSecurityPolicyIssueDetails( 1088 String blockedURL, String violatedDirective, boolean isReportOnly, 1089 String contentSecurityPolicyViolationType, Audits.AffectedFrame frameAncestor, 1090 Audits.SourceCodeLocation sourceCodeLocation, Integer violatingNodeId 1091 ) 1092 { 1093 // Exception-Check(s) to ensure that if any parameters which are not declared as 1094 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1095 1096 if (violatedDirective == null) THROWS.throwNPE("violatedDirective"); 1097 if (contentSecurityPolicyViolationType == null) THROWS.throwNPE("contentSecurityPolicyViolationType"); 1098 1099 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1100 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1101 1102 THROWS.checkIAE("contentSecurityPolicyViolationType", contentSecurityPolicyViolationType, "Audits.ContentSecurityPolicyViolationType", Audits.ContentSecurityPolicyViolationType); 1103 1104 this.blockedURL = blockedURL; 1105 this.violatedDirective = violatedDirective; 1106 this.isReportOnly = isReportOnly; 1107 this.contentSecurityPolicyViolationType = contentSecurityPolicyViolationType; 1108 this.frameAncestor = frameAncestor; 1109 this.sourceCodeLocation = sourceCodeLocation; 1110 this.violatingNodeId = violatingNodeId; 1111 } 1112 1113 /** 1114 * JSON Object Constructor 1115 * @param jo A Json-Object having data about an instance of {@code 'ContentSecurityPolicyIssueDetails'}. 1116 */ 1117 public ContentSecurityPolicyIssueDetails (JsonObject jo) 1118 { 1119 this.blockedURL = ReadJSON.getString(jo, "blockedURL", true, false); 1120 this.violatedDirective = ReadJSON.getString(jo, "violatedDirective", false, true); 1121 this.isReportOnly = ReadPrimJSON.getBoolean(jo, "isReportOnly"); 1122 this.contentSecurityPolicyViolationType = ReadJSON.getString(jo, "contentSecurityPolicyViolationType", false, true); 1123 this.frameAncestor = ReadJSON.getObject(jo, "frameAncestor", Audits.AffectedFrame.class, true, false); 1124 this.sourceCodeLocation = ReadJSON.getObject(jo, "sourceCodeLocation", Audits.SourceCodeLocation.class, true, false); 1125 this.violatingNodeId = ReadBoxedJSON.getInteger(jo, "violatingNodeId", true); 1126 } 1127 1128 1129 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1130 public boolean equals(Object other) 1131 { 1132 if (this == other) return true; 1133 if (other == null) return false; 1134 if (other.getClass() != this.getClass()) return false; 1135 1136 ContentSecurityPolicyIssueDetails o = (ContentSecurityPolicyIssueDetails) other; 1137 1138 return 1139 Objects.equals(this.blockedURL, o.blockedURL) 1140 && Objects.equals(this.violatedDirective, o.violatedDirective) 1141 && (this.isReportOnly == o.isReportOnly) 1142 && Objects.equals(this.contentSecurityPolicyViolationType, o.contentSecurityPolicyViolationType) 1143 && Objects.equals(this.frameAncestor, o.frameAncestor) 1144 && Objects.equals(this.sourceCodeLocation, o.sourceCodeLocation) 1145 && Objects.equals(this.violatingNodeId, o.violatingNodeId); 1146 } 1147 1148 /** Generates a Hash-Code for {@code 'this'} instance */ 1149 public int hashCode() 1150 { 1151 return 1152 Objects.hashCode(this.blockedURL) 1153 + Objects.hashCode(this.violatedDirective) 1154 + (this.isReportOnly ? 1 : 0) 1155 + Objects.hashCode(this.contentSecurityPolicyViolationType) 1156 + this.frameAncestor.hashCode() 1157 + this.sourceCodeLocation.hashCode() 1158 + Objects.hashCode(this.violatingNodeId); 1159 } 1160 } 1161 1162 /** 1163 * Details for a issue arising from an SAB being instantiated in, or 1164 * transferred to a context that is not cross-origin isolated. 1165 */ 1166 public static class SharedArrayBufferIssueDetails 1167 extends BaseType 1168 implements java.io.Serializable 1169 { 1170 /** For Object Serialization. java.io.Serializable */ 1171 protected static final long serialVersionUID = 1; 1172 1173 public boolean[] optionals() 1174 { return new boolean[] { false, false, false, }; } 1175 1176 /** <CODE>[No Description Provided by Google]</CODE> */ 1177 public final Audits.SourceCodeLocation sourceCodeLocation; 1178 1179 /** <CODE>[No Description Provided by Google]</CODE> */ 1180 public final boolean isWarning; 1181 1182 /** <CODE>[No Description Provided by Google]</CODE> */ 1183 public final String type; 1184 1185 /** 1186 * Constructor 1187 * 1188 * @param sourceCodeLocation - 1189 * 1190 * @param isWarning - 1191 * 1192 * @param type - 1193 */ 1194 public SharedArrayBufferIssueDetails 1195 (Audits.SourceCodeLocation sourceCodeLocation, boolean isWarning, String type) 1196 { 1197 // Exception-Check(s) to ensure that if any parameters which are not declared as 1198 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1199 1200 if (sourceCodeLocation == null) THROWS.throwNPE("sourceCodeLocation"); 1201 if (type == null) THROWS.throwNPE("type"); 1202 1203 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1204 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1205 1206 THROWS.checkIAE("type", type, "Audits.SharedArrayBufferIssueType", Audits.SharedArrayBufferIssueType); 1207 1208 this.sourceCodeLocation = sourceCodeLocation; 1209 this.isWarning = isWarning; 1210 this.type = type; 1211 } 1212 1213 /** 1214 * JSON Object Constructor 1215 * @param jo A Json-Object having data about an instance of {@code 'SharedArrayBufferIssueDetails'}. 1216 */ 1217 public SharedArrayBufferIssueDetails (JsonObject jo) 1218 { 1219 this.sourceCodeLocation = ReadJSON.getObject(jo, "sourceCodeLocation", Audits.SourceCodeLocation.class, false, true); 1220 this.isWarning = ReadPrimJSON.getBoolean(jo, "isWarning"); 1221 this.type = ReadJSON.getString(jo, "type", false, true); 1222 } 1223 1224 1225 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1226 public boolean equals(Object other) 1227 { 1228 if (this == other) return true; 1229 if (other == null) return false; 1230 if (other.getClass() != this.getClass()) return false; 1231 1232 SharedArrayBufferIssueDetails o = (SharedArrayBufferIssueDetails) other; 1233 1234 return 1235 Objects.equals(this.sourceCodeLocation, o.sourceCodeLocation) 1236 && (this.isWarning == o.isWarning) 1237 && Objects.equals(this.type, o.type); 1238 } 1239 1240 /** Generates a Hash-Code for {@code 'this'} instance */ 1241 public int hashCode() 1242 { 1243 return 1244 this.sourceCodeLocation.hashCode() 1245 + (this.isWarning ? 1 : 0) 1246 + Objects.hashCode(this.type); 1247 } 1248 } 1249 1250 /** <CODE>[No Description Provided by Google]</CODE> */ 1251 public static class TrustedWebActivityIssueDetails 1252 extends BaseType 1253 implements java.io.Serializable 1254 { 1255 /** For Object Serialization. java.io.Serializable */ 1256 protected static final long serialVersionUID = 1; 1257 1258 public boolean[] optionals() 1259 { return new boolean[] { false, false, true, true, true, }; } 1260 1261 /** The url that triggers the violation. */ 1262 public final String url; 1263 1264 /** <CODE>[No Description Provided by Google]</CODE> */ 1265 public final String violationType; 1266 1267 /** 1268 * <CODE>[No Description Provided by Google]</CODE> 1269 * <BR /> 1270 * <BR /><B>OPTIONAL</B> 1271 */ 1272 public final Integer httpStatusCode; 1273 1274 /** 1275 * The package name of the Trusted Web Activity client app. This field is 1276 * only used when violation type is kDigitalAssetLinks. 1277 * <BR /> 1278 * <BR /><B>OPTIONAL</B> 1279 */ 1280 public final String packageName; 1281 1282 /** 1283 * The signature of the Trusted Web Activity client app. This field is only 1284 * used when violation type is kDigitalAssetLinks. 1285 * <BR /> 1286 * <BR /><B>OPTIONAL</B> 1287 */ 1288 public final String signature; 1289 1290 /** 1291 * Constructor 1292 * 1293 * @param url The url that triggers the violation. 1294 * 1295 * @param violationType - 1296 * 1297 * @param httpStatusCode - 1298 * <BR /><B>OPTIONAL</B> 1299 * 1300 * @param packageName 1301 * The package name of the Trusted Web Activity client app. This field is 1302 * only used when violation type is kDigitalAssetLinks. 1303 * <BR /><B>OPTIONAL</B> 1304 * 1305 * @param signature 1306 * The signature of the Trusted Web Activity client app. This field is only 1307 * used when violation type is kDigitalAssetLinks. 1308 * <BR /><B>OPTIONAL</B> 1309 */ 1310 public TrustedWebActivityIssueDetails( 1311 String url, String violationType, Integer httpStatusCode, String packageName, 1312 String signature 1313 ) 1314 { 1315 // Exception-Check(s) to ensure that if any parameters which are not declared as 1316 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1317 1318 if (url == null) THROWS.throwNPE("url"); 1319 if (violationType == null) THROWS.throwNPE("violationType"); 1320 1321 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1322 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1323 1324 THROWS.checkIAE("violationType", violationType, "Audits.TwaQualityEnforcementViolationType", Audits.TwaQualityEnforcementViolationType); 1325 1326 this.url = url; 1327 this.violationType = violationType; 1328 this.httpStatusCode = httpStatusCode; 1329 this.packageName = packageName; 1330 this.signature = signature; 1331 } 1332 1333 /** 1334 * JSON Object Constructor 1335 * @param jo A Json-Object having data about an instance of {@code 'TrustedWebActivityIssueDetails'}. 1336 */ 1337 public TrustedWebActivityIssueDetails (JsonObject jo) 1338 { 1339 this.url = ReadJSON.getString(jo, "url", false, true); 1340 this.violationType = ReadJSON.getString(jo, "violationType", false, true); 1341 this.httpStatusCode = ReadBoxedJSON.getInteger(jo, "httpStatusCode", true); 1342 this.packageName = ReadJSON.getString(jo, "packageName", true, false); 1343 this.signature = ReadJSON.getString(jo, "signature", true, false); 1344 } 1345 1346 1347 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1348 public boolean equals(Object other) 1349 { 1350 if (this == other) return true; 1351 if (other == null) return false; 1352 if (other.getClass() != this.getClass()) return false; 1353 1354 TrustedWebActivityIssueDetails o = (TrustedWebActivityIssueDetails) other; 1355 1356 return 1357 Objects.equals(this.url, o.url) 1358 && Objects.equals(this.violationType, o.violationType) 1359 && Objects.equals(this.httpStatusCode, o.httpStatusCode) 1360 && Objects.equals(this.packageName, o.packageName) 1361 && Objects.equals(this.signature, o.signature); 1362 } 1363 1364 /** Generates a Hash-Code for {@code 'this'} instance */ 1365 public int hashCode() 1366 { 1367 return 1368 Objects.hashCode(this.url) 1369 + Objects.hashCode(this.violationType) 1370 + Objects.hashCode(this.httpStatusCode) 1371 + Objects.hashCode(this.packageName) 1372 + Objects.hashCode(this.signature); 1373 } 1374 } 1375 1376 /** <CODE>[No Description Provided by Google]</CODE> */ 1377 public static class LowTextContrastIssueDetails 1378 extends BaseType 1379 implements java.io.Serializable 1380 { 1381 /** For Object Serialization. java.io.Serializable */ 1382 protected static final long serialVersionUID = 1; 1383 1384 public boolean[] optionals() 1385 { return new boolean[] { false, false, false, false, false, false, false, }; } 1386 1387 /** <CODE>[No Description Provided by Google]</CODE> */ 1388 public final int violatingNodeId; 1389 1390 /** <CODE>[No Description Provided by Google]</CODE> */ 1391 public final String violatingNodeSelector; 1392 1393 /** <CODE>[No Description Provided by Google]</CODE> */ 1394 public final Number contrastRatio; 1395 1396 /** <CODE>[No Description Provided by Google]</CODE> */ 1397 public final Number thresholdAA; 1398 1399 /** <CODE>[No Description Provided by Google]</CODE> */ 1400 public final Number thresholdAAA; 1401 1402 /** <CODE>[No Description Provided by Google]</CODE> */ 1403 public final String fontSize; 1404 1405 /** <CODE>[No Description Provided by Google]</CODE> */ 1406 public final String fontWeight; 1407 1408 /** 1409 * Constructor 1410 * 1411 * @param violatingNodeId - 1412 * 1413 * @param violatingNodeSelector - 1414 * 1415 * @param contrastRatio - 1416 * 1417 * @param thresholdAA - 1418 * 1419 * @param thresholdAAA - 1420 * 1421 * @param fontSize - 1422 * 1423 * @param fontWeight - 1424 */ 1425 public LowTextContrastIssueDetails( 1426 int violatingNodeId, String violatingNodeSelector, Number contrastRatio, 1427 Number thresholdAA, Number thresholdAAA, String fontSize, String fontWeight 1428 ) 1429 { 1430 // Exception-Check(s) to ensure that if any parameters which are not declared as 1431 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1432 1433 if (violatingNodeSelector == null) THROWS.throwNPE("violatingNodeSelector"); 1434 if (contrastRatio == null) THROWS.throwNPE("contrastRatio"); 1435 if (thresholdAA == null) THROWS.throwNPE("thresholdAA"); 1436 if (thresholdAAA == null) THROWS.throwNPE("thresholdAAA"); 1437 if (fontSize == null) THROWS.throwNPE("fontSize"); 1438 if (fontWeight == null) THROWS.throwNPE("fontWeight"); 1439 1440 this.violatingNodeId = violatingNodeId; 1441 this.violatingNodeSelector = violatingNodeSelector; 1442 this.contrastRatio = contrastRatio; 1443 this.thresholdAA = thresholdAA; 1444 this.thresholdAAA = thresholdAAA; 1445 this.fontSize = fontSize; 1446 this.fontWeight = fontWeight; 1447 } 1448 1449 /** 1450 * JSON Object Constructor 1451 * @param jo A Json-Object having data about an instance of {@code 'LowTextContrastIssueDetails'}. 1452 */ 1453 public LowTextContrastIssueDetails (JsonObject jo) 1454 { 1455 this.violatingNodeId = ReadPrimJSON.getInt(jo, "violatingNodeId"); 1456 this.violatingNodeSelector = ReadJSON.getString(jo, "violatingNodeSelector", false, true); 1457 this.contrastRatio = ReadNumberJSON.get(jo, "contrastRatio", false, true); 1458 this.thresholdAA = ReadNumberJSON.get(jo, "thresholdAA", false, true); 1459 this.thresholdAAA = ReadNumberJSON.get(jo, "thresholdAAA", false, true); 1460 this.fontSize = ReadJSON.getString(jo, "fontSize", false, true); 1461 this.fontWeight = ReadJSON.getString(jo, "fontWeight", false, true); 1462 } 1463 1464 1465 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1466 public boolean equals(Object other) 1467 { 1468 if (this == other) return true; 1469 if (other == null) return false; 1470 if (other.getClass() != this.getClass()) return false; 1471 1472 LowTextContrastIssueDetails o = (LowTextContrastIssueDetails) other; 1473 1474 return 1475 Objects.equals(this.violatingNodeId, o.violatingNodeId) 1476 && Objects.equals(this.violatingNodeSelector, o.violatingNodeSelector) 1477 && Objects.equals(this.contrastRatio, o.contrastRatio) 1478 && Objects.equals(this.thresholdAA, o.thresholdAA) 1479 && Objects.equals(this.thresholdAAA, o.thresholdAAA) 1480 && Objects.equals(this.fontSize, o.fontSize) 1481 && Objects.equals(this.fontWeight, o.fontWeight); 1482 } 1483 1484 /** Generates a Hash-Code for {@code 'this'} instance */ 1485 public int hashCode() 1486 { 1487 return 1488 this.violatingNodeId 1489 + Objects.hashCode(this.violatingNodeSelector) 1490 + Objects.hashCode(this.contrastRatio) 1491 + Objects.hashCode(this.thresholdAA) 1492 + Objects.hashCode(this.thresholdAAA) 1493 + Objects.hashCode(this.fontSize) 1494 + Objects.hashCode(this.fontWeight); 1495 } 1496 } 1497 1498 /** 1499 * Details for a CORS related issue, e.g. a warning or error related to 1500 * CORS RFC1918 enforcement. 1501 */ 1502 public static class CorsIssueDetails 1503 extends BaseType 1504 implements java.io.Serializable 1505 { 1506 /** For Object Serialization. java.io.Serializable */ 1507 protected static final long serialVersionUID = 1; 1508 1509 public boolean[] optionals() 1510 { return new boolean[] { false, false, false, true, true, true, true, }; } 1511 1512 /** <CODE>[No Description Provided by Google]</CODE> */ 1513 public final Network.CorsErrorStatus corsErrorStatus; 1514 1515 /** <CODE>[No Description Provided by Google]</CODE> */ 1516 public final boolean isWarning; 1517 1518 /** <CODE>[No Description Provided by Google]</CODE> */ 1519 public final Audits.AffectedRequest request; 1520 1521 /** 1522 * <CODE>[No Description Provided by Google]</CODE> 1523 * <BR /> 1524 * <BR /><B>OPTIONAL</B> 1525 */ 1526 public final Audits.SourceCodeLocation location; 1527 1528 /** 1529 * <CODE>[No Description Provided by Google]</CODE> 1530 * <BR /> 1531 * <BR /><B>OPTIONAL</B> 1532 */ 1533 public final String initiatorOrigin; 1534 1535 /** 1536 * <CODE>[No Description Provided by Google]</CODE> 1537 * <BR /> 1538 * <BR /><B>OPTIONAL</B> 1539 */ 1540 public final String resourceIPAddressSpace; 1541 1542 /** 1543 * <CODE>[No Description Provided by Google]</CODE> 1544 * <BR /> 1545 * <BR /><B>OPTIONAL</B> 1546 */ 1547 public final Network.ClientSecurityState clientSecurityState; 1548 1549 /** 1550 * Constructor 1551 * 1552 * @param corsErrorStatus - 1553 * 1554 * @param isWarning - 1555 * 1556 * @param request - 1557 * 1558 * @param location - 1559 * <BR /><B>OPTIONAL</B> 1560 * 1561 * @param initiatorOrigin - 1562 * <BR /><B>OPTIONAL</B> 1563 * 1564 * @param resourceIPAddressSpace - 1565 * <BR /><B>OPTIONAL</B> 1566 * 1567 * @param clientSecurityState - 1568 * <BR /><B>OPTIONAL</B> 1569 */ 1570 public CorsIssueDetails( 1571 Network.CorsErrorStatus corsErrorStatus, boolean isWarning, 1572 Audits.AffectedRequest request, Audits.SourceCodeLocation location, 1573 String initiatorOrigin, String resourceIPAddressSpace, 1574 Network.ClientSecurityState clientSecurityState 1575 ) 1576 { 1577 // Exception-Check(s) to ensure that if any parameters which are not declared as 1578 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1579 1580 if (corsErrorStatus == null) THROWS.throwNPE("corsErrorStatus"); 1581 if (request == null) THROWS.throwNPE("request"); 1582 1583 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1584 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1585 1586 THROWS.checkIAE("resourceIPAddressSpace", resourceIPAddressSpace, "Network.IPAddressSpace", Network.IPAddressSpace); 1587 1588 this.corsErrorStatus = corsErrorStatus; 1589 this.isWarning = isWarning; 1590 this.request = request; 1591 this.location = location; 1592 this.initiatorOrigin = initiatorOrigin; 1593 this.resourceIPAddressSpace = resourceIPAddressSpace; 1594 this.clientSecurityState = clientSecurityState; 1595 } 1596 1597 /** 1598 * JSON Object Constructor 1599 * @param jo A Json-Object having data about an instance of {@code 'CorsIssueDetails'}. 1600 */ 1601 public CorsIssueDetails (JsonObject jo) 1602 { 1603 this.corsErrorStatus = ReadJSON.getObject(jo, "corsErrorStatus", Network.CorsErrorStatus.class, false, true); 1604 this.isWarning = ReadPrimJSON.getBoolean(jo, "isWarning"); 1605 this.request = ReadJSON.getObject(jo, "request", Audits.AffectedRequest.class, false, true); 1606 this.location = ReadJSON.getObject(jo, "location", Audits.SourceCodeLocation.class, true, false); 1607 this.initiatorOrigin = ReadJSON.getString(jo, "initiatorOrigin", true, false); 1608 this.resourceIPAddressSpace = ReadJSON.getString(jo, "resourceIPAddressSpace", true, false); 1609 this.clientSecurityState = ReadJSON.getObject(jo, "clientSecurityState", Network.ClientSecurityState.class, true, false); 1610 } 1611 1612 1613 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1614 public boolean equals(Object other) 1615 { 1616 if (this == other) return true; 1617 if (other == null) return false; 1618 if (other.getClass() != this.getClass()) return false; 1619 1620 CorsIssueDetails o = (CorsIssueDetails) other; 1621 1622 return 1623 Objects.equals(this.corsErrorStatus, o.corsErrorStatus) 1624 && (this.isWarning == o.isWarning) 1625 && Objects.equals(this.request, o.request) 1626 && Objects.equals(this.location, o.location) 1627 && Objects.equals(this.initiatorOrigin, o.initiatorOrigin) 1628 && Objects.equals(this.resourceIPAddressSpace, o.resourceIPAddressSpace) 1629 && Objects.equals(this.clientSecurityState, o.clientSecurityState); 1630 } 1631 1632 /** Generates a Hash-Code for {@code 'this'} instance */ 1633 public int hashCode() 1634 { 1635 return 1636 this.corsErrorStatus.hashCode() 1637 + (this.isWarning ? 1 : 0) 1638 + this.request.hashCode() 1639 + this.location.hashCode() 1640 + Objects.hashCode(this.initiatorOrigin) 1641 + Objects.hashCode(this.resourceIPAddressSpace) 1642 + this.clientSecurityState.hashCode(); 1643 } 1644 } 1645 1646 /** 1647 * Details for issues around "Attribution Reporting API" usage. 1648 * Explainer: https://github.com/WICG/conversion-measurement-api 1649 */ 1650 public static class AttributionReportingIssueDetails 1651 extends BaseType 1652 implements java.io.Serializable 1653 { 1654 /** For Object Serialization. java.io.Serializable */ 1655 protected static final long serialVersionUID = 1; 1656 1657 public boolean[] optionals() 1658 { return new boolean[] { false, true, true, true, true, }; } 1659 1660 /** <CODE>[No Description Provided by Google]</CODE> */ 1661 public final String violationType; 1662 1663 /** 1664 * <CODE>[No Description Provided by Google]</CODE> 1665 * <BR /> 1666 * <BR /><B>OPTIONAL</B> 1667 */ 1668 public final Audits.AffectedFrame frame; 1669 1670 /** 1671 * <CODE>[No Description Provided by Google]</CODE> 1672 * <BR /> 1673 * <BR /><B>OPTIONAL</B> 1674 */ 1675 public final Audits.AffectedRequest request; 1676 1677 /** 1678 * <CODE>[No Description Provided by Google]</CODE> 1679 * <BR /> 1680 * <BR /><B>OPTIONAL</B> 1681 */ 1682 public final Integer violatingNodeId; 1683 1684 /** 1685 * <CODE>[No Description Provided by Google]</CODE> 1686 * <BR /> 1687 * <BR /><B>OPTIONAL</B> 1688 */ 1689 public final String invalidParameter; 1690 1691 /** 1692 * Constructor 1693 * 1694 * @param violationType - 1695 * 1696 * @param frame - 1697 * <BR /><B>OPTIONAL</B> 1698 * 1699 * @param request - 1700 * <BR /><B>OPTIONAL</B> 1701 * 1702 * @param violatingNodeId - 1703 * <BR /><B>OPTIONAL</B> 1704 * 1705 * @param invalidParameter - 1706 * <BR /><B>OPTIONAL</B> 1707 */ 1708 public AttributionReportingIssueDetails( 1709 String violationType, Audits.AffectedFrame frame, Audits.AffectedRequest request, 1710 Integer violatingNodeId, String invalidParameter 1711 ) 1712 { 1713 // Exception-Check(s) to ensure that if any parameters which are not declared as 1714 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1715 1716 if (violationType == null) THROWS.throwNPE("violationType"); 1717 1718 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1719 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1720 1721 THROWS.checkIAE("violationType", violationType, "Audits.AttributionReportingIssueType", Audits.AttributionReportingIssueType); 1722 1723 this.violationType = violationType; 1724 this.frame = frame; 1725 this.request = request; 1726 this.violatingNodeId = violatingNodeId; 1727 this.invalidParameter = invalidParameter; 1728 } 1729 1730 /** 1731 * JSON Object Constructor 1732 * @param jo A Json-Object having data about an instance of {@code 'AttributionReportingIssueDetails'}. 1733 */ 1734 public AttributionReportingIssueDetails (JsonObject jo) 1735 { 1736 this.violationType = ReadJSON.getString(jo, "violationType", false, true); 1737 this.frame = ReadJSON.getObject(jo, "frame", Audits.AffectedFrame.class, true, false); 1738 this.request = ReadJSON.getObject(jo, "request", Audits.AffectedRequest.class, true, false); 1739 this.violatingNodeId = ReadBoxedJSON.getInteger(jo, "violatingNodeId", true); 1740 this.invalidParameter = ReadJSON.getString(jo, "invalidParameter", true, false); 1741 } 1742 1743 1744 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1745 public boolean equals(Object other) 1746 { 1747 if (this == other) return true; 1748 if (other == null) return false; 1749 if (other.getClass() != this.getClass()) return false; 1750 1751 AttributionReportingIssueDetails o = (AttributionReportingIssueDetails) other; 1752 1753 return 1754 Objects.equals(this.violationType, o.violationType) 1755 && Objects.equals(this.frame, o.frame) 1756 && Objects.equals(this.request, o.request) 1757 && Objects.equals(this.violatingNodeId, o.violatingNodeId) 1758 && Objects.equals(this.invalidParameter, o.invalidParameter); 1759 } 1760 1761 /** Generates a Hash-Code for {@code 'this'} instance */ 1762 public int hashCode() 1763 { 1764 return 1765 Objects.hashCode(this.violationType) 1766 + this.frame.hashCode() 1767 + this.request.hashCode() 1768 + Objects.hashCode(this.violatingNodeId) 1769 + Objects.hashCode(this.invalidParameter); 1770 } 1771 } 1772 1773 /** 1774 * Details for issues about documents in Quirks Mode 1775 * or Limited Quirks Mode that affects page layouting. 1776 */ 1777 public static class QuirksModeIssueDetails 1778 extends BaseType 1779 implements java.io.Serializable 1780 { 1781 /** For Object Serialization. java.io.Serializable */ 1782 protected static final long serialVersionUID = 1; 1783 1784 public boolean[] optionals() 1785 { return new boolean[] { false, false, false, false, false, }; } 1786 1787 /** 1788 * If false, it means the document's mode is "quirks" 1789 * instead of "limited-quirks". 1790 */ 1791 public final boolean isLimitedQuirksMode; 1792 1793 /** <CODE>[No Description Provided by Google]</CODE> */ 1794 public final int documentNodeId; 1795 1796 /** <CODE>[No Description Provided by Google]</CODE> */ 1797 public final String url; 1798 1799 /** <CODE>[No Description Provided by Google]</CODE> */ 1800 public final String frameId; 1801 1802 /** <CODE>[No Description Provided by Google]</CODE> */ 1803 public final String loaderId; 1804 1805 /** 1806 * Constructor 1807 * 1808 * @param isLimitedQuirksMode 1809 * If false, it means the document's mode is "quirks" 1810 * instead of "limited-quirks". 1811 * 1812 * @param documentNodeId - 1813 * 1814 * @param url - 1815 * 1816 * @param frameId - 1817 * 1818 * @param loaderId - 1819 */ 1820 public QuirksModeIssueDetails( 1821 boolean isLimitedQuirksMode, int documentNodeId, String url, String frameId, 1822 String loaderId 1823 ) 1824 { 1825 // Exception-Check(s) to ensure that if any parameters which are not declared as 1826 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1827 1828 if (url == null) THROWS.throwNPE("url"); 1829 if (frameId == null) THROWS.throwNPE("frameId"); 1830 if (loaderId == null) THROWS.throwNPE("loaderId"); 1831 1832 this.isLimitedQuirksMode = isLimitedQuirksMode; 1833 this.documentNodeId = documentNodeId; 1834 this.url = url; 1835 this.frameId = frameId; 1836 this.loaderId = loaderId; 1837 } 1838 1839 /** 1840 * JSON Object Constructor 1841 * @param jo A Json-Object having data about an instance of {@code 'QuirksModeIssueDetails'}. 1842 */ 1843 public QuirksModeIssueDetails (JsonObject jo) 1844 { 1845 this.isLimitedQuirksMode = ReadPrimJSON.getBoolean(jo, "isLimitedQuirksMode"); 1846 this.documentNodeId = ReadPrimJSON.getInt(jo, "documentNodeId"); 1847 this.url = ReadJSON.getString(jo, "url", false, true); 1848 this.frameId = ReadJSON.getString(jo, "frameId", false, true); 1849 this.loaderId = ReadJSON.getString(jo, "loaderId", false, true); 1850 } 1851 1852 1853 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1854 public boolean equals(Object other) 1855 { 1856 if (this == other) return true; 1857 if (other == null) return false; 1858 if (other.getClass() != this.getClass()) return false; 1859 1860 QuirksModeIssueDetails o = (QuirksModeIssueDetails) other; 1861 1862 return 1863 (this.isLimitedQuirksMode == o.isLimitedQuirksMode) 1864 && Objects.equals(this.documentNodeId, o.documentNodeId) 1865 && Objects.equals(this.url, o.url) 1866 && Objects.equals(this.frameId, o.frameId) 1867 && Objects.equals(this.loaderId, o.loaderId); 1868 } 1869 1870 /** Generates a Hash-Code for {@code 'this'} instance */ 1871 public int hashCode() 1872 { 1873 return 1874 (this.isLimitedQuirksMode ? 1 : 0) 1875 + this.documentNodeId 1876 + Objects.hashCode(this.url) 1877 + Objects.hashCode(this.frameId) 1878 + Objects.hashCode(this.loaderId); 1879 } 1880 } 1881 1882 /** <CODE>[No Description Provided by Google]</CODE> */ 1883 public static class NavigatorUserAgentIssueDetails 1884 extends BaseType 1885 implements java.io.Serializable 1886 { 1887 /** For Object Serialization. java.io.Serializable */ 1888 protected static final long serialVersionUID = 1; 1889 1890 public boolean[] optionals() 1891 { return new boolean[] { false, true, }; } 1892 1893 /** <CODE>[No Description Provided by Google]</CODE> */ 1894 public final String url; 1895 1896 /** 1897 * <CODE>[No Description Provided by Google]</CODE> 1898 * <BR /> 1899 * <BR /><B>OPTIONAL</B> 1900 */ 1901 public final Audits.SourceCodeLocation location; 1902 1903 /** 1904 * Constructor 1905 * 1906 * @param url - 1907 * 1908 * @param location - 1909 * <BR /><B>OPTIONAL</B> 1910 */ 1911 public NavigatorUserAgentIssueDetails(String url, Audits.SourceCodeLocation location) 1912 { 1913 // Exception-Check(s) to ensure that if any parameters which are not declared as 1914 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1915 1916 if (url == null) THROWS.throwNPE("url"); 1917 1918 this.url = url; 1919 this.location = location; 1920 } 1921 1922 /** 1923 * JSON Object Constructor 1924 * @param jo A Json-Object having data about an instance of {@code 'NavigatorUserAgentIssueDetails'}. 1925 */ 1926 public NavigatorUserAgentIssueDetails (JsonObject jo) 1927 { 1928 this.url = ReadJSON.getString(jo, "url", false, true); 1929 this.location = ReadJSON.getObject(jo, "location", Audits.SourceCodeLocation.class, true, false); 1930 } 1931 1932 1933 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1934 public boolean equals(Object other) 1935 { 1936 if (this == other) return true; 1937 if (other == null) return false; 1938 if (other.getClass() != this.getClass()) return false; 1939 1940 NavigatorUserAgentIssueDetails o = (NavigatorUserAgentIssueDetails) other; 1941 1942 return 1943 Objects.equals(this.url, o.url) 1944 && Objects.equals(this.location, o.location); 1945 } 1946 1947 /** Generates a Hash-Code for {@code 'this'} instance */ 1948 public int hashCode() 1949 { 1950 return 1951 Objects.hashCode(this.url) 1952 + this.location.hashCode(); 1953 } 1954 } 1955 1956 /** <CODE>[No Description Provided by Google]</CODE> */ 1957 public static class WasmCrossOriginModuleSharingIssueDetails 1958 extends BaseType 1959 implements java.io.Serializable 1960 { 1961 /** For Object Serialization. java.io.Serializable */ 1962 protected static final long serialVersionUID = 1; 1963 1964 public boolean[] optionals() 1965 { return new boolean[] { false, false, false, false, }; } 1966 1967 /** <CODE>[No Description Provided by Google]</CODE> */ 1968 public final String wasmModuleUrl; 1969 1970 /** <CODE>[No Description Provided by Google]</CODE> */ 1971 public final String sourceOrigin; 1972 1973 /** <CODE>[No Description Provided by Google]</CODE> */ 1974 public final String targetOrigin; 1975 1976 /** <CODE>[No Description Provided by Google]</CODE> */ 1977 public final boolean isWarning; 1978 1979 /** 1980 * Constructor 1981 * 1982 * @param wasmModuleUrl - 1983 * 1984 * @param sourceOrigin - 1985 * 1986 * @param targetOrigin - 1987 * 1988 * @param isWarning - 1989 */ 1990 public WasmCrossOriginModuleSharingIssueDetails 1991 (String wasmModuleUrl, String sourceOrigin, String targetOrigin, boolean isWarning) 1992 { 1993 // Exception-Check(s) to ensure that if any parameters which are not declared as 1994 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1995 1996 if (wasmModuleUrl == null) THROWS.throwNPE("wasmModuleUrl"); 1997 if (sourceOrigin == null) THROWS.throwNPE("sourceOrigin"); 1998 if (targetOrigin == null) THROWS.throwNPE("targetOrigin"); 1999 2000 this.wasmModuleUrl = wasmModuleUrl; 2001 this.sourceOrigin = sourceOrigin; 2002 this.targetOrigin = targetOrigin; 2003 this.isWarning = isWarning; 2004 } 2005 2006 /** 2007 * JSON Object Constructor 2008 * @param jo A Json-Object having data about an instance of {@code 'WasmCrossOriginModuleSharingIssueDetails'}. 2009 */ 2010 public WasmCrossOriginModuleSharingIssueDetails (JsonObject jo) 2011 { 2012 this.wasmModuleUrl = ReadJSON.getString(jo, "wasmModuleUrl", false, true); 2013 this.sourceOrigin = ReadJSON.getString(jo, "sourceOrigin", false, true); 2014 this.targetOrigin = ReadJSON.getString(jo, "targetOrigin", false, true); 2015 this.isWarning = ReadPrimJSON.getBoolean(jo, "isWarning"); 2016 } 2017 2018 2019 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 2020 public boolean equals(Object other) 2021 { 2022 if (this == other) return true; 2023 if (other == null) return false; 2024 if (other.getClass() != this.getClass()) return false; 2025 2026 WasmCrossOriginModuleSharingIssueDetails o = (WasmCrossOriginModuleSharingIssueDetails) other; 2027 2028 return 2029 Objects.equals(this.wasmModuleUrl, o.wasmModuleUrl) 2030 && Objects.equals(this.sourceOrigin, o.sourceOrigin) 2031 && Objects.equals(this.targetOrigin, o.targetOrigin) 2032 && (this.isWarning == o.isWarning); 2033 } 2034 2035 /** Generates a Hash-Code for {@code 'this'} instance */ 2036 public int hashCode() 2037 { 2038 return 2039 Objects.hashCode(this.wasmModuleUrl) 2040 + Objects.hashCode(this.sourceOrigin) 2041 + Objects.hashCode(this.targetOrigin) 2042 + (this.isWarning ? 1 : 0); 2043 } 2044 } 2045 2046 /** Depending on the concrete errorType, different properties are set. */ 2047 public static class GenericIssueDetails 2048 extends BaseType 2049 implements java.io.Serializable 2050 { 2051 /** For Object Serialization. java.io.Serializable */ 2052 protected static final long serialVersionUID = 1; 2053 2054 public boolean[] optionals() 2055 { return new boolean[] { false, true, }; } 2056 2057 /** Issues with the same errorType are aggregated in the frontend. */ 2058 public final String errorType; 2059 2060 /** 2061 * <CODE>[No Description Provided by Google]</CODE> 2062 * <BR /> 2063 * <BR /><B>OPTIONAL</B> 2064 */ 2065 public final String frameId; 2066 2067 /** 2068 * Constructor 2069 * 2070 * @param errorType Issues with the same errorType are aggregated in the frontend. 2071 * 2072 * @param frameId - 2073 * <BR /><B>OPTIONAL</B> 2074 */ 2075 public GenericIssueDetails(String errorType, String frameId) 2076 { 2077 // Exception-Check(s) to ensure that if any parameters which are not declared as 2078 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2079 2080 if (errorType == null) THROWS.throwNPE("errorType"); 2081 2082 // Exception-Check(s) to ensure that if any parameters which must adhere to a 2083 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 2084 2085 THROWS.checkIAE("errorType", errorType, "Audits.GenericIssueErrorType", Audits.GenericIssueErrorType); 2086 2087 this.errorType = errorType; 2088 this.frameId = frameId; 2089 } 2090 2091 /** 2092 * JSON Object Constructor 2093 * @param jo A Json-Object having data about an instance of {@code 'GenericIssueDetails'}. 2094 */ 2095 public GenericIssueDetails (JsonObject jo) 2096 { 2097 this.errorType = ReadJSON.getString(jo, "errorType", false, true); 2098 this.frameId = ReadJSON.getString(jo, "frameId", true, false); 2099 } 2100 2101 2102 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 2103 public boolean equals(Object other) 2104 { 2105 if (this == other) return true; 2106 if (other == null) return false; 2107 if (other.getClass() != this.getClass()) return false; 2108 2109 GenericIssueDetails o = (GenericIssueDetails) other; 2110 2111 return 2112 Objects.equals(this.errorType, o.errorType) 2113 && Objects.equals(this.frameId, o.frameId); 2114 } 2115 2116 /** Generates a Hash-Code for {@code 'this'} instance */ 2117 public int hashCode() 2118 { 2119 return 2120 Objects.hashCode(this.errorType) 2121 + Objects.hashCode(this.frameId); 2122 } 2123 } 2124 2125 /** 2126 * This struct holds a list of optional fields with additional information 2127 * specific to the kind of issue. When adding a new issue code, please also 2128 * add a new optional field to this type. 2129 */ 2130 public static class InspectorIssueDetails 2131 extends BaseType 2132 implements java.io.Serializable 2133 { 2134 /** For Object Serialization. java.io.Serializable */ 2135 protected static final long serialVersionUID = 1; 2136 2137 public boolean[] optionals() 2138 { return new boolean[] { true, true, true, true, true, true, true, true, true, true, true, true, true, true, }; } 2139 2140 /** 2141 * <CODE>[No Description Provided by Google]</CODE> 2142 * <BR /> 2143 * <BR /><B>OPTIONAL</B> 2144 */ 2145 public final Audits.SameSiteCookieIssueDetails sameSiteCookieIssueDetails; 2146 2147 /** 2148 * <CODE>[No Description Provided by Google]</CODE> 2149 * <BR /> 2150 * <BR /><B>OPTIONAL</B> 2151 */ 2152 public final Audits.MixedContentIssueDetails mixedContentIssueDetails; 2153 2154 /** 2155 * <CODE>[No Description Provided by Google]</CODE> 2156 * <BR /> 2157 * <BR /><B>OPTIONAL</B> 2158 */ 2159 public final Audits.BlockedByResponseIssueDetails blockedByResponseIssueDetails; 2160 2161 /** 2162 * <CODE>[No Description Provided by Google]</CODE> 2163 * <BR /> 2164 * <BR /><B>OPTIONAL</B> 2165 */ 2166 public final Audits.HeavyAdIssueDetails heavyAdIssueDetails; 2167 2168 /** 2169 * <CODE>[No Description Provided by Google]</CODE> 2170 * <BR /> 2171 * <BR /><B>OPTIONAL</B> 2172 */ 2173 public final Audits.ContentSecurityPolicyIssueDetails contentSecurityPolicyIssueDetails; 2174 2175 /** 2176 * <CODE>[No Description Provided by Google]</CODE> 2177 * <BR /> 2178 * <BR /><B>OPTIONAL</B> 2179 */ 2180 public final Audits.SharedArrayBufferIssueDetails sharedArrayBufferIssueDetails; 2181 2182 /** 2183 * <CODE>[No Description Provided by Google]</CODE> 2184 * <BR /> 2185 * <BR /><B>OPTIONAL</B> 2186 */ 2187 public final Audits.TrustedWebActivityIssueDetails twaQualityEnforcementDetails; 2188 2189 /** 2190 * <CODE>[No Description Provided by Google]</CODE> 2191 * <BR /> 2192 * <BR /><B>OPTIONAL</B> 2193 */ 2194 public final Audits.LowTextContrastIssueDetails lowTextContrastIssueDetails; 2195 2196 /** 2197 * <CODE>[No Description Provided by Google]</CODE> 2198 * <BR /> 2199 * <BR /><B>OPTIONAL</B> 2200 */ 2201 public final Audits.CorsIssueDetails corsIssueDetails; 2202 2203 /** 2204 * <CODE>[No Description Provided by Google]</CODE> 2205 * <BR /> 2206 * <BR /><B>OPTIONAL</B> 2207 */ 2208 public final Audits.AttributionReportingIssueDetails attributionReportingIssueDetails; 2209 2210 /** 2211 * <CODE>[No Description Provided by Google]</CODE> 2212 * <BR /> 2213 * <BR /><B>OPTIONAL</B> 2214 */ 2215 public final Audits.QuirksModeIssueDetails quirksModeIssueDetails; 2216 2217 /** 2218 * <CODE>[No Description Provided by Google]</CODE> 2219 * <BR /> 2220 * <BR /><B>OPTIONAL</B> 2221 */ 2222 public final Audits.NavigatorUserAgentIssueDetails navigatorUserAgentIssueDetails; 2223 2224 /** 2225 * <CODE>[No Description Provided by Google]</CODE> 2226 * <BR /> 2227 * <BR /><B>OPTIONAL</B> 2228 */ 2229 public final Audits.WasmCrossOriginModuleSharingIssueDetails wasmCrossOriginModuleSharingIssue; 2230 2231 /** 2232 * <CODE>[No Description Provided by Google]</CODE> 2233 * <BR /> 2234 * <BR /><B>OPTIONAL</B> 2235 */ 2236 public final Audits.GenericIssueDetails genericIssueDetails; 2237 2238 /** 2239 * Constructor 2240 * 2241 * @param sameSiteCookieIssueDetails - 2242 * <BR /><B>OPTIONAL</B> 2243 * 2244 * @param mixedContentIssueDetails - 2245 * <BR /><B>OPTIONAL</B> 2246 * 2247 * @param blockedByResponseIssueDetails - 2248 * <BR /><B>OPTIONAL</B> 2249 * 2250 * @param heavyAdIssueDetails - 2251 * <BR /><B>OPTIONAL</B> 2252 * 2253 * @param contentSecurityPolicyIssueDetails - 2254 * <BR /><B>OPTIONAL</B> 2255 * 2256 * @param sharedArrayBufferIssueDetails - 2257 * <BR /><B>OPTIONAL</B> 2258 * 2259 * @param twaQualityEnforcementDetails - 2260 * <BR /><B>OPTIONAL</B> 2261 * 2262 * @param lowTextContrastIssueDetails - 2263 * <BR /><B>OPTIONAL</B> 2264 * 2265 * @param corsIssueDetails - 2266 * <BR /><B>OPTIONAL</B> 2267 * 2268 * @param attributionReportingIssueDetails - 2269 * <BR /><B>OPTIONAL</B> 2270 * 2271 * @param quirksModeIssueDetails - 2272 * <BR /><B>OPTIONAL</B> 2273 * 2274 * @param navigatorUserAgentIssueDetails - 2275 * <BR /><B>OPTIONAL</B> 2276 * 2277 * @param wasmCrossOriginModuleSharingIssue - 2278 * <BR /><B>OPTIONAL</B> 2279 * 2280 * @param genericIssueDetails - 2281 * <BR /><B>OPTIONAL</B> 2282 */ 2283 public InspectorIssueDetails( 2284 Audits.SameSiteCookieIssueDetails sameSiteCookieIssueDetails, 2285 Audits.MixedContentIssueDetails mixedContentIssueDetails, 2286 Audits.BlockedByResponseIssueDetails blockedByResponseIssueDetails, 2287 Audits.HeavyAdIssueDetails heavyAdIssueDetails, 2288 Audits.ContentSecurityPolicyIssueDetails contentSecurityPolicyIssueDetails, 2289 Audits.SharedArrayBufferIssueDetails sharedArrayBufferIssueDetails, 2290 Audits.TrustedWebActivityIssueDetails twaQualityEnforcementDetails, 2291 Audits.LowTextContrastIssueDetails lowTextContrastIssueDetails, 2292 Audits.CorsIssueDetails corsIssueDetails, 2293 Audits.AttributionReportingIssueDetails attributionReportingIssueDetails, 2294 Audits.QuirksModeIssueDetails quirksModeIssueDetails, 2295 Audits.NavigatorUserAgentIssueDetails navigatorUserAgentIssueDetails, 2296 Audits.WasmCrossOriginModuleSharingIssueDetails wasmCrossOriginModuleSharingIssue, 2297 Audits.GenericIssueDetails genericIssueDetails 2298 ) 2299 { 2300 this.sameSiteCookieIssueDetails = sameSiteCookieIssueDetails; 2301 this.mixedContentIssueDetails = mixedContentIssueDetails; 2302 this.blockedByResponseIssueDetails = blockedByResponseIssueDetails; 2303 this.heavyAdIssueDetails = heavyAdIssueDetails; 2304 this.contentSecurityPolicyIssueDetails = contentSecurityPolicyIssueDetails; 2305 this.sharedArrayBufferIssueDetails = sharedArrayBufferIssueDetails; 2306 this.twaQualityEnforcementDetails = twaQualityEnforcementDetails; 2307 this.lowTextContrastIssueDetails = lowTextContrastIssueDetails; 2308 this.corsIssueDetails = corsIssueDetails; 2309 this.attributionReportingIssueDetails = attributionReportingIssueDetails; 2310 this.quirksModeIssueDetails = quirksModeIssueDetails; 2311 this.navigatorUserAgentIssueDetails = navigatorUserAgentIssueDetails; 2312 this.wasmCrossOriginModuleSharingIssue = wasmCrossOriginModuleSharingIssue; 2313 this.genericIssueDetails = genericIssueDetails; 2314 } 2315 2316 /** 2317 * JSON Object Constructor 2318 * @param jo A Json-Object having data about an instance of {@code 'InspectorIssueDetails'}. 2319 */ 2320 public InspectorIssueDetails (JsonObject jo) 2321 { 2322 this.sameSiteCookieIssueDetails = ReadJSON.getObject(jo, "sameSiteCookieIssueDetails", Audits.SameSiteCookieIssueDetails.class, true, false); 2323 this.mixedContentIssueDetails = ReadJSON.getObject(jo, "mixedContentIssueDetails", Audits.MixedContentIssueDetails.class, true, false); 2324 this.blockedByResponseIssueDetails = ReadJSON.getObject(jo, "blockedByResponseIssueDetails", Audits.BlockedByResponseIssueDetails.class, true, false); 2325 this.heavyAdIssueDetails = ReadJSON.getObject(jo, "heavyAdIssueDetails", Audits.HeavyAdIssueDetails.class, true, false); 2326 this.contentSecurityPolicyIssueDetails = ReadJSON.getObject(jo, "contentSecurityPolicyIssueDetails", Audits.ContentSecurityPolicyIssueDetails.class, true, false); 2327 this.sharedArrayBufferIssueDetails = ReadJSON.getObject(jo, "sharedArrayBufferIssueDetails", Audits.SharedArrayBufferIssueDetails.class, true, false); 2328 this.twaQualityEnforcementDetails = ReadJSON.getObject(jo, "twaQualityEnforcementDetails", Audits.TrustedWebActivityIssueDetails.class, true, false); 2329 this.lowTextContrastIssueDetails = ReadJSON.getObject(jo, "lowTextContrastIssueDetails", Audits.LowTextContrastIssueDetails.class, true, false); 2330 this.corsIssueDetails = ReadJSON.getObject(jo, "corsIssueDetails", Audits.CorsIssueDetails.class, true, false); 2331 this.attributionReportingIssueDetails = ReadJSON.getObject(jo, "attributionReportingIssueDetails", Audits.AttributionReportingIssueDetails.class, true, false); 2332 this.quirksModeIssueDetails = ReadJSON.getObject(jo, "quirksModeIssueDetails", Audits.QuirksModeIssueDetails.class, true, false); 2333 this.navigatorUserAgentIssueDetails = ReadJSON.getObject(jo, "navigatorUserAgentIssueDetails", Audits.NavigatorUserAgentIssueDetails.class, true, false); 2334 this.wasmCrossOriginModuleSharingIssue = ReadJSON.getObject(jo, "wasmCrossOriginModuleSharingIssue", Audits.WasmCrossOriginModuleSharingIssueDetails.class, true, false); 2335 this.genericIssueDetails = ReadJSON.getObject(jo, "genericIssueDetails", Audits.GenericIssueDetails.class, true, false); 2336 } 2337 2338 2339 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 2340 public boolean equals(Object other) 2341 { 2342 if (this == other) return true; 2343 if (other == null) return false; 2344 if (other.getClass() != this.getClass()) return false; 2345 2346 InspectorIssueDetails o = (InspectorIssueDetails) other; 2347 2348 return 2349 Objects.equals(this.sameSiteCookieIssueDetails, o.sameSiteCookieIssueDetails) 2350 && Objects.equals(this.mixedContentIssueDetails, o.mixedContentIssueDetails) 2351 && Objects.equals(this.blockedByResponseIssueDetails, o.blockedByResponseIssueDetails) 2352 && Objects.equals(this.heavyAdIssueDetails, o.heavyAdIssueDetails) 2353 && Objects.equals(this.contentSecurityPolicyIssueDetails, o.contentSecurityPolicyIssueDetails) 2354 && Objects.equals(this.sharedArrayBufferIssueDetails, o.sharedArrayBufferIssueDetails) 2355 && Objects.equals(this.twaQualityEnforcementDetails, o.twaQualityEnforcementDetails) 2356 && Objects.equals(this.lowTextContrastIssueDetails, o.lowTextContrastIssueDetails) 2357 && Objects.equals(this.corsIssueDetails, o.corsIssueDetails) 2358 && Objects.equals(this.attributionReportingIssueDetails, o.attributionReportingIssueDetails) 2359 && Objects.equals(this.quirksModeIssueDetails, o.quirksModeIssueDetails) 2360 && Objects.equals(this.navigatorUserAgentIssueDetails, o.navigatorUserAgentIssueDetails) 2361 && Objects.equals(this.wasmCrossOriginModuleSharingIssue, o.wasmCrossOriginModuleSharingIssue) 2362 && Objects.equals(this.genericIssueDetails, o.genericIssueDetails); 2363 } 2364 2365 /** Generates a Hash-Code for {@code 'this'} instance */ 2366 public int hashCode() 2367 { 2368 return 2369 this.sameSiteCookieIssueDetails.hashCode() 2370 + this.mixedContentIssueDetails.hashCode() 2371 + this.blockedByResponseIssueDetails.hashCode() 2372 + this.heavyAdIssueDetails.hashCode() 2373 + this.contentSecurityPolicyIssueDetails.hashCode() 2374 + this.sharedArrayBufferIssueDetails.hashCode() 2375 + this.twaQualityEnforcementDetails.hashCode() 2376 + this.lowTextContrastIssueDetails.hashCode() 2377 + this.corsIssueDetails.hashCode() 2378 + this.attributionReportingIssueDetails.hashCode() 2379 + this.quirksModeIssueDetails.hashCode() 2380 + this.navigatorUserAgentIssueDetails.hashCode() 2381 + this.wasmCrossOriginModuleSharingIssue.hashCode() 2382 + this.genericIssueDetails.hashCode(); 2383 } 2384 } 2385 2386 /** An inspector issue reported from the back-end. */ 2387 public static class InspectorIssue 2388 extends BaseType 2389 implements java.io.Serializable 2390 { 2391 /** For Object Serialization. java.io.Serializable */ 2392 protected static final long serialVersionUID = 1; 2393 2394 public boolean[] optionals() 2395 { return new boolean[] { false, false, true, }; } 2396 2397 /** <CODE>[No Description Provided by Google]</CODE> */ 2398 public final String code; 2399 2400 /** <CODE>[No Description Provided by Google]</CODE> */ 2401 public final Audits.InspectorIssueDetails details; 2402 2403 /** 2404 * A unique id for this issue. May be omitted if no other entity (e.g. 2405 * exception, CDP message, etc.) is referencing this issue. 2406 * <BR /> 2407 * <BR /><B>OPTIONAL</B> 2408 */ 2409 public final String issueId; 2410 2411 /** 2412 * Constructor 2413 * 2414 * @param code - 2415 * 2416 * @param details - 2417 * 2418 * @param issueId 2419 * A unique id for this issue. May be omitted if no other entity (e.g. 2420 * exception, CDP message, etc.) is referencing this issue. 2421 * <BR /><B>OPTIONAL</B> 2422 */ 2423 public InspectorIssue(String code, Audits.InspectorIssueDetails details, String issueId) 2424 { 2425 // Exception-Check(s) to ensure that if any parameters which are not declared as 2426 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2427 2428 if (code == null) THROWS.throwNPE("code"); 2429 if (details == null) THROWS.throwNPE("details"); 2430 2431 // Exception-Check(s) to ensure that if any parameters which must adhere to a 2432 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 2433 2434 THROWS.checkIAE("code", code, "Audits.InspectorIssueCode", Audits.InspectorIssueCode); 2435 2436 this.code = code; 2437 this.details = details; 2438 this.issueId = issueId; 2439 } 2440 2441 /** 2442 * JSON Object Constructor 2443 * @param jo A Json-Object having data about an instance of {@code 'InspectorIssue'}. 2444 */ 2445 public InspectorIssue (JsonObject jo) 2446 { 2447 this.code = ReadJSON.getString(jo, "code", false, true); 2448 this.details = ReadJSON.getObject(jo, "details", Audits.InspectorIssueDetails.class, false, true); 2449 this.issueId = ReadJSON.getString(jo, "issueId", true, false); 2450 } 2451 2452 2453 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 2454 public boolean equals(Object other) 2455 { 2456 if (this == other) return true; 2457 if (other == null) return false; 2458 if (other.getClass() != this.getClass()) return false; 2459 2460 InspectorIssue o = (InspectorIssue) other; 2461 2462 return 2463 Objects.equals(this.code, o.code) 2464 && Objects.equals(this.details, o.details) 2465 && Objects.equals(this.issueId, o.issueId); 2466 } 2467 2468 /** Generates a Hash-Code for {@code 'this'} instance */ 2469 public int hashCode() 2470 { 2471 return 2472 Objects.hashCode(this.code) 2473 + this.details.hashCode() 2474 + Objects.hashCode(this.issueId); 2475 } 2476 } 2477 2478 /** <CODE>[No Description Provided by Google]</CODE> */ 2479 public static class issueAdded 2480 extends BrowserEvent 2481 implements java.io.Serializable 2482 { 2483 /** For Object Serialization. java.io.Serializable */ 2484 protected static final long serialVersionUID = 1; 2485 2486 public boolean[] optionals() 2487 { return new boolean[] { false, }; } 2488 2489 /** <CODE>[No Description Provided by Google]</CODE> */ 2490 public final Audits.InspectorIssue issue; 2491 2492 /** 2493 * Constructor 2494 * 2495 * @param issue - 2496 */ 2497 public issueAdded(Audits.InspectorIssue issue) 2498 { 2499 super("Audits", "issueAdded", 1); 2500 2501 // Exception-Check(s) to ensure that if any parameters which are not declared as 2502 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2503 2504 if (issue == null) THROWS.throwNPE("issue"); 2505 2506 this.issue = issue; 2507 } 2508 2509 /** 2510 * JSON Object Constructor 2511 * @param jo A Json-Object having data about an instance of {@code 'issueAdded'}. 2512 */ 2513 public issueAdded (JsonObject jo) 2514 { 2515 super("Audits", "issueAdded", 1); 2516 2517 this.issue = ReadJSON.getObject(jo, "issue", Audits.InspectorIssue.class, false, true); 2518 } 2519 2520 2521 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 2522 public boolean equals(Object other) 2523 { 2524 if (this == other) return true; 2525 if (other == null) return false; 2526 if (other.getClass() != this.getClass()) return false; 2527 2528 issueAdded o = (issueAdded) other; 2529 2530 return 2531 Objects.equals(this.issue, o.issue); 2532 } 2533 2534 /** Generates a Hash-Code for {@code 'this'} instance */ 2535 public int hashCode() 2536 { 2537 return 2538 this.issue.hashCode(); 2539 } 2540 } 2541 2542 2543 // Counter for keeping the WebSocket Request ID's distinct. 2544 private static int counter = 1; 2545 2546 /** 2547 * Returns the response body and size if it were re-encoded with the specified settings. Only 2548 * applies to images. 2549 * 2550 * @param requestId Identifier of the network request to get content for. 2551 * 2552 * @param encoding The encoding to use. 2553 * <BR />Acceptable Values: ["webp", "jpeg", "png"] 2554 * 2555 * @param quality The quality of the encoding (0-1). (defaults to 1) 2556 * <BR /><B>OPTIONAL</B> 2557 * 2558 * @param sizeOnly Whether to only return the size information (defaults to false). 2559 * <BR /><B>OPTIONAL</B> 2560 * 2561 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 2562 * {@link Ret3}></CODE> 2563 * 2564 * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 2565 * {@link Script#exec()}), and a {@link Promise} returned. 2566 * 2567 * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B> 2568 * (using {@link Promise#await()}), the {@code Ret3} will subsequently 2569 * be returned from that call. 2570 * 2571 * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated 2572 * in an instance of <B>{@link Ret3}</B> 2573 * 2574 * <BR /><BR /><UL CLASS=JDUL> 2575 * <LI><CODE><B>Ret3.a:</B> String (<B>body</B>)</CODE> 2576 * <BR />The encoded body as a base64 string. Omitted if sizeOnly is true. (Encoded as a base64 string when passed over JSON) 2577 * <BR /><BR /></LI> 2578 * <LI><CODE><B>Ret3.b:</B> Integer (<B>originalSize</B>)</CODE> 2579 * <BR />Size before re-encoding. 2580 * <BR /><BR /></LI> 2581 * <LI><CODE><B>Ret3.c:</B> Integer (<B>encodedSize</B>)</CODE> 2582 * <BR />Size after re-encoding. 2583 * </LI> 2584 * </UL> 2585 */ 2586 public static Script<String, JsonObject, Ret3<String, Integer, Integer>> getEncodedResponse 2587 (String requestId, String encoding, Number quality, Boolean sizeOnly) 2588 { 2589 // Exception-Check(s) to ensure that if any parameters which are not declared as 2590 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2591 2592 if (requestId == null) THROWS.throwNPE("requestId"); 2593 if (encoding == null) THROWS.throwNPE("encoding"); 2594 2595 // Exception-Check(s) to ensure that if any parameters which must adhere to a 2596 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 2597 2598 THROWS.checkIAE( 2599 "encoding", encoding, 2600 "webp", "jpeg", "png" 2601 ); 2602 2603 final int webSocketID = 9000000 + counter++; 2604 final boolean[] optionals = { false, false, true, true, }; 2605 2606 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 2607 String requestJSON = WriteJSON.get( 2608 parameterTypes.get("getEncodedResponse"), 2609 parameterNames.get("getEncodedResponse"), 2610 optionals, webSocketID, 2611 "Audits.getEncodedResponse", 2612 requestId, encoding, quality, sizeOnly 2613 ); 2614 2615 // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret3' 2616 Function<JsonObject, Ret3<String, Integer, Integer>> 2617 responseProcessor = (JsonObject jo) -> new Ret3<>( 2618 ReadJSON.getString(jo, "body", true, false), 2619 ReadBoxedJSON.getInteger(jo, "originalSize", true), 2620 ReadBoxedJSON.getInteger(jo, "encodedSize", true) 2621 ); 2622 2623 return new Script<>(webSocketID, requestJSON, responseProcessor); 2624 } 2625 2626 /** 2627 * Disables issues domain, prevents further issues from being reported to the client. 2628 * 2629 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 2630 * {@link Ret0}></CODE> 2631 * 2632 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 2633 * browser receives the invocation-request. 2634 * 2635 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 2636 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 2637 * {@code >} to ensure the Browser Function has run to completion. 2638 */ 2639 public static Script<String, JsonObject, Ret0> disable() 2640 { 2641 final int webSocketID = 9001000 + counter++; 2642 final boolean[] optionals = new boolean[0]; 2643 2644 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 2645 String requestJSON = WriteJSON.get( 2646 parameterTypes.get("disable"), 2647 parameterNames.get("disable"), 2648 optionals, webSocketID, 2649 "Audits.disable" 2650 ); 2651 2652 // This Remote Command does not have a Return-Value. 2653 return new Script<> 2654 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 2655 } 2656 2657 /** 2658 * Enables issues domain, sends the issues collected so far to the client by means of the 2659 * <CODE>issueAdded</CODE> event. 2660 * 2661 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 2662 * {@link Ret0}></CODE> 2663 * 2664 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 2665 * browser receives the invocation-request. 2666 * 2667 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 2668 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 2669 * {@code >} to ensure the Browser Function has run to completion. 2670 */ 2671 public static Script<String, JsonObject, Ret0> enable() 2672 { 2673 final int webSocketID = 9002000 + counter++; 2674 final boolean[] optionals = new boolean[0]; 2675 2676 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 2677 String requestJSON = WriteJSON.get( 2678 parameterTypes.get("enable"), 2679 parameterNames.get("enable"), 2680 optionals, webSocketID, 2681 "Audits.enable" 2682 ); 2683 2684 // This Remote Command does not have a Return-Value. 2685 return new Script<> 2686 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 2687 } 2688 2689 /** 2690 * Runs the contrast check for the target page. Found issues are reported 2691 * using Audits.issueAdded event. 2692 * 2693 * @param reportAAA Whether to report WCAG AAA level issues. Default is false. 2694 * <BR /><B>OPTIONAL</B> 2695 * 2696 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 2697 * {@link Ret0}></CODE> 2698 * 2699 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 2700 * browser receives the invocation-request. 2701 * 2702 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 2703 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 2704 * {@code >} to ensure the Browser Function has run to completion. 2705 */ 2706 public static Script<String, JsonObject, Ret0> checkContrast(Boolean reportAAA) 2707 { 2708 final int webSocketID = 9003000 + counter++; 2709 final boolean[] optionals = { true, }; 2710 2711 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 2712 String requestJSON = WriteJSON.get( 2713 parameterTypes.get("checkContrast"), 2714 parameterNames.get("checkContrast"), 2715 optionals, webSocketID, 2716 "Audits.checkContrast", 2717 reportAAA 2718 ); 2719 2720 // This Remote Command does not have a Return-Value. 2721 return new Script<> 2722 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 2723 } 2724 2725}