rebrowser-playwright-core 1.48.2 → 1.49.1

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.
Files changed (112) hide show
  1. package/README.md +2 -2
  2. package/ThirdPartyNotices.txt +70 -384
  3. package/bin/reinstall_chrome_beta_linux.sh +10 -8
  4. package/bin/reinstall_chrome_stable_linux.sh +10 -8
  5. package/bin/reinstall_msedge_beta_linux.sh +11 -9
  6. package/bin/reinstall_msedge_dev_linux.sh +11 -9
  7. package/bin/reinstall_msedge_stable_linux.sh +11 -9
  8. package/browsers.json +19 -11
  9. package/lib/cli/program.js +23 -5
  10. package/lib/client/channelOwner.js +2 -2
  11. package/lib/client/locator.js +7 -0
  12. package/lib/client/network.js +5 -0
  13. package/lib/client/page.js +4 -2
  14. package/lib/client/tracing.js +13 -0
  15. package/lib/client/waiter.js +15 -11
  16. package/lib/generated/consoleApiSource.js +1 -1
  17. package/lib/generated/injectedScriptSource.js +1 -1
  18. package/lib/generated/pollingRecorderSource.js +1 -1
  19. package/lib/generated/webSocketMockSource.js +1 -1
  20. package/lib/protocol/validator.js +23 -3
  21. package/lib/server/ariaSnapshot.js +33 -0
  22. package/lib/server/bidi/bidiChromium.js +1 -1
  23. package/lib/server/bidi/bidiConnection.js +0 -2
  24. package/lib/server/bidi/bidiExecutionContext.js +0 -3
  25. package/lib/server/browserType.js +4 -1
  26. package/lib/server/chromium/chromium.js +6 -2
  27. package/lib/server/chromium/crConnection.js +153 -0
  28. package/lib/server/chromium/crExecutionContext.js +0 -13
  29. package/lib/server/chromium/crPage.js +8 -10
  30. package/lib/server/codegen/csharp.js +11 -16
  31. package/lib/server/codegen/java.js +4 -7
  32. package/lib/server/codegen/javascript.js +28 -6
  33. package/lib/server/codegen/python.js +12 -16
  34. package/lib/server/debugController.js +8 -5
  35. package/lib/server/deviceDescriptorsSource.json +127 -127
  36. package/lib/server/dispatchers/androidDispatcher.js +13 -2
  37. package/lib/server/dispatchers/debugControllerDispatcher.js +1 -1
  38. package/lib/server/dispatchers/dispatcher.js +1 -1
  39. package/lib/server/dispatchers/frameDispatcher.js +8 -1
  40. package/lib/server/dispatchers/tracingDispatcher.js +10 -0
  41. package/lib/server/dom.js +79 -36
  42. package/lib/server/fetch.js +30 -17
  43. package/lib/server/firefox/ffExecutionContext.js +0 -12
  44. package/lib/server/firefox/ffNetworkManager.js +1 -1
  45. package/lib/server/frames.js +66 -196
  46. package/lib/server/index.js +0 -6
  47. package/lib/server/javascript.js +0 -6
  48. package/lib/server/launchApp.js +5 -5
  49. package/lib/server/page.js +52 -8
  50. package/lib/server/progress.js +0 -3
  51. package/lib/server/recorder/recorderApp.js +6 -15
  52. package/lib/server/recorder/recorderCollection.js +1 -1
  53. package/lib/server/recorder/recorderInTraceViewer.js +3 -3
  54. package/lib/server/recorder/recorderUtils.js +2 -1
  55. package/lib/server/recorder.js +66 -31
  56. package/lib/server/registry/index.js +70 -23
  57. package/lib/server/registry/nativeDeps.js +6 -3
  58. package/lib/server/socksClientCertificatesInterceptor.js +1 -1
  59. package/lib/server/trace/recorder/snapshotter.js +1 -12
  60. package/lib/server/trace/recorder/snapshotterInjected.js +19 -1
  61. package/lib/server/trace/recorder/tracing.js +69 -15
  62. package/lib/server/trace/test/inMemorySnapshotter.js +3 -3
  63. package/lib/server/trace/viewer/traceViewer.js +2 -1
  64. package/lib/server/webkit/wkBrowser.js +2 -2
  65. package/lib/server/webkit/wkExecutionContext.js +0 -13
  66. package/lib/server/webkit/wkPage.js +6 -0
  67. package/lib/utils/comparators.js +12 -30
  68. package/lib/utils/crypto.js +1 -4
  69. package/lib/utils/hostPlatform.js +6 -0
  70. package/lib/utils/isomorphic/ariaSnapshot.js +267 -0
  71. package/lib/utils/isomorphic/locatorGenerators.js +23 -5
  72. package/lib/utils/isomorphic/recorderUtils.js +36 -4
  73. package/lib/utils/isomorphic/stringUtils.js +30 -0
  74. package/lib/utils/isomorphic/urlMatch.js +5 -1
  75. package/lib/utils/network.js +1 -1
  76. package/lib/utils/sequence.js +64 -0
  77. package/lib/utils/stackTrace.js +16 -3
  78. package/lib/utils/zones.js +32 -23
  79. package/lib/utilsBundle.js +4 -5
  80. package/lib/utilsBundleImpl/index.js +190 -33
  81. package/lib/vite/htmlReport/index.html +19 -16
  82. package/lib/vite/recorder/assets/codeMirrorModule-C5j27SYZ.js +24 -0
  83. package/lib/vite/recorder/assets/{index-BW-aOBcL.css → index-iA1aAGZg.css} +1 -1
  84. package/lib/vite/recorder/assets/index-m0XdVJHe.js +184 -0
  85. package/lib/vite/recorder/index.html +2 -2
  86. package/lib/vite/traceViewer/assets/codeMirrorModule-BBCX0spr.js +24 -0
  87. package/lib/vite/traceViewer/assets/inspectorTab-B4Iw34Ow.js +68 -0
  88. package/lib/vite/traceViewer/assets/workbench-DFlGYqou.js +9 -0
  89. package/lib/vite/traceViewer/{embedded.BlHoW5LY.js → embedded.CmarehFk.js} +1 -1
  90. package/lib/vite/traceViewer/embedded.html +5 -5
  91. package/lib/vite/traceViewer/{index.DaWVfou1.js → index.FBucu_gE.js} +1 -1
  92. package/lib/vite/traceViewer/index.html +24 -7
  93. package/lib/vite/traceViewer/{inspectorTab.DLjBDrQR.css → inspectorTab.DEOUW62d.css} +1 -1
  94. package/lib/vite/traceViewer/recorder.CW_rzcEp.js +2 -0
  95. package/lib/vite/traceViewer/recorder.html +3 -3
  96. package/lib/vite/traceViewer/sw.bundle.js +3 -3
  97. package/lib/vite/traceViewer/uiMode.CDUVjusr.js +5 -0
  98. package/lib/vite/traceViewer/uiMode.html +6 -6
  99. package/lib/vite/traceViewer/{uiMode.CAYqod-m.css → uiMode.voC1ZiOQ.css} +1 -1
  100. package/lib/vite/traceViewer/workbench.C-zR9ysA.css +1 -0
  101. package/package.json +1 -1
  102. package/types/protocol.d.ts +58 -10
  103. package/types/types.d.ts +134 -29
  104. package/lib/third_party/diff_match_patch.js +0 -2222
  105. package/lib/vite/recorder/assets/codeMirrorModule-baozm8ur.js +0 -24
  106. package/lib/vite/recorder/assets/index-2ElAIWFB.js +0 -42
  107. package/lib/vite/traceViewer/assets/codeMirrorModule-Bh1rfd2w.js +0 -24
  108. package/lib/vite/traceViewer/assets/inspectorTab-7GHnKvSD.js +0 -64
  109. package/lib/vite/traceViewer/assets/workbench-DPQnTHYP.js +0 -9
  110. package/lib/vite/traceViewer/recorder.C4zxcvd2.js +0 -2
  111. package/lib/vite/traceViewer/uiMode.mTXWniJb.js +0 -5
  112. package/lib/vite/traceViewer/workbench.D3JVcA9K.css +0 -1
