@browserless.io/browserless 2.2.0-beta-8 → 2.2.0

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 (1316) hide show
  1. package/CHANGELOG.md +21 -2
  2. package/bin/browserless.js +1 -1
  3. package/bin/scaffold/README.md +8 -7
  4. package/build/browserless.js +7 -6
  5. package/build/browsers/chrome.cdp.d.ts +6 -0
  6. package/build/browsers/chrome.cdp.js +6 -0
  7. package/build/browsers/chrome.playwright.d.ts +6 -0
  8. package/build/browsers/chrome.playwright.js +6 -0
  9. package/build/browsers/{cdp-chromium.d.ts → chromium.cdp.d.ts} +3 -2
  10. package/build/browsers/{cdp-chromium.js → chromium.cdp.js} +16 -10
  11. package/build/browsers/{playwright-chromium.d.ts → chromium.playwright.d.ts} +3 -2
  12. package/build/browsers/{playwright-chromium.js → chromium.playwright.js} +6 -5
  13. package/build/browsers/{playwright-firefox.d.ts → firefox.playwright.d.ts} +2 -2
  14. package/build/browsers/{playwright-firefox.js → firefox.playwright.js} +4 -4
  15. package/build/browsers/index.d.ts +20 -10
  16. package/build/browsers/index.js +110 -11
  17. package/build/browsers/{playwright-webkit.d.ts → webkit.playwright.d.ts} +2 -2
  18. package/build/browsers/{playwright-webkit.js → webkit.playwright.js} +4 -4
  19. package/build/data/selectors.json +1 -1
  20. package/build/exports.d.ts +6 -4
  21. package/build/exports.js +6 -4
  22. package/build/hooks.d.ts +4 -5
  23. package/build/hooks.js +4 -6
  24. package/build/http.d.ts +22 -1
  25. package/build/http.js +21 -0
  26. package/build/router.js +19 -3
  27. package/build/routes/{chromium/http/content-post.body.json → chrome/http/content.post.body.json} +8 -8
  28. package/build/routes/chrome/http/content.post.d.ts +7 -0
  29. package/build/routes/chrome/http/content.post.js +6 -0
  30. package/build/routes/chrome/http/download.post.d.ts +7 -0
  31. package/build/routes/chrome/http/download.post.js +6 -0
  32. package/build/routes/chrome/http/function.post.d.ts +7 -0
  33. package/build/routes/chrome/http/function.post.js +6 -0
  34. package/build/routes/chrome/http/json-list.get.d.ts +1 -0
  35. package/build/routes/chrome/http/json-list.get.js +1 -0
  36. package/build/routes/chrome/http/json-new.put.d.ts +1 -0
  37. package/build/routes/chrome/http/json-new.put.js +1 -0
  38. package/build/routes/chrome/http/json-protocol.get.d.ts +1 -0
  39. package/build/routes/chrome/http/json-protocol.get.js +1 -0
  40. package/build/routes/chrome/http/json-version.get.d.ts +1 -0
  41. package/build/routes/chrome/http/json-version.get.js +1 -0
  42. package/build/routes/chrome/http/json-version.get.response.json +44 -0
  43. package/build/routes/{chromium/http/pdf-post.body.json → chrome/http/pdf.post.body.json} +8 -8
  44. package/build/routes/chrome/http/pdf.post.d.ts +7 -0
  45. package/build/routes/chrome/http/pdf.post.js +6 -0
  46. package/build/routes/chrome/http/performance.post.d.ts +7 -0
  47. package/build/routes/chrome/http/performance.post.js +6 -0
  48. package/build/routes/{chromium/http/scrape-post.body.json → chrome/http/scrape.post.body.json} +8 -8
  49. package/build/routes/chrome/http/scrape.post.d.ts +7 -0
  50. package/build/routes/chrome/http/scrape.post.js +6 -0
  51. package/build/routes/{chromium/http/screenshot-post.body.json → chrome/http/screenshot.post.body.json} +8 -8
  52. package/build/routes/chrome/http/screenshot.post.d.ts +7 -0
  53. package/build/routes/chrome/http/screenshot.post.js +6 -0
  54. package/build/routes/chrome/tests/content.spec.js +311 -0
  55. package/build/routes/chrome/tests/download.spec.js +67 -0
  56. package/build/routes/chrome/tests/function.spec.d.ts +1 -0
  57. package/build/routes/chrome/tests/function.spec.js +245 -0
  58. package/build/routes/chrome/tests/json-version.spec.d.ts +1 -0
  59. package/build/routes/chrome/tests/json-version.spec.js +37 -0
  60. package/build/routes/chrome/tests/page-websocket.spec.d.ts +1 -0
  61. package/build/routes/chrome/tests/page-websocket.spec.js +97 -0
  62. package/build/routes/chrome/tests/pdf.spec.d.ts +1 -0
  63. package/build/routes/chrome/tests/pdf.spec.js +333 -0
  64. package/build/routes/chrome/tests/performance.spec.d.ts +1 -0
  65. package/build/routes/chrome/tests/performance.spec.js +124 -0
  66. package/build/routes/chrome/tests/scrape.spec.d.ts +1 -0
  67. package/build/routes/chrome/tests/scrape.spec.js +354 -0
  68. package/build/routes/chrome/tests/screenshot.spec.d.ts +1 -0
  69. package/build/routes/chrome/tests/screenshot.spec.js +339 -0
  70. package/build/routes/chrome/tests/websocket.spec.d.ts +1 -0
  71. package/build/routes/chrome/tests/websocket.spec.js +371 -0
  72. package/build/routes/chrome/ws/browser.d.ts +6 -0
  73. package/build/routes/chrome/ws/browser.js +5 -0
  74. package/build/routes/chrome/ws/cdp.d.ts +7 -0
  75. package/build/routes/chrome/ws/cdp.js +6 -0
  76. package/build/routes/chrome/ws/cdp.query.json +120 -0
  77. package/build/routes/chrome/ws/page.d.ts +6 -0
  78. package/build/routes/chrome/ws/page.js +5 -0
  79. package/build/routes/chrome/ws/page.query.json +120 -0
  80. package/build/routes/chrome/ws/playwright.d.ts +7 -0
  81. package/build/routes/chrome/ws/playwright.js +6 -0
  82. package/build/routes/chromium/http/content.post.body.json +510 -0
  83. package/build/routes/chromium/http/content.post.d.ts +1 -0
  84. package/build/routes/chromium/http/content.post.js +1 -0
  85. package/build/routes/chromium/http/content.post.query.json +183 -0
  86. package/build/routes/chromium/http/content.post.response.json +5 -0
  87. package/build/routes/chromium/http/download.post.body.json +32 -0
  88. package/build/routes/chromium/http/download.post.d.ts +1 -0
  89. package/build/routes/chromium/http/download.post.js +1 -0
  90. package/build/routes/chromium/http/download.post.query.json +120 -0
  91. package/build/routes/chromium/http/download.post.response.json +4 -0
  92. package/build/routes/chromium/http/function.post.body.json +32 -0
  93. package/build/routes/chromium/http/function.post.d.ts +1 -0
  94. package/build/routes/chromium/http/function.post.js +1 -0
  95. package/build/routes/chromium/http/function.post.query.json +120 -0
  96. package/build/routes/chromium/http/function.post.response.json +4 -0
  97. package/build/routes/chromium/http/json-list.get.d.ts +1 -0
  98. package/build/routes/chromium/http/json-list.get.js +1 -0
  99. package/build/routes/chromium/http/json-list.get.response.json +52 -0
  100. package/build/routes/chromium/http/json-new.put.d.ts +1 -0
  101. package/build/routes/chromium/http/json-new.put.js +1 -0
  102. package/build/routes/chromium/http/json-new.put.response.json +44 -0
  103. package/build/routes/chromium/http/json-protocol.get.d.ts +1 -0
  104. package/build/routes/chromium/http/json-protocol.get.js +1 -0
  105. package/build/routes/chromium/http/json-protocol.get.response.json +6 -0
  106. package/build/routes/chromium/http/json-version.get.d.ts +1 -0
  107. package/build/routes/chromium/http/json-version.get.js +1 -0
  108. package/build/routes/chromium/http/json-version.get.response.json +44 -0
  109. package/build/routes/chromium/http/pdf.post.body.json +654 -0
  110. package/build/routes/chromium/http/pdf.post.d.ts +1 -0
  111. package/build/routes/chromium/http/pdf.post.js +1 -0
  112. package/build/routes/chromium/http/pdf.post.query.json +120 -0
  113. package/build/routes/chromium/http/pdf.post.response.json +5 -0
  114. package/build/routes/chromium/http/performance.post.body.json +26 -0
  115. package/build/routes/chromium/http/performance.post.d.ts +1 -0
  116. package/build/routes/chromium/http/performance.post.js +1 -0
  117. package/build/routes/chromium/http/performance.post.query.json +120 -0
  118. package/build/routes/chromium/http/performance.post.response.json +7 -0
  119. package/build/routes/chromium/http/scrape.post.body.json +557 -0
  120. package/build/routes/chromium/http/scrape.post.d.ts +1 -0
  121. package/build/routes/chromium/http/scrape.post.js +1 -0
  122. package/build/routes/chromium/http/scrape.post.query.json +183 -0
  123. package/build/routes/chromium/http/scrape.post.response.json +309 -0
  124. package/build/routes/chromium/http/screenshot.post.body.json +600 -0
  125. package/build/routes/chromium/http/screenshot.post.d.ts +1 -0
  126. package/build/routes/chromium/http/screenshot.post.js +1 -0
  127. package/build/routes/chromium/http/screenshot.post.query.json +120 -0
  128. package/build/routes/chromium/http/screenshot.post.response.json +5 -0
  129. package/build/routes/chromium/tests/content.spec.js +16 -16
  130. package/build/routes/chromium/tests/download.spec.js +3 -3
  131. package/build/routes/chromium/tests/function.spec.js +10 -10
  132. package/build/routes/chromium/tests/page-websocket.spec.d.ts +1 -0
  133. package/build/routes/chromium/tests/page-websocket.spec.js +97 -0
  134. package/build/routes/chromium/tests/pdf.spec.js +16 -16
  135. package/build/routes/chromium/tests/performance.spec.js +7 -7
  136. package/build/routes/chromium/tests/scrape.spec.js +15 -15
  137. package/build/routes/chromium/tests/screenshot.spec.js +17 -17
  138. package/build/routes/chromium/tests/websocket.spec.js +31 -37
  139. package/build/routes/chromium/ws/browser.d.ts +1 -16
  140. package/build/routes/chromium/ws/browser.js +1 -10
  141. package/build/routes/chromium/ws/cdp.d.ts +1 -0
  142. package/build/routes/chromium/ws/cdp.js +1 -0
  143. package/build/routes/chromium/ws/cdp.query.json +120 -0
  144. package/build/routes/chromium/ws/page.d.ts +1 -16
  145. package/build/routes/chromium/ws/page.js +1 -10
  146. package/build/routes/chromium/ws/playwright.d.ts +1 -0
  147. package/build/routes/chromium/ws/playwright.js +1 -0
  148. package/build/routes/firefox/ws/{playwright-firefox.d.ts → playwright.d.ts} +5 -5
  149. package/build/routes/firefox/ws/{playwright-firefox.js → playwright.js} +4 -4
  150. package/build/routes/management/http/{sessions-get.response.json → sessions.get.response.json} +11 -1
  151. package/build/routes/management/http/{static-get.js → static.get.js} +2 -2
  152. package/build/routes/webkit/ws/{playwright-webkit.d.ts → playwright.d.ts} +5 -5
  153. package/build/routes/webkit/ws/{playwright-webkit.js → playwright.js} +4 -4
  154. package/build/routes/webkit/ws/playwright.query.json +100 -0
  155. package/build/{routes/chromium/ws/cdp-chromium.d.ts → shared/browser.ws.d.ts} +4 -4
  156. package/build/shared/browser.ws.js +12 -0
  157. package/build/{routes/chromium/ws/playwright-chromium.d.ts → shared/chromium.playwright.ws.d.ts} +4 -4
  158. package/build/{routes/chromium/ws/playwright-chromium.js → shared/chromium.playwright.ws.js} +6 -3
  159. package/build/shared/chromium.ws.d.ts +16 -0
  160. package/build/shared/chromium.ws.js +10 -0
  161. package/build/{routes/chromium/http/content-post.d.ts → shared/content.http.d.ts} +3 -3
  162. package/build/{routes/chromium/http/content-post.js → shared/content.http.js} +3 -3
  163. package/build/{routes/chromium/http/download-post.d.ts → shared/download.http.d.ts} +3 -3
  164. package/build/{routes/chromium/http/download-post.js → shared/download.http.js} +4 -4
  165. package/build/{routes/chromium/http/function-post.d.ts → shared/function.http.d.ts} +3 -3
  166. package/build/{routes/chromium/http/function-post.js → shared/function.http.js} +4 -4
  167. package/build/{routes/chromium/http/json-new.d.ts → shared/json-list.http.d.ts} +2 -3
  168. package/build/{routes/chromium/http/json-list.js → shared/json-list.http.js} +5 -8
  169. package/build/{routes/chromium/http/json-list.d.ts → shared/json-new.http.d.ts} +2 -3
  170. package/build/shared/json-new.http.js +34 -0
  171. package/build/{routes/chromium/http/json-protocol-get.js → shared/json-protocol.http.js} +2 -2
  172. package/build/{routes/chromium/http/json-version-get.js → shared/json-version.http.js} +3 -3
  173. package/build/shared/page.ws.d.ts +16 -0
  174. package/build/shared/page.ws.js +13 -0
  175. package/build/{routes/chromium/http/pdf-post.d.ts → shared/pdf.http.d.ts} +3 -3
  176. package/build/{routes/chromium/http/pdf-post.js → shared/pdf.http.js} +3 -3
  177. package/build/{routes/chromium/http/performance.d.ts → shared/performance.http.d.ts} +3 -3
  178. package/build/{routes/chromium/http/performance.js → shared/performance.http.js} +4 -4
  179. package/build/{routes/chromium/http/scrape-post.d.ts → shared/scrape.http.d.ts} +3 -3
  180. package/build/{routes/chromium/http/scrape-post.js → shared/scrape.http.js} +3 -3
  181. package/build/{routes/chromium/http/screenshot-post.d.ts → shared/screenshot.http.d.ts} +3 -3
  182. package/build/{routes/chromium/http/screenshot-post.js → shared/screenshot.http.js} +3 -3
  183. package/build/shared/utils/performance/child.d.ts +1 -0
  184. package/build/{routes/chromium → shared}/utils/performance/main.js +1 -1
  185. package/build/shared/utils/performance/types.js +1 -0
  186. package/build/shim.js +2 -1
  187. package/build/types.d.ts +10 -8
  188. package/build/utils.d.ts +8 -3
  189. package/build/utils.js +24 -11
  190. package/docker/base/Dockerfile +1 -1
  191. package/docker/chrome/Dockerfile +4 -4
  192. package/docker/chromium/.dockerignore +16 -0
  193. package/docker/chromium/Dockerfile +40 -0
  194. package/docker/firefox/Dockerfile +1 -1
  195. package/docker/multi/Dockerfile +13 -1
  196. package/docker/webkit/Dockerfile +1 -1
  197. package/extensions/ublock/3p-filters.html +1 -1
  198. package/extensions/ublock/_locales/ar/messages.json +4 -0
  199. package/extensions/ublock/_locales/az/messages.json +4 -0
  200. package/extensions/ublock/_locales/be/messages.json +4 -0
  201. package/extensions/ublock/_locales/bg/messages.json +5 -1
  202. package/extensions/ublock/_locales/bn/messages.json +4 -0
  203. package/extensions/ublock/_locales/br_FR/messages.json +6 -2
  204. package/extensions/ublock/_locales/bs/messages.json +4 -0
  205. package/extensions/ublock/_locales/ca/messages.json +4 -0
  206. package/extensions/ublock/_locales/cs/messages.json +4 -0
  207. package/extensions/ublock/_locales/cv/messages.json +4 -0
  208. package/extensions/ublock/_locales/cy/messages.json +1294 -0
  209. package/extensions/ublock/_locales/da/messages.json +4 -0
  210. package/extensions/ublock/_locales/de/messages.json +5 -1
  211. package/extensions/ublock/_locales/el/messages.json +4 -0
  212. package/extensions/ublock/_locales/en/messages.json +4 -0
  213. package/extensions/ublock/_locales/en_GB/messages.json +4 -0
  214. package/extensions/ublock/_locales/eo/messages.json +9 -5
  215. package/extensions/ublock/_locales/es/messages.json +4 -0
  216. package/extensions/ublock/_locales/et/messages.json +4 -0
  217. package/extensions/ublock/_locales/eu/messages.json +8 -4
  218. package/extensions/ublock/_locales/fa/messages.json +4 -0
  219. package/extensions/ublock/_locales/fi/messages.json +4 -0
  220. package/extensions/ublock/_locales/fil/messages.json +4 -0
  221. package/extensions/ublock/_locales/fr/messages.json +4 -0
  222. package/extensions/ublock/_locales/fy/messages.json +4 -0
  223. package/extensions/ublock/_locales/gl/messages.json +4 -0
  224. package/extensions/ublock/_locales/gu/messages.json +4 -0
  225. package/extensions/ublock/_locales/he/messages.json +4 -0
  226. package/extensions/ublock/_locales/hi/messages.json +4 -0
  227. package/extensions/ublock/_locales/hr/messages.json +4 -0
  228. package/extensions/ublock/_locales/hu/messages.json +4 -0
  229. package/extensions/ublock/_locales/hy/messages.json +4 -0
  230. package/extensions/ublock/_locales/id/messages.json +5 -1
  231. package/extensions/ublock/_locales/it/messages.json +4 -0
  232. package/extensions/ublock/_locales/ja/messages.json +4 -0
  233. package/extensions/ublock/_locales/ka/messages.json +34 -30
  234. package/extensions/ublock/_locales/kk/messages.json +4 -0
  235. package/extensions/ublock/_locales/kn/messages.json +4 -0
  236. package/extensions/ublock/_locales/ko/messages.json +4 -0
  237. package/extensions/ublock/_locales/ku/messages.json +4 -0
  238. package/extensions/ublock/_locales/lt/messages.json +4 -0
  239. package/extensions/ublock/_locales/lv/messages.json +4 -0
  240. package/extensions/ublock/_locales/mk/messages.json +4 -0
  241. package/extensions/ublock/_locales/ml/messages.json +4 -0
  242. package/extensions/ublock/_locales/mr/messages.json +4 -0
  243. package/extensions/ublock/_locales/ms/messages.json +13 -9
  244. package/extensions/ublock/_locales/nb/messages.json +4 -0
  245. package/extensions/ublock/_locales/nl/messages.json +4 -0
  246. package/extensions/ublock/_locales/no/messages.json +4 -0
  247. package/extensions/ublock/_locales/oc/messages.json +4 -0
  248. package/extensions/ublock/_locales/pa/messages.json +4 -0
  249. package/extensions/ublock/_locales/pl/messages.json +5 -1
  250. package/extensions/ublock/_locales/pt_BR/messages.json +4 -0
  251. package/extensions/ublock/_locales/pt_PT/messages.json +4 -0
  252. package/extensions/ublock/_locales/ro/messages.json +5 -1
  253. package/extensions/ublock/_locales/ru/messages.json +4 -0
  254. package/extensions/ublock/_locales/si/messages.json +4 -0
  255. package/extensions/ublock/_locales/sk/messages.json +4 -0
  256. package/extensions/ublock/_locales/sl/messages.json +4 -0
  257. package/extensions/ublock/_locales/so/messages.json +4 -0
  258. package/extensions/ublock/_locales/sq/messages.json +4 -0
  259. package/extensions/ublock/_locales/sr/messages.json +4 -0
  260. package/extensions/ublock/_locales/sv/messages.json +4 -0
  261. package/extensions/ublock/_locales/sw/messages.json +4 -0
  262. package/extensions/ublock/_locales/ta/messages.json +4 -0
  263. package/extensions/ublock/_locales/te/messages.json +4 -0
  264. package/extensions/ublock/_locales/th/messages.json +12 -8
  265. package/extensions/ublock/_locales/tr/messages.json +4 -0
  266. package/extensions/ublock/_locales/uk/messages.json +4 -0
  267. package/extensions/ublock/_locales/ur/messages.json +4 -0
  268. package/extensions/ublock/_locales/vi/messages.json +4 -0
  269. package/extensions/ublock/_locales/zh_CN/messages.json +6 -2
  270. package/extensions/ublock/_locales/zh_TW/messages.json +6 -2
  271. package/extensions/ublock/assets/assets.json +11 -11
  272. package/extensions/ublock/assets/resources/scriptlets.js +660 -378
  273. package/extensions/ublock/assets/thirdparties/easylist/easylist.txt +7173 -3455
  274. package/extensions/ublock/assets/thirdparties/easylist/easyprivacy.txt +18829 -1918
  275. package/extensions/ublock/assets/thirdparties/pgl.yoyo.org/as/serverlist +21 -26
  276. package/extensions/ublock/assets/thirdparties/publicsuffix.org/list/effective_tld_names.dat +118 -46
  277. package/extensions/ublock/assets/thirdparties/urlhaus-filter/urlhaus-filter-online.txt +710 -1117
  278. package/extensions/ublock/assets/ublock/badlists.txt +0 -4
  279. package/extensions/ublock/assets/ublock/badware.min.txt +116 -105
  280. package/extensions/ublock/assets/ublock/filters.min.txt +1443 -1097
  281. package/extensions/ublock/assets/ublock/privacy.min.txt +50 -31
  282. package/extensions/ublock/assets/ublock/quick-fixes.min.txt +97 -108
  283. package/extensions/ublock/assets/ublock/unbreak.min.txt +64 -21
  284. package/extensions/ublock/css/1p-filters.css +4 -0
  285. package/extensions/ublock/css/3p-filters.css +6 -4
  286. package/extensions/ublock/css/common.css +1 -1
  287. package/extensions/ublock/css/fa-icons.css +1 -0
  288. package/extensions/ublock/css/logger-ui.css +72 -52
  289. package/extensions/ublock/css/popup-fenix.css +1 -1
  290. package/extensions/ublock/img/fontawesome/fontawesome-defs.svg +1 -0
  291. package/extensions/ublock/js/3p-filters.js +3 -3
  292. package/extensions/ublock/js/assets.js +7 -4
  293. package/extensions/ublock/js/background.js +1 -3
  294. package/extensions/ublock/js/benchmarks.js +1 -0
  295. package/extensions/ublock/js/broadcast.js +12 -0
  296. package/extensions/ublock/js/click2load.js +2 -3
  297. package/extensions/ublock/js/codemirror/ubo-static-filtering.js +1 -0
  298. package/extensions/ublock/js/commands.js +10 -0
  299. package/extensions/ublock/js/contentscript-extra.js +13 -11
  300. package/extensions/ublock/js/contentscript.js +0 -31
  301. package/extensions/ublock/js/contextmenu.js +5 -1
  302. package/extensions/ublock/js/dyna-rules.js +83 -52
  303. package/extensions/ublock/js/fa-icons.js +1 -0
  304. package/extensions/ublock/js/filtering-context.js +0 -2
  305. package/extensions/ublock/js/i18n.js +1 -5
  306. package/extensions/ublock/js/logger-ui.js +71 -38
  307. package/extensions/ublock/js/logger.js +18 -14
  308. package/extensions/ublock/js/messaging.js +17 -5
  309. package/extensions/ublock/js/popup-fenix.js +6 -6
  310. package/extensions/ublock/js/scriptlet-filtering-core.js +14 -12
  311. package/extensions/ublock/js/scriptlet-filtering.js +149 -53
  312. package/extensions/ublock/js/scriptlets/scriptlet-loglevel-1.js +49 -0
  313. package/extensions/ublock/js/scriptlets/scriptlet-loglevel-2.js +49 -0
  314. package/extensions/ublock/js/scriptlets/should-inject-contentscript.js +1 -1
  315. package/extensions/ublock/js/static-dnr-filtering.js +4 -2
  316. package/extensions/ublock/js/static-filtering-parser.js +14 -8
  317. package/extensions/ublock/js/static-net-filtering.js +32 -30
  318. package/extensions/ublock/js/storage.js +18 -4
  319. package/extensions/ublock/js/traffic.js +3 -3
  320. package/extensions/ublock/js/ublock.js +1 -1
  321. package/extensions/ublock/js/vapi-background.js +15 -7
  322. package/extensions/ublock/logger-ui.html +18 -10
  323. package/extensions/ublock/manifest.json +4 -1
  324. package/extensions/ublock/web_accessible_resources/chartbeat.js +3 -0
  325. package/package.json +12 -11
  326. package/scripts/build-function.js +1 -1
  327. package/scripts/build-open-api.js +3 -2
  328. package/scripts/clean.js +6 -1
  329. package/scripts/install-debugger.js +20 -0
  330. package/scripts/install-devtools.js +40 -0
  331. package/src/browserless.ts +11 -9
  332. package/src/browsers/chrome.cdp.ts +10 -0
  333. package/src/browsers/chrome.playwright.ts +10 -0
  334. package/src/browsers/{cdp-chromium.ts → chromium.cdp.ts} +20 -13
  335. package/src/browsers/{playwright-chromium.ts → chromium.playwright.ts} +7 -6
  336. package/src/browsers/{playwright-firefox.ts → firefox.playwright.ts} +5 -5
  337. package/src/browsers/index.ts +160 -23
  338. package/src/browsers/{playwright-webkit.ts → webkit.playwright.ts} +5 -5
  339. package/src/exports.ts +6 -4
  340. package/src/hooks.ts +4 -12
  341. package/src/http.ts +21 -0
  342. package/src/router.ts +21 -5
  343. package/src/routes/chrome/http/content.post.ts +14 -0
  344. package/src/routes/chrome/http/download.post.ts +14 -0
  345. package/src/routes/chrome/http/function.post.ts +14 -0
  346. package/src/routes/chrome/http/json-list.get.ts +1 -0
  347. package/src/routes/chrome/http/json-new.put.ts +1 -0
  348. package/src/routes/chrome/http/json-protocol.get.ts +1 -0
  349. package/src/routes/chrome/http/json-version.get.ts +1 -0
  350. package/src/routes/chrome/http/pdf.post.ts +14 -0
  351. package/src/routes/chrome/http/performance.post.ts +14 -0
  352. package/src/routes/chrome/http/scrape.post.ts +14 -0
  353. package/src/routes/chrome/http/screenshot.post.ts +14 -0
  354. package/src/routes/chrome/tests/content.spec.ts +375 -0
  355. package/src/routes/chrome/tests/download.spec.ts +77 -0
  356. package/src/routes/chrome/tests/function.spec.ts +282 -0
  357. package/src/routes/chrome/tests/json-version.spec.ts +52 -0
  358. package/src/routes/chrome/tests/page-websocket.spec.ts +129 -0
  359. package/src/routes/chrome/tests/pdf.spec.ts +380 -0
  360. package/src/routes/chrome/tests/performance.spec.ts +155 -0
  361. package/src/routes/chrome/tests/scrape.spec.ts +417 -0
  362. package/src/routes/chrome/tests/screenshot.spec.ts +387 -0
  363. package/src/routes/chrome/tests/websocket.spec.ts +491 -0
  364. package/src/routes/chrome/ws/browser.ts +8 -0
  365. package/src/routes/chrome/ws/cdp.ts +12 -0
  366. package/src/routes/chrome/ws/page.ts +8 -0
  367. package/src/routes/chrome/ws/playwright.ts +12 -0
  368. package/src/routes/chromium/http/content.post.ts +6 -0
  369. package/src/routes/chromium/http/download.post.ts +6 -0
  370. package/src/routes/chromium/http/function.post.ts +6 -0
  371. package/src/routes/chromium/http/json-list.get.ts +1 -0
  372. package/src/routes/chromium/http/json-new.put.ts +1 -0
  373. package/src/routes/chromium/http/json-protocol.get.ts +1 -0
  374. package/src/routes/chromium/http/json-version.get.ts +1 -0
  375. package/src/routes/chromium/http/pdf.post.ts +6 -0
  376. package/src/routes/chromium/http/performance.post.ts +6 -0
  377. package/src/routes/chromium/http/scrape.post.ts +6 -0
  378. package/src/routes/chromium/http/screenshot.post.ts +6 -0
  379. package/src/routes/chromium/tests/content.spec.ts +36 -28
  380. package/src/routes/chromium/tests/download.spec.ts +3 -3
  381. package/src/routes/chromium/tests/function.spec.ts +18 -15
  382. package/src/routes/chromium/tests/page-websocket.spec.ts +129 -0
  383. package/src/routes/chromium/tests/pdf.spec.ts +31 -26
  384. package/src/routes/chromium/tests/performance.spec.ts +46 -34
  385. package/src/routes/chromium/tests/scrape.spec.ts +23 -20
  386. package/src/routes/chromium/tests/screenshot.spec.ts +24 -24
  387. package/src/routes/chromium/tests/websocket.spec.ts +31 -40
  388. package/src/routes/chromium/ws/browser.ts +1 -29
  389. package/src/routes/chromium/ws/cdp.ts +1 -0
  390. package/src/routes/chromium/ws/page.ts +1 -29
  391. package/src/routes/chromium/ws/playwright.ts +4 -0
  392. package/src/routes/firefox/ws/{playwright-firefox.ts → playwright.ts} +5 -5
  393. package/src/routes/management/http/{static-get.ts → static.get.ts} +2 -2
  394. package/src/routes/webkit/ws/{playwright-webkit.ts → playwright.ts} +5 -5
  395. package/src/shared/browser.ws.ts +34 -0
  396. package/src/{routes/chromium/ws/playwright-chromium.ts → shared/chromium.playwright.ws.ts} +7 -4
  397. package/src/{routes/chromium/ws/cdp-chromium.ts → shared/chromium.ws.ts} +6 -6
  398. package/src/{routes/chromium/http/content-post.ts → shared/content.http.ts} +4 -4
  399. package/src/{routes/chromium/http/download-post.ts → shared/download.http.ts} +4 -4
  400. package/src/{routes/chromium/http/function-post.ts → shared/function.http.ts} +4 -4
  401. package/src/shared/json-list.http.ts +35 -0
  402. package/src/{routes/chromium/http/json-new.ts → shared/json-new.http.ts} +23 -7
  403. package/src/{routes/chromium/http/json-protocol-get.ts → shared/json-protocol.http.ts} +3 -5
  404. package/src/{routes/chromium/http/json-version-get.ts → shared/json-version.http.ts} +4 -5
  405. package/src/shared/page.ws.ts +35 -0
  406. package/src/{routes/chromium/http/pdf-post.ts → shared/pdf.http.ts} +4 -4
  407. package/src/{routes/chromium/http/performance.ts → shared/performance.http.ts} +4 -4
  408. package/src/{routes/chromium/http/scrape-post.ts → shared/scrape.http.ts} +4 -4
  409. package/src/{routes/chromium/http/screenshot-post.ts → shared/screenshot.http.ts} +4 -4
  410. package/src/{routes/chromium → shared}/utils/function/handler.ts +2 -2
  411. package/src/{routes/chromium → shared}/utils/performance/main.ts +1 -2
  412. package/src/shim.ts +2 -1
  413. package/src/types.ts +27 -20
  414. package/src/utils.ts +32 -14
  415. package/static/devtools/Images/accelerometer-back.svg +1 -0
  416. package/static/devtools/Images/accelerometer-bottom.png +0 -0
  417. package/static/devtools/Images/accelerometer-front.svg +1 -0
  418. package/static/devtools/Images/accelerometer-left.png +0 -0
  419. package/static/devtools/Images/accelerometer-right.png +0 -0
  420. package/static/devtools/Images/accelerometer-top.png +0 -0
  421. package/static/devtools/Images/baseline-icon.svg +1 -0
  422. package/static/devtools/Images/breaking_change_icon.svg +1 -0
  423. package/static/devtools/Images/checkboxCheckmark.svg +1 -0
  424. package/static/devtools/Images/checker.png +0 -0
  425. package/static/devtools/Images/chevrons.svg +1 -0
  426. package/static/devtools/Images/chromeDisabledSelect.png +0 -0
  427. package/static/devtools/Images/chromeDisabledSelect_2x.png +0 -0
  428. package/static/devtools/Images/chromeLeft.avif +0 -0
  429. package/static/devtools/Images/chromeMiddle.avif +0 -0
  430. package/static/devtools/Images/chromeRight.avif +0 -0
  431. package/static/devtools/Images/chromeSelect.svg +1 -0
  432. package/static/devtools/Images/chromeSelectDark.svg +1 -0
  433. package/static/devtools/Images/cssoverview_icons_2x.avif +0 -0
  434. package/static/devtools/Images/dropdown_7x6_icon.svg +1 -0
  435. package/static/devtools/Images/elements_panel_icon.svg +1 -0
  436. package/static/devtools/Images/errorWave.svg +1 -0
  437. package/static/devtools/Images/error_icon.svg +1 -0
  438. package/static/devtools/Images/feedback_thin_16x16_icon.svg +1 -0
  439. package/static/devtools/Images/flex-align-content-center-icon.svg +1 -0
  440. package/static/devtools/Images/flex-align-content-end-icon.svg +1 -0
  441. package/static/devtools/Images/flex-align-content-space-around-icon.svg +1 -0
  442. package/static/devtools/Images/flex-align-content-space-between-icon.svg +1 -0
  443. package/static/devtools/Images/flex-align-content-space-evenly-icon.svg +1 -0
  444. package/static/devtools/Images/flex-align-content-start-icon.svg +1 -0
  445. package/static/devtools/Images/flex-align-content-stretch-icon.svg +1 -0
  446. package/static/devtools/Images/flex-align-items-center-icon.svg +1 -0
  447. package/static/devtools/Images/flex-align-items-flex-end-icon.svg +1 -0
  448. package/static/devtools/Images/flex-align-items-flex-start-icon.svg +1 -0
  449. package/static/devtools/Images/flex-align-items-stretch-icon.svg +1 -0
  450. package/static/devtools/Images/flex-align-self-center-icon.svg +1 -0
  451. package/static/devtools/Images/flex-align-self-flex-end-icon.svg +1 -0
  452. package/static/devtools/Images/flex-align-self-flex-start-icon.svg +1 -0
  453. package/static/devtools/Images/flex-align-self-stretch-icon.svg +1 -0
  454. package/static/devtools/Images/flex-direction-icon.svg +1 -0
  455. package/static/devtools/Images/flex-justify-content-center-icon.svg +1 -0
  456. package/static/devtools/Images/flex-justify-content-flex-end-icon.svg +1 -0
  457. package/static/devtools/Images/flex-justify-content-flex-start-icon.svg +1 -0
  458. package/static/devtools/Images/flex-justify-content-space-around-icon.svg +1 -0
  459. package/static/devtools/Images/flex-justify-content-space-between-icon.svg +1 -0
  460. package/static/devtools/Images/flex-justify-content-space-evenly-icon.svg +1 -0
  461. package/static/devtools/Images/ic_checkmark_16x16.svg +3 -0
  462. package/static/devtools/Images/ic_delete_filter.svg +1 -0
  463. package/static/devtools/Images/ic_delete_list.svg +1 -0
  464. package/static/devtools/Images/ic_info_black_18dp.svg +1 -0
  465. package/static/devtools/Images/ic_page_next_16x16_icon.svg +1 -0
  466. package/static/devtools/Images/ic_page_prev_16x16_icon.svg +1 -0
  467. package/static/devtools/Images/ic_redo_16x16_icon.svg +1 -0
  468. package/static/devtools/Images/ic_show_node_16x16.svg +4 -0
  469. package/static/devtools/Images/ic_suggest_color.svg +6 -0
  470. package/static/devtools/Images/ic_undo_16x16_icon.svg +1 -0
  471. package/static/devtools/Images/ic_warning_black_18dp.svg +1 -0
  472. package/static/devtools/Images/issue-text-icon.svg +1 -0
  473. package/static/devtools/Images/largeIcons.svg +1 -0
  474. package/static/devtools/Images/lighthouse_logo.svg +1 -0
  475. package/static/devtools/Images/link_icon.svg +1 -0
  476. package/static/devtools/Images/mediumIcons.svg +1 -0
  477. package/static/devtools/Images/navigationControls.png +0 -0
  478. package/static/devtools/Images/navigationControls_2x.png +0 -0
  479. package/static/devtools/Images/network_panel_icon.svg +1 -0
  480. package/static/devtools/Images/nodeIcon.avif +0 -0
  481. package/static/devtools/Images/node_search_icon.svg +1 -0
  482. package/static/devtools/Images/popoverArrows.png +0 -0
  483. package/static/devtools/Images/profileGroupIcon.png +0 -0
  484. package/static/devtools/Images/profileIcon.png +0 -0
  485. package/static/devtools/Images/profileSmallIcon.png +0 -0
  486. package/static/devtools/Images/radioDot-dark-theme.png +0 -0
  487. package/static/devtools/Images/radioDot.png +0 -0
  488. package/static/devtools/Images/refresh_12x12_icon.svg +1 -0
  489. package/static/devtools/Images/resizeDiagonal.svg +1 -0
  490. package/static/devtools/Images/resizeHorizontal.svg +1 -0
  491. package/static/devtools/Images/resizeVertical.svg +1 -0
  492. package/static/devtools/Images/resourceCSSIcon.png +0 -0
  493. package/static/devtools/Images/resourceDocumentIcon.png +0 -0
  494. package/static/devtools/Images/resourceDocumentIconSmall.png +0 -0
  495. package/static/devtools/Images/resourceJSIcon.png +0 -0
  496. package/static/devtools/Images/resourcePlainIcon.png +0 -0
  497. package/static/devtools/Images/resourcePlainIconSmall.png +0 -0
  498. package/static/devtools/Images/resourcesTimeGraphIcon.avif +0 -0
  499. package/static/devtools/Images/searchNext.png +0 -0
  500. package/static/devtools/Images/searchPrev.png +0 -0
  501. package/static/devtools/Images/securityIcons.svg +1 -0
  502. package/static/devtools/Images/settings_14x14_icon.svg +1 -0
  503. package/static/devtools/Images/smallIcons.svg +1 -0
  504. package/static/devtools/Images/sources_panel_icon.svg +1 -0
  505. package/static/devtools/Images/speech.png +0 -0
  506. package/static/devtools/Images/toolbarResizerVertical.png +0 -0
  507. package/static/devtools/Images/touchCursor.png +0 -0
  508. package/static/devtools/Images/touchCursor_2x.png +0 -0
  509. package/static/devtools/Images/treeoutlineTriangles.svg +1 -0
  510. package/static/devtools/Images/warning_icon.svg +1 -0
  511. package/static/devtools/Images/whatsnew.avif +0 -0
  512. package/static/devtools/Tests.js +1654 -0
  513. package/static/devtools/accessibility/accessibility-legacy.js +1 -0
  514. package/static/devtools/accessibility/accessibility-meta.js +1 -0
  515. package/static/devtools/accessibility/accessibility.js +1 -0
  516. package/static/devtools/accessibility/accessibility_module.js +1 -0
  517. package/static/devtools/accessibility_test_runner/accessibility_test_runner.js +77 -0
  518. package/static/devtools/accessibility_test_runner/accessibility_test_runner_module.js +0 -0
  519. package/static/devtools/animation/animation-legacy.js +1 -0
  520. package/static/devtools/animation/animation-meta.js +1 -0
  521. package/static/devtools/animation/animation.js +1 -0
  522. package/static/devtools/animation/animation_module.js +1 -0
  523. package/static/devtools/application_test_runner/AppcacheTestRunner.js +220 -0
  524. package/static/devtools/application_test_runner/CacheStorageTestRunner.js +286 -0
  525. package/static/devtools/application_test_runner/IndexedDBTestRunner.js +476 -0
  526. package/static/devtools/application_test_runner/ResourceTreeTestRunner.js +99 -0
  527. package/static/devtools/application_test_runner/ResourcesTestRunner.js +167 -0
  528. package/static/devtools/application_test_runner/ServiceWorkersTestRunner.js +131 -0
  529. package/static/devtools/application_test_runner/application_test_runner.js +10 -0
  530. package/static/devtools/application_test_runner/application_test_runner_module.js +0 -0
  531. package/static/devtools/axe_core_test_runner/axe_core_test_runner.js +174 -0
  532. package/static/devtools/axe_core_test_runner/axe_core_test_runner_module.js +0 -0
  533. package/static/devtools/bindings/bindings-legacy.js +1 -0
  534. package/static/devtools/bindings/bindings.js +1 -0
  535. package/static/devtools/bindings_test_runner/AutomappingTestRunner.js +130 -0
  536. package/static/devtools/bindings_test_runner/BindingsTestRunner.js +238 -0
  537. package/static/devtools/bindings_test_runner/IsolatedFilesystemTestRunner.js +287 -0
  538. package/static/devtools/bindings_test_runner/OverridesTestRunner.js +26 -0
  539. package/static/devtools/bindings_test_runner/PersistenceTestRunner.js +109 -0
  540. package/static/devtools/bindings_test_runner/bindings_test_runner.js +9 -0
  541. package/static/devtools/bindings_test_runner/bindings_test_runner_module.js +0 -0
  542. package/static/devtools/browser_debugger/browser_debugger-legacy.js +1 -0
  543. package/static/devtools/browser_debugger/browser_debugger-meta.js +1 -0
  544. package/static/devtools/browser_debugger/browser_debugger.js +1 -0
  545. package/static/devtools/browser_debugger/browser_debugger_module.js +1 -0
  546. package/static/devtools/browser_sdk/browser_sdk-meta.js +1 -0
  547. package/static/devtools/browser_sdk/browser_sdk.js +1 -0
  548. package/static/devtools/changes/changes-legacy.js +1 -0
  549. package/static/devtools/changes/changes-meta.js +1 -0
  550. package/static/devtools/changes/changes.js +1 -0
  551. package/static/devtools/changes/changes_module.js +1 -0
  552. package/static/devtools/client_variations/client_variations.js +1 -0
  553. package/static/devtools/client_variations/client_variations_module.js +0 -0
  554. package/static/devtools/cm/cm.js +1 -0
  555. package/static/devtools/cm/cm_module.js +1 -0
  556. package/static/devtools/cm_headless/cm_headless.js +1 -0
  557. package/static/devtools/color_picker/color_picker-legacy.js +1 -0
  558. package/static/devtools/color_picker/color_picker.js +1 -0
  559. package/static/devtools/color_picker/color_picker_module.js +1 -0
  560. package/static/devtools/common/common-legacy.js +1 -0
  561. package/static/devtools/common/common.js +1 -0
  562. package/static/devtools/component_helpers/component_helpers.js +1 -0
  563. package/static/devtools/components/components-legacy.js +1 -0
  564. package/static/devtools/components/components.js +1 -0
  565. package/static/devtools/console/console-legacy.js +1 -0
  566. package/static/devtools/console/console-meta.js +1 -0
  567. package/static/devtools/console/console.js +6 -0
  568. package/static/devtools/console/console_module.js +1 -0
  569. package/static/devtools/console_counters/console_counters-legacy.js +1 -0
  570. package/static/devtools/console_counters/console_counters.js +1 -0
  571. package/static/devtools/console_test_runner/console_test_runner.js +696 -0
  572. package/static/devtools/console_test_runner/console_test_runner_module.js +0 -0
  573. package/static/devtools/cookie_table/cookie_table-legacy.js +1 -0
  574. package/static/devtools/cookie_table/cookie_table.js +1 -0
  575. package/static/devtools/cookie_table/cookie_table_module.js +1 -0
  576. package/static/devtools/coverage/coverage-legacy.js +1 -0
  577. package/static/devtools/coverage/coverage-meta.js +1 -0
  578. package/static/devtools/coverage/coverage.js +1 -0
  579. package/static/devtools/coverage/coverage_module.js +1 -0
  580. package/static/devtools/coverage_test_runner/coverage_test_runner.js +151 -0
  581. package/static/devtools/coverage_test_runner/coverage_test_runner_module.js +0 -0
  582. package/static/devtools/cpu_profiler_test_runner/cpu_profiler_test_runner.js +72 -0
  583. package/static/devtools/cpu_profiler_test_runner/cpu_profiler_test_runner_module.js +0 -0
  584. package/static/devtools/css_overview/css_overview-meta.js +1 -0
  585. package/static/devtools/css_overview/css_overview.js +146 -0
  586. package/static/devtools/css_overview/css_overview_module.js +1 -0
  587. package/static/devtools/data_grid/data_grid-legacy.js +1 -0
  588. package/static/devtools/data_grid/data_grid.js +1 -0
  589. package/static/devtools/data_grid/data_grid_module.js +1 -0
  590. package/static/devtools/data_grid_test_runner/data_grid_test_runner.js +78 -0
  591. package/static/devtools/data_grid_test_runner/data_grid_test_runner_module.js +0 -0
  592. package/static/devtools/developer_resources/developer_resources-legacy.js +1 -0
  593. package/static/devtools/developer_resources/developer_resources-meta.js +1 -0
  594. package/static/devtools/developer_resources/developer_resources.js +1 -0
  595. package/static/devtools/developer_resources/developer_resources_module.js +1 -0
  596. package/static/devtools/device_mode_test_runner/device_mode_test_runner.js +45 -0
  597. package/static/devtools/device_mode_test_runner/device_mode_test_runner_module.js +0 -0
  598. package/static/devtools/devtools_app.html +20 -0
  599. package/static/devtools/devtools_app.js +1 -0
  600. package/static/devtools/devtools_compatibility.js +1546 -0
  601. package/static/devtools/diff/diff-legacy.js +1 -0
  602. package/static/devtools/diff/diff.js +1 -0
  603. package/static/devtools/diff/diff_module.js +0 -0
  604. package/static/devtools/dom_extension/dom_extension.js +1 -0
  605. package/static/devtools/elements/elements-legacy.js +1 -0
  606. package/static/devtools/elements/elements-meta.js +1 -0
  607. package/static/devtools/elements/elements.js +469 -0
  608. package/static/devtools/elements/elements_module.js +1 -0
  609. package/static/devtools/elements_test_runner/EditDOMTestRunner.js +78 -0
  610. package/static/devtools/elements_test_runner/ElementsPanelShadowSelectionOnRefreshTestRunner.js +39 -0
  611. package/static/devtools/elements_test_runner/ElementsTestRunner.js +1280 -0
  612. package/static/devtools/elements_test_runner/SetOuterHTMLTestRunner.js +115 -0
  613. package/static/devtools/elements_test_runner/StylesUpdateLinksTestRunner.js +134 -0
  614. package/static/devtools/elements_test_runner/elements_test_runner.js +9 -0
  615. package/static/devtools/elements_test_runner/elements_test_runner_module.js +0 -0
  616. package/static/devtools/emulated_devices/emulated_devices_module.js +0 -0
  617. package/static/devtools/emulated_devices/optimized/MotoG4-landscape.avif +0 -0
  618. package/static/devtools/emulated_devices/optimized/MotoG4-portrait.avif +0 -0
  619. package/static/devtools/emulated_devices/optimized/Nexus5X-landscape.avif +0 -0
  620. package/static/devtools/emulated_devices/optimized/Nexus5X-portrait.avif +0 -0
  621. package/static/devtools/emulated_devices/optimized/Nexus6P-landscape.avif +0 -0
  622. package/static/devtools/emulated_devices/optimized/Nexus6P-portrait.avif +0 -0
  623. package/static/devtools/emulated_devices/optimized/google-nexus-5-horizontal-default-1x.avif +0 -0
  624. package/static/devtools/emulated_devices/optimized/google-nexus-5-horizontal-default-2x.avif +0 -0
  625. package/static/devtools/emulated_devices/optimized/google-nexus-5-horizontal-keyboard-1x.avif +0 -0
  626. package/static/devtools/emulated_devices/optimized/google-nexus-5-horizontal-keyboard-2x.avif +0 -0
  627. package/static/devtools/emulated_devices/optimized/google-nexus-5-horizontal-navigation-1x.avif +0 -0
  628. package/static/devtools/emulated_devices/optimized/google-nexus-5-horizontal-navigation-2x.avif +0 -0
  629. package/static/devtools/emulated_devices/optimized/google-nexus-5-vertical-default-1x.avif +0 -0
  630. package/static/devtools/emulated_devices/optimized/google-nexus-5-vertical-default-2x.avif +0 -0
  631. package/static/devtools/emulated_devices/optimized/google-nexus-5-vertical-keyboard-1x.avif +0 -0
  632. package/static/devtools/emulated_devices/optimized/google-nexus-5-vertical-keyboard-2x.avif +0 -0
  633. package/static/devtools/emulated_devices/optimized/google-nexus-5-vertical-navigation-1x.avif +0 -0
  634. package/static/devtools/emulated_devices/optimized/google-nexus-5-vertical-navigation-2x.avif +0 -0
  635. package/static/devtools/emulated_devices/optimized/google-nexus-5x-horizontal-default-1x.avif +0 -0
  636. package/static/devtools/emulated_devices/optimized/google-nexus-5x-horizontal-default-2x.avif +0 -0
  637. package/static/devtools/emulated_devices/optimized/google-nexus-5x-horizontal-keyboard-1x.avif +0 -0
  638. package/static/devtools/emulated_devices/optimized/google-nexus-5x-horizontal-keyboard-2x.avif +0 -0
  639. package/static/devtools/emulated_devices/optimized/google-nexus-5x-horizontal-navigation-1x.avif +0 -0
  640. package/static/devtools/emulated_devices/optimized/google-nexus-5x-horizontal-navigation-2x.avif +0 -0
  641. package/static/devtools/emulated_devices/optimized/google-nexus-5x-vertical-default-1x.avif +0 -0
  642. package/static/devtools/emulated_devices/optimized/google-nexus-5x-vertical-default-2x.avif +0 -0
  643. package/static/devtools/emulated_devices/optimized/google-nexus-5x-vertical-keyboard-1x.avif +0 -0
  644. package/static/devtools/emulated_devices/optimized/google-nexus-5x-vertical-keyboard-2x.avif +0 -0
  645. package/static/devtools/emulated_devices/optimized/google-nexus-5x-vertical-navigation-1x.avif +0 -0
  646. package/static/devtools/emulated_devices/optimized/google-nexus-5x-vertical-navigation-2x.avif +0 -0
  647. package/static/devtools/emulated_devices/optimized/iPad-landscape.avif +0 -0
  648. package/static/devtools/emulated_devices/optimized/iPad-portrait.avif +0 -0
  649. package/static/devtools/emulated_devices/optimized/iPhone5-landscape.avif +0 -0
  650. package/static/devtools/emulated_devices/optimized/iPhone5-portrait.avif +0 -0
  651. package/static/devtools/emulated_devices/optimized/iPhone6-landscape.avif +0 -0
  652. package/static/devtools/emulated_devices/optimized/iPhone6-portrait.avif +0 -0
  653. package/static/devtools/emulated_devices/optimized/iPhone6Plus-landscape.avif +0 -0
  654. package/static/devtools/emulated_devices/optimized/iPhone6Plus-portrait.avif +0 -0
  655. package/static/devtools/emulation/emulation-legacy.js +1 -0
  656. package/static/devtools/emulation/emulation-meta.js +1 -0
  657. package/static/devtools/emulation/emulation.js +1 -0
  658. package/static/devtools/event_listeners/event_listeners-legacy.js +1 -0
  659. package/static/devtools/event_listeners/event_listeners.js +1 -0
  660. package/static/devtools/event_listeners/event_listeners_module.js +1 -0
  661. package/static/devtools/extensions/extensions-legacy.js +1 -0
  662. package/static/devtools/extensions/extensions.js +1 -0
  663. package/static/devtools/extensions_test_runner/ExtensionsNetworkTestRunner.js +27 -0
  664. package/static/devtools/extensions_test_runner/ExtensionsTestRunner.js +68 -0
  665. package/static/devtools/extensions_test_runner/extensions_test_runner.js +6 -0
  666. package/static/devtools/extensions_test_runner/extensions_test_runner_module.js +0 -0
  667. package/static/devtools/formatter/formatter-legacy.js +1 -0
  668. package/static/devtools/formatter/formatter.js +1 -0
  669. package/static/devtools/formatter/formatter_module.js +0 -0
  670. package/static/devtools/formatter_worker/FormatterActions.js +1 -0
  671. package/static/devtools/formatter_worker/formatter_worker-entrypoint.js +1 -0
  672. package/static/devtools/formatter_worker/formatter_worker.js +1 -0
  673. package/static/devtools/har_importer/har_importer-legacy.js +1 -0
  674. package/static/devtools/har_importer/har_importer.js +1 -0
  675. package/static/devtools/har_importer/har_importer_module.js +0 -0
  676. package/static/devtools/heap_profiler_test_runner/heap_profiler_test_runner.js +740 -0
  677. package/static/devtools/heap_profiler_test_runner/heap_profiler_test_runner_module.js +0 -0
  678. package/static/devtools/heap_snapshot_model/heap_snapshot_model-legacy.js +1 -0
  679. package/static/devtools/heap_snapshot_model/heap_snapshot_model.js +1 -0
  680. package/static/devtools/heap_snapshot_model/heap_snapshot_model_module.js +0 -0
  681. package/static/devtools/heap_snapshot_worker/heap_snapshot_worker-entrypoint.js +1 -0
  682. package/static/devtools/heap_snapshot_worker/heap_snapshot_worker-legacy.js +1 -0
  683. package/static/devtools/heap_snapshot_worker/heap_snapshot_worker.js +1 -0
  684. package/static/devtools/heap_snapshot_worker/heap_snapshot_worker_module.js +0 -0
  685. package/static/devtools/help/help-legacy.js +1 -0
  686. package/static/devtools/help/help-meta.js +1 -0
  687. package/static/devtools/help/help.js +1 -0
  688. package/static/devtools/help/help_module.js +1 -0
  689. package/static/devtools/host/host-legacy.js +1 -0
  690. package/static/devtools/host/host.js +1 -0
  691. package/static/devtools/i18n/i18n.js +1 -0
  692. package/static/devtools/i18n/i18n_locales-tsconfig.json +8 -0
  693. package/static/devtools/i18n/locales/en-US.json +3566 -0
  694. package/static/devtools/inline_editor/inline_editor-legacy.js +1 -0
  695. package/static/devtools/inline_editor/inline_editor.js +203 -0
  696. package/static/devtools/inline_editor/inline_editor_module.js +1 -0
  697. package/static/devtools/input/input-legacy.js +1 -0
  698. package/static/devtools/input/input-meta.js +1 -0
  699. package/static/devtools/input/input.js +1 -0
  700. package/static/devtools/input/input_module.js +1 -0
  701. package/static/devtools/inspector.html +20 -0
  702. package/static/devtools/inspector.js +1 -0
  703. package/static/devtools/inspector_main/inspector_main-legacy.js +1 -0
  704. package/static/devtools/inspector_main/inspector_main-meta.js +1 -0
  705. package/static/devtools/inspector_main/inspector_main.js +1 -0
  706. package/static/devtools/integration_test_runner.html +14 -0
  707. package/static/devtools/integration_test_runner.js +2 -0
  708. package/static/devtools/issues/issues-legacy.js +1 -0
  709. package/static/devtools/issues/issues-meta.js +1 -0
  710. package/static/devtools/issues/issues.js +67 -0
  711. package/static/devtools/issues/issues_module.js +1 -0
  712. package/static/devtools/javascript_metadata/javascript_metadata-legacy.js +1 -0
  713. package/static/devtools/javascript_metadata/javascript_metadata.js +1 -0
  714. package/static/devtools/javascript_metadata/javascript_metadata_module.js +0 -0
  715. package/static/devtools/js_app.html +20 -0
  716. package/static/devtools/js_app.js +1 -0
  717. package/static/devtools/js_main/js_main-legacy.js +1 -0
  718. package/static/devtools/js_main/js_main.js +1 -0
  719. package/static/devtools/js_profiler/js_profiler-meta.js +1 -0
  720. package/static/devtools/js_profiler/js_profiler.js +1 -0
  721. package/static/devtools/js_profiler/js_profiler_module.js +0 -0
  722. package/static/devtools/layer_viewer/layer_viewer-legacy.js +1 -0
  723. package/static/devtools/layer_viewer/layer_viewer.js +1 -0
  724. package/static/devtools/layer_viewer/layer_viewer_module.js +1 -0
  725. package/static/devtools/layers/layers-legacy.js +1 -0
  726. package/static/devtools/layers/layers-meta.js +1 -0
  727. package/static/devtools/layers/layers.js +1 -0
  728. package/static/devtools/layers/layers_module.js +0 -0
  729. package/static/devtools/layers_test_runner/layers_test_runner.js +156 -0
  730. package/static/devtools/layers_test_runner/layers_test_runner_module.js +0 -0
  731. package/static/devtools/lighthouse/lighthouse-legacy.js +1 -0
  732. package/static/devtools/lighthouse/lighthouse-meta.js +1 -0
  733. package/static/devtools/lighthouse/lighthouse.js +70 -0
  734. package/static/devtools/lighthouse/lighthouse_module.js +1 -0
  735. package/static/devtools/lighthouse_test_runner/lighthouse_test_runner.js +136 -0
  736. package/static/devtools/lighthouse_test_runner/lighthouse_test_runner_module.js +0 -0
  737. package/static/devtools/lighthouse_worker/LighthouseService.js +195 -0
  738. package/static/devtools/lighthouse_worker/lighthouse_worker.js +6 -0
  739. package/static/devtools/lighthouse_worker.js +1 -0
  740. package/static/devtools/linear_memory_inspector/linear_memory_inspector-legacy.js +1 -0
  741. package/static/devtools/linear_memory_inspector/linear_memory_inspector-meta.js +1 -0
  742. package/static/devtools/linear_memory_inspector/linear_memory_inspector.js +399 -0
  743. package/static/devtools/linear_memory_inspector/linear_memory_inspector_module.js +0 -0
  744. package/static/devtools/main/main-legacy.js +1 -0
  745. package/static/devtools/main/main.js +1 -0
  746. package/static/devtools/media/media-legacy.js +1 -0
  747. package/static/devtools/media/media-meta.js +1 -0
  748. package/static/devtools/media/media.js +1 -0
  749. package/static/devtools/media/media_module.js +1 -0
  750. package/static/devtools/mobile_throttling/mobile_throttling-legacy.js +1 -0
  751. package/static/devtools/mobile_throttling/mobile_throttling-meta.js +1 -0
  752. package/static/devtools/mobile_throttling/mobile_throttling.js +1 -0
  753. package/static/devtools/ndb_app.html +20 -0
  754. package/static/devtools/ndb_app.js +1 -0
  755. package/static/devtools/network/network-legacy.js +1 -0
  756. package/static/devtools/network/network-meta.js +1 -0
  757. package/static/devtools/network/network.js +72 -0
  758. package/static/devtools/network/network_module.js +1 -0
  759. package/static/devtools/network_test_runner/network_test_runner.js +280 -0
  760. package/static/devtools/network_test_runner/network_test_runner_module.js +0 -0
  761. package/static/devtools/node_app.html +20 -0
  762. package/static/devtools/node_app.js +1 -0
  763. package/static/devtools/node_debugger/node_debugger-meta.js +1 -0
  764. package/static/devtools/node_debugger/node_debugger.js +1 -0
  765. package/static/devtools/node_debugger/node_debugger_module.js +0 -0
  766. package/static/devtools/node_main/node_main-legacy.js +1 -0
  767. package/static/devtools/node_main/node_main-meta.js +1 -0
  768. package/static/devtools/node_main/node_main.js +1 -0
  769. package/static/devtools/object_ui/object_ui-legacy.js +1 -0
  770. package/static/devtools/object_ui/object_ui.js +3 -0
  771. package/static/devtools/object_ui/object_ui_module.js +1 -0
  772. package/static/devtools/perf_ui/perf_ui-legacy.js +1 -0
  773. package/static/devtools/perf_ui/perf_ui.js +152 -0
  774. package/static/devtools/perf_ui/perf_ui_module.js +1 -0
  775. package/static/devtools/performance_monitor/performance_monitor-legacy.js +1 -0
  776. package/static/devtools/performance_monitor/performance_monitor-meta.js +1 -0
  777. package/static/devtools/performance_monitor/performance_monitor.js +1 -0
  778. package/static/devtools/performance_monitor/performance_monitor_module.js +1 -0
  779. package/static/devtools/performance_test_runner/TimelineDataTestRunner.js +5375 -0
  780. package/static/devtools/performance_test_runner/TimelineTestRunner.js +446 -0
  781. package/static/devtools/performance_test_runner/performance_test_runner.js +6 -0
  782. package/static/devtools/performance_test_runner/performance_test_runner_module.js +0 -0
  783. package/static/devtools/persistence/persistence-legacy.js +1 -0
  784. package/static/devtools/persistence/persistence-meta.js +1 -0
  785. package/static/devtools/persistence/persistence.js +1 -0
  786. package/static/devtools/platform/platform.js +1 -0
  787. package/static/devtools/profiler/profiler-legacy.js +1 -0
  788. package/static/devtools/profiler/profiler-meta.js +1 -0
  789. package/static/devtools/profiler/profiler.js +8 -0
  790. package/static/devtools/profiler/profiler_module.js +1 -0
  791. package/static/devtools/protocol_client/protocol_client-legacy.js +1 -0
  792. package/static/devtools/protocol_client/protocol_client.js +1 -0
  793. package/static/devtools/protocol_monitor/protocol_monitor-legacy.js +1 -0
  794. package/static/devtools/protocol_monitor/protocol_monitor-meta.js +1 -0
  795. package/static/devtools/protocol_monitor/protocol_monitor.js +1 -0
  796. package/static/devtools/protocol_monitor/protocol_monitor_module.js +1 -0
  797. package/static/devtools/quick_open/quick_open-legacy.js +1 -0
  798. package/static/devtools/quick_open/quick_open.js +1 -0
  799. package/static/devtools/quick_open/quick_open_module.js +1 -0
  800. package/static/devtools/recorder/recorder.js +1 -0
  801. package/static/devtools/resources/resources-legacy.js +1 -0
  802. package/static/devtools/resources/resources-meta.js +1 -0
  803. package/static/devtools/resources/resources.js +28 -0
  804. package/static/devtools/resources/resources_module.js +1 -0
  805. package/static/devtools/root/root-legacy.js +1 -0
  806. package/static/devtools/root/root.js +1 -0
  807. package/static/devtools/screencast/screencast-legacy.js +1 -0
  808. package/static/devtools/screencast/screencast.js +1 -0
  809. package/static/devtools/sdk/sdk-legacy.js +1 -0
  810. package/static/devtools/sdk/sdk.js +2 -0
  811. package/static/devtools/sdk_test_runner/sdk_test_runner.js +297 -0
  812. package/static/devtools/sdk_test_runner/sdk_test_runner_module.js +0 -0
  813. package/static/devtools/search/search-legacy.js +1 -0
  814. package/static/devtools/search/search.js +1 -0
  815. package/static/devtools/search/search_module.js +1 -0
  816. package/static/devtools/security/security-legacy.js +1 -0
  817. package/static/devtools/security/security-meta.js +1 -0
  818. package/static/devtools/security/security.js +1 -0
  819. package/static/devtools/security/security_module.js +1 -0
  820. package/static/devtools/security_test_runner/security_test_runner.js +32 -0
  821. package/static/devtools/security_test_runner/security_test_runner_module.js +0 -0
  822. package/static/devtools/services/services-legacy.js +1 -0
  823. package/static/devtools/services/services.js +1 -0
  824. package/static/devtools/settings/settings-legacy.js +1 -0
  825. package/static/devtools/settings/settings-meta.js +1 -0
  826. package/static/devtools/settings/settings.js +1 -0
  827. package/static/devtools/settings/settings_module.js +1 -0
  828. package/static/devtools/shell.js +1 -0
  829. package/static/devtools/snippets/snippets-legacy.js +1 -0
  830. package/static/devtools/snippets/snippets.js +1 -0
  831. package/static/devtools/snippets/snippets_module.js +0 -0
  832. package/static/devtools/source_frame/source_frame-legacy.js +1 -0
  833. package/static/devtools/source_frame/source_frame.js +1 -0
  834. package/static/devtools/source_frame/source_frame_module.js +1 -0
  835. package/static/devtools/sources/sources-legacy.js +1 -0
  836. package/static/devtools/sources/sources-meta.js +1 -0
  837. package/static/devtools/sources/sources.js +13 -0
  838. package/static/devtools/sources/sources_module.js +1 -0
  839. package/static/devtools/sources_test_runner/AutocompleteTestRunner.js +46 -0
  840. package/static/devtools/sources_test_runner/DebuggerTestRunner.js +895 -0
  841. package/static/devtools/sources_test_runner/EditorTestRunner.js +237 -0
  842. package/static/devtools/sources_test_runner/LiveEditTestRunner.js +33 -0
  843. package/static/devtools/sources_test_runner/SearchTestRunner.js +158 -0
  844. package/static/devtools/sources_test_runner/SourcesTestRunner.js +173 -0
  845. package/static/devtools/sources_test_runner/sources_test_runner.js +10 -0
  846. package/static/devtools/sources_test_runner/sources_test_runner_module.js +0 -0
  847. package/static/devtools/startup/startup.js +1 -0
  848. package/static/devtools/test_runner/test_runner.js +1 -0
  849. package/static/devtools/text_editor/text_editor-legacy.js +1 -0
  850. package/static/devtools/text_editor/text_editor.js +1 -0
  851. package/static/devtools/text_editor/text_editor_module.js +1 -0
  852. package/static/devtools/text_utils/text_utils-legacy.js +1 -0
  853. package/static/devtools/text_utils/text_utils.js +1 -0
  854. package/static/devtools/theme_support/theme_support.js +1 -0
  855. package/static/devtools/third_party/acorn/acorn-tsconfig.json +8 -0
  856. package/static/devtools/third_party/acorn/acorn.js +1 -0
  857. package/static/devtools/third_party/acorn/package/dist/acorn.d.ts +209 -0
  858. package/static/devtools/third_party/acorn/package/dist/acorn.mjs +5261 -0
  859. package/static/devtools/third_party/acorn/package/dist/acorn.mjs.d.ts +2 -0
  860. package/static/devtools/third_party/acorn/package/dist/acorn.mjs.map +1 -0
  861. package/static/devtools/third_party/acorn-loose/acorn-loose-tsconfig.json +8 -0
  862. package/static/devtools/third_party/acorn-loose/package/dist/acorn-loose.d.ts +16 -0
  863. package/static/devtools/third_party/acorn-loose/package/dist/acorn-loose.mjs +1418 -0
  864. package/static/devtools/third_party/axe-core/axe.js +16423 -0
  865. package/static/devtools/third_party/chromium/chromium-tsconfig.json +8 -0
  866. package/static/devtools/third_party/chromium/client-variations/ClientVariations.d.ts +13 -0
  867. package/static/devtools/third_party/chromium/client-variations/ClientVariations.js +27 -0
  868. package/static/devtools/third_party/codemirror/codemirror-tsconfig.json +72 -0
  869. package/static/devtools/third_party/codemirror/package/addon/comment/comment.d.ts +4 -0
  870. package/static/devtools/third_party/codemirror/package/addon/comment/comment.js +211 -0
  871. package/static/devtools/third_party/codemirror/package/addon/edit/closebrackets.d.ts +1 -0
  872. package/static/devtools/third_party/codemirror/package/addon/edit/closebrackets.js +201 -0
  873. package/static/devtools/third_party/codemirror/package/addon/edit/matchbrackets.d.ts +1 -0
  874. package/static/devtools/third_party/codemirror/package/addon/edit/matchbrackets.js +158 -0
  875. package/static/devtools/third_party/codemirror/package/addon/fold/brace-fold.d.ts +1 -0
  876. package/static/devtools/third_party/codemirror/package/addon/fold/brace-fold.js +105 -0
  877. package/static/devtools/third_party/codemirror/package/addon/fold/foldcode.d.ts +1 -0
  878. package/static/devtools/third_party/codemirror/package/addon/fold/foldcode.js +157 -0
  879. package/static/devtools/third_party/codemirror/package/addon/fold/foldgutter.d.ts +1 -0
  880. package/static/devtools/third_party/codemirror/package/addon/fold/foldgutter.js +163 -0
  881. package/static/devtools/third_party/codemirror/package/addon/mode/multiplex.d.ts +1 -0
  882. package/static/devtools/third_party/codemirror/package/addon/mode/multiplex.js +131 -0
  883. package/static/devtools/third_party/codemirror/package/addon/mode/overlay.d.ts +1 -0
  884. package/static/devtools/third_party/codemirror/package/addon/mode/overlay.js +90 -0
  885. package/static/devtools/third_party/codemirror/package/addon/mode/simple.d.ts +1 -0
  886. package/static/devtools/third_party/codemirror/package/addon/mode/simple.js +216 -0
  887. package/static/devtools/third_party/codemirror/package/addon/runmode/runmode-standalone.d.ts +1 -0
  888. package/static/devtools/third_party/codemirror/package/addon/runmode/runmode-standalone.js +333 -0
  889. package/static/devtools/third_party/codemirror/package/addon/selection/active-line.d.ts +1 -0
  890. package/static/devtools/third_party/codemirror/package/addon/selection/active-line.js +72 -0
  891. package/static/devtools/third_party/codemirror/package/addon/selection/mark-selection.d.ts +1 -0
  892. package/static/devtools/third_party/codemirror/package/addon/selection/mark-selection.js +119 -0
  893. package/static/devtools/third_party/codemirror/package/lib/codemirror.d.ts +1 -0
  894. package/static/devtools/third_party/codemirror/package/lib/codemirror.js +9800 -0
  895. package/static/devtools/third_party/codemirror/package/mode/clike/clike.d.ts +4 -0
  896. package/static/devtools/third_party/codemirror/package/mode/clike/clike.js +935 -0
  897. package/static/devtools/third_party/codemirror/package/mode/clojure/clojure.d.ts +4 -0
  898. package/static/devtools/third_party/codemirror/package/mode/clojure/clojure.js +292 -0
  899. package/static/devtools/third_party/codemirror/package/mode/coffeescript/coffeescript.d.ts +4 -0
  900. package/static/devtools/third_party/codemirror/package/mode/coffeescript/coffeescript.js +359 -0
  901. package/static/devtools/third_party/codemirror/package/mode/css/css.d.ts +1 -0
  902. package/static/devtools/third_party/codemirror/package/mode/css/css.js +864 -0
  903. package/static/devtools/third_party/codemirror/package/mode/htmlembedded/htmlembedded.d.ts +1 -0
  904. package/static/devtools/third_party/codemirror/package/mode/htmlembedded/htmlembedded.js +37 -0
  905. package/static/devtools/third_party/codemirror/package/mode/htmlmixed/htmlmixed.d.ts +1 -0
  906. package/static/devtools/third_party/codemirror/package/mode/htmlmixed/htmlmixed.js +153 -0
  907. package/static/devtools/third_party/codemirror/package/mode/javascript/javascript.d.ts +1 -0
  908. package/static/devtools/third_party/codemirror/package/mode/javascript/javascript.js +942 -0
  909. package/static/devtools/third_party/codemirror/package/mode/jsx/jsx.d.ts +4 -0
  910. package/static/devtools/third_party/codemirror/package/mode/jsx/jsx.js +148 -0
  911. package/static/devtools/third_party/codemirror/package/mode/livescript/livescript.d.ts +4 -0
  912. package/static/devtools/third_party/codemirror/package/mode/livescript/livescript.js +280 -0
  913. package/static/devtools/third_party/codemirror/package/mode/markdown/markdown.d.ts +1 -0
  914. package/static/devtools/third_party/codemirror/package/mode/markdown/markdown.js +886 -0
  915. package/static/devtools/third_party/codemirror/package/mode/php/php.d.ts +1 -0
  916. package/static/devtools/third_party/codemirror/package/mode/php/php.js +234 -0
  917. package/static/devtools/third_party/codemirror/package/mode/python/python.d.ts +1 -0
  918. package/static/devtools/third_party/codemirror/package/mode/python/python.js +399 -0
  919. package/static/devtools/third_party/codemirror/package/mode/shell/shell.d.ts +1 -0
  920. package/static/devtools/third_party/codemirror/package/mode/shell/shell.js +168 -0
  921. package/static/devtools/third_party/codemirror/package/mode/wast/wast.d.ts +1 -0
  922. package/static/devtools/third_party/codemirror/package/mode/wast/wast.js +41 -0
  923. package/static/devtools/third_party/codemirror/package/mode/xml/xml.d.ts +1 -0
  924. package/static/devtools/third_party/codemirror/package/mode/xml/xml.js +413 -0
  925. package/static/devtools/third_party/i18n/bundle-tsconfig.json +8 -0
  926. package/static/devtools/third_party/i18n/i18n.d.ts +108 -0
  927. package/static/devtools/third_party/i18n/i18n.js +4336 -0
  928. package/static/devtools/third_party/lighthouse/lighthouse-dt-bundle.d.ts +1 -0
  929. package/static/devtools/third_party/lighthouse/lighthouse-dt-bundle.js +1140 -0
  930. package/static/devtools/third_party/lighthouse/lighthouse-tsconfig.json +10 -0
  931. package/static/devtools/third_party/lighthouse/locales/ar-XB.json +2066 -0
  932. package/static/devtools/third_party/lighthouse/locales/ar.json +2066 -0
  933. package/static/devtools/third_party/lighthouse/locales/bg.json +2066 -0
  934. package/static/devtools/third_party/lighthouse/locales/ca.json +2066 -0
  935. package/static/devtools/third_party/lighthouse/locales/cs.json +2066 -0
  936. package/static/devtools/third_party/lighthouse/locales/da.json +2066 -0
  937. package/static/devtools/third_party/lighthouse/locales/de.json +2066 -0
  938. package/static/devtools/third_party/lighthouse/locales/el.json +2066 -0
  939. package/static/devtools/third_party/lighthouse/locales/en-GB.json +2066 -0
  940. package/static/devtools/third_party/lighthouse/locales/en-US.json +2297 -0
  941. package/static/devtools/third_party/lighthouse/locales/en-XA.json +2066 -0
  942. package/static/devtools/third_party/lighthouse/locales/en-XL.json +2297 -0
  943. package/static/devtools/third_party/lighthouse/locales/es-419.json +2066 -0
  944. package/static/devtools/third_party/lighthouse/locales/es.json +2066 -0
  945. package/static/devtools/third_party/lighthouse/locales/fi.json +2066 -0
  946. package/static/devtools/third_party/lighthouse/locales/fil.json +2066 -0
  947. package/static/devtools/third_party/lighthouse/locales/fr.json +2066 -0
  948. package/static/devtools/third_party/lighthouse/locales/he.json +2066 -0
  949. package/static/devtools/third_party/lighthouse/locales/hi.json +2066 -0
  950. package/static/devtools/third_party/lighthouse/locales/hr.json +2066 -0
  951. package/static/devtools/third_party/lighthouse/locales/hu.json +2066 -0
  952. package/static/devtools/third_party/lighthouse/locales/id.json +2066 -0
  953. package/static/devtools/third_party/lighthouse/locales/it.json +2066 -0
  954. package/static/devtools/third_party/lighthouse/locales/ja.json +2066 -0
  955. package/static/devtools/third_party/lighthouse/locales/ko.json +2066 -0
  956. package/static/devtools/third_party/lighthouse/locales/lt.json +2066 -0
  957. package/static/devtools/third_party/lighthouse/locales/lv.json +2066 -0
  958. package/static/devtools/third_party/lighthouse/locales/nl.json +2066 -0
  959. package/static/devtools/third_party/lighthouse/locales/no.json +2066 -0
  960. package/static/devtools/third_party/lighthouse/locales/pl.json +2066 -0
  961. package/static/devtools/third_party/lighthouse/locales/pt-PT.json +2066 -0
  962. package/static/devtools/third_party/lighthouse/locales/pt.json +2066 -0
  963. package/static/devtools/third_party/lighthouse/locales/ro.json +2066 -0
  964. package/static/devtools/third_party/lighthouse/locales/ru.json +2066 -0
  965. package/static/devtools/third_party/lighthouse/locales/sk.json +2066 -0
  966. package/static/devtools/third_party/lighthouse/locales/sl.json +2066 -0
  967. package/static/devtools/third_party/lighthouse/locales/sr-Latn.json +2066 -0
  968. package/static/devtools/third_party/lighthouse/locales/sr.json +2066 -0
  969. package/static/devtools/third_party/lighthouse/locales/sv.json +2066 -0
  970. package/static/devtools/third_party/lighthouse/locales/ta.json +2066 -0
  971. package/static/devtools/third_party/lighthouse/locales/te.json +2066 -0
  972. package/static/devtools/third_party/lighthouse/locales/th.json +2066 -0
  973. package/static/devtools/third_party/lighthouse/locales/tr.json +2066 -0
  974. package/static/devtools/third_party/lighthouse/locales/uk.json +2066 -0
  975. package/static/devtools/third_party/lighthouse/locales/vi.json +2066 -0
  976. package/static/devtools/third_party/lighthouse/locales/zh-HK.json +2066 -0
  977. package/static/devtools/third_party/lighthouse/locales/zh-TW.json +2066 -0
  978. package/static/devtools/third_party/lighthouse/locales/zh.json +2066 -0
  979. package/static/devtools/third_party/lighthouse/report-assets/report-generator.d.ts +1 -0
  980. package/static/devtools/third_party/lighthouse/report-assets/report-generator.js +167 -0
  981. package/static/devtools/third_party/lighthouse/report-assets/report.d.ts +1 -0
  982. package/static/devtools/third_party/lighthouse/report-assets/report.js +5032 -0
  983. package/static/devtools/third_party/lit-html/lit-html-tsconfig.json +22 -0
  984. package/static/devtools/third_party/lit-html/lit-html.js +120 -0
  985. package/static/devtools/third_party/lit-html/package/directives/class-map.d.ts +28 -0
  986. package/static/devtools/third_party/lit-html/package/directives/class-map.js +101 -0
  987. package/static/devtools/third_party/lit-html/package/directives/class-map.js.map +1 -0
  988. package/static/devtools/third_party/lit-html/package/directives/if-defined.d.ts +22 -0
  989. package/static/devtools/third_party/lit-html/package/directives/if-defined.js +37 -0
  990. package/static/devtools/third_party/lit-html/package/directives/if-defined.js.map +1 -0
  991. package/static/devtools/third_party/lit-html/package/directives/live.d.ts +38 -0
  992. package/static/devtools/third_party/lit-html/package/directives/live.js +73 -0
  993. package/static/devtools/third_party/lit-html/package/directives/live.js.map +1 -0
  994. package/static/devtools/third_party/lit-html/package/directives/repeat.d.ts +37 -0
  995. package/static/devtools/third_party/lit-html/package/directives/repeat.js +415 -0
  996. package/static/devtools/third_party/lit-html/package/directives/repeat.js.map +1 -0
  997. package/static/devtools/third_party/lit-html/package/directives/style-map.d.ts +36 -0
  998. package/static/devtools/third_party/lit-html/package/directives/style-map.js +78 -0
  999. package/static/devtools/third_party/lit-html/package/directives/style-map.js.map +1 -0
  1000. package/static/devtools/third_party/lit-html/package/lib/default-template-processor.d.ts +39 -0
  1001. package/static/devtools/third_party/lit-html/package/lib/default-template-processor.js +52 -0
  1002. package/static/devtools/third_party/lit-html/package/lib/default-template-processor.js.map +1 -0
  1003. package/static/devtools/third_party/lit-html/package/lib/directive.d.ts +59 -0
  1004. package/static/devtools/third_party/lit-html/package/lib/directive.js +63 -0
  1005. package/static/devtools/third_party/lit-html/package/lib/directive.js.map +1 -0
  1006. package/static/devtools/third_party/lit-html/package/lib/dom.d.ts +29 -0
  1007. package/static/devtools/third_party/lit-html/package/lib/dom.js +44 -0
  1008. package/static/devtools/third_party/lit-html/package/lib/dom.js.map +1 -0
  1009. package/static/devtools/third_party/lit-html/package/lib/part.d.ts +46 -0
  1010. package/static/devtools/third_party/lit-html/package/lib/part.js +23 -0
  1011. package/static/devtools/third_party/lit-html/package/lib/part.js.map +1 -0
  1012. package/static/devtools/third_party/lit-html/package/lib/parts.d.ts +148 -0
  1013. package/static/devtools/third_party/lit-html/package/lib/parts.js +476 -0
  1014. package/static/devtools/third_party/lit-html/package/lib/parts.js.map +1 -0
  1015. package/static/devtools/third_party/lit-html/package/lib/render.d.ts +33 -0
  1016. package/static/devtools/third_party/lit-html/package/lib/render.js +43 -0
  1017. package/static/devtools/third_party/lit-html/package/lib/render.js.map +1 -0
  1018. package/static/devtools/third_party/lit-html/package/lib/template-factory.d.ts +57 -0
  1019. package/static/devtools/third_party/lit-html/package/lib/template-factory.js +48 -0
  1020. package/static/devtools/third_party/lit-html/package/lib/template-factory.js.map +1 -0
  1021. package/static/devtools/third_party/lit-html/package/lib/template-instance.d.ts +30 -0
  1022. package/static/devtools/third_party/lit-html/package/lib/template-instance.js +134 -0
  1023. package/static/devtools/third_party/lit-html/package/lib/template-instance.js.map +1 -0
  1024. package/static/devtools/third_party/lit-html/package/lib/template-result.d.ts +42 -0
  1025. package/static/devtools/third_party/lit-html/package/lib/template-result.js +131 -0
  1026. package/static/devtools/third_party/lit-html/package/lib/template-result.js.map +1 -0
  1027. package/static/devtools/third_party/lit-html/package/lib/template.d.ts +92 -0
  1028. package/static/devtools/third_party/lit-html/package/lib/template.js +215 -0
  1029. package/static/devtools/third_party/lit-html/package/lib/template.js.map +1 -0
  1030. package/static/devtools/third_party/lit-html/package/lit-html.d.ts +42 -0
  1031. package/static/devtools/third_party/lit-html/package/lit-html.js +59 -0
  1032. package/static/devtools/third_party/lit-html/package/lit-html.js.map +1 -0
  1033. package/static/devtools/third_party/marked/marked-tsconfig.json +8 -0
  1034. package/static/devtools/third_party/marked/marked.js +1 -0
  1035. package/static/devtools/third_party/marked/package/lib/marked.esm.d.ts +1 -0
  1036. package/static/devtools/third_party/marked/package/lib/marked.esm.js +2584 -0
  1037. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/api-docs-entry.d.ts +53 -0
  1038. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/api-docs-entry.d.ts.map +1 -0
  1039. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/api-docs-entry.js +64 -0
  1040. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Accessibility.d.ts +176 -0
  1041. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Accessibility.d.ts.map +1 -0
  1042. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Accessibility.js +356 -0
  1043. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.d.ts +21 -0
  1044. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.d.ts.map +1 -0
  1045. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.js +81 -0
  1046. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.d.ts +423 -0
  1047. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.d.ts.map +1 -0
  1048. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.js +516 -0
  1049. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.d.ts +39 -0
  1050. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.d.ts.map +1 -0
  1051. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js +76 -0
  1052. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserWebSocketTransport.d.ts +26 -0
  1053. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserWebSocketTransport.d.ts.map +1 -0
  1054. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserWebSocketTransport.js +30 -0
  1055. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Connection.d.ts +120 -0
  1056. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Connection.d.ts.map +1 -0
  1057. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Connection.js +266 -0
  1058. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectionTransport.d.ts +22 -0
  1059. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectionTransport.d.ts.map +1 -0
  1060. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectionTransport.js +15 -0
  1061. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.d.ts +72 -0
  1062. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.d.ts.map +1 -0
  1063. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.js +60 -0
  1064. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Coverage.d.ts +181 -0
  1065. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Coverage.d.ts.map +1 -0
  1066. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Coverage.js +316 -0
  1067. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.d.ts +174 -0
  1068. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.d.ts.map +1 -0
  1069. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.js +647 -0
  1070. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Debug.d.ts +53 -0
  1071. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Debug.d.ts.map +1 -0
  1072. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Debug.js +77 -0
  1073. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/DeviceDescriptors.d.ts +33 -0
  1074. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/DeviceDescriptors.d.ts.map +1 -0
  1075. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/DeviceDescriptors.js +873 -0
  1076. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Dialog.d.ts +76 -0
  1077. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Dialog.d.ts.map +1 -0
  1078. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Dialog.js +92 -0
  1079. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/EmulationManager.d.ts +25 -0
  1080. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/EmulationManager.d.ts.map +1 -0
  1081. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/EmulationManager.js +33 -0
  1082. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.d.ts +34 -0
  1083. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.d.ts.map +1 -0
  1084. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.js +37 -0
  1085. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/EvalTypes.d.ts +59 -0
  1086. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/EvalTypes.d.ts.map +1 -0
  1087. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/EvalTypes.js +15 -0
  1088. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/EventEmitter.d.ts +89 -0
  1089. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/EventEmitter.d.ts.map +1 -0
  1090. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/EventEmitter.js +109 -0
  1091. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Events.d.ts +82 -0
  1092. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Events.d.ts.map +1 -0
  1093. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Events.js +83 -0
  1094. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/ExecutionContext.d.ts +189 -0
  1095. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/ExecutionContext.d.ts.map +1 -0
  1096. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/ExecutionContext.js +313 -0
  1097. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/FileChooser.d.ts +60 -0
  1098. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/FileChooser.d.ts.map +1 -0
  1099. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/FileChooser.js +66 -0
  1100. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.d.ts +735 -0
  1101. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.d.ts.map +1 -0
  1102. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.js +962 -0
  1103. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPRequest.d.ts +276 -0
  1104. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPRequest.d.ts.map +1 -0
  1105. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPRequest.js +421 -0
  1106. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPResponse.d.ts +128 -0
  1107. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPResponse.d.ts.map +1 -0
  1108. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPResponse.js +150 -0
  1109. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Input.d.ts +322 -0
  1110. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Input.d.ts.map +1 -0
  1111. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Input.js +463 -0
  1112. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.d.ts +439 -0
  1113. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.d.ts.map +1 -0
  1114. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.js +724 -0
  1115. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/LifecycleWatcher.d.ts +62 -0
  1116. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/LifecycleWatcher.d.ts.map +1 -0
  1117. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/LifecycleWatcher.js +145 -0
  1118. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkManager.d.ts +80 -0
  1119. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkManager.d.ts.map +1 -0
  1120. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkManager.js +262 -0
  1121. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/PDFOptions.d.ts +152 -0
  1122. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/PDFOptions.d.ts.map +1 -0
  1123. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/PDFOptions.js +31 -0
  1124. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Page.d.ts +910 -0
  1125. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Page.d.ts.map +1 -0
  1126. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Page.js +1343 -0
  1127. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Product.d.ts +21 -0
  1128. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Product.d.ts.map +1 -0
  1129. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Product.js +15 -0
  1130. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Puppeteer.d.ts +135 -0
  1131. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Puppeteer.d.ts.map +1 -0
  1132. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Puppeteer.js +133 -0
  1133. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/PuppeteerViewport.d.ts +24 -0
  1134. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/PuppeteerViewport.d.ts.map +1 -0
  1135. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/PuppeteerViewport.js +0 -0
  1136. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/QueryHandler.d.ts +66 -0
  1137. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/QueryHandler.d.ts.map +1 -0
  1138. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/QueryHandler.js +157 -0
  1139. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/SecurityDetails.d.ts +61 -0
  1140. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/SecurityDetails.d.ts.map +1 -0
  1141. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/SecurityDetails.js +72 -0
  1142. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Target.d.ts +98 -0
  1143. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Target.d.ts.map +1 -0
  1144. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Target.js +137 -0
  1145. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/TimeoutSettings.d.ts +28 -0
  1146. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/TimeoutSettings.d.ts.map +1 -0
  1147. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/TimeoutSettings.js +43 -0
  1148. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Tracing.d.ts +47 -0
  1149. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Tracing.d.ts.map +1 -0
  1150. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/Tracing.js +94 -0
  1151. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/USKeyboardLayout.d.ts +40 -0
  1152. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/USKeyboardLayout.d.ts.map +1 -0
  1153. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/USKeyboardLayout.js +403 -0
  1154. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/WebWorker.d.ts +102 -0
  1155. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/WebWorker.d.ts.map +1 -0
  1156. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/WebWorker.js +109 -0
  1157. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/assert.d.ts +22 -0
  1158. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/assert.d.ts.map +1 -0
  1159. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/assert.js +24 -0
  1160. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/fetch.d.ts +17 -0
  1161. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/fetch.d.ts.map +1 -0
  1162. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/fetch.js +20 -0
  1163. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/helper.d.ts +66 -0
  1164. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/helper.d.ts.map +1 -0
  1165. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/common/helper.js +288 -0
  1166. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/environment.d.ts +17 -0
  1167. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/environment.d.ts.map +1 -0
  1168. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/environment.js +16 -0
  1169. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.d.ts +18 -0
  1170. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.d.ts.map +1 -0
  1171. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.js +39 -0
  1172. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/initialize-web.d.ts +18 -0
  1173. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/initialize-web.d.ts.map +1 -0
  1174. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/initialize-web.js +22 -0
  1175. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserFetcher.d.ts +132 -0
  1176. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserFetcher.d.ts.map +1 -0
  1177. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserFetcher.js +468 -0
  1178. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.d.ts +40 -0
  1179. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.d.ts.map +1 -0
  1180. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.js +197 -0
  1181. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node/LaunchOptions.d.ts +42 -0
  1182. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node/LaunchOptions.d.ts.map +1 -0
  1183. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node/LaunchOptions.js +0 -0
  1184. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.d.ts +16 -0
  1185. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.d.ts.map +1 -0
  1186. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.js +469 -0
  1187. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.d.ts +29 -0
  1188. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.d.ts.map +1 -0
  1189. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.js +34 -0
  1190. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node/PipeTransport.d.ts +31 -0
  1191. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node/PipeTransport.d.ts.map +1 -0
  1192. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node/PipeTransport.js +61 -0
  1193. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.d.ts +156 -0
  1194. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.d.ts.map +1 -0
  1195. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.js +183 -0
  1196. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node/install.d.ts +18 -0
  1197. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node/install.d.ts.map +1 -0
  1198. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node/install.js +151 -0
  1199. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node-puppeteer-core.d.ts +18 -0
  1200. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node-puppeteer-core.d.ts.map +1 -0
  1201. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node-puppeteer-core.js +23 -0
  1202. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node.d.ts +18 -0
  1203. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node.d.ts.map +1 -0
  1204. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/node.js +22 -0
  1205. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +22 -0
  1206. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts.map +1 -0
  1207. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +19 -0
  1208. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/web.d.ts +18 -0
  1209. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/web.d.ts.map +1 -0
  1210. package/static/devtools/third_party/puppeteer/package/lib/esm/puppeteer/web.js +22 -0
  1211. package/static/devtools/third_party/puppeteer/package/lib/esm/vendor/mitt/src/index.d.ts +22 -0
  1212. package/static/devtools/third_party/puppeteer/package/lib/esm/vendor/mitt/src/index.d.ts.map +1 -0
  1213. package/static/devtools/third_party/puppeteer/package/lib/esm/vendor/mitt/src/index.js +53 -0
  1214. package/static/devtools/third_party/puppeteer/puppeteer-tsconfig.json +58 -0
  1215. package/static/devtools/third_party/puppeteer/puppeteer.js +1 -0
  1216. package/static/devtools/third_party/wasmparser/package/dist/esm/WasmDis.js +1595 -0
  1217. package/static/devtools/third_party/wasmparser/package/dist/esm/WasmParser.js +3120 -0
  1218. package/static/devtools/third_party/wasmparser/wasmparser-tsconfig.json +9 -0
  1219. package/static/devtools/timeline/timeline-legacy.js +1 -0
  1220. package/static/devtools/timeline/timeline-meta.js +1 -0
  1221. package/static/devtools/timeline/timeline.js +1 -0
  1222. package/static/devtools/timeline/timeline_module.js +1 -0
  1223. package/static/devtools/timeline_model/timeline_model-legacy.js +1 -0
  1224. package/static/devtools/timeline_model/timeline_model.js +1 -0
  1225. package/static/devtools/timeline_model/timeline_model_module.js +0 -0
  1226. package/static/devtools/toolbox.html +20 -0
  1227. package/static/devtools/toolbox.js +1 -0
  1228. package/static/devtools/toolbox_bootstrap/toolbox_bootstrap.js +1 -0
  1229. package/static/devtools/ui/components/components.js +378 -0
  1230. package/static/devtools/ui/ui-legacy.js +1 -0
  1231. package/static/devtools/ui/ui.js +3 -0
  1232. package/static/devtools/ui/utils/utils.js +1 -0
  1233. package/static/devtools/wasmparser_worker/wasmparser_worker-entrypoint.js +1 -0
  1234. package/static/devtools/wasmparser_worker/wasmparser_worker.js +1 -0
  1235. package/static/devtools/web_audio/graph_visualizer/graph_visualizer.js +1 -0
  1236. package/static/devtools/web_audio/web_audio-legacy.js +1 -0
  1237. package/static/devtools/web_audio/web_audio-meta.js +1 -0
  1238. package/static/devtools/web_audio/web_audio.js +23 -0
  1239. package/static/devtools/web_audio/web_audio_module.js +1 -0
  1240. package/static/devtools/webauthn/webauthn-legacy.js +1 -0
  1241. package/static/devtools/webauthn/webauthn-meta.js +1 -0
  1242. package/static/devtools/webauthn/webauthn.js +6 -0
  1243. package/static/devtools/webauthn/webauthn_module.js +1 -0
  1244. package/static/devtools/worker_app.html +20 -0
  1245. package/static/devtools/worker_app.js +1 -0
  1246. package/static/devtools/worker_main/worker_main-legacy.js +1 -0
  1247. package/static/devtools/worker_main/worker_main.js +1 -0
  1248. package/static/devtools/worker_service/worker_service.js +1 -0
  1249. package/static/devtools/workspace/workspace-legacy.js +1 -0
  1250. package/static/devtools/workspace/workspace.js +1 -0
  1251. package/static/devtools/workspace_diff/workspace_diff-legacy.js +1 -0
  1252. package/static/devtools/workspace_diff/workspace_diff.js +1 -0
  1253. package/static/devtools/workspace_diff/workspace_diff_module.js +0 -0
  1254. package/static/docs/swagger.json +2337 -279
  1255. package/static/function/client.js +1037 -992
  1256. package/build/routes/chromium/http/json-new.js +0 -23
  1257. package/build/routes/chromium/http/json-version-get.response.json +0 -37
  1258. package/build/routes/chromium/utils/cdp.d.ts +0 -2
  1259. package/build/routes/chromium/utils/cdp.js +0 -14
  1260. package/build/routes/chromium/ws/cdp-chromium.js +0 -10
  1261. package/src/routes/chromium/http/json-list.ts +0 -50
  1262. package/src/routes/chromium/utils/cdp.ts +0 -19
  1263. package/build/routes/{chromium/http/content-post.query.json → chrome/http/content.post.query.json} +0 -0
  1264. package/build/routes/{chromium/http/content-post.response.json → chrome/http/content.post.response.json} +0 -0
  1265. package/build/routes/{chromium/http/download-post.body.json → chrome/http/download.post.body.json} +0 -0
  1266. package/build/routes/{chromium/http/download-post.query.json → chrome/http/download.post.query.json} +0 -0
  1267. package/build/routes/{chromium/http/download-post.response.json → chrome/http/download.post.response.json} +0 -0
  1268. package/build/routes/{chromium/http/function-post.body.json → chrome/http/function.post.body.json} +0 -0
  1269. package/build/routes/{chromium/http/function-post.query.json → chrome/http/function.post.query.json} +0 -0
  1270. package/build/routes/{chromium/http/function-post.response.json → chrome/http/function.post.response.json} +0 -0
  1271. package/build/routes/{chromium/http/json-list.response.json → chrome/http/json-list.get.response.json} +0 -0
  1272. package/build/routes/{chromium/http/json-new.response.json → chrome/http/json-new.put.response.json} +0 -0
  1273. package/build/routes/{chromium/http/json-protocol-get.response.json → chrome/http/json-protocol.get.response.json} +0 -0
  1274. package/build/routes/{chromium/http/pdf-post.query.json → chrome/http/pdf.post.query.json} +0 -0
  1275. package/build/routes/{chromium/http/pdf-post.response.json → chrome/http/pdf.post.response.json} +0 -0
  1276. package/build/routes/{chromium/http/performance.body.json → chrome/http/performance.post.body.json} +0 -0
  1277. package/build/routes/{chromium/http/performance.query.json → chrome/http/performance.post.query.json} +0 -0
  1278. package/build/routes/{chromium/http/performance.response.json → chrome/http/performance.post.response.json} +0 -0
  1279. package/build/routes/{chromium/http/scrape-post.query.json → chrome/http/scrape.post.query.json} +0 -0
  1280. package/build/routes/{chromium/http/scrape-post.response.json → chrome/http/scrape.post.response.json} +0 -0
  1281. package/build/routes/{chromium/http/screenshot-post.query.json → chrome/http/screenshot.post.query.json} +0 -0
  1282. package/build/routes/{chromium/http/screenshot-post.response.json → chrome/http/screenshot.post.response.json} +0 -0
  1283. package/build/routes/{chromium/utils/performance/child.d.ts → chrome/tests/content.spec.d.ts} +0 -0
  1284. package/build/routes/{chromium/utils/performance/types.js → chrome/tests/download.spec.d.ts} +0 -0
  1285. package/build/routes/{chromium/ws/cdp-chromium.query.json → chrome/ws/browser.query.json} +0 -0
  1286. package/build/routes/{chromium/ws/playwright-chromium.query.json → chrome/ws/playwright.query.json} +0 -0
  1287. package/build/routes/{firefox/ws/playwright-firefox.query.json → chromium/ws/playwright.query.json} +0 -0
  1288. package/build/routes/{webkit/ws/playwright-webkit.query.json → firefox/ws/playwright.query.json} +0 -0
  1289. package/build/routes/management/http/{config-get.d.ts → config.get.d.ts} +0 -0
  1290. package/build/routes/management/http/{config-get.js → config.get.js} +0 -0
  1291. package/build/routes/management/http/{config-get.response.json → config.get.response.json} +0 -0
  1292. package/build/routes/management/http/{metrics-total-get.d.ts → metrics-total.get.d.ts} +0 -0
  1293. package/build/routes/management/http/{metrics-total-get.js → metrics-total.get.js} +0 -0
  1294. package/build/routes/management/http/{metrics-total-get.response.json → metrics-total.get.response.json} +0 -0
  1295. package/build/routes/management/http/{metrics-get.d.ts → metrics.get.d.ts} +0 -0
  1296. package/build/routes/management/http/{metrics-get.js → metrics.get.js} +0 -0
  1297. package/build/routes/management/http/{metrics-get.response.json → metrics.get.response.json} +0 -0
  1298. package/build/routes/management/http/{sessions-get.d.ts → sessions.get.d.ts} +0 -0
  1299. package/build/routes/management/http/{sessions-get.js → sessions.get.js} +0 -0
  1300. package/build/routes/management/http/{static-get.d.ts → static.get.d.ts} +0 -0
  1301. package/build/{routes/chromium/http/json-protocol-get.d.ts → shared/json-protocol.http.d.ts} +1 -1
  1302. package/build/{routes/chromium/http/json-version-get.d.ts → shared/json-version.http.d.ts} +1 -1
  1303. /package/build/{routes/chromium → shared}/utils/function/client.d.ts +0 -0
  1304. /package/build/{routes/chromium → shared}/utils/function/client.js +0 -0
  1305. /package/build/{routes/chromium → shared}/utils/function/handler.d.ts +0 -0
  1306. /package/build/{routes/chromium → shared}/utils/function/handler.js +0 -0
  1307. /package/build/{routes/chromium → shared}/utils/performance/child.js +0 -0
  1308. /package/build/{routes/chromium → shared}/utils/performance/main.d.ts +0 -0
  1309. /package/build/{routes/chromium → shared}/utils/performance/types.d.ts +0 -0
  1310. /package/src/routes/management/http/{config-get.ts → config.get.ts} +0 -0
  1311. /package/src/routes/management/http/{metrics-total-get.ts → metrics-total.get.ts} +0 -0
  1312. /package/src/routes/management/http/{metrics-get.ts → metrics.get.ts} +0 -0
  1313. /package/src/routes/management/http/{sessions-get.ts → sessions.get.ts} +0 -0
  1314. /package/src/{routes/chromium → shared}/utils/function/client.ts +0 -0
  1315. /package/src/{routes/chromium → shared}/utils/performance/child.ts +0 -0
  1316. /package/src/{routes/chromium → shared}/utils/performance/types.ts +0 -0
