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