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>Actions and events related to the inspected page belong to the page domain.</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 Page 029{ 030 // ******************************************************************************************** 031 // ******************************************************************************************** 032 // Class Header Stuff 033 // ******************************************************************************************** 034 // ******************************************************************************************** 035 036 037 // No Pubic Constructors 038 private Page () { } 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 : Page.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>(1); 077 parameterNames.put("addScriptToEvaluateOnLoad", v); 078 Collections.addAll(v, new String[] 079 { "scriptSource", }); 080 081 v = new Vector<String>(3); 082 parameterNames.put("addScriptToEvaluateOnNewDocument", v); 083 Collections.addAll(v, new String[] 084 { "source", "worldName", "includeCommandLineAPI", }); 085 086 parameterNames.put("bringToFront", EMPTY_VEC_STR); 087 088 v = new Vector<String>(5); 089 parameterNames.put("captureScreenshot", v); 090 Collections.addAll(v, new String[] 091 { "format", "quality", "clip", "fromSurface", "captureBeyondViewport", }); 092 093 v = new Vector<String>(1); 094 parameterNames.put("captureSnapshot", v); 095 Collections.addAll(v, new String[] 096 { "format", }); 097 098 parameterNames.put("clearDeviceMetricsOverride", EMPTY_VEC_STR); 099 100 parameterNames.put("clearDeviceOrientationOverride", EMPTY_VEC_STR); 101 102 parameterNames.put("clearGeolocationOverride", EMPTY_VEC_STR); 103 104 v = new Vector<String>(3); 105 parameterNames.put("createIsolatedWorld", v); 106 Collections.addAll(v, new String[] 107 { "frameId", "worldName", "grantUniveralAccess", }); 108 109 v = new Vector<String>(2); 110 parameterNames.put("deleteCookie", v); 111 Collections.addAll(v, new String[] 112 { "cookieName", "url", }); 113 114 parameterNames.put("disable", EMPTY_VEC_STR); 115 116 parameterNames.put("enable", EMPTY_VEC_STR); 117 118 parameterNames.put("getAppManifest", EMPTY_VEC_STR); 119 120 parameterNames.put("getInstallabilityErrors", EMPTY_VEC_STR); 121 122 parameterNames.put("getManifestIcons", EMPTY_VEC_STR); 123 124 parameterNames.put("getAppId", EMPTY_VEC_STR); 125 126 parameterNames.put("getCookies", EMPTY_VEC_STR); 127 128 parameterNames.put("getFrameTree", EMPTY_VEC_STR); 129 130 parameterNames.put("getLayoutMetrics", EMPTY_VEC_STR); 131 132 parameterNames.put("getNavigationHistory", EMPTY_VEC_STR); 133 134 parameterNames.put("resetNavigationHistory", EMPTY_VEC_STR); 135 136 v = new Vector<String>(2); 137 parameterNames.put("getResourceContent", v); 138 Collections.addAll(v, new String[] 139 { "frameId", "url", }); 140 141 parameterNames.put("getResourceTree", EMPTY_VEC_STR); 142 143 v = new Vector<String>(2); 144 parameterNames.put("handleJavaScriptDialog", v); 145 Collections.addAll(v, new String[] 146 { "accept", "promptText", }); 147 148 v = new Vector<String>(5); 149 parameterNames.put("navigate", v); 150 Collections.addAll(v, new String[] 151 { "url", "referrer", "transitionType", "frameId", "referrerPolicy", }); 152 153 v = new Vector<String>(1); 154 parameterNames.put("navigateToHistoryEntry", v); 155 Collections.addAll(v, new String[] 156 { "entryId", }); 157 158 v = new Vector<String>(16); 159 parameterNames.put("printToPDF", v); 160 Collections.addAll(v, new String[] 161 { "landscape", "displayHeaderFooter", "printBackground", "scale", "paperWidth", "paperHeight", "marginTop", "marginBottom", "marginLeft", "marginRight", "pageRanges", "ignoreInvalidPageRanges", "headerTemplate", "footerTemplate", "preferCSSPageSize", "transferMode", }); 162 163 v = new Vector<String>(2); 164 parameterNames.put("reload", v); 165 Collections.addAll(v, new String[] 166 { "ignoreCache", "scriptToEvaluateOnLoad", }); 167 168 v = new Vector<String>(1); 169 parameterNames.put("removeScriptToEvaluateOnLoad", v); 170 Collections.addAll(v, new String[] 171 { "identifier", }); 172 173 v = new Vector<String>(1); 174 parameterNames.put("removeScriptToEvaluateOnNewDocument", v); 175 Collections.addAll(v, new String[] 176 { "identifier", }); 177 178 v = new Vector<String>(1); 179 parameterNames.put("screencastFrameAck", v); 180 Collections.addAll(v, new String[] 181 { "sessionId", }); 182 183 v = new Vector<String>(5); 184 parameterNames.put("searchInResource", v); 185 Collections.addAll(v, new String[] 186 { "frameId", "url", "query", "caseSensitive", "isRegex", }); 187 188 v = new Vector<String>(1); 189 parameterNames.put("setAdBlockingEnabled", v); 190 Collections.addAll(v, new String[] 191 { "enabled", }); 192 193 v = new Vector<String>(1); 194 parameterNames.put("setBypassCSP", v); 195 Collections.addAll(v, new String[] 196 { "enabled", }); 197 198 v = new Vector<String>(1); 199 parameterNames.put("getPermissionsPolicyState", v); 200 Collections.addAll(v, new String[] 201 { "frameId", }); 202 203 v = new Vector<String>(1); 204 parameterNames.put("getOriginTrials", v); 205 Collections.addAll(v, new String[] 206 { "frameId", }); 207 208 v = new Vector<String>(12); 209 parameterNames.put("setDeviceMetricsOverride", v); 210 Collections.addAll(v, new String[] 211 { "width", "height", "deviceScaleFactor", "mobile", "scale", "screenWidth", "screenHeight", "positionX", "positionY", "dontSetVisibleSize", "screenOrientation", "viewport", }); 212 213 v = new Vector<String>(3); 214 parameterNames.put("setDeviceOrientationOverride", v); 215 Collections.addAll(v, new String[] 216 { "alpha", "beta", "gamma", }); 217 218 v = new Vector<String>(1); 219 parameterNames.put("setFontFamilies", v); 220 Collections.addAll(v, new String[] 221 { "fontFamilies", }); 222 223 v = new Vector<String>(1); 224 parameterNames.put("setFontSizes", v); 225 Collections.addAll(v, new String[] 226 { "fontSizes", }); 227 228 v = new Vector<String>(2); 229 parameterNames.put("setDocumentContent", v); 230 Collections.addAll(v, new String[] 231 { "frameId", "html", }); 232 233 v = new Vector<String>(2); 234 parameterNames.put("setDownloadBehavior", v); 235 Collections.addAll(v, new String[] 236 { "behavior", "downloadPath", }); 237 238 v = new Vector<String>(3); 239 parameterNames.put("setGeolocationOverride", v); 240 Collections.addAll(v, new String[] 241 { "latitude", "longitude", "accuracy", }); 242 243 v = new Vector<String>(1); 244 parameterNames.put("setLifecycleEventsEnabled", v); 245 Collections.addAll(v, new String[] 246 { "enabled", }); 247 248 v = new Vector<String>(2); 249 parameterNames.put("setTouchEmulationEnabled", v); 250 Collections.addAll(v, new String[] 251 { "enabled", "configuration", }); 252 253 v = new Vector<String>(5); 254 parameterNames.put("startScreencast", v); 255 Collections.addAll(v, new String[] 256 { "format", "quality", "maxWidth", "maxHeight", "everyNthFrame", }); 257 258 parameterNames.put("stopLoading", EMPTY_VEC_STR); 259 260 parameterNames.put("crash", EMPTY_VEC_STR); 261 262 parameterNames.put("close", EMPTY_VEC_STR); 263 264 v = new Vector<String>(1); 265 parameterNames.put("setWebLifecycleState", v); 266 Collections.addAll(v, new String[] 267 { "state", }); 268 269 parameterNames.put("stopScreencast", EMPTY_VEC_STR); 270 271 v = new Vector<String>(1); 272 parameterNames.put("produceCompilationCache", v); 273 Collections.addAll(v, new String[] 274 { "scripts", }); 275 276 v = new Vector<String>(2); 277 parameterNames.put("addCompilationCache", v); 278 Collections.addAll(v, new String[] 279 { "url", "data", }); 280 281 parameterNames.put("clearCompilationCache", EMPTY_VEC_STR); 282 283 v = new Vector<String>(2); 284 parameterNames.put("generateTestReport", v); 285 Collections.addAll(v, new String[] 286 { "message", "group", }); 287 288 parameterNames.put("waitForDebugger", EMPTY_VEC_STR); 289 290 v = new Vector<String>(1); 291 parameterNames.put("setInterceptFileChooserDialog", v); 292 Collections.addAll(v, new String[] 293 { "enabled", }); 294 } 295 296 297 // ******************************************************************************************** 298 // ******************************************************************************************** 299 // Types - Static Inner Classes 300 // ******************************************************************************************** 301 // ******************************************************************************************** 302 303 // public static class FrameId => String 304 305 // public static class ScriptIdentifier => String 306 307 /** 308 * Indicates whether a frame has been identified as an ad. 309 * <BR /> 310 * <BR /><B>EXPERIMENTAL</B> 311 */ 312 public static final String[] AdFrameType = 313 { "none", "child", "root", }; 314 315 /** 316 * <CODE>[No Description Provided by Google]</CODE> 317 * <BR /> 318 * <BR /><B>EXPERIMENTAL</B> 319 */ 320 public static final String[] AdFrameExplanation = 321 { "ParentIsAd", "CreatedByAdScript", "MatchedBlockingRule", }; 322 323 /** 324 * Indicates whether the frame is a secure context and why it is the case. 325 * <BR /> 326 * <BR /><B>EXPERIMENTAL</B> 327 */ 328 public static final String[] SecureContextType = 329 { "Secure", "SecureLocalhost", "InsecureScheme", "InsecureAncestor", }; 330 331 /** 332 * Indicates whether the frame is cross-origin isolated and why it is the case. 333 * <BR /> 334 * <BR /><B>EXPERIMENTAL</B> 335 */ 336 public static final String[] CrossOriginIsolatedContextType = 337 { "Isolated", "NotIsolated", "NotIsolatedFeatureDisabled", }; 338 339 /** 340 * <CODE>[No Description Provided by Google]</CODE> 341 * <BR /> 342 * <BR /><B>EXPERIMENTAL</B> 343 */ 344 public static final String[] GatedAPIFeatures = 345 { 346 "SharedArrayBuffers", "SharedArrayBuffersTransferAllowed", "PerformanceMeasureMemory", 347 "PerformanceProfile", 348 }; 349 350 /** 351 * All Permissions Policy features. This enum should match the one defined 352 * in third_party/blink/renderer/core/permissions_policy/permissions_policy_features.json5. 353 * <BR /> 354 * <BR /><B>EXPERIMENTAL</B> 355 */ 356 public static final String[] PermissionsPolicyFeature = 357 { 358 "accelerometer", "ambient-light-sensor", "attribution-reporting", "autoplay", "camera", 359 "ch-dpr", "ch-device-memory", "ch-downlink", "ch-ect", "ch-prefers-color-scheme", "ch-rtt", 360 "ch-ua", "ch-ua-arch", "ch-ua-bitness", "ch-ua-platform", "ch-ua-model", "ch-ua-mobile", 361 "ch-ua-full-version", "ch-ua-platform-version", "ch-ua-reduced", "ch-viewport-height", 362 "ch-viewport-width", "ch-width", "clipboard-read", "clipboard-write", 363 "cross-origin-isolated", "direct-sockets", "display-capture", "document-domain", 364 "encrypted-media", "execution-while-out-of-viewport", "execution-while-not-rendered", 365 "focus-without-user-activation", "fullscreen", "frobulate", "gamepad", "geolocation", 366 "gyroscope", "hid", "idle-detection", "interest-cohort", "keyboard-map", "magnetometer", 367 "microphone", "midi", "otp-credentials", "payment", "picture-in-picture", 368 "publickey-credentials-get", "screen-wake-lock", "serial", "shared-autofill", 369 "storage-access-api", "sync-xhr", "trust-token-redemption", "usb", "vertical-scroll", 370 "web-share", "window-placement", "xr-spatial-tracking", 371 }; 372 373 /** 374 * Reason for a permissions policy feature to be disabled. 375 * <BR /> 376 * <BR /><B>EXPERIMENTAL</B> 377 */ 378 public static final String[] PermissionsPolicyBlockReason = 379 { "Header", "IframeAttribute", }; 380 381 /** 382 * Origin Trial(https://www.chromium.org/blink/origin-trials) support. 383 * Status for an Origin Trial token. 384 * <BR /> 385 * <BR /><B>EXPERIMENTAL</B> 386 */ 387 public static final String[] OriginTrialTokenStatus = 388 { 389 "Success", "NotSupported", "Insecure", "Expired", "WrongOrigin", "InvalidSignature", 390 "Malformed", "WrongVersion", "FeatureDisabled", "TokenDisabled", "FeatureDisabledForUser", 391 "UnknownTrial", 392 }; 393 394 /** 395 * Status for an Origin Trial. 396 * <BR /> 397 * <BR /><B>EXPERIMENTAL</B> 398 */ 399 public static final String[] OriginTrialStatus = 400 { "Enabled", "ValidTokenNotProvided", "OSNotSupported", "TrialNotAllowed", }; 401 402 /** 403 * <CODE>[No Description Provided by Google]</CODE> 404 * <BR /> 405 * <BR /><B>EXPERIMENTAL</B> 406 */ 407 public static final String[] OriginTrialUsageRestriction = 408 { "None", "Subset", }; 409 410 /** Transition type. */ 411 public static final String[] TransitionType = 412 { 413 "link", "typed", "address_bar", "auto_bookmark", "auto_subframe", "manual_subframe", 414 "generated", "auto_toplevel", "form_submit", "reload", "keyword", "keyword_generated", 415 "other", 416 }; 417 418 /** Javascript dialog type. */ 419 public static final String[] DialogType = 420 { "alert", "confirm", "prompt", "beforeunload", }; 421 422 /** 423 * <CODE>[No Description Provided by Google]</CODE> 424 * <BR /> 425 * <BR /><B>EXPERIMENTAL</B> 426 */ 427 public static final String[] ClientNavigationReason = 428 { 429 "formSubmissionGet", "formSubmissionPost", "httpHeaderRefresh", "scriptInitiated", 430 "metaTagRefresh", "pageBlockInterstitial", "reload", "anchorClick", 431 }; 432 433 /** 434 * <CODE>[No Description Provided by Google]</CODE> 435 * <BR /> 436 * <BR /><B>EXPERIMENTAL</B> 437 */ 438 public static final String[] ClientNavigationDisposition = 439 { "currentTab", "newTab", "newWindow", "download", }; 440 441 /** 442 * The referring-policy used for the navigation. 443 * <BR /> 444 * <BR /><B>EXPERIMENTAL</B> 445 */ 446 public static final String[] ReferrerPolicy = 447 { 448 "noReferrer", "noReferrerWhenDowngrade", "origin", "originWhenCrossOrigin", "sameOrigin", 449 "strictOrigin", "strictOriginWhenCrossOrigin", "unsafeUrl", 450 }; 451 452 /** 453 * The type of a frameNavigated event. 454 * <BR /> 455 * <BR /><B>EXPERIMENTAL</B> 456 */ 457 public static final String[] NavigationType = 458 { "Navigation", "BackForwardCacheRestore", }; 459 460 /** 461 * List of not restored reasons for back-forward cache. 462 * <BR /> 463 * <BR /><B>EXPERIMENTAL</B> 464 */ 465 public static final String[] BackForwardCacheNotRestoredReason = 466 { 467 "NotMainFrame", "BackForwardCacheDisabled", "RelatedActiveContentsExist", 468 "HTTPStatusNotOK", "SchemeNotHTTPOrHTTPS", "Loading", "WasGrantedMediaAccess", 469 "DisableForRenderFrameHostCalled", "DomainNotAllowed", "HTTPMethodNotGET", 470 "SubframeIsNavigating", "Timeout", "CacheLimit", "JavaScriptExecution", 471 "RendererProcessKilled", "RendererProcessCrashed", "GrantedMediaStreamAccess", 472 "SchedulerTrackedFeatureUsed", "ConflictingBrowsingInstance", "CacheFlushed", 473 "ServiceWorkerVersionActivation", "SessionRestored", "ServiceWorkerPostMessage", 474 "EnteredBackForwardCacheBeforeServiceWorkerHostAdded", "RenderFrameHostReused_SameSite", 475 "RenderFrameHostReused_CrossSite", "ServiceWorkerClaim", "IgnoreEventAndEvict", 476 "HaveInnerContents", "TimeoutPuttingInCache", "BackForwardCacheDisabledByLowMemory", 477 "BackForwardCacheDisabledByCommandLine", "NetworkRequestDatapipeDrainedAsBytesConsumer", 478 "NetworkRequestRedirected", "NetworkRequestTimeout", "NetworkExceedsBufferLimit", 479 "NavigationCancelledWhileRestoring", "NotMostRecentNavigationEntry", 480 "BackForwardCacheDisabledForPrerender", "UserAgentOverrideDiffers", "ForegroundCacheLimit", 481 "BrowsingInstanceNotSwapped", "BackForwardCacheDisabledForDelegate", 482 "OptInUnloadHeaderNotPresent", "UnloadHandlerExistsInMainFrame", 483 "UnloadHandlerExistsInSubFrame", "ServiceWorkerUnregistration", "CacheControlNoStore", 484 "CacheControlNoStoreCookieModified", "CacheControlNoStoreHTTPOnlyCookieModified", 485 "NoResponseHead", "Unknown", "ActivationNavigationsDisallowedForBug1234857", "WebSocket", 486 "WebTransport", "WebRTC", "MainResourceHasCacheControlNoStore", 487 "MainResourceHasCacheControlNoCache", "SubresourceHasCacheControlNoStore", 488 "SubresourceHasCacheControlNoCache", "ContainsPlugins", "DocumentLoaded", 489 "DedicatedWorkerOrWorklet", "OutstandingNetworkRequestOthers", 490 "OutstandingIndexedDBTransaction", "RequestedNotificationsPermission", 491 "RequestedMIDIPermission", "RequestedAudioCapturePermission", 492 "RequestedVideoCapturePermission", "RequestedBackForwardCacheBlockedSensors", 493 "RequestedBackgroundWorkPermission", "BroadcastChannel", "IndexedDBConnection", "WebXR", 494 "SharedWorker", "WebLocks", "WebHID", "WebShare", "RequestedStorageAccessGrant", "WebNfc", 495 "OutstandingNetworkRequestFetch", "OutstandingNetworkRequestXHR", "AppBanner", "Printing", 496 "WebDatabase", "PictureInPicture", "Portal", "SpeechRecognizer", "IdleManager", 497 "PaymentManager", "SpeechSynthesis", "KeyboardLock", "WebOTPService", 498 "OutstandingNetworkRequestDirectSocket", "InjectedJavascript", "InjectedStyleSheet", 499 "Dummy", "ContentSecurityHandler", "ContentWebAuthenticationAPI", "ContentFileChooser", 500 "ContentSerial", "ContentFileSystemAccess", "ContentMediaDevicesDispatcherHost", 501 "ContentWebBluetooth", "ContentWebUSB", "ContentMediaSession", 502 "ContentMediaSessionService", "EmbedderPopupBlockerTabHelper", 503 "EmbedderSafeBrowsingTriggeredPopupBlocker", "EmbedderSafeBrowsingThreatDetails", 504 "EmbedderAppBannerManager", "EmbedderDomDistillerViewerSource", 505 "EmbedderDomDistillerSelfDeletingRequestDelegate", "EmbedderOomInterventionTabHelper", 506 "EmbedderOfflinePage", "EmbedderChromePasswordManagerClientBindCredentialManager", 507 "EmbedderPermissionRequestManager", "EmbedderModalDialog", "EmbedderExtensions", 508 "EmbedderExtensionMessaging", "EmbedderExtensionMessagingForOpenPort", 509 "EmbedderExtensionSentMessageToCachedFrame", 510 }; 511 512 /** 513 * Types of not restored reasons for back-forward cache. 514 * <BR /> 515 * <BR /><B>EXPERIMENTAL</B> 516 */ 517 public static final String[] BackForwardCacheNotRestoredReasonType = 518 { "SupportPending", "PageSupportNeeded", "Circumstantial", }; 519 520 /** 521 * Indicates whether a frame has been identified as an ad and why. 522 * <BR /> 523 * <BR /><B>EXPERIMENTAL</B> 524 */ 525 public static class AdFrameStatus extends BaseType 526 { 527 /** For Object Serialization. java.io.Serializable */ 528 protected static final long serialVersionUID = 1; 529 530 public boolean[] optionals() 531 { return new boolean[] { false, true, }; } 532 533 /** <CODE>[No Description Provided by Google]</CODE> */ 534 public final String adFrameType; 535 536 /** 537 * <CODE>[No Description Provided by Google]</CODE> 538 * <BR /> 539 * <BR /><B>OPTIONAL</B> 540 */ 541 public final String[] explanations; 542 543 /** 544 * Constructor 545 * 546 * @param adFrameType - 547 * 548 * @param explanations - 549 * <BR /><B>OPTIONAL</B> 550 */ 551 public AdFrameStatus(String adFrameType, String[] explanations) 552 { 553 // Exception-Check(s) to ensure that if any parameters which are not declared as 554 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 555 556 if (adFrameType == null) BRDPC.throwNPE("adFrameType"); 557 558 // Exception-Check(s) to ensure that if any parameters which must adhere to a 559 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 560 561 BRDPC.checkIAE("adFrameType", adFrameType, "Page.AdFrameType", Page.AdFrameType); 562 563 this.adFrameType = adFrameType; 564 this.explanations = explanations; 565 } 566 567 /** 568 * JSON Object Constructor 569 * @param jo A Json-Object having data about an instance of {@code 'AdFrameStatus'}. 570 */ 571 public AdFrameStatus (JsonObject jo) 572 { 573 this.adFrameType = ReadJSON.getString(jo, "adFrameType", false, true); 574 this.explanations = (jo.getJsonArray("explanations") == null) 575 ? null 576 : ReadArrJSON.DimN.strArr(jo.getJsonArray("explanations"), null, 0, String[].class); 577 } 578 579 } 580 581 /** 582 * <CODE>[No Description Provided by Google]</CODE> 583 * <BR /> 584 * <BR /><B>EXPERIMENTAL</B> 585 */ 586 public static class PermissionsPolicyBlockLocator extends BaseType 587 { 588 /** For Object Serialization. java.io.Serializable */ 589 protected static final long serialVersionUID = 1; 590 591 public boolean[] optionals() 592 { return new boolean[] { false, false, }; } 593 594 /** <CODE>[No Description Provided by Google]</CODE> */ 595 public final String frameId; 596 597 /** <CODE>[No Description Provided by Google]</CODE> */ 598 public final String blockReason; 599 600 /** 601 * Constructor 602 * 603 * @param frameId - 604 * 605 * @param blockReason - 606 */ 607 public PermissionsPolicyBlockLocator(String frameId, String blockReason) 608 { 609 // Exception-Check(s) to ensure that if any parameters which are not declared as 610 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 611 612 if (frameId == null) BRDPC.throwNPE("frameId"); 613 if (blockReason == null) BRDPC.throwNPE("blockReason"); 614 615 // Exception-Check(s) to ensure that if any parameters which must adhere to a 616 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 617 618 BRDPC.checkIAE("blockReason", blockReason, "Page.PermissionsPolicyBlockReason", Page.PermissionsPolicyBlockReason); 619 620 this.frameId = frameId; 621 this.blockReason = blockReason; 622 } 623 624 /** 625 * JSON Object Constructor 626 * @param jo A Json-Object having data about an instance of {@code 'PermissionsPolicyBlockLocator'}. 627 */ 628 public PermissionsPolicyBlockLocator (JsonObject jo) 629 { 630 this.frameId = ReadJSON.getString(jo, "frameId", false, true); 631 this.blockReason = ReadJSON.getString(jo, "blockReason", false, true); 632 } 633 634 } 635 636 /** 637 * <CODE>[No Description Provided by Google]</CODE> 638 * <BR /> 639 * <BR /><B>EXPERIMENTAL</B> 640 */ 641 public static class PermissionsPolicyFeatureState extends BaseType 642 { 643 /** For Object Serialization. java.io.Serializable */ 644 protected static final long serialVersionUID = 1; 645 646 public boolean[] optionals() 647 { return new boolean[] { false, false, true, }; } 648 649 /** <CODE>[No Description Provided by Google]</CODE> */ 650 public final String feature; 651 652 /** <CODE>[No Description Provided by Google]</CODE> */ 653 public final boolean allowed; 654 655 /** 656 * <CODE>[No Description Provided by Google]</CODE> 657 * <BR /> 658 * <BR /><B>OPTIONAL</B> 659 */ 660 public final Page.PermissionsPolicyBlockLocator locator; 661 662 /** 663 * Constructor 664 * 665 * @param feature - 666 * 667 * @param allowed - 668 * 669 * @param locator - 670 * <BR /><B>OPTIONAL</B> 671 */ 672 public PermissionsPolicyFeatureState 673 (String feature, boolean allowed, Page.PermissionsPolicyBlockLocator locator) 674 { 675 // Exception-Check(s) to ensure that if any parameters which are not declared as 676 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 677 678 if (feature == null) BRDPC.throwNPE("feature"); 679 680 // Exception-Check(s) to ensure that if any parameters which must adhere to a 681 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 682 683 BRDPC.checkIAE("feature", feature, "Page.PermissionsPolicyFeature", Page.PermissionsPolicyFeature); 684 685 this.feature = feature; 686 this.allowed = allowed; 687 this.locator = locator; 688 } 689 690 /** 691 * JSON Object Constructor 692 * @param jo A Json-Object having data about an instance of {@code 'PermissionsPolicyFeatureState'}. 693 */ 694 public PermissionsPolicyFeatureState (JsonObject jo) 695 { 696 this.feature = ReadJSON.getString(jo, "feature", false, true); 697 this.allowed = ReadJSON.getBoolean(jo, "allowed"); 698 this.locator = ReadJSON.XL.getObject(jo, "locator", Page.PermissionsPolicyBlockLocator.class, true, false); 699 } 700 701 } 702 703 /** 704 * <CODE>[No Description Provided by Google]</CODE> 705 * <BR /> 706 * <BR /><B>EXPERIMENTAL</B> 707 */ 708 public static class OriginTrialToken extends BaseType 709 { 710 /** For Object Serialization. java.io.Serializable */ 711 protected static final long serialVersionUID = 1; 712 713 public boolean[] optionals() 714 { return new boolean[] { false, false, false, false, false, false, }; } 715 716 /** <CODE>[No Description Provided by Google]</CODE> */ 717 public final String origin; 718 719 /** <CODE>[No Description Provided by Google]</CODE> */ 720 public final boolean matchSubDomains; 721 722 /** <CODE>[No Description Provided by Google]</CODE> */ 723 public final String trialName; 724 725 /** <CODE>[No Description Provided by Google]</CODE> */ 726 public final Number expiryTime; 727 728 /** <CODE>[No Description Provided by Google]</CODE> */ 729 public final boolean isThirdParty; 730 731 /** <CODE>[No Description Provided by Google]</CODE> */ 732 public final String usageRestriction; 733 734 /** 735 * Constructor 736 * 737 * @param origin - 738 * 739 * @param matchSubDomains - 740 * 741 * @param trialName - 742 * 743 * @param expiryTime - 744 * 745 * @param isThirdParty - 746 * 747 * @param usageRestriction - 748 */ 749 public OriginTrialToken( 750 String origin, boolean matchSubDomains, String trialName, Number expiryTime, 751 boolean isThirdParty, String usageRestriction 752 ) 753 { 754 // Exception-Check(s) to ensure that if any parameters which are not declared as 755 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 756 757 if (origin == null) BRDPC.throwNPE("origin"); 758 if (trialName == null) BRDPC.throwNPE("trialName"); 759 if (expiryTime == null) BRDPC.throwNPE("expiryTime"); 760 if (usageRestriction == null) BRDPC.throwNPE("usageRestriction"); 761 762 // Exception-Check(s) to ensure that if any parameters which must adhere to a 763 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 764 765 BRDPC.checkIAE("usageRestriction", usageRestriction, "Page.OriginTrialUsageRestriction", Page.OriginTrialUsageRestriction); 766 767 this.origin = origin; 768 this.matchSubDomains = matchSubDomains; 769 this.trialName = trialName; 770 this.expiryTime = expiryTime; 771 this.isThirdParty = isThirdParty; 772 this.usageRestriction = usageRestriction; 773 } 774 775 /** 776 * JSON Object Constructor 777 * @param jo A Json-Object having data about an instance of {@code 'OriginTrialToken'}. 778 */ 779 public OriginTrialToken (JsonObject jo) 780 { 781 this.origin = ReadJSON.getString(jo, "origin", false, true); 782 this.matchSubDomains = ReadJSON.getBoolean(jo, "matchSubDomains"); 783 this.trialName = ReadJSON.getString(jo, "trialName", false, true); 784 this.expiryTime = ReadJSON.getNUMBER(jo, "expiryTime", false, true); 785 this.isThirdParty = ReadJSON.getBoolean(jo, "isThirdParty"); 786 this.usageRestriction = ReadJSON.getString(jo, "usageRestriction", false, true); 787 } 788 789 } 790 791 /** 792 * <CODE>[No Description Provided by Google]</CODE> 793 * <BR /> 794 * <BR /><B>EXPERIMENTAL</B> 795 */ 796 public static class OriginTrialTokenWithStatus extends BaseType 797 { 798 /** For Object Serialization. java.io.Serializable */ 799 protected static final long serialVersionUID = 1; 800 801 public boolean[] optionals() 802 { return new boolean[] { false, true, false, }; } 803 804 /** <CODE>[No Description Provided by Google]</CODE> */ 805 public final String rawTokenText; 806 807 /** 808 * <CODE>parsedToken</CODE> is present only when the token is extractable and 809 * parsable. 810 * <BR /> 811 * <BR /><B>OPTIONAL</B> 812 */ 813 public final Page.OriginTrialToken parsedToken; 814 815 /** <CODE>[No Description Provided by Google]</CODE> */ 816 public final String status; 817 818 /** 819 * Constructor 820 * 821 * @param rawTokenText - 822 * 823 * @param parsedToken 824 * <CODE>parsedToken</CODE> is present only when the token is extractable and 825 * parsable. 826 * <BR /><B>OPTIONAL</B> 827 * 828 * @param status - 829 */ 830 public OriginTrialTokenWithStatus 831 (String rawTokenText, Page.OriginTrialToken parsedToken, String status) 832 { 833 // Exception-Check(s) to ensure that if any parameters which are not declared as 834 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 835 836 if (rawTokenText == null) BRDPC.throwNPE("rawTokenText"); 837 if (status == null) BRDPC.throwNPE("status"); 838 839 // Exception-Check(s) to ensure that if any parameters which must adhere to a 840 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 841 842 BRDPC.checkIAE("status", status, "Page.OriginTrialTokenStatus", Page.OriginTrialTokenStatus); 843 844 this.rawTokenText = rawTokenText; 845 this.parsedToken = parsedToken; 846 this.status = status; 847 } 848 849 /** 850 * JSON Object Constructor 851 * @param jo A Json-Object having data about an instance of {@code 'OriginTrialTokenWithStatus'}. 852 */ 853 public OriginTrialTokenWithStatus (JsonObject jo) 854 { 855 this.rawTokenText = ReadJSON.getString(jo, "rawTokenText", false, true); 856 this.parsedToken = ReadJSON.XL.getObject(jo, "parsedToken", Page.OriginTrialToken.class, true, false); 857 this.status = ReadJSON.getString(jo, "status", false, true); 858 } 859 860 } 861 862 /** 863 * <CODE>[No Description Provided by Google]</CODE> 864 * <BR /> 865 * <BR /><B>EXPERIMENTAL</B> 866 */ 867 public static class OriginTrial extends BaseType 868 { 869 /** For Object Serialization. java.io.Serializable */ 870 protected static final long serialVersionUID = 1; 871 872 public boolean[] optionals() 873 { return new boolean[] { false, false, false, }; } 874 875 /** <CODE>[No Description Provided by Google]</CODE> */ 876 public final String trialName; 877 878 /** <CODE>[No Description Provided by Google]</CODE> */ 879 public final String status; 880 881 /** <CODE>[No Description Provided by Google]</CODE> */ 882 public final Page.OriginTrialTokenWithStatus[] tokensWithStatus; 883 884 /** 885 * Constructor 886 * 887 * @param trialName - 888 * 889 * @param status - 890 * 891 * @param tokensWithStatus - 892 */ 893 public OriginTrial 894 (String trialName, String status, Page.OriginTrialTokenWithStatus[] tokensWithStatus) 895 { 896 // Exception-Check(s) to ensure that if any parameters which are not declared as 897 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 898 899 if (trialName == null) BRDPC.throwNPE("trialName"); 900 if (status == null) BRDPC.throwNPE("status"); 901 if (tokensWithStatus == null) BRDPC.throwNPE("tokensWithStatus"); 902 903 // Exception-Check(s) to ensure that if any parameters which must adhere to a 904 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 905 906 BRDPC.checkIAE("status", status, "Page.OriginTrialStatus", Page.OriginTrialStatus); 907 908 this.trialName = trialName; 909 this.status = status; 910 this.tokensWithStatus = tokensWithStatus; 911 } 912 913 /** 914 * JSON Object Constructor 915 * @param jo A Json-Object having data about an instance of {@code 'OriginTrial'}. 916 */ 917 public OriginTrial (JsonObject jo) 918 { 919 this.trialName = ReadJSON.getString(jo, "trialName", false, true); 920 this.status = ReadJSON.getString(jo, "status", false, true); 921 this.tokensWithStatus = (jo.getJsonArray("tokensWithStatus") == null) 922 ? null 923 : ReadArrJSON.DimN.objArr(jo.getJsonArray("tokensWithStatus"), null, 0, Page.OriginTrialTokenWithStatus[].class); 924 } 925 926 } 927 928 /** Information about the Frame on the page. */ 929 public static class Frame extends BaseType 930 { 931 /** For Object Serialization. java.io.Serializable */ 932 protected static final long serialVersionUID = 1; 933 934 public boolean[] optionals() 935 { return new boolean[] { false, true, false, true, false, true, false, false, false, true, true, false, false, false, }; } 936 937 /** Frame unique identifier. */ 938 public final String id; 939 940 /** 941 * Parent frame identifier. 942 * <BR /> 943 * <BR /><B>OPTIONAL</B> 944 */ 945 public final String parentId; 946 947 /** Identifier of the loader associated with this frame. */ 948 public final String loaderId; 949 950 /** 951 * Frame's name as specified in the tag. 952 * <BR /> 953 * <BR /><B>OPTIONAL</B> 954 */ 955 public final String name; 956 957 /** Frame document's URL without fragment. */ 958 public final String url; 959 960 /** 961 * Frame document's URL fragment including the '#'. 962 * <BR /> 963 * <BR /><B>OPTIONAL</B> 964 * <BR /><B>EXPERIMENTAL</B> 965 */ 966 public final String urlFragment; 967 968 /** 969 * Frame document's registered domain, taking the public suffixes list into account. 970 * Extracted from the Frame's url. 971 * Example URLs: http://www.google.com/file.html -> "google.com" 972 * http://a.b.co.uk/file.html -> "b.co.uk" 973 * <BR /> 974 * <BR /><B>EXPERIMENTAL</B> 975 */ 976 public final String domainAndRegistry; 977 978 /** Frame document's security origin. */ 979 public final String securityOrigin; 980 981 /** Frame document's mimeType as determined by the browser. */ 982 public final String mimeType; 983 984 /** 985 * If the frame failed to load, this contains the URL that could not be loaded. Note that unlike url above, this URL may contain a fragment. 986 * <BR /> 987 * <BR /><B>OPTIONAL</B> 988 * <BR /><B>EXPERIMENTAL</B> 989 */ 990 public final String unreachableUrl; 991 992 /** 993 * Indicates whether this frame was tagged as an ad and why. 994 * <BR /> 995 * <BR /><B>OPTIONAL</B> 996 * <BR /><B>EXPERIMENTAL</B> 997 */ 998 public final Page.AdFrameStatus adFrameStatus; 999 1000 /** 1001 * Indicates whether the main document is a secure context and explains why that is the case. 1002 * <BR /> 1003 * <BR /><B>EXPERIMENTAL</B> 1004 */ 1005 public final String secureContextType; 1006 1007 /** 1008 * Indicates whether this is a cross origin isolated context. 1009 * <BR /> 1010 * <BR /><B>EXPERIMENTAL</B> 1011 */ 1012 public final String crossOriginIsolatedContextType; 1013 1014 /** 1015 * Indicated which gated APIs / features are available. 1016 * <BR /> 1017 * <BR /><B>EXPERIMENTAL</B> 1018 */ 1019 public final String[] gatedAPIFeatures; 1020 1021 /** 1022 * Constructor 1023 * 1024 * @param id Frame unique identifier. 1025 * 1026 * @param parentId Parent frame identifier. 1027 * <BR /><B>OPTIONAL</B> 1028 * 1029 * @param loaderId Identifier of the loader associated with this frame. 1030 * 1031 * @param name Frame's name as specified in the tag. 1032 * <BR /><B>OPTIONAL</B> 1033 * 1034 * @param url Frame document's URL without fragment. 1035 * 1036 * @param urlFragment Frame document's URL fragment including the '#'. 1037 * <BR /><B>OPTIONAL</B> 1038 * <BR /><B>EXPERIMENTAL</B> 1039 * 1040 * @param domainAndRegistry 1041 * Frame document's registered domain, taking the public suffixes list into account. 1042 * Extracted from the Frame's url. 1043 * Example URLs: http://www.google.com/file.html -> "google.com" 1044 * http://a.b.co.uk/file.html -> "b.co.uk" 1045 * <BR /><B>EXPERIMENTAL</B> 1046 * 1047 * @param securityOrigin Frame document's security origin. 1048 * 1049 * @param mimeType Frame document's mimeType as determined by the browser. 1050 * 1051 * @param unreachableUrl If the frame failed to load, this contains the URL that could not be loaded. Note that unlike url above, this URL may contain a fragment. 1052 * <BR /><B>OPTIONAL</B> 1053 * <BR /><B>EXPERIMENTAL</B> 1054 * 1055 * @param adFrameStatus Indicates whether this frame was tagged as an ad and why. 1056 * <BR /><B>OPTIONAL</B> 1057 * <BR /><B>EXPERIMENTAL</B> 1058 * 1059 * @param secureContextType Indicates whether the main document is a secure context and explains why that is the case. 1060 * <BR /><B>EXPERIMENTAL</B> 1061 * 1062 * @param crossOriginIsolatedContextType Indicates whether this is a cross origin isolated context. 1063 * <BR /><B>EXPERIMENTAL</B> 1064 * 1065 * @param gatedAPIFeatures Indicated which gated APIs / features are available. 1066 * <BR /><B>EXPERIMENTAL</B> 1067 */ 1068 public Frame( 1069 String id, String parentId, String loaderId, String name, String url, 1070 String urlFragment, String domainAndRegistry, String securityOrigin, 1071 String mimeType, String unreachableUrl, Page.AdFrameStatus adFrameStatus, 1072 String secureContextType, String crossOriginIsolatedContextType, 1073 String[] gatedAPIFeatures 1074 ) 1075 { 1076 // Exception-Check(s) to ensure that if any parameters which are not declared as 1077 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1078 1079 if (id == null) BRDPC.throwNPE("id"); 1080 if (loaderId == null) BRDPC.throwNPE("loaderId"); 1081 if (url == null) BRDPC.throwNPE("url"); 1082 if (domainAndRegistry == null) BRDPC.throwNPE("domainAndRegistry"); 1083 if (securityOrigin == null) BRDPC.throwNPE("securityOrigin"); 1084 if (mimeType == null) BRDPC.throwNPE("mimeType"); 1085 if (secureContextType == null) BRDPC.throwNPE("secureContextType"); 1086 if (crossOriginIsolatedContextType == null) BRDPC.throwNPE("crossOriginIsolatedContextType"); 1087 if (gatedAPIFeatures == null) BRDPC.throwNPE("gatedAPIFeatures"); 1088 1089 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1090 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1091 1092 BRDPC.checkIAE("secureContextType", secureContextType, "Page.SecureContextType", Page.SecureContextType); 1093 BRDPC.checkIAE("crossOriginIsolatedContextType", crossOriginIsolatedContextType, "Page.CrossOriginIsolatedContextType", Page.CrossOriginIsolatedContextType); 1094 1095 this.id = id; 1096 this.parentId = parentId; 1097 this.loaderId = loaderId; 1098 this.name = name; 1099 this.url = url; 1100 this.urlFragment = urlFragment; 1101 this.domainAndRegistry = domainAndRegistry; 1102 this.securityOrigin = securityOrigin; 1103 this.mimeType = mimeType; 1104 this.unreachableUrl = unreachableUrl; 1105 this.adFrameStatus = adFrameStatus; 1106 this.secureContextType = secureContextType; 1107 this.crossOriginIsolatedContextType = crossOriginIsolatedContextType; 1108 this.gatedAPIFeatures = gatedAPIFeatures; 1109 } 1110 1111 /** 1112 * JSON Object Constructor 1113 * @param jo A Json-Object having data about an instance of {@code 'Frame'}. 1114 */ 1115 public Frame (JsonObject jo) 1116 { 1117 this.id = ReadJSON.getString(jo, "id", false, true); 1118 this.parentId = ReadJSON.getString(jo, "parentId", true, false); 1119 this.loaderId = ReadJSON.getString(jo, "loaderId", false, true); 1120 this.name = ReadJSON.getString(jo, "name", true, false); 1121 this.url = ReadJSON.getString(jo, "url", false, true); 1122 this.urlFragment = ReadJSON.getString(jo, "urlFragment", true, false); 1123 this.domainAndRegistry = ReadJSON.getString(jo, "domainAndRegistry", false, true); 1124 this.securityOrigin = ReadJSON.getString(jo, "securityOrigin", false, true); 1125 this.mimeType = ReadJSON.getString(jo, "mimeType", false, true); 1126 this.unreachableUrl = ReadJSON.getString(jo, "unreachableUrl", true, false); 1127 this.adFrameStatus = ReadJSON.XL.getObject(jo, "adFrameStatus", Page.AdFrameStatus.class, true, false); 1128 this.secureContextType = ReadJSON.getString(jo, "secureContextType", false, true); 1129 this.crossOriginIsolatedContextType = ReadJSON.getString(jo, "crossOriginIsolatedContextType", false, true); 1130 this.gatedAPIFeatures = (jo.getJsonArray("gatedAPIFeatures") == null) 1131 ? null 1132 : ReadArrJSON.DimN.strArr(jo.getJsonArray("gatedAPIFeatures"), null, 0, String[].class); 1133 } 1134 1135 } 1136 1137 /** 1138 * Information about the Resource on the page. 1139 * <BR /> 1140 * <BR /><B>EXPERIMENTAL</B> 1141 */ 1142 public static class FrameResource extends BaseType 1143 { 1144 /** For Object Serialization. java.io.Serializable */ 1145 protected static final long serialVersionUID = 1; 1146 1147 public boolean[] optionals() 1148 { return new boolean[] { false, false, false, true, true, true, true, }; } 1149 1150 /** Resource URL. */ 1151 public final String url; 1152 1153 /** Type of this resource. */ 1154 public final String type; 1155 1156 /** Resource mimeType as determined by the browser. */ 1157 public final String mimeType; 1158 1159 /** 1160 * last-modified timestamp as reported by server. 1161 * <BR /> 1162 * <BR /><B>OPTIONAL</B> 1163 */ 1164 public final Number lastModified; 1165 1166 /** 1167 * Resource content size. 1168 * <BR /> 1169 * <BR /><B>OPTIONAL</B> 1170 */ 1171 public final Number contentSize; 1172 1173 /** 1174 * True if the resource failed to load. 1175 * <BR /> 1176 * <BR /><B>OPTIONAL</B> 1177 */ 1178 public final Boolean failed; 1179 1180 /** 1181 * True if the resource was canceled during loading. 1182 * <BR /> 1183 * <BR /><B>OPTIONAL</B> 1184 */ 1185 public final Boolean canceled; 1186 1187 /** 1188 * Constructor 1189 * 1190 * @param url Resource URL. 1191 * 1192 * @param type Type of this resource. 1193 * 1194 * @param mimeType Resource mimeType as determined by the browser. 1195 * 1196 * @param lastModified last-modified timestamp as reported by server. 1197 * <BR /><B>OPTIONAL</B> 1198 * 1199 * @param contentSize Resource content size. 1200 * <BR /><B>OPTIONAL</B> 1201 * 1202 * @param failed True if the resource failed to load. 1203 * <BR /><B>OPTIONAL</B> 1204 * 1205 * @param canceled True if the resource was canceled during loading. 1206 * <BR /><B>OPTIONAL</B> 1207 */ 1208 public FrameResource( 1209 String url, String type, String mimeType, Number lastModified, Number contentSize, 1210 Boolean failed, Boolean canceled 1211 ) 1212 { 1213 // Exception-Check(s) to ensure that if any parameters which are not declared as 1214 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1215 1216 if (url == null) BRDPC.throwNPE("url"); 1217 if (type == null) BRDPC.throwNPE("type"); 1218 if (mimeType == null) BRDPC.throwNPE("mimeType"); 1219 1220 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1221 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1222 1223 BRDPC.checkIAE("type", type, "Network.ResourceType", Network.ResourceType); 1224 1225 this.url = url; 1226 this.type = type; 1227 this.mimeType = mimeType; 1228 this.lastModified = lastModified; 1229 this.contentSize = contentSize; 1230 this.failed = failed; 1231 this.canceled = canceled; 1232 } 1233 1234 /** 1235 * JSON Object Constructor 1236 * @param jo A Json-Object having data about an instance of {@code 'FrameResource'}. 1237 */ 1238 public FrameResource (JsonObject jo) 1239 { 1240 this.url = ReadJSON.getString(jo, "url", false, true); 1241 this.type = ReadJSON.getString(jo, "type", false, true); 1242 this.mimeType = ReadJSON.getString(jo, "mimeType", false, true); 1243 this.lastModified = ReadJSON.getNUMBER(jo, "lastModified", true, false); 1244 this.contentSize = ReadJSON.getNUMBER(jo, "contentSize", true, false); 1245 this.failed = ReadJSON.getBOOLEAN(jo, "failed", true); 1246 this.canceled = ReadJSON.getBOOLEAN(jo, "canceled", true); 1247 } 1248 1249 } 1250 1251 /** 1252 * Information about the Frame hierarchy along with their cached resources. 1253 * <BR /> 1254 * <BR /><B>EXPERIMENTAL</B> 1255 */ 1256 public static class FrameResourceTree extends BaseType 1257 { 1258 /** For Object Serialization. java.io.Serializable */ 1259 protected static final long serialVersionUID = 1; 1260 1261 public boolean[] optionals() 1262 { return new boolean[] { false, true, false, }; } 1263 1264 /** Frame information for this tree item. */ 1265 public final Page.Frame frame; 1266 1267 /** 1268 * Child frames. 1269 * <BR /> 1270 * <BR /><B>OPTIONAL</B> 1271 */ 1272 public final Page.FrameResourceTree[] childFrames; 1273 1274 /** Information about frame resources. */ 1275 public final Page.FrameResource[] resources; 1276 1277 /** 1278 * Constructor 1279 * 1280 * @param frame Frame information for this tree item. 1281 * 1282 * @param childFrames Child frames. 1283 * <BR /><B>OPTIONAL</B> 1284 * 1285 * @param resources Information about frame resources. 1286 */ 1287 public FrameResourceTree 1288 (Page.Frame frame, Page.FrameResourceTree[] childFrames, Page.FrameResource[] resources) 1289 { 1290 // Exception-Check(s) to ensure that if any parameters which are not declared as 1291 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1292 1293 if (frame == null) BRDPC.throwNPE("frame"); 1294 if (resources == null) BRDPC.throwNPE("resources"); 1295 1296 this.frame = frame; 1297 this.childFrames = childFrames; 1298 this.resources = resources; 1299 } 1300 1301 /** 1302 * JSON Object Constructor 1303 * @param jo A Json-Object having data about an instance of {@code 'FrameResourceTree'}. 1304 */ 1305 public FrameResourceTree (JsonObject jo) 1306 { 1307 this.frame = ReadJSON.XL.getObject(jo, "frame", Page.Frame.class, false, true); 1308 this.childFrames = (jo.getJsonArray("childFrames") == null) 1309 ? null 1310 : ReadArrJSON.DimN.objArr(jo.getJsonArray("childFrames"), null, 0, Page.FrameResourceTree[].class); 1311 this.resources = (jo.getJsonArray("resources") == null) 1312 ? null 1313 : ReadArrJSON.DimN.objArr(jo.getJsonArray("resources"), null, 0, Page.FrameResource[].class); 1314 } 1315 1316 } 1317 1318 /** Information about the Frame hierarchy. */ 1319 public static class FrameTree extends BaseType 1320 { 1321 /** For Object Serialization. java.io.Serializable */ 1322 protected static final long serialVersionUID = 1; 1323 1324 public boolean[] optionals() 1325 { return new boolean[] { false, true, }; } 1326 1327 /** Frame information for this tree item. */ 1328 public final Page.Frame frame; 1329 1330 /** 1331 * Child frames. 1332 * <BR /> 1333 * <BR /><B>OPTIONAL</B> 1334 */ 1335 public final Page.FrameTree[] childFrames; 1336 1337 /** 1338 * Constructor 1339 * 1340 * @param frame Frame information for this tree item. 1341 * 1342 * @param childFrames Child frames. 1343 * <BR /><B>OPTIONAL</B> 1344 */ 1345 public FrameTree(Page.Frame frame, Page.FrameTree[] childFrames) 1346 { 1347 // Exception-Check(s) to ensure that if any parameters which are not declared as 1348 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1349 1350 if (frame == null) BRDPC.throwNPE("frame"); 1351 1352 this.frame = frame; 1353 this.childFrames = childFrames; 1354 } 1355 1356 /** 1357 * JSON Object Constructor 1358 * @param jo A Json-Object having data about an instance of {@code 'FrameTree'}. 1359 */ 1360 public FrameTree (JsonObject jo) 1361 { 1362 this.frame = ReadJSON.XL.getObject(jo, "frame", Page.Frame.class, false, true); 1363 this.childFrames = (jo.getJsonArray("childFrames") == null) 1364 ? null 1365 : ReadArrJSON.DimN.objArr(jo.getJsonArray("childFrames"), null, 0, Page.FrameTree[].class); 1366 } 1367 1368 } 1369 1370 /** Navigation history entry. */ 1371 public static class NavigationEntry extends BaseType 1372 { 1373 /** For Object Serialization. java.io.Serializable */ 1374 protected static final long serialVersionUID = 1; 1375 1376 public boolean[] optionals() 1377 { return new boolean[] { false, false, false, false, false, }; } 1378 1379 /** Unique id of the navigation history entry. */ 1380 public final int id; 1381 1382 /** URL of the navigation history entry. */ 1383 public final String url; 1384 1385 /** URL that the user typed in the url bar. */ 1386 public final String userTypedURL; 1387 1388 /** Title of the navigation history entry. */ 1389 public final String title; 1390 1391 /** Transition type. */ 1392 public final String transitionType; 1393 1394 /** 1395 * Constructor 1396 * 1397 * @param id Unique id of the navigation history entry. 1398 * 1399 * @param url URL of the navigation history entry. 1400 * 1401 * @param userTypedURL URL that the user typed in the url bar. 1402 * 1403 * @param title Title of the navigation history entry. 1404 * 1405 * @param transitionType Transition type. 1406 */ 1407 public NavigationEntry 1408 (int id, String url, String userTypedURL, String title, String transitionType) 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 (userTypedURL == null) BRDPC.throwNPE("userTypedURL"); 1415 if (title == null) BRDPC.throwNPE("title"); 1416 if (transitionType == null) BRDPC.throwNPE("transitionType"); 1417 1418 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1419 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1420 1421 BRDPC.checkIAE("transitionType", transitionType, "Page.TransitionType", Page.TransitionType); 1422 1423 this.id = id; 1424 this.url = url; 1425 this.userTypedURL = userTypedURL; 1426 this.title = title; 1427 this.transitionType = transitionType; 1428 } 1429 1430 /** 1431 * JSON Object Constructor 1432 * @param jo A Json-Object having data about an instance of {@code 'NavigationEntry'}. 1433 */ 1434 public NavigationEntry (JsonObject jo) 1435 { 1436 this.id = ReadJSON.getInt(jo, "id"); 1437 this.url = ReadJSON.getString(jo, "url", false, true); 1438 this.userTypedURL = ReadJSON.getString(jo, "userTypedURL", false, true); 1439 this.title = ReadJSON.getString(jo, "title", false, true); 1440 this.transitionType = ReadJSON.getString(jo, "transitionType", false, true); 1441 } 1442 1443 } 1444 1445 /** 1446 * Screencast frame metadata. 1447 * <BR /> 1448 * <BR /><B>EXPERIMENTAL</B> 1449 */ 1450 public static class ScreencastFrameMetadata extends BaseType 1451 { 1452 /** For Object Serialization. java.io.Serializable */ 1453 protected static final long serialVersionUID = 1; 1454 1455 public boolean[] optionals() 1456 { return new boolean[] { false, false, false, false, false, false, true, }; } 1457 1458 /** Top offset in DIP. */ 1459 public final Number offsetTop; 1460 1461 /** Page scale factor. */ 1462 public final Number pageScaleFactor; 1463 1464 /** Device screen width in DIP. */ 1465 public final Number deviceWidth; 1466 1467 /** Device screen height in DIP. */ 1468 public final Number deviceHeight; 1469 1470 /** Position of horizontal scroll in CSS pixels. */ 1471 public final Number scrollOffsetX; 1472 1473 /** Position of vertical scroll in CSS pixels. */ 1474 public final Number scrollOffsetY; 1475 1476 /** 1477 * Frame swap timestamp. 1478 * <BR /> 1479 * <BR /><B>OPTIONAL</B> 1480 */ 1481 public final Number timestamp; 1482 1483 /** 1484 * Constructor 1485 * 1486 * @param offsetTop Top offset in DIP. 1487 * 1488 * @param pageScaleFactor Page scale factor. 1489 * 1490 * @param deviceWidth Device screen width in DIP. 1491 * 1492 * @param deviceHeight Device screen height in DIP. 1493 * 1494 * @param scrollOffsetX Position of horizontal scroll in CSS pixels. 1495 * 1496 * @param scrollOffsetY Position of vertical scroll in CSS pixels. 1497 * 1498 * @param timestamp Frame swap timestamp. 1499 * <BR /><B>OPTIONAL</B> 1500 */ 1501 public ScreencastFrameMetadata( 1502 Number offsetTop, Number pageScaleFactor, Number deviceWidth, Number deviceHeight, 1503 Number scrollOffsetX, Number scrollOffsetY, Number timestamp 1504 ) 1505 { 1506 // Exception-Check(s) to ensure that if any parameters which are not declared as 1507 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1508 1509 if (offsetTop == null) BRDPC.throwNPE("offsetTop"); 1510 if (pageScaleFactor == null) BRDPC.throwNPE("pageScaleFactor"); 1511 if (deviceWidth == null) BRDPC.throwNPE("deviceWidth"); 1512 if (deviceHeight == null) BRDPC.throwNPE("deviceHeight"); 1513 if (scrollOffsetX == null) BRDPC.throwNPE("scrollOffsetX"); 1514 if (scrollOffsetY == null) BRDPC.throwNPE("scrollOffsetY"); 1515 1516 this.offsetTop = offsetTop; 1517 this.pageScaleFactor = pageScaleFactor; 1518 this.deviceWidth = deviceWidth; 1519 this.deviceHeight = deviceHeight; 1520 this.scrollOffsetX = scrollOffsetX; 1521 this.scrollOffsetY = scrollOffsetY; 1522 this.timestamp = timestamp; 1523 } 1524 1525 /** 1526 * JSON Object Constructor 1527 * @param jo A Json-Object having data about an instance of {@code 'ScreencastFrameMetadata'}. 1528 */ 1529 public ScreencastFrameMetadata (JsonObject jo) 1530 { 1531 this.offsetTop = ReadJSON.getNUMBER(jo, "offsetTop", false, true); 1532 this.pageScaleFactor = ReadJSON.getNUMBER(jo, "pageScaleFactor", false, true); 1533 this.deviceWidth = ReadJSON.getNUMBER(jo, "deviceWidth", false, true); 1534 this.deviceHeight = ReadJSON.getNUMBER(jo, "deviceHeight", false, true); 1535 this.scrollOffsetX = ReadJSON.getNUMBER(jo, "scrollOffsetX", false, true); 1536 this.scrollOffsetY = ReadJSON.getNUMBER(jo, "scrollOffsetY", false, true); 1537 this.timestamp = ReadJSON.getNUMBER(jo, "timestamp", true, false); 1538 } 1539 1540 } 1541 1542 /** Error while paring app manifest. */ 1543 public static class AppManifestError extends BaseType 1544 { 1545 /** For Object Serialization. java.io.Serializable */ 1546 protected static final long serialVersionUID = 1; 1547 1548 public boolean[] optionals() 1549 { return new boolean[] { false, false, false, false, }; } 1550 1551 /** Error message. */ 1552 public final String message; 1553 1554 /** If criticial, this is a non-recoverable parse error. */ 1555 public final int critical; 1556 1557 /** Error line. */ 1558 public final int line; 1559 1560 /** Error column. */ 1561 public final int column; 1562 1563 /** 1564 * Constructor 1565 * 1566 * @param message Error message. 1567 * 1568 * @param critical If criticial, this is a non-recoverable parse error. 1569 * 1570 * @param line Error line. 1571 * 1572 * @param column Error column. 1573 */ 1574 public AppManifestError(String message, int critical, int line, int column) 1575 { 1576 // Exception-Check(s) to ensure that if any parameters which are not declared as 1577 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1578 1579 if (message == null) BRDPC.throwNPE("message"); 1580 1581 this.message = message; 1582 this.critical = critical; 1583 this.line = line; 1584 this.column = column; 1585 } 1586 1587 /** 1588 * JSON Object Constructor 1589 * @param jo A Json-Object having data about an instance of {@code 'AppManifestError'}. 1590 */ 1591 public AppManifestError (JsonObject jo) 1592 { 1593 this.message = ReadJSON.getString(jo, "message", false, true); 1594 this.critical = ReadJSON.getInt(jo, "critical"); 1595 this.line = ReadJSON.getInt(jo, "line"); 1596 this.column = ReadJSON.getInt(jo, "column"); 1597 } 1598 1599 } 1600 1601 /** 1602 * Parsed app manifest properties. 1603 * <BR /> 1604 * <BR /><B>EXPERIMENTAL</B> 1605 */ 1606 public static class AppManifestParsedProperties extends BaseType 1607 { 1608 /** For Object Serialization. java.io.Serializable */ 1609 protected static final long serialVersionUID = 1; 1610 1611 public boolean[] optionals() 1612 { return new boolean[] { false, }; } 1613 1614 /** Computed scope value */ 1615 public final String scope; 1616 1617 /** 1618 * Constructor 1619 * 1620 * @param scope Computed scope value 1621 */ 1622 public AppManifestParsedProperties(String scope) 1623 { 1624 // Exception-Check(s) to ensure that if any parameters which are not declared as 1625 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1626 1627 if (scope == null) BRDPC.throwNPE("scope"); 1628 1629 this.scope = scope; 1630 } 1631 1632 /** 1633 * JSON Object Constructor 1634 * @param jo A Json-Object having data about an instance of {@code 'AppManifestParsedProperties'}. 1635 */ 1636 public AppManifestParsedProperties (JsonObject jo) 1637 { 1638 this.scope = ReadJSON.getString(jo, "scope", false, true); 1639 } 1640 1641 } 1642 1643 /** Layout viewport position and dimensions. */ 1644 public static class LayoutViewport extends BaseType 1645 { 1646 /** For Object Serialization. java.io.Serializable */ 1647 protected static final long serialVersionUID = 1; 1648 1649 public boolean[] optionals() 1650 { return new boolean[] { false, false, false, false, }; } 1651 1652 /** Horizontal offset relative to the document (CSS pixels). */ 1653 public final int pageX; 1654 1655 /** Vertical offset relative to the document (CSS pixels). */ 1656 public final int pageY; 1657 1658 /** Width (CSS pixels), excludes scrollbar if present. */ 1659 public final int clientWidth; 1660 1661 /** Height (CSS pixels), excludes scrollbar if present. */ 1662 public final int clientHeight; 1663 1664 /** 1665 * Constructor 1666 * 1667 * @param pageX Horizontal offset relative to the document (CSS pixels). 1668 * 1669 * @param pageY Vertical offset relative to the document (CSS pixels). 1670 * 1671 * @param clientWidth Width (CSS pixels), excludes scrollbar if present. 1672 * 1673 * @param clientHeight Height (CSS pixels), excludes scrollbar if present. 1674 */ 1675 public LayoutViewport(int pageX, int pageY, int clientWidth, int clientHeight) 1676 { 1677 this.pageX = pageX; 1678 this.pageY = pageY; 1679 this.clientWidth = clientWidth; 1680 this.clientHeight = clientHeight; 1681 } 1682 1683 /** 1684 * JSON Object Constructor 1685 * @param jo A Json-Object having data about an instance of {@code 'LayoutViewport'}. 1686 */ 1687 public LayoutViewport (JsonObject jo) 1688 { 1689 this.pageX = ReadJSON.getInt(jo, "pageX"); 1690 this.pageY = ReadJSON.getInt(jo, "pageY"); 1691 this.clientWidth = ReadJSON.getInt(jo, "clientWidth"); 1692 this.clientHeight = ReadJSON.getInt(jo, "clientHeight"); 1693 } 1694 1695 } 1696 1697 /** Visual viewport position, dimensions, and scale. */ 1698 public static class VisualViewport extends BaseType 1699 { 1700 /** For Object Serialization. java.io.Serializable */ 1701 protected static final long serialVersionUID = 1; 1702 1703 public boolean[] optionals() 1704 { return new boolean[] { false, false, false, false, false, false, false, true, }; } 1705 1706 /** Horizontal offset relative to the layout viewport (CSS pixels). */ 1707 public final Number offsetX; 1708 1709 /** Vertical offset relative to the layout viewport (CSS pixels). */ 1710 public final Number offsetY; 1711 1712 /** Horizontal offset relative to the document (CSS pixels). */ 1713 public final Number pageX; 1714 1715 /** Vertical offset relative to the document (CSS pixels). */ 1716 public final Number pageY; 1717 1718 /** Width (CSS pixels), excludes scrollbar if present. */ 1719 public final Number clientWidth; 1720 1721 /** Height (CSS pixels), excludes scrollbar if present. */ 1722 public final Number clientHeight; 1723 1724 /** Scale relative to the ideal viewport (size at width=device-width). */ 1725 public final Number scale; 1726 1727 /** 1728 * Page zoom factor (CSS to device independent pixels ratio). 1729 * <BR /> 1730 * <BR /><B>OPTIONAL</B> 1731 */ 1732 public final Number zoom; 1733 1734 /** 1735 * Constructor 1736 * 1737 * @param offsetX Horizontal offset relative to the layout viewport (CSS pixels). 1738 * 1739 * @param offsetY Vertical offset relative to the layout viewport (CSS pixels). 1740 * 1741 * @param pageX Horizontal offset relative to the document (CSS pixels). 1742 * 1743 * @param pageY Vertical offset relative to the document (CSS pixels). 1744 * 1745 * @param clientWidth Width (CSS pixels), excludes scrollbar if present. 1746 * 1747 * @param clientHeight Height (CSS pixels), excludes scrollbar if present. 1748 * 1749 * @param scale Scale relative to the ideal viewport (size at width=device-width). 1750 * 1751 * @param zoom Page zoom factor (CSS to device independent pixels ratio). 1752 * <BR /><B>OPTIONAL</B> 1753 */ 1754 public VisualViewport( 1755 Number offsetX, Number offsetY, Number pageX, Number pageY, Number clientWidth, 1756 Number clientHeight, Number scale, Number zoom 1757 ) 1758 { 1759 // Exception-Check(s) to ensure that if any parameters which are not declared as 1760 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1761 1762 if (offsetX == null) BRDPC.throwNPE("offsetX"); 1763 if (offsetY == null) BRDPC.throwNPE("offsetY"); 1764 if (pageX == null) BRDPC.throwNPE("pageX"); 1765 if (pageY == null) BRDPC.throwNPE("pageY"); 1766 if (clientWidth == null) BRDPC.throwNPE("clientWidth"); 1767 if (clientHeight == null) BRDPC.throwNPE("clientHeight"); 1768 if (scale == null) BRDPC.throwNPE("scale"); 1769 1770 this.offsetX = offsetX; 1771 this.offsetY = offsetY; 1772 this.pageX = pageX; 1773 this.pageY = pageY; 1774 this.clientWidth = clientWidth; 1775 this.clientHeight = clientHeight; 1776 this.scale = scale; 1777 this.zoom = zoom; 1778 } 1779 1780 /** 1781 * JSON Object Constructor 1782 * @param jo A Json-Object having data about an instance of {@code 'VisualViewport'}. 1783 */ 1784 public VisualViewport (JsonObject jo) 1785 { 1786 this.offsetX = ReadJSON.getNUMBER(jo, "offsetX", false, true); 1787 this.offsetY = ReadJSON.getNUMBER(jo, "offsetY", false, true); 1788 this.pageX = ReadJSON.getNUMBER(jo, "pageX", false, true); 1789 this.pageY = ReadJSON.getNUMBER(jo, "pageY", false, true); 1790 this.clientWidth = ReadJSON.getNUMBER(jo, "clientWidth", false, true); 1791 this.clientHeight = ReadJSON.getNUMBER(jo, "clientHeight", false, true); 1792 this.scale = ReadJSON.getNUMBER(jo, "scale", false, true); 1793 this.zoom = ReadJSON.getNUMBER(jo, "zoom", true, false); 1794 } 1795 1796 } 1797 1798 /** Viewport for capturing screenshot. */ 1799 public static class Viewport extends BaseType 1800 { 1801 /** For Object Serialization. java.io.Serializable */ 1802 protected static final long serialVersionUID = 1; 1803 1804 public boolean[] optionals() 1805 { return new boolean[] { false, false, false, false, false, }; } 1806 1807 /** X offset in device independent pixels (dip). */ 1808 public final Number x; 1809 1810 /** Y offset in device independent pixels (dip). */ 1811 public final Number y; 1812 1813 /** Rectangle width in device independent pixels (dip). */ 1814 public final Number width; 1815 1816 /** Rectangle height in device independent pixels (dip). */ 1817 public final Number height; 1818 1819 /** Page scale factor. */ 1820 public final Number scale; 1821 1822 /** 1823 * Constructor 1824 * 1825 * @param x X offset in device independent pixels (dip). 1826 * 1827 * @param y Y offset in device independent pixels (dip). 1828 * 1829 * @param width Rectangle width in device independent pixels (dip). 1830 * 1831 * @param height Rectangle height in device independent pixels (dip). 1832 * 1833 * @param scale Page scale factor. 1834 */ 1835 public Viewport(Number x, Number y, Number width, Number height, Number scale) 1836 { 1837 // Exception-Check(s) to ensure that if any parameters which are not declared as 1838 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1839 1840 if (x == null) BRDPC.throwNPE("x"); 1841 if (y == null) BRDPC.throwNPE("y"); 1842 if (width == null) BRDPC.throwNPE("width"); 1843 if (height == null) BRDPC.throwNPE("height"); 1844 if (scale == null) BRDPC.throwNPE("scale"); 1845 1846 this.x = x; 1847 this.y = y; 1848 this.width = width; 1849 this.height = height; 1850 this.scale = scale; 1851 } 1852 1853 /** 1854 * JSON Object Constructor 1855 * @param jo A Json-Object having data about an instance of {@code 'Viewport'}. 1856 */ 1857 public Viewport (JsonObject jo) 1858 { 1859 this.x = ReadJSON.getNUMBER(jo, "x", false, true); 1860 this.y = ReadJSON.getNUMBER(jo, "y", false, true); 1861 this.width = ReadJSON.getNUMBER(jo, "width", false, true); 1862 this.height = ReadJSON.getNUMBER(jo, "height", false, true); 1863 this.scale = ReadJSON.getNUMBER(jo, "scale", false, true); 1864 } 1865 1866 } 1867 1868 /** 1869 * Generic font families collection. 1870 * <BR /> 1871 * <BR /><B>EXPERIMENTAL</B> 1872 */ 1873 public static class FontFamilies extends BaseType 1874 { 1875 /** For Object Serialization. java.io.Serializable */ 1876 protected static final long serialVersionUID = 1; 1877 1878 public boolean[] optionals() 1879 { return new boolean[] { true, true, true, true, true, true, true, }; } 1880 1881 /** 1882 * The standard font-family. 1883 * <BR /> 1884 * <BR /><B>OPTIONAL</B> 1885 */ 1886 public final String standard; 1887 1888 /** 1889 * The fixed font-family. 1890 * <BR /> 1891 * <BR /><B>OPTIONAL</B> 1892 */ 1893 public final String fixed; 1894 1895 /** 1896 * The serif font-family. 1897 * <BR /> 1898 * <BR /><B>OPTIONAL</B> 1899 */ 1900 public final String serif; 1901 1902 /** 1903 * The sansSerif font-family. 1904 * <BR /> 1905 * <BR /><B>OPTIONAL</B> 1906 */ 1907 public final String sansSerif; 1908 1909 /** 1910 * The cursive font-family. 1911 * <BR /> 1912 * <BR /><B>OPTIONAL</B> 1913 */ 1914 public final String cursive; 1915 1916 /** 1917 * The fantasy font-family. 1918 * <BR /> 1919 * <BR /><B>OPTIONAL</B> 1920 */ 1921 public final String fantasy; 1922 1923 /** 1924 * The pictograph font-family. 1925 * <BR /> 1926 * <BR /><B>OPTIONAL</B> 1927 */ 1928 public final String pictograph; 1929 1930 /** 1931 * Constructor 1932 * 1933 * @param standard The standard font-family. 1934 * <BR /><B>OPTIONAL</B> 1935 * 1936 * @param fixed The fixed font-family. 1937 * <BR /><B>OPTIONAL</B> 1938 * 1939 * @param serif The serif font-family. 1940 * <BR /><B>OPTIONAL</B> 1941 * 1942 * @param sansSerif The sansSerif font-family. 1943 * <BR /><B>OPTIONAL</B> 1944 * 1945 * @param cursive The cursive font-family. 1946 * <BR /><B>OPTIONAL</B> 1947 * 1948 * @param fantasy The fantasy font-family. 1949 * <BR /><B>OPTIONAL</B> 1950 * 1951 * @param pictograph The pictograph font-family. 1952 * <BR /><B>OPTIONAL</B> 1953 */ 1954 public FontFamilies( 1955 String standard, String fixed, String serif, String sansSerif, String cursive, 1956 String fantasy, String pictograph 1957 ) 1958 { 1959 this.standard = standard; 1960 this.fixed = fixed; 1961 this.serif = serif; 1962 this.sansSerif = sansSerif; 1963 this.cursive = cursive; 1964 this.fantasy = fantasy; 1965 this.pictograph = pictograph; 1966 } 1967 1968 /** 1969 * JSON Object Constructor 1970 * @param jo A Json-Object having data about an instance of {@code 'FontFamilies'}. 1971 */ 1972 public FontFamilies (JsonObject jo) 1973 { 1974 this.standard = ReadJSON.getString(jo, "standard", true, false); 1975 this.fixed = ReadJSON.getString(jo, "fixed", true, false); 1976 this.serif = ReadJSON.getString(jo, "serif", true, false); 1977 this.sansSerif = ReadJSON.getString(jo, "sansSerif", true, false); 1978 this.cursive = ReadJSON.getString(jo, "cursive", true, false); 1979 this.fantasy = ReadJSON.getString(jo, "fantasy", true, false); 1980 this.pictograph = ReadJSON.getString(jo, "pictograph", true, false); 1981 } 1982 1983 } 1984 1985 /** 1986 * Default font sizes. 1987 * <BR /> 1988 * <BR /><B>EXPERIMENTAL</B> 1989 */ 1990 public static class FontSizes extends BaseType 1991 { 1992 /** For Object Serialization. java.io.Serializable */ 1993 protected static final long serialVersionUID = 1; 1994 1995 public boolean[] optionals() 1996 { return new boolean[] { true, true, }; } 1997 1998 /** 1999 * Default standard font size. 2000 * <BR /> 2001 * <BR /><B>OPTIONAL</B> 2002 */ 2003 public final Integer standard; 2004 2005 /** 2006 * Default fixed font size. 2007 * <BR /> 2008 * <BR /><B>OPTIONAL</B> 2009 */ 2010 public final Integer fixed; 2011 2012 /** 2013 * Constructor 2014 * 2015 * @param standard Default standard font size. 2016 * <BR /><B>OPTIONAL</B> 2017 * 2018 * @param fixed Default fixed font size. 2019 * <BR /><B>OPTIONAL</B> 2020 */ 2021 public FontSizes(Integer standard, Integer fixed) 2022 { 2023 this.standard = standard; 2024 this.fixed = fixed; 2025 } 2026 2027 /** 2028 * JSON Object Constructor 2029 * @param jo A Json-Object having data about an instance of {@code 'FontSizes'}. 2030 */ 2031 public FontSizes (JsonObject jo) 2032 { 2033 this.standard = ReadJSON.getINTEGER(jo, "standard", true); 2034 this.fixed = ReadJSON.getINTEGER(jo, "fixed", true); 2035 } 2036 2037 } 2038 2039 /** 2040 * <CODE>[No Description Provided by Google]</CODE> 2041 * <BR /> 2042 * <BR /><B>EXPERIMENTAL</B> 2043 */ 2044 public static class InstallabilityErrorArgument extends BaseType 2045 { 2046 /** For Object Serialization. java.io.Serializable */ 2047 protected static final long serialVersionUID = 1; 2048 2049 public boolean[] optionals() 2050 { return new boolean[] { false, false, }; } 2051 2052 /** Argument name (e.g. name:'minimum-icon-size-in-pixels'). */ 2053 public final String name; 2054 2055 /** Argument value (e.g. value:'64'). */ 2056 public final String value; 2057 2058 /** 2059 * Constructor 2060 * 2061 * @param name Argument name (e.g. name:'minimum-icon-size-in-pixels'). 2062 * 2063 * @param value Argument value (e.g. value:'64'). 2064 */ 2065 public InstallabilityErrorArgument(String name, String value) 2066 { 2067 // Exception-Check(s) to ensure that if any parameters which are not declared as 2068 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2069 2070 if (name == null) BRDPC.throwNPE("name"); 2071 if (value == null) BRDPC.throwNPE("value"); 2072 2073 this.name = name; 2074 this.value = value; 2075 } 2076 2077 /** 2078 * JSON Object Constructor 2079 * @param jo A Json-Object having data about an instance of {@code 'InstallabilityErrorArgument'}. 2080 */ 2081 public InstallabilityErrorArgument (JsonObject jo) 2082 { 2083 this.name = ReadJSON.getString(jo, "name", false, true); 2084 this.value = ReadJSON.getString(jo, "value", false, true); 2085 } 2086 2087 } 2088 2089 /** 2090 * The installability error 2091 * <BR /> 2092 * <BR /><B>EXPERIMENTAL</B> 2093 */ 2094 public static class InstallabilityError extends BaseType 2095 { 2096 /** For Object Serialization. java.io.Serializable */ 2097 protected static final long serialVersionUID = 1; 2098 2099 public boolean[] optionals() 2100 { return new boolean[] { false, false, }; } 2101 2102 /** The error id (e.g. 'manifest-missing-suitable-icon'). */ 2103 public final String errorId; 2104 2105 /** The list of error arguments (e.g. {name:'minimum-icon-size-in-pixels', value:'64'}). */ 2106 public final Page.InstallabilityErrorArgument[] errorArguments; 2107 2108 /** 2109 * Constructor 2110 * 2111 * @param errorId The error id (e.g. 'manifest-missing-suitable-icon'). 2112 * 2113 * @param errorArguments The list of error arguments (e.g. {name:'minimum-icon-size-in-pixels', value:'64'}). 2114 */ 2115 public InstallabilityError 2116 (String errorId, Page.InstallabilityErrorArgument[] errorArguments) 2117 { 2118 // Exception-Check(s) to ensure that if any parameters which are not declared as 2119 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2120 2121 if (errorId == null) BRDPC.throwNPE("errorId"); 2122 if (errorArguments == null) BRDPC.throwNPE("errorArguments"); 2123 2124 this.errorId = errorId; 2125 this.errorArguments = errorArguments; 2126 } 2127 2128 /** 2129 * JSON Object Constructor 2130 * @param jo A Json-Object having data about an instance of {@code 'InstallabilityError'}. 2131 */ 2132 public InstallabilityError (JsonObject jo) 2133 { 2134 this.errorId = ReadJSON.getString(jo, "errorId", false, true); 2135 this.errorArguments = (jo.getJsonArray("errorArguments") == null) 2136 ? null 2137 : ReadArrJSON.DimN.objArr(jo.getJsonArray("errorArguments"), null, 0, Page.InstallabilityErrorArgument[].class); 2138 } 2139 2140 } 2141 2142 /** 2143 * Per-script compilation cache parameters for <CODE>Page.produceCompilationCache</CODE> 2144 * <BR /> 2145 * <BR /><B>EXPERIMENTAL</B> 2146 */ 2147 public static class CompilationCacheParams extends BaseType 2148 { 2149 /** For Object Serialization. java.io.Serializable */ 2150 protected static final long serialVersionUID = 1; 2151 2152 public boolean[] optionals() 2153 { return new boolean[] { false, true, }; } 2154 2155 /** The URL of the script to produce a compilation cache entry for. */ 2156 public final String url; 2157 2158 /** 2159 * A hint to the backend whether eager compilation is recommended. 2160 * (the actual compilation mode used is upon backend discretion). 2161 * <BR /> 2162 * <BR /><B>OPTIONAL</B> 2163 */ 2164 public final Boolean eager; 2165 2166 /** 2167 * Constructor 2168 * 2169 * @param url The URL of the script to produce a compilation cache entry for. 2170 * 2171 * @param eager 2172 * A hint to the backend whether eager compilation is recommended. 2173 * (the actual compilation mode used is upon backend discretion). 2174 * <BR /><B>OPTIONAL</B> 2175 */ 2176 public CompilationCacheParams(String url, Boolean eager) 2177 { 2178 // Exception-Check(s) to ensure that if any parameters which are not declared as 2179 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2180 2181 if (url == null) BRDPC.throwNPE("url"); 2182 2183 this.url = url; 2184 this.eager = eager; 2185 } 2186 2187 /** 2188 * JSON Object Constructor 2189 * @param jo A Json-Object having data about an instance of {@code 'CompilationCacheParams'}. 2190 */ 2191 public CompilationCacheParams (JsonObject jo) 2192 { 2193 this.url = ReadJSON.getString(jo, "url", false, true); 2194 this.eager = ReadJSON.getBOOLEAN(jo, "eager", true); 2195 } 2196 2197 } 2198 2199 /** 2200 * <CODE>[No Description Provided by Google]</CODE> 2201 * <BR /> 2202 * <BR /><B>EXPERIMENTAL</B> 2203 */ 2204 public static class BackForwardCacheNotRestoredExplanation extends BaseType 2205 { 2206 /** For Object Serialization. java.io.Serializable */ 2207 protected static final long serialVersionUID = 1; 2208 2209 public boolean[] optionals() 2210 { return new boolean[] { false, false, }; } 2211 2212 /** Type of the reason */ 2213 public final String type; 2214 2215 /** Not restored reason */ 2216 public final String reason; 2217 2218 /** 2219 * Constructor 2220 * 2221 * @param type Type of the reason 2222 * 2223 * @param reason Not restored reason 2224 */ 2225 public BackForwardCacheNotRestoredExplanation(String type, String reason) 2226 { 2227 // Exception-Check(s) to ensure that if any parameters which are not declared as 2228 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2229 2230 if (type == null) BRDPC.throwNPE("type"); 2231 if (reason == null) BRDPC.throwNPE("reason"); 2232 2233 // Exception-Check(s) to ensure that if any parameters which must adhere to a 2234 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 2235 2236 BRDPC.checkIAE("type", type, "Page.BackForwardCacheNotRestoredReasonType", Page.BackForwardCacheNotRestoredReasonType); 2237 BRDPC.checkIAE("reason", reason, "Page.BackForwardCacheNotRestoredReason", Page.BackForwardCacheNotRestoredReason); 2238 2239 this.type = type; 2240 this.reason = reason; 2241 } 2242 2243 /** 2244 * JSON Object Constructor 2245 * @param jo A Json-Object having data about an instance of {@code 'BackForwardCacheNotRestoredExplanation'}. 2246 */ 2247 public BackForwardCacheNotRestoredExplanation (JsonObject jo) 2248 { 2249 this.type = ReadJSON.getString(jo, "type", false, true); 2250 this.reason = ReadJSON.getString(jo, "reason", false, true); 2251 } 2252 2253 } 2254 2255 /** 2256 * - 2257 * <BR /> 2258 * <BR /><B>EXPERIMENTAL</B> 2259 * 2260 * <BR /><BR />This is Marker-Event. Marker-Event's are Events that do not posses 2261 * any data, fields or state. When they are fired, only the event name is supplied. 2262 */ 2263 public static class frameResized extends BrowserEvent 2264 { 2265 /** For Object Serialization. java.io.Serializable */ 2266 protected static final long serialVersionUID = 1; 2267 2268 public boolean[] optionals() { return new boolean[0]; } 2269 2270 /** JSON Object Constructor */ 2271 public frameResized(JsonObject jo) 2272 { super("Page", "frameResized", 0); } 2273 2274 @Override 2275 public String toString() { return "Page.frameResized Marker Event\n"; } 2276 } 2277 2278 /** 2279 * Fired when interstitial page was hidden 2280 * 2281 * <BR /><BR />This is Marker-Event. Marker-Event's are Events that do not posses 2282 * any data, fields or state. When they are fired, only the event name is supplied. 2283 */ 2284 public static class interstitialHidden extends BrowserEvent 2285 { 2286 /** For Object Serialization. java.io.Serializable */ 2287 protected static final long serialVersionUID = 1; 2288 2289 public boolean[] optionals() { return new boolean[0]; } 2290 2291 /** JSON Object Constructor */ 2292 public interstitialHidden(JsonObject jo) 2293 { super("Page", "interstitialHidden", 0); } 2294 2295 @Override 2296 public String toString() { return "Page.interstitialHidden Marker Event\n"; } 2297 } 2298 2299 /** 2300 * Fired when interstitial page was shown 2301 * 2302 * <BR /><BR />This is Marker-Event. Marker-Event's are Events that do not posses 2303 * any data, fields or state. When they are fired, only the event name is supplied. 2304 */ 2305 public static class interstitialShown extends BrowserEvent 2306 { 2307 /** For Object Serialization. java.io.Serializable */ 2308 protected static final long serialVersionUID = 1; 2309 2310 public boolean[] optionals() { return new boolean[0]; } 2311 2312 /** JSON Object Constructor */ 2313 public interstitialShown(JsonObject jo) 2314 { super("Page", "interstitialShown", 0); } 2315 2316 @Override 2317 public String toString() { return "Page.interstitialShown Marker Event\n"; } 2318 } 2319 2320 /** <CODE>[No Description Provided by Google]</CODE> */ 2321 public static class domContentEventFired extends BrowserEvent 2322 { 2323 /** For Object Serialization. java.io.Serializable */ 2324 protected static final long serialVersionUID = 1; 2325 2326 public boolean[] optionals() 2327 { return new boolean[] { false, }; } 2328 2329 /** <CODE>[No Description Provided by Google]</CODE> */ 2330 public final Number timestamp; 2331 2332 /** 2333 * Constructor 2334 * 2335 * @param timestamp - 2336 */ 2337 public domContentEventFired(Number timestamp) 2338 { 2339 super("Page", "domContentEventFired", 1); 2340 2341 // Exception-Check(s) to ensure that if any parameters which are not declared as 2342 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2343 2344 if (timestamp == null) BRDPC.throwNPE("timestamp"); 2345 2346 this.timestamp = timestamp; 2347 } 2348 2349 /** 2350 * JSON Object Constructor 2351 * @param jo A Json-Object having data about an instance of {@code 'domContentEventFired'}. 2352 */ 2353 public domContentEventFired (JsonObject jo) 2354 { 2355 super("Page", "domContentEventFired", 1); 2356 2357 this.timestamp = ReadJSON.getNUMBER(jo, "timestamp", false, true); 2358 } 2359 2360 } 2361 2362 /** Emitted only when <CODE>page.interceptFileChooser</CODE> is enabled. */ 2363 public static class fileChooserOpened extends BrowserEvent 2364 { 2365 /** For Object Serialization. java.io.Serializable */ 2366 protected static final long serialVersionUID = 1; 2367 2368 public boolean[] optionals() 2369 { return new boolean[] { false, false, false, }; } 2370 2371 /** 2372 * Id of the frame containing input node. 2373 * <BR /> 2374 * <BR /><B>EXPERIMENTAL</B> 2375 */ 2376 public final String frameId; 2377 2378 /** 2379 * Input node id. 2380 * <BR /> 2381 * <BR /><B>EXPERIMENTAL</B> 2382 */ 2383 public final int backendNodeId; 2384 2385 /** Input mode. */ 2386 public final String mode; 2387 2388 /** 2389 * Constructor 2390 * 2391 * @param frameId Id of the frame containing input node. 2392 * <BR /><B>EXPERIMENTAL</B> 2393 * 2394 * @param backendNodeId Input node id. 2395 * <BR /><B>EXPERIMENTAL</B> 2396 * 2397 * @param mode Input mode. 2398 * <BR />Acceptable Values: ["selectSingle", "selectMultiple"] 2399 */ 2400 public fileChooserOpened(String frameId, int backendNodeId, String mode) 2401 { 2402 super("Page", "fileChooserOpened", 3); 2403 2404 // Exception-Check(s) to ensure that if any parameters which are not declared as 2405 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2406 2407 if (frameId == null) BRDPC.throwNPE("frameId"); 2408 if (mode == null) BRDPC.throwNPE("mode"); 2409 2410 // Exception-Check(s) to ensure that if any parameters which must adhere to a 2411 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 2412 2413 BRDPC.checkIAE( 2414 "mode", mode, 2415 "selectSingle", "selectMultiple" 2416 ); 2417 2418 this.frameId = frameId; 2419 this.backendNodeId = backendNodeId; 2420 this.mode = mode; 2421 } 2422 2423 /** 2424 * JSON Object Constructor 2425 * @param jo A Json-Object having data about an instance of {@code 'fileChooserOpened'}. 2426 */ 2427 public fileChooserOpened (JsonObject jo) 2428 { 2429 super("Page", "fileChooserOpened", 3); 2430 2431 this.frameId = ReadJSON.getString(jo, "frameId", false, true); 2432 this.backendNodeId = ReadJSON.getInt(jo, "backendNodeId"); 2433 this.mode = ReadJSON.getString(jo, "mode", false, true); 2434 } 2435 2436 } 2437 2438 /** Fired when frame has been attached to its parent. */ 2439 public static class frameAttached extends BrowserEvent 2440 { 2441 /** For Object Serialization. java.io.Serializable */ 2442 protected static final long serialVersionUID = 1; 2443 2444 public boolean[] optionals() 2445 { return new boolean[] { false, false, true, }; } 2446 2447 /** Id of the frame that has been attached. */ 2448 public final String frameId; 2449 2450 /** Parent frame identifier. */ 2451 public final String parentFrameId; 2452 2453 /** 2454 * JavaScript stack trace of when frame was attached, only set if frame initiated from script. 2455 * <BR /> 2456 * <BR /><B>OPTIONAL</B> 2457 */ 2458 public final RunTime.StackTrace stack; 2459 2460 /** 2461 * Constructor 2462 * 2463 * @param frameId Id of the frame that has been attached. 2464 * 2465 * @param parentFrameId Parent frame identifier. 2466 * 2467 * @param stack JavaScript stack trace of when frame was attached, only set if frame initiated from script. 2468 * <BR /><B>OPTIONAL</B> 2469 */ 2470 public frameAttached(String frameId, String parentFrameId, RunTime.StackTrace stack) 2471 { 2472 super("Page", "frameAttached", 3); 2473 2474 // Exception-Check(s) to ensure that if any parameters which are not declared as 2475 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2476 2477 if (frameId == null) BRDPC.throwNPE("frameId"); 2478 if (parentFrameId == null) BRDPC.throwNPE("parentFrameId"); 2479 2480 this.frameId = frameId; 2481 this.parentFrameId = parentFrameId; 2482 this.stack = stack; 2483 } 2484 2485 /** 2486 * JSON Object Constructor 2487 * @param jo A Json-Object having data about an instance of {@code 'frameAttached'}. 2488 */ 2489 public frameAttached (JsonObject jo) 2490 { 2491 super("Page", "frameAttached", 3); 2492 2493 this.frameId = ReadJSON.getString(jo, "frameId", false, true); 2494 this.parentFrameId = ReadJSON.getString(jo, "parentFrameId", false, true); 2495 this.stack = ReadJSON.XL.getObject(jo, "stack", RunTime.StackTrace.class, true, false); 2496 } 2497 2498 } 2499 2500 /** 2501 * Fired when frame no longer has a scheduled navigation. 2502 * <BR /> 2503 * <BR /><B>DEPRECATED</B> 2504 */ 2505 public static class frameClearedScheduledNavigation extends BrowserEvent 2506 { 2507 /** For Object Serialization. java.io.Serializable */ 2508 protected static final long serialVersionUID = 1; 2509 2510 public boolean[] optionals() 2511 { return new boolean[] { false, }; } 2512 2513 /** Id of the frame that has cleared its scheduled navigation. */ 2514 public final String frameId; 2515 2516 /** 2517 * Constructor 2518 * 2519 * @param frameId Id of the frame that has cleared its scheduled navigation. 2520 */ 2521 public frameClearedScheduledNavigation(String frameId) 2522 { 2523 super("Page", "frameClearedScheduledNavigation", 1); 2524 2525 // Exception-Check(s) to ensure that if any parameters which are not declared as 2526 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2527 2528 if (frameId == null) BRDPC.throwNPE("frameId"); 2529 2530 this.frameId = frameId; 2531 } 2532 2533 /** 2534 * JSON Object Constructor 2535 * @param jo A Json-Object having data about an instance of {@code 'frameClearedScheduledNavigation'}. 2536 */ 2537 public frameClearedScheduledNavigation (JsonObject jo) 2538 { 2539 super("Page", "frameClearedScheduledNavigation", 1); 2540 2541 this.frameId = ReadJSON.getString(jo, "frameId", false, true); 2542 } 2543 2544 } 2545 2546 /** Fired when frame has been detached from its parent. */ 2547 public static class frameDetached extends BrowserEvent 2548 { 2549 /** For Object Serialization. java.io.Serializable */ 2550 protected static final long serialVersionUID = 1; 2551 2552 public boolean[] optionals() 2553 { return new boolean[] { false, false, }; } 2554 2555 /** Id of the frame that has been detached. */ 2556 public final String frameId; 2557 2558 /** 2559 * <CODE>[No Description Provided by Google]</CODE> 2560 * <BR /> 2561 * <BR /><B>EXPERIMENTAL</B> 2562 */ 2563 public final String reason; 2564 2565 /** 2566 * Constructor 2567 * 2568 * @param frameId Id of the frame that has been detached. 2569 * 2570 * @param reason - 2571 * <BR />Acceptable Values: ["remove", "swap"] 2572 * <BR /><B>EXPERIMENTAL</B> 2573 */ 2574 public frameDetached(String frameId, String reason) 2575 { 2576 super("Page", "frameDetached", 2); 2577 2578 // Exception-Check(s) to ensure that if any parameters which are not declared as 2579 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2580 2581 if (frameId == null) BRDPC.throwNPE("frameId"); 2582 if (reason == null) BRDPC.throwNPE("reason"); 2583 2584 // Exception-Check(s) to ensure that if any parameters which must adhere to a 2585 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 2586 2587 BRDPC.checkIAE( 2588 "reason", reason, 2589 "remove", "swap" 2590 ); 2591 2592 this.frameId = frameId; 2593 this.reason = reason; 2594 } 2595 2596 /** 2597 * JSON Object Constructor 2598 * @param jo A Json-Object having data about an instance of {@code 'frameDetached'}. 2599 */ 2600 public frameDetached (JsonObject jo) 2601 { 2602 super("Page", "frameDetached", 2); 2603 2604 this.frameId = ReadJSON.getString(jo, "frameId", false, true); 2605 this.reason = ReadJSON.getString(jo, "reason", false, true); 2606 } 2607 2608 } 2609 2610 /** Fired once navigation of the frame has completed. Frame is now associated with the new loader. */ 2611 public static class frameNavigated extends BrowserEvent 2612 { 2613 /** For Object Serialization. java.io.Serializable */ 2614 protected static final long serialVersionUID = 1; 2615 2616 public boolean[] optionals() 2617 { return new boolean[] { false, false, }; } 2618 2619 /** Frame object. */ 2620 public final Page.Frame frame; 2621 2622 /** 2623 * <CODE>[No Description Provided by Google]</CODE> 2624 * <BR /> 2625 * <BR /><B>EXPERIMENTAL</B> 2626 */ 2627 public final String type; 2628 2629 /** 2630 * Constructor 2631 * 2632 * @param frame Frame object. 2633 * 2634 * @param type - 2635 * <BR /><B>EXPERIMENTAL</B> 2636 */ 2637 public frameNavigated(Page.Frame frame, String type) 2638 { 2639 super("Page", "frameNavigated", 2); 2640 2641 // Exception-Check(s) to ensure that if any parameters which are not declared as 2642 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2643 2644 if (frame == null) BRDPC.throwNPE("frame"); 2645 if (type == null) BRDPC.throwNPE("type"); 2646 2647 // Exception-Check(s) to ensure that if any parameters which must adhere to a 2648 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 2649 2650 BRDPC.checkIAE("type", type, "Page.NavigationType", Page.NavigationType); 2651 2652 this.frame = frame; 2653 this.type = type; 2654 } 2655 2656 /** 2657 * JSON Object Constructor 2658 * @param jo A Json-Object having data about an instance of {@code 'frameNavigated'}. 2659 */ 2660 public frameNavigated (JsonObject jo) 2661 { 2662 super("Page", "frameNavigated", 2); 2663 2664 this.frame = ReadJSON.XL.getObject(jo, "frame", Page.Frame.class, false, true); 2665 this.type = ReadJSON.getString(jo, "type", false, true); 2666 } 2667 2668 } 2669 2670 /** 2671 * Fired when opening document to write to. 2672 * <BR /> 2673 * <BR /><B>EXPERIMENTAL</B> 2674 */ 2675 public static class documentOpened extends BrowserEvent 2676 { 2677 /** For Object Serialization. java.io.Serializable */ 2678 protected static final long serialVersionUID = 1; 2679 2680 public boolean[] optionals() 2681 { return new boolean[] { false, }; } 2682 2683 /** Frame object. */ 2684 public final Page.Frame frame; 2685 2686 /** 2687 * Constructor 2688 * 2689 * @param frame Frame object. 2690 */ 2691 public documentOpened(Page.Frame frame) 2692 { 2693 super("Page", "documentOpened", 1); 2694 2695 // Exception-Check(s) to ensure that if any parameters which are not declared as 2696 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2697 2698 if (frame == null) BRDPC.throwNPE("frame"); 2699 2700 this.frame = frame; 2701 } 2702 2703 /** 2704 * JSON Object Constructor 2705 * @param jo A Json-Object having data about an instance of {@code 'documentOpened'}. 2706 */ 2707 public documentOpened (JsonObject jo) 2708 { 2709 super("Page", "documentOpened", 1); 2710 2711 this.frame = ReadJSON.XL.getObject(jo, "frame", Page.Frame.class, false, true); 2712 } 2713 2714 } 2715 2716 /** 2717 * Fired when a renderer-initiated navigation is requested. 2718 * Navigation may still be cancelled after the event is issued. 2719 * <BR /> 2720 * <BR /><B>EXPERIMENTAL</B> 2721 */ 2722 public static class frameRequestedNavigation extends BrowserEvent 2723 { 2724 /** For Object Serialization. java.io.Serializable */ 2725 protected static final long serialVersionUID = 1; 2726 2727 public boolean[] optionals() 2728 { return new boolean[] { false, false, false, false, }; } 2729 2730 /** Id of the frame that is being navigated. */ 2731 public final String frameId; 2732 2733 /** The reason for the navigation. */ 2734 public final String reason; 2735 2736 /** The destination URL for the requested navigation. */ 2737 public final String url; 2738 2739 /** The disposition for the navigation. */ 2740 public final String disposition; 2741 2742 /** 2743 * Constructor 2744 * 2745 * @param frameId Id of the frame that is being navigated. 2746 * 2747 * @param reason The reason for the navigation. 2748 * 2749 * @param url The destination URL for the requested navigation. 2750 * 2751 * @param disposition The disposition for the navigation. 2752 */ 2753 public frameRequestedNavigation 2754 (String frameId, String reason, String url, String disposition) 2755 { 2756 super("Page", "frameRequestedNavigation", 4); 2757 2758 // Exception-Check(s) to ensure that if any parameters which are not declared as 2759 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2760 2761 if (frameId == null) BRDPC.throwNPE("frameId"); 2762 if (reason == null) BRDPC.throwNPE("reason"); 2763 if (url == null) BRDPC.throwNPE("url"); 2764 if (disposition == null) BRDPC.throwNPE("disposition"); 2765 2766 // Exception-Check(s) to ensure that if any parameters which must adhere to a 2767 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 2768 2769 BRDPC.checkIAE("reason", reason, "Page.ClientNavigationReason", Page.ClientNavigationReason); 2770 BRDPC.checkIAE("disposition", disposition, "Page.ClientNavigationDisposition", Page.ClientNavigationDisposition); 2771 2772 this.frameId = frameId; 2773 this.reason = reason; 2774 this.url = url; 2775 this.disposition = disposition; 2776 } 2777 2778 /** 2779 * JSON Object Constructor 2780 * @param jo A Json-Object having data about an instance of {@code 'frameRequestedNavigation'}. 2781 */ 2782 public frameRequestedNavigation (JsonObject jo) 2783 { 2784 super("Page", "frameRequestedNavigation", 4); 2785 2786 this.frameId = ReadJSON.getString(jo, "frameId", false, true); 2787 this.reason = ReadJSON.getString(jo, "reason", false, true); 2788 this.url = ReadJSON.getString(jo, "url", false, true); 2789 this.disposition = ReadJSON.getString(jo, "disposition", false, true); 2790 } 2791 2792 } 2793 2794 /** 2795 * Fired when frame schedules a potential navigation. 2796 * <BR /> 2797 * <BR /><B>DEPRECATED</B> 2798 */ 2799 public static class frameScheduledNavigation extends BrowserEvent 2800 { 2801 /** For Object Serialization. java.io.Serializable */ 2802 protected static final long serialVersionUID = 1; 2803 2804 public boolean[] optionals() 2805 { return new boolean[] { false, false, false, false, }; } 2806 2807 /** Id of the frame that has scheduled a navigation. */ 2808 public final String frameId; 2809 2810 /** 2811 * Delay (in seconds) until the navigation is scheduled to begin. The navigation is not 2812 * guaranteed to start. 2813 */ 2814 public final Number delay; 2815 2816 /** The reason for the navigation. */ 2817 public final String reason; 2818 2819 /** The destination URL for the scheduled navigation. */ 2820 public final String url; 2821 2822 /** 2823 * Constructor 2824 * 2825 * @param frameId Id of the frame that has scheduled a navigation. 2826 * 2827 * @param delay 2828 * Delay (in seconds) until the navigation is scheduled to begin. The navigation is not 2829 * guaranteed to start. 2830 * 2831 * @param reason The reason for the navigation. 2832 * 2833 * @param url The destination URL for the scheduled navigation. 2834 */ 2835 public frameScheduledNavigation(String frameId, Number delay, String reason, String url) 2836 { 2837 super("Page", "frameScheduledNavigation", 4); 2838 2839 // Exception-Check(s) to ensure that if any parameters which are not declared as 2840 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2841 2842 if (frameId == null) BRDPC.throwNPE("frameId"); 2843 if (delay == null) BRDPC.throwNPE("delay"); 2844 if (reason == null) BRDPC.throwNPE("reason"); 2845 if (url == null) BRDPC.throwNPE("url"); 2846 2847 // Exception-Check(s) to ensure that if any parameters which must adhere to a 2848 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 2849 2850 BRDPC.checkIAE("reason", reason, "Page.ClientNavigationReason", Page.ClientNavigationReason); 2851 2852 this.frameId = frameId; 2853 this.delay = delay; 2854 this.reason = reason; 2855 this.url = url; 2856 } 2857 2858 /** 2859 * JSON Object Constructor 2860 * @param jo A Json-Object having data about an instance of {@code 'frameScheduledNavigation'}. 2861 */ 2862 public frameScheduledNavigation (JsonObject jo) 2863 { 2864 super("Page", "frameScheduledNavigation", 4); 2865 2866 this.frameId = ReadJSON.getString(jo, "frameId", false, true); 2867 this.delay = ReadJSON.getNUMBER(jo, "delay", false, true); 2868 this.reason = ReadJSON.getString(jo, "reason", false, true); 2869 this.url = ReadJSON.getString(jo, "url", false, true); 2870 } 2871 2872 } 2873 2874 /** 2875 * Fired when frame has started loading. 2876 * <BR /> 2877 * <BR /><B>EXPERIMENTAL</B> 2878 */ 2879 public static class frameStartedLoading extends BrowserEvent 2880 { 2881 /** For Object Serialization. java.io.Serializable */ 2882 protected static final long serialVersionUID = 1; 2883 2884 public boolean[] optionals() 2885 { return new boolean[] { false, }; } 2886 2887 /** Id of the frame that has started loading. */ 2888 public final String frameId; 2889 2890 /** 2891 * Constructor 2892 * 2893 * @param frameId Id of the frame that has started loading. 2894 */ 2895 public frameStartedLoading(String frameId) 2896 { 2897 super("Page", "frameStartedLoading", 1); 2898 2899 // Exception-Check(s) to ensure that if any parameters which are not declared as 2900 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2901 2902 if (frameId == null) BRDPC.throwNPE("frameId"); 2903 2904 this.frameId = frameId; 2905 } 2906 2907 /** 2908 * JSON Object Constructor 2909 * @param jo A Json-Object having data about an instance of {@code 'frameStartedLoading'}. 2910 */ 2911 public frameStartedLoading (JsonObject jo) 2912 { 2913 super("Page", "frameStartedLoading", 1); 2914 2915 this.frameId = ReadJSON.getString(jo, "frameId", false, true); 2916 } 2917 2918 } 2919 2920 /** 2921 * Fired when frame has stopped loading. 2922 * <BR /> 2923 * <BR /><B>EXPERIMENTAL</B> 2924 */ 2925 public static class frameStoppedLoading extends BrowserEvent 2926 { 2927 /** For Object Serialization. java.io.Serializable */ 2928 protected static final long serialVersionUID = 1; 2929 2930 public boolean[] optionals() 2931 { return new boolean[] { false, }; } 2932 2933 /** Id of the frame that has stopped loading. */ 2934 public final String frameId; 2935 2936 /** 2937 * Constructor 2938 * 2939 * @param frameId Id of the frame that has stopped loading. 2940 */ 2941 public frameStoppedLoading(String frameId) 2942 { 2943 super("Page", "frameStoppedLoading", 1); 2944 2945 // Exception-Check(s) to ensure that if any parameters which are not declared as 2946 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2947 2948 if (frameId == null) BRDPC.throwNPE("frameId"); 2949 2950 this.frameId = frameId; 2951 } 2952 2953 /** 2954 * JSON Object Constructor 2955 * @param jo A Json-Object having data about an instance of {@code 'frameStoppedLoading'}. 2956 */ 2957 public frameStoppedLoading (JsonObject jo) 2958 { 2959 super("Page", "frameStoppedLoading", 1); 2960 2961 this.frameId = ReadJSON.getString(jo, "frameId", false, true); 2962 } 2963 2964 } 2965 2966 /** 2967 * Fired when page is about to start a download. 2968 * Deprecated. Use Browser.downloadWillBegin instead. 2969 * <BR /> 2970 * <BR /><B>EXPERIMENTAL</B> 2971 * <BR /><B>DEPRECATED</B> 2972 */ 2973 public static class downloadWillBegin extends BrowserEvent 2974 { 2975 /** For Object Serialization. java.io.Serializable */ 2976 protected static final long serialVersionUID = 1; 2977 2978 public boolean[] optionals() 2979 { return new boolean[] { false, false, false, false, }; } 2980 2981 /** Id of the frame that caused download to begin. */ 2982 public final String frameId; 2983 2984 /** Global unique identifier of the download. */ 2985 public final String guid; 2986 2987 /** URL of the resource being downloaded. */ 2988 public final String url; 2989 2990 /** Suggested file name of the resource (the actual name of the file saved on disk may differ). */ 2991 public final String suggestedFilename; 2992 2993 /** 2994 * Constructor 2995 * 2996 * @param frameId Id of the frame that caused download to begin. 2997 * 2998 * @param guid Global unique identifier of the download. 2999 * 3000 * @param url URL of the resource being downloaded. 3001 * 3002 * @param suggestedFilename Suggested file name of the resource (the actual name of the file saved on disk may differ). 3003 */ 3004 public downloadWillBegin 3005 (String frameId, String guid, String url, String suggestedFilename) 3006 { 3007 super("Page", "downloadWillBegin", 4); 3008 3009 // Exception-Check(s) to ensure that if any parameters which are not declared as 3010 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3011 3012 if (frameId == null) BRDPC.throwNPE("frameId"); 3013 if (guid == null) BRDPC.throwNPE("guid"); 3014 if (url == null) BRDPC.throwNPE("url"); 3015 if (suggestedFilename == null) BRDPC.throwNPE("suggestedFilename"); 3016 3017 this.frameId = frameId; 3018 this.guid = guid; 3019 this.url = url; 3020 this.suggestedFilename = suggestedFilename; 3021 } 3022 3023 /** 3024 * JSON Object Constructor 3025 * @param jo A Json-Object having data about an instance of {@code 'downloadWillBegin'}. 3026 */ 3027 public downloadWillBegin (JsonObject jo) 3028 { 3029 super("Page", "downloadWillBegin", 4); 3030 3031 this.frameId = ReadJSON.getString(jo, "frameId", false, true); 3032 this.guid = ReadJSON.getString(jo, "guid", false, true); 3033 this.url = ReadJSON.getString(jo, "url", false, true); 3034 this.suggestedFilename = ReadJSON.getString(jo, "suggestedFilename", false, true); 3035 } 3036 3037 } 3038 3039 /** 3040 * Fired when download makes progress. Last call has |done| == true. 3041 * Deprecated. Use Browser.downloadProgress instead. 3042 * <BR /> 3043 * <BR /><B>EXPERIMENTAL</B> 3044 * <BR /><B>DEPRECATED</B> 3045 */ 3046 public static class downloadProgress extends BrowserEvent 3047 { 3048 /** For Object Serialization. java.io.Serializable */ 3049 protected static final long serialVersionUID = 1; 3050 3051 public boolean[] optionals() 3052 { return new boolean[] { false, false, false, false, }; } 3053 3054 /** Global unique identifier of the download. */ 3055 public final String guid; 3056 3057 /** Total expected bytes to download. */ 3058 public final Number totalBytes; 3059 3060 /** Total bytes received. */ 3061 public final Number receivedBytes; 3062 3063 /** Download status. */ 3064 public final String state; 3065 3066 /** 3067 * Constructor 3068 * 3069 * @param guid Global unique identifier of the download. 3070 * 3071 * @param totalBytes Total expected bytes to download. 3072 * 3073 * @param receivedBytes Total bytes received. 3074 * 3075 * @param state Download status. 3076 * <BR />Acceptable Values: ["inProgress", "completed", "canceled"] 3077 */ 3078 public downloadProgress 3079 (String guid, Number totalBytes, Number receivedBytes, String state) 3080 { 3081 super("Page", "downloadProgress", 4); 3082 3083 // Exception-Check(s) to ensure that if any parameters which are not declared as 3084 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3085 3086 if (guid == null) BRDPC.throwNPE("guid"); 3087 if (totalBytes == null) BRDPC.throwNPE("totalBytes"); 3088 if (receivedBytes == null) BRDPC.throwNPE("receivedBytes"); 3089 if (state == null) BRDPC.throwNPE("state"); 3090 3091 // Exception-Check(s) to ensure that if any parameters which must adhere to a 3092 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 3093 3094 BRDPC.checkIAE( 3095 "state", state, 3096 "inProgress", "completed", "canceled" 3097 ); 3098 3099 this.guid = guid; 3100 this.totalBytes = totalBytes; 3101 this.receivedBytes = receivedBytes; 3102 this.state = state; 3103 } 3104 3105 /** 3106 * JSON Object Constructor 3107 * @param jo A Json-Object having data about an instance of {@code 'downloadProgress'}. 3108 */ 3109 public downloadProgress (JsonObject jo) 3110 { 3111 super("Page", "downloadProgress", 4); 3112 3113 this.guid = ReadJSON.getString(jo, "guid", false, true); 3114 this.totalBytes = ReadJSON.getNUMBER(jo, "totalBytes", false, true); 3115 this.receivedBytes = ReadJSON.getNUMBER(jo, "receivedBytes", false, true); 3116 this.state = ReadJSON.getString(jo, "state", false, true); 3117 } 3118 3119 } 3120 3121 /** 3122 * Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) has been 3123 * closed. 3124 */ 3125 public static class javascriptDialogClosed extends BrowserEvent 3126 { 3127 /** For Object Serialization. java.io.Serializable */ 3128 protected static final long serialVersionUID = 1; 3129 3130 public boolean[] optionals() 3131 { return new boolean[] { false, false, }; } 3132 3133 /** Whether dialog was confirmed. */ 3134 public final boolean result; 3135 3136 /** User input in case of prompt. */ 3137 public final String userInput; 3138 3139 /** 3140 * Constructor 3141 * 3142 * @param result Whether dialog was confirmed. 3143 * 3144 * @param userInput User input in case of prompt. 3145 */ 3146 public javascriptDialogClosed(boolean result, String userInput) 3147 { 3148 super("Page", "javascriptDialogClosed", 2); 3149 3150 // Exception-Check(s) to ensure that if any parameters which are not declared as 3151 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3152 3153 if (userInput == null) BRDPC.throwNPE("userInput"); 3154 3155 this.result = result; 3156 this.userInput = userInput; 3157 } 3158 3159 /** 3160 * JSON Object Constructor 3161 * @param jo A Json-Object having data about an instance of {@code 'javascriptDialogClosed'}. 3162 */ 3163 public javascriptDialogClosed (JsonObject jo) 3164 { 3165 super("Page", "javascriptDialogClosed", 2); 3166 3167 this.result = ReadJSON.getBoolean(jo, "result"); 3168 this.userInput = ReadJSON.getString(jo, "userInput", false, true); 3169 } 3170 3171 } 3172 3173 /** 3174 * Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) is about to 3175 * open. 3176 */ 3177 public static class javascriptDialogOpening extends BrowserEvent 3178 { 3179 /** For Object Serialization. java.io.Serializable */ 3180 protected static final long serialVersionUID = 1; 3181 3182 public boolean[] optionals() 3183 { return new boolean[] { false, false, false, false, true, }; } 3184 3185 /** Frame url. */ 3186 public final String url; 3187 3188 /** Message that will be displayed by the dialog. */ 3189 public final String message; 3190 3191 /** Dialog type. */ 3192 public final String type; 3193 3194 /** 3195 * True iff browser is capable showing or acting on the given dialog. When browser has no 3196 * dialog handler for given target, calling alert while Page domain is engaged will stall 3197 * the page execution. Execution can be resumed via calling Page.handleJavaScriptDialog. 3198 */ 3199 public final boolean hasBrowserHandler; 3200 3201 /** 3202 * Default dialog prompt. 3203 * <BR /> 3204 * <BR /><B>OPTIONAL</B> 3205 */ 3206 public final String defaultPrompt; 3207 3208 /** 3209 * Constructor 3210 * 3211 * @param url Frame url. 3212 * 3213 * @param message Message that will be displayed by the dialog. 3214 * 3215 * @param type Dialog type. 3216 * 3217 * @param hasBrowserHandler 3218 * True iff browser is capable showing or acting on the given dialog. When browser has no 3219 * dialog handler for given target, calling alert while Page domain is engaged will stall 3220 * the page execution. Execution can be resumed via calling Page.handleJavaScriptDialog. 3221 * 3222 * @param defaultPrompt Default dialog prompt. 3223 * <BR /><B>OPTIONAL</B> 3224 */ 3225 public javascriptDialogOpening( 3226 String url, String message, String type, boolean hasBrowserHandler, 3227 String defaultPrompt 3228 ) 3229 { 3230 super("Page", "javascriptDialogOpening", 5); 3231 3232 // Exception-Check(s) to ensure that if any parameters which are not declared as 3233 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3234 3235 if (url == null) BRDPC.throwNPE("url"); 3236 if (message == null) BRDPC.throwNPE("message"); 3237 if (type == null) BRDPC.throwNPE("type"); 3238 3239 // Exception-Check(s) to ensure that if any parameters which must adhere to a 3240 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 3241 3242 BRDPC.checkIAE("type", type, "Page.DialogType", Page.DialogType); 3243 3244 this.url = url; 3245 this.message = message; 3246 this.type = type; 3247 this.hasBrowserHandler = hasBrowserHandler; 3248 this.defaultPrompt = defaultPrompt; 3249 } 3250 3251 /** 3252 * JSON Object Constructor 3253 * @param jo A Json-Object having data about an instance of {@code 'javascriptDialogOpening'}. 3254 */ 3255 public javascriptDialogOpening (JsonObject jo) 3256 { 3257 super("Page", "javascriptDialogOpening", 5); 3258 3259 this.url = ReadJSON.getString(jo, "url", false, true); 3260 this.message = ReadJSON.getString(jo, "message", false, true); 3261 this.type = ReadJSON.getString(jo, "type", false, true); 3262 this.hasBrowserHandler = ReadJSON.getBoolean(jo, "hasBrowserHandler"); 3263 this.defaultPrompt = ReadJSON.getString(jo, "defaultPrompt", true, false); 3264 } 3265 3266 } 3267 3268 /** Fired for top level page lifecycle events such as navigation, load, paint, etc. */ 3269 public static class lifecycleEvent extends BrowserEvent 3270 { 3271 /** For Object Serialization. java.io.Serializable */ 3272 protected static final long serialVersionUID = 1; 3273 3274 public boolean[] optionals() 3275 { return new boolean[] { false, false, false, false, }; } 3276 3277 /** Id of the frame. */ 3278 public final String frameId; 3279 3280 /** Loader identifier. Empty string if the request is fetched from worker. */ 3281 public final String loaderId; 3282 3283 /** <CODE>[No Description Provided by Google]</CODE> */ 3284 public final String name; 3285 3286 /** <CODE>[No Description Provided by Google]</CODE> */ 3287 public final Number timestamp; 3288 3289 /** 3290 * Constructor 3291 * 3292 * @param frameId Id of the frame. 3293 * 3294 * @param loaderId Loader identifier. Empty string if the request is fetched from worker. 3295 * 3296 * @param name - 3297 * 3298 * @param timestamp - 3299 */ 3300 public lifecycleEvent(String frameId, String loaderId, String name, Number timestamp) 3301 { 3302 super("Page", "lifecycleEvent", 4); 3303 3304 // Exception-Check(s) to ensure that if any parameters which are not declared as 3305 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3306 3307 if (frameId == null) BRDPC.throwNPE("frameId"); 3308 if (loaderId == null) BRDPC.throwNPE("loaderId"); 3309 if (name == null) BRDPC.throwNPE("name"); 3310 if (timestamp == null) BRDPC.throwNPE("timestamp"); 3311 3312 this.frameId = frameId; 3313 this.loaderId = loaderId; 3314 this.name = name; 3315 this.timestamp = timestamp; 3316 } 3317 3318 /** 3319 * JSON Object Constructor 3320 * @param jo A Json-Object having data about an instance of {@code 'lifecycleEvent'}. 3321 */ 3322 public lifecycleEvent (JsonObject jo) 3323 { 3324 super("Page", "lifecycleEvent", 4); 3325 3326 this.frameId = ReadJSON.getString(jo, "frameId", false, true); 3327 this.loaderId = ReadJSON.getString(jo, "loaderId", false, true); 3328 this.name = ReadJSON.getString(jo, "name", false, true); 3329 this.timestamp = ReadJSON.getNUMBER(jo, "timestamp", false, true); 3330 } 3331 3332 } 3333 3334 /** 3335 * Fired for failed bfcache history navigations if BackForwardCache feature is enabled. Do 3336 * not assume any ordering with the Page.frameNavigated event. This event is fired only for 3337 * main-frame history navigation where the document changes (non-same-document navigations), 3338 * when bfcache navigation fails. 3339 * <BR /> 3340 * <BR /><B>EXPERIMENTAL</B> 3341 */ 3342 public static class backForwardCacheNotUsed extends BrowserEvent 3343 { 3344 /** For Object Serialization. java.io.Serializable */ 3345 protected static final long serialVersionUID = 1; 3346 3347 public boolean[] optionals() 3348 { return new boolean[] { false, false, false, }; } 3349 3350 /** The loader id for the associated navgation. */ 3351 public final String loaderId; 3352 3353 /** The frame id of the associated frame. */ 3354 public final String frameId; 3355 3356 /** Array of reasons why the page could not be cached. This must not be empty. */ 3357 public final Page.BackForwardCacheNotRestoredExplanation[] notRestoredExplanations; 3358 3359 /** 3360 * Constructor 3361 * 3362 * @param loaderId The loader id for the associated navgation. 3363 * 3364 * @param frameId The frame id of the associated frame. 3365 * 3366 * @param notRestoredExplanations Array of reasons why the page could not be cached. This must not be empty. 3367 */ 3368 public backForwardCacheNotUsed( 3369 String loaderId, String frameId, 3370 Page.BackForwardCacheNotRestoredExplanation[] notRestoredExplanations 3371 ) 3372 { 3373 super("Page", "backForwardCacheNotUsed", 3); 3374 3375 // Exception-Check(s) to ensure that if any parameters which are not declared as 3376 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3377 3378 if (loaderId == null) BRDPC.throwNPE("loaderId"); 3379 if (frameId == null) BRDPC.throwNPE("frameId"); 3380 if (notRestoredExplanations == null) BRDPC.throwNPE("notRestoredExplanations"); 3381 3382 this.loaderId = loaderId; 3383 this.frameId = frameId; 3384 this.notRestoredExplanations = notRestoredExplanations; 3385 } 3386 3387 /** 3388 * JSON Object Constructor 3389 * @param jo A Json-Object having data about an instance of {@code 'backForwardCacheNotUsed'}. 3390 */ 3391 public backForwardCacheNotUsed (JsonObject jo) 3392 { 3393 super("Page", "backForwardCacheNotUsed", 3); 3394 3395 this.loaderId = ReadJSON.getString(jo, "loaderId", false, true); 3396 this.frameId = ReadJSON.getString(jo, "frameId", false, true); 3397 this.notRestoredExplanations = (jo.getJsonArray("notRestoredExplanations") == null) 3398 ? null 3399 : ReadArrJSON.DimN.objArr(jo.getJsonArray("notRestoredExplanations"), null, 0, Page.BackForwardCacheNotRestoredExplanation[].class); 3400 } 3401 3402 } 3403 3404 /** <CODE>[No Description Provided by Google]</CODE> */ 3405 public static class loadEventFired extends BrowserEvent 3406 { 3407 /** For Object Serialization. java.io.Serializable */ 3408 protected static final long serialVersionUID = 1; 3409 3410 public boolean[] optionals() 3411 { return new boolean[] { false, }; } 3412 3413 /** <CODE>[No Description Provided by Google]</CODE> */ 3414 public final Number timestamp; 3415 3416 /** 3417 * Constructor 3418 * 3419 * @param timestamp - 3420 */ 3421 public loadEventFired(Number timestamp) 3422 { 3423 super("Page", "loadEventFired", 1); 3424 3425 // Exception-Check(s) to ensure that if any parameters which are not declared as 3426 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3427 3428 if (timestamp == null) BRDPC.throwNPE("timestamp"); 3429 3430 this.timestamp = timestamp; 3431 } 3432 3433 /** 3434 * JSON Object Constructor 3435 * @param jo A Json-Object having data about an instance of {@code 'loadEventFired'}. 3436 */ 3437 public loadEventFired (JsonObject jo) 3438 { 3439 super("Page", "loadEventFired", 1); 3440 3441 this.timestamp = ReadJSON.getNUMBER(jo, "timestamp", false, true); 3442 } 3443 3444 } 3445 3446 /** 3447 * Fired when same-document navigation happens, e.g. due to history API usage or anchor navigation. 3448 * <BR /> 3449 * <BR /><B>EXPERIMENTAL</B> 3450 */ 3451 public static class navigatedWithinDocument extends BrowserEvent 3452 { 3453 /** For Object Serialization. java.io.Serializable */ 3454 protected static final long serialVersionUID = 1; 3455 3456 public boolean[] optionals() 3457 { return new boolean[] { false, false, }; } 3458 3459 /** Id of the frame. */ 3460 public final String frameId; 3461 3462 /** Frame's new url. */ 3463 public final String url; 3464 3465 /** 3466 * Constructor 3467 * 3468 * @param frameId Id of the frame. 3469 * 3470 * @param url Frame's new url. 3471 */ 3472 public navigatedWithinDocument(String frameId, String url) 3473 { 3474 super("Page", "navigatedWithinDocument", 2); 3475 3476 // Exception-Check(s) to ensure that if any parameters which are not declared as 3477 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3478 3479 if (frameId == null) BRDPC.throwNPE("frameId"); 3480 if (url == null) BRDPC.throwNPE("url"); 3481 3482 this.frameId = frameId; 3483 this.url = url; 3484 } 3485 3486 /** 3487 * JSON Object Constructor 3488 * @param jo A Json-Object having data about an instance of {@code 'navigatedWithinDocument'}. 3489 */ 3490 public navigatedWithinDocument (JsonObject jo) 3491 { 3492 super("Page", "navigatedWithinDocument", 2); 3493 3494 this.frameId = ReadJSON.getString(jo, "frameId", false, true); 3495 this.url = ReadJSON.getString(jo, "url", false, true); 3496 } 3497 3498 } 3499 3500 /** 3501 * Compressed image data requested by the <CODE>startScreencast</CODE>. 3502 * <BR /> 3503 * <BR /><B>EXPERIMENTAL</B> 3504 */ 3505 public static class screencastFrame extends BrowserEvent 3506 { 3507 /** For Object Serialization. java.io.Serializable */ 3508 protected static final long serialVersionUID = 1; 3509 3510 public boolean[] optionals() 3511 { return new boolean[] { false, false, false, }; } 3512 3513 /** Base64-encoded compressed image. (Encoded as a base64 string when passed over JSON) */ 3514 public final String data; 3515 3516 /** Screencast frame metadata. */ 3517 public final Page.ScreencastFrameMetadata metadata; 3518 3519 /** Frame number. */ 3520 public final int sessionId; 3521 3522 /** 3523 * Constructor 3524 * 3525 * @param data Base64-encoded compressed image. (Encoded as a base64 string when passed over JSON) 3526 * 3527 * @param metadata Screencast frame metadata. 3528 * 3529 * @param sessionId Frame number. 3530 */ 3531 public screencastFrame 3532 (String data, Page.ScreencastFrameMetadata metadata, int sessionId) 3533 { 3534 super("Page", "screencastFrame", 3); 3535 3536 // Exception-Check(s) to ensure that if any parameters which are not declared as 3537 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3538 3539 if (data == null) BRDPC.throwNPE("data"); 3540 if (metadata == null) BRDPC.throwNPE("metadata"); 3541 3542 this.data = data; 3543 this.metadata = metadata; 3544 this.sessionId = sessionId; 3545 } 3546 3547 /** 3548 * JSON Object Constructor 3549 * @param jo A Json-Object having data about an instance of {@code 'screencastFrame'}. 3550 */ 3551 public screencastFrame (JsonObject jo) 3552 { 3553 super("Page", "screencastFrame", 3); 3554 3555 this.data = ReadJSON.getString(jo, "data", false, true); 3556 this.metadata = ReadJSON.XL.getObject(jo, "metadata", Page.ScreencastFrameMetadata.class, false, true); 3557 this.sessionId = ReadJSON.getInt(jo, "sessionId"); 3558 } 3559 3560 } 3561 3562 /** 3563 * Fired when the page with currently enabled screencast was shown or hidden. 3564 * <BR /> 3565 * <BR /><B>EXPERIMENTAL</B> 3566 */ 3567 public static class screencastVisibilityChanged extends BrowserEvent 3568 { 3569 /** For Object Serialization. java.io.Serializable */ 3570 protected static final long serialVersionUID = 1; 3571 3572 public boolean[] optionals() 3573 { return new boolean[] { false, }; } 3574 3575 /** True if the page is visible. */ 3576 public final boolean visible; 3577 3578 /** 3579 * Constructor 3580 * 3581 * @param visible True if the page is visible. 3582 */ 3583 public screencastVisibilityChanged(boolean visible) 3584 { 3585 super("Page", "screencastVisibilityChanged", 1); 3586 3587 this.visible = visible; 3588 } 3589 3590 /** 3591 * JSON Object Constructor 3592 * @param jo A Json-Object having data about an instance of {@code 'screencastVisibilityChanged'}. 3593 */ 3594 public screencastVisibilityChanged (JsonObject jo) 3595 { 3596 super("Page", "screencastVisibilityChanged", 1); 3597 3598 this.visible = ReadJSON.getBoolean(jo, "visible"); 3599 } 3600 3601 } 3602 3603 /** 3604 * Fired when a new window is going to be opened, via window.open(), link click, form submission, 3605 * etc. 3606 */ 3607 public static class windowOpen extends BrowserEvent 3608 { 3609 /** For Object Serialization. java.io.Serializable */ 3610 protected static final long serialVersionUID = 1; 3611 3612 public boolean[] optionals() 3613 { return new boolean[] { false, false, false, false, }; } 3614 3615 /** The URL for the new window. */ 3616 public final String url; 3617 3618 /** Window name. */ 3619 public final String windowName; 3620 3621 /** An array of enabled window features. */ 3622 public final String[] windowFeatures; 3623 3624 /** Whether or not it was triggered by user gesture. */ 3625 public final boolean userGesture; 3626 3627 /** 3628 * Constructor 3629 * 3630 * @param url The URL for the new window. 3631 * 3632 * @param windowName Window name. 3633 * 3634 * @param windowFeatures An array of enabled window features. 3635 * 3636 * @param userGesture Whether or not it was triggered by user gesture. 3637 */ 3638 public windowOpen 3639 (String url, String windowName, String[] windowFeatures, boolean userGesture) 3640 { 3641 super("Page", "windowOpen", 4); 3642 3643 // Exception-Check(s) to ensure that if any parameters which are not declared as 3644 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3645 3646 if (url == null) BRDPC.throwNPE("url"); 3647 if (windowName == null) BRDPC.throwNPE("windowName"); 3648 if (windowFeatures == null) BRDPC.throwNPE("windowFeatures"); 3649 3650 this.url = url; 3651 this.windowName = windowName; 3652 this.windowFeatures = windowFeatures; 3653 this.userGesture = userGesture; 3654 } 3655 3656 /** 3657 * JSON Object Constructor 3658 * @param jo A Json-Object having data about an instance of {@code 'windowOpen'}. 3659 */ 3660 public windowOpen (JsonObject jo) 3661 { 3662 super("Page", "windowOpen", 4); 3663 3664 this.url = ReadJSON.getString(jo, "url", false, true); 3665 this.windowName = ReadJSON.getString(jo, "windowName", false, true); 3666 this.windowFeatures = (jo.getJsonArray("windowFeatures") == null) 3667 ? null 3668 : ReadArrJSON.DimN.strArr(jo.getJsonArray("windowFeatures"), null, 0, String[].class); 3669 this.userGesture = ReadJSON.getBoolean(jo, "userGesture"); 3670 } 3671 3672 } 3673 3674 /** 3675 * Issued for every compilation cache generated. Is only available 3676 * if Page.setGenerateCompilationCache is enabled. 3677 * <BR /> 3678 * <BR /><B>EXPERIMENTAL</B> 3679 */ 3680 public static class compilationCacheProduced extends BrowserEvent 3681 { 3682 /** For Object Serialization. java.io.Serializable */ 3683 protected static final long serialVersionUID = 1; 3684 3685 public boolean[] optionals() 3686 { return new boolean[] { false, false, }; } 3687 3688 /** <CODE>[No Description Provided by Google]</CODE> */ 3689 public final String url; 3690 3691 /** Base64-encoded data (Encoded as a base64 string when passed over JSON) */ 3692 public final String data; 3693 3694 /** 3695 * Constructor 3696 * 3697 * @param url - 3698 * 3699 * @param data Base64-encoded data (Encoded as a base64 string when passed over JSON) 3700 */ 3701 public compilationCacheProduced(String url, String data) 3702 { 3703 super("Page", "compilationCacheProduced", 2); 3704 3705 // Exception-Check(s) to ensure that if any parameters which are not declared as 3706 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3707 3708 if (url == null) BRDPC.throwNPE("url"); 3709 if (data == null) BRDPC.throwNPE("data"); 3710 3711 this.url = url; 3712 this.data = data; 3713 } 3714 3715 /** 3716 * JSON Object Constructor 3717 * @param jo A Json-Object having data about an instance of {@code 'compilationCacheProduced'}. 3718 */ 3719 public compilationCacheProduced (JsonObject jo) 3720 { 3721 super("Page", "compilationCacheProduced", 2); 3722 3723 this.url = ReadJSON.getString(jo, "url", false, true); 3724 this.data = ReadJSON.getString(jo, "data", false, true); 3725 } 3726 3727 } 3728 3729 3730 // Counter for keeping the WebSocket Request ID's distinct. 3731 private static int counter = 1; 3732 3733 /** 3734 * Deprecated, please use addScriptToEvaluateOnNewDocument instead. 3735 * <BR /><B>EXPERIMENTAL</B> 3736 * <BR /><B>DEPRECATED</B> 3737 * 3738 * @param scriptSource - 3739 * 3740 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 3741 * String></CODE> 3742 * 3743 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 3744 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 3745 * String></CODE> will be returned. 3746 * 3747 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 3748 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 3749 * may be retrieved.</I> 3750 * 3751 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 3752 * <BR /><BR /><UL CLASS=JDUL> 3753 * <LI><CODE>String (<B>identifier</B></CODE>) 3754 * <BR />Identifier of the added script. 3755 * </LI> 3756 * </UL> */ 3757 public static Script<String, JsonObject, String> addScriptToEvaluateOnLoad 3758 (String scriptSource) 3759 { 3760 // Exception-Check(s) to ensure that if any parameters which are not declared as 3761 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3762 3763 if (scriptSource == null) BRDPC.throwNPE("scriptSource"); 3764 3765 final int webSocketID = 32000000 + counter++; 3766 final boolean[] optionals = { false, }; 3767 3768 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 3769 String requestJSON = WriteJSON.get( 3770 parameterTypes.get("addScriptToEvaluateOnLoad"), 3771 parameterNames.get("addScriptToEvaluateOnLoad"), 3772 optionals, webSocketID, 3773 "Page.addScriptToEvaluateOnLoad", 3774 scriptSource 3775 ); 3776 3777 // 'JSON Binding' ... Converts Browser Response-JSON to 'String' 3778 Function<JsonObject, String> responseProcessor = (JsonObject jo) -> 3779 ReadJSON.getString(jo, "identifier", false, true); 3780 3781 // Pass the 'defaultSender' to Script-Constructor 3782 // The sender that is used can be changed before executing script. 3783 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 3784 } 3785 3786 /** 3787 * Evaluates given script in every frame upon creation (before loading frame's scripts). 3788 * 3789 * @param source - 3790 * 3791 * @param worldName 3792 * If specified, creates an isolated world with the given name and evaluates given script in it. 3793 * This world name will be used as the ExecutionContextDescription::name when the corresponding 3794 * event is emitted. 3795 * <BR /><B>OPTIONAL</B> 3796 * <BR /><B>EXPERIMENTAL</B> 3797 * 3798 * @param includeCommandLineAPI 3799 * Specifies whether command line API should be available to the script, defaults 3800 * to false. 3801 * <BR /><B>OPTIONAL</B> 3802 * <BR /><B>EXPERIMENTAL</B> 3803 * 3804 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 3805 * String></CODE> 3806 * 3807 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 3808 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 3809 * String></CODE> will be returned. 3810 * 3811 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 3812 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 3813 * may be retrieved.</I> 3814 * 3815 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 3816 * <BR /><BR /><UL CLASS=JDUL> 3817 * <LI><CODE>String (<B>identifier</B></CODE>) 3818 * <BR />Identifier of the added script. 3819 * </LI> 3820 * </UL> */ 3821 public static Script<String, JsonObject, String> addScriptToEvaluateOnNewDocument 3822 (String source, String worldName, Boolean includeCommandLineAPI) 3823 { 3824 // Exception-Check(s) to ensure that if any parameters which are not declared as 3825 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3826 3827 if (source == null) BRDPC.throwNPE("source"); 3828 3829 final int webSocketID = 32001000 + counter++; 3830 final boolean[] optionals = { false, true, true, }; 3831 3832 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 3833 String requestJSON = WriteJSON.get( 3834 parameterTypes.get("addScriptToEvaluateOnNewDocument"), 3835 parameterNames.get("addScriptToEvaluateOnNewDocument"), 3836 optionals, webSocketID, 3837 "Page.addScriptToEvaluateOnNewDocument", 3838 source, worldName, includeCommandLineAPI 3839 ); 3840 3841 // 'JSON Binding' ... Converts Browser Response-JSON to 'String' 3842 Function<JsonObject, String> responseProcessor = (JsonObject jo) -> 3843 ReadJSON.getString(jo, "identifier", false, true); 3844 3845 // Pass the 'defaultSender' to Script-Constructor 3846 // The sender that is used can be changed before executing script. 3847 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 3848 } 3849 3850 /** 3851 * Brings page to front (activates tab). 3852 * 3853 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 3854 * {@link Ret0}></CODE> 3855 * 3856 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 3857 * browser receives the invocation-request. 3858 * 3859 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 3860 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 3861 * {@code >} to ensure the Browser Function has run to completion. 3862 */ 3863 public static Script<String, JsonObject, Ret0> bringToFront() 3864 { 3865 final int webSocketID = 32002000 + counter++; 3866 final boolean[] optionals = new boolean[0]; 3867 3868 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 3869 String requestJSON = WriteJSON.get( 3870 parameterTypes.get("bringToFront"), 3871 parameterNames.get("bringToFront"), 3872 optionals, webSocketID, 3873 "Page.bringToFront" 3874 ); 3875 3876 // This Remote Command does not have a Return-Value. 3877 return new Script<> 3878 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 3879 } 3880 3881 /** 3882 * Capture page screenshot. 3883 * 3884 * @param format Image compression format (defaults to png). 3885 * <BR />Acceptable Values: ["jpeg", "png", "webp"] 3886 * <BR /><B>OPTIONAL</B> 3887 * 3888 * @param quality Compression quality from range [0..100] (jpeg only). 3889 * <BR /><B>OPTIONAL</B> 3890 * 3891 * @param clip Capture the screenshot of a given region only. 3892 * <BR /><B>OPTIONAL</B> 3893 * 3894 * @param fromSurface Capture the screenshot from the surface, rather than the view. Defaults to true. 3895 * <BR /><B>OPTIONAL</B> 3896 * <BR /><B>EXPERIMENTAL</B> 3897 * 3898 * @param captureBeyondViewport Capture the screenshot beyond the viewport. Defaults to false. 3899 * <BR /><B>OPTIONAL</B> 3900 * <BR /><B>EXPERIMENTAL</B> 3901 * 3902 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 3903 * String></CODE> 3904 * 3905 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 3906 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 3907 * String></CODE> will be returned. 3908 * 3909 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 3910 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 3911 * may be retrieved.</I> 3912 * 3913 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 3914 * <BR /><BR /><UL CLASS=JDUL> 3915 * <LI><CODE>String (<B>data</B></CODE>) 3916 * <BR />Base64-encoded image data. (Encoded as a base64 string when passed over JSON) 3917 * </LI> 3918 * </UL> */ 3919 public static Script<String, JsonObject, String> captureScreenshot( 3920 String format, Integer quality, Page.Viewport clip, Boolean fromSurface, 3921 Boolean captureBeyondViewport 3922 ) 3923 { 3924 // Exception-Check(s) to ensure that if any parameters which must adhere to a 3925 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 3926 3927 BRDPC.checkIAE( 3928 "format", format, 3929 "jpeg", "png", "webp" 3930 ); 3931 3932 final int webSocketID = 32003000 + counter++; 3933 final boolean[] optionals = { true, true, true, true, true, }; 3934 3935 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 3936 String requestJSON = WriteJSON.get( 3937 parameterTypes.get("captureScreenshot"), 3938 parameterNames.get("captureScreenshot"), 3939 optionals, webSocketID, 3940 "Page.captureScreenshot", 3941 format, quality, clip, fromSurface, captureBeyondViewport 3942 ); 3943 3944 // 'JSON Binding' ... Converts Browser Response-JSON to 'String' 3945 Function<JsonObject, String> responseProcessor = (JsonObject jo) -> 3946 ReadJSON.getString(jo, "data", false, true); 3947 3948 // Pass the 'defaultSender' to Script-Constructor 3949 // The sender that is used can be changed before executing script. 3950 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 3951 } 3952 3953 /** 3954 * Returns a snapshot of the page as a string. For MHTML format, the serialization includes 3955 * iframes, shadow DOM, external resources, and element-inline styles. 3956 * <BR /><B>EXPERIMENTAL</B> 3957 * 3958 * @param format Format (defaults to mhtml). 3959 * <BR />Acceptable Values: ["mhtml"] 3960 * <BR /><B>OPTIONAL</B> 3961 * 3962 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 3963 * String></CODE> 3964 * 3965 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 3966 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 3967 * String></CODE> will be returned. 3968 * 3969 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 3970 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 3971 * may be retrieved.</I> 3972 * 3973 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 3974 * <BR /><BR /><UL CLASS=JDUL> 3975 * <LI><CODE>String (<B>data</B></CODE>) 3976 * <BR />Serialized page data. 3977 * </LI> 3978 * </UL> */ 3979 public static Script<String, JsonObject, String> captureSnapshot(String format) 3980 { 3981 // Exception-Check(s) to ensure that if any parameters which must adhere to a 3982 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 3983 3984 BRDPC.checkIAE( 3985 "format", format, 3986 "mhtml" 3987 ); 3988 3989 final int webSocketID = 32004000 + counter++; 3990 final boolean[] optionals = { true, }; 3991 3992 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 3993 String requestJSON = WriteJSON.get( 3994 parameterTypes.get("captureSnapshot"), 3995 parameterNames.get("captureSnapshot"), 3996 optionals, webSocketID, 3997 "Page.captureSnapshot", 3998 format 3999 ); 4000 4001 // 'JSON Binding' ... Converts Browser Response-JSON to 'String' 4002 Function<JsonObject, String> responseProcessor = (JsonObject jo) -> 4003 ReadJSON.getString(jo, "data", false, true); 4004 4005 // Pass the 'defaultSender' to Script-Constructor 4006 // The sender that is used can be changed before executing script. 4007 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 4008 } 4009 4010 /** 4011 * Clears the overridden device metrics. 4012 * <BR /><B>EXPERIMENTAL</B> 4013 * <BR /><B>DEPRECATED</B> 4014 * 4015 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 4016 * {@link Ret0}></CODE> 4017 * 4018 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 4019 * browser receives the invocation-request. 4020 * 4021 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 4022 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 4023 * {@code >} to ensure the Browser Function has run to completion. 4024 */ 4025 public static Script<String, JsonObject, Ret0> clearDeviceMetricsOverride() 4026 { 4027 final int webSocketID = 32005000 + counter++; 4028 final boolean[] optionals = new boolean[0]; 4029 4030 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 4031 String requestJSON = WriteJSON.get( 4032 parameterTypes.get("clearDeviceMetricsOverride"), 4033 parameterNames.get("clearDeviceMetricsOverride"), 4034 optionals, webSocketID, 4035 "Page.clearDeviceMetricsOverride" 4036 ); 4037 4038 // This Remote Command does not have a Return-Value. 4039 return new Script<> 4040 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 4041 } 4042 4043 /** 4044 * Clears the overridden Device Orientation. 4045 * <BR /><B>EXPERIMENTAL</B> 4046 * <BR /><B>DEPRECATED</B> 4047 * 4048 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 4049 * {@link Ret0}></CODE> 4050 * 4051 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 4052 * browser receives the invocation-request. 4053 * 4054 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 4055 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 4056 * {@code >} to ensure the Browser Function has run to completion. 4057 */ 4058 public static Script<String, JsonObject, Ret0> clearDeviceOrientationOverride() 4059 { 4060 final int webSocketID = 32006000 + counter++; 4061 final boolean[] optionals = new boolean[0]; 4062 4063 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 4064 String requestJSON = WriteJSON.get( 4065 parameterTypes.get("clearDeviceOrientationOverride"), 4066 parameterNames.get("clearDeviceOrientationOverride"), 4067 optionals, webSocketID, 4068 "Page.clearDeviceOrientationOverride" 4069 ); 4070 4071 // This Remote Command does not have a Return-Value. 4072 return new Script<> 4073 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 4074 } 4075 4076 /** 4077 * Clears the overridden Geolocation Position and Error. 4078 * <BR /><B>DEPRECATED</B> 4079 * 4080 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 4081 * {@link Ret0}></CODE> 4082 * 4083 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 4084 * browser receives the invocation-request. 4085 * 4086 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 4087 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 4088 * {@code >} to ensure the Browser Function has run to completion. 4089 */ 4090 public static Script<String, JsonObject, Ret0> clearGeolocationOverride() 4091 { 4092 final int webSocketID = 32007000 + counter++; 4093 final boolean[] optionals = new boolean[0]; 4094 4095 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 4096 String requestJSON = WriteJSON.get( 4097 parameterTypes.get("clearGeolocationOverride"), 4098 parameterNames.get("clearGeolocationOverride"), 4099 optionals, webSocketID, 4100 "Page.clearGeolocationOverride" 4101 ); 4102 4103 // This Remote Command does not have a Return-Value. 4104 return new Script<> 4105 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 4106 } 4107 4108 /** 4109 * Creates an isolated world for the given frame. 4110 * 4111 * @param frameId Id of the frame in which the isolated world should be created. 4112 * 4113 * @param worldName An optional name which is reported in the Execution Context. 4114 * <BR /><B>OPTIONAL</B> 4115 * 4116 * @param grantUniveralAccess 4117 * Whether or not universal access should be granted to the isolated world. This is a powerful 4118 * option, use with caution. 4119 * <BR /><B>OPTIONAL</B> 4120 * 4121 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 4122 * Integer></CODE> 4123 * 4124 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 4125 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 4126 * Integer></CODE> will be returned. 4127 * 4128 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 4129 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 4130 * may be retrieved.</I> 4131 * 4132 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 4133 * <BR /><BR /><UL CLASS=JDUL> 4134 * <LI><CODE>Integer (<B>executionContextId</B></CODE>) 4135 * <BR />Execution context of the isolated world. 4136 * </LI> 4137 * </UL> */ 4138 public static Script<String, JsonObject, Integer> createIsolatedWorld 4139 (String frameId, String worldName, Boolean grantUniveralAccess) 4140 { 4141 // Exception-Check(s) to ensure that if any parameters which are not declared as 4142 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4143 4144 if (frameId == null) BRDPC.throwNPE("frameId"); 4145 4146 final int webSocketID = 32008000 + counter++; 4147 final boolean[] optionals = { false, true, true, }; 4148 4149 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 4150 String requestJSON = WriteJSON.get( 4151 parameterTypes.get("createIsolatedWorld"), 4152 parameterNames.get("createIsolatedWorld"), 4153 optionals, webSocketID, 4154 "Page.createIsolatedWorld", 4155 frameId, worldName, grantUniveralAccess 4156 ); 4157 4158 // 'JSON Binding' ... Converts Browser Response-JSON to 'Integer' 4159 Function<JsonObject, Integer> responseProcessor = (JsonObject jo) -> 4160 ReadJSON.getINTEGER(jo, "executionContextId", true); 4161 4162 // Pass the 'defaultSender' to Script-Constructor 4163 // The sender that is used can be changed before executing script. 4164 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 4165 } 4166 4167 /** 4168 * Deletes browser cookie with given name, domain and path. 4169 * <BR /><B>EXPERIMENTAL</B> 4170 * <BR /><B>DEPRECATED</B> 4171 * 4172 * @param cookieName Name of the cookie to remove. 4173 * 4174 * @param url URL to match cooke domain and path. 4175 * 4176 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 4177 * {@link Ret0}></CODE> 4178 * 4179 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 4180 * browser receives the invocation-request. 4181 * 4182 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 4183 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 4184 * {@code >} to ensure the Browser Function has run to completion. 4185 */ 4186 public static Script<String, JsonObject, Ret0> deleteCookie(String cookieName, String url) 4187 { 4188 // Exception-Check(s) to ensure that if any parameters which are not declared as 4189 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4190 4191 if (cookieName == null) BRDPC.throwNPE("cookieName"); 4192 if (url == null) BRDPC.throwNPE("url"); 4193 4194 final int webSocketID = 32009000 + counter++; 4195 final boolean[] optionals = { false, false, }; 4196 4197 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 4198 String requestJSON = WriteJSON.get( 4199 parameterTypes.get("deleteCookie"), 4200 parameterNames.get("deleteCookie"), 4201 optionals, webSocketID, 4202 "Page.deleteCookie", 4203 cookieName, url 4204 ); 4205 4206 // This Remote Command does not have a Return-Value. 4207 return new Script<> 4208 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 4209 } 4210 4211 /** 4212 * Disables page domain notifications. 4213 * 4214 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 4215 * {@link Ret0}></CODE> 4216 * 4217 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 4218 * browser receives the invocation-request. 4219 * 4220 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 4221 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 4222 * {@code >} to ensure the Browser Function has run to completion. 4223 */ 4224 public static Script<String, JsonObject, Ret0> disable() 4225 { 4226 final int webSocketID = 32010000 + counter++; 4227 final boolean[] optionals = new boolean[0]; 4228 4229 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 4230 String requestJSON = WriteJSON.get( 4231 parameterTypes.get("disable"), 4232 parameterNames.get("disable"), 4233 optionals, webSocketID, 4234 "Page.disable" 4235 ); 4236 4237 // This Remote Command does not have a Return-Value. 4238 return new Script<> 4239 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 4240 } 4241 4242 /** 4243 * Enables page domain notifications. 4244 * 4245 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 4246 * {@link Ret0}></CODE> 4247 * 4248 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 4249 * browser receives the invocation-request. 4250 * 4251 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 4252 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 4253 * {@code >} to ensure the Browser Function has run to completion. 4254 */ 4255 public static Script<String, JsonObject, Ret0> enable() 4256 { 4257 final int webSocketID = 32011000 + counter++; 4258 final boolean[] optionals = new boolean[0]; 4259 4260 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 4261 String requestJSON = WriteJSON.get( 4262 parameterTypes.get("enable"), 4263 parameterNames.get("enable"), 4264 optionals, webSocketID, 4265 "Page.enable" 4266 ); 4267 4268 // This Remote Command does not have a Return-Value. 4269 return new Script<> 4270 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 4271 } 4272 4273 /** 4274 * <CODE>[No Description Provided by Google]</CODE> 4275 * 4276 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 4277 * {@link Ret4}></CODE> 4278 * 4279 * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 4280 * {@link Script#exec()}), and a {@link Promise} returned. 4281 * 4282 * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B> 4283 * (using {@link Promise#await()}), the {@code Ret4} will subsequently 4284 * be returned from that call. 4285 * 4286 * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated 4287 * in an instance of <B>{@link Ret4}</B> 4288 * 4289 * <BR /><BR /><UL CLASS=JDUL> 4290 * <LI><CODE><B>Ret4.a:</B> String (<B>url</B>)</CODE> 4291 * <BR />Manifest location. 4292 * <BR /><BR /></LI> 4293 * <LI><CODE><B>Ret4.b:</B> {@link Page.AppManifestError}[] (<B>errors</B>)</CODE> 4294 * <BR />- 4295 * <BR /><BR /></LI> 4296 * <LI><CODE><B>Ret4.c:</B> String (<B>data</B>)</CODE> 4297 * <BR />Manifest content. 4298 * <BR /><BR /></LI> 4299 * <LI><CODE><B>Ret4.d:</B> {@link Page.AppManifestParsedProperties} (<B>parsed</B>)</CODE> 4300 * <BR />Parsed manifest properties 4301 * </LI> 4302 * </UL> 4303 */ 4304 public static Script<String, JsonObject, Ret4<String, Page.AppManifestError[], String, Page.AppManifestParsedProperties>> 4305 getAppManifest() 4306 { 4307 final int webSocketID = 32012000 + counter++; 4308 final boolean[] optionals = new boolean[0]; 4309 4310 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 4311 String requestJSON = WriteJSON.get( 4312 parameterTypes.get("getAppManifest"), 4313 parameterNames.get("getAppManifest"), 4314 optionals, webSocketID, 4315 "Page.getAppManifest" 4316 ); 4317 4318 // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret4' 4319 Function<JsonObject, Ret4<String, Page.AppManifestError[], String, Page.AppManifestParsedProperties>> 4320 responseProcessor = (JsonObject jo) -> new Ret4<>( 4321 ReadJSON.getString(jo, "url", false, true), 4322 (jo.getJsonArray("errors") == null) 4323 ? null 4324 : ReadArrJSON.DimN.objArr(jo.getJsonArray("errors"), null, 0, Page.AppManifestError[].class), 4325 ReadJSON.getString(jo, "data", true, false), 4326 ReadJSON.XL.getObject(jo, "parsed", Page.AppManifestParsedProperties.class, true, false) 4327 ); 4328 4329 // Pass the 'defaultSender' to Script-Constructor 4330 // The sender that is used can be changed before executing script. 4331 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 4332 } 4333 4334 /** 4335 * <CODE>[No Description Provided by Google]</CODE> 4336 * <BR /><B>EXPERIMENTAL</B> 4337 * 4338 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 4339 * {@link Page.InstallabilityError}[]></CODE> 4340 * 4341 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 4342 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 4343 * {@link Page.InstallabilityError}[]></CODE> will be returned. 4344 * 4345 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 4346 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 4347 * may be retrieved.</I> 4348 * 4349 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 4350 * <BR /><BR /><UL CLASS=JDUL> 4351 * <LI><CODE>{@link Page.InstallabilityError}[] (<B>installabilityErrors</B></CODE>) 4352 * <BR />- 4353 * </LI> 4354 * </UL> */ 4355 public static Script<String, JsonObject, Page.InstallabilityError[]> getInstallabilityErrors() 4356 { 4357 final int webSocketID = 32013000 + counter++; 4358 final boolean[] optionals = new boolean[0]; 4359 4360 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 4361 String requestJSON = WriteJSON.get( 4362 parameterTypes.get("getInstallabilityErrors"), 4363 parameterNames.get("getInstallabilityErrors"), 4364 optionals, webSocketID, 4365 "Page.getInstallabilityErrors" 4366 ); 4367 4368 // 'JSON Binding' ... Converts Browser Response-JSON to 'Page.InstallabilityError[]' 4369 Function<JsonObject, Page.InstallabilityError[]> responseProcessor = (JsonObject jo) -> 4370 (jo.getJsonArray("installabilityErrors") == null) 4371 ? null 4372 : ReadArrJSON.DimN.objArr(jo.getJsonArray("installabilityErrors"), null, 0, Page.InstallabilityError[].class); 4373 4374 // Pass the 'defaultSender' to Script-Constructor 4375 // The sender that is used can be changed before executing script. 4376 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 4377 } 4378 4379 /** 4380 * <CODE>[No Description Provided by Google]</CODE> 4381 * <BR /><B>EXPERIMENTAL</B> 4382 * 4383 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 4384 * String></CODE> 4385 * 4386 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 4387 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 4388 * String></CODE> will be returned. 4389 * 4390 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 4391 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 4392 * may be retrieved.</I> 4393 * 4394 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 4395 * <BR /><BR /><UL CLASS=JDUL> 4396 * <LI><CODE>String (<B>primaryIcon</B></CODE>) 4397 * <BR />- 4398 * </LI> 4399 * </UL> */ 4400 public static Script<String, JsonObject, String> getManifestIcons() 4401 { 4402 final int webSocketID = 32014000 + counter++; 4403 final boolean[] optionals = new boolean[0]; 4404 4405 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 4406 String requestJSON = WriteJSON.get( 4407 parameterTypes.get("getManifestIcons"), 4408 parameterNames.get("getManifestIcons"), 4409 optionals, webSocketID, 4410 "Page.getManifestIcons" 4411 ); 4412 4413 // 'JSON Binding' ... Converts Browser Response-JSON to 'String' 4414 Function<JsonObject, String> responseProcessor = (JsonObject jo) -> 4415 ReadJSON.getString(jo, "primaryIcon", true, false); 4416 4417 // Pass the 'defaultSender' to Script-Constructor 4418 // The sender that is used can be changed before executing script. 4419 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 4420 } 4421 4422 /** 4423 * Returns the unique (PWA) app id. 4424 * Only returns values if the feature flag 'WebAppEnableManifestId' is enabled 4425 * <BR /><B>EXPERIMENTAL</B> 4426 * 4427 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 4428 * {@link Ret2}></CODE> 4429 * 4430 * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 4431 * {@link Script#exec()}), and a {@link Promise} returned. 4432 * 4433 * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B> 4434 * (using {@link Promise#await()}), the {@code Ret2} will subsequently 4435 * be returned from that call. 4436 * 4437 * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated 4438 * in an instance of <B>{@link Ret2}</B> 4439 * 4440 * <BR /><BR /><UL CLASS=JDUL> 4441 * <LI><CODE><B>Ret2.a:</B> String (<B>appId</B>)</CODE> 4442 * <BR />App id, either from manifest's id attribute or computed from start_url 4443 * <BR /><BR /></LI> 4444 * <LI><CODE><B>Ret2.b:</B> String (<B>recommendedId</B>)</CODE> 4445 * <BR />Recommendation for manifest's id attribute to match current id computed from start_url 4446 * </LI> 4447 * </UL> 4448 */ 4449 public static Script<String, JsonObject, Ret2<String, String>> getAppId() 4450 { 4451 final int webSocketID = 32015000 + counter++; 4452 final boolean[] optionals = new boolean[0]; 4453 4454 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 4455 String requestJSON = WriteJSON.get( 4456 parameterTypes.get("getAppId"), 4457 parameterNames.get("getAppId"), 4458 optionals, webSocketID, 4459 "Page.getAppId" 4460 ); 4461 4462 // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret2' 4463 Function<JsonObject, Ret2<String, String>> 4464 responseProcessor = (JsonObject jo) -> new Ret2<>( 4465 ReadJSON.getString(jo, "appId", true, false), 4466 ReadJSON.getString(jo, "recommendedId", true, false) 4467 ); 4468 4469 // Pass the 'defaultSender' to Script-Constructor 4470 // The sender that is used can be changed before executing script. 4471 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 4472 } 4473 4474 /** 4475 * Returns all browser cookies. Depending on the backend support, will return detailed cookie 4476 * information in the <CODE>cookies</CODE> field. 4477 * <BR /><B>EXPERIMENTAL</B> 4478 * <BR /><B>DEPRECATED</B> 4479 * 4480 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 4481 * {@link Network.Cookie}[]></CODE> 4482 * 4483 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 4484 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 4485 * {@link Network.Cookie}[]></CODE> will be returned. 4486 * 4487 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 4488 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 4489 * may be retrieved.</I> 4490 * 4491 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 4492 * <BR /><BR /><UL CLASS=JDUL> 4493 * <LI><CODE>{@link Network.Cookie}[] (<B>cookies</B></CODE>) 4494 * <BR />Array of cookie objects. 4495 * </LI> 4496 * </UL> */ 4497 public static Script<String, JsonObject, Network.Cookie[]> getCookies() 4498 { 4499 final int webSocketID = 32016000 + counter++; 4500 final boolean[] optionals = new boolean[0]; 4501 4502 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 4503 String requestJSON = WriteJSON.get( 4504 parameterTypes.get("getCookies"), 4505 parameterNames.get("getCookies"), 4506 optionals, webSocketID, 4507 "Page.getCookies" 4508 ); 4509 4510 // 'JSON Binding' ... Converts Browser Response-JSON to 'Network.Cookie[]' 4511 Function<JsonObject, Network.Cookie[]> responseProcessor = (JsonObject jo) -> 4512 (jo.getJsonArray("cookies") == null) 4513 ? null 4514 : ReadArrJSON.DimN.objArr(jo.getJsonArray("cookies"), null, 0, Network.Cookie[].class); 4515 4516 // Pass the 'defaultSender' to Script-Constructor 4517 // The sender that is used can be changed before executing script. 4518 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 4519 } 4520 4521 /** 4522 * Returns present frame tree structure. 4523 * 4524 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 4525 * {@link Page.FrameTree}></CODE> 4526 * 4527 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 4528 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 4529 * {@link Page.FrameTree}></CODE> will be returned. 4530 * 4531 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 4532 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 4533 * may be retrieved.</I> 4534 * 4535 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 4536 * <BR /><BR /><UL CLASS=JDUL> 4537 * <LI><CODE>{@link Page.FrameTree} (<B>frameTree</B></CODE>) 4538 * <BR />Present frame tree structure. 4539 * </LI> 4540 * </UL> */ 4541 public static Script<String, JsonObject, Page.FrameTree> getFrameTree() 4542 { 4543 final int webSocketID = 32017000 + counter++; 4544 final boolean[] optionals = new boolean[0]; 4545 4546 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 4547 String requestJSON = WriteJSON.get( 4548 parameterTypes.get("getFrameTree"), 4549 parameterNames.get("getFrameTree"), 4550 optionals, webSocketID, 4551 "Page.getFrameTree" 4552 ); 4553 4554 // 'JSON Binding' ... Converts Browser Response-JSON to 'Page.FrameTree' 4555 Function<JsonObject, Page.FrameTree> responseProcessor = (JsonObject jo) -> 4556 ReadJSON.XL.getObject(jo, "frameTree", Page.FrameTree.class, false, true); 4557 4558 // Pass the 'defaultSender' to Script-Constructor 4559 // The sender that is used can be changed before executing script. 4560 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 4561 } 4562 4563 /** 4564 * Returns metrics relating to the layouting of the page, such as viewport bounds/scale. 4565 * 4566 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 4567 * {@link Ret6}></CODE> 4568 * 4569 * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 4570 * {@link Script#exec()}), and a {@link Promise} returned. 4571 * 4572 * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B> 4573 * (using {@link Promise#await()}), the {@code Ret6} will subsequently 4574 * be returned from that call. 4575 * 4576 * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated 4577 * in an instance of <B>{@link Ret6}</B> 4578 * 4579 * <BR /><BR /><UL CLASS=JDUL> 4580 * <LI><CODE><B>Ret6.a1:</B> {@link Page.LayoutViewport} (<B>layoutViewport</B>)</CODE> 4581 * <BR />Deprecated metrics relating to the layout viewport. Can be in DP or in CSS pixels depending on the <CODE>enable-use-zoom-for-dsf</CODE> flag. Use <CODE>cssLayoutViewport</CODE> instead. 4582 * <BR /><BR /></LI> 4583 * <LI><CODE><B>Ret6.b2:</B> {@link Page.VisualViewport} (<B>visualViewport</B>)</CODE> 4584 * <BR />Deprecated metrics relating to the visual viewport. Can be in DP or in CSS pixels depending on the <CODE>enable-use-zoom-for-dsf</CODE> flag. Use <CODE>cssVisualViewport</CODE> instead. 4585 * <BR /><BR /></LI> 4586 * <LI><CODE><B>Ret6.c3:</B> {@link DOM.Rect} (<B>contentSize</B>)</CODE> 4587 * <BR />Deprecated size of scrollable area. Can be in DP or in CSS pixels depending on the <CODE>enable-use-zoom-for-dsf</CODE> flag. Use <CODE>cssContentSize</CODE> instead. 4588 * <BR /><BR /></LI> 4589 * <LI><CODE><B>Ret6.d4:</B> {@link Page.LayoutViewport} (<B>cssLayoutViewport</B>)</CODE> 4590 * <BR />Metrics relating to the layout viewport in CSS pixels. 4591 * <BR /><BR /></LI> 4592 * <LI><CODE><B>Ret6.e5:</B> {@link Page.VisualViewport} (<B>cssVisualViewport</B>)</CODE> 4593 * <BR />Metrics relating to the visual viewport in CSS pixels. 4594 * <BR /><BR /></LI> 4595 * <LI><CODE><B>Ret6.f6:</B> {@link DOM.Rect} (<B>cssContentSize</B>)</CODE> 4596 * <BR />Size of scrollable area in CSS pixels. 4597 * </LI> 4598 * </UL> 4599 */ 4600 public static Script<String, JsonObject, Ret6<Page.LayoutViewport, Page.VisualViewport, DOM.Rect, Page.LayoutViewport, Page.VisualViewport, DOM.Rect>> 4601 getLayoutMetrics() 4602 { 4603 final int webSocketID = 32018000 + counter++; 4604 final boolean[] optionals = new boolean[0]; 4605 4606 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 4607 String requestJSON = WriteJSON.get( 4608 parameterTypes.get("getLayoutMetrics"), 4609 parameterNames.get("getLayoutMetrics"), 4610 optionals, webSocketID, 4611 "Page.getLayoutMetrics" 4612 ); 4613 4614 // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret6' 4615 Function<JsonObject, Ret6<Page.LayoutViewport, Page.VisualViewport, DOM.Rect, Page.LayoutViewport, Page.VisualViewport, DOM.Rect>> 4616 responseProcessor = (JsonObject jo) -> new Ret6<>( 4617 ReadJSON.XL.getObject(jo, "layoutViewport", Page.LayoutViewport.class, false, true), 4618 ReadJSON.XL.getObject(jo, "visualViewport", Page.VisualViewport.class, false, true), 4619 ReadJSON.XL.getObject(jo, "contentSize", DOM.Rect.class, false, true), 4620 ReadJSON.XL.getObject(jo, "cssLayoutViewport", Page.LayoutViewport.class, false, true), 4621 ReadJSON.XL.getObject(jo, "cssVisualViewport", Page.VisualViewport.class, false, true), 4622 ReadJSON.XL.getObject(jo, "cssContentSize", DOM.Rect.class, false, true) 4623 ); 4624 4625 // Pass the 'defaultSender' to Script-Constructor 4626 // The sender that is used can be changed before executing script. 4627 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 4628 } 4629 4630 /** 4631 * Returns navigation history for the current page. 4632 * 4633 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 4634 * {@link Ret2}></CODE> 4635 * 4636 * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 4637 * {@link Script#exec()}), and a {@link Promise} returned. 4638 * 4639 * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B> 4640 * (using {@link Promise#await()}), the {@code Ret2} will subsequently 4641 * be returned from that call. 4642 * 4643 * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated 4644 * in an instance of <B>{@link Ret2}</B> 4645 * 4646 * <BR /><BR /><UL CLASS=JDUL> 4647 * <LI><CODE><B>Ret2.a:</B> Integer (<B>currentIndex</B>)</CODE> 4648 * <BR />Index of the current navigation history entry. 4649 * <BR /><BR /></LI> 4650 * <LI><CODE><B>Ret2.b:</B> {@link Page.NavigationEntry}[] (<B>entries</B>)</CODE> 4651 * <BR />Array of navigation history entries. 4652 * </LI> 4653 * </UL> 4654 */ 4655 public static Script<String, JsonObject, Ret2<Integer, Page.NavigationEntry[]>> getNavigationHistory() 4656 { 4657 final int webSocketID = 32019000 + counter++; 4658 final boolean[] optionals = new boolean[0]; 4659 4660 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 4661 String requestJSON = WriteJSON.get( 4662 parameterTypes.get("getNavigationHistory"), 4663 parameterNames.get("getNavigationHistory"), 4664 optionals, webSocketID, 4665 "Page.getNavigationHistory" 4666 ); 4667 4668 // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret2' 4669 Function<JsonObject, Ret2<Integer, Page.NavigationEntry[]>> 4670 responseProcessor = (JsonObject jo) -> new Ret2<>( 4671 ReadJSON.getINTEGER(jo, "currentIndex", true), 4672 (jo.getJsonArray("entries") == null) 4673 ? null 4674 : ReadArrJSON.DimN.objArr(jo.getJsonArray("entries"), null, 0, Page.NavigationEntry[].class) 4675 ); 4676 4677 // Pass the 'defaultSender' to Script-Constructor 4678 // The sender that is used can be changed before executing script. 4679 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 4680 } 4681 4682 /** 4683 * Resets navigation history for the current page. 4684 * 4685 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 4686 * {@link Ret0}></CODE> 4687 * 4688 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 4689 * browser receives the invocation-request. 4690 * 4691 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 4692 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 4693 * {@code >} to ensure the Browser Function has run to completion. 4694 */ 4695 public static Script<String, JsonObject, Ret0> resetNavigationHistory() 4696 { 4697 final int webSocketID = 32020000 + counter++; 4698 final boolean[] optionals = new boolean[0]; 4699 4700 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 4701 String requestJSON = WriteJSON.get( 4702 parameterTypes.get("resetNavigationHistory"), 4703 parameterNames.get("resetNavigationHistory"), 4704 optionals, webSocketID, 4705 "Page.resetNavigationHistory" 4706 ); 4707 4708 // This Remote Command does not have a Return-Value. 4709 return new Script<> 4710 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 4711 } 4712 4713 /** 4714 * Returns content of the given resource. 4715 * <BR /><B>EXPERIMENTAL</B> 4716 * 4717 * @param frameId Frame id to get resource for. 4718 * 4719 * @param url URL of the resource to get content for. 4720 * 4721 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 4722 * {@link Ret2}></CODE> 4723 * 4724 * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 4725 * {@link Script#exec()}), and a {@link Promise} returned. 4726 * 4727 * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B> 4728 * (using {@link Promise#await()}), the {@code Ret2} will subsequently 4729 * be returned from that call. 4730 * 4731 * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated 4732 * in an instance of <B>{@link Ret2}</B> 4733 * 4734 * <BR /><BR /><UL CLASS=JDUL> 4735 * <LI><CODE><B>Ret2.a:</B> String (<B>content</B>)</CODE> 4736 * <BR />Resource content. 4737 * <BR /><BR /></LI> 4738 * <LI><CODE><B>Ret2.b:</B> Boolean (<B>base64Encoded</B>)</CODE> 4739 * <BR />True, if content was served as base64. 4740 * </LI> 4741 * </UL> 4742 */ 4743 public static Script<String, JsonObject, Ret2<String, Boolean>> getResourceContent 4744 (String frameId, String url) 4745 { 4746 // Exception-Check(s) to ensure that if any parameters which are not declared as 4747 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4748 4749 if (frameId == null) BRDPC.throwNPE("frameId"); 4750 if (url == null) BRDPC.throwNPE("url"); 4751 4752 final int webSocketID = 32021000 + counter++; 4753 final boolean[] optionals = { false, false, }; 4754 4755 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 4756 String requestJSON = WriteJSON.get( 4757 parameterTypes.get("getResourceContent"), 4758 parameterNames.get("getResourceContent"), 4759 optionals, webSocketID, 4760 "Page.getResourceContent", 4761 frameId, url 4762 ); 4763 4764 // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret2' 4765 Function<JsonObject, Ret2<String, Boolean>> 4766 responseProcessor = (JsonObject jo) -> new Ret2<>( 4767 ReadJSON.getString(jo, "content", false, true), 4768 ReadJSON.getBOOLEAN(jo, "base64Encoded", true) 4769 ); 4770 4771 // Pass the 'defaultSender' to Script-Constructor 4772 // The sender that is used can be changed before executing script. 4773 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 4774 } 4775 4776 /** 4777 * Returns present frame / resource tree structure. 4778 * <BR /><B>EXPERIMENTAL</B> 4779 * 4780 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 4781 * {@link Page.FrameResourceTree}></CODE> 4782 * 4783 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 4784 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 4785 * {@link Page.FrameResourceTree}></CODE> will be returned. 4786 * 4787 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 4788 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 4789 * may be retrieved.</I> 4790 * 4791 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 4792 * <BR /><BR /><UL CLASS=JDUL> 4793 * <LI><CODE>{@link Page.FrameResourceTree} (<B>frameTree</B></CODE>) 4794 * <BR />Present frame / resource tree structure. 4795 * </LI> 4796 * </UL> */ 4797 public static Script<String, JsonObject, Page.FrameResourceTree> getResourceTree() 4798 { 4799 final int webSocketID = 32022000 + counter++; 4800 final boolean[] optionals = new boolean[0]; 4801 4802 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 4803 String requestJSON = WriteJSON.get( 4804 parameterTypes.get("getResourceTree"), 4805 parameterNames.get("getResourceTree"), 4806 optionals, webSocketID, 4807 "Page.getResourceTree" 4808 ); 4809 4810 // 'JSON Binding' ... Converts Browser Response-JSON to 'Page.FrameResourceTree' 4811 Function<JsonObject, Page.FrameResourceTree> responseProcessor = (JsonObject jo) -> 4812 ReadJSON.XL.getObject(jo, "frameTree", Page.FrameResourceTree.class, false, true); 4813 4814 // Pass the 'defaultSender' to Script-Constructor 4815 // The sender that is used can be changed before executing script. 4816 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 4817 } 4818 4819 /** 4820 * Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload). 4821 * 4822 * @param accept Whether to accept or dismiss the dialog. 4823 * 4824 * @param promptText 4825 * The text to enter into the dialog prompt before accepting. Used only if this is a prompt 4826 * dialog. 4827 * <BR /><B>OPTIONAL</B> 4828 * 4829 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 4830 * {@link Ret0}></CODE> 4831 * 4832 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 4833 * browser receives the invocation-request. 4834 * 4835 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 4836 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 4837 * {@code >} to ensure the Browser Function has run to completion. 4838 */ 4839 public static Script<String, JsonObject, Ret0> handleJavaScriptDialog 4840 (boolean accept, String promptText) 4841 { 4842 final int webSocketID = 32023000 + counter++; 4843 final boolean[] optionals = { false, true, }; 4844 4845 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 4846 String requestJSON = WriteJSON.get( 4847 parameterTypes.get("handleJavaScriptDialog"), 4848 parameterNames.get("handleJavaScriptDialog"), 4849 optionals, webSocketID, 4850 "Page.handleJavaScriptDialog", 4851 accept, promptText 4852 ); 4853 4854 // This Remote Command does not have a Return-Value. 4855 return new Script<> 4856 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 4857 } 4858 4859 /** 4860 * Navigates current page to the given URL. 4861 * 4862 * @param url URL to navigate the page to. 4863 * 4864 * @param referrer Referrer URL. 4865 * <BR /><B>OPTIONAL</B> 4866 * 4867 * @param transitionType Intended transition type. 4868 * <BR /><B>OPTIONAL</B> 4869 * 4870 * @param frameId Frame id to navigate, if not specified navigates the top frame. 4871 * <BR /><B>OPTIONAL</B> 4872 * 4873 * @param referrerPolicy Referrer-policy used for the navigation. 4874 * <BR /><B>OPTIONAL</B> 4875 * <BR /><B>EXPERIMENTAL</B> 4876 * 4877 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 4878 * {@link Ret3}></CODE> 4879 * 4880 * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 4881 * {@link Script#exec()}), and a {@link Promise} returned. 4882 * 4883 * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B> 4884 * (using {@link Promise#await()}), the {@code Ret3} will subsequently 4885 * be returned from that call. 4886 * 4887 * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated 4888 * in an instance of <B>{@link Ret3}</B> 4889 * 4890 * <BR /><BR /><UL CLASS=JDUL> 4891 * <LI><CODE><B>Ret3.a:</B> String (<B>frameId</B>)</CODE> 4892 * <BR />Frame id that has navigated (or failed to navigate) 4893 * <BR /><BR /></LI> 4894 * <LI><CODE><B>Ret3.b:</B> String (<B>loaderId</B>)</CODE> 4895 * <BR />Loader identifier. 4896 * <BR /><BR /></LI> 4897 * <LI><CODE><B>Ret3.c:</B> String (<B>errorText</B>)</CODE> 4898 * <BR />User friendly error message, present if and only if navigation has failed. 4899 * </LI> 4900 * </UL> 4901 */ 4902 public static Script<String, JsonObject, Ret3<String, String, String>> navigate 4903 (String url, String referrer, String transitionType, String frameId, String referrerPolicy) 4904 { 4905 // Exception-Check(s) to ensure that if any parameters which are not declared as 4906 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4907 4908 if (url == null) BRDPC.throwNPE("url"); 4909 4910 // Exception-Check(s) to ensure that if any parameters which must adhere to a 4911 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 4912 4913 BRDPC.checkIAE("transitionType", transitionType, "Page.TransitionType", Page.TransitionType); 4914 BRDPC.checkIAE("referrerPolicy", referrerPolicy, "Page.ReferrerPolicy", Page.ReferrerPolicy); 4915 4916 final int webSocketID = 32024000 + counter++; 4917 final boolean[] optionals = { false, true, true, true, true, }; 4918 4919 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 4920 String requestJSON = WriteJSON.get( 4921 parameterTypes.get("navigate"), 4922 parameterNames.get("navigate"), 4923 optionals, webSocketID, 4924 "Page.navigate", 4925 url, referrer, transitionType, frameId, referrerPolicy 4926 ); 4927 4928 // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret3' 4929 Function<JsonObject, Ret3<String, String, String>> 4930 responseProcessor = (JsonObject jo) -> new Ret3<>( 4931 ReadJSON.getString(jo, "frameId", false, true), 4932 ReadJSON.getString(jo, "loaderId", true, false), 4933 ReadJSON.getString(jo, "errorText", true, false) 4934 ); 4935 4936 // Pass the 'defaultSender' to Script-Constructor 4937 // The sender that is used can be changed before executing script. 4938 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 4939 } 4940 4941 /** 4942 * Navigates current page to the given history entry. 4943 * 4944 * @param entryId Unique id of the entry to navigate to. 4945 * 4946 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 4947 * {@link Ret0}></CODE> 4948 * 4949 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 4950 * browser receives the invocation-request. 4951 * 4952 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 4953 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 4954 * {@code >} to ensure the Browser Function has run to completion. 4955 */ 4956 public static Script<String, JsonObject, Ret0> navigateToHistoryEntry(int entryId) 4957 { 4958 final int webSocketID = 32025000 + counter++; 4959 final boolean[] optionals = { false, }; 4960 4961 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 4962 String requestJSON = WriteJSON.get( 4963 parameterTypes.get("navigateToHistoryEntry"), 4964 parameterNames.get("navigateToHistoryEntry"), 4965 optionals, webSocketID, 4966 "Page.navigateToHistoryEntry", 4967 entryId 4968 ); 4969 4970 // This Remote Command does not have a Return-Value. 4971 return new Script<> 4972 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 4973 } 4974 4975 /** 4976 * Print page as PDF. 4977 * 4978 * @param landscape Paper orientation. Defaults to false. 4979 * <BR /><B>OPTIONAL</B> 4980 * 4981 * @param displayHeaderFooter Display header and footer. Defaults to false. 4982 * <BR /><B>OPTIONAL</B> 4983 * 4984 * @param printBackground Print background graphics. Defaults to false. 4985 * <BR /><B>OPTIONAL</B> 4986 * 4987 * @param scale Scale of the webpage rendering. Defaults to 1. 4988 * <BR /><B>OPTIONAL</B> 4989 * 4990 * @param paperWidth Paper width in inches. Defaults to 8.5 inches. 4991 * <BR /><B>OPTIONAL</B> 4992 * 4993 * @param paperHeight Paper height in inches. Defaults to 11 inches. 4994 * <BR /><B>OPTIONAL</B> 4995 * 4996 * @param marginTop Top margin in inches. Defaults to 1cm (~0.4 inches). 4997 * <BR /><B>OPTIONAL</B> 4998 * 4999 * @param marginBottom Bottom margin in inches. Defaults to 1cm (~0.4 inches). 5000 * <BR /><B>OPTIONAL</B> 5001 * 5002 * @param marginLeft Left margin in inches. Defaults to 1cm (~0.4 inches). 5003 * <BR /><B>OPTIONAL</B> 5004 * 5005 * @param marginRight Right margin in inches. Defaults to 1cm (~0.4 inches). 5006 * <BR /><B>OPTIONAL</B> 5007 * 5008 * @param pageRanges 5009 * Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means 5010 * print all pages. 5011 * <BR /><B>OPTIONAL</B> 5012 * 5013 * @param ignoreInvalidPageRanges 5014 * Whether to silently ignore invalid but successfully parsed page ranges, such as '3-2'. 5015 * Defaults to false. 5016 * <BR /><B>OPTIONAL</B> 5017 * 5018 * @param headerTemplate 5019 * HTML template for the print header. Should be valid HTML markup with following 5020 * classes used to inject printing values into them: 5021 * - <CODE>date</CODE>: formatted print date 5022 * - <CODE>title</CODE>: document title 5023 * - <CODE>url</CODE>: document location 5024 * - <CODE>pageNumber</CODE>: current page number 5025 * - <CODE>totalPages</CODE>: total pages in the document 5026 * 5027 * For example, <CODE><span class=title></span></CODE> would generate span containing the title. 5028 * <BR /><B>OPTIONAL</B> 5029 * 5030 * @param footerTemplate HTML template for the print footer. Should use the same format as the <CODE>headerTemplate</CODE>. 5031 * <BR /><B>OPTIONAL</B> 5032 * 5033 * @param preferCSSPageSize 5034 * Whether or not to prefer page size as defined by css. Defaults to false, 5035 * in which case the content will be scaled to fit the paper size. 5036 * <BR /><B>OPTIONAL</B> 5037 * 5038 * @param transferMode return as stream 5039 * <BR />Acceptable Values: ["ReturnAsBase64", "ReturnAsStream"] 5040 * <BR /><B>OPTIONAL</B> 5041 * <BR /><B>EXPERIMENTAL</B> 5042 * 5043 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5044 * {@link Ret2}></CODE> 5045 * 5046 * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 5047 * {@link Script#exec()}), and a {@link Promise} returned. 5048 * 5049 * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B> 5050 * (using {@link Promise#await()}), the {@code Ret2} will subsequently 5051 * be returned from that call. 5052 * 5053 * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated 5054 * in an instance of <B>{@link Ret2}</B> 5055 * 5056 * <BR /><BR /><UL CLASS=JDUL> 5057 * <LI><CODE><B>Ret2.a:</B> String (<B>data</B>)</CODE> 5058 * <BR />Base64-encoded pdf data. Empty if |returnAsStream| is specified. (Encoded as a base64 string when passed over JSON) 5059 * <BR /><BR /></LI> 5060 * <LI><CODE><B>Ret2.b:</B> String (<B>stream</B>)</CODE> 5061 * <BR />A handle of the stream that holds resulting PDF data. 5062 * </LI> 5063 * </UL> 5064 */ 5065 public static Script<String, JsonObject, Ret2<String, String>> printToPDF( 5066 Boolean landscape, Boolean displayHeaderFooter, Boolean printBackground, Number scale, 5067 Number paperWidth, Number paperHeight, Number marginTop, Number marginBottom, 5068 Number marginLeft, Number marginRight, String pageRanges, 5069 Boolean ignoreInvalidPageRanges, String headerTemplate, String footerTemplate, 5070 Boolean preferCSSPageSize, String transferMode 5071 ) 5072 { 5073 // Exception-Check(s) to ensure that if any parameters which must adhere to a 5074 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 5075 5076 BRDPC.checkIAE( 5077 "transferMode", transferMode, 5078 "ReturnAsBase64", "ReturnAsStream" 5079 ); 5080 5081 final int webSocketID = 32026000 + counter++; 5082 final boolean[] optionals = { true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, }; 5083 5084 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5085 String requestJSON = WriteJSON.get( 5086 parameterTypes.get("printToPDF"), 5087 parameterNames.get("printToPDF"), 5088 optionals, webSocketID, 5089 "Page.printToPDF", 5090 landscape, displayHeaderFooter, printBackground, scale, paperWidth, paperHeight, 5091 marginTop, marginBottom, marginLeft, marginRight, pageRanges, ignoreInvalidPageRanges, 5092 headerTemplate, footerTemplate, preferCSSPageSize, transferMode 5093 ); 5094 5095 // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret2' 5096 Function<JsonObject, Ret2<String, String>> 5097 responseProcessor = (JsonObject jo) -> new Ret2<>( 5098 ReadJSON.getString(jo, "data", false, true), 5099 ReadJSON.getString(jo, "stream", true, false) 5100 ); 5101 5102 // Pass the 'defaultSender' to Script-Constructor 5103 // The sender that is used can be changed before executing script. 5104 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 5105 } 5106 5107 /** 5108 * Reloads given page optionally ignoring the cache. 5109 * 5110 * @param ignoreCache If true, browser cache is ignored (as if the user pressed Shift+refresh). 5111 * <BR /><B>OPTIONAL</B> 5112 * 5113 * @param scriptToEvaluateOnLoad 5114 * If set, the script will be injected into all frames of the inspected page after reload. 5115 * Argument will be ignored if reloading dataURL origin. 5116 * <BR /><B>OPTIONAL</B> 5117 * 5118 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5119 * {@link Ret0}></CODE> 5120 * 5121 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 5122 * browser receives the invocation-request. 5123 * 5124 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 5125 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 5126 * {@code >} to ensure the Browser Function has run to completion. 5127 */ 5128 public static Script<String, JsonObject, Ret0> reload 5129 (Boolean ignoreCache, String scriptToEvaluateOnLoad) 5130 { 5131 final int webSocketID = 32027000 + counter++; 5132 final boolean[] optionals = { true, true, }; 5133 5134 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5135 String requestJSON = WriteJSON.get( 5136 parameterTypes.get("reload"), 5137 parameterNames.get("reload"), 5138 optionals, webSocketID, 5139 "Page.reload", 5140 ignoreCache, scriptToEvaluateOnLoad 5141 ); 5142 5143 // This Remote Command does not have a Return-Value. 5144 return new Script<> 5145 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 5146 } 5147 5148 /** 5149 * Deprecated, please use removeScriptToEvaluateOnNewDocument instead. 5150 * <BR /><B>EXPERIMENTAL</B> 5151 * <BR /><B>DEPRECATED</B> 5152 * 5153 * @param identifier - 5154 * 5155 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5156 * {@link Ret0}></CODE> 5157 * 5158 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 5159 * browser receives the invocation-request. 5160 * 5161 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 5162 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 5163 * {@code >} to ensure the Browser Function has run to completion. 5164 */ 5165 public static Script<String, JsonObject, Ret0> removeScriptToEvaluateOnLoad 5166 (String identifier) 5167 { 5168 // Exception-Check(s) to ensure that if any parameters which are not declared as 5169 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5170 5171 if (identifier == null) BRDPC.throwNPE("identifier"); 5172 5173 final int webSocketID = 32028000 + counter++; 5174 final boolean[] optionals = { false, }; 5175 5176 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5177 String requestJSON = WriteJSON.get( 5178 parameterTypes.get("removeScriptToEvaluateOnLoad"), 5179 parameterNames.get("removeScriptToEvaluateOnLoad"), 5180 optionals, webSocketID, 5181 "Page.removeScriptToEvaluateOnLoad", 5182 identifier 5183 ); 5184 5185 // This Remote Command does not have a Return-Value. 5186 return new Script<> 5187 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 5188 } 5189 5190 /** 5191 * Removes given script from the list. 5192 * 5193 * @param identifier - 5194 * 5195 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5196 * {@link Ret0}></CODE> 5197 * 5198 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 5199 * browser receives the invocation-request. 5200 * 5201 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 5202 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 5203 * {@code >} to ensure the Browser Function has run to completion. 5204 */ 5205 public static Script<String, JsonObject, Ret0> removeScriptToEvaluateOnNewDocument 5206 (String identifier) 5207 { 5208 // Exception-Check(s) to ensure that if any parameters which are not declared as 5209 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5210 5211 if (identifier == null) BRDPC.throwNPE("identifier"); 5212 5213 final int webSocketID = 32029000 + counter++; 5214 final boolean[] optionals = { false, }; 5215 5216 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5217 String requestJSON = WriteJSON.get( 5218 parameterTypes.get("removeScriptToEvaluateOnNewDocument"), 5219 parameterNames.get("removeScriptToEvaluateOnNewDocument"), 5220 optionals, webSocketID, 5221 "Page.removeScriptToEvaluateOnNewDocument", 5222 identifier 5223 ); 5224 5225 // This Remote Command does not have a Return-Value. 5226 return new Script<> 5227 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 5228 } 5229 5230 /** 5231 * Acknowledges that a screencast frame has been received by the frontend. 5232 * <BR /><B>EXPERIMENTAL</B> 5233 * 5234 * @param sessionId Frame number. 5235 * 5236 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5237 * {@link Ret0}></CODE> 5238 * 5239 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 5240 * browser receives the invocation-request. 5241 * 5242 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 5243 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 5244 * {@code >} to ensure the Browser Function has run to completion. 5245 */ 5246 public static Script<String, JsonObject, Ret0> screencastFrameAck(int sessionId) 5247 { 5248 final int webSocketID = 32030000 + counter++; 5249 final boolean[] optionals = { false, }; 5250 5251 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5252 String requestJSON = WriteJSON.get( 5253 parameterTypes.get("screencastFrameAck"), 5254 parameterNames.get("screencastFrameAck"), 5255 optionals, webSocketID, 5256 "Page.screencastFrameAck", 5257 sessionId 5258 ); 5259 5260 // This Remote Command does not have a Return-Value. 5261 return new Script<> 5262 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 5263 } 5264 5265 /** 5266 * Searches for given string in resource content. 5267 * <BR /><B>EXPERIMENTAL</B> 5268 * 5269 * @param frameId Frame id for resource to search in. 5270 * 5271 * @param url URL of the resource to search in. 5272 * 5273 * @param query String to search for. 5274 * 5275 * @param caseSensitive If true, search is case sensitive. 5276 * <BR /><B>OPTIONAL</B> 5277 * 5278 * @param isRegex If true, treats string parameter as regex. 5279 * <BR /><B>OPTIONAL</B> 5280 * 5281 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5282 * {@link Debugger.SearchMatch}[]></CODE> 5283 * 5284 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 5285 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 5286 * {@link Debugger.SearchMatch}[]></CODE> will be returned. 5287 * 5288 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 5289 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 5290 * may be retrieved.</I> 5291 * 5292 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 5293 * <BR /><BR /><UL CLASS=JDUL> 5294 * <LI><CODE>{@link Debugger.SearchMatch}[] (<B>result</B></CODE>) 5295 * <BR />List of search matches. 5296 * </LI> 5297 * </UL> */ 5298 public static Script<String, JsonObject, Debugger.SearchMatch[]> searchInResource 5299 (String frameId, String url, String query, Boolean caseSensitive, Boolean isRegex) 5300 { 5301 // Exception-Check(s) to ensure that if any parameters which are not declared as 5302 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5303 5304 if (frameId == null) BRDPC.throwNPE("frameId"); 5305 if (url == null) BRDPC.throwNPE("url"); 5306 if (query == null) BRDPC.throwNPE("query"); 5307 5308 final int webSocketID = 32031000 + counter++; 5309 final boolean[] optionals = { false, false, false, true, true, }; 5310 5311 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5312 String requestJSON = WriteJSON.get( 5313 parameterTypes.get("searchInResource"), 5314 parameterNames.get("searchInResource"), 5315 optionals, webSocketID, 5316 "Page.searchInResource", 5317 frameId, url, query, caseSensitive, isRegex 5318 ); 5319 5320 // 'JSON Binding' ... Converts Browser Response-JSON to 'Debugger.SearchMatch[]' 5321 Function<JsonObject, Debugger.SearchMatch[]> responseProcessor = (JsonObject jo) -> 5322 (jo.getJsonArray("result") == null) 5323 ? null 5324 : ReadArrJSON.DimN.objArr(jo.getJsonArray("result"), null, 0, Debugger.SearchMatch[].class); 5325 5326 // Pass the 'defaultSender' to Script-Constructor 5327 // The sender that is used can be changed before executing script. 5328 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 5329 } 5330 5331 /** 5332 * Enable Chrome's experimental ad filter on all sites. 5333 * <BR /><B>EXPERIMENTAL</B> 5334 * 5335 * @param enabled Whether to block ads. 5336 * 5337 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5338 * {@link Ret0}></CODE> 5339 * 5340 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 5341 * browser receives the invocation-request. 5342 * 5343 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 5344 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 5345 * {@code >} to ensure the Browser Function has run to completion. 5346 */ 5347 public static Script<String, JsonObject, Ret0> setAdBlockingEnabled(boolean enabled) 5348 { 5349 final int webSocketID = 32032000 + counter++; 5350 final boolean[] optionals = { false, }; 5351 5352 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5353 String requestJSON = WriteJSON.get( 5354 parameterTypes.get("setAdBlockingEnabled"), 5355 parameterNames.get("setAdBlockingEnabled"), 5356 optionals, webSocketID, 5357 "Page.setAdBlockingEnabled", 5358 enabled 5359 ); 5360 5361 // This Remote Command does not have a Return-Value. 5362 return new Script<> 5363 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 5364 } 5365 5366 /** 5367 * Enable page Content Security Policy by-passing. 5368 * <BR /><B>EXPERIMENTAL</B> 5369 * 5370 * @param enabled Whether to bypass page CSP. 5371 * 5372 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5373 * {@link Ret0}></CODE> 5374 * 5375 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 5376 * browser receives the invocation-request. 5377 * 5378 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 5379 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 5380 * {@code >} to ensure the Browser Function has run to completion. 5381 */ 5382 public static Script<String, JsonObject, Ret0> setBypassCSP(boolean enabled) 5383 { 5384 final int webSocketID = 32033000 + counter++; 5385 final boolean[] optionals = { false, }; 5386 5387 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5388 String requestJSON = WriteJSON.get( 5389 parameterTypes.get("setBypassCSP"), 5390 parameterNames.get("setBypassCSP"), 5391 optionals, webSocketID, 5392 "Page.setBypassCSP", 5393 enabled 5394 ); 5395 5396 // This Remote Command does not have a Return-Value. 5397 return new Script<> 5398 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 5399 } 5400 5401 /** 5402 * Get Permissions Policy state on given frame. 5403 * <BR /><B>EXPERIMENTAL</B> 5404 * 5405 * @param frameId - 5406 * 5407 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5408 * {@link Page.PermissionsPolicyFeatureState}[]></CODE> 5409 * 5410 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 5411 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 5412 * {@link Page.PermissionsPolicyFeatureState}[]></CODE> will be returned. 5413 * 5414 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 5415 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 5416 * may be retrieved.</I> 5417 * 5418 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 5419 * <BR /><BR /><UL CLASS=JDUL> 5420 * <LI><CODE>{@link Page.PermissionsPolicyFeatureState}[] (<B>states</B></CODE>) 5421 * <BR />- 5422 * </LI> 5423 * </UL> */ 5424 public static Script<String, JsonObject, Page.PermissionsPolicyFeatureState[]> getPermissionsPolicyState 5425 (String frameId) 5426 { 5427 // Exception-Check(s) to ensure that if any parameters which are not declared as 5428 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5429 5430 if (frameId == null) BRDPC.throwNPE("frameId"); 5431 5432 final int webSocketID = 32034000 + counter++; 5433 final boolean[] optionals = { false, }; 5434 5435 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5436 String requestJSON = WriteJSON.get( 5437 parameterTypes.get("getPermissionsPolicyState"), 5438 parameterNames.get("getPermissionsPolicyState"), 5439 optionals, webSocketID, 5440 "Page.getPermissionsPolicyState", 5441 frameId 5442 ); 5443 5444 // 'JSON Binding' ... Converts Browser Response-JSON to 'Page.PermissionsPolicyFeatureState[]' 5445 Function<JsonObject, Page.PermissionsPolicyFeatureState[]> responseProcessor = (JsonObject jo) -> 5446 (jo.getJsonArray("states") == null) 5447 ? null 5448 : ReadArrJSON.DimN.objArr(jo.getJsonArray("states"), null, 0, Page.PermissionsPolicyFeatureState[].class); 5449 5450 // Pass the 'defaultSender' to Script-Constructor 5451 // The sender that is used can be changed before executing script. 5452 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 5453 } 5454 5455 /** 5456 * Get Origin Trials on given frame. 5457 * <BR /><B>EXPERIMENTAL</B> 5458 * 5459 * @param frameId - 5460 * 5461 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5462 * {@link Page.OriginTrial}[]></CODE> 5463 * 5464 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 5465 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 5466 * {@link Page.OriginTrial}[]></CODE> will be returned. 5467 * 5468 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 5469 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 5470 * may be retrieved.</I> 5471 * 5472 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 5473 * <BR /><BR /><UL CLASS=JDUL> 5474 * <LI><CODE>{@link Page.OriginTrial}[] (<B>originTrials</B></CODE>) 5475 * <BR />- 5476 * </LI> 5477 * </UL> */ 5478 public static Script<String, JsonObject, Page.OriginTrial[]> getOriginTrials(String frameId) 5479 { 5480 // Exception-Check(s) to ensure that if any parameters which are not declared as 5481 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5482 5483 if (frameId == null) BRDPC.throwNPE("frameId"); 5484 5485 final int webSocketID = 32035000 + counter++; 5486 final boolean[] optionals = { false, }; 5487 5488 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5489 String requestJSON = WriteJSON.get( 5490 parameterTypes.get("getOriginTrials"), 5491 parameterNames.get("getOriginTrials"), 5492 optionals, webSocketID, 5493 "Page.getOriginTrials", 5494 frameId 5495 ); 5496 5497 // 'JSON Binding' ... Converts Browser Response-JSON to 'Page.OriginTrial[]' 5498 Function<JsonObject, Page.OriginTrial[]> responseProcessor = (JsonObject jo) -> 5499 (jo.getJsonArray("originTrials") == null) 5500 ? null 5501 : ReadArrJSON.DimN.objArr(jo.getJsonArray("originTrials"), null, 0, Page.OriginTrial[].class); 5502 5503 // Pass the 'defaultSender' to Script-Constructor 5504 // The sender that is used can be changed before executing script. 5505 return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor); 5506 } 5507 5508 /** 5509 * Overrides the values of device screen dimensions (window.screen.width, window.screen.height, 5510 * window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media 5511 * query results). 5512 * <BR /><B>EXPERIMENTAL</B> 5513 * <BR /><B>DEPRECATED</B> 5514 * 5515 * @param width Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override. 5516 * 5517 * @param height Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override. 5518 * 5519 * @param deviceScaleFactor Overriding device scale factor value. 0 disables the override. 5520 * 5521 * @param mobile 5522 * Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text 5523 * autosizing and more. 5524 * 5525 * @param scale Scale to apply to resulting view image. 5526 * <BR /><B>OPTIONAL</B> 5527 * 5528 * @param screenWidth Overriding screen width value in pixels (minimum 0, maximum 10000000). 5529 * <BR /><B>OPTIONAL</B> 5530 * 5531 * @param screenHeight Overriding screen height value in pixels (minimum 0, maximum 10000000). 5532 * <BR /><B>OPTIONAL</B> 5533 * 5534 * @param positionX Overriding view X position on screen in pixels (minimum 0, maximum 10000000). 5535 * <BR /><B>OPTIONAL</B> 5536 * 5537 * @param positionY Overriding view Y position on screen in pixels (minimum 0, maximum 10000000). 5538 * <BR /><B>OPTIONAL</B> 5539 * 5540 * @param dontSetVisibleSize Do not set visible view size, rely upon explicit setVisibleSize call. 5541 * <BR /><B>OPTIONAL</B> 5542 * 5543 * @param screenOrientation Screen orientation override. 5544 * <BR /><B>OPTIONAL</B> 5545 * 5546 * @param viewport The viewport dimensions and scale. If not set, the override is cleared. 5547 * <BR /><B>OPTIONAL</B> 5548 * 5549 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5550 * {@link Ret0}></CODE> 5551 * 5552 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 5553 * browser receives the invocation-request. 5554 * 5555 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 5556 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 5557 * {@code >} to ensure the Browser Function has run to completion. 5558 */ 5559 public static Script<String, JsonObject, Ret0> setDeviceMetricsOverride( 5560 int width, int height, Number deviceScaleFactor, boolean mobile, Number scale, 5561 Integer screenWidth, Integer screenHeight, Integer positionX, Integer positionY, 5562 Boolean dontSetVisibleSize, Emulation.ScreenOrientation screenOrientation, 5563 Page.Viewport viewport 5564 ) 5565 { 5566 // Exception-Check(s) to ensure that if any parameters which are not declared as 5567 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5568 5569 if (deviceScaleFactor == null) BRDPC.throwNPE("deviceScaleFactor"); 5570 5571 final int webSocketID = 32036000 + counter++; 5572 final boolean[] optionals = { false, false, false, false, true, true, true, true, true, true, true, true, }; 5573 5574 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5575 String requestJSON = WriteJSON.get( 5576 parameterTypes.get("setDeviceMetricsOverride"), 5577 parameterNames.get("setDeviceMetricsOverride"), 5578 optionals, webSocketID, 5579 "Page.setDeviceMetricsOverride", 5580 width, height, deviceScaleFactor, mobile, scale, screenWidth, screenHeight, positionX, 5581 positionY, dontSetVisibleSize, screenOrientation, viewport 5582 ); 5583 5584 // This Remote Command does not have a Return-Value. 5585 return new Script<> 5586 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 5587 } 5588 5589 /** 5590 * Overrides the Device Orientation. 5591 * <BR /><B>EXPERIMENTAL</B> 5592 * <BR /><B>DEPRECATED</B> 5593 * 5594 * @param alpha Mock alpha 5595 * 5596 * @param beta Mock beta 5597 * 5598 * @param gamma Mock gamma 5599 * 5600 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5601 * {@link Ret0}></CODE> 5602 * 5603 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 5604 * browser receives the invocation-request. 5605 * 5606 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 5607 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 5608 * {@code >} to ensure the Browser Function has run to completion. 5609 */ 5610 public static Script<String, JsonObject, Ret0> setDeviceOrientationOverride 5611 (Number alpha, Number beta, Number gamma) 5612 { 5613 // Exception-Check(s) to ensure that if any parameters which are not declared as 5614 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5615 5616 if (alpha == null) BRDPC.throwNPE("alpha"); 5617 if (beta == null) BRDPC.throwNPE("beta"); 5618 if (gamma == null) BRDPC.throwNPE("gamma"); 5619 5620 final int webSocketID = 32037000 + counter++; 5621 final boolean[] optionals = { false, false, false, }; 5622 5623 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5624 String requestJSON = WriteJSON.get( 5625 parameterTypes.get("setDeviceOrientationOverride"), 5626 parameterNames.get("setDeviceOrientationOverride"), 5627 optionals, webSocketID, 5628 "Page.setDeviceOrientationOverride", 5629 alpha, beta, gamma 5630 ); 5631 5632 // This Remote Command does not have a Return-Value. 5633 return new Script<> 5634 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 5635 } 5636 5637 /** 5638 * Set generic font families. 5639 * <BR /><B>EXPERIMENTAL</B> 5640 * 5641 * @param fontFamilies Specifies font families to set. If a font family is not specified, it won't be changed. 5642 * 5643 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5644 * {@link Ret0}></CODE> 5645 * 5646 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 5647 * browser receives the invocation-request. 5648 * 5649 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 5650 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 5651 * {@code >} to ensure the Browser Function has run to completion. 5652 */ 5653 public static Script<String, JsonObject, Ret0> setFontFamilies 5654 (Page.FontFamilies fontFamilies) 5655 { 5656 // Exception-Check(s) to ensure that if any parameters which are not declared as 5657 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5658 5659 if (fontFamilies == null) BRDPC.throwNPE("fontFamilies"); 5660 5661 final int webSocketID = 32038000 + counter++; 5662 final boolean[] optionals = { false, }; 5663 5664 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5665 String requestJSON = WriteJSON.get( 5666 parameterTypes.get("setFontFamilies"), 5667 parameterNames.get("setFontFamilies"), 5668 optionals, webSocketID, 5669 "Page.setFontFamilies", 5670 fontFamilies 5671 ); 5672 5673 // This Remote Command does not have a Return-Value. 5674 return new Script<> 5675 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 5676 } 5677 5678 /** 5679 * Set default font sizes. 5680 * <BR /><B>EXPERIMENTAL</B> 5681 * 5682 * @param fontSizes Specifies font sizes to set. If a font size is not specified, it won't be changed. 5683 * 5684 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5685 * {@link Ret0}></CODE> 5686 * 5687 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 5688 * browser receives the invocation-request. 5689 * 5690 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 5691 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 5692 * {@code >} to ensure the Browser Function has run to completion. 5693 */ 5694 public static Script<String, JsonObject, Ret0> setFontSizes(Page.FontSizes fontSizes) 5695 { 5696 // Exception-Check(s) to ensure that if any parameters which are not declared as 5697 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5698 5699 if (fontSizes == null) BRDPC.throwNPE("fontSizes"); 5700 5701 final int webSocketID = 32039000 + counter++; 5702 final boolean[] optionals = { false, }; 5703 5704 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5705 String requestJSON = WriteJSON.get( 5706 parameterTypes.get("setFontSizes"), 5707 parameterNames.get("setFontSizes"), 5708 optionals, webSocketID, 5709 "Page.setFontSizes", 5710 fontSizes 5711 ); 5712 5713 // This Remote Command does not have a Return-Value. 5714 return new Script<> 5715 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 5716 } 5717 5718 /** 5719 * Sets given markup as the document's HTML. 5720 * 5721 * @param frameId Frame id to set HTML for. 5722 * 5723 * @param html HTML content to set. 5724 * 5725 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5726 * {@link Ret0}></CODE> 5727 * 5728 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 5729 * browser receives the invocation-request. 5730 * 5731 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 5732 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 5733 * {@code >} to ensure the Browser Function has run to completion. 5734 */ 5735 public static Script<String, JsonObject, Ret0> setDocumentContent 5736 (String frameId, String html) 5737 { 5738 // Exception-Check(s) to ensure that if any parameters which are not declared as 5739 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5740 5741 if (frameId == null) BRDPC.throwNPE("frameId"); 5742 if (html == null) BRDPC.throwNPE("html"); 5743 5744 final int webSocketID = 32040000 + counter++; 5745 final boolean[] optionals = { false, false, }; 5746 5747 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5748 String requestJSON = WriteJSON.get( 5749 parameterTypes.get("setDocumentContent"), 5750 parameterNames.get("setDocumentContent"), 5751 optionals, webSocketID, 5752 "Page.setDocumentContent", 5753 frameId, html 5754 ); 5755 5756 // This Remote Command does not have a Return-Value. 5757 return new Script<> 5758 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 5759 } 5760 5761 /** 5762 * Set the behavior when downloading a file. 5763 * <BR /><B>EXPERIMENTAL</B> 5764 * <BR /><B>DEPRECATED</B> 5765 * 5766 * @param behavior 5767 * Whether to allow all or deny all download requests, or use default Chrome behavior if 5768 * available (otherwise deny). 5769 * <BR />Acceptable Values: ["deny", "allow", "default"] 5770 * 5771 * @param downloadPath The default path to save downloaded files to. This is required if behavior is set to 'allow' 5772 * <BR /><B>OPTIONAL</B> 5773 * 5774 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5775 * {@link Ret0}></CODE> 5776 * 5777 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 5778 * browser receives the invocation-request. 5779 * 5780 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 5781 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 5782 * {@code >} to ensure the Browser Function has run to completion. 5783 */ 5784 public static Script<String, JsonObject, Ret0> setDownloadBehavior 5785 (String behavior, String downloadPath) 5786 { 5787 // Exception-Check(s) to ensure that if any parameters which are not declared as 5788 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5789 5790 if (behavior == null) BRDPC.throwNPE("behavior"); 5791 5792 // Exception-Check(s) to ensure that if any parameters which must adhere to a 5793 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 5794 5795 BRDPC.checkIAE( 5796 "behavior", behavior, 5797 "deny", "allow", "default" 5798 ); 5799 5800 final int webSocketID = 32041000 + counter++; 5801 final boolean[] optionals = { false, true, }; 5802 5803 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5804 String requestJSON = WriteJSON.get( 5805 parameterTypes.get("setDownloadBehavior"), 5806 parameterNames.get("setDownloadBehavior"), 5807 optionals, webSocketID, 5808 "Page.setDownloadBehavior", 5809 behavior, downloadPath 5810 ); 5811 5812 // This Remote Command does not have a Return-Value. 5813 return new Script<> 5814 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 5815 } 5816 5817 /** 5818 * Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position 5819 * unavailable. 5820 * <BR /><B>DEPRECATED</B> 5821 * 5822 * @param latitude Mock latitude 5823 * <BR /><B>OPTIONAL</B> 5824 * 5825 * @param longitude Mock longitude 5826 * <BR /><B>OPTIONAL</B> 5827 * 5828 * @param accuracy Mock accuracy 5829 * <BR /><B>OPTIONAL</B> 5830 * 5831 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5832 * {@link Ret0}></CODE> 5833 * 5834 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 5835 * browser receives the invocation-request. 5836 * 5837 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 5838 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 5839 * {@code >} to ensure the Browser Function has run to completion. 5840 */ 5841 public static Script<String, JsonObject, Ret0> setGeolocationOverride 5842 (Number latitude, Number longitude, Number accuracy) 5843 { 5844 final int webSocketID = 32042000 + counter++; 5845 final boolean[] optionals = { true, true, true, }; 5846 5847 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5848 String requestJSON = WriteJSON.get( 5849 parameterTypes.get("setGeolocationOverride"), 5850 parameterNames.get("setGeolocationOverride"), 5851 optionals, webSocketID, 5852 "Page.setGeolocationOverride", 5853 latitude, longitude, accuracy 5854 ); 5855 5856 // This Remote Command does not have a Return-Value. 5857 return new Script<> 5858 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 5859 } 5860 5861 /** 5862 * Controls whether page will emit lifecycle events. 5863 * <BR /><B>EXPERIMENTAL</B> 5864 * 5865 * @param enabled If true, starts emitting lifecycle events. 5866 * 5867 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5868 * {@link Ret0}></CODE> 5869 * 5870 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 5871 * browser receives the invocation-request. 5872 * 5873 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 5874 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 5875 * {@code >} to ensure the Browser Function has run to completion. 5876 */ 5877 public static Script<String, JsonObject, Ret0> setLifecycleEventsEnabled(boolean enabled) 5878 { 5879 final int webSocketID = 32043000 + counter++; 5880 final boolean[] optionals = { false, }; 5881 5882 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5883 String requestJSON = WriteJSON.get( 5884 parameterTypes.get("setLifecycleEventsEnabled"), 5885 parameterNames.get("setLifecycleEventsEnabled"), 5886 optionals, webSocketID, 5887 "Page.setLifecycleEventsEnabled", 5888 enabled 5889 ); 5890 5891 // This Remote Command does not have a Return-Value. 5892 return new Script<> 5893 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 5894 } 5895 5896 /** 5897 * Toggles mouse event-based touch event emulation. 5898 * <BR /><B>EXPERIMENTAL</B> 5899 * <BR /><B>DEPRECATED</B> 5900 * 5901 * @param enabled Whether the touch event emulation should be enabled. 5902 * 5903 * @param configuration Touch/gesture events configuration. Default: current platform. 5904 * <BR />Acceptable Values: ["mobile", "desktop"] 5905 * <BR /><B>OPTIONAL</B> 5906 * 5907 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5908 * {@link Ret0}></CODE> 5909 * 5910 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 5911 * browser receives the invocation-request. 5912 * 5913 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 5914 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 5915 * {@code >} to ensure the Browser Function has run to completion. 5916 */ 5917 public static Script<String, JsonObject, Ret0> setTouchEmulationEnabled 5918 (boolean enabled, String configuration) 5919 { 5920 // Exception-Check(s) to ensure that if any parameters which must adhere to a 5921 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 5922 5923 BRDPC.checkIAE( 5924 "configuration", configuration, 5925 "mobile", "desktop" 5926 ); 5927 5928 final int webSocketID = 32044000 + counter++; 5929 final boolean[] optionals = { false, true, }; 5930 5931 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5932 String requestJSON = WriteJSON.get( 5933 parameterTypes.get("setTouchEmulationEnabled"), 5934 parameterNames.get("setTouchEmulationEnabled"), 5935 optionals, webSocketID, 5936 "Page.setTouchEmulationEnabled", 5937 enabled, configuration 5938 ); 5939 5940 // This Remote Command does not have a Return-Value. 5941 return new Script<> 5942 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 5943 } 5944 5945 /** 5946 * Starts sending each frame using the <CODE>screencastFrame</CODE> event. 5947 * <BR /><B>EXPERIMENTAL</B> 5948 * 5949 * @param format Image compression format. 5950 * <BR />Acceptable Values: ["jpeg", "png"] 5951 * <BR /><B>OPTIONAL</B> 5952 * 5953 * @param quality Compression quality from range [0..100]. 5954 * <BR /><B>OPTIONAL</B> 5955 * 5956 * @param maxWidth Maximum screenshot width. 5957 * <BR /><B>OPTIONAL</B> 5958 * 5959 * @param maxHeight Maximum screenshot height. 5960 * <BR /><B>OPTIONAL</B> 5961 * 5962 * @param everyNthFrame Send every n-th frame. 5963 * <BR /><B>OPTIONAL</B> 5964 * 5965 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5966 * {@link Ret0}></CODE> 5967 * 5968 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 5969 * browser receives the invocation-request. 5970 * 5971 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 5972 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 5973 * {@code >} to ensure the Browser Function has run to completion. 5974 */ 5975 public static Script<String, JsonObject, Ret0> startScreencast 5976 (String format, Integer quality, Integer maxWidth, Integer maxHeight, Integer everyNthFrame) 5977 { 5978 // Exception-Check(s) to ensure that if any parameters which must adhere to a 5979 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 5980 5981 BRDPC.checkIAE( 5982 "format", format, 5983 "jpeg", "png" 5984 ); 5985 5986 final int webSocketID = 32045000 + counter++; 5987 final boolean[] optionals = { true, true, true, true, true, }; 5988 5989 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5990 String requestJSON = WriteJSON.get( 5991 parameterTypes.get("startScreencast"), 5992 parameterNames.get("startScreencast"), 5993 optionals, webSocketID, 5994 "Page.startScreencast", 5995 format, quality, maxWidth, maxHeight, everyNthFrame 5996 ); 5997 5998 // This Remote Command does not have a Return-Value. 5999 return new Script<> 6000 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 6001 } 6002 6003 /** 6004 * Force the page stop all navigations and pending resource fetches. 6005 * 6006 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6007 * {@link Ret0}></CODE> 6008 * 6009 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6010 * browser receives the invocation-request. 6011 * 6012 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6013 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6014 * {@code >} to ensure the Browser Function has run to completion. 6015 */ 6016 public static Script<String, JsonObject, Ret0> stopLoading() 6017 { 6018 final int webSocketID = 32046000 + counter++; 6019 final boolean[] optionals = new boolean[0]; 6020 6021 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6022 String requestJSON = WriteJSON.get( 6023 parameterTypes.get("stopLoading"), 6024 parameterNames.get("stopLoading"), 6025 optionals, webSocketID, 6026 "Page.stopLoading" 6027 ); 6028 6029 // This Remote Command does not have a Return-Value. 6030 return new Script<> 6031 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 6032 } 6033 6034 /** 6035 * Crashes renderer on the IO thread, generates minidumps. 6036 * <BR /><B>EXPERIMENTAL</B> 6037 * 6038 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6039 * {@link Ret0}></CODE> 6040 * 6041 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6042 * browser receives the invocation-request. 6043 * 6044 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6045 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6046 * {@code >} to ensure the Browser Function has run to completion. 6047 */ 6048 public static Script<String, JsonObject, Ret0> crash() 6049 { 6050 final int webSocketID = 32047000 + counter++; 6051 final boolean[] optionals = new boolean[0]; 6052 6053 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6054 String requestJSON = WriteJSON.get( 6055 parameterTypes.get("crash"), 6056 parameterNames.get("crash"), 6057 optionals, webSocketID, 6058 "Page.crash" 6059 ); 6060 6061 // This Remote Command does not have a Return-Value. 6062 return new Script<> 6063 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 6064 } 6065 6066 /** 6067 * Tries to close page, running its beforeunload hooks, if any. 6068 * <BR /><B>EXPERIMENTAL</B> 6069 * 6070 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6071 * {@link Ret0}></CODE> 6072 * 6073 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6074 * browser receives the invocation-request. 6075 * 6076 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6077 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6078 * {@code >} to ensure the Browser Function has run to completion. 6079 */ 6080 public static Script<String, JsonObject, Ret0> close() 6081 { 6082 final int webSocketID = 32048000 + counter++; 6083 final boolean[] optionals = new boolean[0]; 6084 6085 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6086 String requestJSON = WriteJSON.get( 6087 parameterTypes.get("close"), 6088 parameterNames.get("close"), 6089 optionals, webSocketID, 6090 "Page.close" 6091 ); 6092 6093 // This Remote Command does not have a Return-Value. 6094 return new Script<> 6095 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 6096 } 6097 6098 /** 6099 * Tries to update the web lifecycle state of the page. 6100 * It will transition the page to the given state according to: 6101 * https://github.com/WICG/web-lifecycle/ 6102 * <BR /><B>EXPERIMENTAL</B> 6103 * 6104 * @param state Target lifecycle state 6105 * <BR />Acceptable Values: ["frozen", "active"] 6106 * 6107 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6108 * {@link Ret0}></CODE> 6109 * 6110 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6111 * browser receives the invocation-request. 6112 * 6113 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6114 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6115 * {@code >} to ensure the Browser Function has run to completion. 6116 */ 6117 public static Script<String, JsonObject, Ret0> setWebLifecycleState(String state) 6118 { 6119 // Exception-Check(s) to ensure that if any parameters which are not declared as 6120 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6121 6122 if (state == null) BRDPC.throwNPE("state"); 6123 6124 // Exception-Check(s) to ensure that if any parameters which must adhere to a 6125 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 6126 6127 BRDPC.checkIAE( 6128 "state", state, 6129 "frozen", "active" 6130 ); 6131 6132 final int webSocketID = 32049000 + counter++; 6133 final boolean[] optionals = { false, }; 6134 6135 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6136 String requestJSON = WriteJSON.get( 6137 parameterTypes.get("setWebLifecycleState"), 6138 parameterNames.get("setWebLifecycleState"), 6139 optionals, webSocketID, 6140 "Page.setWebLifecycleState", 6141 state 6142 ); 6143 6144 // This Remote Command does not have a Return-Value. 6145 return new Script<> 6146 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 6147 } 6148 6149 /** 6150 * Stops sending each frame in the <CODE>screencastFrame</CODE>. 6151 * <BR /><B>EXPERIMENTAL</B> 6152 * 6153 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6154 * {@link Ret0}></CODE> 6155 * 6156 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6157 * browser receives the invocation-request. 6158 * 6159 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6160 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6161 * {@code >} to ensure the Browser Function has run to completion. 6162 */ 6163 public static Script<String, JsonObject, Ret0> stopScreencast() 6164 { 6165 final int webSocketID = 32050000 + counter++; 6166 final boolean[] optionals = new boolean[0]; 6167 6168 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6169 String requestJSON = WriteJSON.get( 6170 parameterTypes.get("stopScreencast"), 6171 parameterNames.get("stopScreencast"), 6172 optionals, webSocketID, 6173 "Page.stopScreencast" 6174 ); 6175 6176 // This Remote Command does not have a Return-Value. 6177 return new Script<> 6178 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 6179 } 6180 6181 /** 6182 * Requests backend to produce compilation cache for the specified scripts. 6183 * <CODE>scripts</CODE> are appeneded to the list of scripts for which the cache 6184 * would be produced. The list may be reset during page navigation. 6185 * When script with a matching URL is encountered, the cache is optionally 6186 * produced upon backend discretion, based on internal heuristics. 6187 * See also: <CODE>Page.compilationCacheProduced</CODE>. 6188 * <BR /><B>EXPERIMENTAL</B> 6189 * 6190 * @param scripts - 6191 * 6192 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6193 * {@link Ret0}></CODE> 6194 * 6195 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6196 * browser receives the invocation-request. 6197 * 6198 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6199 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6200 * {@code >} to ensure the Browser Function has run to completion. 6201 */ 6202 public static Script<String, JsonObject, Ret0> produceCompilationCache 6203 (Page.CompilationCacheParams[] scripts) 6204 { 6205 // Exception-Check(s) to ensure that if any parameters which are not declared as 6206 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6207 6208 if (scripts == null) BRDPC.throwNPE("scripts"); 6209 6210 final int webSocketID = 32051000 + counter++; 6211 final boolean[] optionals = { false, }; 6212 6213 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6214 String requestJSON = WriteJSON.get( 6215 parameterTypes.get("produceCompilationCache"), 6216 parameterNames.get("produceCompilationCache"), 6217 optionals, webSocketID, 6218 "Page.produceCompilationCache", 6219 (Object) scripts 6220 ); 6221 6222 // This Remote Command does not have a Return-Value. 6223 return new Script<> 6224 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 6225 } 6226 6227 /** 6228 * Seeds compilation cache for given url. Compilation cache does not survive 6229 * cross-process navigation. 6230 * <BR /><B>EXPERIMENTAL</B> 6231 * 6232 * @param url - 6233 * 6234 * @param data Base64-encoded data (Encoded as a base64 string when passed over JSON) 6235 * 6236 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6237 * {@link Ret0}></CODE> 6238 * 6239 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6240 * browser receives the invocation-request. 6241 * 6242 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6243 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6244 * {@code >} to ensure the Browser Function has run to completion. 6245 */ 6246 public static Script<String, JsonObject, Ret0> addCompilationCache(String url, String data) 6247 { 6248 // Exception-Check(s) to ensure that if any parameters which are not declared as 6249 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6250 6251 if (url == null) BRDPC.throwNPE("url"); 6252 if (data == null) BRDPC.throwNPE("data"); 6253 6254 final int webSocketID = 32052000 + counter++; 6255 final boolean[] optionals = { false, false, }; 6256 6257 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6258 String requestJSON = WriteJSON.get( 6259 parameterTypes.get("addCompilationCache"), 6260 parameterNames.get("addCompilationCache"), 6261 optionals, webSocketID, 6262 "Page.addCompilationCache", 6263 url, data 6264 ); 6265 6266 // This Remote Command does not have a Return-Value. 6267 return new Script<> 6268 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 6269 } 6270 6271 /** 6272 * Clears seeded compilation cache. 6273 * <BR /><B>EXPERIMENTAL</B> 6274 * 6275 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6276 * {@link Ret0}></CODE> 6277 * 6278 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6279 * browser receives the invocation-request. 6280 * 6281 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6282 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6283 * {@code >} to ensure the Browser Function has run to completion. 6284 */ 6285 public static Script<String, JsonObject, Ret0> clearCompilationCache() 6286 { 6287 final int webSocketID = 32053000 + counter++; 6288 final boolean[] optionals = new boolean[0]; 6289 6290 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6291 String requestJSON = WriteJSON.get( 6292 parameterTypes.get("clearCompilationCache"), 6293 parameterNames.get("clearCompilationCache"), 6294 optionals, webSocketID, 6295 "Page.clearCompilationCache" 6296 ); 6297 6298 // This Remote Command does not have a Return-Value. 6299 return new Script<> 6300 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 6301 } 6302 6303 /** 6304 * Generates a report for testing. 6305 * <BR /><B>EXPERIMENTAL</B> 6306 * 6307 * @param message Message to be displayed in the report. 6308 * 6309 * @param group Specifies the endpoint group to deliver the report to. 6310 * <BR /><B>OPTIONAL</B> 6311 * 6312 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6313 * {@link Ret0}></CODE> 6314 * 6315 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6316 * browser receives the invocation-request. 6317 * 6318 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6319 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6320 * {@code >} to ensure the Browser Function has run to completion. 6321 */ 6322 public static Script<String, JsonObject, Ret0> generateTestReport 6323 (String message, String group) 6324 { 6325 // Exception-Check(s) to ensure that if any parameters which are not declared as 6326 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6327 6328 if (message == null) BRDPC.throwNPE("message"); 6329 6330 final int webSocketID = 32054000 + counter++; 6331 final boolean[] optionals = { false, true, }; 6332 6333 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6334 String requestJSON = WriteJSON.get( 6335 parameterTypes.get("generateTestReport"), 6336 parameterNames.get("generateTestReport"), 6337 optionals, webSocketID, 6338 "Page.generateTestReport", 6339 message, group 6340 ); 6341 6342 // This Remote Command does not have a Return-Value. 6343 return new Script<> 6344 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 6345 } 6346 6347 /** 6348 * Pauses page execution. Can be resumed using generic RunTime.runIfWaitingForDebugger. 6349 * <BR /><B>EXPERIMENTAL</B> 6350 * 6351 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6352 * {@link Ret0}></CODE> 6353 * 6354 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6355 * browser receives the invocation-request. 6356 * 6357 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6358 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6359 * {@code >} to ensure the Browser Function has run to completion. 6360 */ 6361 public static Script<String, JsonObject, Ret0> waitForDebugger() 6362 { 6363 final int webSocketID = 32055000 + counter++; 6364 final boolean[] optionals = new boolean[0]; 6365 6366 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6367 String requestJSON = WriteJSON.get( 6368 parameterTypes.get("waitForDebugger"), 6369 parameterNames.get("waitForDebugger"), 6370 optionals, webSocketID, 6371 "Page.waitForDebugger" 6372 ); 6373 6374 // This Remote Command does not have a Return-Value. 6375 return new Script<> 6376 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 6377 } 6378 6379 /** 6380 * Intercept file chooser requests and transfer control to protocol clients. 6381 * When file chooser interception is enabled, native file chooser dialog is not shown. 6382 * Instead, a protocol event <CODE>Page.fileChooserOpened</CODE> is emitted. 6383 * <BR /><B>EXPERIMENTAL</B> 6384 * 6385 * @param enabled - 6386 * 6387 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6388 * {@link Ret0}></CODE> 6389 * 6390 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6391 * browser receives the invocation-request. 6392 * 6393 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6394 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6395 * {@code >} to ensure the Browser Function has run to completion. 6396 */ 6397 public static Script<String, JsonObject, Ret0> setInterceptFileChooserDialog 6398 (boolean enabled) 6399 { 6400 final int webSocketID = 32056000 + counter++; 6401 final boolean[] optionals = { false, }; 6402 6403 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6404 String requestJSON = WriteJSON.get( 6405 parameterTypes.get("setInterceptFileChooserDialog"), 6406 parameterNames.get("setInterceptFileChooserDialog"), 6407 optionals, webSocketID, 6408 "Page.setInterceptFileChooserDialog", 6409 enabled 6410 ); 6411 6412 // This Remote Command does not have a Return-Value. 6413 return new Script<> 6414 (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues); 6415 } 6416 6417}