From 2aa4a82499d4becd2284cdb482213d541b8804dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 16:29:10 +0200 Subject: Adding upstream version 86.0.1. Signed-off-by: Daniel Baumann --- remote/.gitignore | 3 + remote/Cargo.toml | 15 + remote/Connection.jsm | 304 + remote/Error.jsm | 137 + remote/Format.jsm | 184 + remote/JSONHandler.jsm | 84 + remote/Log.jsm | 31 + remote/Protocol.jsm | 17362 +++++++++++++++++++ remote/README | 17 + remote/RecommendedPreferences.jsm | 28 + remote/RemoteAgent.jsm | 179 + remote/StreamRegistry.jsm | 125 + remote/Sync.jsm | 208 + remote/TabManager.jsm | 34 + remote/WindowManager.jsm | 25 + remote/components.conf | 19 + remote/doc/Architecture.md | 164 + remote/doc/Building.md | 53 + remote/doc/CodeStyle.md | 73 + remote/doc/Debugging.md | 53 + remote/doc/Prefs.md | 32 + remote/doc/PuppeteerVendor.md | 83 + remote/doc/Security.md | 99 + remote/doc/Testing.md | 140 + remote/doc/Usage.md | 62 + remote/doc/index.rst | 54 + remote/doc/moz.build | 8 + remote/domains/ContentProcessDomain.jsm | 31 + remote/domains/ContentProcessDomains.jsm | 25 + remote/domains/Domain.jsm | 75 + remote/domains/DomainCache.jsm | 117 + remote/domains/ParentProcessDomains.jsm | 24 + remote/domains/content/DOM.jsm | 250 + remote/domains/content/Emulation.jsm | 44 + remote/domains/content/Input.jsm | 71 + remote/domains/content/Log.jsm | 93 + remote/domains/content/Network.jsm | 24 + remote/domains/content/Page.jsm | 457 + remote/domains/content/Performance.jsm | 38 + remote/domains/content/Runtime.jsm | 621 + remote/domains/content/Security.jsm | 38 + .../domains/content/runtime/ExecutionContext.jsm | 538 + remote/domains/parent/Browser.jsm | 34 + remote/domains/parent/Emulation.jsm | 176 + remote/domains/parent/IO.jsm | 122 + remote/domains/parent/Input.jsm | 172 + remote/domains/parent/Network.jsm | 512 + remote/domains/parent/Page.jsm | 747 + remote/domains/parent/Security.jsm | 55 + remote/domains/parent/Target.jsm | 199 + remote/domains/parent/page/DialogHandler.jsm | 117 + remote/error.rs | 61 + remote/jar.mn | 72 + remote/lib.rs | 18 + remote/mach_commands.py | 684 + remote/moz.build | 44 + remote/nsIRemoteAgent.idl | 64 + remote/observers/ChannelEventSink.jsm | 109 + remote/observers/ContextObserver.jsm | 143 + remote/observers/NetworkObserver.jsm | 635 + remote/observers/TargetObserver.jsm | 144 + remote/puppeteer-expected.json | 2084 +++ remote/remote_agent.rs | 75 + remote/server/README | 8 + remote/server/WebSocketHandshake.jsm | 198 + remote/server/WebSocketTransport.jsm | 88 + remote/sessions/ContentProcessSession.jsm | 111 + remote/sessions/MainProcessSession.jsm | 18 + remote/sessions/Session.jsm | 85 + remote/sessions/TabSession.jsm | 116 + remote/sessions/frame-script.js | 12 + remote/startup/RemoteAgentHandler.cpp | 36 + remote/startup/RemoteAgentHandler.h | 12 + remote/startup/handler.rs | 242 + remote/startup/mod.rs | 5 + remote/startup/moz.build | 7 + remote/targets/MainProcessTarget.jsm | 59 + remote/targets/TabTarget.jsm | 164 + remote/targets/Target.jsm | 74 + remote/targets/TargetList.jsm | 173 + remote/test/browser/README.md | 11 + remote/test/browser/browser.ini | 17 + remote/test/browser/browser_agent.js | 131 + remote/test/browser/browser_cdp.js | 61 + remote/test/browser/browser_httpd.js | 42 + remote/test/browser/browser_main_target.js | 42 + remote/test/browser/browser_session.js | 22 + remote/test/browser/browser_tabs.js | 34 + remote/test/browser/chrome-remote-interface.js | 8 + remote/test/browser/dom/browser.ini | 12 + remote/test/browser/dom/browser_describeNode.js | 175 + remote/test/browser/dom/browser_resolveNode.js | 100 + remote/test/browser/dom/head.js | 11 + remote/test/browser/emulation/browser.ini | 13 + .../emulation/browser_setDeviceMetricsOverride.js | 418 + .../emulation/browser_setTouchEmulationEnabled.js | 83 + .../emulation/browser_setUserAgentOverride.js | 147 + remote/test/browser/emulation/head.js | 11 + remote/test/browser/head.js | 644 + remote/test/browser/input/browser.ini | 17 + .../test/browser/input/browser_dispatchKeyEvent.js | 169 + .../input/browser_dispatchKeyEvent_events.js | 129 + .../browser/input/browser_dispatchKeyEvent_race.js | 92 + .../browser/input/browser_dispatchMouseEvent.js | 60 + .../browser/input/doc_dispatchKeyEvent_race.html | 27 + remote/test/browser/input/doc_events.html | 148 + remote/test/browser/input/head.js | 123 + remote/test/browser/io/browser.ini | 12 + remote/test/browser/io/browser_close.js | 43 + remote/test/browser/io/browser_read.js | 155 + remote/test/browser/io/head.js | 26 + remote/test/browser/log/browser.ini | 11 + remote/test/browser/log/browser_entryAdded.js | 138 + remote/test/browser/log/head.js | 11 + remote/test/browser/network/browser.ini | 29 + .../test/browser/network/browser_deleteCookies.js | 298 + .../network/browser_emulateNetworkConditions.js | 248 + .../test/browser/network/browser_getAllCookies.js | 225 + remote/test/browser/network/browser_getCookies.js | 220 + .../browser/network/browser_navigationEvents.js | 202 + .../browser/network/browser_requestWillBeSent.js | 154 + .../browser/network/browser_responseReceived.js | 236 + .../browser/network/browser_setCacheDisabled.js | 122 + remote/test/browser/network/browser_setCookie.js | 298 + remote/test/browser/network/browser_setCookies.js | 70 + .../network/browser_setUserAgentOverride.js | 68 + remote/test/browser/network/doc_empty.html | 9 + remote/test/browser/network/doc_frameset.html | 10 + remote/test/browser/network/doc_networkEvents.html | 9 + remote/test/browser/network/file_framesetEvents.js | 2 + remote/test/browser/network/file_networkEvents.js | 2 + remote/test/browser/network/head.js | 101 + remote/test/browser/network/sjs-cookies.sjs | 44 + remote/test/browser/page/browser.ini | 39 + remote/test/browser/page/browser_bringToFront.js | 64 + .../test/browser/page/browser_captureScreenshot.js | 563 + .../browser/page/browser_createIsolatedWorld.js | 494 + .../browser/page/browser_domContentEventFired.js | 104 + remote/test/browser/page/browser_frameAttached.js | 147 + remote/test/browser/page/browser_frameDetached.js | 180 + remote/test/browser/page/browser_frameNavigated.js | 102 + .../browser/page/browser_frameStartedLoading.js | 113 + .../browser/page/browser_frameStoppedLoading.js | 113 + remote/test/browser/page/browser_getFrameTree.js | 158 + .../test/browser/page/browser_getLayoutMetrics.js | 118 + .../browser/page/browser_getNavigationHistory.js | 69 + .../browser/page/browser_javascriptDialog_alert.js | 59 + .../page/browser_javascriptDialog_beforeunload.js | 54 + .../page/browser_javascriptDialog_confirm.js | 43 + .../page/browser_javascriptDialog_otherTarget.js | 48 + .../page/browser_javascriptDialog_prompt.js | 45 + remote/test/browser/page/browser_lifecycleEvent.js | 206 + remote/test/browser/page/browser_loadEventFired.js | 104 + remote/test/browser/page/browser_navigate.js | 264 + .../browser/page/browser_navigateToHistoryEntry.js | 133 + .../test/browser/page/browser_navigationEvents.js | 189 + remote/test/browser/page/browser_printToPDF.js | 53 + remote/test/browser/page/browser_reload.js | 34 + remote/test/browser/page/browser_runtimeEvents.js | 122 + .../page/browser_scriptToEvaluateOnNewDocument.js | 172 + remote/test/browser/page/doc_empty.html | 8 + remote/test/browser/page/head.js | 116 + remote/test/browser/page/sjs_redirect.sjs | 7 + remote/test/browser/runtime/browser.ini | 20 + .../test/browser/runtime/browser_callFunctionOn.js | 460 + .../browser_callFunctionOn_returnByValue.js | 369 + .../browser/runtime/browser_consoleAPICalled.js | 186 + remote/test/browser/runtime/browser_evaluate.js | 506 + .../browser/runtime/browser_exceptionThrown.js | 120 + .../runtime/browser_executionContextEvents.js | 339 + .../test/browser/runtime/browser_getProperties.js | 184 + .../test/browser/runtime/browser_remoteObjects.js | 83 + .../test/browser/runtime/doc_console_events.html | 18 + remote/test/browser/runtime/head.js | 11 + remote/test/browser/security/browser.ini | 11 + .../security/browser_setIgnoreCertificateErrors.js | 162 + remote/test/browser/security/head.js | 11 + remote/test/browser/target/browser.ini | 22 + .../test/browser/target/browser_activateTarget.js | 82 + .../test/browser/target/browser_attachToTarget.js | 45 + .../browser/target/browser_attachedToTarget.js | 45 + .../test/browser/target/browser_browserContext.js | 39 + remote/test/browser/target/browser_closeTarget.js | 43 + remote/test/browser/target/browser_getTargets.js | 43 + .../browser/target/browser_sendMessageToTarget.js | 41 + .../browser/target/browser_setDiscoverTargets.js | 71 + .../test/browser/target/browser_targetCreated.js | 18 + .../test/browser/target/browser_targetDestroyed.js | 21 + remote/test/browser/target/doc_test.html | 8 + remote/test/browser/target/head.js | 11 + remote/test/moz.build | 18 + remote/test/puppeteer/.ci/node10/Dockerfile.linux | 17 + remote/test/puppeteer/.ci/node12/Dockerfile.linux | 17 + remote/test/puppeteer/.editorconfig | 9 + remote/test/puppeteer/.eslintignore | 14 + remote/test/puppeteer/.eslintrc.js | 183 + .../puppeteer/.github/workflows/publish-on-tag.yml | 30 + remote/test/puppeteer/.npmrc | 2 + remote/test/puppeteer/.travis.yml | 118 + remote/test/puppeteer/.versionrc | 3 + remote/test/puppeteer/CHANGELOG.md | 20 + remote/test/puppeteer/CONTRIBUTING.md | 290 + remote/test/puppeteer/LICENSE | 202 + remote/test/puppeteer/README.md | 453 + remote/test/puppeteer/api-extractor.json | 45 + remote/test/puppeteer/cjs-entry-core.js | 29 + remote/test/puppeteer/cjs-entry.js | 29 + remote/test/puppeteer/commitlint.config.js | 22 + remote/test/puppeteer/examples/README.md | 38 + remote/test/puppeteer/examples/block-images.js | 33 + remote/test/puppeteer/examples/cross-browser.js | 48 + remote/test/puppeteer/examples/custom-event.js | 50 + remote/test/puppeteer/examples/detect-sniff.js | 44 + remote/test/puppeteer/examples/oopif.js | 47 + remote/test/puppeteer/examples/pdf.js | 35 + remote/test/puppeteer/examples/proxy.js | 35 + .../test/puppeteer/examples/screenshot-fullpage.js | 28 + remote/test/puppeteer/examples/screenshot.js | 27 + remote/test/puppeteer/examples/search.js | 55 + remote/test/puppeteer/install.js | 89 + remote/test/puppeteer/json-mocha-reporter.js | 68 + remote/test/puppeteer/mocha-config/base.js | 6 + .../test/puppeteer/mocha-config/coverage-tests.js | 6 + .../test/puppeteer/mocha-config/doclint-tests.js | 6 + .../puppeteer/mocha-config/puppeteer-unit-tests.js | 28 + remote/test/puppeteer/moz.yaml | 10 + remote/test/puppeteer/package-lock.json | 9746 +++++++++++ remote/test/puppeteer/package.json | 115 + remote/test/puppeteer/prettier.config.js | 5 + .../ensure-correct-devtools-protocol-package.ts | 84 + remote/test/puppeteer/scripts/test-install.sh | 41 + remote/test/puppeteer/scripts/tsconfig.json | 6 + remote/test/puppeteer/src/.eslintrc.js | 19 + remote/test/puppeteer/src/api-docs-entry.ts | 65 + remote/test/puppeteer/src/common/Accessibility.ts | 502 + .../test/puppeteer/src/common/AriaQueryHandler.ts | 140 + remote/test/puppeteer/src/common/Browser.ts | 734 + .../test/puppeteer/src/common/BrowserConnector.ts | 120 + .../src/common/BrowserWebSocketTransport.ts | 55 + remote/test/puppeteer/src/common/Connection.ts | 347 + .../puppeteer/src/common/ConnectionTransport.ts | 22 + remote/test/puppeteer/src/common/ConsoleMessage.ts | 122 + remote/test/puppeteer/src/common/Coverage.ts | 425 + remote/test/puppeteer/src/common/DOMWorld.ts | 940 + remote/test/puppeteer/src/common/Debug.ts | 83 + .../test/puppeteer/src/common/DeviceDescriptors.ts | 964 + remote/test/puppeteer/src/common/Dialog.ts | 111 + .../test/puppeteer/src/common/EmulationManager.ts | 58 + remote/test/puppeteer/src/common/Errors.ts | 41 + remote/test/puppeteer/src/common/EvalTypes.ts | 81 + remote/test/puppeteer/src/common/EventEmitter.ts | 144 + remote/test/puppeteer/src/common/Events.ts | 97 + .../test/puppeteer/src/common/ExecutionContext.ts | 387 + remote/test/puppeteer/src/common/FileChooser.ts | 85 + remote/test/puppeteer/src/common/FrameManager.ts | 1309 ++ remote/test/puppeteer/src/common/HTTPRequest.ts | 537 + remote/test/puppeteer/src/common/HTTPResponse.ts | 213 + remote/test/puppeteer/src/common/Input.ts | 525 + remote/test/puppeteer/src/common/JSHandle.ts | 982 ++ .../test/puppeteer/src/common/LifecycleWatcher.ts | 244 + remote/test/puppeteer/src/common/NetworkManager.ts | 340 + remote/test/puppeteer/src/common/PDFOptions.ts | 179 + remote/test/puppeteer/src/common/Page.ts | 2013 +++ remote/test/puppeteer/src/common/Product.ts | 21 + remote/test/puppeteer/src/common/Puppeteer.ts | 169 + .../test/puppeteer/src/common/PuppeteerViewport.ts | 23 + remote/test/puppeteer/src/common/QueryHandler.ts | 238 + .../test/puppeteer/src/common/SecurityDetails.ts | 88 + remote/test/puppeteer/src/common/Target.ts | 222 + .../test/puppeteer/src/common/TimeoutSettings.ts | 50 + remote/test/puppeteer/src/common/Tracing.ts | 118 + .../test/puppeteer/src/common/USKeyboardLayout.ts | 681 + remote/test/puppeteer/src/common/WebWorker.ts | 172 + remote/test/puppeteer/src/common/assert.ts | 24 + remote/test/puppeteer/src/common/fetch.ts | 22 + remote/test/puppeteer/src/common/helper.ts | 389 + remote/test/puppeteer/src/environment.ts | 17 + remote/test/puppeteer/src/initialize-node.ts | 43 + remote/test/puppeteer/src/initialize-web.ts | 24 + remote/test/puppeteer/src/node-puppeteer-core.ts | 25 + remote/test/puppeteer/src/node.ts | 23 + remote/test/puppeteer/src/node/BrowserFetcher.ts | 602 + remote/test/puppeteer/src/node/BrowserRunner.ts | 257 + remote/test/puppeteer/src/node/LaunchOptions.ts | 42 + remote/test/puppeteer/src/node/Launcher.ts | 673 + .../puppeteer/src/node/NodeWebSocketTransport.ts | 59 + remote/test/puppeteer/src/node/PipeTransport.ts | 80 + remote/test/puppeteer/src/node/Puppeteer.ts | 230 + remote/test/puppeteer/src/node/install.ts | 185 + remote/test/puppeteer/src/revisions.ts | 25 + remote/test/puppeteer/src/tsconfig.cjs.json | 11 + remote/test/puppeteer/src/tsconfig.esm.json | 11 + remote/test/puppeteer/src/web.ts | 24 + .../test/puppeteer/test-browser/connection.spec.js | 55 + remote/test/puppeteer/test-browser/debug.spec.js | 65 + remote/test/puppeteer/test-browser/helper.js | 27 + remote/test/puppeteer/test/.eslintrc.js | 13 + remote/test/puppeteer/test/CDPSession.spec.ts | 106 + remote/test/puppeteer/test/EventEmitter.spec.ts | 170 + remote/test/puppeteer/test/README.md | 88 + remote/test/puppeteer/test/accessibility.spec.ts | 520 + .../test/puppeteer/test/ariaqueryhandler.spec.ts | 565 + remote/test/puppeteer/test/assert-coverage-test.js | 25 + .../test/puppeteer/test/assets/beforeunload.html | 10 + .../puppeteer/test/assets/cached/one-style.css | 3 + .../puppeteer/test/assets/cached/one-style.html | 2 + .../test/puppeteer/test/assets/chromium-linux.zip | Bin 0 -> 325 bytes remote/test/puppeteer/test/assets/consolelog.html | 17 + remote/test/puppeteer/test/assets/csp.html | 1 + .../test/assets/csscoverage/Dosis-Regular.ttf | Bin 0 -> 136940 bytes .../test/puppeteer/test/assets/csscoverage/OFL.txt | 95 + .../test/assets/csscoverage/involved.html | 26 + .../puppeteer/test/assets/csscoverage/media.html | 4 + .../test/assets/csscoverage/multiple.html | 8 + .../puppeteer/test/assets/csscoverage/simple.html | 6 + .../test/assets/csscoverage/sourceurl.html | 7 + .../test/assets/csscoverage/stylesheet1.css | 3 + .../test/assets/csscoverage/stylesheet2.css | 4 + .../puppeteer/test/assets/csscoverage/unused.html | 7 + .../test/puppeteer/test/assets/detect-touch.html | 12 + remote/test/puppeteer/test/assets/digits/0.png | Bin 0 -> 434 bytes remote/test/puppeteer/test/assets/digits/1.png | Bin 0 -> 346 bytes remote/test/puppeteer/test/assets/digits/2.png | Bin 0 -> 413 bytes remote/test/puppeteer/test/assets/digits/3.png | Bin 0 -> 434 bytes remote/test/puppeteer/test/assets/digits/4.png | Bin 0 -> 403 bytes remote/test/puppeteer/test/assets/digits/5.png | Bin 0 -> 422 bytes remote/test/puppeteer/test/assets/digits/6.png | Bin 0 -> 445 bytes remote/test/puppeteer/test/assets/digits/7.png | Bin 0 -> 387 bytes remote/test/puppeteer/test/assets/digits/8.png | Bin 0 -> 447 bytes remote/test/puppeteer/test/assets/digits/9.png | Bin 0 -> 437 bytes .../test/puppeteer/test/assets/dynamic-oopif.html | 10 + remote/test/puppeteer/test/assets/empty.html | 0 remote/test/puppeteer/test/assets/error.html | 15 + remote/test/puppeteer/test/assets/es6/.eslintrc | 5 + remote/test/puppeteer/test/assets/es6/es6import.js | 2 + remote/test/puppeteer/test/assets/es6/es6module.js | 1 + .../puppeteer/test/assets/es6/es6pathimport.js | 2 + .../test/puppeteer/test/assets/file-to-upload.txt | 1 + .../firefox-75.0a1.en-US.linux-x86_64.tar.bz2 | Bin 0 -> 211 bytes .../test/puppeteer/test/assets/frames/frame.html | 8 + .../puppeteer/test/assets/frames/frameset.html | 8 + .../test/assets/frames/nested-frames.html | 25 + .../test/assets/frames/one-frame-url-fragment.html | 1 + .../puppeteer/test/assets/frames/one-frame.html | 1 + remote/test/puppeteer/test/assets/frames/script.js | 1 + remote/test/puppeteer/test/assets/frames/style.css | 3 + .../puppeteer/test/assets/frames/two-frames.html | 13 + remote/test/puppeteer/test/assets/global-var.html | 3 + remote/test/puppeteer/test/assets/grid.html | 52 + remote/test/puppeteer/test/assets/historyapi.html | 5 + .../test/puppeteer/test/assets/idle-detector.html | 23 + remote/test/puppeteer/test/assets/injectedfile.js | 2 + .../test/puppeteer/test/assets/injectedstyle.css | 3 + .../test/puppeteer/test/assets/input/button.html | 16 + .../test/puppeteer/test/assets/input/checkbox.html | 42 + .../puppeteer/test/assets/input/fileupload.html | 9 + .../test/puppeteer/test/assets/input/keyboard.html | 42 + .../puppeteer/test/assets/input/mouse-helper.js | 74 + .../puppeteer/test/assets/input/rotatedButton.html | 21 + .../puppeteer/test/assets/input/scrollable.html | 23 + .../test/puppeteer/test/assets/input/select.html | 69 + .../test/puppeteer/test/assets/input/textarea.html | 15 + .../test/puppeteer/test/assets/input/touches.html | 35 + remote/test/puppeteer/test/assets/input/wheel.html | 43 + .../puppeteer/test/assets/jscoverage/eval.html | 1 + .../puppeteer/test/assets/jscoverage/involved.html | 15 + .../puppeteer/test/assets/jscoverage/multiple.html | 2 + .../puppeteer/test/assets/jscoverage/ranges.html | 2 + .../puppeteer/test/assets/jscoverage/script1.js | 1 + .../puppeteer/test/assets/jscoverage/script2.js | 1 + .../puppeteer/test/assets/jscoverage/simple.html | 2 + .../test/assets/jscoverage/sourceurl.html | 4 + .../puppeteer/test/assets/jscoverage/unused.html | 1 + remote/test/puppeteer/test/assets/mobile.html | 1 + remote/test/puppeteer/test/assets/modernizr.js | 3 + remote/test/puppeteer/test/assets/networkidle.html | 19 + .../puppeteer/test/assets/offscreenbuttons.html | 36 + remote/test/puppeteer/test/assets/one-style.css | 3 + remote/test/puppeteer/test/assets/one-style.html | 2 + remote/test/puppeteer/test/assets/playground.html | 15 + remote/test/puppeteer/test/assets/popup/popup.html | 9 + .../puppeteer/test/assets/popup/window-open.html | 11 + remote/test/puppeteer/test/assets/pptr.png | Bin 0 -> 6138 bytes remote/test/puppeteer/test/assets/resetcss.html | 50 + .../test/puppeteer/test/assets/self-request.html | 5 + .../test/assets/serviceworkers/empty/sw.html | 3 + .../test/assets/serviceworkers/empty/sw.js | 0 .../test/assets/serviceworkers/fetch/style.css | 3 + .../test/assets/serviceworkers/fetch/sw.html | 5 + .../test/assets/serviceworkers/fetch/sw.js | 7 + remote/test/puppeteer/test/assets/shadow.html | 17 + .../test/assets/simple-extension/content-script.js | 2 + .../test/assets/simple-extension/index.js | 2 + .../test/assets/simple-extension/manifest.json | 14 + remote/test/puppeteer/test/assets/simple.json | 1 + remote/test/puppeteer/test/assets/tamperable.html | 3 + remote/test/puppeteer/test/assets/title.html | 1 + .../test/puppeteer/test/assets/worker/worker.html | 14 + remote/test/puppeteer/test/assets/worker/worker.js | 16 + remote/test/puppeteer/test/assets/wrappedlink.html | 32 + remote/test/puppeteer/test/browser.spec.ts | 81 + remote/test/puppeteer/test/browsercontext.spec.ts | 206 + remote/test/puppeteer/test/chromiumonly.spec.ts | 159 + remote/test/puppeteer/test/click.spec.ts | 352 + remote/test/puppeteer/test/cookies.spec.ts | 526 + remote/test/puppeteer/test/coverage-utils.js | 164 + remote/test/puppeteer/test/coverage.spec.ts | 280 + .../puppeteer/test/defaultbrowsercontext.spec.ts | 104 + remote/test/puppeteer/test/dialog.spec.ts | 73 + remote/test/puppeteer/test/diffstyle.css | 13 + remote/test/puppeteer/test/elementhandle.spec.ts | 449 + remote/test/puppeteer/test/emulation.spec.ts | 355 + remote/test/puppeteer/test/evaluation.spec.ts | 474 + remote/test/puppeteer/test/fixtures.spec.ts | 93 + remote/test/puppeteer/test/fixtures/closeme.js | 5 + remote/test/puppeteer/test/fixtures/dumpio.js | 8 + remote/test/puppeteer/test/frame.spec.ts | 269 + .../test/golden-chromium/csscoverage-involved.txt | 16 + .../puppeteer/test/golden-chromium/grid-cell-0.png | Bin 0 -> 436 bytes .../puppeteer/test/golden-chromium/grid-cell-1.png | Bin 0 -> 276 bytes .../puppeteer/test/golden-chromium/grid-cell-2.png | Bin 0 -> 428 bytes .../puppeteer/test/golden-chromium/grid-cell-3.png | Bin 0 -> 448 bytes .../test/golden-chromium/jscoverage-involved.txt | 28 + .../test/golden-chromium/mock-binary-response.png | Bin 0 -> 6789 bytes .../golden-chromium/screenshot-clip-odd-size.png | Bin 0 -> 81 bytes .../test/golden-chromium/screenshot-clip-rect.png | Bin 0 -> 1962 bytes .../screenshot-element-bounding-box.png | Bin 0 -> 461 bytes .../screenshot-element-fractional-offset.png | Bin 0 -> 138 bytes .../screenshot-element-fractional.png | Bin 0 -> 138 bytes .../screenshot-element-larger-than-viewport.png | Bin 0 -> 2807 bytes .../screenshot-element-padding-border.png | Bin 0 -> 168 bytes .../golden-chromium/screenshot-element-rotate.png | Bin 0 -> 2342 bytes .../screenshot-element-scrolled-into-view.png | Bin 0 -> 168 bytes .../golden-chromium/screenshot-grid-fullpage.png | Bin 0 -> 74972 bytes .../golden-chromium/screenshot-offscreen-clip.png | Bin 0 -> 326 bytes .../test/golden-chromium/screenshot-sanity.png | Bin 0 -> 36252 bytes .../puppeteer/test/golden-chromium/transparent.png | Bin 0 -> 119 bytes .../vision-deficiency-achromatopsia.png | Bin 0 -> 33569 bytes .../vision-deficiency-blurredVision.png | Bin 0 -> 84544 bytes .../vision-deficiency-deuteranopia.png | Bin 0 -> 37483 bytes .../vision-deficiency-protanopia.png | Bin 0 -> 36282 bytes .../vision-deficiency-tritanopia.png | Bin 0 -> 37282 bytes .../test/puppeteer/test/golden-chromium/white.jpg | Bin 0 -> 357 bytes .../puppeteer/test/golden-firefox/grid-cell-0.png | Bin 0 -> 331 bytes .../puppeteer/test/golden-firefox/grid-cell-1.png | Bin 0 -> 201 bytes .../golden-firefox/screenshot-clip-odd-size.png | Bin 0 -> 75 bytes .../test/golden-firefox/screenshot-clip-rect.png | Bin 0 -> 1371 bytes .../screenshot-element-bounding-box.png | Bin 0 -> 311 bytes .../screenshot-element-fractional-offset.png | Bin 0 -> 113 bytes .../screenshot-element-fractional.png | Bin 0 -> 109 bytes .../screenshot-element-larger-than-viewport.png | Bin 0 -> 2797 bytes .../screenshot-element-padding-border.png | Bin 0 -> 153 bytes .../golden-firefox/screenshot-element-rotate.png | Bin 0 -> 1800 bytes .../screenshot-element-scrolled-into-view.png | Bin 0 -> 153 bytes .../golden-firefox/screenshot-grid-fullpage.png | Bin 0 -> 55662 bytes .../golden-firefox/screenshot-offscreen-clip.png | Bin 0 -> 326 bytes .../test/golden-firefox/screenshot-sanity.png | Bin 0 -> 26146 bytes remote/test/puppeteer/test/golden-utils.js | 160 + remote/test/puppeteer/test/headful.spec.ts | 204 + remote/test/puppeteer/test/idle_override.spec.ts | 93 + .../test/puppeteer/test/ignorehttpserrors.spec.ts | 133 + remote/test/puppeteer/test/input.spec.ts | 337 + remote/test/puppeteer/test/jshandle.spec.ts | 282 + remote/test/puppeteer/test/keyboard.spec.ts | 407 + remote/test/puppeteer/test/launcher.spec.ts | 654 + remote/test/puppeteer/test/mocha-ts-require.js | 11 + remote/test/puppeteer/test/mocha-utils.ts | 279 + remote/test/puppeteer/test/mouse.spec.ts | 241 + remote/test/puppeteer/test/navigation.spec.ts | 774 + remote/test/puppeteer/test/network.spec.ts | 571 + remote/test/puppeteer/test/oopif.spec.ts | 74 + remote/test/puppeteer/test/page.spec.ts | 1720 ++ remote/test/puppeteer/test/queryselector.spec.ts | 507 + .../puppeteer/test/requestinterception.spec.ts | 703 + remote/test/puppeteer/test/run_static_server.js | 33 + remote/test/puppeteer/test/screenshot.spec.ts | 323 + remote/test/puppeteer/test/target.spec.ts | 294 + remote/test/puppeteer/test/touchscreen.spec.ts | 48 + remote/test/puppeteer/test/tracing.spec.ts | 133 + remote/test/puppeteer/test/tsconfig.json | 7 + remote/test/puppeteer/test/tsconfig.test.json | 6 + remote/test/puppeteer/test/utils.js | 135 + remote/test/puppeteer/test/waittask.spec.ts | 774 + remote/test/puppeteer/test/worker.spec.ts | 126 + remote/test/puppeteer/tsconfig-esm.json | 7 + remote/test/puppeteer/tsconfig.base.json | 13 + remote/test/puppeteer/tsconfig.json | 11 + remote/test/puppeteer/typescript-if-required.js | 61 + remote/test/puppeteer/utils/ESTreeWalker.js | 135 + remote/test/puppeteer/utils/apply_next_version.js | 32 + remote/test/puppeteer/utils/bisect.js | 229 + remote/test/puppeteer/utils/check_availability.js | 298 + remote/test/puppeteer/utils/doclint/.gitignore | 1 + remote/test/puppeteer/utils/doclint/Message.js | 44 + remote/test/puppeteer/utils/doclint/README.md | 31 + remote/test/puppeteer/utils/doclint/Source.js | 117 + .../doclint/check_public_api/Documentation.js | 157 + .../utils/doclint/check_public_api/JSBuilder.js | 279 + .../utils/doclint/check_public_api/MDBuilder.js | 402 + .../utils/doclint/check_public_api/index.js | 977 ++ remote/test/puppeteer/utils/doclint/cli.js | 136 + .../puppeteer/utils/doclint/preprocessor/index.js | 165 + .../doclint/preprocessor/preprocessor.spec.js | 248 + remote/test/puppeteer/utils/fetch_devices.js | 282 + .../test/puppeteer/utils/prepare_puppeteer_core.js | 27 + remote/test/puppeteer/utils/testserver/LICENSE | 202 + remote/test/puppeteer/utils/testserver/README.md | 18 + remote/test/puppeteer/utils/testserver/cert.pem | 20 + remote/test/puppeteer/utils/testserver/index.js | 284 + remote/test/puppeteer/utils/testserver/key.pem | 28 + .../test/puppeteer/utils/testserver/package.json | 15 + remote/test/puppeteer/vendor/README.md | 13 + remote/test/puppeteer/vendor/mitt/README.md | 179 + remote/test/puppeteer/vendor/mitt/dist/mitt.es.js | 2 + .../test/puppeteer/vendor/mitt/dist/mitt.es.js.map | 1 + remote/test/puppeteer/vendor/mitt/dist/mitt.js | 2 + remote/test/puppeteer/vendor/mitt/dist/mitt.js.map | 1 + .../test/puppeteer/vendor/mitt/dist/mitt.modern.js | 2 + .../puppeteer/vendor/mitt/dist/mitt.modern.js.map | 1 + remote/test/puppeteer/vendor/mitt/dist/mitt.umd.js | 2 + .../puppeteer/vendor/mitt/dist/mitt.umd.js.map | 1 + remote/test/puppeteer/vendor/mitt/index.d.ts | 21 + remote/test/puppeteer/vendor/mitt/package.json | 141 + remote/test/puppeteer/vendor/mitt/src/index.ts | 85 + remote/test/puppeteer/vendor/tsconfig.cjs.json | 11 + remote/test/puppeteer/vendor/tsconfig.esm.json | 11 + remote/test/puppeteer/versions.js | 37 + remote/test/puppeteer/web-test-runner.config.js | 43 + remote/test/unit/test_Connection.js | 31 + remote/test/unit/test_DomainCache.js | 127 + remote/test/unit/test_Error.js | 119 + remote/test/unit/test_Format.js | 119 + remote/test/unit/test_Session.js | 42 + remote/test/unit/test_StreamRegistry.js | 172 + remote/test/unit/test_Sync.js | 230 + remote/test/unit/xpcshell.ini | 14 + 536 files changed, 91685 insertions(+) create mode 100644 remote/.gitignore create mode 100644 remote/Cargo.toml create mode 100644 remote/Connection.jsm create mode 100644 remote/Error.jsm create mode 100644 remote/Format.jsm create mode 100644 remote/JSONHandler.jsm create mode 100644 remote/Log.jsm create mode 100644 remote/Protocol.jsm create mode 100644 remote/README create mode 100644 remote/RecommendedPreferences.jsm create mode 100644 remote/RemoteAgent.jsm create mode 100644 remote/StreamRegistry.jsm create mode 100644 remote/Sync.jsm create mode 100644 remote/TabManager.jsm create mode 100644 remote/WindowManager.jsm create mode 100644 remote/components.conf create mode 100644 remote/doc/Architecture.md create mode 100644 remote/doc/Building.md create mode 100644 remote/doc/CodeStyle.md create mode 100644 remote/doc/Debugging.md create mode 100644 remote/doc/Prefs.md create mode 100644 remote/doc/PuppeteerVendor.md create mode 100644 remote/doc/Security.md create mode 100644 remote/doc/Testing.md create mode 100644 remote/doc/Usage.md create mode 100644 remote/doc/index.rst create mode 100644 remote/doc/moz.build create mode 100644 remote/domains/ContentProcessDomain.jsm create mode 100644 remote/domains/ContentProcessDomains.jsm create mode 100644 remote/domains/Domain.jsm create mode 100644 remote/domains/DomainCache.jsm create mode 100644 remote/domains/ParentProcessDomains.jsm create mode 100644 remote/domains/content/DOM.jsm create mode 100644 remote/domains/content/Emulation.jsm create mode 100644 remote/domains/content/Input.jsm create mode 100644 remote/domains/content/Log.jsm create mode 100644 remote/domains/content/Network.jsm create mode 100644 remote/domains/content/Page.jsm create mode 100644 remote/domains/content/Performance.jsm create mode 100644 remote/domains/content/Runtime.jsm create mode 100644 remote/domains/content/Security.jsm create mode 100644 remote/domains/content/runtime/ExecutionContext.jsm create mode 100644 remote/domains/parent/Browser.jsm create mode 100644 remote/domains/parent/Emulation.jsm create mode 100644 remote/domains/parent/IO.jsm create mode 100644 remote/domains/parent/Input.jsm create mode 100644 remote/domains/parent/Network.jsm create mode 100644 remote/domains/parent/Page.jsm create mode 100644 remote/domains/parent/Security.jsm create mode 100644 remote/domains/parent/Target.jsm create mode 100644 remote/domains/parent/page/DialogHandler.jsm create mode 100644 remote/error.rs create mode 100644 remote/jar.mn create mode 100644 remote/lib.rs create mode 100644 remote/mach_commands.py create mode 100644 remote/moz.build create mode 100644 remote/nsIRemoteAgent.idl create mode 100644 remote/observers/ChannelEventSink.jsm create mode 100644 remote/observers/ContextObserver.jsm create mode 100644 remote/observers/NetworkObserver.jsm create mode 100644 remote/observers/TargetObserver.jsm create mode 100644 remote/puppeteer-expected.json create mode 100644 remote/remote_agent.rs create mode 100644 remote/server/README create mode 100644 remote/server/WebSocketHandshake.jsm create mode 100644 remote/server/WebSocketTransport.jsm create mode 100644 remote/sessions/ContentProcessSession.jsm create mode 100644 remote/sessions/MainProcessSession.jsm create mode 100644 remote/sessions/Session.jsm create mode 100644 remote/sessions/TabSession.jsm create mode 100644 remote/sessions/frame-script.js create mode 100644 remote/startup/RemoteAgentHandler.cpp create mode 100644 remote/startup/RemoteAgentHandler.h create mode 100644 remote/startup/handler.rs create mode 100644 remote/startup/mod.rs create mode 100644 remote/startup/moz.build create mode 100644 remote/targets/MainProcessTarget.jsm create mode 100644 remote/targets/TabTarget.jsm create mode 100644 remote/targets/Target.jsm create mode 100644 remote/targets/TargetList.jsm create mode 100644 remote/test/browser/README.md create mode 100644 remote/test/browser/browser.ini create mode 100644 remote/test/browser/browser_agent.js create mode 100644 remote/test/browser/browser_cdp.js create mode 100644 remote/test/browser/browser_httpd.js create mode 100644 remote/test/browser/browser_main_target.js create mode 100644 remote/test/browser/browser_session.js create mode 100644 remote/test/browser/browser_tabs.js create mode 100644 remote/test/browser/chrome-remote-interface.js create mode 100644 remote/test/browser/dom/browser.ini create mode 100644 remote/test/browser/dom/browser_describeNode.js create mode 100644 remote/test/browser/dom/browser_resolveNode.js create mode 100644 remote/test/browser/dom/head.js create mode 100644 remote/test/browser/emulation/browser.ini create mode 100644 remote/test/browser/emulation/browser_setDeviceMetricsOverride.js create mode 100644 remote/test/browser/emulation/browser_setTouchEmulationEnabled.js create mode 100644 remote/test/browser/emulation/browser_setUserAgentOverride.js create mode 100644 remote/test/browser/emulation/head.js create mode 100644 remote/test/browser/head.js create mode 100644 remote/test/browser/input/browser.ini create mode 100644 remote/test/browser/input/browser_dispatchKeyEvent.js create mode 100644 remote/test/browser/input/browser_dispatchKeyEvent_events.js create mode 100644 remote/test/browser/input/browser_dispatchKeyEvent_race.js create mode 100644 remote/test/browser/input/browser_dispatchMouseEvent.js create mode 100644 remote/test/browser/input/doc_dispatchKeyEvent_race.html create mode 100644 remote/test/browser/input/doc_events.html create mode 100644 remote/test/browser/input/head.js create mode 100644 remote/test/browser/io/browser.ini create mode 100644 remote/test/browser/io/browser_close.js create mode 100644 remote/test/browser/io/browser_read.js create mode 100644 remote/test/browser/io/head.js create mode 100644 remote/test/browser/log/browser.ini create mode 100644 remote/test/browser/log/browser_entryAdded.js create mode 100644 remote/test/browser/log/head.js create mode 100644 remote/test/browser/network/browser.ini create mode 100644 remote/test/browser/network/browser_deleteCookies.js create mode 100644 remote/test/browser/network/browser_emulateNetworkConditions.js create mode 100644 remote/test/browser/network/browser_getAllCookies.js create mode 100644 remote/test/browser/network/browser_getCookies.js create mode 100644 remote/test/browser/network/browser_navigationEvents.js create mode 100644 remote/test/browser/network/browser_requestWillBeSent.js create mode 100644 remote/test/browser/network/browser_responseReceived.js create mode 100644 remote/test/browser/network/browser_setCacheDisabled.js create mode 100644 remote/test/browser/network/browser_setCookie.js create mode 100644 remote/test/browser/network/browser_setCookies.js create mode 100644 remote/test/browser/network/browser_setUserAgentOverride.js create mode 100644 remote/test/browser/network/doc_empty.html create mode 100644 remote/test/browser/network/doc_frameset.html create mode 100644 remote/test/browser/network/doc_networkEvents.html create mode 100644 remote/test/browser/network/file_framesetEvents.js create mode 100644 remote/test/browser/network/file_networkEvents.js create mode 100644 remote/test/browser/network/head.js create mode 100644 remote/test/browser/network/sjs-cookies.sjs create mode 100644 remote/test/browser/page/browser.ini create mode 100644 remote/test/browser/page/browser_bringToFront.js create mode 100644 remote/test/browser/page/browser_captureScreenshot.js create mode 100644 remote/test/browser/page/browser_createIsolatedWorld.js create mode 100644 remote/test/browser/page/browser_domContentEventFired.js create mode 100644 remote/test/browser/page/browser_frameAttached.js create mode 100644 remote/test/browser/page/browser_frameDetached.js create mode 100644 remote/test/browser/page/browser_frameNavigated.js create mode 100644 remote/test/browser/page/browser_frameStartedLoading.js create mode 100644 remote/test/browser/page/browser_frameStoppedLoading.js create mode 100644 remote/test/browser/page/browser_getFrameTree.js create mode 100644 remote/test/browser/page/browser_getLayoutMetrics.js create mode 100644 remote/test/browser/page/browser_getNavigationHistory.js create mode 100644 remote/test/browser/page/browser_javascriptDialog_alert.js create mode 100644 remote/test/browser/page/browser_javascriptDialog_beforeunload.js create mode 100644 remote/test/browser/page/browser_javascriptDialog_confirm.js create mode 100644 remote/test/browser/page/browser_javascriptDialog_otherTarget.js create mode 100644 remote/test/browser/page/browser_javascriptDialog_prompt.js create mode 100644 remote/test/browser/page/browser_lifecycleEvent.js create mode 100644 remote/test/browser/page/browser_loadEventFired.js create mode 100644 remote/test/browser/page/browser_navigate.js create mode 100644 remote/test/browser/page/browser_navigateToHistoryEntry.js create mode 100644 remote/test/browser/page/browser_navigationEvents.js create mode 100644 remote/test/browser/page/browser_printToPDF.js create mode 100644 remote/test/browser/page/browser_reload.js create mode 100644 remote/test/browser/page/browser_runtimeEvents.js create mode 100644 remote/test/browser/page/browser_scriptToEvaluateOnNewDocument.js create mode 100644 remote/test/browser/page/doc_empty.html create mode 100644 remote/test/browser/page/head.js create mode 100644 remote/test/browser/page/sjs_redirect.sjs create mode 100644 remote/test/browser/runtime/browser.ini create mode 100644 remote/test/browser/runtime/browser_callFunctionOn.js create mode 100644 remote/test/browser/runtime/browser_callFunctionOn_returnByValue.js create mode 100644 remote/test/browser/runtime/browser_consoleAPICalled.js create mode 100644 remote/test/browser/runtime/browser_evaluate.js create mode 100644 remote/test/browser/runtime/browser_exceptionThrown.js create mode 100644 remote/test/browser/runtime/browser_executionContextEvents.js create mode 100644 remote/test/browser/runtime/browser_getProperties.js create mode 100644 remote/test/browser/runtime/browser_remoteObjects.js create mode 100644 remote/test/browser/runtime/doc_console_events.html create mode 100644 remote/test/browser/runtime/head.js create mode 100644 remote/test/browser/security/browser.ini create mode 100644 remote/test/browser/security/browser_setIgnoreCertificateErrors.js create mode 100644 remote/test/browser/security/head.js create mode 100644 remote/test/browser/target/browser.ini create mode 100644 remote/test/browser/target/browser_activateTarget.js create mode 100644 remote/test/browser/target/browser_attachToTarget.js create mode 100644 remote/test/browser/target/browser_attachedToTarget.js create mode 100644 remote/test/browser/target/browser_browserContext.js create mode 100644 remote/test/browser/target/browser_closeTarget.js create mode 100644 remote/test/browser/target/browser_getTargets.js create mode 100644 remote/test/browser/target/browser_sendMessageToTarget.js create mode 100644 remote/test/browser/target/browser_setDiscoverTargets.js create mode 100644 remote/test/browser/target/browser_targetCreated.js create mode 100644 remote/test/browser/target/browser_targetDestroyed.js create mode 100644 remote/test/browser/target/doc_test.html create mode 100644 remote/test/browser/target/head.js create mode 100644 remote/test/moz.build create mode 100644 remote/test/puppeteer/.ci/node10/Dockerfile.linux create mode 100644 remote/test/puppeteer/.ci/node12/Dockerfile.linux create mode 100644 remote/test/puppeteer/.editorconfig create mode 100644 remote/test/puppeteer/.eslintignore create mode 100644 remote/test/puppeteer/.eslintrc.js create mode 100644 remote/test/puppeteer/.github/workflows/publish-on-tag.yml create mode 100644 remote/test/puppeteer/.npmrc create mode 100644 remote/test/puppeteer/.travis.yml create mode 100644 remote/test/puppeteer/.versionrc create mode 100644 remote/test/puppeteer/CHANGELOG.md create mode 100644 remote/test/puppeteer/CONTRIBUTING.md create mode 100644 remote/test/puppeteer/LICENSE create mode 100644 remote/test/puppeteer/README.md create mode 100644 remote/test/puppeteer/api-extractor.json create mode 100644 remote/test/puppeteer/cjs-entry-core.js create mode 100644 remote/test/puppeteer/cjs-entry.js create mode 100644 remote/test/puppeteer/commitlint.config.js create mode 100644 remote/test/puppeteer/examples/README.md create mode 100644 remote/test/puppeteer/examples/block-images.js create mode 100644 remote/test/puppeteer/examples/cross-browser.js create mode 100644 remote/test/puppeteer/examples/custom-event.js create mode 100644 remote/test/puppeteer/examples/detect-sniff.js create mode 100644 remote/test/puppeteer/examples/oopif.js create mode 100644 remote/test/puppeteer/examples/pdf.js create mode 100644 remote/test/puppeteer/examples/proxy.js create mode 100644 remote/test/puppeteer/examples/screenshot-fullpage.js create mode 100644 remote/test/puppeteer/examples/screenshot.js create mode 100644 remote/test/puppeteer/examples/search.js create mode 100644 remote/test/puppeteer/install.js create mode 100644 remote/test/puppeteer/json-mocha-reporter.js create mode 100644 remote/test/puppeteer/mocha-config/base.js create mode 100644 remote/test/puppeteer/mocha-config/coverage-tests.js create mode 100644 remote/test/puppeteer/mocha-config/doclint-tests.js create mode 100644 remote/test/puppeteer/mocha-config/puppeteer-unit-tests.js create mode 100644 remote/test/puppeteer/moz.yaml create mode 100644 remote/test/puppeteer/package-lock.json create mode 100644 remote/test/puppeteer/package.json create mode 100644 remote/test/puppeteer/prettier.config.js create mode 100644 remote/test/puppeteer/scripts/ensure-correct-devtools-protocol-package.ts create mode 100755 remote/test/puppeteer/scripts/test-install.sh create mode 100644 remote/test/puppeteer/scripts/tsconfig.json create mode 100644 remote/test/puppeteer/src/.eslintrc.js create mode 100644 remote/test/puppeteer/src/api-docs-entry.ts create mode 100644 remote/test/puppeteer/src/common/Accessibility.ts create mode 100644 remote/test/puppeteer/src/common/AriaQueryHandler.ts create mode 100644 remote/test/puppeteer/src/common/Browser.ts create mode 100644 remote/test/puppeteer/src/common/BrowserConnector.ts create mode 100644 remote/test/puppeteer/src/common/BrowserWebSocketTransport.ts create mode 100644 remote/test/puppeteer/src/common/Connection.ts create mode 100644 remote/test/puppeteer/src/common/ConnectionTransport.ts create mode 100644 remote/test/puppeteer/src/common/ConsoleMessage.ts create mode 100644 remote/test/puppeteer/src/common/Coverage.ts create mode 100644 remote/test/puppeteer/src/common/DOMWorld.ts create mode 100644 remote/test/puppeteer/src/common/Debug.ts create mode 100644 remote/test/puppeteer/src/common/DeviceDescriptors.ts create mode 100644 remote/test/puppeteer/src/common/Dialog.ts create mode 100644 remote/test/puppeteer/src/common/EmulationManager.ts create mode 100644 remote/test/puppeteer/src/common/Errors.ts create mode 100644 remote/test/puppeteer/src/common/EvalTypes.ts create mode 100644 remote/test/puppeteer/src/common/EventEmitter.ts create mode 100644 remote/test/puppeteer/src/common/Events.ts create mode 100644 remote/test/puppeteer/src/common/ExecutionContext.ts create mode 100644 remote/test/puppeteer/src/common/FileChooser.ts create mode 100644 remote/test/puppeteer/src/common/FrameManager.ts create mode 100644 remote/test/puppeteer/src/common/HTTPRequest.ts create mode 100644 remote/test/puppeteer/src/common/HTTPResponse.ts create mode 100644 remote/test/puppeteer/src/common/Input.ts create mode 100644 remote/test/puppeteer/src/common/JSHandle.ts create mode 100644 remote/test/puppeteer/src/common/LifecycleWatcher.ts create mode 100644 remote/test/puppeteer/src/common/NetworkManager.ts create mode 100644 remote/test/puppeteer/src/common/PDFOptions.ts create mode 100644 remote/test/puppeteer/src/common/Page.ts create mode 100644 remote/test/puppeteer/src/common/Product.ts create mode 100644 remote/test/puppeteer/src/common/Puppeteer.ts create mode 100644 remote/test/puppeteer/src/common/PuppeteerViewport.ts create mode 100644 remote/test/puppeteer/src/common/QueryHandler.ts create mode 100644 remote/test/puppeteer/src/common/SecurityDetails.ts create mode 100644 remote/test/puppeteer/src/common/Target.ts create mode 100644 remote/test/puppeteer/src/common/TimeoutSettings.ts create mode 100644 remote/test/puppeteer/src/common/Tracing.ts create mode 100644 remote/test/puppeteer/src/common/USKeyboardLayout.ts create mode 100644 remote/test/puppeteer/src/common/WebWorker.ts create mode 100644 remote/test/puppeteer/src/common/assert.ts create mode 100644 remote/test/puppeteer/src/common/fetch.ts create mode 100644 remote/test/puppeteer/src/common/helper.ts create mode 100644 remote/test/puppeteer/src/environment.ts create mode 100644 remote/test/puppeteer/src/initialize-node.ts create mode 100644 remote/test/puppeteer/src/initialize-web.ts create mode 100644 remote/test/puppeteer/src/node-puppeteer-core.ts create mode 100644 remote/test/puppeteer/src/node.ts create mode 100644 remote/test/puppeteer/src/node/BrowserFetcher.ts create mode 100644 remote/test/puppeteer/src/node/BrowserRunner.ts create mode 100644 remote/test/puppeteer/src/node/LaunchOptions.ts create mode 100644 remote/test/puppeteer/src/node/Launcher.ts create mode 100644 remote/test/puppeteer/src/node/NodeWebSocketTransport.ts create mode 100644 remote/test/puppeteer/src/node/PipeTransport.ts create mode 100644 remote/test/puppeteer/src/node/Puppeteer.ts create mode 100644 remote/test/puppeteer/src/node/install.ts create mode 100644 remote/test/puppeteer/src/revisions.ts create mode 100644 remote/test/puppeteer/src/tsconfig.cjs.json create mode 100644 remote/test/puppeteer/src/tsconfig.esm.json create mode 100644 remote/test/puppeteer/src/web.ts create mode 100644 remote/test/puppeteer/test-browser/connection.spec.js create mode 100644 remote/test/puppeteer/test-browser/debug.spec.js create mode 100644 remote/test/puppeteer/test-browser/helper.js create mode 100644 remote/test/puppeteer/test/.eslintrc.js create mode 100644 remote/test/puppeteer/test/CDPSession.spec.ts create mode 100644 remote/test/puppeteer/test/EventEmitter.spec.ts create mode 100644 remote/test/puppeteer/test/README.md create mode 100644 remote/test/puppeteer/test/accessibility.spec.ts create mode 100644 remote/test/puppeteer/test/ariaqueryhandler.spec.ts create mode 100644 remote/test/puppeteer/test/assert-coverage-test.js create mode 100644 remote/test/puppeteer/test/assets/beforeunload.html create mode 100644 remote/test/puppeteer/test/assets/cached/one-style.css create mode 100644 remote/test/puppeteer/test/assets/cached/one-style.html create mode 100644 remote/test/puppeteer/test/assets/chromium-linux.zip create mode 100644 remote/test/puppeteer/test/assets/consolelog.html create mode 100644 remote/test/puppeteer/test/assets/csp.html create mode 100644 remote/test/puppeteer/test/assets/csscoverage/Dosis-Regular.ttf create mode 100644 remote/test/puppeteer/test/assets/csscoverage/OFL.txt create mode 100644 remote/test/puppeteer/test/assets/csscoverage/involved.html create mode 100644 remote/test/puppeteer/test/assets/csscoverage/media.html create mode 100644 remote/test/puppeteer/test/assets/csscoverage/multiple.html create mode 100644 remote/test/puppeteer/test/assets/csscoverage/simple.html create mode 100644 remote/test/puppeteer/test/assets/csscoverage/sourceurl.html create mode 100644 remote/test/puppeteer/test/assets/csscoverage/stylesheet1.css create mode 100644 remote/test/puppeteer/test/assets/csscoverage/stylesheet2.css create mode 100644 remote/test/puppeteer/test/assets/csscoverage/unused.html create mode 100644 remote/test/puppeteer/test/assets/detect-touch.html create mode 100644 remote/test/puppeteer/test/assets/digits/0.png create mode 100644 remote/test/puppeteer/test/assets/digits/1.png create mode 100644 remote/test/puppeteer/test/assets/digits/2.png create mode 100644 remote/test/puppeteer/test/assets/digits/3.png create mode 100644 remote/test/puppeteer/test/assets/digits/4.png create mode 100644 remote/test/puppeteer/test/assets/digits/5.png create mode 100644 remote/test/puppeteer/test/assets/digits/6.png create mode 100644 remote/test/puppeteer/test/assets/digits/7.png create mode 100644 remote/test/puppeteer/test/assets/digits/8.png create mode 100644 remote/test/puppeteer/test/assets/digits/9.png create mode 100644 remote/test/puppeteer/test/assets/dynamic-oopif.html create mode 100644 remote/test/puppeteer/test/assets/empty.html create mode 100644 remote/test/puppeteer/test/assets/error.html create mode 100644 remote/test/puppeteer/test/assets/es6/.eslintrc create mode 100644 remote/test/puppeteer/test/assets/es6/es6import.js create mode 100644 remote/test/puppeteer/test/assets/es6/es6module.js create mode 100644 remote/test/puppeteer/test/assets/es6/es6pathimport.js create mode 100644 remote/test/puppeteer/test/assets/file-to-upload.txt create mode 100644 remote/test/puppeteer/test/assets/firefox-75.0a1.en-US.linux-x86_64.tar.bz2 create mode 100644 remote/test/puppeteer/test/assets/frames/frame.html create mode 100644 remote/test/puppeteer/test/assets/frames/frameset.html create mode 100644 remote/test/puppeteer/test/assets/frames/nested-frames.html create mode 100644 remote/test/puppeteer/test/assets/frames/one-frame-url-fragment.html create mode 100644 remote/test/puppeteer/test/assets/frames/one-frame.html create mode 100644 remote/test/puppeteer/test/assets/frames/script.js create mode 100644 remote/test/puppeteer/test/assets/frames/style.css create mode 100644 remote/test/puppeteer/test/assets/frames/two-frames.html create mode 100644 remote/test/puppeteer/test/assets/global-var.html create mode 100644 remote/test/puppeteer/test/assets/grid.html create mode 100644 remote/test/puppeteer/test/assets/historyapi.html create mode 100644 remote/test/puppeteer/test/assets/idle-detector.html create mode 100644 remote/test/puppeteer/test/assets/injectedfile.js create mode 100644 remote/test/puppeteer/test/assets/injectedstyle.css create mode 100644 remote/test/puppeteer/test/assets/input/button.html create mode 100644 remote/test/puppeteer/test/assets/input/checkbox.html create mode 100644 remote/test/puppeteer/test/assets/input/fileupload.html create mode 100644 remote/test/puppeteer/test/assets/input/keyboard.html create mode 100644 remote/test/puppeteer/test/assets/input/mouse-helper.js create mode 100644 remote/test/puppeteer/test/assets/input/rotatedButton.html create mode 100644 remote/test/puppeteer/test/assets/input/scrollable.html create mode 100644 remote/test/puppeteer/test/assets/input/select.html create mode 100644 remote/test/puppeteer/test/assets/input/textarea.html create mode 100644 remote/test/puppeteer/test/assets/input/touches.html create mode 100644 remote/test/puppeteer/test/assets/input/wheel.html create mode 100644 remote/test/puppeteer/test/assets/jscoverage/eval.html create mode 100644 remote/test/puppeteer/test/assets/jscoverage/involved.html create mode 100644 remote/test/puppeteer/test/assets/jscoverage/multiple.html create mode 100644 remote/test/puppeteer/test/assets/jscoverage/ranges.html create mode 100644 remote/test/puppeteer/test/assets/jscoverage/script1.js create mode 100644 remote/test/puppeteer/test/assets/jscoverage/script2.js create mode 100644 remote/test/puppeteer/test/assets/jscoverage/simple.html create mode 100644 remote/test/puppeteer/test/assets/jscoverage/sourceurl.html create mode 100644 remote/test/puppeteer/test/assets/jscoverage/unused.html create mode 100644 remote/test/puppeteer/test/assets/mobile.html create mode 100644 remote/test/puppeteer/test/assets/modernizr.js create mode 100644 remote/test/puppeteer/test/assets/networkidle.html create mode 100644 remote/test/puppeteer/test/assets/offscreenbuttons.html create mode 100644 remote/test/puppeteer/test/assets/one-style.css create mode 100644 remote/test/puppeteer/test/assets/one-style.html create mode 100644 remote/test/puppeteer/test/assets/playground.html create mode 100644 remote/test/puppeteer/test/assets/popup/popup.html create mode 100644 remote/test/puppeteer/test/assets/popup/window-open.html create mode 100644 remote/test/puppeteer/test/assets/pptr.png create mode 100644 remote/test/puppeteer/test/assets/resetcss.html create mode 100644 remote/test/puppeteer/test/assets/self-request.html create mode 100644 remote/test/puppeteer/test/assets/serviceworkers/empty/sw.html create mode 100644 remote/test/puppeteer/test/assets/serviceworkers/empty/sw.js create mode 100644 remote/test/puppeteer/test/assets/serviceworkers/fetch/style.css create mode 100644 remote/test/puppeteer/test/assets/serviceworkers/fetch/sw.html create mode 100644 remote/test/puppeteer/test/assets/serviceworkers/fetch/sw.js create mode 100644 remote/test/puppeteer/test/assets/shadow.html create mode 100644 remote/test/puppeteer/test/assets/simple-extension/content-script.js create mode 100644 remote/test/puppeteer/test/assets/simple-extension/index.js create mode 100644 remote/test/puppeteer/test/assets/simple-extension/manifest.json create mode 100644 remote/test/puppeteer/test/assets/simple.json create mode 100644 remote/test/puppeteer/test/assets/tamperable.html create mode 100644 remote/test/puppeteer/test/assets/title.html create mode 100644 remote/test/puppeteer/test/assets/worker/worker.html create mode 100644 remote/test/puppeteer/test/assets/worker/worker.js create mode 100644 remote/test/puppeteer/test/assets/wrappedlink.html create mode 100644 remote/test/puppeteer/test/browser.spec.ts create mode 100644 remote/test/puppeteer/test/browsercontext.spec.ts create mode 100644 remote/test/puppeteer/test/chromiumonly.spec.ts create mode 100644 remote/test/puppeteer/test/click.spec.ts create mode 100644 remote/test/puppeteer/test/cookies.spec.ts create mode 100644 remote/test/puppeteer/test/coverage-utils.js create mode 100644 remote/test/puppeteer/test/coverage.spec.ts create mode 100644 remote/test/puppeteer/test/defaultbrowsercontext.spec.ts create mode 100644 remote/test/puppeteer/test/dialog.spec.ts create mode 100644 remote/test/puppeteer/test/diffstyle.css create mode 100644 remote/test/puppeteer/test/elementhandle.spec.ts create mode 100644 remote/test/puppeteer/test/emulation.spec.ts create mode 100644 remote/test/puppeteer/test/evaluation.spec.ts create mode 100644 remote/test/puppeteer/test/fixtures.spec.ts create mode 100644 remote/test/puppeteer/test/fixtures/closeme.js create mode 100644 remote/test/puppeteer/test/fixtures/dumpio.js create mode 100644 remote/test/puppeteer/test/frame.spec.ts create mode 100644 remote/test/puppeteer/test/golden-chromium/csscoverage-involved.txt create mode 100644 remote/test/puppeteer/test/golden-chromium/grid-cell-0.png create mode 100644 remote/test/puppeteer/test/golden-chromium/grid-cell-1.png create mode 100644 remote/test/puppeteer/test/golden-chromium/grid-cell-2.png create mode 100644 remote/test/puppeteer/test/golden-chromium/grid-cell-3.png create mode 100644 remote/test/puppeteer/test/golden-chromium/jscoverage-involved.txt create mode 100644 remote/test/puppeteer/test/golden-chromium/mock-binary-response.png create mode 100644 remote/test/puppeteer/test/golden-chromium/screenshot-clip-odd-size.png create mode 100644 remote/test/puppeteer/test/golden-chromium/screenshot-clip-rect.png create mode 100644 remote/test/puppeteer/test/golden-chromium/screenshot-element-bounding-box.png create mode 100644 remote/test/puppeteer/test/golden-chromium/screenshot-element-fractional-offset.png create mode 100644 remote/test/puppeteer/test/golden-chromium/screenshot-element-fractional.png create mode 100644 remote/test/puppeteer/test/golden-chromium/screenshot-element-larger-than-viewport.png create mode 100644 remote/test/puppeteer/test/golden-chromium/screenshot-element-padding-border.png create mode 100644 remote/test/puppeteer/test/golden-chromium/screenshot-element-rotate.png create mode 100644 remote/test/puppeteer/test/golden-chromium/screenshot-element-scrolled-into-view.png create mode 100644 remote/test/puppeteer/test/golden-chromium/screenshot-grid-fullpage.png create mode 100644 remote/test/puppeteer/test/golden-chromium/screenshot-offscreen-clip.png create mode 100644 remote/test/puppeteer/test/golden-chromium/screenshot-sanity.png create mode 100644 remote/test/puppeteer/test/golden-chromium/transparent.png create mode 100644 remote/test/puppeteer/test/golden-chromium/vision-deficiency-achromatopsia.png create mode 100644 remote/test/puppeteer/test/golden-chromium/vision-deficiency-blurredVision.png create mode 100644 remote/test/puppeteer/test/golden-chromium/vision-deficiency-deuteranopia.png create mode 100644 remote/test/puppeteer/test/golden-chromium/vision-deficiency-protanopia.png create mode 100644 remote/test/puppeteer/test/golden-chromium/vision-deficiency-tritanopia.png create mode 100644 remote/test/puppeteer/test/golden-chromium/white.jpg create mode 100644 remote/test/puppeteer/test/golden-firefox/grid-cell-0.png create mode 100644 remote/test/puppeteer/test/golden-firefox/grid-cell-1.png create mode 100644 remote/test/puppeteer/test/golden-firefox/screenshot-clip-odd-size.png create mode 100644 remote/test/puppeteer/test/golden-firefox/screenshot-clip-rect.png create mode 100644 remote/test/puppeteer/test/golden-firefox/screenshot-element-bounding-box.png create mode 100644 remote/test/puppeteer/test/golden-firefox/screenshot-element-fractional-offset.png create mode 100644 remote/test/puppeteer/test/golden-firefox/screenshot-element-fractional.png create mode 100644 remote/test/puppeteer/test/golden-firefox/screenshot-element-larger-than-viewport.png create mode 100644 remote/test/puppeteer/test/golden-firefox/screenshot-element-padding-border.png create mode 100644 remote/test/puppeteer/test/golden-firefox/screenshot-element-rotate.png create mode 100644 remote/test/puppeteer/test/golden-firefox/screenshot-element-scrolled-into-view.png create mode 100644 remote/test/puppeteer/test/golden-firefox/screenshot-grid-fullpage.png create mode 100644 remote/test/puppeteer/test/golden-firefox/screenshot-offscreen-clip.png create mode 100644 remote/test/puppeteer/test/golden-firefox/screenshot-sanity.png create mode 100644 remote/test/puppeteer/test/golden-utils.js create mode 100644 remote/test/puppeteer/test/headful.spec.ts create mode 100644 remote/test/puppeteer/test/idle_override.spec.ts create mode 100644 remote/test/puppeteer/test/ignorehttpserrors.spec.ts create mode 100644 remote/test/puppeteer/test/input.spec.ts create mode 100644 remote/test/puppeteer/test/jshandle.spec.ts create mode 100644 remote/test/puppeteer/test/keyboard.spec.ts create mode 100644 remote/test/puppeteer/test/launcher.spec.ts create mode 100644 remote/test/puppeteer/test/mocha-ts-require.js create mode 100644 remote/test/puppeteer/test/mocha-utils.ts create mode 100644 remote/test/puppeteer/test/mouse.spec.ts create mode 100644 remote/test/puppeteer/test/navigation.spec.ts create mode 100644 remote/test/puppeteer/test/network.spec.ts create mode 100644 remote/test/puppeteer/test/oopif.spec.ts create mode 100644 remote/test/puppeteer/test/page.spec.ts create mode 100644 remote/test/puppeteer/test/queryselector.spec.ts create mode 100644 remote/test/puppeteer/test/requestinterception.spec.ts create mode 100755 remote/test/puppeteer/test/run_static_server.js create mode 100644 remote/test/puppeteer/test/screenshot.spec.ts create mode 100644 remote/test/puppeteer/test/target.spec.ts create mode 100644 remote/test/puppeteer/test/touchscreen.spec.ts create mode 100644 remote/test/puppeteer/test/tracing.spec.ts create mode 100644 remote/test/puppeteer/test/tsconfig.json create mode 100644 remote/test/puppeteer/test/tsconfig.test.json create mode 100644 remote/test/puppeteer/test/utils.js create mode 100644 remote/test/puppeteer/test/waittask.spec.ts create mode 100644 remote/test/puppeteer/test/worker.spec.ts create mode 100644 remote/test/puppeteer/tsconfig-esm.json create mode 100644 remote/test/puppeteer/tsconfig.base.json create mode 100644 remote/test/puppeteer/tsconfig.json create mode 100644 remote/test/puppeteer/typescript-if-required.js create mode 100644 remote/test/puppeteer/utils/ESTreeWalker.js create mode 100644 remote/test/puppeteer/utils/apply_next_version.js create mode 100755 remote/test/puppeteer/utils/bisect.js create mode 100755 remote/test/puppeteer/utils/check_availability.js create mode 100644 remote/test/puppeteer/utils/doclint/.gitignore create mode 100644 remote/test/puppeteer/utils/doclint/Message.js create mode 100644 remote/test/puppeteer/utils/doclint/README.md create mode 100644 remote/test/puppeteer/utils/doclint/Source.js create mode 100644 remote/test/puppeteer/utils/doclint/check_public_api/Documentation.js create mode 100644 remote/test/puppeteer/utils/doclint/check_public_api/JSBuilder.js create mode 100644 remote/test/puppeteer/utils/doclint/check_public_api/MDBuilder.js create mode 100644 remote/test/puppeteer/utils/doclint/check_public_api/index.js create mode 100755 remote/test/puppeteer/utils/doclint/cli.js create mode 100644 remote/test/puppeteer/utils/doclint/preprocessor/index.js create mode 100644 remote/test/puppeteer/utils/doclint/preprocessor/preprocessor.spec.js create mode 100755 remote/test/puppeteer/utils/fetch_devices.js create mode 100755 remote/test/puppeteer/utils/prepare_puppeteer_core.js create mode 100644 remote/test/puppeteer/utils/testserver/LICENSE create mode 100644 remote/test/puppeteer/utils/testserver/README.md create mode 100644 remote/test/puppeteer/utils/testserver/cert.pem create mode 100644 remote/test/puppeteer/utils/testserver/index.js create mode 100644 remote/test/puppeteer/utils/testserver/key.pem create mode 100644 remote/test/puppeteer/utils/testserver/package.json create mode 100644 remote/test/puppeteer/vendor/README.md create mode 100644 remote/test/puppeteer/vendor/mitt/README.md create mode 100644 remote/test/puppeteer/vendor/mitt/dist/mitt.es.js create mode 100644 remote/test/puppeteer/vendor/mitt/dist/mitt.es.js.map create mode 100644 remote/test/puppeteer/vendor/mitt/dist/mitt.js create mode 100644 remote/test/puppeteer/vendor/mitt/dist/mitt.js.map create mode 100644 remote/test/puppeteer/vendor/mitt/dist/mitt.modern.js create mode 100644 remote/test/puppeteer/vendor/mitt/dist/mitt.modern.js.map create mode 100644 remote/test/puppeteer/vendor/mitt/dist/mitt.umd.js create mode 100644 remote/test/puppeteer/vendor/mitt/dist/mitt.umd.js.map create mode 100644 remote/test/puppeteer/vendor/mitt/index.d.ts create mode 100644 remote/test/puppeteer/vendor/mitt/package.json create mode 100644 remote/test/puppeteer/vendor/mitt/src/index.ts create mode 100644 remote/test/puppeteer/vendor/tsconfig.cjs.json create mode 100644 remote/test/puppeteer/vendor/tsconfig.esm.json create mode 100644 remote/test/puppeteer/versions.js create mode 100644 remote/test/puppeteer/web-test-runner.config.js create mode 100644 remote/test/unit/test_Connection.js create mode 100644 remote/test/unit/test_DomainCache.js create mode 100644 remote/test/unit/test_Error.js create mode 100644 remote/test/unit/test_Format.js create mode 100644 remote/test/unit/test_Session.js create mode 100644 remote/test/unit/test_StreamRegistry.js create mode 100644 remote/test/unit/test_Sync.js create mode 100644 remote/test/unit/xpcshell.ini (limited to 'remote') diff --git a/remote/.gitignore b/remote/.gitignore new file mode 100644 index 0000000000..74e8609ab2 --- /dev/null +++ b/remote/.gitignore @@ -0,0 +1,3 @@ +test/puppeteer/package-lock.json +test/puppeteer/node_modules/ +test/puppeteer/.local-chromium/ diff --git a/remote/Cargo.toml b/remote/Cargo.toml new file mode 100644 index 0000000000..d37568f9db --- /dev/null +++ b/remote/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "remote" +version = "0.1.0" + +[lib] +path = "lib.rs" + +[dependencies] +http = "0.2" +libc = "0.2" +log = "0.4" +nserror = { path = "../xpcom/rust/nserror" } +nsstring = { path = "../xpcom/rust/nsstring" } +thiserror = "1" +xpcom = { path = "../xpcom/rust/xpcom" } diff --git a/remote/Connection.jsm b/remote/Connection.jsm new file mode 100644 index 0000000000..a87d6a9a3b --- /dev/null +++ b/remote/Connection.jsm @@ -0,0 +1,304 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +var EXPORTED_SYMBOLS = ["Connection"]; + +const { XPCOMUtils } = ChromeUtils.import( + "resource://gre/modules/XPCOMUtils.jsm" +); + +const { truncate } = ChromeUtils.import("chrome://remote/content/Format.jsm"); +const { Log } = ChromeUtils.import("chrome://remote/content/Log.jsm"); +const { UnknownMethodError } = ChromeUtils.import( + "chrome://remote/content/Error.jsm" +); + +XPCOMUtils.defineLazyGetter(this, "log", Log.get); +XPCOMUtils.defineLazyServiceGetter( + this, + "UUIDGen", + "@mozilla.org/uuid-generator;1", + "nsIUUIDGenerator" +); + +class Connection { + /** + * @param WebSocketTransport transport + * @param httpd.js's Connection httpdConnection + */ + constructor(transport, httpdConnection) { + this.id = UUIDGen.generateUUID().toString(); + this.transport = transport; + this.httpdConnection = httpdConnection; + + this.transport.hooks = this; + this.transport.ready(); + + this.defaultSession = null; + this.sessions = new Map(); + } + + /** + * Register a new Session to forward the messages to. + * Session without any `id` attribute will be considered to be the + * default one, to which messages without `sessionId` attribute are + * forwarded to. Only one such session can be registered. + * + * @param Session session + */ + registerSession(session) { + if (!session.id) { + if (this.defaultSession) { + throw new Error( + "Default session is already set on Connection," + + "can't register another one." + ); + } + this.defaultSession = session; + } + this.sessions.set(session.id, session); + } + + send(body) { + const payload = JSON.stringify(body, null, Log.verbose ? "\t" : null); + log.trace(truncate`<-(connection ${this.id}) ${payload}`); + this.transport.send(JSON.parse(payload)); + } + + /** + * Send an error back to the client. + * + * @param Number id + * Id of the packet which lead to an error. + * @param Error e + * Error object with `message` and `stack` attributes. + * @param Number sessionId (Optional) + * Id of the session used to send this packet. + * This will be null if that was the default session. + */ + onError(id, e, sessionId) { + const error = { + message: e.message, + data: e.stack, + }; + this.send({ id, sessionId, error }); + } + + /** + * Send the result of a call to a Domain's function. + * + * @param Number id + * The request id being sent by the client to call the domain's method. + * @param Object result + * A JSON-serializable value which is the actual result. + * @param Number sessionId + * The sessionId from which this packet is emitted. + * This will be undefined for the default session. + */ + onResult(id, result, sessionId) { + this.sendResult(id, result, sessionId); + + // When a client attaches to a secondary target via + // `Target.attachToTarget`, and it executes a command via + // `Target.sendMessageToTarget`, we should emit an event back with the + // result including the `sessionId` attribute of this secondary target's + // session. `Target.attachToTarget` creates the secondary session and + // returns the session ID. + if (sessionId) { + // Temporarily disabled due to spamming of the console (bug 1598468). + // Event should only be sent on protocol messages (eg. attachedToTarget) + // this.sendEvent("Target.receivedMessageFromTarget", { + // sessionId, + // // receivedMessageFromTarget is expected to send a raw CDP packet + // // in the `message` property and it to be already serialized to a + // // string + // message: JSON.stringify({ + // id, + // result, + // }), + // }); + } + } + + sendResult(id, result, sessionId) { + this.send({ + sessionId, // this will be undefined for the default session + id, + result: typeof result != "undefined" ? result : {}, + }); + } + + /** + * Send an event coming from a Domain to the CDP client. + * + * @param String method + * The event name. This is composed by a domain name, + * a dot character followed by the event name. + * e.g. `Target.targetCreated` + * @param Object params + * A JSON-serializable value which is the payload + * associated with this event. + * @param Number sessionId + * The sessionId from which this packet is emitted. + * This will be undefined for the default session. + */ + onEvent(method, params, sessionId) { + this.sendEvent(method, params, sessionId); + + // When a client attaches to a secondary target via + // `Target.attachToTarget`, we should emit an event back with the + // result including the `sessionId` attribute of this secondary target's + // session. `Target.attachToTarget` creates the secondary session and + // returns the session ID. + if (sessionId) { + // Temporarily disabled due to spamming of the console (bug 1598468). + // Event should only be sent on protocol messages (eg. attachedToTarget) + // this.sendEvent("Target.receivedMessageFromTarget", { + // sessionId, + // message: JSON.stringify({ + // method, + // params, + // }), + // }); + } + } + + sendEvent(method, params, sessionId) { + this.send({ + sessionId, // this will be undefined for the default session + method, + params, + }); + } + + // transport hooks + + /** + * Receive a packet from the WebSocket layer. + * This packet is sent by a CDP client and is meant to execute + * a particular function on a given Domain. + * + * @param Object packet + * JSON-serializable object sent by the client + */ + async onPacket(packet) { + log.trace(`(connection ${this.id})-> ${JSON.stringify(packet)}`); + + try { + const { id, method, params, sessionId } = packet; + + // First check for mandatory field in the packets + if (typeof id == "undefined") { + throw new TypeError("Message missing 'id' field"); + } + if (typeof method == "undefined") { + throw new TypeError("Message missing 'method' field"); + } + + // Extract the domain name and the method name out of `method` attribute + const { domain, command } = Connection.splitMethod(method); + + // If a `sessionId` field is passed, retrieve the session to which we + // should forward this packet. Otherwise send it to the default session. + let session; + if (!sessionId) { + if (!this.defaultSession) { + throw new Error(`Connection is missing a default Session.`); + } + session = this.defaultSession; + } else { + session = this.sessions.get(sessionId); + if (!session) { + throw new Error(`Session '${sessionId}' doesn't exists.`); + } + } + + // Bug 1600317 - Workaround to deny internal methods to be called + if (command.startsWith("_")) { + throw new UnknownMethodError(command); + } + + // Finally, instruct the targeted session to execute the command + const result = await session.execute(id, domain, command, params); + this.onResult(id, result, sessionId); + } catch (e) { + this.onError(packet.id, e, packet.sessionId); + } + } + + /** + * Interpret a given CDP packet for a given Session. + * + * @param String sessionId + * ID of the session for which we should execute a command. + * @param String message + * JSON payload of the CDP packet stringified to a string. + * The CDP packet is about executing a Domain's function. + */ + sendMessageToTarget(sessionId, message) { + const session = this.sessions.get(sessionId); + if (!session) { + throw new Error(`Session '${sessionId}' doesn't exists.`); + } + // `message` is received from `Target.sendMessageToTarget` where the + // message attribute is a stringify JSON payload which represent a CDP + // packet. + const packet = JSON.parse(message); + + // The CDP packet sent by the client shouldn't have a sessionId attribute + // as it is passed as another argument of `Target.sendMessageToTarget`. + // Set it here in order to reuse the codepath of flatten session, where + // the client sends CDP packets with a `sessionId` attribute instead + // of going through the old and probably deprecated + // `Target.sendMessageToTarget` API. + packet.sessionId = sessionId; + this.onPacket(packet); + } + + /** + * Instruct the connection to close. + * This will ask the transport to shutdown the WebSocket connection + * and destroy all active sessions. + */ + close() { + this.transport.close(); + + // In addition to the WebSocket transport, we also have to close the Connection + // used internaly within httpd.js. Otherwise the server doesn't shut down correctly + // and keep these Connection instances alive. + this.httpdConnection.close(); + } + + /** + * This is called by the `transport` when the connection is closed. + * Cleanup all the registered sessions. + */ + onClosed(status) { + for (const session of this.sessions.values()) { + session.destructor(); + } + this.sessions.clear(); + } + + /** + * Splits a method, e.g. "Browser.getVersion", + * into domain ("Browser") and command ("getVersion") components. + */ + static splitMethod(s) { + const ss = s.split("."); + if (ss.length != 2 || ss[0].length == 0 || ss[1].length == 0) { + throw new TypeError(`Invalid method format: "${s}"`); + } + return { + domain: ss[0], + command: ss[1], + }; + } + + toString() { + return `[object Connection ${this.id}]`; + } +} diff --git a/remote/Error.jsm b/remote/Error.jsm new file mode 100644 index 0000000000..d7a83400cb --- /dev/null +++ b/remote/Error.jsm @@ -0,0 +1,137 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +var EXPORTED_SYMBOLS = [ + "FatalError", + "RemoteAgentError", + "UnknownMethodError", + "UnsupportedError", +]; + +const { Log } = ChromeUtils.import("chrome://remote/content/Log.jsm"); +const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); +const { XPCOMUtils } = ChromeUtils.import( + "resource://gre/modules/XPCOMUtils.jsm" +); + +XPCOMUtils.defineLazyGetter(this, "log", Log.get); + +class RemoteAgentError extends Error { + constructor(message = "", cause = undefined) { + cause = cause || message; + super(cause); + + this.name = this.constructor.name; + this.message = message; + this.cause = cause; + + this.notify(); + } + + notify() { + Cu.reportError(this); + log.error(this.toString({ stack: true })); + } + + toString({ stack = false } = {}) { + return RemoteAgentError.format(this, { stack }); + } + + static format(e, { stack = false } = {}) { + return formatError(e, { stack }); + } + + /** + * Takes a serialised CDP error and reconstructs it + * as a RemoteAgentError. + * + * The error must be of this form: + * + * {"message": "TypeError: foo is not a function\n + * execute@chrome://remote/content/sessions/Session.jsm:73:39\n + * onMessage@chrome://remote/content/sessions/TabSession.jsm:65:20"} + * + * This approach has the notable deficiency that it cannot deal + * with causes to errors because of the unstructured nature of CDP + * errors. A possible future improvement would be to extend the + * error serialisation to include discrete fields for each data + * property. + * + * @param {Object} json + * CDP error encoded as a JSON object, which must have a + * "message" field, where the first line will make out the error + * message and the subsequent lines the stacktrace. + * + * @return {RemoteAgentError} + */ + static fromJSON(json) { + const [message, ...stack] = json.message.split("\n"); + const err = new RemoteAgentError(); + err.message = message.slice(0, -1); + err.stack = stack.map(s => s.trim()).join("\n"); + err.cause = null; + return err; + } +} + +/** + * A fatal error that it is not possible to recover from + * or send back to the client. + * + * Constructing this error will force the application to quit. + */ +class FatalError extends RemoteAgentError { + constructor(...args) { + super(...args); + this.quit(); + } + + notify() { + log.fatal(this.toString({ stack: true })); + } + + quit(mode = Ci.nsIAppStartup.eForceQuit) { + Services.startup.quit(mode); + } +} + +/** When an operation is not yet implemented. */ +class UnsupportedError extends RemoteAgentError {} + +/** The requested remote method does not exist. */ +class UnknownMethodError extends RemoteAgentError { + constructor(domain, command = null) { + if (command) { + super(`${domain}.${command}`); + } else { + super(domain); + } + } +} + +function formatError(error, { stack = false } = {}) { + const els = []; + + els.push(error.name); + if (error.message) { + els.push(": "); + els.push(error.message); + } + + if (stack && error.stack) { + els.push(":\n"); + + const stack = error.stack.trim().split("\n"); + els.push(stack.map(line => `\t${line}`).join("\n")); + + if (error.cause) { + els.push("\n"); + els.push("caused by: " + formatError(error.cause, { stack })); + } + } + + return els.join(""); +} diff --git a/remote/Format.jsm b/remote/Format.jsm new file mode 100644 index 0000000000..0b571fc660 --- /dev/null +++ b/remote/Format.jsm @@ -0,0 +1,184 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +var EXPORTED_SYMBOLS = ["pprint", "truncate"]; + +const { Log } = ChromeUtils.import("chrome://remote/content/Log.jsm"); + +const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); +const { XPCOMUtils } = ChromeUtils.import( + "resource://gre/modules/XPCOMUtils.jsm" +); + +XPCOMUtils.defineLazyGetter(this, "log", Log.get); + +const ELEMENT_NODE = 1; +const MAX_STRING_LENGTH = 250; +const PREF_TRUNCATE = "remote.log.truncate"; + +/** + * Pretty-print values passed to template strings. + * + * Usage:: + * + * let bool = {value: true}; + * pprint`Expected boolean, got ${bool}`; + * => 'Expected boolean, got [object Object] {"value": true}' + * + * let htmlElement = document.querySelector("input#foo"); + * pprint`Expected element ${htmlElement}`; + * => 'Expected element ' + * + * pprint`Current window: ${window}`; + * => '[object Window https://www.mozilla.org/]' + */ +function pprint(ss, ...values) { + function pretty(val) { + let proto = Object.prototype.toString.call(val); + if ( + typeof val == "object" && + val !== null && + "nodeType" in val && + val.nodeType === ELEMENT_NODE + ) { + return prettyElement(val); + } else if (["[object Window]", "[object ChromeWindow]"].includes(proto)) { + return prettyWindowGlobal(val); + } else if (proto == "[object Attr]") { + return prettyAttr(val); + } + return prettyObject(val); + } + + function prettyElement(el) { + let attrs = ["id", "class", "href", "name", "src", "type"]; + + let idents = ""; + for (let attr of attrs) { + if (el.hasAttribute(attr)) { + idents += ` ${attr}="${el.getAttribute(attr)}"`; + } + } + + return `<${el.localName}${idents}>`; + } + + function prettyWindowGlobal(win) { + let proto = Object.prototype.toString.call(win); + return `[${proto.substring(1, proto.length - 1)} ${win.location}]`; + } + + function prettyAttr(obj) { + return `[object Attr ${obj.name}="${obj.value}"]`; + } + + function prettyObject(obj) { + let proto = Object.prototype.toString.call(obj); + let s = ""; + try { + s = JSON.stringify(obj); + } catch (e) { + if (e instanceof TypeError) { + s = `<${e.message}>`; + } else { + throw e; + } + } + return `${proto} ${s}`; + } + + let res = []; + for (let i = 0; i < ss.length; i++) { + res.push(ss[i]); + if (i < values.length) { + let s; + try { + s = pretty(values[i]); + } catch (e) { + log.warn("Problem pretty printing:", e); + s = typeof values[i]; + } + res.push(s); + } + } + return res.join(""); +} + +/** + * Template literal that truncates string values in arbitrary objects. + * + * Given any object, the template will walk the object and truncate + * any strings it comes across to a reasonable limit. This is suitable + * when you have arbitrary data and data integrity is not important. + * + * The strings are truncated in the middle so that the beginning and + * the end is preserved. This will make a long, truncated string look + * like "X <...> Y", where X and Y are half the number of characters + * of the maximum string length from either side of the string. + * + * + * Usage:: + * + * truncate`Hello ${"x".repeat(260)}!`; + * // Hello xxx ... xxx! + * + * Functions named `toJSON` or `toString` on objects will be called. + */ +function truncate(strings, ...values) { + const truncateLog = Services.prefs.getBoolPref(PREF_TRUNCATE, false); + function walk(obj) { + const typ = Object.prototype.toString.call(obj); + + switch (typ) { + case "[object Undefined]": + case "[object Null]": + case "[object Boolean]": + case "[object Number]": + return obj; + + case "[object String]": + if (truncateLog && obj.length > MAX_STRING_LENGTH) { + let s1 = obj.substring(0, MAX_STRING_LENGTH / 2); + let s2 = obj.substring(obj.length - MAX_STRING_LENGTH / 2); + return `${s1} ... ${s2}`; + } + return obj; + + case "[object Array]": + return obj.map(walk); + + // arbitrary object + default: + if ( + Object.getOwnPropertyNames(obj).includes("toString") && + typeof obj.toString == "function" + ) { + return walk(obj.toString()); + } + + let rv = {}; + for (let prop in obj) { + rv[prop] = walk(obj[prop]); + } + return rv; + } + } + + let res = []; + for (let i = 0; i < strings.length; ++i) { + res.push(strings[i]); + if (i < values.length) { + let obj = walk(values[i]); + let t = Object.prototype.toString.call(obj); + if (t == "[object Array]" || t == "[object Object]") { + res.push(JSON.stringify(obj)); + } else { + res.push(obj); + } + } + } + return res.join(""); +} diff --git a/remote/JSONHandler.jsm b/remote/JSONHandler.jsm new file mode 100644 index 0000000000..4a81672893 --- /dev/null +++ b/remote/JSONHandler.jsm @@ -0,0 +1,84 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +var EXPORTED_SYMBOLS = ["JSONHandler"]; + +const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); + +const { HTTP_404, HTTP_505 } = ChromeUtils.import( + "chrome://remote/content/server/HTTPD.jsm" +); +const { Log } = ChromeUtils.import("chrome://remote/content/Log.jsm"); +const { Protocol } = ChromeUtils.import("chrome://remote/content/Protocol.jsm"); +const { RemoteAgentError } = ChromeUtils.import( + "chrome://remote/content/Error.jsm" +); + +class JSONHandler { + constructor(agent) { + this.agent = agent; + this.routes = { + "/json/version": this.getVersion.bind(this), + "/json/protocol": this.getProtocol.bind(this), + "/json/list": this.getTargetList.bind(this), + }; + } + + getVersion() { + const mainProcessTarget = this.agent.targets.getMainProcessTarget(); + + const { userAgent } = Cc[ + "@mozilla.org/network/protocol;1?name=http" + ].getService(Ci.nsIHttpProtocolHandler); + + return { + Browser: `${Services.appinfo.name}/${Services.appinfo.version}`, + "Protocol-Version": "1.0", + "User-Agent": userAgent, + "V8-Version": "1.0", + "WebKit-Version": "1.0", + webSocketDebuggerUrl: mainProcessTarget.toJSON().webSocketDebuggerUrl, + }; + } + + getProtocol() { + return Protocol.Description; + } + + getTargetList() { + return [...this.agent.targets]; + } + + // nsIHttpRequestHandler + + handle(request, response) { + if (request.method != "GET") { + throw HTTP_404; + } + + if (!(request.path in this.routes)) { + throw HTTP_404; + } + + try { + const body = this.routes[request.path](); + const payload = JSON.stringify(body, null, Log.verbose ? "\t" : null); + + response.setStatusLine(request.httpVersion, 200, "OK"); + response.setHeader("Content-Type", "application/json"); + response.write(payload); + } catch (e) { + new RemoteAgentError(e).notify(); + throw HTTP_505; + } + } + + // XPCOM + + get QueryInterface() { + return ChromeUtils.generateQI(["nsIHttpRequestHandler"]); + } +} diff --git a/remote/Log.jsm b/remote/Log.jsm new file mode 100644 index 0000000000..12c0b60714 --- /dev/null +++ b/remote/Log.jsm @@ -0,0 +1,31 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +var EXPORTED_SYMBOLS = ["Log"]; + +const { Log: StdLog } = ChromeUtils.import("resource://gre/modules/Log.jsm"); +const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); + +const LOG_LEVEL = "remote.log.level"; + +/** E10s compatible wrapper for the standard logger from Log.jsm. */ +class Log { + static get() { + const logger = StdLog.repository.getLogger("RemoteAgent"); + if (logger.ownAppenders.length == 0) { + logger.addAppender(new StdLog.DumpAppender()); + logger.manageLevelFromPref(LOG_LEVEL); + } + return logger; + } + + static get verbose() { + // we can't use Preferences.jsm before first paint, + // see ../browser/base/content/test/performance/browser_startup.js + const level = Services.prefs.getStringPref(LOG_LEVEL, "Info"); + return StdLog.Level[level] >= StdLog.Level.Info; + } +} diff --git a/remote/Protocol.jsm b/remote/Protocol.jsm new file mode 100644 index 0000000000..ef6c65f6f4 --- /dev/null +++ b/remote/Protocol.jsm @@ -0,0 +1,17362 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +var EXPORTED_SYMBOLS = ["Protocol"]; + +// The `Description` below is imported from Chromium Code. + +// TODO(ato): We send back a description of the protocol +// when the user makes the initial HTTP request, +// but the following is pure fiction. +const Description = { + "domains": [ + { + "domain": "Accessibility", + "experimental": true, + "dependencies": [ + "DOM" + ], + "types": [ + { + "id": "AXNodeId", + "description": "Unique accessibility node identifier.", + "type": "string" + }, + { + "id": "AXValueType", + "description": "Enum of possible property types.", + "type": "string", + "enum": [ + "boolean", + "tristate", + "booleanOrUndefined", + "idref", + "idrefList", + "integer", + "node", + "nodeList", + "number", + "string", + "computedString", + "token", + "tokenList", + "domRelation", + "role", + "internalRole", + "valueUndefined" + ] + }, + { + "id": "AXValueSourceType", + "description": "Enum of possible property sources.", + "type": "string", + "enum": [ + "attribute", + "implicit", + "style", + "contents", + "placeholder", + "relatedElement" + ] + }, + { + "id": "AXValueNativeSourceType", + "description": "Enum of possible native property sources (as a subtype of a particular AXValueSourceType).", + "type": "string", + "enum": [ + "figcaption", + "label", + "labelfor", + "labelwrapped", + "legend", + "tablecaption", + "title", + "other" + ] + }, + { + "id": "AXValueSource", + "description": "A single source for a computed AX property.", + "type": "object", + "properties": [ + { + "name": "type", + "description": "What type of source this is.", + "$ref": "AXValueSourceType" + }, + { + "name": "value", + "description": "The value of this property source.", + "optional": true, + "$ref": "AXValue" + }, + { + "name": "attribute", + "description": "The name of the relevant attribute, if any.", + "optional": true, + "type": "string" + }, + { + "name": "attributeValue", + "description": "The value of the relevant attribute, if any.", + "optional": true, + "$ref": "AXValue" + }, + { + "name": "superseded", + "description": "Whether this source is superseded by a higher priority source.", + "optional": true, + "type": "boolean" + }, + { + "name": "nativeSource", + "description": "The native markup source for this value, e.g. a