@@ -42,8 +42,8 @@ builtinScriptlets.push({
42
42
  fn: safeSelf,
43
43
  });
44
44
  function safeSelf() {
45
- if ( scriptletGlobals.has('safeSelf') ) {
46
- return scriptletGlobals.get('safeSelf');
45
+ if ( scriptletGlobals.safeSelf ) {
46
+ return scriptletGlobals.safeSelf;
47
47
  }
48
48
  const self = globalThis;
49
49
  const safe = {
@@ -55,7 +55,10 @@ function safeSelf() {
55
55
  'Math_max': Math.max,
56
56
  'Math_min': Math.min,
57
57
  'Math_random': Math.random,
58
+ 'Object': Object,
58
59
  'Object_defineProperty': Object.defineProperty.bind(Object),
60
+ 'Object_fromEntries': Object.fromEntries.bind(Object),
61
+ 'Object_getOwnPropertyDescriptor': Object.getOwnPropertyDescriptor.bind(Object),
59
62
  'RegExp': self.RegExp,
60
63
  'RegExp_test': self.RegExp.prototype.test,
61
64
  'RegExp_exec': self.RegExp.prototype.exec,
@@ -70,11 +73,25 @@ function safeSelf() {
70
73
  'JSON_parse': (...args) => safe.JSON_parseFn.call(safe.JSON, ...args),
71
74
  'JSON_stringify': (...args) => safe.JSON_stringifyFn.call(safe.JSON, ...args),
72
75
  'log': console.log.bind(console),
76
+ // Properties
77
+ logLevel: 0,
78
+ // Methods
79
+ makeLogPrefix(...args) {
80
+ return this.sendToLogger && `[${args.join(' \u205D ')}]` || '';
81
+ },
73
82
  uboLog(...args) {
74
- if ( scriptletGlobals.has('canDebug') === false ) { return; }
75
- if ( args.length === 0 ) { return; }
76
- if ( `${args[0]}` === '' ) { return; }
77
- this.log('[uBO]', ...args);
83
+ if ( this.sendToLogger === undefined ) { return; }
84
+ if ( args === undefined || args[0] === '' ) { return; }
85
+ return this.sendToLogger('info', ...args);
86
+
87
+ },
88
+ uboErr(...args) {
89
+ if ( this.sendToLogger === undefined ) { return; }
90
+ if ( args === undefined || args[0] === '' ) { return; }
91
+ return this.sendToLogger('error', ...args);
92
+ },
93
+ escapeRegexChars(s) {
94
+ return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
78
95
  },
79
96
  initPattern(pattern, options = {}) {
80
97
  if ( pattern === '' ) {
@@ -96,8 +113,7 @@ function safeSelf() {
96
113
  }
97
114
  if ( options.flags !== undefined ) {
98
115
  return {
99
- re: new this.RegExp(pattern.replace(
100
- /[.*+?^${}()|[\]\\]/g, '\\$&'),
116
+ re: new this.RegExp(this.escapeRegexChars(pattern),
101
117
  options.flags
102
118
  ),
103
119
  expect,
@@ -116,7 +132,7 @@ function safeSelf() {
116
132
  if ( pattern === '' ) { return /^/; }
117
133
  const match = /^\/(.+)\/([gimsu]*)$/.exec(pattern);
118
134
  if ( match === null ) {
119
- const reStr = pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
135
+ const reStr = this.escapeRegexChars(pattern);
120
136
  return new RegExp(verbatim ? `^${reStr}$` : reStr, flags);
121
137
  }
122
138
  try {
@@ -137,10 +153,42 @@ function safeSelf() {
137
153
  }
138
154
  return out;
139
155
  }, []);
140
- return Object.fromEntries(entries);
156
+ return this.Object_fromEntries(entries);
141
157
  },
142
158
  };
143
- scriptletGlobals.set('safeSelf', safe);
159
+ scriptletGlobals.safeSelf = safe;
160
+ if ( scriptletGlobals.bcSecret === undefined ) { return safe; }
161
+ // This is executed only when the logger is opened
162
+ const bc = new self.BroadcastChannel(scriptletGlobals.bcSecret);
163
+ let bcBuffer = [];
164
+ safe.logLevel = scriptletGlobals.logLevel || 1;
165
+ safe.sendToLogger = (type, ...args) => {
166
+ if ( args.length === 0 ) { return; }
167
+ const text = `[${document.location.hostname || document.location.href}]${args.join(' ')}`;
168
+ if ( bcBuffer === undefined ) {
169
+ return bc.postMessage({ what: 'messageToLogger', type, text });
170
+ }
171
+ bcBuffer.push({ type, text });
172
+ };
173
+ bc.onmessage = ev => {
174
+ const msg = ev.data;
175
+ switch ( msg ) {
176
+ case 'iamready!':
177
+ if ( bcBuffer === undefined ) { break; }
178
+ bcBuffer.forEach(({ type, text }) =>
179
+ bc.postMessage({ what: 'messageToLogger', type, text })
180
+ );
181
+ bcBuffer = undefined;
182
+ break;
183
+ case 'setScriptletLogLevelToOne':
184
+ safe.logLevel = 1;
185
+ break;
186
+ case 'setScriptletLogLevelToTwo':
187
+ safe.logLevel = 2;
188
+ break;
189
+ }
190
+ };
191
+ bc.postMessage('areyouready?');
144
192
  return safe;
145
193
  }
146
194
 
@@ -176,18 +224,7 @@ builtinScriptlets.push({
176
224
  });
177
225
  function shouldDebug(details) {
178
226
  if ( details instanceof Object === false ) { return false; }
179
- return scriptletGlobals.has('canDebug') && details.debug;
180
- }
181
-
182
- /******************************************************************************/
183
-
184
- builtinScriptlets.push({
185
- name: 'should-log.fn',
186
- fn: shouldLog,
187
- });
188
- function shouldLog(details) {
189
- if ( details instanceof Object === false ) { return false; }
190
- return scriptletGlobals.has('canDebug') && details.log;
227
+ return scriptletGlobals.canDebug && details.debug;
191
228
  }
192
229
 
193
230
  /******************************************************************************/
@@ -292,12 +329,12 @@ function generateContentFn(directive) {
292
329
  return Promise.resolve(randomize(len | 0));
293
330
  }
294
331
  }
295
- if ( directive.startsWith('war:') && scriptletGlobals.has('warOrigin') ) {
332
+ if ( directive.startsWith('war:') && scriptletGlobals.warOrigin ) {
296
333
  return new Promise(resolve => {
297
- const warOrigin = scriptletGlobals.get('warOrigin');
334
+ const warOrigin = scriptletGlobals.warOrigin;
298
335
  const warName = directive.slice(4);
299
336
  const fullpath = [ warOrigin, '/', warName ];
300
- const warSecret = scriptletGlobals.get('warSecret');
337
+ const warSecret = scriptletGlobals.warSecret;
301
338
  if ( warSecret !== undefined ) {
302
339
  fullpath.push('?secret=', warSecret);
303
340
  }
@@ -322,7 +359,6 @@ builtinScriptlets.push({
322
359
  'get-exception-token.fn',
323
360
  'safe-self.fn',
324
361
  'should-debug.fn',
325
- 'should-log.fn',
326
362
  ],
327
363
  });
328
364
  // Issues to mind before changing anything:
@@ -335,6 +371,7 @@ function abortCurrentScriptCore(
335
371
  if ( typeof target !== 'string' ) { return; }
336
372
  if ( target === '' ) { return; }
337
373
  const safe = safeSelf();
374
+ const logPrefix = safe.makeLogPrefix('abort-current-script', target, needle, context);
338
375
  const reNeedle = safe.patternToRegex(needle);
339
376
  const reContext = safe.patternToRegex(context);
340
377
  const extraArgs = safe.getExtraArgs(Array.from(arguments), 3);
@@ -358,7 +395,6 @@ function abortCurrentScriptCore(
358
395
  value = owner[prop];
359
396
  desc = undefined;
360
397
  }
361
- const log = shouldLog(extraArgs);
362
398
  const debug = shouldDebug(extraArgs);
363
399
  const exceptionToken = getExceptionToken();
364
400
  const scriptTexts = new WeakMap();
@@ -391,14 +427,19 @@ function abortCurrentScriptCore(
391
427
  if ( debug === 'nomatch' || debug === 'all' ) { debugger; } // jshint ignore: line
392
428
  return;
393
429
  }
394
- if ( log && e.src !== '' ) { safe.uboLog(`matched src: ${e.src}`); }
430
+ if ( safe.logLevel > 1 && context !== '' ) {
431
+ safe.uboLog(logPrefix, `Matched src\n${e.src}`);
432
+ }
395
433
  const scriptText = getScriptText(e);
396
434
  if ( reNeedle.test(scriptText) === false ) {
397
435
  if ( debug === 'nomatch' || debug === 'all' ) { debugger; } // jshint ignore: line
398
436
  return;
399
437
  }
400
- if ( log ) { safe.uboLog(`matched script text: ${scriptText}`); }
438
+ if ( safe.logLevel > 1 ) {
439
+ safe.uboLog(logPrefix, `Matched text\n${scriptText}`);
440
+ }
401
441
  if ( debug === 'match' || debug === 'all' ) { debugger; } // jshint ignore: line
442
+ safe.uboLog(logPrefix, 'Aborted');
402
443
  throw new ReferenceError(exceptionToken);
403
444
  };
404
445
  if ( debug === 'install' ) { debugger; } // jshint ignore: line
@@ -420,40 +461,97 @@ function abortCurrentScriptCore(
420
461
  }
421
462
  });
422
463
  } catch(ex) {
423
- if ( log ) { safe.uboLog(ex); }
464
+ safe.uboErr(logPrefix, `Error: ${ex}`);
424
465
  }
425
466
  }
426
467
 
427
468
  /******************************************************************************/
428
469
 
429
470
  builtinScriptlets.push({
430
- name: 'set-constant-core.fn',
431
- fn: setConstantCore,
471
+ name: 'validate-constant.fn',
472
+ fn: validateConstantFn,
432
473
  dependencies: [
433
- 'run-at.fn',
434
474
  'safe-self.fn',
435
475
  ],
436
476
  });
477
+ function validateConstantFn(trusted, raw) {
478
+ const safe = safeSelf();
479
+ const extraArgs = safe.getExtraArgs(Array.from(arguments), 2);
480
+ let value;
481
+ if ( raw === 'undefined' ) {
482
+ value = undefined;
483
+ } else if ( raw === 'false' ) {
484
+ value = false;
485
+ } else if ( raw === 'true' ) {
486
+ value = true;
487
+ } else if ( raw === 'null' ) {
488
+ value = null;
489
+ } else if ( raw === "''" || raw === '' ) {
490
+ value = '';
491
+ } else if ( raw === '[]' || raw === 'emptyArr' ) {
492
+ value = [];
493
+ } else if ( raw === '{}' || raw === 'emptyObj' ) {
494
+ value = {};
495
+ } else if ( raw === 'noopFunc' ) {
496
+ value = function(){};
497
+ } else if ( raw === 'trueFunc' ) {
498
+ value = function(){ return true; };
499
+ } else if ( raw === 'falseFunc' ) {
500
+ value = function(){ return false; };
501
+ } else if ( /^-?\d+$/.test(raw) ) {
502
+ value = parseInt(raw);
503
+ if ( isNaN(raw) ) { return; }
504
+ if ( Math.abs(raw) > 0x7FFF ) { return; }
505
+ } else if ( trusted ) {
506
+ if ( raw.startsWith('{') && raw.endsWith('}') ) {
507
+ try { value = safe.JSON_parse(raw).value; } catch(ex) { return; }
508
+ }
509
+ } else {
510
+ return;
511
+ }
512
+ if ( extraArgs.as !== undefined ) {
513
+ if ( extraArgs.as === 'function' ) {
514
+ return ( ) => value;
515
+ } else if ( extraArgs.as === 'callback' ) {
516
+ return ( ) => (( ) => value);
517
+ } else if ( extraArgs.as === 'resolved' ) {
518
+ return Promise.resolve(value);
519
+ } else if ( extraArgs.as === 'rejected' ) {
520
+ return Promise.reject(value);
521
+ }
522
+ }
523
+ return value;
524
+ }
525
+
526
+ /******************************************************************************/
437
527
 
438
- function setConstantCore(
528
+ builtinScriptlets.push({
529
+ name: 'set-constant.fn',
530
+ fn: setConstantFn,
531
+ dependencies: [
532
+ 'run-at.fn',
533
+ 'safe-self.fn',
534
+ 'validate-constant.fn',
535
+ ],
536
+ });
537
+ function setConstantFn(
439
538
  trusted = false,
440
539
  chain = '',
441
- cValue = ''
540
+ rawValue = ''
442
541
  ) {
443
542
  if ( chain === '' ) { return; }
444
543
  const safe = safeSelf();
544
+ const logPrefix = safe.makeLogPrefix('set-constant', chain, rawValue);
445
545
  const extraArgs = safe.getExtraArgs(Array.from(arguments), 3);
446
- function setConstant(chain, cValue) {
546
+ function setConstant(chain, rawValue) {
447
547
  const trappedProp = (( ) => {
448
548
  const pos = chain.lastIndexOf('.');
449
549
  if ( pos === -1 ) { return chain; }
450
550
  return chain.slice(pos+1);
451
551
  })();
452
- if ( trappedProp === '' ) { return; }
453
- const thisScript = document.currentScript;
454
552
  const cloakFunc = fn => {
455
553
  safe.Object_defineProperty(fn, 'name', { value: trappedProp });
456
- const proxy = new Proxy(fn, {
554
+ return new Proxy(fn, {
457
555
  defineProperty(target, prop) {
458
556
  if ( prop !== 'toString' ) {
459
557
  return Reflect.defineProperty(...arguments);
@@ -475,50 +573,12 @@ function setConstantCore(
475
573
  return Reflect.get(...arguments);
476
574
  },
477
575
  });
478
- return proxy;
479
576
  };
480
- if ( cValue === 'undefined' ) {
481
- cValue = undefined;
482
- } else if ( cValue === 'false' ) {
483
- cValue = false;
484
- } else if ( cValue === 'true' ) {
485
- cValue = true;
486
- } else if ( cValue === 'null' ) {
487
- cValue = null;
488
- } else if ( cValue === "''" || cValue === '' ) {
489
- cValue = '';
490
- } else if ( cValue === '[]' || cValue === 'emptyArr' ) {
491
- cValue = [];
492
- } else if ( cValue === '{}' || cValue === 'emptyObj' ) {
493
- cValue = {};
494
- } else if ( cValue === 'noopFunc' ) {
495
- cValue = cloakFunc(function(){});
496
- } else if ( cValue === 'trueFunc' ) {
497
- cValue = cloakFunc(function(){ return true; });
498
- } else if ( cValue === 'falseFunc' ) {
499
- cValue = cloakFunc(function(){ return false; });
500
- } else if ( /^-?\d+$/.test(cValue) ) {
501
- cValue = parseInt(cValue);
502
- if ( isNaN(cValue) ) { return; }
503
- if ( Math.abs(cValue) > 0x7FFF ) { return; }
504
- } else if ( trusted ) {
505
- if ( cValue.startsWith('{') && cValue.endsWith('}') ) {
506
- try { cValue = safe.JSON_parse(cValue).value; } catch(ex) { return; }
507
- }
508
- } else {
509
- return;
510
- }
511
- if ( extraArgs.as !== undefined ) {
512
- const value = cValue;
513
- if ( extraArgs.as === 'function' ) {
514
- cValue = ( ) => value;
515
- } else if ( extraArgs.as === 'callback' ) {
516
- cValue = ( ) => (( ) => value);
517
- } else if ( extraArgs.as === 'resolved' ) {
518
- cValue = Promise.resolve(value);
519
- } else if ( extraArgs.as === 'rejected' ) {
520
- cValue = Promise.reject(value);
521
- }
577
+ if ( trappedProp === '' ) { return; }
578
+ const thisScript = document.currentScript;
579
+ let normalValue = validateConstantFn(trusted, rawValue);
580
+ if ( rawValue === 'noopFunc' || rawValue === 'trueFunc' || rawValue === 'falseFunc' ) {
581
+ normalValue = cloakFunc(normalValue);
522
582
  }
523
583
  let aborted = false;
524
584
  const mustAbort = function(v) {
@@ -526,18 +586,21 @@ function setConstantCore(
526
586
  if ( aborted ) { return true; }
527
587
  aborted =
528
588
  (v !== undefined && v !== null) &&
529
- (cValue !== undefined && cValue !== null) &&
530
- (typeof v !== typeof cValue);
589
+ (normalValue !== undefined && normalValue !== null) &&
590
+ (typeof v !== typeof normalValue);
591
+ if ( aborted ) {
592
+ safe.uboLog(logPrefix, `Aborted because value set to ${v}`);
593
+ }
531
594
  return aborted;
532
595
  };
533
596
  // https://github.com/uBlockOrigin/uBlock-issues/issues/156
534
597
  // Support multiple trappers for the same property.
535
598
  const trapProp = function(owner, prop, configurable, handler) {
536
- if ( handler.init(configurable ? owner[prop] : cValue) === false ) { return; }
537
- const odesc = Object.getOwnPropertyDescriptor(owner, prop);
599
+ if ( handler.init(configurable ? owner[prop] : normalValue) === false ) { return; }
600
+ const odesc = safe.Object_getOwnPropertyDescriptor(owner, prop);
538
601
  let prevGetter, prevSetter;
539
- if ( odesc instanceof Object ) {
540
- owner[prop] = cValue;
602
+ if ( odesc instanceof safe.Object ) {
603
+ owner[prop] = normalValue;
541
604
  if ( odesc.get instanceof Function ) {
542
605
  prevGetter = odesc.get;
543
606
  }
@@ -552,7 +615,7 @@ function setConstantCore(
552
615
  if ( prevGetter !== undefined ) {
553
616
  prevGetter();
554
617
  }
555
- return handler.getter(); // cValue
618
+ return handler.getter();
556
619
  },
557
620
  set(a) {
558
621
  if ( prevSetter !== undefined ) {
@@ -561,7 +624,9 @@ function setConstantCore(
561
624
  handler.setter(a);
562
625
  }
563
626
  });
627
+ safe.uboLog(logPrefix, 'Trap installed');
564
628
  } catch(ex) {
629
+ safe.uboErr(logPrefix, ex);
565
630
  }
566
631
  };
567
632
  const trapChain = function(owner, chain) {
@@ -575,13 +640,15 @@ function setConstantCore(
575
640
  return true;
576
641
  },
577
642
  getter: function() {
578
- return document.currentScript === thisScript
579
- ? this.v
580
- : cValue;
643
+ if ( document.currentScript === thisScript ) {
644
+ return this.v;
645
+ }
646
+ safe.uboLog(logPrefix, 'Property read');
647
+ return normalValue;
581
648
  },
582
649
  setter: function(a) {
583
650
  if ( mustAbort(a) === false ) { return; }
584
- cValue = a;
651
+ normalValue = a;
585
652
  }
586
653
  });
587
654
  return;
@@ -589,7 +656,7 @@ function setConstantCore(
589
656
  const prop = chain.slice(0, pos);
590
657
  const v = owner[prop];
591
658
  chain = chain.slice(pos + 1);
592
- if ( v instanceof Object || typeof v === 'object' && v !== null ) {
659
+ if ( v instanceof safe.Object || typeof v === 'object' && v !== null ) {
593
660
  trapChain(v, chain);
594
661
  return;
595
662
  }
@@ -604,7 +671,7 @@ function setConstantCore(
604
671
  },
605
672
  setter: function(a) {
606
673
  this.v = a;
607
- if ( a instanceof Object ) {
674
+ if ( a instanceof safe.Object ) {
608
675
  trapChain(a, chain);
609
676
  }
610
677
  }
@@ -613,7 +680,7 @@ function setConstantCore(
613
680
  trapChain(window, chain);
614
681
  }
615
682
  runAt(( ) => {
616
- setConstant(chain, cValue);
683
+ setConstant(chain, rawValue);
617
684
  }, extraArgs.runAt);
618
685
  }
619
686
 
@@ -633,18 +700,18 @@ function replaceNodeTextFn(
633
700
  replacement = ''
634
701
  ) {
635
702
  const safe = safeSelf();
703
+ const logPrefix = safe.makeLogPrefix('replace-node-text.fn', ...Array.from(arguments));
636
704
  const reNodeName = safe.patternToRegex(nodeName, 'i', true);
637
705
  const rePattern = safe.patternToRegex(pattern, 'gms');
638
706
  const extraArgs = safe.getExtraArgs(Array.from(arguments), 3);
639
- const shouldLog = scriptletGlobals.has('canDebug') && extraArgs.log || 0;
640
707
  const reCondition = safe.patternToRegex(extraArgs.condition || '', 'ms');
641
708
  const stop = (takeRecord = true) => {
642
709
  if ( takeRecord ) {
643
710
  handleMutations(observer.takeRecords());
644
711
  }
645
712
  observer.disconnect();
646
- if ( shouldLog !== 0 ) {
647
- safe.uboLog(`replace-node-text-core.fn: quitting "${pattern}" => "${replacement}"`);
713
+ if ( safe.logLevel > 1 ) {
714
+ safe.uboLog(logPrefix, 'Quitting');
648
715
  }
649
716
  };
650
717
  let sedCount = extraArgs.sedCount || 0;
@@ -659,10 +726,10 @@ function replaceNodeTextFn(
659
726
  ? before.replace(rePattern, replacement)
660
727
  : replacement;
661
728
  node.textContent = after;
662
- if ( shouldLog !== 0 ) {
663
- safe.uboLog('replace-node-text.fn before:\n', before);
664
- safe.uboLog('replace-node-text.fn after:\n', after);
729
+ if ( safe.logLevel > 1 ) {
730
+ safe.uboLog(logPrefix, `Text before:\n${before.trim()}`);
665
731
  }
732
+ safe.uboLog(logPrefix, `Text after:\n${after.trim()}`);
666
733
  return sedCount === 0 || (sedCount -= 1) !== 0;
667
734
  };
668
735
  const handleMutations = mutations => {
@@ -690,9 +757,7 @@ function replaceNodeTextFn(
690
757
  if ( handleNode(node) ) { continue; }
691
758
  stop(); break;
692
759
  }
693
- if ( shouldLog !== 0 ) {
694
- safe.uboLog(`replace-node-text-core.fn ${count} nodes present before installing mutation observer`);
695
- }
760
+ safe.uboLog(logPrefix, `${count} nodes present before installing mutation observer`);
696
761
  }
697
762
  if ( extraArgs.stay ) { return; }
698
763
  runAt(( ) => {
@@ -713,8 +778,6 @@ builtinScriptlets.push({
713
778
  dependencies: [
714
779
  'matches-stack-trace.fn',
715
780
  'object-find-owner.fn',
716
- 'safe-self.fn',
717
- 'should-log.fn',
718
781
  ],
719
782
  });
720
783
  // When no "prune paths" argument is provided, the scriptlet is
@@ -731,15 +794,12 @@ function objectPruneFn(
731
794
  extraArgs = {}
732
795
  ) {
733
796
  if ( typeof rawPrunePaths !== 'string' ) { return; }
734
- const safe = safeSelf();
735
797
  const prunePaths = rawPrunePaths !== ''
736
798
  ? rawPrunePaths.split(/ +/)
737
799
  : [];
738
800
  const needlePaths = prunePaths.length !== 0 && rawNeedlePaths !== ''
739
801
  ? rawNeedlePaths.split(/ +/)
740
802
  : [];
741
- const logLevel = shouldLog({ log: rawPrunePaths === '' || extraArgs.log });
742
- const reLogNeedle = safe.patternToRegex(logLevel === true ? rawNeedlePaths : '');
743
803
  if ( stackNeedleDetails.matchAll !== true ) {
744
804
  if ( matchesStackTrace(stackNeedleDetails, extraArgs.logstack) === false ) {
745
805
  return;
@@ -754,14 +814,6 @@ function objectPruneFn(
754
814
  }
755
815
  return true;
756
816
  };
757
- objectPruneFn.logJson = (json, msg, reNeedle) => {
758
- if ( reNeedle.test(json) === false ) { return; }
759
- safeSelf().uboLog(`objectPrune()`, msg, location.hostname, json);
760
- };
761
- }
762
- const jsonBefore = logLevel ? safe.JSON_stringify(obj, null, 2) : '';
763
- if ( logLevel === true || logLevel === 'all' ) {
764
- objectPruneFn.logJson(jsonBefore, `prune:"${rawPrunePaths}" log:"${logLevel}"`, reLogNeedle);
765
817
  }
766
818
  if ( prunePaths.length === 0 ) { return; }
767
819
  let outcome = 'nomatch';
@@ -772,9 +824,6 @@ function objectPruneFn(
772
824
  }
773
825
  }
774
826
  }
775
- if ( logLevel === outcome ) {
776
- objectPruneFn.logJson(jsonBefore, `prune:"${rawPrunePaths}" log:"${logLevel}"`, reLogNeedle);
777
- }
778
827
  if ( outcome === 'match' ) { return obj; }
779
828
  }
780
829
 
@@ -832,9 +881,63 @@ function objectFindOwnerFn(
832
881
 
833
882
  /******************************************************************************/
834
883
 
884
+ builtinScriptlets.push({
885
+ name: 'get-all-cookies.fn',
886
+ fn: getAllCookiesFn,
887
+ });
888
+ function getAllCookiesFn() {
889
+ return document.cookie.split(/\s*;\s*/).map(s => {
890
+ const pos = s.indexOf('=');
891
+ if ( pos === 0 ) { return; }
892
+ if ( pos === -1 ) { return `${s.trim()}=`; }
893
+ const key = s.slice(0, pos).trim();
894
+ const value = s.slice(pos+1).trim();
895
+ return { key, value };
896
+ }).filter(s => s !== undefined);
897
+ }
898
+
899
+ /******************************************************************************/
900
+
901
+ builtinScriptlets.push({
902
+ name: 'get-all-local-storage.fn',
903
+ fn: getAllLocalStorageFn,
904
+ });
905
+ function getAllLocalStorageFn(which = 'localStorage') {
906
+ const storage = self[which];
907
+ const out = [];
908
+ for ( let i = 0; i < storage.length; i++ ) {
909
+ const key = storage.key(i);
910
+ const value = storage.getItem(key);
911
+ return { key, value };
912
+ }
913
+ return out;
914
+ }
915
+
916
+ /******************************************************************************/
917
+
918
+ builtinScriptlets.push({
919
+ name: 'get-cookie.fn',
920
+ fn: getCookieFn,
921
+ });
922
+ function getCookieFn(
923
+ name = ''
924
+ ) {
925
+ for ( const s of document.cookie.split(/\s*;\s*/) ) {
926
+ const pos = s.indexOf('=');
927
+ if ( pos === -1 ) { continue; }
928
+ if ( s.slice(0, pos) !== name ) { continue; }
929
+ return s.slice(pos+1).trim();
930
+ }
931
+ }
932
+
933
+ /******************************************************************************/
934
+
835
935
  builtinScriptlets.push({
836
936
  name: 'set-cookie.fn',
837
937
  fn: setCookieFn,
938
+ dependencies: [
939
+ 'get-cookie.fn',
940
+ ],
838
941
  });
839
942
  function setCookieFn(
840
943
  trusted = false,
@@ -844,16 +947,7 @@ function setCookieFn(
844
947
  path = '',
845
948
  options = {},
846
949
  ) {
847
- const getCookieValue = name => {
848
- for ( const s of document.cookie.split(/\s*;\s*/) ) {
849
- const pos = s.indexOf('=');
850
- if ( pos === -1 ) { continue; }
851
- if ( s.slice(0, pos) !== name ) { continue; }
852
- return s.slice(pos+1);
853
- }
854
- };
855
-
856
- const cookieBefore = getCookieValue(name);
950
+ const cookieBefore = getCookieFn(name);
857
951
  if ( cookieBefore !== undefined && options.dontOverwrite ) { return; }
858
952
  if ( cookieBefore === value && options.reload ) { return; }
859
953
 
@@ -881,9 +975,12 @@ function setCookieFn(
881
975
  } catch(_) {
882
976
  }
883
977
 
884
- if ( options.reload && getCookieValue(name) === value ) {
978
+ const done = getCookieFn(name) === value;
979
+ if ( done && options.reload ) {
885
980
  window.location.reload();
886
981
  }
982
+
983
+ return done;
887
984
  }
888
985
 
889
986
  /******************************************************************************/
@@ -1070,7 +1167,7 @@ function matchObjectProperties(propNeedles, ...objs) {
1070
1167
  let value = haystack[prop];
1071
1168
  if ( value === undefined ) { continue; }
1072
1169
  if ( typeof value !== 'string' ) {
1073
- try { value = JSON.stringify(value); }
1170
+ try { value = safe.JSON_stringify(value); }
1074
1171
  catch(ex) { }
1075
1172
  if ( typeof value !== 'string' ) { continue; }
1076
1173
  }
@@ -1090,7 +1187,6 @@ builtinScriptlets.push({
1090
1187
  'object-prune.fn',
1091
1188
  'parse-properties-to-match.fn',
1092
1189
  'safe-self.fn',
1093
- 'should-log.fn',
1094
1190
  ],
1095
1191
  });
1096
1192
  function jsonPruneFetchResponseFn(
@@ -1098,23 +1194,22 @@ function jsonPruneFetchResponseFn(
1098
1194
  rawNeedlePaths = ''
1099
1195
  ) {
1100
1196
  const safe = safeSelf();
1197
+ const logPrefix = safe.makeLogPrefix('json-prune-fetch-response', rawPrunePaths, rawNeedlePaths);
1101
1198
  const extraArgs = safe.getExtraArgs(Array.from(arguments), 2);
1102
- const logLevel = shouldLog({ log: rawPrunePaths === '' || extraArgs.log, });
1103
- const log = logLevel ? ((...args) => { safe.uboLog(...args); }) : (( ) => { });
1104
1199
  const propNeedles = parsePropertiesToMatch(extraArgs.propsToMatch, 'url');
1105
1200
  const stackNeedle = safe.initPattern(extraArgs.stackToMatch || '', { canNegate: true });
1106
1201
  const applyHandler = function(target, thisArg, args) {
1107
1202
  const fetchPromise = Reflect.apply(target, thisArg, args);
1108
- if ( logLevel === true ) {
1109
- log('json-prune-fetch-response:', JSON.stringify(Array.from(args)).slice(1,-1));
1110
- }
1111
1203
  if ( rawPrunePaths === '' ) { return fetchPromise; }
1112
1204
  let outcome = 'match';
1113
1205
  if ( propNeedles.size !== 0 ) {
1114
1206
  const objs = [ args[0] instanceof Object ? args[0] : { url: args[0] } ];
1115
1207
  if ( objs[0] instanceof Request ) {
1116
- try { objs[0] = safe.Request_clone.call(objs[0]); }
1117
- catch(ex) { log(ex); }
1208
+ try {
1209
+ objs[0] = safe.Request_clone.call(objs[0]);
1210
+ } catch(ex) {
1211
+ safe.uboErr(logPrefix, 'Error:', ex);
1212
+ }
1118
1213
  }
1119
1214
  if ( args[1] instanceof Object ) {
1120
1215
  objs.push(args[1]);
@@ -1122,15 +1217,11 @@ function jsonPruneFetchResponseFn(
1122
1217
  if ( matchObjectProperties(propNeedles, ...objs) === false ) {
1123
1218
  outcome = 'nomatch';
1124
1219
  }
1125
- if ( outcome === logLevel || logLevel === 'all' ) {
1126
- log(
1127
- `json-prune-fetch-response (${outcome})`,
1128
- `\n\tfetchPropsToMatch: ${JSON.stringify(Array.from(propNeedles)).slice(1,-1)}`,
1129
- '\n\tprops:', ...objs,
1130
- );
1131
- }
1132
1220
  }
1133
1221
  if ( outcome === 'nomatch' ) { return fetchPromise; }
1222
+ if ( safe.logLevel > 1 ) {
1223
+ safe.uboLog(logPrefix, `Matched optional "propsToMatch"\n${extraArgs.propsToMatch}`);
1224
+ }
1134
1225
  return fetchPromise.then(responseBefore => {
1135
1226
  const response = responseBefore.clone();
1136
1227
  return response.json().then(objBefore => {
@@ -1143,6 +1234,7 @@ function jsonPruneFetchResponseFn(
1143
1234
  extraArgs
1144
1235
  );
1145
1236
  if ( typeof objAfter !== 'object' ) { return responseBefore; }
1237
+ safe.uboLog(logPrefix, 'Pruned');
1146
1238
  const responseAfter = Response.json(objAfter, {
1147
1239
  status: responseBefore.status,
1148
1240
  statusText: responseBefore.statusText,
@@ -1156,11 +1248,11 @@ function jsonPruneFetchResponseFn(
1156
1248
  });
1157
1249
  return responseAfter;
1158
1250
  }).catch(reason => {
1159
- log('json-prune-fetch-response:', reason);
1251
+ safe.uboErr(logPrefix, 'Error:', reason);
1160
1252
  return responseBefore;
1161
1253
  });
1162
1254
  }).catch(reason => {
1163
- log('json-prune-fetch-response:', reason);
1255
+ safe.uboErr(logPrefix, 'Error:', reason);
1164
1256
  return fetchPromise;
1165
1257
  });
1166
1258
  };
@@ -1178,7 +1270,6 @@ builtinScriptlets.push({
1178
1270
  'match-object-properties.fn',
1179
1271
  'parse-properties-to-match.fn',
1180
1272
  'safe-self.fn',
1181
- 'should-log.fn',
1182
1273
  ],
1183
1274
  });
1184
1275
  function replaceFetchResponseFn(
@@ -1189,27 +1280,24 @@ function replaceFetchResponseFn(
1189
1280
  ) {
1190
1281
  if ( trusted !== true ) { return; }
1191
1282
  const safe = safeSelf();
1192
- const extraArgs = safe.getExtraArgs(Array.from(arguments), 4);
1193
- const logLevel = shouldLog({
1194
- log: pattern === '' || extraArgs.log,
1195
- });
1196
- const log = logLevel ? ((...args) => { safe.uboLog(...args); }) : (( ) => { });
1283
+ const logPrefix = safe.makeLogPrefix('replace-fetch-response', pattern, replacement, propsToMatch);
1197
1284
  if ( pattern === '*' ) { pattern = '.*'; }
1198
1285
  const rePattern = safe.patternToRegex(pattern);
1199
1286
  const propNeedles = parsePropertiesToMatch(propsToMatch, 'url');
1200
1287
  self.fetch = new Proxy(self.fetch, {
1201
1288
  apply: function(target, thisArg, args) {
1202
- if ( logLevel === true ) {
1203
- log('replace-fetch-response:', JSON.stringify(Array.from(args)).slice(1,-1));
1204
- }
1205
1289
  const fetchPromise = Reflect.apply(target, thisArg, args);
1206
1290
  if ( pattern === '' ) { return fetchPromise; }
1207
1291
  let outcome = 'match';
1208
1292
  if ( propNeedles.size !== 0 ) {
1209
1293
  const objs = [ args[0] instanceof Object ? args[0] : { url: args[0] } ];
1210
1294
  if ( objs[0] instanceof Request ) {
1211
- try { objs[0] = safe.Request_clone.call(objs[0]); }
1212
- catch(ex) { log(ex); }
1295
+ try {
1296
+ objs[0] = safe.Request_clone.call(objs[0]);
1297
+ }
1298
+ catch(ex) {
1299
+ safe.uboErr(logPrefix, ex);
1300
+ }
1213
1301
  }
1214
1302
  if ( args[1] instanceof Object ) {
1215
1303
  objs.push(args[1]);
@@ -1217,28 +1305,18 @@ function replaceFetchResponseFn(
1217
1305
  if ( matchObjectProperties(propNeedles, ...objs) === false ) {
1218
1306
  outcome = 'nomatch';
1219
1307
  }
1220
- if ( outcome === logLevel || logLevel === 'all' ) {
1221
- log(
1222
- `replace-fetch-response (${outcome})`,
1223
- `\n\tpropsToMatch: ${JSON.stringify(Array.from(propNeedles)).slice(1,-1)}`,
1224
- '\n\tprops:', ...args,
1225
- );
1226
- }
1227
1308
  }
1228
1309
  if ( outcome === 'nomatch' ) { return fetchPromise; }
1310
+ if ( safe.logLevel > 1 ) {
1311
+ safe.uboLog(logPrefix, `Matched "propsToMatch"\n${propsToMatch}`);
1312
+ }
1229
1313
  return fetchPromise.then(responseBefore => {
1230
1314
  const response = responseBefore.clone();
1231
1315
  return response.text().then(textBefore => {
1232
1316
  const textAfter = textBefore.replace(rePattern, replacement);
1233
1317
  const outcome = textAfter !== textBefore ? 'match' : 'nomatch';
1234
- if ( outcome === logLevel || logLevel === 'all' ) {
1235
- log(
1236
- `replace-fetch-response (${outcome})`,
1237
- `\n\tpattern: ${pattern}`,
1238
- `\n\treplacement: ${replacement}`,
1239
- );
1240
- }
1241
1318
  if ( outcome === 'nomatch' ) { return responseBefore; }
1319
+ safe.uboLog(logPrefix, 'Replaced');
1242
1320
  const responseAfter = new Response(textAfter, {
1243
1321
  status: responseBefore.status,
1244
1322
  statusText: responseBefore.statusText,
@@ -1252,17 +1330,48 @@ function replaceFetchResponseFn(
1252
1330
  });
1253
1331
  return responseAfter;
1254
1332
  }).catch(reason => {
1255
- log('replace-fetch-response:', reason);
1333
+ safe.uboErr(logPrefix, reason);
1256
1334
  return responseBefore;
1257
1335
  });
1258
1336
  }).catch(reason => {
1259
- log('replace-fetch-response:', reason);
1337
+ safe.uboErr(logPrefix, reason);
1260
1338
  return fetchPromise;
1261
1339
  });
1262
1340
  }
1263
1341
  });
1264
1342
  }
1265
1343
 
1344
+ /******************************************************************************/
1345
+
1346
+ builtinScriptlets.push({
1347
+ name: 'proxy-apply.fn',
1348
+ fn: proxyApplyFn,
1349
+ dependencies: [
1350
+ 'safe-self.fn',
1351
+ ],
1352
+ });
1353
+ function proxyApplyFn(
1354
+ target = '',
1355
+ handler = ''
1356
+ ) {
1357
+ let context = globalThis;
1358
+ let prop = target;
1359
+ for (;;) {
1360
+ const pos = prop.indexOf('.');
1361
+ if ( pos === -1 ) { break; }
1362
+ context = context[prop.slice(0, pos)];
1363
+ if ( context instanceof Object === false ) { return; }
1364
+ prop = prop.slice(pos+1);
1365
+ }
1366
+ const fn = context[prop];
1367
+ if ( typeof fn !== 'function' ) { return; }
1368
+ if ( fn.prototype && fn.prototype.constructor === fn ) {
1369
+ context[prop] = new Proxy(fn, { construct: handler });
1370
+ return (...args) => { return Reflect.construct(...args); };
1371
+ }
1372
+ context[prop] = new Proxy(fn, { apply: handler });
1373
+ return (...args) => { return Reflect.apply(...args); };
1374
+ }
1266
1375
 
1267
1376
  /*******************************************************************************
1268
1377
 
@@ -1303,6 +1412,7 @@ builtinScriptlets.push({
1303
1412
  fn: abortOnPropertyRead,
1304
1413
  dependencies: [
1305
1414
  'get-exception-token.fn',
1415
+ 'safe-self.fn',
1306
1416
  ],
1307
1417
  });
1308
1418
  function abortOnPropertyRead(
@@ -1310,8 +1420,11 @@ function abortOnPropertyRead(
1310
1420
  ) {
1311
1421
  if ( typeof chain !== 'string' ) { return; }
1312
1422
  if ( chain === '' ) { return; }
1423
+ const safe = safeSelf();
1424
+ const logPrefix = safe.makeLogPrefix('abort-on-property-read', chain);
1313
1425
  const exceptionToken = getExceptionToken();
1314
1426
  const abort = function() {
1427
+ safe.uboLog(logPrefix, 'Aborted');
1315
1428
  throw new ReferenceError(exceptionToken);
1316
1429
  };
1317
1430
  const makeProxy = function(owner, chain) {
@@ -1359,6 +1472,7 @@ builtinScriptlets.push({
1359
1472
  fn: abortOnPropertyWrite,
1360
1473
  dependencies: [
1361
1474
  'get-exception-token.fn',
1475
+ 'safe-self.fn',
1362
1476
  ],
1363
1477
  });
1364
1478
  function abortOnPropertyWrite(
@@ -1366,6 +1480,8 @@ function abortOnPropertyWrite(
1366
1480
  ) {
1367
1481
  if ( typeof prop !== 'string' ) { return; }
1368
1482
  if ( prop === '' ) { return; }
1483
+ const safe = safeSelf();
1484
+ const logPrefix = safe.makeLogPrefix('abort-on-property-write', prop);
1369
1485
  const exceptionToken = getExceptionToken();
1370
1486
  let owner = window;
1371
1487
  for (;;) {
@@ -1378,6 +1494,7 @@ function abortOnPropertyWrite(
1378
1494
  delete owner[prop];
1379
1495
  Object.defineProperty(owner, prop, {
1380
1496
  set: function() {
1497
+ safe.uboLog(logPrefix, 'Aborted');
1381
1498
  throw new ReferenceError(exceptionToken);
1382
1499
  }
1383
1500
  });
@@ -1462,7 +1579,6 @@ builtinScriptlets.push({
1462
1579
  'run-at.fn',
1463
1580
  'safe-self.fn',
1464
1581
  'should-debug.fn',
1465
- 'should-log.fn',
1466
1582
  ],
1467
1583
  });
1468
1584
  // https://github.com/uBlockOrigin/uAssets/issues/9123#issuecomment-848255120
@@ -1472,32 +1588,68 @@ function addEventListenerDefuser(
1472
1588
  ) {
1473
1589
  const safe = safeSelf();
1474
1590
  const extraArgs = safe.getExtraArgs(Array.from(arguments), 2);
1591
+ const logPrefix = safe.makeLogPrefix('prevent-addEventListener', type, pattern);
1475
1592
  const reType = safe.patternToRegex(type, undefined, true);
1476
1593
  const rePattern = safe.patternToRegex(pattern);
1477
- const log = shouldLog(extraArgs);
1478
1594
  const debug = shouldDebug(extraArgs);
1595
+ const targetSelector = extraArgs.elements || undefined;
1596
+ const elementMatches = elem => {
1597
+ if ( elem && elem.matches && elem.matches(targetSelector) ) { return true; }
1598
+ const elems = Array.from(document.querySelectorAll(targetSelector));
1599
+ return elems.includes(elem);
1600
+ };
1601
+ const elementDetails = elem => {
1602
+ if ( elem instanceof Window ) { return 'window'; }
1603
+ if ( elem instanceof Document ) { return 'document'; }
1604
+ if ( elem instanceof Element === false ) { return '?'; }
1605
+ const parts = [];
1606
+ if ( elem.id !== '' ) { parts.push(`#${CSS.escape(elem.id)}`); }
1607
+ for ( let i = 0; i < elem.classList.length; i++ ) {
1608
+ parts.push(`.${CSS.escape(elem.classList.item(i))}`);
1609
+ }
1610
+ for ( let i = 0; i < elem.attributes.length; i++ ) {
1611
+ const attr = elem.attributes.item(i);
1612
+ if ( attr.name === 'id' ) { continue; }
1613
+ if ( attr.name === 'class' ) { continue; }
1614
+ parts.push(`[${CSS.escape(attr.name)}="${attr.value}"]`);
1615
+ }
1616
+ return parts.join('');
1617
+ };
1618
+ const shouldPrevent = (thisArg, type, handler) => {
1619
+ const matchesType = safe.RegExp_test.call(reType, type);
1620
+ const matchesHandler = safe.RegExp_test.call(rePattern, handler);
1621
+ const matchesEither = matchesType || matchesHandler;
1622
+ const matchesBoth = matchesType && matchesHandler;
1623
+ if ( debug === 1 && matchesBoth || debug === 2 && matchesEither ) {
1624
+ debugger; // jshint ignore:line
1625
+ }
1626
+ if ( matchesBoth && targetSelector !== undefined ) {
1627
+ if ( elementMatches(thisArg) === false ) { return false; }
1628
+ }
1629
+ return matchesBoth;
1630
+ };
1479
1631
  const trapEddEventListeners = ( ) => {
1480
1632
  const eventListenerHandler = {
1481
1633
  apply: function(target, thisArg, args) {
1482
- let type, handler;
1634
+ let t, h;
1483
1635
  try {
1484
- type = String(args[0]);
1485
- handler = args[1] instanceof Function
1486
- ? String(safe.Function_toString(args[1]))
1487
- : String(args[1]);
1636
+ t = String(args[0]);
1637
+ if ( typeof args[1] === 'function' ) {
1638
+ h = String(safe.Function_toString(args[1]));
1639
+ } else if ( typeof args[1] === 'object' && args[1] !== null ) {
1640
+ if ( typeof args[1].handleEvent === 'function' ) {
1641
+ h = String(safe.Function_toString(args[1].handleEvent));
1642
+ }
1643
+ } else {
1644
+ h = String(args[1]);
1645
+ }
1488
1646
  } catch(ex) {
1489
1647
  }
1490
- const matchesType = safe.RegExp_test.call(reType, type);
1491
- const matchesHandler = safe.RegExp_test.call(rePattern, handler);
1492
- const matchesEither = matchesType || matchesHandler;
1493
- const matchesBoth = matchesType && matchesHandler;
1494
- if ( log === 1 && matchesBoth || log === 2 && matchesEither || log === 3 ) {
1495
- safe.uboLog(`addEventListener('${type}', ${handler})`);
1496
- }
1497
- if ( debug === 1 && matchesBoth || debug === 2 && matchesEither ) {
1498
- debugger; // jshint ignore:line
1648
+ if ( type === '' && pattern === '' ) {
1649
+ safe.uboLog(logPrefix, `Called: ${t}\n${h}\n${elementDetails(thisArg)}`);
1650
+ } else if ( shouldPrevent(thisArg, t, h) ) {
1651
+ return safe.uboLog(logPrefix, `Prevented: ${t}\n${h}\n${elementDetails(thisArg)}`);
1499
1652
  }
1500
- if ( matchesBoth ) { return; }
1501
1653
  return Reflect.apply(target, thisArg, args);
1502
1654
  },
1503
1655
  get(target, prop, receiver) {
@@ -1533,19 +1685,28 @@ function jsonPrune(
1533
1685
  stackNeedle = ''
1534
1686
  ) {
1535
1687
  const safe = safeSelf();
1688
+ const logPrefix = safe.makeLogPrefix('json-prune', rawPrunePaths, rawNeedlePaths, stackNeedle);
1536
1689
  const stackNeedleDetails = safe.initPattern(stackNeedle, { canNegate: true });
1537
1690
  const extraArgs = safe.getExtraArgs(Array.from(arguments), 3);
1538
1691
  JSON.parse = new Proxy(JSON.parse, {
1539
1692
  apply: function(target, thisArg, args) {
1540
1693
  const objBefore = Reflect.apply(target, thisArg, args);
1694
+ if ( rawPrunePaths === '' ) {
1695
+ safe.uboLog(logPrefix, safe.JSON_stringify(objBefore, null, 2));
1696
+ }
1541
1697
  const objAfter = objectPruneFn(
1542
1698
  objBefore,
1543
1699
  rawPrunePaths,
1544
1700
  rawNeedlePaths,
1545
1701
  stackNeedleDetails,
1546
1702
  extraArgs
1547
- );
1548
- return objAfter || objBefore;
1703
+ );
1704
+ if ( objAfter === undefined ) { return objBefore; }
1705
+ safe.uboLog(logPrefix, 'Pruned');
1706
+ if ( safe.logLevel > 1 ) {
1707
+ safe.uboLog(logPrefix, `After pruning:\n${safe.JSON_stringify(objAfter, null, 2)}`);
1708
+ }
1709
+ return objAfter;
1549
1710
  },
1550
1711
  });
1551
1712
  }
@@ -1579,7 +1740,6 @@ builtinScriptlets.push({
1579
1740
  'object-prune.fn',
1580
1741
  'parse-properties-to-match.fn',
1581
1742
  'safe-self.fn',
1582
- 'should-log.fn',
1583
1743
  ],
1584
1744
  });
1585
1745
  function jsonPruneXhrResponse(
@@ -1587,10 +1747,9 @@ function jsonPruneXhrResponse(
1587
1747
  rawNeedlePaths = ''
1588
1748
  ) {
1589
1749
  const safe = safeSelf();
1750
+ const logPrefix = safe.makeLogPrefix('json-prune-xhr-response', rawPrunePaths, rawNeedlePaths);
1590
1751
  const xhrInstances = new WeakMap();
1591
1752
  const extraArgs = safe.getExtraArgs(Array.from(arguments), 2);
1592
- const logLevel = shouldLog({ log: rawPrunePaths === '' || extraArgs.log, });
1593
- const log = logLevel ? ((...args) => { safe.uboLog(...args); }) : (( ) => { });
1594
1753
  const propNeedles = parsePropertiesToMatch(extraArgs.propsToMatch, 'url');
1595
1754
  const stackNeedle = safe.initPattern(extraArgs.stackToMatch || '', { canNegate: true });
1596
1755
  self.XMLHttpRequest = class extends self.XMLHttpRequest {
@@ -1602,10 +1761,10 @@ function jsonPruneXhrResponse(
1602
1761
  outcome = 'nomatch';
1603
1762
  }
1604
1763
  }
1605
- if ( outcome === logLevel || outcome === 'all' ) {
1606
- log(`xhr.open(${method}, ${url}, ${args.join(', ')})`);
1607
- }
1608
1764
  if ( outcome === 'match' ) {
1765
+ if ( safe.logLevel > 1 ) {
1766
+ safe.uboLog(logPrefix, `Matched optional "propsToMatch", "${extraArgs.propsToMatch}"`);
1767
+ }
1609
1768
  xhrInstances.set(this, xhrDetails);
1610
1769
  }
1611
1770
  return super.open(method, url, ...args);
@@ -1630,8 +1789,10 @@ function jsonPruneXhrResponse(
1630
1789
  if ( typeof innerResponse === 'object' ) {
1631
1790
  objBefore = innerResponse;
1632
1791
  } else if ( typeof innerResponse === 'string' ) {
1633
- try { objBefore = safe.JSON_parse(innerResponse); }
1634
- catch(ex) { }
1792
+ try {
1793
+ objBefore = safe.JSON_parse(innerResponse);
1794
+ } catch(ex) {
1795
+ }
1635
1796
  }
1636
1797
  if ( typeof objBefore !== 'object' ) {
1637
1798
  return (xhrDetails.response = innerResponse);
@@ -1648,6 +1809,7 @@ function jsonPruneXhrResponse(
1648
1809
  outerResponse = typeof innerResponse === 'string'
1649
1810
  ? safe.JSON_stringify(objAfter)
1650
1811
  : objAfter;
1812
+ safe.uboLog(logPrefix, 'Pruned');
1651
1813
  } else {
1652
1814
  outerResponse = innerResponse;
1653
1815
  }
@@ -1826,9 +1988,9 @@ function noEvalIf(
1826
1988
  /******************************************************************************/
1827
1989
 
1828
1990
  builtinScriptlets.push({
1829
- name: 'no-fetch-if.js',
1991
+ name: 'prevent-fetch.js',
1830
1992
  aliases: [
1831
- 'prevent-fetch.js',
1993
+ 'no-fetch-if.js',
1832
1994
  ],
1833
1995
  fn: noFetchIf,
1834
1996
  dependencies: [
@@ -1842,6 +2004,7 @@ function noFetchIf(
1842
2004
  ) {
1843
2005
  if ( typeof propsToMatch !== 'string' ) { return; }
1844
2006
  const safe = safeSelf();
2007
+ const logPrefix = safe.makeLogPrefix('prevent-fetch', propsToMatch, responseBody);
1845
2008
  const needles = [];
1846
2009
  for ( const condition of propsToMatch.split(/\s+/) ) {
1847
2010
  if ( condition === '' ) { continue; }
@@ -1856,7 +2019,6 @@ function noFetchIf(
1856
2019
  }
1857
2020
  needles.push({ key, re: safe.patternToRegex(value) });
1858
2021
  }
1859
- const log = needles.length === 0 ? console.log.bind(console) : undefined;
1860
2022
  self.fetch = new Proxy(self.fetch, {
1861
2023
  apply: function(target, thisArg, args) {
1862
2024
  const details = args[0] instanceof self.Request
@@ -1868,17 +2030,16 @@ function noFetchIf(
1868
2030
  for ( const prop in details ) {
1869
2031
  let v = details[prop];
1870
2032
  if ( typeof v !== 'string' ) {
1871
- try { v = JSON.stringify(v); }
2033
+ try { v = safe.JSON_stringify(v); }
1872
2034
  catch(ex) { }
1873
2035
  }
1874
2036
  if ( typeof v !== 'string' ) { continue; }
1875
2037
  props.set(prop, v);
1876
2038
  }
1877
- if ( log !== undefined ) {
1878
- const out = Array.from(props)
1879
- .map(a => `${a[0]}:${a[1]}`)
1880
- .join(' ');
1881
- log(`uBO: fetch(${out})`);
2039
+ if ( propsToMatch === '' && responseBody === '' ) {
2040
+ const out = Array.from(props).map(a => `${a[0]}:${a[1]}`);
2041
+ safe.uboLog(logPrefix, `Called: ${out.join('\n')}`);
2042
+ return Reflect.apply(target, thisArg, args);
1882
2043
  }
1883
2044
  proceed = needles.length === 0;
1884
2045
  for ( const { key, re } of needles ) {
@@ -1902,21 +2063,23 @@ function noFetchIf(
1902
2063
  responseType = desURL.origin !== document.location.origin
1903
2064
  ? 'cors'
1904
2065
  : 'basic';
1905
- } catch(_) {
2066
+ } catch(ex) {
2067
+ safe.uboErr(logPrefix, `Error: ${ex}`);
1906
2068
  }
1907
2069
  }
1908
2070
  return generateContentFn(responseBody).then(text => {
2071
+ safe.uboLog(logPrefix, `Prevented with response "${text}"`);
1909
2072
  const response = new Response(text, {
1910
2073
  statusText: 'OK',
1911
2074
  headers: {
1912
2075
  'Content-Length': text.length,
1913
2076
  }
1914
2077
  });
1915
- Object.defineProperty(response, 'url', {
2078
+ safe.Object_defineProperty(response, 'url', {
1916
2079
  value: details.url
1917
2080
  });
1918
2081
  if ( responseType !== '' ) {
1919
- Object.defineProperty(response, 'type', {
2082
+ safe.Object_defineProperty(response, 'type', {
1920
2083
  value: responseType
1921
2084
  });
1922
2085
  }
@@ -1937,6 +2100,7 @@ builtinScriptlets.push({
1937
2100
  world: 'ISOLATED',
1938
2101
  dependencies: [
1939
2102
  'run-at.fn',
2103
+ 'safe-self.fn',
1940
2104
  ],
1941
2105
  });
1942
2106
  // https://www.reddit.com/r/uBlockOrigin/comments/q0frv0/while_reading_a_sports_article_i_was_redirected/hf7wo9v/
@@ -1944,9 +2108,12 @@ function preventRefresh(
1944
2108
  arg1 = ''
1945
2109
  ) {
1946
2110
  if ( typeof arg1 !== 'string' ) { return; }
2111
+ const safe = safeSelf();
2112
+ const logPrefix = safe.makeLogPrefix('prevent-refresh', arg1);
1947
2113
  const defuse = ( ) => {
1948
2114
  const meta = document.querySelector('meta[http-equiv="refresh" i][content]');
1949
2115
  if ( meta === null ) { return; }
2116
+ safe.uboLog(logPrefix, `Prevented "${meta.textContent}"`);
1950
2117
  const s = arg1 === ''
1951
2118
  ? meta.getAttribute('content')
1952
2119
  : arg1;
@@ -2146,13 +2313,13 @@ builtinScriptlets.push({
2146
2313
  ],
2147
2314
  fn: setConstant,
2148
2315
  dependencies: [
2149
- 'set-constant-core.fn'
2316
+ 'set-constant.fn'
2150
2317
  ],
2151
2318
  });
2152
2319
  function setConstant(
2153
2320
  ...args
2154
2321
  ) {
2155
- setConstantCore(false, ...args);
2322
+ setConstantFn(false, ...args);
2156
2323
  }
2157
2324
 
2158
2325
  /******************************************************************************/
@@ -2175,6 +2342,7 @@ function noSetIntervalIf(
2175
2342
  ) {
2176
2343
  if ( typeof needle !== 'string' ) { return; }
2177
2344
  const safe = safeSelf();
2345
+ const logPrefix = safe.makeLogPrefix('prevent-setInterval', needle, delay);
2178
2346
  const needleNot = needle.charAt(0) === '!';
2179
2347
  if ( needleNot ) { needle = needle.slice(1); }
2180
2348
  if ( delay === '' ) { delay = undefined; }
@@ -2184,9 +2352,6 @@ function noSetIntervalIf(
2184
2352
  if ( delayNot ) { delay = delay.slice(1); }
2185
2353
  delay = parseInt(delay, 10);
2186
2354
  }
2187
- const log = needleNot === false && needle === '' && delay === undefined
2188
- ? console.log
2189
- : undefined;
2190
2355
  const reNeedle = safe.patternToRegex(needle);
2191
2356
  self.setInterval = new Proxy(self.setInterval, {
2192
2357
  apply: function(target, thisArg, args) {
@@ -2194,19 +2359,20 @@ function noSetIntervalIf(
2194
2359
  ? String(safe.Function_toString(args[0]))
2195
2360
  : String(args[0]);
2196
2361
  const b = args[1];
2197
- if ( log !== undefined ) {
2198
- log('uBO: setInterval("%s", %s)', a, b);
2199
- } else {
2200
- let defuse;
2201
- if ( needle !== '' ) {
2202
- defuse = reNeedle.test(a) !== needleNot;
2203
- }
2204
- if ( defuse !== false && delay !== undefined ) {
2205
- defuse = (b === delay || isNaN(b) && isNaN(delay) ) !== delayNot;
2206
- }
2207
- if ( defuse ) {
2208
- args[0] = function(){};
2209
- }
2362
+ if ( needle === '' && delay === undefined ) {
2363
+ safe.uboLog(logPrefix, `Called:\n${a}\n${b}`);
2364
+ return Reflect.apply(target, thisArg, args);
2365
+ }
2366
+ let defuse;
2367
+ if ( needle !== '' ) {
2368
+ defuse = reNeedle.test(a) !== needleNot;
2369
+ }
2370
+ if ( defuse !== false && delay !== undefined ) {
2371
+ defuse = (b === delay || isNaN(b) && isNaN(delay) ) !== delayNot;
2372
+ }
2373
+ if ( defuse ) {
2374
+ args[0] = function(){};
2375
+ safe.uboLog(logPrefix, `Prevented:\n${a}\n${b}`);
2210
2376
  }
2211
2377
  return Reflect.apply(target, thisArg, args);
2212
2378
  },
@@ -2239,6 +2405,7 @@ function noSetTimeoutIf(
2239
2405
  ) {
2240
2406
  if ( typeof needle !== 'string' ) { return; }
2241
2407
  const safe = safeSelf();
2408
+ const logPrefix = safe.makeLogPrefix('prevent-setTimeout', needle, delay);
2242
2409
  const needleNot = needle.charAt(0) === '!';
2243
2410
  if ( needleNot ) { needle = needle.slice(1); }
2244
2411
  if ( delay === '' ) { delay = undefined; }
@@ -2248,9 +2415,6 @@ function noSetTimeoutIf(
2248
2415
  if ( delayNot ) { delay = delay.slice(1); }
2249
2416
  delay = parseInt(delay, 10);
2250
2417
  }
2251
- const log = needleNot === false && needle === '' && delay === undefined
2252
- ? console.log
2253
- : undefined;
2254
2418
  const reNeedle = safe.patternToRegex(needle);
2255
2419
  self.setTimeout = new Proxy(self.setTimeout, {
2256
2420
  apply: function(target, thisArg, args) {
@@ -2258,19 +2422,20 @@ function noSetTimeoutIf(
2258
2422
  ? String(safe.Function_toString(args[0]))
2259
2423
  : String(args[0]);
2260
2424
  const b = args[1];
2261
- if ( log !== undefined ) {
2262
- log('uBO: setTimeout("%s", %s)', a, b);
2263
- } else {
2264
- let defuse;
2265
- if ( needle !== '' ) {
2266
- defuse = reNeedle.test(a) !== needleNot;
2267
- }
2268
- if ( defuse !== false && delay !== undefined ) {
2269
- defuse = (b === delay || isNaN(b) && isNaN(delay) ) !== delayNot;
2270
- }
2271
- if ( defuse ) {
2272
- args[0] = function(){};
2273
- }
2425
+ if ( needle === '' && delay === undefined ) {
2426
+ safe.uboLog(logPrefix, `Called:\n${a}\n${b}`);
2427
+ return Reflect.apply(target, thisArg, args);
2428
+ }
2429
+ let defuse;
2430
+ if ( needle !== '' ) {
2431
+ defuse = reNeedle.test(a) !== needleNot;
2432
+ }
2433
+ if ( defuse !== false && delay !== undefined ) {
2434
+ defuse = (b === delay || isNaN(b) && isNaN(delay) ) !== delayNot;
2435
+ }
2436
+ if ( defuse ) {
2437
+ args[0] = function(){};
2438
+ safe.uboLog(logPrefix, `Prevented:\n${a}\n${b}`);
2274
2439
  }
2275
2440
  return Reflect.apply(target, thisArg, args);
2276
2441
  },
@@ -2371,10 +2536,11 @@ function noXhrIf(
2371
2536
  directive = ''
2372
2537
  ) {
2373
2538
  if ( typeof propsToMatch !== 'string' ) { return; }
2539
+ const safe = safeSelf();
2540
+ const logPrefix = safe.makeLogPrefix('prevent-xhr', propsToMatch, directive);
2374
2541
  const xhrInstances = new WeakMap();
2375
2542
  const propNeedles = parsePropertiesToMatch(propsToMatch, 'url');
2376
- const log = propNeedles.size === 0 ? console.log.bind(console) : undefined;
2377
- const warOrigin = scriptletGlobals.get('warOrigin');
2543
+ const warOrigin = scriptletGlobals.warOrigin;
2378
2544
  const headers = {
2379
2545
  'date': '',
2380
2546
  'content-type': '',
@@ -2382,15 +2548,15 @@ function noXhrIf(
2382
2548
  };
2383
2549
  self.XMLHttpRequest = class extends self.XMLHttpRequest {
2384
2550
  open(method, url, ...args) {
2385
- if ( log !== undefined ) {
2386
- log(`uBO: xhr.open(${method}, ${url}, ${args.join(', ')})`);
2387
- return super.open(method, url, ...args);
2388
- }
2389
2551
  xhrInstances.delete(this);
2390
2552
  if ( warOrigin !== undefined && url.startsWith(warOrigin) ) {
2391
2553
  return super.open(method, url, ...args);
2392
2554
  }
2393
2555
  const haystack = { method, url };
2556
+ if ( propsToMatch === '' && directive === '' ) {
2557
+ safe.uboLog(logPrefix, `Called: ${safe.JSON_stringify(haystack, null, 2)}`);
2558
+ return super.open(method, url, ...args);
2559
+ }
2394
2560
  if ( matchObjectProperties(propNeedles, haystack) ) {
2395
2561
  xhrInstances.set(this, haystack);
2396
2562
  }
@@ -2468,6 +2634,7 @@ function noXhrIf(
2468
2634
  details.xhr.dispatchEvent(new Event('readystatechange'));
2469
2635
  details.xhr.dispatchEvent(new Event('load'));
2470
2636
  details.xhr.dispatchEvent(new Event('loadend'));
2637
+ safe.uboLog(logPrefix, `Prevented with response:\n${details.xhr.response}`);
2471
2638
  });
2472
2639
  }
2473
2640
  getResponseHeader(headerName) {
@@ -2507,7 +2674,6 @@ builtinScriptlets.push({
2507
2674
  fn: noWindowOpenIf,
2508
2675
  dependencies: [
2509
2676
  'safe-self.fn',
2510
- 'should-log.fn',
2511
2677
  ],
2512
2678
  });
2513
2679
  function noWindowOpenIf(
@@ -2516,6 +2682,7 @@ function noWindowOpenIf(
2516
2682
  decoy = ''
2517
2683
  ) {
2518
2684
  const safe = safeSelf();
2685
+ const logPrefix = safe.makeLogPrefix('no-window-open-if', pattern, delay, decoy);
2519
2686
  const targetMatchResult = pattern.startsWith('!') === false;
2520
2687
  if ( targetMatchResult === false ) {
2521
2688
  pattern = pattern.slice(1);
@@ -2525,8 +2692,6 @@ function noWindowOpenIf(
2525
2692
  if ( isNaN(autoRemoveAfter) ) {
2526
2693
  autoRemoveAfter = -1;
2527
2694
  }
2528
- const extraArgs = safe.getExtraArgs(Array.from(arguments), 3);
2529
- const logLevel = shouldLog(extraArgs);
2530
2695
  const createDecoy = function(tag, urlProp, url) {
2531
2696
  const decoyElem = document.createElement(tag);
2532
2697
  decoyElem[urlProp] = url;
@@ -2541,12 +2706,13 @@ function noWindowOpenIf(
2541
2706
  window.open = new Proxy(window.open, {
2542
2707
  apply: function(target, thisArg, args) {
2543
2708
  const haystack = args.join(' ');
2544
- if ( logLevel ) {
2545
- safe.uboLog('window.open:', haystack);
2546
- }
2547
2709
  if ( rePattern.test(haystack) !== targetMatchResult ) {
2710
+ if ( safe.logLevel > 1 ) {
2711
+ safe.uboLog(logPrefix, `Allowed (${args.join(', ')})`);
2712
+ }
2548
2713
  return Reflect.apply(target, thisArg, args);
2549
2714
  }
2715
+ safe.uboLog(logPrefix, `Prevented (${args.join(', ')})`);
2550
2716
  if ( autoRemoveAfter < 0 ) { return null; }
2551
2717
  const decoyElem = decoy === 'obj'
2552
2718
  ? createDecoy('object', 'data', ...args)
@@ -2568,14 +2734,14 @@ function noWindowOpenIf(
2568
2734
  },
2569
2735
  });
2570
2736
  }
2571
- if ( logLevel ) {
2737
+ if ( safe.logLevel !== 0 ) {
2572
2738
  popup = new Proxy(popup, {
2573
2739
  get: function(target, prop) {
2574
- safe.uboLog('window.open / get', prop, '===', target[prop]);
2740
+ safe.uboLog(logPrefix, 'window.open / get', prop, '===', target[prop]);
2575
2741
  return Reflect.get(...arguments);
2576
2742
  },
2577
2743
  set: function(target, prop, value) {
2578
- safe.uboLog('window.open / set', prop, '=', value);
2744
+ safe.uboLog(logPrefix, 'window.open / set', prop, '=', value);
2579
2745
  return Reflect.set(...arguments);
2580
2746
  },
2581
2747
  });
@@ -2757,31 +2923,6 @@ function noWebrtc() {
2757
2923
 
2758
2924
  /******************************************************************************/
2759
2925
 
2760
- builtinScriptlets.push({
2761
- name: 'golem.de.js',
2762
- fn: golemDe,
2763
- });
2764
- // https://github.com/uBlockOrigin/uAssets/issues/88
2765
- function golemDe() {
2766
- const rael = window.addEventListener;
2767
- window.addEventListener = function(a, b) {
2768
- rael(...arguments);
2769
- let haystack;
2770
- try {
2771
- haystack = b.toString();
2772
- } catch(ex) {
2773
- }
2774
- if (
2775
- typeof haystack === 'string' &&
2776
- /^\s*function\s*\(\)\s*\{\s*window\.clearTimeout\(r\)\s*\}\s*$/.test(haystack)
2777
- ) {
2778
- b();
2779
- }
2780
- }.bind(window);
2781
- }
2782
-
2783
- /******************************************************************************/
2784
-
2785
2926
  builtinScriptlets.push({
2786
2927
  name: 'disable-newtab-links.js',
2787
2928
  fn: disableNewtabLinks,
@@ -2884,7 +3025,6 @@ builtinScriptlets.push({
2884
3025
  fn: xmlPrune,
2885
3026
  dependencies: [
2886
3027
  'safe-self.fn',
2887
- 'should-log.fn',
2888
3028
  ],
2889
3029
  });
2890
3030
  function xmlPrune(
@@ -2895,9 +3035,9 @@ function xmlPrune(
2895
3035
  if ( typeof selector !== 'string' ) { return; }
2896
3036
  if ( selector === '' ) { return; }
2897
3037
  const safe = safeSelf();
3038
+ const logPrefix = safe.makeLogPrefix('xml-prune', selector, selectorCheck, urlPattern);
2898
3039
  const reUrl = safe.patternToRegex(urlPattern);
2899
3040
  const extraArgs = safe.getExtraArgs(Array.from(arguments), 3);
2900
- const log = shouldLog(extraArgs) ? ((...args) => { safe.uboLog(...args); }) : (( ) => { });
2901
3041
  const queryAll = (xmlDoc, selector) => {
2902
3042
  const isXpath = /^xpath\(.+\)$/.test(selector);
2903
3043
  if ( isXpath === false ) {
@@ -2924,21 +3064,21 @@ function xmlPrune(
2924
3064
  }
2925
3065
  if ( extraArgs.logdoc ) {
2926
3066
  const serializer = new XMLSerializer();
2927
- log(`xmlPrune: document is\n\t${serializer.serializeToString(xmlDoc)}`);
3067
+ safe.uboLog(logPrefix, `Document is\n\t${serializer.serializeToString(xmlDoc)}`);
2928
3068
  }
2929
3069
  const items = queryAll(xmlDoc, selector);
2930
3070
  if ( items.length === 0 ) { return xmlDoc; }
2931
- log(`xmlPrune: removing ${items.length} items`);
3071
+ safe.uboLog(logPrefix, `Removing ${items.length} items`);
2932
3072
  for ( const item of items ) {
2933
3073
  if ( item.nodeType === 1 ) {
2934
3074
  item.remove();
2935
3075
  } else if ( item.nodeType === 2 ) {
2936
3076
  item.ownerElement.removeAttribute(item.nodeName);
2937
3077
  }
2938
- log(`xmlPrune: ${item.constructor.name}.${item.nodeName} removed`);
3078
+ safe.uboLog(logPrefix, `${item.constructor.name}.${item.nodeName} removed`);
2939
3079
  }
2940
3080
  } catch(ex) {
2941
- log(ex);
3081
+ safe.uboErr(logPrefix, `Error: ${ex}`);
2942
3082
  }
2943
3083
  return xmlDoc;
2944
3084
  };
@@ -3030,7 +3170,6 @@ builtinScriptlets.push({
3030
3170
  fn: m3uPrune,
3031
3171
  dependencies: [
3032
3172
  'safe-self.fn',
3033
- 'should-log.fn',
3034
3173
  ],
3035
3174
  });
3036
3175
  // https://en.wikipedia.org/wiki/M3U
@@ -3040,9 +3179,8 @@ function m3uPrune(
3040
3179
  ) {
3041
3180
  if ( typeof m3uPattern !== 'string' ) { return; }
3042
3181
  const safe = safeSelf();
3043
- const options = safe.getExtraArgs(Array.from(arguments), 2);
3044
- const logLevel = shouldLog(options);
3045
- const uboLog = logLevel ? ((...args) => safe.uboLog(...args)) : (( ) => { });
3182
+ const logPrefix = safe.makeLogPrefix('m3u-prune', m3uPattern, urlPattern);
3183
+ const toLog = [];
3046
3184
  const regexFromArg = arg => {
3047
3185
  if ( arg === '' ) { return /^/; }
3048
3186
  const match = /^\/(.+)\/([gms]*)$/.exec(arg);
@@ -3061,22 +3199,22 @@ function m3uPrune(
3061
3199
  if ( lines[i].startsWith('#EXT-X-CUE:TYPE="SpliceOut"') === false ) {
3062
3200
  return false;
3063
3201
  }
3064
- uboLog('m3u-prune: discarding', `\n\t${lines[i]}`);
3202
+ toLog.push(`\t${lines[i]}`);
3065
3203
  lines[i] = undefined; i += 1;
3066
3204
  if ( lines[i].startsWith('#EXT-X-ASSET:CAID') ) {
3067
- uboLog(`\t${lines[i]}`);
3205
+ toLog.push(`\t${lines[i]}`);
3068
3206
  lines[i] = undefined; i += 1;
3069
3207
  }
3070
3208
  if ( lines[i].startsWith('#EXT-X-SCTE35:') ) {
3071
- uboLog(`\t${lines[i]}`);
3209
+ toLog.push(`\t${lines[i]}`);
3072
3210
  lines[i] = undefined; i += 1;
3073
3211
  }
3074
3212
  if ( lines[i].startsWith('#EXT-X-CUE-IN') ) {
3075
- uboLog(`\t${lines[i]}`);
3213
+ toLog.push(`\t${lines[i]}`);
3076
3214
  lines[i] = undefined; i += 1;
3077
3215
  }
3078
3216
  if ( lines[i].startsWith('#EXT-X-SCTE35:') ) {
3079
- uboLog(`\t${lines[i]}`);
3217
+ toLog.push(`\t${lines[i]}`);
3080
3218
  lines[i] = undefined; i += 1;
3081
3219
  }
3082
3220
  return true;
@@ -3084,10 +3222,10 @@ function m3uPrune(
3084
3222
  const pruneInfBlock = (lines, i) => {
3085
3223
  if ( lines[i].startsWith('#EXTINF') === false ) { return false; }
3086
3224
  if ( reM3u.test(lines[i+1]) === false ) { return false; }
3087
- uboLog('m3u-prune: discarding', `\n\t${lines[i]}, \n\t${lines[i+1]}`);
3225
+ toLog.push('Discarding', `\t${lines[i]}, \t${lines[i+1]}`);
3088
3226
  lines[i] = lines[i+1] = undefined; i += 2;
3089
3227
  if ( lines[i].startsWith('#EXT-X-DISCONTINUITY') ) {
3090
- uboLog(`\t${lines[i]}`);
3228
+ toLog.push(`\t${lines[i]}`);
3091
3229
  lines[i] = undefined; i += 1;
3092
3230
  }
3093
3231
  return true;
@@ -3124,9 +3262,7 @@ function m3uPrune(
3124
3262
  }
3125
3263
  text = before.trim() + '\n' + after.trim();
3126
3264
  reM3u.lastIndex = before.length + 1;
3127
- uboLog('m3u-prune: discarding\n',
3128
- discard.split(/\n+/).map(s => `\t${s}`).join('\n')
3129
- );
3265
+ toLog.push('Discarding', ...discard.split(/\n+/).map(s => `\t${s}`));
3130
3266
  if ( reM3u.global === false ) { break; }
3131
3267
  }
3132
3268
  return text;
@@ -3151,13 +3287,18 @@ function m3uPrune(
3151
3287
  return Reflect.apply(target, thisArg, args);
3152
3288
  }
3153
3289
  return realFetch(...args).then(realResponse =>
3154
- realResponse.text().then(text =>
3155
- new Response(pruner(text), {
3290
+ realResponse.text().then(text => {
3291
+ const response = new Response(pruner(text), {
3156
3292
  status: realResponse.status,
3157
3293
  statusText: realResponse.statusText,
3158
3294
  headers: realResponse.headers,
3159
- })
3160
- )
3295
+ });
3296
+ if ( toLog.length !== 0 ) {
3297
+ toLog.unshift(logPrefix);
3298
+ safe.uboLog(toLog.join('\n'));
3299
+ }
3300
+ return response;
3301
+ })
3161
3302
  );
3162
3303
  }
3163
3304
  });
@@ -3175,6 +3316,10 @@ function m3uPrune(
3175
3316
  if ( textout === textin ) { return; }
3176
3317
  Object.defineProperty(thisArg, 'response', { value: textout });
3177
3318
  Object.defineProperty(thisArg, 'responseText', { value: textout });
3319
+ if ( toLog.length !== 0 ) {
3320
+ toLog.unshift(logPrefix);
3321
+ safe.uboLog(toLog.join('\n'));
3322
+ }
3178
3323
  });
3179
3324
  return Reflect.apply(target, thisArg, args);
3180
3325
  }
@@ -3220,6 +3365,7 @@ builtinScriptlets.push({
3220
3365
  world: 'ISOLATED',
3221
3366
  dependencies: [
3222
3367
  'run-at.fn',
3368
+ 'safe-self.fn',
3223
3369
  ],
3224
3370
  });
3225
3371
  function hrefSanitizer(
@@ -3228,6 +3374,8 @@ function hrefSanitizer(
3228
3374
  ) {
3229
3375
  if ( typeof selector !== 'string' ) { return; }
3230
3376
  if ( selector === '' ) { return; }
3377
+ const safe = safeSelf();
3378
+ const logPrefix = safe.makeLogPrefix('href-sanitizer', selector, source);
3231
3379
  if ( source === '' ) { source = 'text'; }
3232
3380
  const sanitizeCopycats = (href, text) => {
3233
3381
  let elems = [];
@@ -3239,6 +3387,7 @@ function hrefSanitizer(
3239
3387
  for ( const elem of elems ) {
3240
3388
  elem.setAttribute('href', text);
3241
3389
  }
3390
+ return elems.length;
3242
3391
  };
3243
3392
  const validateURL = text => {
3244
3393
  if ( text === '' ) { return ''; }
@@ -3287,7 +3436,8 @@ function hrefSanitizer(
3287
3436
  if ( hrefAfter === '' ) { continue; }
3288
3437
  if ( hrefAfter === href ) { continue; }
3289
3438
  elem.setAttribute('href', hrefAfter);
3290
- sanitizeCopycats(href, hrefAfter);
3439
+ const count = sanitizeCopycats(href, hrefAfter);
3440
+ safe.uboLog(logPrefix, `Sanitized ${count+1} links to\n${hrefAfter}`);
3291
3441
  }
3292
3442
  return true;
3293
3443
  };
@@ -3402,15 +3552,15 @@ function spoofCSS(
3402
3552
  propToValueMap.set(toCamelCase(args[i+0]), args[i+1]);
3403
3553
  }
3404
3554
  const safe = safeSelf();
3405
- const canDebug = scriptletGlobals.has('canDebug');
3555
+ const logPrefix = safe.makeLogPrefix('spoof-css', selector, ...args);
3556
+ const canDebug = scriptletGlobals.canDebug;
3406
3557
  const shouldDebug = canDebug && propToValueMap.get('debug') || 0;
3407
- const shouldLog = canDebug && propToValueMap.has('log') || 0;
3408
3558
  const spoofStyle = (prop, real) => {
3409
3559
  const normalProp = toCamelCase(prop);
3410
3560
  const shouldSpoof = propToValueMap.has(normalProp);
3411
3561
  const value = shouldSpoof ? propToValueMap.get(normalProp) : real;
3412
- if ( shouldLog === 2 || shouldSpoof && shouldLog === 1 ) {
3413
- safe.uboLog(prop, value);
3562
+ if ( shouldSpoof ) {
3563
+ safe.uboLog(logPrefix, `Spoofing ${prop} to ${value}`);
3414
3564
  }
3415
3565
  return value;
3416
3566
  };
@@ -3524,6 +3674,8 @@ function setCookie(
3524
3674
  path = ''
3525
3675
  ) {
3526
3676
  if ( name === '' ) { return; }
3677
+ const safe = safeSelf();
3678
+ const logPrefix = safe.makeLogPrefix('set-cookie', name, value, path);
3527
3679
  name = encodeURIComponent(name);
3528
3680
 
3529
3681
  const validValues = [
@@ -3548,14 +3700,18 @@ function setCookie(
3548
3700
  if ( n > 15 ) { return; }
3549
3701
  }
3550
3702
 
3551
- setCookieFn(
3703
+ const done = setCookieFn(
3552
3704
  false,
3553
3705
  name,
3554
3706
  value,
3555
3707
  '',
3556
3708
  path,
3557
- safeSelf().getExtraArgs(Array.from(arguments), 3)
3709
+ safe.getExtraArgs(Array.from(arguments), 3)
3558
3710
  );
3711
+
3712
+ if ( done ) {
3713
+ safe.uboLog(logPrefix, 'Done');
3714
+ }
3559
3715
  }
3560
3716
 
3561
3717
  // For compatibility with AdGuard
@@ -3641,6 +3797,7 @@ builtinScriptlets.push({
3641
3797
  world: 'ISOLATED',
3642
3798
  dependencies: [
3643
3799
  'run-at.fn',
3800
+ 'safe-self.fn',
3644
3801
  ],
3645
3802
  });
3646
3803
  function setAttr(
@@ -3648,9 +3805,11 @@ function setAttr(
3648
3805
  attr = '',
3649
3806
  value = ''
3650
3807
  ) {
3651
- if ( typeof selector !== 'string' ) { return; }
3652
3808
  if ( selector === '' ) { return; }
3809
+ if ( attr === '' ) { return; }
3653
3810
 
3811
+ const safe = safeSelf();
3812
+ const logPrefix = safe.makeLogPrefix('set-attr', attr, value);
3654
3813
  const validValues = [ '', 'false', 'true' ];
3655
3814
  let copyFrom = '';
3656
3815
 
@@ -3685,7 +3844,11 @@ function setAttr(
3685
3844
  const before = elem.getAttribute(attr);
3686
3845
  const after = extractValue(elem);
3687
3846
  if ( after === before ) { continue; }
3847
+ if ( after !== '' && /^on/i.test(attr) ) {
3848
+ if ( attr.toLowerCase() in elem ) { continue; }
3849
+ }
3688
3850
  elem.setAttribute(attr, after);
3851
+ safe.uboLog(logPrefix, `${attr}="${after}"`);
3689
3852
  }
3690
3853
  return true;
3691
3854
  };
@@ -3806,6 +3969,58 @@ function multiup() {
3806
3969
  document.addEventListener('click', handler, { capture: true });
3807
3970
  }
3808
3971
 
3972
+ /******************************************************************************/
3973
+
3974
+ builtinScriptlets.push({
3975
+ name: 'remove-cache-storage-item.js',
3976
+ fn: removeCacheStorageItem,
3977
+ world: 'ISOLATED',
3978
+ dependencies: [
3979
+ 'safe-self.fn',
3980
+ ],
3981
+ });
3982
+ function removeCacheStorageItem(
3983
+ cacheNamePattern = '',
3984
+ requestPattern = ''
3985
+ ) {
3986
+ if ( cacheNamePattern === '' ) { return; }
3987
+ const safe = safeSelf();
3988
+ const logPrefix = safe.makeLogPrefix('remove-cache-storage-item', cacheNamePattern, requestPattern);
3989
+ const cacheStorage = self.caches;
3990
+ if ( cacheStorage instanceof Object === false ) { return; }
3991
+ const reCache = safe.patternToRegex(cacheNamePattern, undefined, true);
3992
+ const reRequest = safe.patternToRegex(requestPattern, undefined, true);
3993
+ cacheStorage.keys().then(cacheNames => {
3994
+ for ( const cacheName of cacheNames ) {
3995
+ if ( reCache.test(cacheName) === false ) { continue; }
3996
+ if ( requestPattern === '' ) {
3997
+ cacheStorage.delete(cacheName).then(result => {
3998
+ if ( safe.logLevel > 1 ) {
3999
+ safe.uboLog(logPrefix, `Deleting ${cacheName}`);
4000
+ }
4001
+ if ( result !== true ) { return; }
4002
+ safe.uboLog(logPrefix, `Deleted ${cacheName}: ${result}`);
4003
+ });
4004
+ continue;
4005
+ }
4006
+ cacheStorage.open(cacheName).then(cache => {
4007
+ cache.keys().then(requests => {
4008
+ for ( const request of requests ) {
4009
+ if ( reRequest.test(request.url) === false ) { continue; }
4010
+ if ( safe.logLevel > 1 ) {
4011
+ safe.uboLog(logPrefix, `Deleting ${cacheName}/${request.url}`);
4012
+ }
4013
+ cache.delete(request).then(result => {
4014
+ if ( result !== true ) { return; }
4015
+ safe.uboLog(logPrefix, `Deleted ${cacheName}/${request.url}: ${result}`);
4016
+ });
4017
+ }
4018
+ });
4019
+ });
4020
+ }
4021
+ });
4022
+ }
4023
+
3809
4024
 
3810
4025
  /*******************************************************************************
3811
4026
  *
@@ -3883,13 +4098,13 @@ builtinScriptlets.push({
3883
4098
  ],
3884
4099
  fn: trustedSetConstant,
3885
4100
  dependencies: [
3886
- 'set-constant-core.fn'
4101
+ 'set-constant.fn'
3887
4102
  ],
3888
4103
  });
3889
4104
  function trustedSetConstant(
3890
4105
  ...args
3891
4106
  ) {
3892
- setConstantCore(true, ...args);
4107
+ setConstantFn(true, ...args);
3893
4108
  }
3894
4109
 
3895
4110
  /*******************************************************************************
@@ -3921,6 +4136,8 @@ function trustedSetCookie(
3921
4136
  ) {
3922
4137
  if ( name === '' ) { return; }
3923
4138
 
4139
+ const safe = safeSelf();
4140
+ const logPrefix = safe.makeLogPrefix('set-cookie', name, value, path);
3924
4141
  const time = new Date();
3925
4142
 
3926
4143
  if ( value === '$now$' ) {
@@ -3942,7 +4159,7 @@ function trustedSetCookie(
3942
4159
  expires = time.toUTCString();
3943
4160
  }
3944
4161
 
3945
- setCookieFn(
4162
+ const done = setCookieFn(
3946
4163
  true,
3947
4164
  name,
3948
4165
  value,
@@ -3950,6 +4167,10 @@ function trustedSetCookie(
3950
4167
  path,
3951
4168
  safeSelf().getExtraArgs(Array.from(arguments), 4)
3952
4169
  );
4170
+
4171
+ if ( done ) {
4172
+ safe.uboLog(logPrefix, 'Done');
4173
+ }
3953
4174
  }
3954
4175
 
3955
4176
  // For compatibility with AdGuard
@@ -4018,6 +4239,9 @@ function trustedSetSessionStorageItem(key = '', value = '') {
4018
4239
  builtinScriptlets.push({
4019
4240
  name: 'trusted-replace-fetch-response.js',
4020
4241
  requiresTrust: true,
4242
+ aliases: [
4243
+ 'trusted-rpfr.js',
4244
+ ],
4021
4245
  fn: trustedReplaceFetchResponse,
4022
4246
  dependencies: [
4023
4247
  'replace-fetch-response.fn',
@@ -4037,7 +4261,6 @@ builtinScriptlets.push({
4037
4261
  'match-object-properties.fn',
4038
4262
  'parse-properties-to-match.fn',
4039
4263
  'safe-self.fn',
4040
- 'should-log.fn',
4041
4264
  ],
4042
4265
  });
4043
4266
  function trustedReplaceXhrResponse(
@@ -4046,12 +4269,8 @@ function trustedReplaceXhrResponse(
4046
4269
  propsToMatch = ''
4047
4270
  ) {
4048
4271
  const safe = safeSelf();
4272
+ const logPrefix = safe.makeLogPrefix('trusted-replace-xhr-response', pattern, replacement, propsToMatch);
4049
4273
  const xhrInstances = new WeakMap();
4050
- const extraArgs = safe.getExtraArgs(Array.from(arguments), 3);
4051
- const logLevel = shouldLog({
4052
- log: pattern === '' && 'all' || extraArgs.log,
4053
- });
4054
- const log = logLevel ? ((...args) => { safe.uboLog(...args); }) : (( ) => { });
4055
4274
  if ( pattern === '*' ) { pattern = '.*'; }
4056
4275
  const rePattern = safe.patternToRegex(pattern);
4057
4276
  const propNeedles = parsePropertiesToMatch(propsToMatch, 'url');
@@ -4065,10 +4284,10 @@ function trustedReplaceXhrResponse(
4065
4284
  outcome = 'nomatch';
4066
4285
  }
4067
4286
  }
4068
- if ( outcome === logLevel || outcome === 'all' ) {
4069
- log(`xhr.open(${method}, ${url}, ${args.join(', ')})`);
4070
- }
4071
4287
  if ( outcome === 'match' ) {
4288
+ if ( safe.logLevel > 1 ) {
4289
+ safe.uboLog(logPrefix, `Matched "propsToMatch"`);
4290
+ }
4072
4291
  xhrInstances.set(outerXhr, xhrDetails);
4073
4292
  }
4074
4293
  return super.open(method, url, ...args);
@@ -4094,13 +4313,8 @@ function trustedReplaceXhrResponse(
4094
4313
  }
4095
4314
  const textBefore = innerResponse;
4096
4315
  const textAfter = textBefore.replace(rePattern, replacement);
4097
- const outcome = textAfter !== textBefore ? 'match' : 'nomatch';
4098
- if ( outcome === logLevel || logLevel === 'all' ) {
4099
- log(
4100
- `trusted-replace-xhr-response (${outcome})`,
4101
- `\n\tpattern: ${pattern}`,
4102
- `\n\treplacement: ${replacement}`,
4103
- );
4316
+ if ( textAfter !== textBefore ) {
4317
+ safe.uboLog(logPrefix, 'Match');
4104
4318
  }
4105
4319
  return (xhrDetails.response = textAfter);
4106
4320
  }
@@ -4129,22 +4343,63 @@ builtinScriptlets.push({
4129
4343
  fn: trustedClickElement,
4130
4344
  world: 'ISOLATED',
4131
4345
  dependencies: [
4346
+ 'get-all-cookies.fn',
4347
+ 'get-all-local-storage.fn',
4132
4348
  'run-at-html-element.fn',
4133
4349
  'safe-self.fn',
4134
4350
  ],
4135
4351
  });
4136
4352
  function trustedClickElement(
4137
4353
  selectors = '',
4138
- extraMatch = '', // not yet supported
4354
+ extraMatch = '',
4139
4355
  delay = ''
4140
4356
  ) {
4141
- if ( extraMatch !== '' ) { return; }
4142
-
4143
4357
  const safe = safeSelf();
4144
- const extraArgs = safe.getExtraArgs(Array.from(arguments), 3);
4145
- const uboLog = extraArgs.log !== undefined
4146
- ? ((...args) => { safe.uboLog(...args); })
4147
- : (( ) => { });
4358
+ const logPrefix = safe.makeLogPrefix('trusted-click-element', selectors, extraMatch, delay);
4359
+
4360
+ if ( extraMatch !== '' ) {
4361
+ const assertions = extraMatch.split(',').map(s => {
4362
+ const pos1 = s.indexOf(':');
4363
+ const s1 = pos1 !== -1 ? s.slice(0, pos1) : s;
4364
+ const not = s1.startsWith('!');
4365
+ const type = not ? s1.slice(1) : s1;
4366
+ const s2 = pos1 !== -1 ? s.slice(pos1+1).trim() : '';
4367
+ if ( s2 === '' ) { return; }
4368
+ const out = { not, type };
4369
+ const match = /^\/(.+)\/(i?)$/.exec(s2);
4370
+ if ( match !== null ) {
4371
+ out.re = new RegExp(match[1], match[2] || undefined);
4372
+ return out;
4373
+ }
4374
+ const pos2 = s2.indexOf('=');
4375
+ const key = pos2 !== -1 ? s2.slice(0, pos2).trim() : s2;
4376
+ const value = pos2 !== -1 ? s2.slice(pos2+1).trim() : '';
4377
+ out.re = new RegExp(`^${this.escapeRegexChars(key)}=${this.escapeRegexChars(value)}`);
4378
+ return out;
4379
+ }).filter(details => details !== undefined);
4380
+ const allCookies = assertions.some(o => o.type === 'cookie')
4381
+ ? getAllCookiesFn()
4382
+ : [];
4383
+ const allStorageItems = assertions.some(o => o.type === 'localStorage')
4384
+ ? getAllLocalStorageFn()
4385
+ : [];
4386
+ const hasNeedle = (haystack, needle) => {
4387
+ for ( const { key, value } of haystack ) {
4388
+ if ( needle.test(`${key}=${value}`) ) { return true; }
4389
+ }
4390
+ return false;
4391
+ };
4392
+ for ( const { not, type, re } of assertions ) {
4393
+ switch ( type ) {
4394
+ case 'cookie':
4395
+ if ( hasNeedle(allCookies, re) === not ) { return; }
4396
+ break;
4397
+ case 'localStorage':
4398
+ if ( hasNeedle(allStorageItems, re) === not ) { return; }
4399
+ break;
4400
+ }
4401
+ }
4402
+ }
4148
4403
 
4149
4404
  const querySelectorEx = (selector, context = document) => {
4150
4405
  const pos = selector.indexOf(' >>> ');
@@ -4181,12 +4436,12 @@ function trustedClickElement(
4181
4436
 
4182
4437
  const next = notFound => {
4183
4438
  if ( selectorList.length === 0 ) {
4184
- uboLog(`trusted-click-element: Completed`);
4439
+ safe.uboLog(logPrefix, 'Completed');
4185
4440
  return terminate();
4186
4441
  }
4187
4442
  const tnow = Date.now();
4188
4443
  if ( tnow >= tbye ) {
4189
- uboLog(`trusted-click-element: Timed out`);
4444
+ safe.uboLog(logPrefix, 'Timed out');
4190
4445
  return terminate();
4191
4446
  }
4192
4447
  if ( notFound ) { observe(); }
@@ -4195,7 +4450,7 @@ function trustedClickElement(
4195
4450
  next.timer = undefined;
4196
4451
  process();
4197
4452
  }, delay);
4198
- uboLog(`trusted-click-element: Waiting for ${selectorList[0]}...`);
4453
+ safe.uboLog(logPrefix, `Waiting for ${selectorList[0]}...`);
4199
4454
  };
4200
4455
  next.stop = ( ) => {
4201
4456
  if ( next.timer === undefined ) { return; }
@@ -4239,7 +4494,7 @@ function trustedClickElement(
4239
4494
  selectorList.unshift(selector);
4240
4495
  return next(true);
4241
4496
  }
4242
- uboLog(`trusted-click-element: Clicked ${selector}`);
4497
+ safe.uboLog(logPrefix, `Clicked ${selector}`);
4243
4498
  elem.click();
4244
4499
  tnext += clickDelay;
4245
4500
  next();
@@ -4336,40 +4591,67 @@ builtinScriptlets.push({
4336
4591
  fn: trustedPruneOutboundObject,
4337
4592
  dependencies: [
4338
4593
  'object-prune.fn',
4594
+ 'proxy-apply.fn',
4339
4595
  'safe-self.fn',
4340
4596
  ],
4341
4597
  });
4342
4598
  function trustedPruneOutboundObject(
4343
- entryPoint = '',
4599
+ propChain = '',
4344
4600
  rawPrunePaths = '',
4345
4601
  rawNeedlePaths = ''
4346
4602
  ) {
4347
- if ( entryPoint === '' ) { return; }
4348
- let context = globalThis;
4349
- let prop = entryPoint;
4350
- for (;;) {
4351
- const pos = prop.indexOf('.');
4352
- if ( pos === -1 ) { break; }
4353
- context = context[prop.slice(0, pos)];
4354
- if ( context instanceof Object === false ) { return; }
4355
- prop = prop.slice(pos+1);
4356
- }
4357
- if ( typeof context[prop] !== 'function' ) { return; }
4603
+ if ( propChain === '' ) { return; }
4358
4604
  const safe = safeSelf();
4359
4605
  const extraArgs = safe.getExtraArgs(Array.from(arguments), 3);
4360
- context[prop] = new Proxy(context[prop], {
4361
- apply: function(target, thisArg, args) {
4362
- const objBefore = Reflect.apply(target, thisArg, args);
4363
- if ( objBefore instanceof Object === false ) { return objBefore; }
4364
- const objAfter = objectPruneFn(
4365
- objBefore,
4366
- rawPrunePaths,
4367
- rawNeedlePaths,
4368
- { matchAll: true },
4369
- extraArgs
4370
- );
4371
- return objAfter || objBefore;
4372
- },
4606
+ const reflector = proxyApplyFn(propChain, function(...args) {
4607
+ const objBefore = reflector(...args);
4608
+ if ( objBefore instanceof Object === false ) { return objBefore; }
4609
+ const objAfter = objectPruneFn(
4610
+ objBefore,
4611
+ rawPrunePaths,
4612
+ rawNeedlePaths,
4613
+ { matchAll: true },
4614
+ extraArgs
4615
+ );
4616
+ return objAfter || objBefore;
4617
+ });
4618
+ }
4619
+
4620
+ /******************************************************************************/
4621
+
4622
+ builtinScriptlets.push({
4623
+ name: 'trusted-replace-argument.js',
4624
+ requiresTrust: true,
4625
+ fn: trustedReplaceArgument,
4626
+ dependencies: [
4627
+ 'proxy-apply.fn',
4628
+ 'safe-self.fn',
4629
+ 'validate-constant.fn',
4630
+ ],
4631
+ });
4632
+ function trustedReplaceArgument(
4633
+ propChain = '',
4634
+ argpos = '',
4635
+ argraw = ''
4636
+ ) {
4637
+ if ( propChain === '' ) { return; }
4638
+ if ( argpos === '' ) { return; }
4639
+ if ( argraw === '' ) { return; }
4640
+ const safe = safeSelf();
4641
+ const logPrefix = safe.makeLogPrefix('trusted-replace-argument', propChain, argpos, argraw);
4642
+ const extraArgs = safe.getExtraArgs(Array.from(arguments), 3);
4643
+ const normalValue = validateConstantFn(true, argraw);
4644
+ const reCondition = extraArgs.condition
4645
+ ? safe.patternToRegex(extraArgs.condition)
4646
+ : /^/;
4647
+ const reflector = proxyApplyFn(propChain, function(...args) {
4648
+ const arglist = args[args.length-1];
4649
+ if ( Array.isArray(arglist) === false ) { return reflector(...args); }
4650
+ const argBefore = arglist[argpos];
4651
+ if ( reCondition.test(argBefore) === false ) { return reflector(...args); }
4652
+ arglist[argpos] = normalValue;
4653
+ safe.uboLog(logPrefix, `Replaced argument:\nBefore: ${JSON.stringify(argBefore)}\nAfter: ${normalValue}`);
4654
+ return reflector(...args);
4373
4655
  });
4374
4656
  }
4375
4657