001package Torello.Browser.BrowserAPI; 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.Browser.BrowserEvent; 013import Torello.Browser.JavaScriptAPI.*; 014import Torello.Browser.helper.*; 015 016import Torello.Java.Additional.*; 017import Torello.Java.JSON.*; 018 019import static Torello.Java.JSON.JFlag.*; 020 021import Torello.Java.StrCmpr; 022import Torello.JavaDoc.StaticFunctional; 023import Torello.JavaDoc.JDHeaderBackgroundImg; 024import Torello.JavaDoc.Excuse; 025 026/** 027 * <SPAN CLASS=COPIEDJDK><B><CODE>[No Description Provided by Google]</CODE></B></SPAN> 028 * 029 * <EMBED CLASS='external-html' DATA-FILE-ID=CODE_GEN_NOTE> 030 */ 031@StaticFunctional(Excused={"counter"}, Excuses={Excuse.CONFIGURATION}) 032@JDHeaderBackgroundImg(EmbedTagFileID="WOOD_PLANK_NOTE") 033public class Preload 034{ 035 // ******************************************************************************************** 036 // ******************************************************************************************** 037 // Class Header Stuff 038 // ******************************************************************************************** 039 // ******************************************************************************************** 040 041 042 // No Pubic Constructors 043 private Preload () { } 044 045 // These two Vector's are used by all the "Methods" exported by this class. java.lang.reflect 046 // is used to generate the JSON String's. It saves thousands of lines of Auto-Generated Code. 047 private static final Map<String, Vector<String>> parameterNames = new HashMap<>(); 048 private static final Map<String, Vector<Class<?>>> parameterTypes = new HashMap<>(); 049 050 // Some Methods do not take any parameters - for instance all the "enable()" and "disable()" 051 // I simply could not get ride of RAW-TYPES and UNCHECKED warnings... so there are now, 052 // offically, two empty-vectors. One for String's, and the other for Classes. 053 054 private static final Vector<String> EMPTY_VEC_STR = new Vector<>(); 055 private static final Vector<Class<?>> EMPTY_VEC_CLASS = new Vector<>(); 056 057 static 058 { 059 for (Method m : Preload.class.getMethods()) 060 { 061 // This doesn't work! The parameter names are all "arg0" ... "argN" 062 // It works for java.lang.reflect.Field, BUT NOT java.lang.reflect.Parameter! 063 // 064 // Vector<String> parameterNamesList = new Vector<>(); -- NOPE! 065 066 Vector<Class<?>> parameterTypesList = new Vector<>(); 067 068 for (Parameter p : m.getParameters()) parameterTypesList.add(p.getType()); 069 070 parameterTypes.put( 071 m.getName(), 072 (parameterTypesList.size() > 0) ? parameterTypesList : EMPTY_VEC_CLASS 073 ); 074 } 075 } 076 077 static 078 { 079 Vector<String> v = null; 080 081 parameterNames.put("enable", EMPTY_VEC_STR); 082 083 parameterNames.put("disable", EMPTY_VEC_STR); 084 } 085 086 087 // ******************************************************************************************** 088 // ******************************************************************************************** 089 // Types - Static Inner Classes 090 // ******************************************************************************************** 091 // ******************************************************************************************** 092 093 // public static class RuleSetId => String 094 095 // public static class PreloadPipelineId => String 096 097 /** <CODE>[No Description Provided by Google]</CODE> */ 098 public static final String[] RuleSetErrorType = 099 { "SourceIsNotJsonObject", "InvalidRulesSkipped", "InvalidRulesetLevelTag", }; 100 101 /** 102 * The type of preloading attempted. It corresponds to 103 * mojom::SpeculationAction (although PrefetchWithSubresources is omitted as it 104 * isn't being used by clients). 105 */ 106 public static final String[] SpeculationAction = 107 { "Prefetch", "Prerender", }; 108 109 /** 110 * Corresponds to mojom::SpeculationTargetHint. 111 * See https://github.com/WICG/nav-speculation/blob/main/triggers.md#window-name-targeting-hints 112 */ 113 public static final String[] SpeculationTargetHint = 114 { "Blank", "Self", }; 115 116 /** List of FinalStatus reasons for Prerender2. */ 117 public static final String[] PrerenderFinalStatus = 118 { 119 "Activated", "Destroyed", "LowEndDevice", "InvalidSchemeRedirect", 120 "InvalidSchemeNavigation", "NavigationRequestBlockedByCsp", "MojoBinderPolicy", 121 "RendererProcessCrashed", "RendererProcessKilled", "Download", "TriggerDestroyed", 122 "NavigationNotCommitted", "NavigationBadHttpStatus", "ClientCertRequested", 123 "NavigationRequestNetworkError", "CancelAllHostsForTesting", "DidFailLoad", "Stop", 124 "SslCertificateError", "LoginAuthRequested", "UaChangeRequiresReload", "BlockedByClient", 125 "AudioOutputDeviceRequested", "MixedContent", "TriggerBackgrounded", "MemoryLimitExceeded", 126 "DataSaverEnabled", "TriggerUrlHasEffectiveUrl", "ActivatedBeforeStarted", 127 "InactivePageRestriction", "StartFailed", "TimeoutBackgrounded", 128 "CrossSiteRedirectInInitialNavigation", "CrossSiteNavigationInInitialNavigation", 129 "SameSiteCrossOriginRedirectNotOptInInInitialNavigation", 130 "SameSiteCrossOriginNavigationNotOptInInInitialNavigation", 131 "ActivationNavigationParameterMismatch", "ActivatedInBackground", "EmbedderHostDisallowed", 132 "ActivationNavigationDestroyedBeforeSuccess", "TabClosedByUserGesture", 133 "TabClosedWithoutUserGesture", "PrimaryMainFrameRendererProcessCrashed", 134 "PrimaryMainFrameRendererProcessKilled", "ActivationFramePolicyNotCompatible", 135 "PreloadingDisabled", "BatterySaverEnabled", "ActivatedDuringMainFrameNavigation", 136 "PreloadingUnsupportedByWebContents", "CrossSiteRedirectInMainFrameNavigation", 137 "CrossSiteNavigationInMainFrameNavigation", 138 "SameSiteCrossOriginRedirectNotOptInInMainFrameNavigation", 139 "SameSiteCrossOriginNavigationNotOptInInMainFrameNavigation", "MemoryPressureOnTrigger", 140 "MemoryPressureAfterTriggered", "PrerenderingDisabledByDevTools", "SpeculationRuleRemoved", 141 "ActivatedWithAuxiliaryBrowsingContexts", "MaxNumOfRunningEagerPrerendersExceeded", 142 "MaxNumOfRunningNonEagerPrerendersExceeded", "MaxNumOfRunningEmbedderPrerendersExceeded", 143 "PrerenderingUrlHasEffectiveUrl", "RedirectedPrerenderingUrlHasEffectiveUrl", 144 "ActivationUrlHasEffectiveUrl", "JavaScriptInterfaceAdded", "JavaScriptInterfaceRemoved", 145 "AllPrerenderingCanceled", "WindowClosed", "SlowNetwork", "OtherPrerenderedPageActivated", 146 "V8OptimizerDisabled", "PrerenderFailedDuringPrefetch", "BrowsingDataRemoved", 147 "PrerenderHostReused", 148 }; 149 150 /** 151 * Preloading status values, see also PreloadingTriggeringOutcome. This 152 * status is shared by prefetchStatusUpdated and prerenderStatusUpdated. 153 */ 154 public static final String[] PreloadingStatus = 155 { "Pending", "Running", "Ready", "Success", "Failure", "NotSupported", }; 156 157 /** 158 * TODO(https://crbug.com/1384419): revisit the list of PrefetchStatus and 159 * filter out the ones that aren't necessary to the developers. 160 */ 161 public static final String[] PrefetchStatus = 162 { 163 "PrefetchAllowed", "PrefetchFailedIneligibleRedirect", "PrefetchFailedInvalidRedirect", 164 "PrefetchFailedMIMENotSupported", "PrefetchFailedNetError", "PrefetchFailedNon2XX", 165 "PrefetchEvictedAfterBrowsingDataRemoved", "PrefetchEvictedAfterCandidateRemoved", 166 "PrefetchEvictedForNewerPrefetch", "PrefetchHeldback", "PrefetchIneligibleRetryAfter", 167 "PrefetchIsPrivacyDecoy", "PrefetchIsStale", 168 "PrefetchNotEligibleBrowserContextOffTheRecord", "PrefetchNotEligibleDataSaverEnabled", 169 "PrefetchNotEligibleExistingProxy", "PrefetchNotEligibleHostIsNonUnique", 170 "PrefetchNotEligibleNonDefaultStoragePartition", 171 "PrefetchNotEligibleSameSiteCrossOriginPrefetchRequiredProxy", 172 "PrefetchNotEligibleSchemeIsNotHttps", "PrefetchNotEligibleUserHasCookies", 173 "PrefetchNotEligibleUserHasServiceWorker", 174 "PrefetchNotEligibleUserHasServiceWorkerNoFetchHandler", 175 "PrefetchNotEligibleRedirectFromServiceWorker", 176 "PrefetchNotEligibleRedirectToServiceWorker", "PrefetchNotEligibleBatterySaverEnabled", 177 "PrefetchNotEligiblePreloadingDisabled", "PrefetchNotFinishedInTime", "PrefetchNotStarted", 178 "PrefetchNotUsedCookiesChanged", "PrefetchProxyNotAvailable", "PrefetchResponseUsed", 179 "PrefetchSuccessfulButNotUsed", "PrefetchNotUsedProbeFailed", 180 }; 181 182 /** Corresponds to SpeculationRuleSet */ 183 public static class RuleSet 184 extends BaseType 185 implements java.io.Serializable 186 { 187 /** For Object Serialization. java.io.Serializable */ 188 protected static final long serialVersionUID = 1; 189 190 public boolean[] optionals() 191 { return new boolean[] { false, false, false, true, true, true, true, true, }; } 192 193 /** <CODE>[No Description Provided by Google]</CODE> */ 194 public final String id; 195 196 /** Identifies a document which the rule set is associated with. */ 197 public final String loaderId; 198 199 /** 200 * Source text of JSON representing the rule set. If it comes from 201 * {@code <script>} tag, it is the textContent of the node. Note that it is 202 * a JSON for valid case. 203 * 204 * See also: 205 * - https://wicg.github.io/nav-speculation/speculation-rules.html 206 * - https://github.com/WICG/nav-speculation/blob/main/triggers.md 207 */ 208 public final String sourceText; 209 210 /** 211 * A speculation rule set is either added through an inline 212 * {@code <script>} tag or through an external resource via the 213 * 'Speculation-Rules' HTTP header. For the first case, we include 214 * the BackendNodeId of the relevant {@code <script>} tag. For the second 215 * case, we include the external URL where the rule set was loaded 216 * from, and also RequestId if Network domain is enabled. 217 * 218 * See also: 219 * - https://wicg.github.io/nav-speculation/speculation-rules.html#speculation-rules-script 220 * - https://wicg.github.io/nav-speculation/speculation-rules.html#speculation-rules-header 221 * <BR /><B CLASS=Opt>OPTIONAL</B> 222 */ 223 public final Integer backendNodeId; 224 225 /** 226 * <CODE>[No Description Provided by Google]</CODE> 227 * <BR /><B CLASS=Opt>OPTIONAL</B> 228 */ 229 public final String url; 230 231 /** 232 * <CODE>[No Description Provided by Google]</CODE> 233 * <BR /><B CLASS=Opt>OPTIONAL</B> 234 */ 235 public final String requestId; 236 237 /** 238 * Error information 239 * {@code errorMessage} is null iff {@code errorType} is null. 240 * <BR /><B CLASS=Opt>OPTIONAL</B> 241 */ 242 public final String errorType; 243 244 /** 245 * TODO(https://crbug.com/1425354): Replace this property with structured error. 246 * <BR /><B CLASS=Opt>OPTIONAL</B> 247 <B CLASS=Dep>DEPRECATED</B> 248 */ 249 public final String errorMessage; 250 251 /** 252 * Constructor 253 * 254 * @param id - 255 * 256 * @param loaderId Identifies a document which the rule set is associated with. 257 * 258 * @param sourceText 259 * Source text of JSON representing the rule set. If it comes from 260 * {@code <script>} tag, it is the textContent of the node. Note that it is 261 * a JSON for valid case. 262 * 263 * See also: 264 * - https://wicg.github.io/nav-speculation/speculation-rules.html 265 * - https://github.com/WICG/nav-speculation/blob/main/triggers.md 266 * 267 * @param backendNodeId 268 * A speculation rule set is either added through an inline 269 * {@code <script>} tag or through an external resource via the 270 * 'Speculation-Rules' HTTP header. For the first case, we include 271 * the BackendNodeId of the relevant {@code <script>} tag. For the second 272 * case, we include the external URL where the rule set was loaded 273 * from, and also RequestId if Network domain is enabled. 274 * 275 * See also: 276 * - https://wicg.github.io/nav-speculation/speculation-rules.html#speculation-rules-script 277 * - https://wicg.github.io/nav-speculation/speculation-rules.html#speculation-rules-header 278 * <BR /><B CLASS=Opt>OPTIONAL</B> 279 * 280 * @param url - 281 * <BR /><B CLASS=Opt>OPTIONAL</B> 282 * 283 * @param requestId - 284 * <BR /><B CLASS=Opt>OPTIONAL</B> 285 * 286 * @param errorType 287 * Error information 288 * {@code errorMessage} is null iff {@code errorType} is null. 289 * <BR /><B CLASS=Opt>OPTIONAL</B> 290 * 291 * @param errorMessage TODO(https://crbug.com/1425354): Replace this property with structured error. 292 * <BR /><B CLASS=Opt>OPTIONAL</B><B CLASS=Dep>DEPRECATED</B> 293 */ 294 public RuleSet( 295 String id, String loaderId, String sourceText, Integer backendNodeId, String url, 296 String requestId, String errorType, String errorMessage 297 ) 298 { 299 // Exception-Check(s) to ensure that if any parameters which are not declared as 300 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 301 302 if (id == null) THROWS.throwNPE("id"); 303 if (loaderId == null) THROWS.throwNPE("loaderId"); 304 if (sourceText == null) THROWS.throwNPE("sourceText"); 305 306 // Exception-Check(s) to ensure that if any parameters which must adhere to a 307 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 308 309 THROWS.checkIAE("errorType", errorType, "Preload.RuleSetErrorType", Preload.RuleSetErrorType); 310 311 this.id = id; 312 this.loaderId = loaderId; 313 this.sourceText = sourceText; 314 this.backendNodeId = backendNodeId; 315 this.url = url; 316 this.requestId = requestId; 317 this.errorType = errorType; 318 this.errorMessage = errorMessage; 319 } 320 321 /** 322 * JSON Object Constructor 323 * @param jo A Json-Object having data about an instance of {@code 'RuleSet'}. 324 */ 325 public RuleSet (JsonObject jo) 326 { 327 this.id = ReadJSON.getString(jo, "id", false, true); 328 this.loaderId = ReadJSON.getString(jo, "loaderId", false, true); 329 this.sourceText = ReadJSON.getString(jo, "sourceText", false, true); 330 this.backendNodeId = ReadBoxedJSON.getInteger(jo, "backendNodeId", true); 331 this.url = ReadJSON.getString(jo, "url", true, false); 332 this.requestId = ReadJSON.getString(jo, "requestId", true, false); 333 this.errorType = ReadJSON.getString(jo, "errorType", true, false); 334 this.errorMessage = ReadJSON.getString(jo, "errorMessage", true, false); 335 } 336 337 338 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 339 public boolean equals(Object other) 340 { 341 if (this == other) return true; 342 if (other == null) return false; 343 if (other.getClass() != this.getClass()) return false; 344 345 RuleSet o = (RuleSet) other; 346 347 return 348 Objects.equals(this.id, o.id) 349 && Objects.equals(this.loaderId, o.loaderId) 350 && Objects.equals(this.sourceText, o.sourceText) 351 && Objects.equals(this.backendNodeId, o.backendNodeId) 352 && Objects.equals(this.url, o.url) 353 && Objects.equals(this.requestId, o.requestId) 354 && Objects.equals(this.errorType, o.errorType) 355 && Objects.equals(this.errorMessage, o.errorMessage); 356 } 357 358 /** Generates a Hash-Code for {@code 'this'} instance */ 359 public int hashCode() 360 { 361 return 362 Objects.hashCode(this.id) 363 + Objects.hashCode(this.loaderId) 364 + Objects.hashCode(this.sourceText) 365 + Objects.hashCode(this.backendNodeId) 366 + Objects.hashCode(this.url) 367 + Objects.hashCode(this.requestId) 368 + Objects.hashCode(this.errorType) 369 + Objects.hashCode(this.errorMessage); 370 } 371 } 372 373 /** 374 * A key that identifies a preloading attempt. 375 * 376 * The url used is the url specified by the trigger (i.e. the initial URL), and 377 * not the final url that is navigated to. For example, prerendering allows 378 * same-origin main frame navigations during the attempt, but the attempt is 379 * still keyed with the initial URL. 380 */ 381 public static class PreloadingAttemptKey 382 extends BaseType 383 implements java.io.Serializable 384 { 385 /** For Object Serialization. java.io.Serializable */ 386 protected static final long serialVersionUID = 1; 387 388 public boolean[] optionals() 389 { return new boolean[] { false, false, false, true, }; } 390 391 /** <CODE>[No Description Provided by Google]</CODE> */ 392 public final String loaderId; 393 394 /** <CODE>[No Description Provided by Google]</CODE> */ 395 public final String action; 396 397 /** <CODE>[No Description Provided by Google]</CODE> */ 398 public final String url; 399 400 /** 401 * <CODE>[No Description Provided by Google]</CODE> 402 * <BR /><B CLASS=Opt>OPTIONAL</B> 403 */ 404 public final String targetHint; 405 406 /** 407 * Constructor 408 * 409 * @param loaderId - 410 * 411 * @param action - 412 * 413 * @param url - 414 * 415 * @param targetHint - 416 * <BR /><B CLASS=Opt>OPTIONAL</B> 417 */ 418 public PreloadingAttemptKey 419 (String loaderId, String action, String url, String targetHint) 420 { 421 // Exception-Check(s) to ensure that if any parameters which are not declared as 422 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 423 424 if (loaderId == null) THROWS.throwNPE("loaderId"); 425 if (action == null) THROWS.throwNPE("action"); 426 if (url == null) THROWS.throwNPE("url"); 427 428 // Exception-Check(s) to ensure that if any parameters which must adhere to a 429 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 430 431 THROWS.checkIAE("action", action, "Preload.SpeculationAction", Preload.SpeculationAction); 432 THROWS.checkIAE("targetHint", targetHint, "Preload.SpeculationTargetHint", Preload.SpeculationTargetHint); 433 434 this.loaderId = loaderId; 435 this.action = action; 436 this.url = url; 437 this.targetHint = targetHint; 438 } 439 440 /** 441 * JSON Object Constructor 442 * @param jo A Json-Object having data about an instance of {@code 'PreloadingAttemptKey'}. 443 */ 444 public PreloadingAttemptKey (JsonObject jo) 445 { 446 this.loaderId = ReadJSON.getString(jo, "loaderId", false, true); 447 this.action = ReadJSON.getString(jo, "action", false, true); 448 this.url = ReadJSON.getString(jo, "url", false, true); 449 this.targetHint = ReadJSON.getString(jo, "targetHint", true, false); 450 } 451 452 453 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 454 public boolean equals(Object other) 455 { 456 if (this == other) return true; 457 if (other == null) return false; 458 if (other.getClass() != this.getClass()) return false; 459 460 PreloadingAttemptKey o = (PreloadingAttemptKey) other; 461 462 return 463 Objects.equals(this.loaderId, o.loaderId) 464 && Objects.equals(this.action, o.action) 465 && Objects.equals(this.url, o.url) 466 && Objects.equals(this.targetHint, o.targetHint); 467 } 468 469 /** Generates a Hash-Code for {@code 'this'} instance */ 470 public int hashCode() 471 { 472 return 473 Objects.hashCode(this.loaderId) 474 + Objects.hashCode(this.action) 475 + Objects.hashCode(this.url) 476 + Objects.hashCode(this.targetHint); 477 } 478 } 479 480 /** 481 * Lists sources for a preloading attempt, specifically the ids of rule sets 482 * that had a speculation rule that triggered the attempt, and the 483 * BackendNodeIds of {@code <a href>} or {@code <area href>} elements that triggered the 484 * attempt (in the case of attempts triggered by a document rule). It is 485 * possible for multiple rule sets and links to trigger a single attempt. 486 */ 487 public static class PreloadingAttemptSource 488 extends BaseType 489 implements java.io.Serializable 490 { 491 /** For Object Serialization. java.io.Serializable */ 492 protected static final long serialVersionUID = 1; 493 494 public boolean[] optionals() 495 { return new boolean[] { false, false, false, }; } 496 497 /** <CODE>[No Description Provided by Google]</CODE> */ 498 public final Preload.PreloadingAttemptKey key; 499 500 /** <CODE>[No Description Provided by Google]</CODE> */ 501 public final String[] ruleSetIds; 502 503 /** <CODE>[No Description Provided by Google]</CODE> */ 504 public final int[] nodeIds; 505 506 /** 507 * Constructor 508 * 509 * @param key - 510 * 511 * @param ruleSetIds - 512 * 513 * @param nodeIds - 514 */ 515 public PreloadingAttemptSource 516 (Preload.PreloadingAttemptKey key, String[] ruleSetIds, int[] nodeIds) 517 { 518 // Exception-Check(s) to ensure that if any parameters which are not declared as 519 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 520 521 if (key == null) THROWS.throwNPE("key"); 522 if (ruleSetIds == null) THROWS.throwNPE("ruleSetIds"); 523 if (nodeIds == null) THROWS.throwNPE("nodeIds"); 524 525 this.key = key; 526 this.ruleSetIds = ruleSetIds; 527 this.nodeIds = nodeIds; 528 } 529 530 /** 531 * JSON Object Constructor 532 * @param jo A Json-Object having data about an instance of {@code 'PreloadingAttemptSource'}. 533 */ 534 public PreloadingAttemptSource (JsonObject jo) 535 { 536 this.key = ReadJSON.getObject(jo, "key", Preload.PreloadingAttemptKey.class, false, true); 537 this.ruleSetIds = (jo.getJsonArray("ruleSetIds") == null) 538 ? null 539 : RJArrIntoStream.strArr(jo.getJsonArray("ruleSetIds"), null, 0).toArray(String[]::new); 540 541 this.nodeIds = (jo.getJsonArray("nodeIds") == null) 542 ? null 543 : RJArrIntoPrimArray.intArr(jo.getJsonArray("nodeIds"), -1, 0, null); 544 545 } 546 547 548 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 549 public boolean equals(Object other) 550 { 551 if (this == other) return true; 552 if (other == null) return false; 553 if (other.getClass() != this.getClass()) return false; 554 555 PreloadingAttemptSource o = (PreloadingAttemptSource) other; 556 557 return 558 Objects.equals(this.key, o.key) 559 && Arrays.deepEquals(this.ruleSetIds, o.ruleSetIds) 560 && Arrays.equals(this.nodeIds, o.nodeIds); 561 } 562 563 /** Generates a Hash-Code for {@code 'this'} instance */ 564 public int hashCode() 565 { 566 return 567 this.key.hashCode() 568 + Arrays.deepHashCode(this.ruleSetIds) 569 + Arrays.hashCode(this.nodeIds); 570 } 571 } 572 573 /** Information of headers to be displayed when the header mismatch occurred. */ 574 public static class PrerenderMismatchedHeaders 575 extends BaseType 576 implements java.io.Serializable 577 { 578 /** For Object Serialization. java.io.Serializable */ 579 protected static final long serialVersionUID = 1; 580 581 public boolean[] optionals() 582 { return new boolean[] { false, true, true, }; } 583 584 /** <CODE>[No Description Provided by Google]</CODE> */ 585 public final String headerName; 586 587 /** 588 * <CODE>[No Description Provided by Google]</CODE> 589 * <BR /><B CLASS=Opt>OPTIONAL</B> 590 */ 591 public final String initialValue; 592 593 /** 594 * <CODE>[No Description Provided by Google]</CODE> 595 * <BR /><B CLASS=Opt>OPTIONAL</B> 596 */ 597 public final String activationValue; 598 599 /** 600 * Constructor 601 * 602 * @param headerName - 603 * 604 * @param initialValue - 605 * <BR /><B CLASS=Opt>OPTIONAL</B> 606 * 607 * @param activationValue - 608 * <BR /><B CLASS=Opt>OPTIONAL</B> 609 */ 610 public PrerenderMismatchedHeaders 611 (String headerName, String initialValue, String activationValue) 612 { 613 // Exception-Check(s) to ensure that if any parameters which are not declared as 614 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 615 616 if (headerName == null) THROWS.throwNPE("headerName"); 617 618 this.headerName = headerName; 619 this.initialValue = initialValue; 620 this.activationValue = activationValue; 621 } 622 623 /** 624 * JSON Object Constructor 625 * @param jo A Json-Object having data about an instance of {@code 'PrerenderMismatchedHeaders'}. 626 */ 627 public PrerenderMismatchedHeaders (JsonObject jo) 628 { 629 this.headerName = ReadJSON.getString(jo, "headerName", false, true); 630 this.initialValue = ReadJSON.getString(jo, "initialValue", true, false); 631 this.activationValue = ReadJSON.getString(jo, "activationValue", true, false); 632 } 633 634 635 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 636 public boolean equals(Object other) 637 { 638 if (this == other) return true; 639 if (other == null) return false; 640 if (other.getClass() != this.getClass()) return false; 641 642 PrerenderMismatchedHeaders o = (PrerenderMismatchedHeaders) other; 643 644 return 645 Objects.equals(this.headerName, o.headerName) 646 && Objects.equals(this.initialValue, o.initialValue) 647 && Objects.equals(this.activationValue, o.activationValue); 648 } 649 650 /** Generates a Hash-Code for {@code 'this'} instance */ 651 public int hashCode() 652 { 653 return 654 Objects.hashCode(this.headerName) 655 + Objects.hashCode(this.initialValue) 656 + Objects.hashCode(this.activationValue); 657 } 658 } 659 660 /** Upsert. Currently, it is only emitted when a rule set added. */ 661 public static class ruleSetUpdated 662 extends BrowserEvent 663 implements java.io.Serializable 664 { 665 /** For Object Serialization. java.io.Serializable */ 666 protected static final long serialVersionUID = 1; 667 668 public boolean[] optionals() 669 { return new boolean[] { false, }; } 670 671 /** <CODE>[No Description Provided by Google]</CODE> */ 672 public final Preload.RuleSet ruleSet; 673 674 /** 675 * Constructor 676 * 677 * @param ruleSet - 678 */ 679 public ruleSetUpdated(Preload.RuleSet ruleSet) 680 { 681 super("Preload", "ruleSetUpdated", 1); 682 683 // Exception-Check(s) to ensure that if any parameters which are not declared as 684 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 685 686 if (ruleSet == null) THROWS.throwNPE("ruleSet"); 687 688 this.ruleSet = ruleSet; 689 } 690 691 /** 692 * JSON Object Constructor 693 * @param jo A Json-Object having data about an instance of {@code 'ruleSetUpdated'}. 694 */ 695 public ruleSetUpdated (JsonObject jo) 696 { 697 super("Preload", "ruleSetUpdated", 1); 698 699 this.ruleSet = ReadJSON.getObject(jo, "ruleSet", Preload.RuleSet.class, false, true); 700 } 701 702 703 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 704 public boolean equals(Object other) 705 { 706 if (this == other) return true; 707 if (other == null) return false; 708 if (other.getClass() != this.getClass()) return false; 709 710 ruleSetUpdated o = (ruleSetUpdated) other; 711 712 return 713 Objects.equals(this.ruleSet, o.ruleSet); 714 } 715 716 /** Generates a Hash-Code for {@code 'this'} instance */ 717 public int hashCode() 718 { 719 return 720 this.ruleSet.hashCode(); 721 } 722 } 723 724 /** <CODE>[No Description Provided by Google]</CODE> */ 725 public static class ruleSetRemoved 726 extends BrowserEvent 727 implements java.io.Serializable 728 { 729 /** For Object Serialization. java.io.Serializable */ 730 protected static final long serialVersionUID = 1; 731 732 public boolean[] optionals() 733 { return new boolean[] { false, }; } 734 735 /** <CODE>[No Description Provided by Google]</CODE> */ 736 public final String id; 737 738 /** 739 * Constructor 740 * 741 * @param id - 742 */ 743 public ruleSetRemoved(String id) 744 { 745 super("Preload", "ruleSetRemoved", 1); 746 747 // Exception-Check(s) to ensure that if any parameters which are not declared as 748 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 749 750 if (id == null) THROWS.throwNPE("id"); 751 752 this.id = id; 753 } 754 755 /** 756 * JSON Object Constructor 757 * @param jo A Json-Object having data about an instance of {@code 'ruleSetRemoved'}. 758 */ 759 public ruleSetRemoved (JsonObject jo) 760 { 761 super("Preload", "ruleSetRemoved", 1); 762 763 this.id = ReadJSON.getString(jo, "id", false, true); 764 } 765 766 767 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 768 public boolean equals(Object other) 769 { 770 if (this == other) return true; 771 if (other == null) return false; 772 if (other.getClass() != this.getClass()) return false; 773 774 ruleSetRemoved o = (ruleSetRemoved) other; 775 776 return 777 Objects.equals(this.id, o.id); 778 } 779 780 /** Generates a Hash-Code for {@code 'this'} instance */ 781 public int hashCode() 782 { 783 return 784 Objects.hashCode(this.id); 785 } 786 } 787 788 /** Fired when a preload enabled state is updated. */ 789 public static class preloadEnabledStateUpdated 790 extends BrowserEvent 791 implements java.io.Serializable 792 { 793 /** For Object Serialization. java.io.Serializable */ 794 protected static final long serialVersionUID = 1; 795 796 public boolean[] optionals() 797 { return new boolean[] { false, false, false, false, false, }; } 798 799 /** <CODE>[No Description Provided by Google]</CODE> */ 800 public final boolean disabledByPreference; 801 802 /** <CODE>[No Description Provided by Google]</CODE> */ 803 public final boolean disabledByDataSaver; 804 805 /** <CODE>[No Description Provided by Google]</CODE> */ 806 public final boolean disabledByBatterySaver; 807 808 /** <CODE>[No Description Provided by Google]</CODE> */ 809 public final boolean disabledByHoldbackPrefetchSpeculationRules; 810 811 /** <CODE>[No Description Provided by Google]</CODE> */ 812 public final boolean disabledByHoldbackPrerenderSpeculationRules; 813 814 /** 815 * Constructor 816 * 817 * @param disabledByPreference - 818 * 819 * @param disabledByDataSaver - 820 * 821 * @param disabledByBatterySaver - 822 * 823 * @param disabledByHoldbackPrefetchSpeculationRules - 824 * 825 * @param disabledByHoldbackPrerenderSpeculationRules - 826 */ 827 public preloadEnabledStateUpdated( 828 boolean disabledByPreference, boolean disabledByDataSaver, 829 boolean disabledByBatterySaver, boolean disabledByHoldbackPrefetchSpeculationRules, 830 boolean disabledByHoldbackPrerenderSpeculationRules 831 ) 832 { 833 super("Preload", "preloadEnabledStateUpdated", 5); 834 835 this.disabledByPreference = disabledByPreference; 836 this.disabledByDataSaver = disabledByDataSaver; 837 this.disabledByBatterySaver = disabledByBatterySaver; 838 this.disabledByHoldbackPrefetchSpeculationRules = disabledByHoldbackPrefetchSpeculationRules; 839 this.disabledByHoldbackPrerenderSpeculationRules = disabledByHoldbackPrerenderSpeculationRules; 840 } 841 842 /** 843 * JSON Object Constructor 844 * @param jo A Json-Object having data about an instance of {@code 'preloadEnabledStateUpdated'}. 845 */ 846 public preloadEnabledStateUpdated (JsonObject jo) 847 { 848 super("Preload", "preloadEnabledStateUpdated", 5); 849 850 this.disabledByPreference = ReadPrimJSON.getBoolean(jo, "disabledByPreference"); 851 this.disabledByDataSaver = ReadPrimJSON.getBoolean(jo, "disabledByDataSaver"); 852 this.disabledByBatterySaver = ReadPrimJSON.getBoolean(jo, "disabledByBatterySaver"); 853 this.disabledByHoldbackPrefetchSpeculationRules = ReadPrimJSON.getBoolean(jo, "disabledByHoldbackPrefetchSpeculationRules"); 854 this.disabledByHoldbackPrerenderSpeculationRules = ReadPrimJSON.getBoolean(jo, "disabledByHoldbackPrerenderSpeculationRules"); 855 } 856 857 858 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 859 public boolean equals(Object other) 860 { 861 if (this == other) return true; 862 if (other == null) return false; 863 if (other.getClass() != this.getClass()) return false; 864 865 preloadEnabledStateUpdated o = (preloadEnabledStateUpdated) other; 866 867 return 868 (this.disabledByPreference == o.disabledByPreference) 869 && (this.disabledByDataSaver == o.disabledByDataSaver) 870 && (this.disabledByBatterySaver == o.disabledByBatterySaver) 871 && (this.disabledByHoldbackPrefetchSpeculationRules == o.disabledByHoldbackPrefetchSpeculationRules) 872 && (this.disabledByHoldbackPrerenderSpeculationRules == o.disabledByHoldbackPrerenderSpeculationRules); 873 } 874 875 /** Generates a Hash-Code for {@code 'this'} instance */ 876 public int hashCode() 877 { 878 return 879 (this.disabledByPreference ? 1 : 0) 880 + (this.disabledByDataSaver ? 1 : 0) 881 + (this.disabledByBatterySaver ? 1 : 0) 882 + (this.disabledByHoldbackPrefetchSpeculationRules ? 1 : 0) 883 + (this.disabledByHoldbackPrerenderSpeculationRules ? 1 : 0); 884 } 885 } 886 887 /** Fired when a prefetch attempt is updated. */ 888 public static class prefetchStatusUpdated 889 extends BrowserEvent 890 implements java.io.Serializable 891 { 892 /** For Object Serialization. java.io.Serializable */ 893 protected static final long serialVersionUID = 1; 894 895 public boolean[] optionals() 896 { return new boolean[] { false, false, false, false, false, false, false, }; } 897 898 /** <CODE>[No Description Provided by Google]</CODE> */ 899 public final Preload.PreloadingAttemptKey key; 900 901 /** <CODE>[No Description Provided by Google]</CODE> */ 902 public final String pipelineId; 903 904 /** The frame id of the frame initiating prefetch. */ 905 public final String initiatingFrameId; 906 907 /** <CODE>[No Description Provided by Google]</CODE> */ 908 public final String prefetchUrl; 909 910 /** <CODE>[No Description Provided by Google]</CODE> */ 911 public final String status; 912 913 /** <CODE>[No Description Provided by Google]</CODE> */ 914 public final String prefetchStatus; 915 916 /** <CODE>[No Description Provided by Google]</CODE> */ 917 public final String requestId; 918 919 /** 920 * Constructor 921 * 922 * @param key - 923 * 924 * @param pipelineId - 925 * 926 * @param initiatingFrameId The frame id of the frame initiating prefetch. 927 * 928 * @param prefetchUrl - 929 * 930 * @param status - 931 * 932 * @param prefetchStatus - 933 * 934 * @param requestId - 935 */ 936 public prefetchStatusUpdated( 937 Preload.PreloadingAttemptKey key, String pipelineId, String initiatingFrameId, 938 String prefetchUrl, String status, String prefetchStatus, String requestId 939 ) 940 { 941 super("Preload", "prefetchStatusUpdated", 7); 942 943 // Exception-Check(s) to ensure that if any parameters which are not declared as 944 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 945 946 if (key == null) THROWS.throwNPE("key"); 947 if (pipelineId == null) THROWS.throwNPE("pipelineId"); 948 if (initiatingFrameId == null) THROWS.throwNPE("initiatingFrameId"); 949 if (prefetchUrl == null) THROWS.throwNPE("prefetchUrl"); 950 if (status == null) THROWS.throwNPE("status"); 951 if (prefetchStatus == null) THROWS.throwNPE("prefetchStatus"); 952 if (requestId == null) THROWS.throwNPE("requestId"); 953 954 // Exception-Check(s) to ensure that if any parameters which must adhere to a 955 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 956 957 THROWS.checkIAE("status", status, "Preload.PreloadingStatus", Preload.PreloadingStatus); 958 THROWS.checkIAE("prefetchStatus", prefetchStatus, "Preload.PrefetchStatus", Preload.PrefetchStatus); 959 960 this.key = key; 961 this.pipelineId = pipelineId; 962 this.initiatingFrameId = initiatingFrameId; 963 this.prefetchUrl = prefetchUrl; 964 this.status = status; 965 this.prefetchStatus = prefetchStatus; 966 this.requestId = requestId; 967 } 968 969 /** 970 * JSON Object Constructor 971 * @param jo A Json-Object having data about an instance of {@code 'prefetchStatusUpdated'}. 972 */ 973 public prefetchStatusUpdated (JsonObject jo) 974 { 975 super("Preload", "prefetchStatusUpdated", 7); 976 977 this.key = ReadJSON.getObject(jo, "key", Preload.PreloadingAttemptKey.class, false, true); 978 this.pipelineId = ReadJSON.getString(jo, "pipelineId", false, true); 979 this.initiatingFrameId = ReadJSON.getString(jo, "initiatingFrameId", false, true); 980 this.prefetchUrl = ReadJSON.getString(jo, "prefetchUrl", false, true); 981 this.status = ReadJSON.getString(jo, "status", false, true); 982 this.prefetchStatus = ReadJSON.getString(jo, "prefetchStatus", false, true); 983 this.requestId = ReadJSON.getString(jo, "requestId", false, true); 984 } 985 986 987 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 988 public boolean equals(Object other) 989 { 990 if (this == other) return true; 991 if (other == null) return false; 992 if (other.getClass() != this.getClass()) return false; 993 994 prefetchStatusUpdated o = (prefetchStatusUpdated) other; 995 996 return 997 Objects.equals(this.key, o.key) 998 && Objects.equals(this.pipelineId, o.pipelineId) 999 && Objects.equals(this.initiatingFrameId, o.initiatingFrameId) 1000 && Objects.equals(this.prefetchUrl, o.prefetchUrl) 1001 && Objects.equals(this.status, o.status) 1002 && Objects.equals(this.prefetchStatus, o.prefetchStatus) 1003 && Objects.equals(this.requestId, o.requestId); 1004 } 1005 1006 /** Generates a Hash-Code for {@code 'this'} instance */ 1007 public int hashCode() 1008 { 1009 return 1010 this.key.hashCode() 1011 + Objects.hashCode(this.pipelineId) 1012 + Objects.hashCode(this.initiatingFrameId) 1013 + Objects.hashCode(this.prefetchUrl) 1014 + Objects.hashCode(this.status) 1015 + Objects.hashCode(this.prefetchStatus) 1016 + Objects.hashCode(this.requestId); 1017 } 1018 } 1019 1020 /** Fired when a prerender attempt is updated. */ 1021 public static class prerenderStatusUpdated 1022 extends BrowserEvent 1023 implements java.io.Serializable 1024 { 1025 /** For Object Serialization. java.io.Serializable */ 1026 protected static final long serialVersionUID = 1; 1027 1028 public boolean[] optionals() 1029 { return new boolean[] { false, false, false, true, true, true, }; } 1030 1031 /** <CODE>[No Description Provided by Google]</CODE> */ 1032 public final Preload.PreloadingAttemptKey key; 1033 1034 /** <CODE>[No Description Provided by Google]</CODE> */ 1035 public final String pipelineId; 1036 1037 /** <CODE>[No Description Provided by Google]</CODE> */ 1038 public final String status; 1039 1040 /** 1041 * <CODE>[No Description Provided by Google]</CODE> 1042 * <BR /><B CLASS=Opt>OPTIONAL</B> 1043 */ 1044 public final String prerenderStatus; 1045 1046 /** 1047 * This is used to give users more information about the name of Mojo interface 1048 * that is incompatible with prerender and has caused the cancellation of the attempt. 1049 * <BR /><B CLASS=Opt>OPTIONAL</B> 1050 */ 1051 public final String disallowedMojoInterface; 1052 1053 /** 1054 * <CODE>[No Description Provided by Google]</CODE> 1055 * <BR /><B CLASS=Opt>OPTIONAL</B> 1056 */ 1057 public final Preload.PrerenderMismatchedHeaders[] mismatchedHeaders; 1058 1059 /** 1060 * Constructor 1061 * 1062 * @param key - 1063 * 1064 * @param pipelineId - 1065 * 1066 * @param status - 1067 * 1068 * @param prerenderStatus - 1069 * <BR /><B CLASS=Opt>OPTIONAL</B> 1070 * 1071 * @param disallowedMojoInterface 1072 * This is used to give users more information about the name of Mojo interface 1073 * that is incompatible with prerender and has caused the cancellation of the attempt. 1074 * <BR /><B CLASS=Opt>OPTIONAL</B> 1075 * 1076 * @param mismatchedHeaders - 1077 * <BR /><B CLASS=Opt>OPTIONAL</B> 1078 */ 1079 public prerenderStatusUpdated( 1080 Preload.PreloadingAttemptKey key, String pipelineId, String status, 1081 String prerenderStatus, String disallowedMojoInterface, 1082 Preload.PrerenderMismatchedHeaders[] mismatchedHeaders 1083 ) 1084 { 1085 super("Preload", "prerenderStatusUpdated", 6); 1086 1087 // Exception-Check(s) to ensure that if any parameters which are not declared as 1088 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1089 1090 if (key == null) THROWS.throwNPE("key"); 1091 if (pipelineId == null) THROWS.throwNPE("pipelineId"); 1092 if (status == null) THROWS.throwNPE("status"); 1093 1094 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1095 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1096 1097 THROWS.checkIAE("status", status, "Preload.PreloadingStatus", Preload.PreloadingStatus); 1098 THROWS.checkIAE("prerenderStatus", prerenderStatus, "Preload.PrerenderFinalStatus", Preload.PrerenderFinalStatus); 1099 1100 this.key = key; 1101 this.pipelineId = pipelineId; 1102 this.status = status; 1103 this.prerenderStatus = prerenderStatus; 1104 this.disallowedMojoInterface = disallowedMojoInterface; 1105 this.mismatchedHeaders = mismatchedHeaders; 1106 } 1107 1108 /** 1109 * JSON Object Constructor 1110 * @param jo A Json-Object having data about an instance of {@code 'prerenderStatusUpdated'}. 1111 */ 1112 public prerenderStatusUpdated (JsonObject jo) 1113 { 1114 super("Preload", "prerenderStatusUpdated", 6); 1115 1116 this.key = ReadJSON.getObject(jo, "key", Preload.PreloadingAttemptKey.class, false, true); 1117 this.pipelineId = ReadJSON.getString(jo, "pipelineId", false, true); 1118 this.status = ReadJSON.getString(jo, "status", false, true); 1119 this.prerenderStatus = ReadJSON.getString(jo, "prerenderStatus", true, false); 1120 this.disallowedMojoInterface = ReadJSON.getString(jo, "disallowedMojoInterface", true, false); 1121 this.mismatchedHeaders = (jo.getJsonArray("mismatchedHeaders") == null) 1122 ? null 1123 : RJArrIntoStream.objArr(jo.getJsonArray("mismatchedHeaders"), null, 0, Preload.PrerenderMismatchedHeaders.class).toArray(Preload.PrerenderMismatchedHeaders[]::new); 1124 1125 } 1126 1127 1128 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1129 public boolean equals(Object other) 1130 { 1131 if (this == other) return true; 1132 if (other == null) return false; 1133 if (other.getClass() != this.getClass()) return false; 1134 1135 prerenderStatusUpdated o = (prerenderStatusUpdated) other; 1136 1137 return 1138 Objects.equals(this.key, o.key) 1139 && Objects.equals(this.pipelineId, o.pipelineId) 1140 && Objects.equals(this.status, o.status) 1141 && Objects.equals(this.prerenderStatus, o.prerenderStatus) 1142 && Objects.equals(this.disallowedMojoInterface, o.disallowedMojoInterface) 1143 && Arrays.deepEquals(this.mismatchedHeaders, o.mismatchedHeaders); 1144 } 1145 1146 /** Generates a Hash-Code for {@code 'this'} instance */ 1147 public int hashCode() 1148 { 1149 return 1150 this.key.hashCode() 1151 + Objects.hashCode(this.pipelineId) 1152 + Objects.hashCode(this.status) 1153 + Objects.hashCode(this.prerenderStatus) 1154 + Objects.hashCode(this.disallowedMojoInterface) 1155 + Arrays.deepHashCode(this.mismatchedHeaders); 1156 } 1157 } 1158 1159 /** Send a list of sources for all preloading attempts in a document. */ 1160 public static class preloadingAttemptSourcesUpdated 1161 extends BrowserEvent 1162 implements java.io.Serializable 1163 { 1164 /** For Object Serialization. java.io.Serializable */ 1165 protected static final long serialVersionUID = 1; 1166 1167 public boolean[] optionals() 1168 { return new boolean[] { false, false, }; } 1169 1170 /** <CODE>[No Description Provided by Google]</CODE> */ 1171 public final String loaderId; 1172 1173 /** <CODE>[No Description Provided by Google]</CODE> */ 1174 public final Preload.PreloadingAttemptSource[] preloadingAttemptSources; 1175 1176 /** 1177 * Constructor 1178 * 1179 * @param loaderId - 1180 * 1181 * @param preloadingAttemptSources - 1182 */ 1183 public preloadingAttemptSourcesUpdated 1184 (String loaderId, Preload.PreloadingAttemptSource[] preloadingAttemptSources) 1185 { 1186 super("Preload", "preloadingAttemptSourcesUpdated", 2); 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 (loaderId == null) THROWS.throwNPE("loaderId"); 1192 if (preloadingAttemptSources == null) THROWS.throwNPE("preloadingAttemptSources"); 1193 1194 this.loaderId = loaderId; 1195 this.preloadingAttemptSources = preloadingAttemptSources; 1196 } 1197 1198 /** 1199 * JSON Object Constructor 1200 * @param jo A Json-Object having data about an instance of {@code 'preloadingAttemptSourcesUpdated'}. 1201 */ 1202 public preloadingAttemptSourcesUpdated (JsonObject jo) 1203 { 1204 super("Preload", "preloadingAttemptSourcesUpdated", 2); 1205 1206 this.loaderId = ReadJSON.getString(jo, "loaderId", false, true); 1207 this.preloadingAttemptSources = (jo.getJsonArray("preloadingAttemptSources") == null) 1208 ? null 1209 : RJArrIntoStream.objArr(jo.getJsonArray("preloadingAttemptSources"), null, 0, Preload.PreloadingAttemptSource.class).toArray(Preload.PreloadingAttemptSource[]::new); 1210 1211 } 1212 1213 1214 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1215 public boolean equals(Object other) 1216 { 1217 if (this == other) return true; 1218 if (other == null) return false; 1219 if (other.getClass() != this.getClass()) return false; 1220 1221 preloadingAttemptSourcesUpdated o = (preloadingAttemptSourcesUpdated) other; 1222 1223 return 1224 Objects.equals(this.loaderId, o.loaderId) 1225 && Arrays.deepEquals(this.preloadingAttemptSources, o.preloadingAttemptSources); 1226 } 1227 1228 /** Generates a Hash-Code for {@code 'this'} instance */ 1229 public int hashCode() 1230 { 1231 return 1232 Objects.hashCode(this.loaderId) 1233 + Arrays.deepHashCode(this.preloadingAttemptSources); 1234 } 1235 } 1236 1237 1238 // Counter for keeping the WebSocket Request ID's distinct. 1239 private static int counter = 1; 1240 1241 /** 1242 * <CODE>[No Description Provided by Google]</CODE> 1243 * 1244 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1245 * {@link Ret0}></CODE> 1246 * 1247 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1248 * browser receives the invocation-request. 1249 * 1250 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1251 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1252 * {@code >} to ensure the Browser Function has run to completion. 1253 */ 1254 public static Script<String, JsonObject, Ret0> enable() 1255 { 1256 final int webSocketID = 50000000 + counter++; 1257 final boolean[] optionals = new boolean[0]; 1258 1259 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1260 String requestJSON = WriteJSON.get( 1261 parameterTypes.get("enable"), 1262 parameterNames.get("enable"), 1263 optionals, webSocketID, 1264 "Preload.enable" 1265 ); 1266 1267 // This Remote Command does not have a Return-Value. 1268 return new Script<> 1269 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 1270 } 1271 1272 /** 1273 * <CODE>[No Description Provided by Google]</CODE> 1274 * 1275 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1276 * {@link Ret0}></CODE> 1277 * 1278 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1279 * browser receives the invocation-request. 1280 * 1281 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1282 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1283 * {@code >} to ensure the Browser Function has run to completion. 1284 */ 1285 public static Script<String, JsonObject, Ret0> disable() 1286 { 1287 final int webSocketID = 50001000 + counter++; 1288 final boolean[] optionals = new boolean[0]; 1289 1290 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1291 String requestJSON = WriteJSON.get( 1292 parameterTypes.get("disable"), 1293 parameterNames.get("disable"), 1294 optionals, webSocketID, 1295 "Preload.disable" 1296 ); 1297 1298 // This Remote Command does not have a Return-Value. 1299 return new Script<> 1300 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 1301 } 1302 1303}