@@ -129,8 +129,9 @@ const deps = exports.deps = {
129
129
  tools: ['xvfb', 'fonts-noto-color-emoji', 'fonts-unifont', 'libfontconfig1', 'libfreetype6', 'xfonts-cyrillic', 'xfonts-scalable', 'fonts-liberation', 'fonts-ipafont-gothic', 'fonts-wqy-zenhei', 'fonts-tlwg-loma-otf', 'fonts-freefont-ttf'],
130
130
  chromium: ['libasound2', 'libatk-bridge2.0-0', 'libatk1.0-0', 'libatspi2.0-0', 'libcairo2', 'libcups2', 'libdbus-1-3', 'libdrm2', 'libgbm1', 'libglib2.0-0', 'libnspr4', 'libnss3', 'libpango-1.0-0', 'libwayland-client0', 'libx11-6', 'libxcb1', 'libxcomposite1', 'libxdamage1', 'libxext6', 'libxfixes3', 'libxkbcommon0', 'libxrandr2'],
131
131
  firefox: ['ffmpeg', 'libasound2', 'libatk1.0-0', 'libcairo-gobject2', 'libcairo2', 'libdbus-1-3', 'libdbus-glib-1-2', 'libfontconfig1', 'libfreetype6', 'libgdk-pixbuf-2.0-0', 'libglib2.0-0', 'libgtk-3-0', 'libpango-1.0-0', 'libpangocairo-1.0-0', 'libx11-6', 'libx11-xcb1', 'libxcb-shm0', 'libxcb1', 'libxcomposite1', 'libxcursor1', 'libxdamage1', 'libxext6', 'libxfixes3', 'libxi6', 'libxrandr2', 'libxrender1', 'libxtst6'],
132
- webkit: ['libsoup-3.0-0', 'libenchant-2-2', 'gstreamer1.0-libav', 'gstreamer1.0-plugins-bad', 'gstreamer1.0-plugins-base', 'gstreamer1.0-plugins-good', 'libicu70', 'libatk-bridge2.0-0', 'libatk1.0-0', 'libcairo2', 'libdbus-1-3', 'libdrm2', 'libegl1', 'libepoxy0', 'libevdev2', 'libffi7', 'libfontconfig1', 'libfreetype6', 'libgbm1', 'libgdk-pixbuf-2.0-0', 'libgles2', 'libglib2.0-0', 'libglx0', 'libgstreamer-gl1.0-0', 'libgstreamer-plugins-base1.0-0', 'libgstreamer1.0-0', 'libgtk-3-0', 'libgudev-1.0-0', 'libharfbuzz-icu0', 'libharfbuzz0b', 'libhyphen0', 'libjpeg-turbo8', 'liblcms2-2', 'libmanette-0.2-0', 'libnotify4', 'libopengl0', 'libopenjp2-7', 'libopus0', 'libpango-1.0-0', 'libpng16-16', 'libproxy1v5', 'libsecret-1-0', 'libwayland-client0', 'libwayland-egl1', 'libwayland-server0', 'libwebpdemux2', 'libwoff1', 'libx11-6', 'libxcomposite1', 'libxdamage1', 'libxkbcommon0', 'libxml2', 'libxslt1.1', 'libx264-163', 'libatomic1', 'libevent-2.1-7'],
132
+ webkit: ['libsoup-3.0-0', 'libenchant-2-2', 'gstreamer1.0-libav', 'gstreamer1.0-plugins-bad', 'gstreamer1.0-plugins-base', 'gstreamer1.0-plugins-good', 'libicu70', 'libatk-bridge2.0-0', 'libatk1.0-0', 'libcairo2', 'libdbus-1-3', 'libdrm2', 'libegl1', 'libepoxy0', 'libevdev2', 'libffi7', 'libfontconfig1', 'libfreetype6', 'libgbm1', 'libgdk-pixbuf-2.0-0', 'libgles2', 'libglib2.0-0', 'libglx0', 'libgstreamer-gl1.0-0', 'libgstreamer-plugins-base1.0-0', 'libgstreamer1.0-0', 'libgtk-3-0', 'libgudev-1.0-0', 'libharfbuzz-icu0', 'libharfbuzz0b', 'libhyphen0', 'libjpeg-turbo8', 'liblcms2-2', 'libmanette-0.2-0', 'libnotify4', 'libopengl0', 'libopenjp2-7', 'libopus0', 'libpango-1.0-0', 'libpng16-16', 'libproxy1v5', 'libsecret-1-0', 'libwayland-client0', 'libwayland-egl1', 'libwayland-server0', 'libwebpdemux2', 'libwoff1', 'libx11-6', 'libxcomposite1', 'libxdamage1', 'libxkbcommon0', 'libxml2', 'libxslt1.1', 'libx264-163', 'libatomic1', 'libevent-2.1-7', 'libavif13'],
133
133
  lib2package: {
134
+ 'libavif.so.13': 'libavif13',
134
135
  'libsoup-3.0.so.0': 'libsoup-3.0-0',
135
136
  'libasound.so.2': 'libasound2',
136
137
  'libatk-1.0.so.0': 'libatk1.0-0',
@@ -224,8 +225,9 @@ const deps = exports.deps = {
224
225
  tools: ['xvfb', 'fonts-noto-color-emoji', 'fonts-unifont', 'libfontconfig1', 'libfreetype6', 'xfonts-cyrillic', 'xfonts-scalable', 'fonts-liberation', 'fonts-ipafont-gothic', 'fonts-wqy-zenhei', 'fonts-tlwg-loma-otf', 'fonts-freefont-ttf'],
225
226
  chromium: ['libasound2t64', 'libatk-bridge2.0-0t64', 'libatk1.0-0t64', 'libatspi2.0-0t64', 'libcairo2', 'libcups2t64', 'libdbus-1-3', 'libdrm2', 'libgbm1', 'libglib2.0-0t64', 'libnspr4', 'libnss3', 'libpango-1.0-0', 'libx11-6', 'libxcb1', 'libxcomposite1', 'libxdamage1', 'libxext6', 'libxfixes3', 'libxkbcommon0', 'libxrandr2'],
226
227
  firefox: ['libasound2t64', 'libatk1.0-0t64', 'libcairo-gobject2', 'libcairo2', 'libdbus-1-3', 'libfontconfig1', 'libfreetype6', 'libgdk-pixbuf-2.0-0', 'libglib2.0-0t64', 'libgtk-3-0t64', 'libpango-1.0-0', 'libpangocairo-1.0-0', 'libx11-6', 'libx11-xcb1', 'libxcb-shm0', 'libxcb1', 'libxcomposite1', 'libxcursor1', 'libxdamage1', 'libxext6', 'libxfixes3', 'libxi6', 'libxrandr2', 'libxrender1'],
227
- webkit: ['gstreamer1.0-libav', 'gstreamer1.0-plugins-bad', 'gstreamer1.0-plugins-base', 'gstreamer1.0-plugins-good', 'libicu74', 'libatomic1', 'libatk-bridge2.0-0t64', 'libatk1.0-0t64', 'libcairo-gobject2', 'libcairo2', 'libdbus-1-3', 'libdrm2', 'libenchant-2-2', 'libepoxy0', 'libevent-2.1-7t64', 'libflite1', 'libfontconfig1', 'libfreetype6', 'libgbm1', 'libgdk-pixbuf-2.0-0', 'libgles2', 'libglib2.0-0t64', 'libgstreamer-gl1.0-0', 'libgstreamer-plugins-bad1.0-0', 'libgstreamer-plugins-base1.0-0', 'libgstreamer1.0-0', 'libgtk-3-0t64', 'libharfbuzz-icu0', 'libharfbuzz0b', 'libhyphen0', 'libicu74', 'libjpeg-turbo8', 'liblcms2-2', 'libmanette-0.2-0', 'libopus0', 'libpango-1.0-0', 'libpangocairo-1.0-0', 'libpng16-16t64', 'libsecret-1-0', 'libvpx9', 'libwayland-client0', 'libwayland-egl1', 'libwayland-server0', 'libwebp7', 'libwebpdemux2', 'libwoff1', 'libx11-6', 'libxkbcommon0', 'libxml2', 'libxslt1.1', 'libx264-164'],
228
+ webkit: ['gstreamer1.0-libav', 'gstreamer1.0-plugins-bad', 'gstreamer1.0-plugins-base', 'gstreamer1.0-plugins-good', 'libicu74', 'libatomic1', 'libatk-bridge2.0-0t64', 'libatk1.0-0t64', 'libcairo-gobject2', 'libcairo2', 'libdbus-1-3', 'libdrm2', 'libenchant-2-2', 'libepoxy0', 'libevent-2.1-7t64', 'libflite1', 'libfontconfig1', 'libfreetype6', 'libgbm1', 'libgdk-pixbuf-2.0-0', 'libgles2', 'libglib2.0-0t64', 'libgstreamer-gl1.0-0', 'libgstreamer-plugins-bad1.0-0', 'libgstreamer-plugins-base1.0-0', 'libgstreamer1.0-0', 'libgtk-3-0t64', 'libharfbuzz-icu0', 'libharfbuzz0b', 'libhyphen0', 'libicu74', 'libjpeg-turbo8', 'liblcms2-2', 'libmanette-0.2-0', 'libopus0', 'libpango-1.0-0', 'libpangocairo-1.0-0', 'libpng16-16t64', 'libsecret-1-0', 'libvpx9', 'libwayland-client0', 'libwayland-egl1', 'libwayland-server0', 'libwebp7', 'libwebpdemux2', 'libwoff1', 'libx11-6', 'libxkbcommon0', 'libxml2', 'libxslt1.1', 'libx264-164', 'libavif16'],
228
229
  lib2package: {
230
+ 'libavif.so.16': 'libavif16',
229
231
  'libasound.so.2': 'libasound2t64',
230
232
  'libatk-1.0.so.0': 'libatk1.0-0t64',
231
233
  'libatk-bridge-2.0.so.0': 'libatk-bridge2.0-0t64',
@@ -412,8 +414,9 @@ const deps = exports.deps = {
412
414
  tools: ['xvfb', 'fonts-noto-color-emoji', 'fonts-unifont', 'libfontconfig1', 'libfreetype6', 'xfonts-scalable', 'fonts-liberation', 'fonts-ipafont-gothic', 'fonts-wqy-zenhei', 'fonts-tlwg-loma-otf', 'fonts-freefont-ttf'],
413
415
  chromium: ['libasound2', 'libatk-bridge2.0-0', 'libatk1.0-0', 'libatspi2.0-0', 'libcairo2', 'libcups2', 'libdbus-1-3', 'libdrm2', 'libgbm1', 'libglib2.0-0', 'libnspr4', 'libnss3', 'libpango-1.0-0', 'libx11-6', 'libxcb1', 'libxcomposite1', 'libxdamage1', 'libxext6', 'libxfixes3', 'libxkbcommon0', 'libxrandr2'],
414
416
  firefox: ['libasound2', 'libatk1.0-0', 'libcairo-gobject2', 'libcairo2', 'libdbus-1-3', 'libdbus-glib-1-2', 'libfontconfig1', 'libfreetype6', 'libgdk-pixbuf-2.0-0', 'libglib2.0-0', 'libgtk-3-0', 'libharfbuzz0b', 'libpango-1.0-0', 'libpangocairo-1.0-0', 'libx11-6', 'libx11-xcb1', 'libxcb-shm0', 'libxcb1', 'libxcomposite1', 'libxcursor1', 'libxdamage1', 'libxext6', 'libxfixes3', 'libxi6', 'libxrandr2', 'libxrender1', 'libxtst6'],
415
- webkit: ['libsoup-3.0-0', 'gstreamer1.0-libav', 'gstreamer1.0-plugins-bad', 'gstreamer1.0-plugins-base', 'gstreamer1.0-plugins-good', 'libatk-bridge2.0-0', 'libatk1.0-0', 'libcairo2', 'libdbus-1-3', 'libdrm2', 'libegl1', 'libenchant-2-2', 'libepoxy0', 'libevdev2', 'libfontconfig1', 'libfreetype6', 'libgbm1', 'libgdk-pixbuf-2.0-0', 'libgles2', 'libglib2.0-0', 'libglx0', 'libgstreamer-gl1.0-0', 'libgstreamer-plugins-base1.0-0', 'libgstreamer1.0-0', 'libgtk-3-0', 'libgudev-1.0-0', 'libharfbuzz-icu0', 'libharfbuzz0b', 'libhyphen0', 'libicu72', 'libjpeg62-turbo', 'liblcms2-2', 'libmanette-0.2-0', 'libnotify4', 'libopengl0', 'libopenjp2-7', 'libopus0', 'libpango-1.0-0', 'libpng16-16', 'libproxy1v5', 'libsecret-1-0', 'libwayland-client0', 'libwayland-egl1', 'libwayland-server0', 'libwebp7', 'libwebpdemux2', 'libwoff1', 'libx11-6', 'libxcomposite1', 'libxdamage1', 'libxkbcommon0', 'libxml2', 'libxslt1.1', 'libatomic1', 'libevent-2.1-7'],
417
+ webkit: ['libsoup-3.0-0', 'gstreamer1.0-libav', 'gstreamer1.0-plugins-bad', 'gstreamer1.0-plugins-base', 'gstreamer1.0-plugins-good', 'libatk-bridge2.0-0', 'libatk1.0-0', 'libcairo2', 'libdbus-1-3', 'libdrm2', 'libegl1', 'libenchant-2-2', 'libepoxy0', 'libevdev2', 'libfontconfig1', 'libfreetype6', 'libgbm1', 'libgdk-pixbuf-2.0-0', 'libgles2', 'libglib2.0-0', 'libglx0', 'libgstreamer-gl1.0-0', 'libgstreamer-plugins-base1.0-0', 'libgstreamer1.0-0', 'libgtk-3-0', 'libgudev-1.0-0', 'libharfbuzz-icu0', 'libharfbuzz0b', 'libhyphen0', 'libicu72', 'libjpeg62-turbo', 'liblcms2-2', 'libmanette-0.2-0', 'libnotify4', 'libopengl0', 'libopenjp2-7', 'libopus0', 'libpango-1.0-0', 'libpng16-16', 'libproxy1v5', 'libsecret-1-0', 'libwayland-client0', 'libwayland-egl1', 'libwayland-server0', 'libwebp7', 'libwebpdemux2', 'libwoff1', 'libx11-6', 'libxcomposite1', 'libxdamage1', 'libxkbcommon0', 'libxml2', 'libxslt1.1', 'libatomic1', 'libevent-2.1-7', 'libavif15'],
416
418
  lib2package: {
419
+ 'libavif.so.15': 'libavif15',
417
420
  'libsoup-3.0.so.0': 'libsoup-3.0-0',
418
421
  'libasound.so.2': 'libasound2',
419
422
  'libatk-1.0.so.0': 'libatk1.0-0',
@@ -107,7 +107,7 @@ class SocksProxyConnection {
107
107
  };
108
108
  }
109
109
  async connect() {
110
- if (this.socksProxy.proxyAgentFromOptions) this.target = await this.socksProxy.proxyAgentFromOptions.callback(new _events.EventEmitter(), {
110
+ if (this.socksProxy.proxyAgentFromOptions) this.target = await this.socksProxy.proxyAgentFromOptions.connect(new _events.EventEmitter(), {
111
111
  host: rewriteToLocalhostIfNeeded(this.host),
112
112
  port: this.port,
113
113
  secureEndpoint: false
@@ -81,21 +81,10 @@ class Snapshotter {
81
81
  dispose() {
82
82
  _eventsHelper.eventsHelper.removeEventListeners(this._eventListeners);
83
83
  }
84
- async captureSnapshot(page, callId, snapshotName, element) {
84
+ async captureSnapshot(page, callId, snapshotName) {
85
85
  // Prepare expression synchronously.
86
86
  const expression = `window["${this._snapshotStreamer}"].captureSnapshot(${JSON.stringify(snapshotName)})`;
87
87
 
88
- // In a best-effort manner, without waiting for it, mark target element.
89
- element === null || element === void 0 || element.callFunctionNoReply((element, callId) => {
90
- const customEvent = new CustomEvent('__playwright_target__', {
91
- bubbles: true,
92
- cancelable: true,
93
- detail: callId,
94
- composed: true
95
- });
96
- element.dispatchEvent(customEvent);
97
- }, callId);
98
-
99
88
  // In each frame, in a non-stalling manner, capture the snapshots.
100
89
  const snapshots = page.frames().map(async frame => {
101
90
  const data = await frame.nonStallingRawEvaluateInExistingMainContext(expression).catch(e => _debugLogger.debugLogger.log('error', e));
@@ -35,6 +35,7 @@ function frameSnapshotStreamer(snapshotStreamer, removeNoScript) {
35
35
  const kTargetAttribute = '__playwright_target__';
36
36
  const kCustomElementsAttribute = '__playwright_custom_elements__';
37
37
  const kCurrentSrcAttribute = '__playwright_current_src__';
38
+ const kBoundingRectAttribute = '__playwright_bounding_rect__';
38
39
 
39
40
  // Symbols for our own info on Nodes/StyleSheets.
40
41
  const kSnapshotFrameId = Symbol('__playwright_snapshot_frameid_');
@@ -112,11 +113,16 @@ function frameSnapshotStreamer(snapshotStreamer, removeNoScript) {
112
113
  });
113
114
  }
114
115
  _refreshListeners() {
115
- document.addEventListener('__playwright_target__', event => {
116
+ document.addEventListener('__playwright_mark_target__', event => {
116
117
  if (!event.detail) return;
117
118
  const callId = event.detail;
118
119
  event.composedPath()[0].__playwright_target__ = callId;
119
120
  });
121
+ document.addEventListener('__playwright_unmark_target__', event => {
122
+ if (!event.detail) return;
123
+ const callId = event.detail;
124
+ if (event.composedPath()[0].__playwright_target__ === callId) delete event.composedPath()[0].__playwright_target__;
125
+ });
120
126
  }
121
127
  _interceptNativeMethod(obj, method, cb) {
122
128
  const native = obj[method];
@@ -348,6 +354,18 @@ function frameSnapshotStreamer(snapshotStreamer, removeNoScript) {
348
354
  expectValue(value);
349
355
  attrs[kSelectedAttribute] = value;
350
356
  }
357
+ if (nodeName === 'CANVAS') {
358
+ const boundingRect = element.getBoundingClientRect();
359
+ const value = JSON.stringify({
360
+ left: boundingRect.left / window.innerWidth,
361
+ top: boundingRect.top / window.innerHeight,
362
+ right: boundingRect.right / window.innerWidth,
363
+ bottom: boundingRect.bottom / window.innerHeight
364
+ });
365
+ expectValue(kBoundingRectAttribute);
366
+ expectValue(value);
367
+ attrs[kBoundingRectAttribute] = value;
368
+ }
351
369
  if (element.scrollTop) {
352
370
  expectValue(kScrollTopAttribute);
353
371
  expectValue(element.scrollTop);
@@ -120,7 +120,8 @@ class Tracing extends _instrumentation.SdkObject {
120
120
  traceSha1s: new Set(),
121
121
  networkSha1s: new Set(),
122
122
  recording: false,
123
- callIds: new Set()
123
+ callIds: new Set(),
124
+ groupStack: []
124
125
  };
125
126
  this._fs.mkdir(this._state.resourcesDir);
126
127
  this._fs.writeFile(this._state.networkFile, '');
@@ -155,6 +156,52 @@ class Tracing extends _instrumentation.SdkObject {
155
156
  traceName: this._state.traceName
156
157
  };
157
158
  }
159
+ _currentGroupId() {
160
+ var _this$_state;
161
+ return (_this$_state = this._state) !== null && _this$_state !== void 0 && _this$_state.groupStack.length ? this._state.groupStack[this._state.groupStack.length - 1] : undefined;
162
+ }
163
+ async group(name, location, metadata) {
164
+ var _ref;
165
+ if (!this._state) return;
166
+ const stackFrames = [];
167
+ const {
168
+ file,
169
+ line,
170
+ column
171
+ } = (_ref = location !== null && location !== void 0 ? location : metadata.location) !== null && _ref !== void 0 ? _ref : {};
172
+ if (file) {
173
+ stackFrames.push({
174
+ file,
175
+ line: line !== null && line !== void 0 ? line : 0,
176
+ column: column !== null && column !== void 0 ? column : 0
177
+ });
178
+ }
179
+ const event = {
180
+ type: 'before',
181
+ callId: metadata.id,
182
+ startTime: metadata.startTime,
183
+ apiName: name,
184
+ class: 'Tracing',
185
+ method: 'tracingGroup',
186
+ params: {},
187
+ stepId: metadata.stepId,
188
+ stack: stackFrames
189
+ };
190
+ if (this._currentGroupId()) event.parentId = this._currentGroupId();
191
+ this._state.groupStack.push(event.callId);
192
+ this._appendTraceEvent(event);
193
+ }
194
+ groupEnd() {
195
+ if (!this._state) return;
196
+ const callId = this._state.groupStack.pop();
197
+ if (!callId) return;
198
+ const event = {
199
+ type: 'after',
200
+ callId,
201
+ endTime: (0, _utils.monotonicTime)()
202
+ };
203
+ this._appendTraceEvent(event);
204
+ }
158
205
  _startScreencast() {
159
206
  if (!(this._context instanceof _browserContext.BrowserContext)) return;
160
207
  for (const page of this._context.pages()) this._startScreencastInPage(page);
@@ -184,6 +231,7 @@ class Tracing extends _instrumentation.SdkObject {
184
231
  if (!this._state) return;
185
232
  if (this._isStopping) throw new Error(`Tracing is already stopping`);
186
233
  if (this._state.recording) throw new Error(`Must stop trace file before stopping tracing`);
234
+ this._closeAllGroups();
187
235
  this._harTracer.stop();
188
236
  this.flushHarEntries();
189
237
  await this._fs.syncAndGetError();
@@ -206,6 +254,9 @@ class Tracing extends _instrumentation.SdkObject {
206
254
  this.abort();
207
255
  await this._fs.syncAndGetError();
208
256
  }
257
+ _closeAllGroups() {
258
+ while (this._currentGroupId()) this.groupEnd();
259
+ }
209
260
  async stopChunk(params) {
210
261
  var _this$_snapshotter4;
211
262
  if (this._isStopping) throw new Error(`Tracing is already stopping`);
@@ -215,6 +266,7 @@ class Tracing extends _instrumentation.SdkObject {
215
266
  if (params.mode !== 'discard') throw new Error(`Must start tracing before stopping`);
216
267
  return {};
217
268
  }
269
+ this._closeAllGroups();
218
270
  this._context.instrumentation.removeListener(this);
219
271
  _utils.eventsHelper.removeEventListeners(this._eventListeners);
220
272
  if (this._state.options.screenshots) this._stopScreencast();
@@ -275,34 +327,34 @@ class Tracing extends _instrumentation.SdkObject {
275
327
  artifact
276
328
  };
277
329
  }
278
- async _captureSnapshot(snapshotName, sdkObject, metadata, element) {
330
+ async _captureSnapshot(snapshotName, sdkObject, metadata) {
279
331
  if (!this._snapshotter) return;
280
332
  if (!sdkObject.attribution.page) return;
281
333
  if (!this._snapshotter.started()) return;
282
334
  if (!shouldCaptureSnapshot(metadata)) return;
283
- await this._snapshotter.captureSnapshot(sdkObject.attribution.page, metadata.id, snapshotName, element).catch(() => {});
335
+ await this._snapshotter.captureSnapshot(sdkObject.attribution.page, metadata.id, snapshotName).catch(() => {});
284
336
  }
285
337
  onBeforeCall(sdkObject, metadata) {
286
- var _sdkObject$attributio, _this$_state;
338
+ var _sdkObject$attributio, _this$_state2;
287
339
  // IMPORTANT: no awaits before this._appendTraceEvent in this method.
288
- const event = createBeforeActionTraceEvent(metadata);
340
+ const event = createBeforeActionTraceEvent(metadata, this._currentGroupId());
289
341
  if (!event) return Promise.resolve();
290
342
  (_sdkObject$attributio = sdkObject.attribution.page) === null || _sdkObject$attributio === void 0 || _sdkObject$attributio.temporarilyDisableTracingScreencastThrottling();
291
343
  event.beforeSnapshot = `before@${metadata.id}`;
292
- (_this$_state = this._state) === null || _this$_state === void 0 || _this$_state.callIds.add(metadata.id);
344
+ (_this$_state2 = this._state) === null || _this$_state2 === void 0 || _this$_state2.callIds.add(metadata.id);
293
345
  this._appendTraceEvent(event);
294
346
  return this._captureSnapshot(event.beforeSnapshot, sdkObject, metadata);
295
347
  }
296
- onBeforeInputAction(sdkObject, metadata, element) {
297
- var _this$_state2, _sdkObject$attributio2;
298
- if (!((_this$_state2 = this._state) !== null && _this$_state2 !== void 0 && _this$_state2.callIds.has(metadata.id))) return Promise.resolve();
348
+ onBeforeInputAction(sdkObject, metadata) {
349
+ var _this$_state3, _sdkObject$attributio2;
350
+ if (!((_this$_state3 = this._state) !== null && _this$_state3 !== void 0 && _this$_state3.callIds.has(metadata.id))) return Promise.resolve();
299
351
  // IMPORTANT: no awaits before this._appendTraceEvent in this method.
300
352
  const event = createInputActionTraceEvent(metadata);
301
353
  if (!event) return Promise.resolve();
302
354
  (_sdkObject$attributio2 = sdkObject.attribution.page) === null || _sdkObject$attributio2 === void 0 || _sdkObject$attributio2.temporarilyDisableTracingScreencastThrottling();
303
355
  event.inputSnapshot = `input@${metadata.id}`;
304
356
  this._appendTraceEvent(event);
305
- return this._captureSnapshot(event.inputSnapshot, sdkObject, metadata, element);
357
+ return this._captureSnapshot(event.inputSnapshot, sdkObject, metadata);
306
358
  }
307
359
  onCallLog(sdkObject, metadata, logName, message) {
308
360
  if (metadata.isServerSide || metadata.internal) return;
@@ -311,9 +363,9 @@ class Tracing extends _instrumentation.SdkObject {
311
363
  if (event) this._appendTraceEvent(event);
312
364
  }
313
365
  async onAfterCall(sdkObject, metadata) {
314
- var _this$_state3, _this$_state4, _sdkObject$attributio3;
315
- if (!((_this$_state3 = this._state) !== null && _this$_state3 !== void 0 && _this$_state3.callIds.has(metadata.id))) return;
316
- (_this$_state4 = this._state) === null || _this$_state4 === void 0 || _this$_state4.callIds.delete(metadata.id);
366
+ var _this$_state4, _this$_state5, _sdkObject$attributio3;
367
+ if (!((_this$_state4 = this._state) !== null && _this$_state4 !== void 0 && _this$_state4.callIds.has(metadata.id))) return;
368
+ (_this$_state5 = this._state) === null || _this$_state5 === void 0 || _this$_state5.callIds.delete(metadata.id);
317
369
  const event = createAfterActionTraceEvent(metadata);
318
370
  if (!event) return;
319
371
  (_sdkObject$attributio3 = sdkObject.attribution.page) === null || _sdkObject$attributio3 === void 0 || _sdkObject$attributio3.temporarilyDisableTracingScreencastThrottling();
@@ -497,9 +549,9 @@ function visitTraceEvent(object, sha1s) {
497
549
  function shouldCaptureSnapshot(metadata) {
498
550
  return _debug.commandsWithTracingSnapshots.has(metadata.type + '.' + metadata.method);
499
551
  }
500
- function createBeforeActionTraceEvent(metadata) {
552
+ function createBeforeActionTraceEvent(metadata, parentId) {
501
553
  if (metadata.internal || metadata.method.startsWith('tracing')) return null;
502
- return {
554
+ const event = {
503
555
  type: 'before',
504
556
  callId: metadata.id,
505
557
  startTime: metadata.startTime,
@@ -510,6 +562,8 @@ function createBeforeActionTraceEvent(metadata) {
510
562
  stepId: metadata.stepId,
511
563
  pageId: metadata.pageId
512
564
  };
565
+ if (parentId) event.parentId = parentId;
566
+ return event;
513
567
  }
514
568
  function createInputActionTraceEvent(metadata) {
515
569
  if (metadata.internal || metadata.method.startsWith('tracing')) return null;
@@ -60,9 +60,9 @@ class InMemorySnapshotter {
60
60
  await this._harTracer.flush();
61
61
  this._harTracer.stop();
62
62
  }
63
- async captureSnapshot(page, callId, snapshotName, element) {
63
+ async captureSnapshot(page, callId, snapshotName) {
64
64
  if (this._snapshotReadyPromises.has(snapshotName)) throw new Error('Duplicate snapshot name: ' + snapshotName);
65
- this._snapshotter.captureSnapshot(page, callId, snapshotName, element).catch(() => {});
65
+ this._snapshotter.captureSnapshot(page, callId, snapshotName).catch(() => {});
66
66
  const promise = new _utils.ManualPromise();
67
67
  this._snapshotReadyPromises.set(snapshotName, promise);
68
68
  return promise;
@@ -80,7 +80,7 @@ class InMemorySnapshotter {
80
80
  onFrameSnapshot(snapshot) {
81
81
  var _this$_snapshotReadyP;
82
82
  ++this._snapshotCount;
83
- const renderer = this._storage.addFrameSnapshot(snapshot);
83
+ const renderer = this._storage.addFrameSnapshot(snapshot, []);
84
84
  (_this$_snapshotReadyP = this._snapshotReadyPromises.get(snapshot.snapshotName || '')) === null || _this$_snapshotReadyP === void 0 || _this$_snapshotReadyP.resolve(renderer);
85
85
  }
86
86
  async resourceContentForTest(sha1) {
@@ -135,7 +135,8 @@ async function openTraceViewerApp(url, browserName, options) {
135
135
  persistentContextOptions: {
136
136
  ...(options === null || options === void 0 ? void 0 : options.persistentContextOptions),
137
137
  useWebSocket: (0, _utils.isUnderTest)(),
138
- headless: !!(options !== null && options !== void 0 && options.headless)
138
+ headless: !!(options !== null && options !== void 0 && options.headless),
139
+ colorScheme: (0, _utils.isUnderTest)() ? 'light' : undefined
139
140
  }
140
141
  });
141
142
  const controller = new _progress.ProgressController((0, _instrumentation.serverSideCallMetadata)(), context._browser);
@@ -30,8 +30,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
30
30
  * limitations under the License.
31
31
  */
32
32
 
33
- const DEFAULT_USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Safari/605.1.15';
34
- const BROWSER_VERSION = '18.0';
33
+ const DEFAULT_USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.2 Safari/605.1.15';
34
+ const BROWSER_VERSION = '18.2';
35
35
  class WKBrowser extends _browser.Browser {
36
36
  static async connect(parent, transport, options) {
37
37
  const browser = new WKBrowser(parent, transport, options);
@@ -59,19 +59,6 @@ class WKExecutionContext {
59
59
  throw rewriteError(error);
60
60
  }
61
61
  }
62
- rawCallFunctionNoReply(func, ...args) {
63
- this._session.send('Runtime.callFunctionOn', {
64
- functionDeclaration: func.toString(),
65
- objectId: args.find(a => a instanceof js.JSHandle)._objectId,
66
- arguments: args.map(a => a instanceof js.JSHandle ? {
67
- objectId: a._objectId
68
- } : {
69
- value: a
70
- }),
71
- returnByValue: true,
72
- emulateUserGesture: true
73
- }).catch(() => {});
74
- }
75
62
  async evaluateWithArguments(expression, returnByValue, utilityScript, values, objectIds) {
76
63
  try {
77
64
  const response = await this._session.send('Runtime.callFunctionOn', {
@@ -247,6 +247,10 @@ class WKPage {
247
247
  setting: 'InputTypeWeekEnabled',
248
248
  value: contextOptions.isMobile
249
249
  }));
250
+ promises.push(session.send('Page.overrideSetting', {
251
+ setting: 'FixedBackgroundsPaintRelativeToDocument',
252
+ value: contextOptions.isMobile
253
+ }));
250
254
  await Promise.all(promises);
251
255
  }
252
256
  _onDidCommitProvisionalTarget(event) {
@@ -566,6 +570,8 @@ class WKPage {
566
570
  }
567
571
  _onDialog(event) {
568
572
  this._page.emitOnContext(_browserContext.BrowserContext.Events.Dialog, new dialog.Dialog(this._page, event.type, event.message, async (accept, promptText) => {
573
+ // TODO: this should actually be a RDP event that notifies about a cancelled navigation attempt.
574
+ if (event.type === 'beforeunload' && !accept) this._page._frameManager.frameAbortedNavigation(this._page.mainFrame()._id, 'navigation cancelled by beforeunload dialog');
569
575
  await this._pageProxySession.send('Dialog.handleJavaScriptDialog', {
570
576
  accept,
571
577
  promptText
@@ -5,7 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getComparator = getComparator;
7
7
  var _utilsBundle = require("../utilsBundle");
8
+ var _pixelmatch = _interopRequireDefault(require("../third_party/pixelmatch"));
8
9
  var _compare = require("../image_tools/compare");
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
11
  /**
10
12
  * Copyright 2017 Google Inc. All rights reserved.
11
13
  * Modifications copyright (c) Microsoft Corporation.
@@ -23,13 +25,8 @@ var _compare = require("../image_tools/compare");
23
25
  * limitations under the License.
24
26
  */
25
27
 
26
- const pixelmatch = require('../third_party/pixelmatch');
27
- const {
28
- diff_match_patch,
29
- DIFF_INSERT,
30
- DIFF_DELETE,
31
- DIFF_EQUAL
32
- } = require('../third_party/diff_match_patch');
28
+ // @ts-ignore
29
+
33
30
  function getComparator(mimeType) {
34
31
  if (mimeType === 'image/png') return compareImages.bind(null, 'image/png');
35
32
  if (mimeType === 'image/jpeg') return compareImages.bind(null, 'image/jpeg');
@@ -83,7 +80,7 @@ function compareImages(mimeType, actualBuffer, expectedBuffer, options = {}) {
83
80
  });
84
81
  } else if (((_options$comparator = options.comparator) !== null && _options$comparator !== void 0 ? _options$comparator : 'pixelmatch') === 'pixelmatch') {
85
82
  var _options$threshold;
86
- count = pixelmatch(expected.data, actual.data, diff.data, size.width, size.height, {
83
+ count = (0, _pixelmatch.default)(expected.data, actual.data, diff.data, size.width, size.height, {
87
84
  threshold: (_options$threshold = options.threshold) !== null && _options$threshold !== void 0 ? _options$threshold : 0.2
88
85
  });
89
86
  } else {
@@ -116,32 +113,17 @@ function compareText(actual, expectedBuffer) {
116
113
  };
117
114
  const expected = expectedBuffer.toString('utf-8');
118
115
  if (expected === actual) return null;
119
- const dmp = new diff_match_patch();
120
- const d = dmp.diff_main(expected, actual);
121
- dmp.diff_cleanupSemantic(d);
116
+ const diffs = _utilsBundle.diff.diffChars(expected, actual);
122
117
  return {
123
- errorMessage: diff_prettyTerminal(d)
118
+ errorMessage: diff_prettyTerminal(diffs)
124
119
  };
125
120
  }
126
121
  function diff_prettyTerminal(diffs) {
127
- const html = [];
128
- for (let x = 0; x < diffs.length; x++) {
129
- const op = diffs[x][0]; // Operation (insert, delete, equal)
130
- const data = diffs[x][1]; // Text of change.
131
- const text = data;
132
- switch (op) {
133
- case DIFF_INSERT:
134
- html[x] = _utilsBundle.colors.green(text);
135
- break;
136
- case DIFF_DELETE:
137
- html[x] = _utilsBundle.colors.reset(_utilsBundle.colors.strikethrough(_utilsBundle.colors.red(text)));
138
- break;
139
- case DIFF_EQUAL:
140
- html[x] = text;
141
- break;
142
- }
143
- }
144
- return html.join('');
122
+ const result = diffs.map(part => {
123
+ const text = part.value;
124
+ if (part.added) return _utilsBundle.colors.green(text);else if (part.removed) return _utilsBundle.colors.reset(_utilsBundle.colors.strikethrough(_utilsBundle.colors.red(text)));else return text;
125
+ });
126
+ return result.join('');
145
127
  }
146
128
  function resizeImage(image, size) {
147
129
  if (image.width === size.width && image.height === size.height) return image;
@@ -45,7 +45,6 @@ function encodeBase128(value) {
45
45
  } while (value > 0);
46
46
  return Buffer.from(bytes.reverse());
47
47
  }
48
- ;
49
48
 
50
49
  // ASN1/DER Speficiation: https://www.itu.int/rec/T-REC-X.680-X.693-202102-I/en
51
50
  class DER {
@@ -60,9 +59,7 @@ class DER {
60
59
  const parts = oid.split('.').map(v => Number(v));
61
60
  // Encode the second part, which could be large, using base-128 encoding if necessary
62
61
  const output = [encodeBase128(40 * parts[0] + parts[1])];
63
- for (let i = 2; i < parts.length; i++) {
64
- output.push(encodeBase128(parts[i]));
65
- }
62
+ for (let i = 2; i < parts.length; i++) output.push(encodeBase128(parts[i]));
66
63
  return this._encode(0x06, Buffer.concat(output));
67
64
  }
68
65
  static encodeNull() {
@@ -24,6 +24,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
24
24
  */
25
25
 
26
26
  function calculatePlatform() {
27
+ if (process.env.PLAYWRIGHT_HOST_PLATFORM_OVERRIDE) {
28
+ return {
29
+ hostPlatform: process.env.PLAYWRIGHT_HOST_PLATFORM_OVERRIDE,
30
+ isOfficiallySupportedPlatform: false
31
+ };
32
+ }
27
33
  const platform = _os.default.platform();
28
34
  if (platform === 'darwin') {
29
35
  const ver = _os.default.release().split('.').map(a => parseInt(a, 10));