easytouch-linux 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.playwright/node/LICENSE +2607 -0
- package/.playwright/node/linux-x64/node +0 -0
- package/.playwright/package/README.md +3 -0
- package/.playwright/package/ThirdPartyNotices.txt +1602 -0
- package/.playwright/package/api.json +1 -0
- package/.playwright/package/bin/install_media_pack.ps1 +5 -0
- package/.playwright/package/bin/reinstall_chrome_beta_linux.sh +42 -0
- package/.playwright/package/bin/reinstall_chrome_beta_mac.sh +13 -0
- package/.playwright/package/bin/reinstall_chrome_beta_win.ps1 +24 -0
- package/.playwright/package/bin/reinstall_chrome_stable_linux.sh +42 -0
- package/.playwright/package/bin/reinstall_chrome_stable_mac.sh +12 -0
- package/.playwright/package/bin/reinstall_chrome_stable_win.ps1 +24 -0
- package/.playwright/package/bin/reinstall_msedge_beta_linux.sh +48 -0
- package/.playwright/package/bin/reinstall_msedge_beta_mac.sh +11 -0
- package/.playwright/package/bin/reinstall_msedge_beta_win.ps1 +23 -0
- package/.playwright/package/bin/reinstall_msedge_dev_linux.sh +48 -0
- package/.playwright/package/bin/reinstall_msedge_dev_mac.sh +11 -0
- package/.playwright/package/bin/reinstall_msedge_dev_win.ps1 +23 -0
- package/.playwright/package/bin/reinstall_msedge_stable_linux.sh +48 -0
- package/.playwright/package/bin/reinstall_msedge_stable_mac.sh +11 -0
- package/.playwright/package/bin/reinstall_msedge_stable_win.ps1 +24 -0
- package/.playwright/package/browsers.json +66 -0
- package/.playwright/package/cli.js +18 -0
- package/.playwright/package/index.d.ts +17 -0
- package/.playwright/package/index.js +33 -0
- package/.playwright/package/index.mjs +28 -0
- package/.playwright/package/lib/androidServerImpl.js +69 -0
- package/.playwright/package/lib/browserServerImpl.js +92 -0
- package/.playwright/package/lib/cli/driver.js +95 -0
- package/.playwright/package/lib/cli/program.js +583 -0
- package/.playwright/package/lib/cli/programWithTestStub.js +67 -0
- package/.playwright/package/lib/client/accessibility.js +50 -0
- package/.playwright/package/lib/client/android.js +473 -0
- package/.playwright/package/lib/client/api.js +285 -0
- package/.playwright/package/lib/client/artifact.js +79 -0
- package/.playwright/package/lib/client/browser.js +145 -0
- package/.playwright/package/lib/client/browserContext.js +559 -0
- package/.playwright/package/lib/client/browserType.js +241 -0
- package/.playwright/package/lib/client/cdpSession.js +53 -0
- package/.playwright/package/lib/client/channelOwner.js +215 -0
- package/.playwright/package/lib/client/clientHelper.js +57 -0
- package/.playwright/package/lib/client/clientInstrumentation.js +52 -0
- package/.playwright/package/lib/client/clock.js +68 -0
- package/.playwright/package/lib/client/connection.js +333 -0
- package/.playwright/package/lib/client/consoleMessage.js +55 -0
- package/.playwright/package/lib/client/coverage.js +41 -0
- package/.playwright/package/lib/client/dialog.js +57 -0
- package/.playwright/package/lib/client/download.js +62 -0
- package/.playwright/package/lib/client/electron.js +135 -0
- package/.playwright/package/lib/client/elementHandle.js +321 -0
- package/.playwright/package/lib/client/errors.js +77 -0
- package/.playwright/package/lib/client/eventEmitter.js +314 -0
- package/.playwright/package/lib/client/events.js +94 -0
- package/.playwright/package/lib/client/fetch.js +391 -0
- package/.playwright/package/lib/client/fileChooser.js +45 -0
- package/.playwright/package/lib/client/frame.js +504 -0
- package/.playwright/package/lib/client/harRouter.js +99 -0
- package/.playwright/package/lib/client/input.js +111 -0
- package/.playwright/package/lib/client/jsHandle.js +121 -0
- package/.playwright/package/lib/client/jsonPipe.js +35 -0
- package/.playwright/package/lib/client/localUtils.js +36 -0
- package/.playwright/package/lib/client/locator.js +448 -0
- package/.playwright/package/lib/client/network.js +769 -0
- package/.playwright/package/lib/client/page.js +748 -0
- package/.playwright/package/lib/client/playwright.js +80 -0
- package/.playwright/package/lib/client/selectors.js +67 -0
- package/.playwright/package/lib/client/stream.js +54 -0
- package/.playwright/package/lib/client/tracing.js +147 -0
- package/.playwright/package/lib/client/types.js +24 -0
- package/.playwright/package/lib/client/video.js +51 -0
- package/.playwright/package/lib/client/waiter.js +162 -0
- package/.playwright/package/lib/client/webError.js +37 -0
- package/.playwright/package/lib/client/worker.js +71 -0
- package/.playwright/package/lib/client/writableStream.js +54 -0
- package/.playwright/package/lib/common/socksProxy.js +569 -0
- package/.playwright/package/lib/common/timeoutSettings.js +73 -0
- package/.playwright/package/lib/common/types.js +5 -0
- package/.playwright/package/lib/generated/clockSource.js +7 -0
- package/.playwright/package/lib/generated/consoleApiSource.js +7 -0
- package/.playwright/package/lib/generated/injectedScriptSource.js +7 -0
- package/.playwright/package/lib/generated/pollingRecorderSource.js +7 -0
- package/.playwright/package/lib/generated/utilityScriptSource.js +7 -0
- package/.playwright/package/lib/generated/webSocketMockSource.js +7 -0
- package/.playwright/package/lib/image_tools/colorUtils.js +98 -0
- package/.playwright/package/lib/image_tools/compare.js +108 -0
- package/.playwright/package/lib/image_tools/imageChannel.js +70 -0
- package/.playwright/package/lib/image_tools/stats.js +102 -0
- package/.playwright/package/lib/inProcessFactory.js +56 -0
- package/.playwright/package/lib/inprocess.js +20 -0
- package/.playwright/package/lib/outofprocess.js +67 -0
- package/.playwright/package/lib/protocol/debug.js +27 -0
- package/.playwright/package/lib/protocol/serializers.js +173 -0
- package/.playwright/package/lib/protocol/transport.js +82 -0
- package/.playwright/package/lib/protocol/validator.js +2780 -0
- package/.playwright/package/lib/protocol/validatorPrimitives.js +139 -0
- package/.playwright/package/lib/remote/playwrightConnection.js +275 -0
- package/.playwright/package/lib/remote/playwrightServer.js +111 -0
- package/.playwright/package/lib/server/accessibility.js +62 -0
- package/.playwright/package/lib/server/android/android.js +441 -0
- package/.playwright/package/lib/server/android/backendAdb.js +172 -0
- package/.playwright/package/lib/server/artifact.js +104 -0
- package/.playwright/package/lib/server/bidi/bidiBrowser.js +314 -0
- package/.playwright/package/lib/server/bidi/bidiChromium.js +124 -0
- package/.playwright/package/lib/server/bidi/bidiConnection.js +204 -0
- package/.playwright/package/lib/server/bidi/bidiExecutionContext.js +175 -0
- package/.playwright/package/lib/server/bidi/bidiFirefox.js +104 -0
- package/.playwright/package/lib/server/bidi/bidiInput.js +160 -0
- package/.playwright/package/lib/server/bidi/bidiNetworkManager.js +337 -0
- package/.playwright/package/lib/server/bidi/bidiOverCdp.js +103 -0
- package/.playwright/package/lib/server/bidi/bidiPage.js +518 -0
- package/.playwright/package/lib/server/bidi/bidiPdf.js +140 -0
- package/.playwright/package/lib/server/bidi/third_party/bidiDeserializer.js +93 -0
- package/.playwright/package/lib/server/bidi/third_party/bidiKeyboard.js +240 -0
- package/.playwright/package/lib/server/bidi/third_party/bidiProtocol.js +139 -0
- package/.playwright/package/lib/server/bidi/third_party/bidiSerializer.js +144 -0
- package/.playwright/package/lib/server/bidi/third_party/firefoxPrefs.js +221 -0
- package/.playwright/package/lib/server/browser.js +148 -0
- package/.playwright/package/lib/server/browserContext.js +675 -0
- package/.playwright/package/lib/server/browserType.js +338 -0
- package/.playwright/package/lib/server/chromium/appIcon.png +0 -0
- package/.playwright/package/lib/server/chromium/chromium.js +354 -0
- package/.playwright/package/lib/server/chromium/chromiumSwitches.js +46 -0
- package/.playwright/package/lib/server/chromium/crAccessibility.js +237 -0
- package/.playwright/package/lib/server/chromium/crBrowser.js +516 -0
- package/.playwright/package/lib/server/chromium/crConnection.js +228 -0
- package/.playwright/package/lib/server/chromium/crCoverage.js +246 -0
- package/.playwright/package/lib/server/chromium/crDevTools.js +104 -0
- package/.playwright/package/lib/server/chromium/crDragDrop.js +143 -0
- package/.playwright/package/lib/server/chromium/crExecutionContext.js +132 -0
- package/.playwright/package/lib/server/chromium/crInput.js +182 -0
- package/.playwright/package/lib/server/chromium/crNetworkManager.js +767 -0
- package/.playwright/package/lib/server/chromium/crPage.js +1122 -0
- package/.playwright/package/lib/server/chromium/crPdf.js +153 -0
- package/.playwright/package/lib/server/chromium/crProtocolHelper.js +133 -0
- package/.playwright/package/lib/server/chromium/crServiceWorker.js +112 -0
- package/.playwright/package/lib/server/chromium/defaultFontFamilies.js +145 -0
- package/.playwright/package/lib/server/chromium/videoRecorder.js +155 -0
- package/.playwright/package/lib/server/clock.js +125 -0
- package/.playwright/package/lib/server/codegen/csharp.js +304 -0
- package/.playwright/package/lib/server/codegen/java.js +243 -0
- package/.playwright/package/lib/server/codegen/javascript.js +253 -0
- package/.playwright/package/lib/server/codegen/jsonl.js +47 -0
- package/.playwright/package/lib/server/codegen/language.js +88 -0
- package/.playwright/package/lib/server/codegen/languages.js +30 -0
- package/.playwright/package/lib/server/codegen/python.js +262 -0
- package/.playwright/package/lib/server/codegen/types.js +5 -0
- package/.playwright/package/lib/server/console.js +57 -0
- package/.playwright/package/lib/server/cookieStore.js +185 -0
- package/.playwright/package/lib/server/debugController.js +212 -0
- package/.playwright/package/lib/server/debugger.js +132 -0
- package/.playwright/package/lib/server/deviceDescriptors.js +26 -0
- package/.playwright/package/lib/server/deviceDescriptorsSource.json +1669 -0
- package/.playwright/package/lib/server/dialog.js +71 -0
- package/.playwright/package/lib/server/dispatchers/androidDispatcher.js +204 -0
- package/.playwright/package/lib/server/dispatchers/artifactDispatcher.js +118 -0
- package/.playwright/package/lib/server/dispatchers/browserContextDispatcher.js +357 -0
- package/.playwright/package/lib/server/dispatchers/browserDispatcher.js +170 -0
- package/.playwright/package/lib/server/dispatchers/browserTypeDispatcher.js +55 -0
- package/.playwright/package/lib/server/dispatchers/cdpSessionDispatcher.js +48 -0
- package/.playwright/package/lib/server/dispatchers/debugControllerDispatcher.js +105 -0
- package/.playwright/package/lib/server/dispatchers/dialogDispatcher.js +44 -0
- package/.playwright/package/lib/server/dispatchers/dispatcher.js +395 -0
- package/.playwright/package/lib/server/dispatchers/electronDispatcher.js +93 -0
- package/.playwright/package/lib/server/dispatchers/elementHandlerDispatcher.js +228 -0
- package/.playwright/package/lib/server/dispatchers/frameDispatcher.js +294 -0
- package/.playwright/package/lib/server/dispatchers/jsHandleDispatcher.js +97 -0
- package/.playwright/package/lib/server/dispatchers/jsonPipeDispatcher.js +59 -0
- package/.playwright/package/lib/server/dispatchers/localUtilsDispatcher.js +413 -0
- package/.playwright/package/lib/server/dispatchers/networkDispatchers.js +221 -0
- package/.playwright/package/lib/server/dispatchers/pageDispatcher.js +367 -0
- package/.playwright/package/lib/server/dispatchers/playwrightDispatcher.js +107 -0
- package/.playwright/package/lib/server/dispatchers/selectorsDispatcher.js +36 -0
- package/.playwright/package/lib/server/dispatchers/streamDispatcher.js +62 -0
- package/.playwright/package/lib/server/dispatchers/tracingDispatcher.js +64 -0
- package/.playwright/package/lib/server/dispatchers/webSocketRouteDispatcher.js +188 -0
- package/.playwright/package/lib/server/dispatchers/writableStreamDispatcher.js +58 -0
- package/.playwright/package/lib/server/dom.js +893 -0
- package/.playwright/package/lib/server/download.js +60 -0
- package/.playwright/package/lib/server/electron/electron.js +296 -0
- package/.playwright/package/lib/server/electron/loader.js +57 -0
- package/.playwright/package/lib/server/errors.js +68 -0
- package/.playwright/package/lib/server/fetch.js +663 -0
- package/.playwright/package/lib/server/fileChooser.js +42 -0
- package/.playwright/package/lib/server/fileUploadUtils.js +75 -0
- package/.playwright/package/lib/server/firefox/ffAccessibility.js +216 -0
- package/.playwright/package/lib/server/firefox/ffBrowser.js +462 -0
- package/.playwright/package/lib/server/firefox/ffConnection.js +168 -0
- package/.playwright/package/lib/server/firefox/ffExecutionContext.js +123 -0
- package/.playwright/package/lib/server/firefox/ffInput.js +161 -0
- package/.playwright/package/lib/server/firefox/ffNetworkManager.js +233 -0
- package/.playwright/package/lib/server/firefox/ffPage.js +544 -0
- package/.playwright/package/lib/server/firefox/firefox.js +99 -0
- package/.playwright/package/lib/server/formData.js +75 -0
- package/.playwright/package/lib/server/frameSelectors.js +171 -0
- package/.playwright/package/lib/server/frames.js +1663 -0
- package/.playwright/package/lib/server/har/harRecorder.js +139 -0
- package/.playwright/package/lib/server/har/harTracer.js +542 -0
- package/.playwright/package/lib/server/helper.js +103 -0
- package/.playwright/package/lib/server/index.js +108 -0
- package/.playwright/package/lib/server/input.js +309 -0
- package/.playwright/package/lib/server/instrumentation.js +70 -0
- package/.playwright/package/lib/server/isomorphic/utilityScriptSerializers.js +226 -0
- package/.playwright/package/lib/server/javascript.js +293 -0
- package/.playwright/package/lib/server/launchApp.js +91 -0
- package/.playwright/package/lib/server/macEditingCommands.js +139 -0
- package/.playwright/package/lib/server/network.js +617 -0
- package/.playwright/package/lib/server/page.js +863 -0
- package/.playwright/package/lib/server/pipeTransport.js +85 -0
- package/.playwright/package/lib/server/playwright.js +88 -0
- package/.playwright/package/lib/server/progress.js +99 -0
- package/.playwright/package/lib/server/protocolError.js +49 -0
- package/.playwright/package/lib/server/recorder/chat.js +177 -0
- package/.playwright/package/lib/server/recorder/contextRecorder.js +290 -0
- package/.playwright/package/lib/server/recorder/recorderApp.js +187 -0
- package/.playwright/package/lib/server/recorder/recorderCollection.js +104 -0
- package/.playwright/package/lib/server/recorder/recorderFrontend.js +5 -0
- package/.playwright/package/lib/server/recorder/recorderRunner.js +159 -0
- package/.playwright/package/lib/server/recorder/recorderUtils.js +89 -0
- package/.playwright/package/lib/server/recorder/throttledFile.js +46 -0
- package/.playwright/package/lib/server/recorder.js +367 -0
- package/.playwright/package/lib/server/registry/browserFetcher.js +168 -0
- package/.playwright/package/lib/server/registry/dependencies.js +322 -0
- package/.playwright/package/lib/server/registry/index.js +1165 -0
- package/.playwright/package/lib/server/registry/nativeDeps.js +496 -0
- package/.playwright/package/lib/server/registry/oopDownloadBrowserMain.js +138 -0
- package/.playwright/package/lib/server/screenshotter.js +348 -0
- package/.playwright/package/lib/server/selectors.js +73 -0
- package/.playwright/package/lib/server/socksClientCertificatesInterceptor.js +340 -0
- package/.playwright/package/lib/server/socksInterceptor.js +100 -0
- package/.playwright/package/lib/server/trace/recorder/snapshotter.js +161 -0
- package/.playwright/package/lib/server/trace/recorder/snapshotterInjected.js +518 -0
- package/.playwright/package/lib/server/trace/recorder/tracing.js +596 -0
- package/.playwright/package/lib/server/trace/test/inMemorySnapshotter.js +93 -0
- package/.playwright/package/lib/server/trace/viewer/traceViewer.js +219 -0
- package/.playwright/package/lib/server/transport.js +192 -0
- package/.playwright/package/lib/server/types.js +24 -0
- package/.playwright/package/lib/server/usKeyboardLayout.js +555 -0
- package/.playwright/package/lib/server/webkit/webkit.js +87 -0
- package/.playwright/package/lib/server/webkit/wkAccessibility.js +194 -0
- package/.playwright/package/lib/server/webkit/wkBrowser.js +329 -0
- package/.playwright/package/lib/server/webkit/wkConnection.js +173 -0
- package/.playwright/package/lib/server/webkit/wkExecutionContext.js +131 -0
- package/.playwright/package/lib/server/webkit/wkInput.js +179 -0
- package/.playwright/package/lib/server/webkit/wkInterceptableRequest.js +162 -0
- package/.playwright/package/lib/server/webkit/wkPage.js +1207 -0
- package/.playwright/package/lib/server/webkit/wkProvisionalPage.js +94 -0
- package/.playwright/package/lib/server/webkit/wkWorkers.js +104 -0
- package/.playwright/package/lib/third_party/pixelmatch.js +255 -0
- package/.playwright/package/lib/utils/ascii.js +31 -0
- package/.playwright/package/lib/utils/comparators.js +159 -0
- package/.playwright/package/lib/utils/crypto.js +171 -0
- package/.playwright/package/lib/utils/debug.js +46 -0
- package/.playwright/package/lib/utils/debugLogger.js +93 -0
- package/.playwright/package/lib/utils/env.js +49 -0
- package/.playwright/package/lib/utils/eventsHelper.js +38 -0
- package/.playwright/package/lib/utils/expectUtils.js +33 -0
- package/.playwright/package/lib/utils/fileUtils.js +205 -0
- package/.playwright/package/lib/utils/happy-eyeballs.js +194 -0
- package/.playwright/package/lib/utils/headers.js +52 -0
- package/.playwright/package/lib/utils/hostPlatform.js +145 -0
- package/.playwright/package/lib/utils/httpServer.js +233 -0
- package/.playwright/package/lib/utils/index.js +368 -0
- package/.playwright/package/lib/utils/isomorphic/ariaSnapshot.js +391 -0
- package/.playwright/package/lib/utils/isomorphic/cssParser.js +250 -0
- package/.playwright/package/lib/utils/isomorphic/cssTokenizer.js +979 -0
- package/.playwright/package/lib/utils/isomorphic/locatorGenerators.js +660 -0
- package/.playwright/package/lib/utils/isomorphic/locatorParser.js +185 -0
- package/.playwright/package/lib/utils/isomorphic/locatorUtils.js +62 -0
- package/.playwright/package/lib/utils/isomorphic/mimeType.js +29 -0
- package/.playwright/package/lib/utils/isomorphic/selectorParser.js +397 -0
- package/.playwright/package/lib/utils/isomorphic/stringUtils.js +169 -0
- package/.playwright/package/lib/utils/isomorphic/traceUtils.js +39 -0
- package/.playwright/package/lib/utils/isomorphic/urlMatch.js +122 -0
- package/.playwright/package/lib/utils/linuxUtils.js +78 -0
- package/.playwright/package/lib/utils/manualPromise.js +109 -0
- package/.playwright/package/lib/utils/multimap.js +75 -0
- package/.playwright/package/lib/utils/network.js +160 -0
- package/.playwright/package/lib/utils/processLauncher.js +248 -0
- package/.playwright/package/lib/utils/profiler.js +53 -0
- package/.playwright/package/lib/utils/rtti.js +44 -0
- package/.playwright/package/lib/utils/semaphore.js +51 -0
- package/.playwright/package/lib/utils/sequence.js +64 -0
- package/.playwright/package/lib/utils/spawnAsync.js +45 -0
- package/.playwright/package/lib/utils/stackTrace.js +134 -0
- package/.playwright/package/lib/utils/task.js +58 -0
- package/.playwright/package/lib/utils/time.js +37 -0
- package/.playwright/package/lib/utils/timeoutRunner.js +66 -0
- package/.playwright/package/lib/utils/traceUtils.js +44 -0
- package/.playwright/package/lib/utils/userAgent.js +105 -0
- package/.playwright/package/lib/utils/wsServer.js +128 -0
- package/.playwright/package/lib/utils/zipFile.js +75 -0
- package/.playwright/package/lib/utils/zones.js +69 -0
- package/.playwright/package/lib/utilsBundle.js +81 -0
- package/.playwright/package/lib/utilsBundleImpl/index.js +210 -0
- package/.playwright/package/lib/utilsBundleImpl/xdg-open +1066 -0
- package/.playwright/package/lib/vite/htmlReport/index.html +69 -0
- package/.playwright/package/lib/vite/recorder/assets/codeMirrorModule-C3UTv-Ge.css +1 -0
- package/.playwright/package/lib/vite/recorder/assets/codeMirrorModule-k-61wZCK.js +24 -0
- package/.playwright/package/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
- package/.playwright/package/lib/vite/recorder/assets/index-B70BEW3b.js +184 -0
- package/.playwright/package/lib/vite/recorder/assets/index-eHBmevrY.css +1 -0
- package/.playwright/package/lib/vite/recorder/index.html +29 -0
- package/.playwright/package/lib/vite/recorder/playwright-logo.svg +9 -0
- package/.playwright/package/lib/vite/traceViewer/assets/codeMirrorModule-CyuxU5C-.js +24 -0
- package/.playwright/package/lib/vite/traceViewer/assets/defaultSettingsView-5nVJRt0A.js +243 -0
- package/.playwright/package/lib/vite/traceViewer/assets/xtermModule-c-SNdYZy.js +9 -0
- package/.playwright/package/lib/vite/traceViewer/codeMirrorModule.C3UTv-Ge.css +1 -0
- package/.playwright/package/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
- package/.playwright/package/lib/vite/traceViewer/defaultSettingsView.2xeEXCXv.css +1 -0
- package/.playwright/package/lib/vite/traceViewer/index.CFOW-Ezb.css +1 -0
- package/.playwright/package/lib/vite/traceViewer/index.html +43 -0
- package/.playwright/package/lib/vite/traceViewer/index.qVn2ZnpC.js +2 -0
- package/.playwright/package/lib/vite/traceViewer/playwright-logo.svg +9 -0
- package/.playwright/package/lib/vite/traceViewer/snapshot.html +21 -0
- package/.playwright/package/lib/vite/traceViewer/sw.bundle.js +3 -0
- package/.playwright/package/lib/vite/traceViewer/uiMode.BatfzHMG.css +1 -0
- package/.playwright/package/lib/vite/traceViewer/uiMode.html +17 -0
- package/.playwright/package/lib/vite/traceViewer/uiMode.m4IPRPOd.js +5 -0
- package/.playwright/package/lib/vite/traceViewer/xtermModule.Beg8tuEN.css +32 -0
- package/.playwright/package/lib/zipBundle.js +25 -0
- package/.playwright/package/lib/zipBundleImpl.js +5 -0
- package/.playwright/package/package.json +44 -0
- package/.playwright/package/protocol.yml +3758 -0
- package/.playwright/package/types/protocol.d.ts +21868 -0
- package/.playwright/package/types/structs.d.ts +45 -0
- package/.playwright/package/types/types.d.ts +22663 -0
- package/README.md +6 -6
- package/et +0 -0
- package/package.json +7 -2
- package/playwright.ps1 +7 -0
- package/scripts/playwright-bridge.js +560 -0
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.frameSnapshotStreamer = frameSnapshotStreamer;
|
|
7
|
+
/**
|
|
8
|
+
* Copyright (c) Microsoft Corporation.
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
+
* you may not use this file except in compliance with the License.
|
|
12
|
+
* You may obtain a copy of the License at
|
|
13
|
+
*
|
|
14
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
* See the License for the specific language governing permissions and
|
|
20
|
+
* limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
function frameSnapshotStreamer(snapshotStreamer, removeNoScript) {
|
|
24
|
+
// Communication with Playwright.
|
|
25
|
+
if (window[snapshotStreamer]) return;
|
|
26
|
+
|
|
27
|
+
// Attributes present in the snapshot.
|
|
28
|
+
const kShadowAttribute = '__playwright_shadow_root_';
|
|
29
|
+
const kValueAttribute = '__playwright_value_';
|
|
30
|
+
const kCheckedAttribute = '__playwright_checked_';
|
|
31
|
+
const kSelectedAttribute = '__playwright_selected_';
|
|
32
|
+
const kScrollTopAttribute = '__playwright_scroll_top_';
|
|
33
|
+
const kScrollLeftAttribute = '__playwright_scroll_left_';
|
|
34
|
+
const kStyleSheetAttribute = '__playwright_style_sheet_';
|
|
35
|
+
const kTargetAttribute = '__playwright_target__';
|
|
36
|
+
const kCustomElementsAttribute = '__playwright_custom_elements__';
|
|
37
|
+
const kCurrentSrcAttribute = '__playwright_current_src__';
|
|
38
|
+
const kBoundingRectAttribute = '__playwright_bounding_rect__';
|
|
39
|
+
const kPopoverOpenAttribute = '__playwright_popover_open_';
|
|
40
|
+
|
|
41
|
+
// Symbols for our own info on Nodes/StyleSheets.
|
|
42
|
+
const kSnapshotFrameId = Symbol('__playwright_snapshot_frameid_');
|
|
43
|
+
const kCachedData = Symbol('__playwright_snapshot_cache_');
|
|
44
|
+
const kEndOfList = Symbol('__playwright_end_of_list_');
|
|
45
|
+
function resetCachedData(obj) {
|
|
46
|
+
delete obj[kCachedData];
|
|
47
|
+
}
|
|
48
|
+
function ensureCachedData(obj) {
|
|
49
|
+
if (!obj[kCachedData]) obj[kCachedData] = {};
|
|
50
|
+
return obj[kCachedData];
|
|
51
|
+
}
|
|
52
|
+
function removeHash(url) {
|
|
53
|
+
try {
|
|
54
|
+
const u = new URL(url);
|
|
55
|
+
u.hash = '';
|
|
56
|
+
return u.toString();
|
|
57
|
+
} catch (e) {
|
|
58
|
+
return url;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
class Streamer {
|
|
62
|
+
constructor() {
|
|
63
|
+
this._lastSnapshotNumber = 0;
|
|
64
|
+
this._staleStyleSheets = new Set();
|
|
65
|
+
this._readingStyleSheet = false;
|
|
66
|
+
// To avoid invalidating due to our own reads.
|
|
67
|
+
this._fakeBase = void 0;
|
|
68
|
+
this._observer = void 0;
|
|
69
|
+
const invalidateCSSGroupingRule = rule => {
|
|
70
|
+
if (rule.parentStyleSheet) this._invalidateStyleSheet(rule.parentStyleSheet);
|
|
71
|
+
};
|
|
72
|
+
this._interceptNativeMethod(window.CSSStyleSheet.prototype, 'insertRule', sheet => this._invalidateStyleSheet(sheet));
|
|
73
|
+
this._interceptNativeMethod(window.CSSStyleSheet.prototype, 'deleteRule', sheet => this._invalidateStyleSheet(sheet));
|
|
74
|
+
this._interceptNativeMethod(window.CSSStyleSheet.prototype, 'addRule', sheet => this._invalidateStyleSheet(sheet));
|
|
75
|
+
this._interceptNativeMethod(window.CSSStyleSheet.prototype, 'removeRule', sheet => this._invalidateStyleSheet(sheet));
|
|
76
|
+
this._interceptNativeGetter(window.CSSStyleSheet.prototype, 'rules', sheet => this._invalidateStyleSheet(sheet));
|
|
77
|
+
this._interceptNativeGetter(window.CSSStyleSheet.prototype, 'cssRules', sheet => this._invalidateStyleSheet(sheet));
|
|
78
|
+
this._interceptNativeMethod(window.CSSStyleSheet.prototype, 'replaceSync', sheet => this._invalidateStyleSheet(sheet));
|
|
79
|
+
this._interceptNativeMethod(window.CSSGroupingRule.prototype, 'insertRule', invalidateCSSGroupingRule);
|
|
80
|
+
this._interceptNativeMethod(window.CSSGroupingRule.prototype, 'deleteRule', invalidateCSSGroupingRule);
|
|
81
|
+
this._interceptNativeGetter(window.CSSGroupingRule.prototype, 'cssRules', invalidateCSSGroupingRule);
|
|
82
|
+
this._interceptNativeAsyncMethod(window.CSSStyleSheet.prototype, 'replace', sheet => this._invalidateStyleSheet(sheet));
|
|
83
|
+
this._fakeBase = document.createElement('base');
|
|
84
|
+
this._observer = new MutationObserver(list => this._handleMutations(list));
|
|
85
|
+
const observerConfig = {
|
|
86
|
+
attributes: true,
|
|
87
|
+
subtree: true
|
|
88
|
+
};
|
|
89
|
+
this._observer.observe(document, observerConfig);
|
|
90
|
+
this._refreshListenersWhenNeeded();
|
|
91
|
+
}
|
|
92
|
+
_refreshListenersWhenNeeded() {
|
|
93
|
+
this._refreshListeners();
|
|
94
|
+
const customEventName = '__playwright_snapshotter_global_listeners_check__';
|
|
95
|
+
let seenEvent = false;
|
|
96
|
+
const handleCustomEvent = () => seenEvent = true;
|
|
97
|
+
window.addEventListener(customEventName, handleCustomEvent);
|
|
98
|
+
const observer = new MutationObserver(entries => {
|
|
99
|
+
// Check for new documentElement in case we need to reinstall document listeners.
|
|
100
|
+
const newDocumentElement = entries.some(entry => Array.from(entry.addedNodes).includes(document.documentElement));
|
|
101
|
+
if (newDocumentElement) {
|
|
102
|
+
// New documentElement - let's check whether listeners are still here.
|
|
103
|
+
seenEvent = false;
|
|
104
|
+
window.dispatchEvent(new CustomEvent(customEventName));
|
|
105
|
+
if (!seenEvent) {
|
|
106
|
+
// Listener did not fire. Reattach the listener and notify.
|
|
107
|
+
window.addEventListener(customEventName, handleCustomEvent);
|
|
108
|
+
this._refreshListeners();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
observer.observe(document, {
|
|
113
|
+
childList: true
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
_refreshListeners() {
|
|
117
|
+
document.addEventListener('__playwright_mark_target__', event => {
|
|
118
|
+
if (!event.detail) return;
|
|
119
|
+
const callId = event.detail;
|
|
120
|
+
event.composedPath()[0].__playwright_target__ = callId;
|
|
121
|
+
});
|
|
122
|
+
document.addEventListener('__playwright_unmark_target__', event => {
|
|
123
|
+
if (!event.detail) return;
|
|
124
|
+
const callId = event.detail;
|
|
125
|
+
if (event.composedPath()[0].__playwright_target__ === callId) delete event.composedPath()[0].__playwright_target__;
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
_interceptNativeMethod(obj, method, cb) {
|
|
129
|
+
const native = obj[method];
|
|
130
|
+
if (!native) return;
|
|
131
|
+
obj[method] = function (...args) {
|
|
132
|
+
const result = native.call(this, ...args);
|
|
133
|
+
cb(this, result);
|
|
134
|
+
return result;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
_interceptNativeAsyncMethod(obj, method, cb) {
|
|
138
|
+
const native = obj[method];
|
|
139
|
+
if (!native) return;
|
|
140
|
+
obj[method] = async function (...args) {
|
|
141
|
+
const result = await native.call(this, ...args);
|
|
142
|
+
cb(this, result);
|
|
143
|
+
return result;
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
_interceptNativeGetter(obj, prop, cb) {
|
|
147
|
+
const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
|
148
|
+
Object.defineProperty(obj, prop, {
|
|
149
|
+
...descriptor,
|
|
150
|
+
get: function () {
|
|
151
|
+
const result = descriptor.get.call(this);
|
|
152
|
+
cb(this, result);
|
|
153
|
+
return result;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
_handleMutations(list) {
|
|
158
|
+
for (const mutation of list) ensureCachedData(mutation.target).attributesCached = undefined;
|
|
159
|
+
}
|
|
160
|
+
_invalidateStyleSheet(sheet) {
|
|
161
|
+
if (this._readingStyleSheet) return;
|
|
162
|
+
this._staleStyleSheets.add(sheet);
|
|
163
|
+
}
|
|
164
|
+
_updateStyleElementStyleSheetTextIfNeeded(sheet, forceText) {
|
|
165
|
+
const data = ensureCachedData(sheet);
|
|
166
|
+
if (this._staleStyleSheets.has(sheet) || forceText && data.cssText === undefined) {
|
|
167
|
+
this._staleStyleSheets.delete(sheet);
|
|
168
|
+
try {
|
|
169
|
+
data.cssText = this._getSheetText(sheet);
|
|
170
|
+
} catch (e) {
|
|
171
|
+
// Sometimes we cannot access cross-origin stylesheets.
|
|
172
|
+
data.cssText = '';
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return data.cssText;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Returns either content, ref, or no override.
|
|
179
|
+
_updateLinkStyleSheetTextIfNeeded(sheet, snapshotNumber) {
|
|
180
|
+
const data = ensureCachedData(sheet);
|
|
181
|
+
if (this._staleStyleSheets.has(sheet)) {
|
|
182
|
+
this._staleStyleSheets.delete(sheet);
|
|
183
|
+
try {
|
|
184
|
+
data.cssText = this._getSheetText(sheet);
|
|
185
|
+
data.cssRef = snapshotNumber;
|
|
186
|
+
return data.cssText;
|
|
187
|
+
} catch (e) {
|
|
188
|
+
// Sometimes we cannot access cross-origin stylesheets.
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return data.cssRef === undefined ? undefined : snapshotNumber - data.cssRef;
|
|
192
|
+
}
|
|
193
|
+
markIframe(iframeElement, frameId) {
|
|
194
|
+
iframeElement[kSnapshotFrameId] = frameId;
|
|
195
|
+
}
|
|
196
|
+
reset() {
|
|
197
|
+
this._staleStyleSheets.clear();
|
|
198
|
+
const visitNode = node => {
|
|
199
|
+
resetCachedData(node);
|
|
200
|
+
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
201
|
+
const element = node;
|
|
202
|
+
if (element.shadowRoot) visitNode(element.shadowRoot);
|
|
203
|
+
}
|
|
204
|
+
for (let child = node.firstChild; child; child = child.nextSibling) visitNode(child);
|
|
205
|
+
};
|
|
206
|
+
visitNode(document.documentElement);
|
|
207
|
+
visitNode(this._fakeBase);
|
|
208
|
+
}
|
|
209
|
+
__sanitizeMetaAttribute(name, value, httpEquiv) {
|
|
210
|
+
if (name === 'charset') return 'utf-8';
|
|
211
|
+
if (httpEquiv.toLowerCase() !== 'content-type' || name !== 'content') return value;
|
|
212
|
+
const [type, ...params] = value.split(';');
|
|
213
|
+
if (type !== 'text/html' || params.length <= 0) return value;
|
|
214
|
+
const charsetParamIdx = params.findIndex(param => param.trim().startsWith('charset='));
|
|
215
|
+
if (charsetParamIdx > -1) params[charsetParamIdx] = 'charset=utf-8';
|
|
216
|
+
return `${type}; ${params.join('; ')}`;
|
|
217
|
+
}
|
|
218
|
+
_sanitizeUrl(url) {
|
|
219
|
+
if (url.startsWith('javascript:') || url.startsWith('vbscript:')) return '';
|
|
220
|
+
return url;
|
|
221
|
+
}
|
|
222
|
+
_sanitizeSrcSet(srcset) {
|
|
223
|
+
return srcset.split(',').map(src => {
|
|
224
|
+
src = src.trim();
|
|
225
|
+
const spaceIndex = src.lastIndexOf(' ');
|
|
226
|
+
if (spaceIndex === -1) return this._sanitizeUrl(src);
|
|
227
|
+
return this._sanitizeUrl(src.substring(0, spaceIndex).trim()) + src.substring(spaceIndex);
|
|
228
|
+
}).join(', ');
|
|
229
|
+
}
|
|
230
|
+
_resolveUrl(base, url) {
|
|
231
|
+
if (url === '') return '';
|
|
232
|
+
try {
|
|
233
|
+
return new URL(url, base).href;
|
|
234
|
+
} catch (e) {
|
|
235
|
+
return url;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
_getSheetBase(sheet) {
|
|
239
|
+
let rootSheet = sheet;
|
|
240
|
+
while (rootSheet.parentStyleSheet) rootSheet = rootSheet.parentStyleSheet;
|
|
241
|
+
if (rootSheet.ownerNode) return rootSheet.ownerNode.baseURI;
|
|
242
|
+
return document.baseURI;
|
|
243
|
+
}
|
|
244
|
+
_getSheetText(sheet) {
|
|
245
|
+
this._readingStyleSheet = true;
|
|
246
|
+
try {
|
|
247
|
+
const rules = [];
|
|
248
|
+
for (const rule of sheet.cssRules) rules.push(rule.cssText);
|
|
249
|
+
return rules.join('\n');
|
|
250
|
+
} finally {
|
|
251
|
+
this._readingStyleSheet = false;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
captureSnapshot() {
|
|
255
|
+
const timestamp = performance.now();
|
|
256
|
+
const snapshotNumber = ++this._lastSnapshotNumber;
|
|
257
|
+
let nodeCounter = 0;
|
|
258
|
+
let shadowDomNesting = 0;
|
|
259
|
+
let headNesting = 0;
|
|
260
|
+
|
|
261
|
+
// Ensure we are up to date.
|
|
262
|
+
this._handleMutations(this._observer.takeRecords());
|
|
263
|
+
const definedCustomElements = new Set();
|
|
264
|
+
const visitNode = node => {
|
|
265
|
+
const nodeType = node.nodeType;
|
|
266
|
+
const nodeName = nodeType === Node.DOCUMENT_FRAGMENT_NODE ? 'template' : node.nodeName;
|
|
267
|
+
if (nodeType !== Node.ELEMENT_NODE && nodeType !== Node.DOCUMENT_FRAGMENT_NODE && nodeType !== Node.TEXT_NODE) return;
|
|
268
|
+
if (nodeName === 'SCRIPT') return;
|
|
269
|
+
// Don't preload resources.
|
|
270
|
+
if (nodeName === 'LINK' && nodeType === Node.ELEMENT_NODE) {
|
|
271
|
+
var _getAttribute;
|
|
272
|
+
const rel = (_getAttribute = node.getAttribute('rel')) === null || _getAttribute === void 0 ? void 0 : _getAttribute.toLowerCase();
|
|
273
|
+
if (rel === 'preload' || rel === 'prefetch') return;
|
|
274
|
+
}
|
|
275
|
+
if (removeNoScript && nodeName === 'NOSCRIPT') return;
|
|
276
|
+
if (nodeName === 'META' && node.httpEquiv.toLowerCase() === 'content-security-policy') return;
|
|
277
|
+
// Skip iframes which are inside document's head as they are not visible.
|
|
278
|
+
// See https://github.com/microsoft/playwright/issues/12005.
|
|
279
|
+
if ((nodeName === 'IFRAME' || nodeName === 'FRAME') && headNesting) return;
|
|
280
|
+
const data = ensureCachedData(node);
|
|
281
|
+
const values = [];
|
|
282
|
+
let equals = !!data.cached;
|
|
283
|
+
let extraNodes = 0;
|
|
284
|
+
const expectValue = value => {
|
|
285
|
+
equals = equals && data.cached[values.length] === value;
|
|
286
|
+
values.push(value);
|
|
287
|
+
};
|
|
288
|
+
const checkAndReturn = n => {
|
|
289
|
+
data.attributesCached = true;
|
|
290
|
+
if (equals) return {
|
|
291
|
+
equals: true,
|
|
292
|
+
n: [[snapshotNumber - data.ref[0], data.ref[1]]]
|
|
293
|
+
};
|
|
294
|
+
nodeCounter += extraNodes;
|
|
295
|
+
data.ref = [snapshotNumber, nodeCounter++];
|
|
296
|
+
data.cached = values;
|
|
297
|
+
return {
|
|
298
|
+
equals: false,
|
|
299
|
+
n
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
if (nodeType === Node.TEXT_NODE) {
|
|
303
|
+
const value = node.nodeValue || '';
|
|
304
|
+
expectValue(value);
|
|
305
|
+
return checkAndReturn(value);
|
|
306
|
+
}
|
|
307
|
+
if (nodeName === 'STYLE') {
|
|
308
|
+
const sheet = node.sheet;
|
|
309
|
+
let cssText;
|
|
310
|
+
if (sheet) cssText = this._updateStyleElementStyleSheetTextIfNeeded(sheet);
|
|
311
|
+
cssText = cssText || node.textContent || '';
|
|
312
|
+
expectValue(cssText);
|
|
313
|
+
// Compensate for the extra 'cssText' text node.
|
|
314
|
+
extraNodes++;
|
|
315
|
+
return checkAndReturn([nodeName, {}, cssText]);
|
|
316
|
+
}
|
|
317
|
+
const attrs = {};
|
|
318
|
+
const result = [nodeName, attrs];
|
|
319
|
+
const visitChild = child => {
|
|
320
|
+
const snapshot = visitNode(child);
|
|
321
|
+
if (snapshot) {
|
|
322
|
+
result.push(snapshot.n);
|
|
323
|
+
expectValue(child);
|
|
324
|
+
equals = equals && snapshot.equals;
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
const visitChildStyleSheet = child => {
|
|
328
|
+
const snapshot = visitStyleSheet(child);
|
|
329
|
+
if (snapshot) {
|
|
330
|
+
result.push(snapshot.n);
|
|
331
|
+
expectValue(child);
|
|
332
|
+
equals = equals && snapshot.equals;
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
if (nodeType === Node.DOCUMENT_FRAGMENT_NODE) attrs[kShadowAttribute] = 'open';
|
|
336
|
+
if (nodeType === Node.ELEMENT_NODE) {
|
|
337
|
+
var _window$customElement;
|
|
338
|
+
const element = node;
|
|
339
|
+
if (element.localName.includes('-') && (_window$customElement = window.customElements) !== null && _window$customElement !== void 0 && _window$customElement.get(element.localName)) definedCustomElements.add(element.localName);
|
|
340
|
+
if (nodeName === 'INPUT' || nodeName === 'TEXTAREA') {
|
|
341
|
+
const value = element.value;
|
|
342
|
+
expectValue(kValueAttribute);
|
|
343
|
+
expectValue(value);
|
|
344
|
+
attrs[kValueAttribute] = value;
|
|
345
|
+
}
|
|
346
|
+
if (nodeName === 'INPUT' && ['checkbox', 'radio'].includes(element.type)) {
|
|
347
|
+
const value = element.checked ? 'true' : 'false';
|
|
348
|
+
expectValue(kCheckedAttribute);
|
|
349
|
+
expectValue(value);
|
|
350
|
+
attrs[kCheckedAttribute] = value;
|
|
351
|
+
}
|
|
352
|
+
if (nodeName === 'OPTION') {
|
|
353
|
+
const value = element.selected ? 'true' : 'false';
|
|
354
|
+
expectValue(kSelectedAttribute);
|
|
355
|
+
expectValue(value);
|
|
356
|
+
attrs[kSelectedAttribute] = value;
|
|
357
|
+
}
|
|
358
|
+
if (nodeName === 'CANVAS' || nodeName === 'IFRAME' || nodeName === 'FRAME') {
|
|
359
|
+
const boundingRect = element.getBoundingClientRect();
|
|
360
|
+
const value = JSON.stringify({
|
|
361
|
+
left: boundingRect.left,
|
|
362
|
+
top: boundingRect.top,
|
|
363
|
+
right: boundingRect.right,
|
|
364
|
+
bottom: boundingRect.bottom
|
|
365
|
+
});
|
|
366
|
+
expectValue(kBoundingRectAttribute);
|
|
367
|
+
expectValue(value);
|
|
368
|
+
attrs[kBoundingRectAttribute] = value;
|
|
369
|
+
}
|
|
370
|
+
if (element.popover && element.matches && element.matches(':popover-open')) {
|
|
371
|
+
const value = 'true';
|
|
372
|
+
expectValue(kPopoverOpenAttribute);
|
|
373
|
+
expectValue(value);
|
|
374
|
+
attrs[kPopoverOpenAttribute] = value;
|
|
375
|
+
}
|
|
376
|
+
if (element.scrollTop) {
|
|
377
|
+
expectValue(kScrollTopAttribute);
|
|
378
|
+
expectValue(element.scrollTop);
|
|
379
|
+
attrs[kScrollTopAttribute] = '' + element.scrollTop;
|
|
380
|
+
}
|
|
381
|
+
if (element.scrollLeft) {
|
|
382
|
+
expectValue(kScrollLeftAttribute);
|
|
383
|
+
expectValue(element.scrollLeft);
|
|
384
|
+
attrs[kScrollLeftAttribute] = '' + element.scrollLeft;
|
|
385
|
+
}
|
|
386
|
+
if (element.shadowRoot) {
|
|
387
|
+
++shadowDomNesting;
|
|
388
|
+
visitChild(element.shadowRoot);
|
|
389
|
+
--shadowDomNesting;
|
|
390
|
+
}
|
|
391
|
+
if ('__playwright_target__' in element) {
|
|
392
|
+
expectValue(kTargetAttribute);
|
|
393
|
+
expectValue(element['__playwright_target__']);
|
|
394
|
+
attrs[kTargetAttribute] = element['__playwright_target__'];
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
if (nodeName === 'HEAD') {
|
|
398
|
+
++headNesting;
|
|
399
|
+
// Insert fake <base> first, to ensure all <link> elements use the proper base uri.
|
|
400
|
+
this._fakeBase.setAttribute('href', document.baseURI);
|
|
401
|
+
visitChild(this._fakeBase);
|
|
402
|
+
}
|
|
403
|
+
for (let child = node.firstChild; child; child = child.nextSibling) visitChild(child);
|
|
404
|
+
if (nodeName === 'HEAD') --headNesting;
|
|
405
|
+
expectValue(kEndOfList);
|
|
406
|
+
let documentOrShadowRoot = null;
|
|
407
|
+
if (node.ownerDocument.documentElement === node) documentOrShadowRoot = node.ownerDocument;else if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) documentOrShadowRoot = node;
|
|
408
|
+
if (documentOrShadowRoot) {
|
|
409
|
+
for (const sheet of documentOrShadowRoot.adoptedStyleSheets || []) visitChildStyleSheet(sheet);
|
|
410
|
+
expectValue(kEndOfList);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// Process iframe src attribute before bailing out since it depends on a symbol, not the DOM.
|
|
414
|
+
if (nodeName === 'IFRAME' || nodeName === 'FRAME') {
|
|
415
|
+
const element = node;
|
|
416
|
+
const frameId = element[kSnapshotFrameId];
|
|
417
|
+
const name = 'src';
|
|
418
|
+
const value = frameId ? `/snapshot/${frameId}` : '';
|
|
419
|
+
expectValue(name);
|
|
420
|
+
expectValue(value);
|
|
421
|
+
attrs[name] = value;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// Process custom elements before bailing out since they depend on JS, not the DOM.
|
|
425
|
+
if (nodeName === 'BODY' && definedCustomElements.size) {
|
|
426
|
+
const value = [...definedCustomElements].join(',');
|
|
427
|
+
expectValue(kCustomElementsAttribute);
|
|
428
|
+
expectValue(value);
|
|
429
|
+
attrs[kCustomElementsAttribute] = value;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
// Process currentSrc before bailing out since it depends on JS, not the DOM.
|
|
433
|
+
if (nodeName === 'IMG' || nodeName === 'PICTURE') {
|
|
434
|
+
const value = nodeName === 'PICTURE' ? '' : this._sanitizeUrl(node.currentSrc);
|
|
435
|
+
expectValue(kCurrentSrcAttribute);
|
|
436
|
+
expectValue(value);
|
|
437
|
+
attrs[kCurrentSrcAttribute] = value;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// We can skip attributes comparison because nothing else has changed,
|
|
441
|
+
// and mutation observer didn't tell us about the attributes.
|
|
442
|
+
if (equals && data.attributesCached && !shadowDomNesting) return checkAndReturn(result);
|
|
443
|
+
if (nodeType === Node.ELEMENT_NODE) {
|
|
444
|
+
const element = node;
|
|
445
|
+
for (let i = 0; i < element.attributes.length; i++) {
|
|
446
|
+
const name = element.attributes[i].name;
|
|
447
|
+
if (nodeName === 'LINK' && name === 'integrity') continue;
|
|
448
|
+
if (nodeName === 'IFRAME' && (name === 'src' || name === 'srcdoc' || name === 'sandbox')) continue;
|
|
449
|
+
if (nodeName === 'FRAME' && name === 'src') continue;
|
|
450
|
+
let value = element.attributes[i].value;
|
|
451
|
+
if (nodeName === 'META') value = this.__sanitizeMetaAttribute(name, value, node.httpEquiv);else if (name === 'src' && nodeName === 'IMG') value = this._sanitizeUrl(value);else if (name === 'srcset' && nodeName === 'IMG') value = this._sanitizeSrcSet(value);else if (name === 'srcset' && nodeName === 'SOURCE') value = this._sanitizeSrcSet(value);else if (name === 'href' && nodeName === 'LINK') value = this._sanitizeUrl(value);else if (name.startsWith('on')) value = '';
|
|
452
|
+
expectValue(name);
|
|
453
|
+
expectValue(value);
|
|
454
|
+
attrs[name] = value;
|
|
455
|
+
}
|
|
456
|
+
expectValue(kEndOfList);
|
|
457
|
+
}
|
|
458
|
+
if (result.length === 2 && !Object.keys(attrs).length) result.pop(); // Remove empty attrs when there are no children.
|
|
459
|
+
return checkAndReturn(result);
|
|
460
|
+
};
|
|
461
|
+
const visitStyleSheet = sheet => {
|
|
462
|
+
const data = ensureCachedData(sheet);
|
|
463
|
+
const oldCSSText = data.cssText;
|
|
464
|
+
const cssText = this._updateStyleElementStyleSheetTextIfNeeded(sheet, true /* forceText */);
|
|
465
|
+
if (cssText === oldCSSText) return {
|
|
466
|
+
equals: true,
|
|
467
|
+
n: [[snapshotNumber - data.ref[0], data.ref[1]]]
|
|
468
|
+
};
|
|
469
|
+
data.ref = [snapshotNumber, nodeCounter++];
|
|
470
|
+
return {
|
|
471
|
+
equals: false,
|
|
472
|
+
n: ['template', {
|
|
473
|
+
[kStyleSheetAttribute]: cssText
|
|
474
|
+
}]
|
|
475
|
+
};
|
|
476
|
+
};
|
|
477
|
+
let html;
|
|
478
|
+
if (document.documentElement) {
|
|
479
|
+
const {
|
|
480
|
+
n
|
|
481
|
+
} = visitNode(document.documentElement);
|
|
482
|
+
html = n;
|
|
483
|
+
} else {
|
|
484
|
+
html = ['html'];
|
|
485
|
+
}
|
|
486
|
+
const result = {
|
|
487
|
+
html,
|
|
488
|
+
doctype: document.doctype ? document.doctype.name : undefined,
|
|
489
|
+
resourceOverrides: [],
|
|
490
|
+
viewport: {
|
|
491
|
+
width: window.innerWidth,
|
|
492
|
+
height: window.innerHeight
|
|
493
|
+
},
|
|
494
|
+
url: location.href,
|
|
495
|
+
wallTime: Date.now(),
|
|
496
|
+
collectionTime: 0
|
|
497
|
+
};
|
|
498
|
+
for (const sheet of this._staleStyleSheets) {
|
|
499
|
+
if (sheet.href === null) continue;
|
|
500
|
+
const content = this._updateLinkStyleSheetTextIfNeeded(sheet, snapshotNumber);
|
|
501
|
+
if (content === undefined) {
|
|
502
|
+
// Unable to capture stylesheet contents.
|
|
503
|
+
continue;
|
|
504
|
+
}
|
|
505
|
+
const base = this._getSheetBase(sheet);
|
|
506
|
+
const url = removeHash(this._resolveUrl(base, sheet.href));
|
|
507
|
+
result.resourceOverrides.push({
|
|
508
|
+
url,
|
|
509
|
+
content,
|
|
510
|
+
contentType: 'text/css'
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
result.collectionTime = performance.now() - timestamp;
|
|
514
|
+
return result;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
window[snapshotStreamer] = new Streamer();
|
|
518
|
+
}
|