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