001package Torello.Browser; 002 003/** 004 * A simple way of representing the various Browser Domains offered by the Remote Browser. 005 * Protocol. Instances of this <B>{@code enum}</B> are attched to each and every 006 * {@link BrowserEvent} which is generated & propagated by the browser. 007 */ 008public enum Domains 009{ 010 // ******************************************************************************************** 011 // ******************************************************************************************** 012 // Browser API Domains 013 // ******************************************************************************************** 014 // ******************************************************************************************** 015 016 017 /** 018 * {@code [No Description provided by Google]} 019 * @see Torello.Browser.BrowserAPI.Accessibility 020 */ 021 Accessibility(true /* BrowserAPI */), 022 023 /** 024 * {@code [No Description provided by Google]} 025 * @see Torello.Browser.BrowserAPI.Animation 026 */ 027 Animation(true /* BrowserAPI */), 028 029 /** 030 * Audits domain allows investigation of page violations and possible improvements. 031 * @see Torello.Browser.BrowserAPI.Audits 032 */ 033 Audits(true /* BrowserAPI */), 034 035 /** 036 * Defines commands and events for Autofill. 037 * @see Torello.Browser.BrowserAPI.Autofill 038 */ 039 Autofill(true /* BrowserAPI */), 040 041 /** 042 * Defines events for background web platform features. 043 * @see Torello.Browser.BrowserAPI.BackgroundService 044 */ 045 BackgroundService(true /* BrowserAPI */), 046 047 /** 048 * This domain allows configuring virtual Bluetooth devices to test the web-bluetooth API. 049 * @see Torello.Browser.BrowserAPI.BluetoothEmulation 050 */ 051 BluetoothEmulation(true /* BrowserAPI */), 052 053 /** 054 * The Browser domain defines methods and events for browser managing. 055 * @see Torello.Browser.BrowserAPI.Browser 056 */ 057 Browser(true /* BrowserAPI */), 058 059 /** 060 * This domain exposes CSS read/write operations. All CSS objects (stylesheets, rules, and 061 * styles) have an associated `id` used in subsequent operations on the related object. Each 062 * object type has a specific `id` structure, and those are not interchangeable between objects 063 * of different kinds. CSS objects can be loaded using the `get*ForNode()` calls (which accept 064 * a DOM node id). A client can also keep track of stylesheets via the 065 * `styleSheetAdded`/`styleSheetRemoved` events and subsequently load the required stylesheet 066 * contents using the `getStyleSheet[Text]()` methods. 067 * @see Torello.Browser.BrowserAPI.CSS 068 */ 069 CSS(true /* BrowserAPI */), 070 071 /** 072 * {@code [No Description provided by Google]} 073 * @see Torello.Browser.BrowserAPI.CacheStorage 074 */ 075 CacheStorage(true /* BrowserAPI */), 076 077 /** 078 * A domain for interacting with Cast, Presentation API, and Remote Playback API 079 * functionalities. 080 * @see Torello.Browser.BrowserAPI.Cast 081 */ 082 Cast(true /* BrowserAPI */), 083 084 /** 085 * This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror 086 * object that has an `id`. This `id` can be used to get additional information on the Node, 087 * resolve it into the JavaScript object wrapper, etc. It is important that client receives DOM 088 * events only for the nodes that are known to the client. Backend keeps track of the nodes 089 * that were sent to the client and never sends the same node twice. It is client's 090 * responsibility to collect information about the nodes that were sent to the client. Note 091 * that `iframe` owner elements will return corresponding document elements as their child 092 * nodes. 093 * @see Torello.Browser.BrowserAPI.DOM 094 */ 095 DOM(true /* BrowserAPI */), 096 097 /** 098 * DOM debugging allows setting breakpoints on particular DOM operations and events. JavaScript 099 * execution will stop on these operations as if there was a regular breakpoint set. 100 * @see Torello.Browser.BrowserAPI.DOMDebugger 101 */ 102 DOMDebugger(true /* BrowserAPI */), 103 104 /** 105 * This domain facilitates obtaining document snapshots with DOM, layout, and style 106 * information. 107 * @see Torello.Browser.BrowserAPI.DOMSnapshot 108 */ 109 DOMSnapshot(true /* BrowserAPI */), 110 111 /** 112 * Query and modify DOM storage. 113 * @see Torello.Browser.BrowserAPI.DOMStorage 114 */ 115 DOMStorage(true /* BrowserAPI */), 116 117 /** 118 * {@code [No Description provided by Google]} 119 * @see Torello.Browser.BrowserAPI.DeviceAccess 120 */ 121 DeviceAccess(true /* BrowserAPI */), 122 123 /** 124 * {@code [No Description provided by Google]} 125 * @see Torello.Browser.BrowserAPI.DeviceOrientation 126 */ 127 DeviceOrientation(true /* BrowserAPI */), 128 129 /** 130 * This domain emulates different environments for the page. 131 * @see Torello.Browser.BrowserAPI.Emulation 132 */ 133 Emulation(true /* BrowserAPI */), 134 135 /** 136 * EventBreakpoints permits setting JavaScript breakpoints on operations and events occurring 137 * in native code invoked from JavaScript. Once breakpoint is hit, it is reported through 138 * Debugger domain, similarly to regular breakpoints being hit. 139 * @see Torello.Browser.BrowserAPI.EventBreakpoints 140 */ 141 EventBreakpoints(true /* BrowserAPI */), 142 143 /** 144 * Defines commands and events for browser extensions. 145 * @see Torello.Browser.BrowserAPI.Extensions 146 */ 147 Extensions(true /* BrowserAPI */), 148 149 /** 150 * This domain allows interacting with the FedCM dialog. 151 * @see Torello.Browser.BrowserAPI.FedCm 152 */ 153 FedCm(true /* BrowserAPI */), 154 155 /** 156 * A domain for letting clients substitute browser's network layer with client code. 157 * @see Torello.Browser.BrowserAPI.Fetch 158 */ 159 Fetch(true /* BrowserAPI */), 160 161 /** 162 * {@code [No Description provided by Google]} 163 * @see Torello.Browser.BrowserAPI.FileSystem 164 */ 165 FileSystem(true /* BrowserAPI */), 166 167 /** 168 * This domain provides experimental commands only supported in headless mode. 169 * @see Torello.Browser.BrowserAPI.HeadlessExperimental 170 */ 171 HeadlessExperimental(true /* BrowserAPI */), 172 173 /** 174 * Input/Output operations for streams produced by DevTools. 175 * @see Torello.Browser.BrowserAPI.IO 176 */ 177 IO(true /* BrowserAPI */), 178 179 /** 180 * {@code [No Description provided by Google]} 181 * @see Torello.Browser.BrowserAPI.IndexedDB 182 */ 183 IndexedDB(true /* BrowserAPI */), 184 185 /** 186 * {@code [No Description provided by Google]} 187 * @see Torello.Browser.BrowserAPI.Input 188 */ 189 Input(true /* BrowserAPI */), 190 191 /** 192 * {@code [No Description provided by Google]} 193 * @see Torello.Browser.BrowserAPI.Inspector 194 */ 195 Inspector(true /* BrowserAPI */), 196 197 /** 198 * {@code [No Description provided by Google]} 199 * @see Torello.Browser.BrowserAPI.LayerTree 200 */ 201 LayerTree(true /* BrowserAPI */), 202 203 /** 204 * Provides access to log entries. 205 * @see Torello.Browser.BrowserAPI.Log 206 */ 207 Log(true /* BrowserAPI */), 208 209 /** 210 * This domain allows detailed inspection of media elements 211 * @see Torello.Browser.BrowserAPI.Media 212 */ 213 Media(true /* BrowserAPI */), 214 215 /** 216 * {@code [No Description provided by Google]} 217 * @see Torello.Browser.BrowserAPI.Memory 218 */ 219 Memory(true /* BrowserAPI */), 220 221 /** 222 * Network domain allows tracking network activities of the page. It exposes information about 223 * http, file, data and other requests and responses, their headers, bodies, timing, etc. 224 * @see Torello.Browser.BrowserAPI.Network 225 */ 226 Network(true /* BrowserAPI */), 227 228 /** 229 * This domain provides various functionality related to drawing atop the inspected page. 230 * @see Torello.Browser.BrowserAPI.Overlay 231 */ 232 Overlay(true /* BrowserAPI */), 233 234 /** 235 * This domain allows interacting with the browser to control PWAs. 236 * @see Torello.Browser.BrowserAPI.PWA 237 */ 238 PWA(true /* BrowserAPI */), 239 240 /** 241 * Actions and events related to the inspected page belong to the page domain. 242 * @see Torello.Browser.BrowserAPI.Page 243 */ 244 Page(true /* BrowserAPI */), 245 246 /** 247 * {@code [No Description provided by Google]} 248 * @see Torello.Browser.BrowserAPI.Performance 249 */ 250 Performance(true /* BrowserAPI */), 251 252 /** 253 * Reporting of performance timeline events, as specified in 254 * https://w3c.github.io/performance-timeline/#dom-performanceobserver. 255 * @see Torello.Browser.BrowserAPI.PerformanceTimeline 256 */ 257 PerformanceTimeline(true /* BrowserAPI */), 258 259 /** 260 * {@code [No Description provided by Google]} 261 * @see Torello.Browser.BrowserAPI.Preload 262 */ 263 Preload(true /* BrowserAPI */), 264 265 /** 266 * Security 267 * @see Torello.Browser.BrowserAPI.Security 268 */ 269 Security(true /* BrowserAPI */), 270 271 /** 272 * {@code [No Description provided by Google]} 273 * @see Torello.Browser.BrowserAPI.ServiceWorker 274 */ 275 ServiceWorker(true /* BrowserAPI */), 276 277 /** 278 * {@code [No Description provided by Google]} 279 * @see Torello.Browser.BrowserAPI.Storage 280 */ 281 Storage(true /* BrowserAPI */), 282 283 /** 284 * The SystemInfo domain defines methods and events for querying low-level system information. 285 * @see Torello.Browser.BrowserAPI.SystemInfo 286 */ 287 SystemInfo(true /* BrowserAPI */), 288 289 /** 290 * Supports additional targets discovery and allows to attach to them. 291 * @see Torello.Browser.BrowserAPI.Target 292 */ 293 Target(true /* BrowserAPI */), 294 295 /** 296 * The Tethering domain defines methods and events for browser port binding. 297 * @see Torello.Browser.BrowserAPI.Tethering 298 */ 299 Tethering(true /* BrowserAPI */), 300 301 /** 302 * {@code [No Description provided by Google]} 303 * @see Torello.Browser.BrowserAPI.Tracing 304 */ 305 Tracing(true /* BrowserAPI */), 306 307 /** 308 * This domain allows inspection of Web Audio API. https://webaudio.github.io/web-audio-api/ 309 * @see Torello.Browser.BrowserAPI.WebAudio 310 */ 311 WebAudio(true /* BrowserAPI */), 312 313 /** 314 * This domain allows configuring virtual authenticators to test the WebAuthn API. 315 * @see Torello.Browser.BrowserAPI.WebAuthn 316 */ 317 WebAuthn(true /* BrowserAPI */), 318 319 320 // ******************************************************************************************** 321 // ******************************************************************************************** 322 // JavaScript API Domains 323 // ******************************************************************************************** 324 // ******************************************************************************************** 325 326 327 /** 328 * This domain is deprecated - use RunTime or Log instead. 329 * @see Torello.Browser.JavaScriptAPI.Console 330 */ 331 Console(false /* JavaScriptAPI */), 332 333 /** 334 * Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing 335 * breakpoints, stepping through execution, exploring stack traces, etc. 336 * @see Torello.Browser.JavaScriptAPI.Debugger 337 */ 338 Debugger(false /* JavaScriptAPI */), 339 340 /** 341 * {@code [No Description provided by Google]} 342 * @see Torello.Browser.JavaScriptAPI.HeapProfiler 343 */ 344 HeapProfiler(false /* JavaScriptAPI */), 345 346 /** 347 * {@code [No Description provided by Google]} 348 * @see Torello.Browser.JavaScriptAPI.Profiler 349 */ 350 Profiler(false /* JavaScriptAPI */), 351 352 /** 353 * RunTime domain exposes JavaScript runtime by means of remote evaluation and mirror objects. 354 * Evaluation results are returned as mirror object that expose object type, string 355 * representation and unique identifier that can be used for further object reference. Original 356 * objects are maintained in memory unless they are either explicitly released or are released 357 * along with the other objects in their object group. 358 * @see Torello.Browser.JavaScriptAPI.RunTime 359 */ 360 RunTime(false /* JavaScriptAPI */), 361 362 /** 363 * This domain is deprecated. 364 * @see Torello.Browser.JavaScriptAPI.Schema 365 */ 366 Schema(false /* JavaScriptAPI */); 367 368 369 // ******************************************************************************************** 370 // ******************************************************************************************** 371 // Constructor ana Constants 372 // ******************************************************************************************** 373 // ******************************************************************************************** 374 375 376 /** {@code TRUE} indicates that a constant is a member of the JavaScript API */ 377 public static final boolean BrowserAPI = true; 378 379 /** {@code FALSE} indicates that a constant is a member of the Browser API */ 380 public static final boolean JSAPI = false; 381 382 /** 383 * When {@code TRUE}, this {@code Domain} is amongst the Browser-API {@code Domains}. 384 * When {@code FALSE}, this is a member of the JavaScript-API {@code Domains}. 385 */ 386 public final boolean browserAPI_Or_JSAPI; 387 388 private Domains(boolean browserAPI_Or_JSAPI) 389 { this.browserAPI_Or_JSAPI = browserAPI_Or_JSAPI; }; 390 391 /** 392 * Geerates a Full-Path Class-Name, as a {@code String} for the Domain that is represented 393 * this Enum-Constant. If {@code 'this'} Enum-Constant were {@link #Animation}, this method 394 * would return: 395 * 396 * <BR /><BR /><B>{@code "Torello.Browser.BrowserAPI.Animation"}</B> 397 */ 398 public String toFullPackageName() 399 { 400 return 401 "Torello.Browser." + 402 (this.browserAPI_Or_JSAPI ? "BrowserAPI" : "JavaScriptAPI") + 403 '.' + 404 this.name(); 405 } 406 407 /** 408 * Generates the Package-Name for the API in which this Domain resides. If {@code 'this'} 409 * Enum-Constant were {@link #Animation}, this method would return: 410 * 411 * <BR /><BR /><B>{@code "Torello.Browser.BrowserAPI"}</B> 412 */ 413 public String getPackageName() 414 { 415 return 416 "Torello.Browser." + 417 (this.browserAPI_Or_JSAPI ? "BrowserAPI" : "JavaScriptAPI"); 418 } 419 420 // Used by the builders. It's transient, so it's not serialized 421 private transient Class<?> domainClass = null; 422 423 public Class<?> getDomainClass() 424 { 425 if (this.domainClass != null) return this.domainClass; 426 427 try 428 { 429 this.domainClass = Class.forName(this.toFullPackageName()); 430 431 if (this.domainClass == null) throw new DomainEnumError( 432 "Class.forName(...) returned null for Domain Class:\n" + 433 this.toFullPackageName() 434 ); 435 436 return this.domainClass; 437 } 438 439 catch (ClassNotFoundException e) 440 { 441 throw new DomainEnumError( 442 "Unable to load the Domain Class using Class.forName(...):\n" + 443 this.toFullPackageName(), 444 e 445 ); 446 } 447 448 catch (LinkageError e) 449 { 450 throw new DomainEnumError( 451 "The Domain Class was found, but Java could not load/link/initialize it:\n" + 452 this.toFullPackageName(), 453 e 454 ); 455 } 456 457 catch (SecurityException e) 458 { 459 throw new DomainEnumError( 460 "A SecurityManager prevented loading the Domain Class:\n" + 461 this.toFullPackageName(), 462 e 463 ); 464 } 465 } 466 467 private static class DomainEnumError extends Error 468 { 469 protected static final long serialVersionUID = 1; 470 471 private DomainEnumError(final String message) 472 { super(message); } 473 474 private DomainEnumError(final String message, final Throwable cause) 475 { super(message, cause); } 476 } 477}