@metamask/snaps-execution-environments 4.0.0 → 5.0.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 (441) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/dist/browserify/iframe/bundle.js +4 -4
  3. package/dist/browserify/iframe/index.html +201 -110
  4. package/dist/browserify/node-process/bundle.js +204 -113
  5. package/dist/browserify/node-thread/bundle.js +204 -113
  6. package/dist/browserify/webview/bundle.js +4 -4
  7. package/dist/browserify/webview/index.html +201 -110
  8. package/dist/browserify/worker-executor/bundle.js +205 -114
  9. package/dist/browserify/worker-pool/bundle.js +4 -4
  10. package/dist/browserify/worker-pool/index.html +201 -110
  11. package/dist/chunk-26EFJQDW.mjs +49 -0
  12. package/dist/chunk-26EFJQDW.mjs.map +1 -0
  13. package/dist/chunk-4NOF6TN6.js +51 -0
  14. package/dist/chunk-4NOF6TN6.js.map +1 -0
  15. package/dist/chunk-5DIRYAYO.js +30 -0
  16. package/dist/chunk-5DIRYAYO.js.map +1 -0
  17. package/dist/chunk-5RKYO2Y5.js +33 -0
  18. package/dist/chunk-5RKYO2Y5.js.map +1 -0
  19. package/dist/chunk-6GHFAQ54.mjs +44 -0
  20. package/dist/chunk-6GHFAQ54.mjs.map +1 -0
  21. package/dist/chunk-A7NJQLUA.mjs +32 -0
  22. package/dist/chunk-A7NJQLUA.mjs.map +1 -0
  23. package/dist/chunk-AJFPA6MI.js +81 -0
  24. package/dist/chunk-AJFPA6MI.js.map +1 -0
  25. package/dist/chunk-AQNACKO6.js +1 -0
  26. package/dist/chunk-AQNACKO6.js.map +1 -0
  27. package/dist/chunk-AZCRNZ5W.js +49 -0
  28. package/dist/chunk-AZCRNZ5W.js.map +1 -0
  29. package/dist/chunk-B3ASGNVQ.mjs +45 -0
  30. package/dist/chunk-B3ASGNVQ.mjs.map +1 -0
  31. package/dist/chunk-BE4YFFMX.js +49 -0
  32. package/dist/chunk-BE4YFFMX.js.map +1 -0
  33. package/dist/chunk-BOCIYCLE.mjs +30 -0
  34. package/dist/chunk-BOCIYCLE.mjs.map +1 -0
  35. package/dist/chunk-CCBKFCGG.js +147 -0
  36. package/dist/chunk-CCBKFCGG.js.map +1 -0
  37. package/dist/chunk-CINBMYIQ.mjs +183 -0
  38. package/dist/chunk-CINBMYIQ.mjs.map +1 -0
  39. package/dist/chunk-EBECHU6M.js +92 -0
  40. package/dist/chunk-EBECHU6M.js.map +1 -0
  41. package/dist/chunk-ETXAWW65.mjs +86 -0
  42. package/dist/chunk-ETXAWW65.mjs.map +1 -0
  43. package/dist/chunk-EXN2TFDJ.js +38 -0
  44. package/dist/chunk-EXN2TFDJ.js.map +1 -0
  45. package/dist/chunk-FNRATYYY.mjs +24 -0
  46. package/dist/chunk-FNRATYYY.mjs.map +1 -0
  47. package/dist/chunk-FQBU72MW.mjs +16 -0
  48. package/dist/chunk-FQBU72MW.mjs.map +1 -0
  49. package/dist/chunk-G3NCGVCC.mjs +33 -0
  50. package/dist/chunk-G3NCGVCC.mjs.map +1 -0
  51. package/dist/chunk-GH6FPDY5.mjs +147 -0
  52. package/dist/chunk-GH6FPDY5.mjs.map +1 -0
  53. package/dist/chunk-HSZIPZHO.js +183 -0
  54. package/dist/chunk-HSZIPZHO.js.map +1 -0
  55. package/dist/chunk-IU54VPNO.js +67 -0
  56. package/dist/chunk-IU54VPNO.js.map +1 -0
  57. package/dist/chunk-IXYNAYMQ.js +33 -0
  58. package/dist/chunk-IXYNAYMQ.js.map +1 -0
  59. package/dist/chunk-IY3CYGH7.js +44 -0
  60. package/dist/chunk-IY3CYGH7.js.map +1 -0
  61. package/dist/chunk-KQNKD7G5.mjs +40 -0
  62. package/dist/chunk-KQNKD7G5.mjs.map +1 -0
  63. package/dist/chunk-KWFB2KH2.mjs +73 -0
  64. package/dist/chunk-KWFB2KH2.mjs.map +1 -0
  65. package/dist/chunk-L4G6IIWG.js +484 -0
  66. package/dist/chunk-L4G6IIWG.js.map +1 -0
  67. package/dist/chunk-L5U2LMZR.js +26 -0
  68. package/dist/chunk-L5U2LMZR.js.map +1 -0
  69. package/dist/chunk-LGC7HQR4.js +32 -0
  70. package/dist/chunk-LGC7HQR4.js.map +1 -0
  71. package/dist/chunk-LX5LQXYU.js +16 -0
  72. package/dist/chunk-LX5LQXYU.js.map +1 -0
  73. package/dist/chunk-M2OYI2NS.js +108 -0
  74. package/dist/chunk-M2OYI2NS.js.map +1 -0
  75. package/dist/chunk-MOWPAP2K.mjs +92 -0
  76. package/dist/chunk-MOWPAP2K.mjs.map +1 -0
  77. package/dist/chunk-N7URTBJV.js +73 -0
  78. package/dist/chunk-N7URTBJV.js.map +1 -0
  79. package/dist/chunk-OW4IXJ5J.mjs +484 -0
  80. package/dist/chunk-OW4IXJ5J.mjs.map +1 -0
  81. package/dist/chunk-OWG545LQ.js +45 -0
  82. package/dist/chunk-OWG545LQ.js.map +1 -0
  83. package/dist/chunk-QYFJ2LLW.js +86 -0
  84. package/dist/chunk-QYFJ2LLW.js.map +1 -0
  85. package/dist/chunk-RCPCISJD.mjs +16 -0
  86. package/dist/chunk-RCPCISJD.mjs.map +1 -0
  87. package/dist/chunk-RDFGQYG6.mjs +147 -0
  88. package/dist/chunk-RDFGQYG6.mjs.map +1 -0
  89. package/dist/chunk-RO347OMD.js +16 -0
  90. package/dist/chunk-RO347OMD.js.map +1 -0
  91. package/dist/chunk-RWBJNNGH.js +24 -0
  92. package/dist/chunk-RWBJNNGH.js.map +1 -0
  93. package/dist/chunk-S7LRB72P.js +38 -0
  94. package/dist/chunk-S7LRB72P.js.map +1 -0
  95. package/dist/chunk-SWINKAMI.js +147 -0
  96. package/dist/chunk-SWINKAMI.js.map +1 -0
  97. package/dist/chunk-TVV27HGP.mjs +81 -0
  98. package/dist/chunk-TVV27HGP.mjs.map +1 -0
  99. package/dist/chunk-TWF4RAXL.mjs +49 -0
  100. package/dist/chunk-TWF4RAXL.mjs.map +1 -0
  101. package/dist/chunk-VL3VNUT4.mjs +12 -0
  102. package/dist/chunk-VL3VNUT4.mjs.map +1 -0
  103. package/dist/chunk-VZS2LXDP.mjs +108 -0
  104. package/dist/chunk-VZS2LXDP.mjs.map +1 -0
  105. package/dist/chunk-WA7K3P4D.js +40 -0
  106. package/dist/chunk-WA7K3P4D.js.map +1 -0
  107. package/dist/chunk-XBKAIK2K.mjs +67 -0
  108. package/dist/chunk-XBKAIK2K.mjs.map +1 -0
  109. package/dist/chunk-XGCWN6ZD.mjs +262 -0
  110. package/dist/chunk-XGCWN6ZD.mjs.map +1 -0
  111. package/dist/chunk-XKY46YTJ.js +12 -0
  112. package/dist/chunk-XKY46YTJ.js.map +1 -0
  113. package/dist/chunk-XL5BQOEI.mjs +33 -0
  114. package/dist/chunk-XL5BQOEI.mjs.map +1 -0
  115. package/dist/chunk-XMCETCVM.js +48 -0
  116. package/dist/chunk-XMCETCVM.js.map +1 -0
  117. package/dist/chunk-XYRWHY3K.mjs +51 -0
  118. package/dist/chunk-XYRWHY3K.mjs.map +1 -0
  119. package/dist/chunk-Y7IEFWZU.mjs +26 -0
  120. package/dist/chunk-Y7IEFWZU.mjs.map +1 -0
  121. package/dist/chunk-YC3HWHJV.mjs +48 -0
  122. package/dist/chunk-YC3HWHJV.mjs.map +1 -0
  123. package/dist/chunk-YMAK7TUO.mjs +1 -0
  124. package/dist/chunk-YMAK7TUO.mjs.map +1 -0
  125. package/dist/chunk-YRZVIDCF.mjs +38 -0
  126. package/dist/chunk-YRZVIDCF.mjs.map +1 -0
  127. package/dist/chunk-Z7FBBBME.mjs +38 -0
  128. package/dist/chunk-Z7FBBBME.mjs.map +1 -0
  129. package/dist/chunk-ZMDJRC2Z.js +262 -0
  130. package/dist/chunk-ZMDJRC2Z.js.map +1 -0
  131. package/dist/common/BaseSnapExecutor.js +26 -0
  132. package/dist/common/BaseSnapExecutor.js.map +1 -0
  133. package/dist/common/BaseSnapExecutor.mjs +26 -0
  134. package/dist/common/BaseSnapExecutor.mjs.map +1 -0
  135. package/dist/common/commands.js +11 -0
  136. package/dist/common/commands.js.map +1 -0
  137. package/dist/common/commands.mjs +11 -0
  138. package/dist/common/commands.mjs.map +1 -0
  139. package/dist/common/endowments/commonEndowmentFactory.js +20 -0
  140. package/dist/common/endowments/commonEndowmentFactory.js.map +1 -0
  141. package/dist/common/endowments/commonEndowmentFactory.mjs +20 -0
  142. package/dist/common/endowments/commonEndowmentFactory.mjs.map +1 -0
  143. package/dist/common/endowments/console.js +13 -0
  144. package/dist/common/endowments/console.js.map +1 -0
  145. package/dist/common/endowments/console.mjs +13 -0
  146. package/dist/common/endowments/console.mjs.map +1 -0
  147. package/dist/common/endowments/crypto.js +11 -0
  148. package/dist/common/endowments/crypto.js.map +1 -0
  149. package/dist/common/endowments/crypto.mjs +11 -0
  150. package/dist/common/endowments/crypto.mjs.map +1 -0
  151. package/dist/common/endowments/date.js +9 -0
  152. package/dist/common/endowments/date.js.map +1 -0
  153. package/dist/common/endowments/date.mjs +9 -0
  154. package/dist/common/endowments/date.mjs.map +1 -0
  155. package/dist/common/endowments/index.js +21 -0
  156. package/dist/common/endowments/index.js.map +1 -0
  157. package/dist/common/endowments/index.mjs +21 -0
  158. package/dist/common/endowments/index.mjs.map +1 -0
  159. package/dist/common/endowments/interval.js +8 -0
  160. package/dist/common/endowments/interval.js.map +1 -0
  161. package/dist/common/endowments/interval.mjs +8 -0
  162. package/dist/common/endowments/interval.mjs.map +1 -0
  163. package/dist/common/endowments/math.js +10 -0
  164. package/dist/common/endowments/math.js.map +1 -0
  165. package/dist/common/endowments/math.mjs +10 -0
  166. package/dist/common/endowments/math.mjs.map +1 -0
  167. package/dist/common/endowments/network.js +10 -0
  168. package/dist/common/endowments/network.js.map +1 -0
  169. package/dist/common/endowments/network.mjs +10 -0
  170. package/dist/common/endowments/network.mjs.map +1 -0
  171. package/dist/common/endowments/textDecoder.js +8 -0
  172. package/dist/common/endowments/textDecoder.js.map +1 -0
  173. package/dist/common/endowments/textDecoder.mjs +8 -0
  174. package/dist/common/endowments/textDecoder.mjs.map +1 -0
  175. package/dist/common/endowments/textEncoder.js +8 -0
  176. package/dist/common/endowments/textEncoder.js.map +1 -0
  177. package/dist/common/endowments/textEncoder.mjs +8 -0
  178. package/dist/common/endowments/textEncoder.mjs.map +1 -0
  179. package/dist/common/endowments/timeout.js +8 -0
  180. package/dist/common/endowments/timeout.js.map +1 -0
  181. package/dist/common/endowments/timeout.mjs +8 -0
  182. package/dist/common/endowments/timeout.mjs.map +1 -0
  183. package/dist/common/globalEvents.js +11 -0
  184. package/dist/common/globalEvents.js.map +1 -0
  185. package/dist/common/globalEvents.mjs +11 -0
  186. package/dist/common/globalEvents.mjs.map +1 -0
  187. package/dist/common/globalObject.js +10 -0
  188. package/dist/common/globalObject.js.map +1 -0
  189. package/dist/common/globalObject.mjs +10 -0
  190. package/dist/common/globalObject.mjs.map +1 -0
  191. package/dist/common/lockdown/lockdown-events.js +8 -0
  192. package/dist/common/lockdown/lockdown-events.js.map +1 -0
  193. package/dist/common/lockdown/lockdown-events.mjs +8 -0
  194. package/dist/common/lockdown/lockdown-events.mjs.map +1 -0
  195. package/dist/common/lockdown/lockdown-more.js +8 -0
  196. package/dist/common/lockdown/lockdown-more.js.map +1 -0
  197. package/dist/common/lockdown/lockdown-more.mjs +8 -0
  198. package/dist/common/lockdown/lockdown-more.mjs.map +1 -0
  199. package/dist/common/lockdown/lockdown.js +22 -0
  200. package/dist/common/lockdown/lockdown.js.map +1 -0
  201. package/dist/common/lockdown/lockdown.mjs +22 -0
  202. package/dist/common/lockdown/lockdown.mjs.map +1 -0
  203. package/dist/common/sortParams.js +8 -0
  204. package/dist/common/sortParams.js.map +1 -0
  205. package/dist/common/sortParams.mjs +8 -0
  206. package/dist/common/sortParams.mjs.map +1 -0
  207. package/dist/common/utils.js +21 -0
  208. package/dist/common/utils.js.map +1 -0
  209. package/dist/common/utils.mjs +21 -0
  210. package/dist/common/utils.mjs.map +1 -0
  211. package/dist/common/validation.js +38 -0
  212. package/dist/common/validation.js.map +1 -0
  213. package/dist/common/validation.mjs +38 -0
  214. package/dist/common/validation.mjs.map +1 -0
  215. package/dist/globals.d.js +1 -0
  216. package/dist/globals.d.js.map +1 -0
  217. package/dist/globals.d.mjs +1 -0
  218. package/dist/globals.d.mjs.map +1 -0
  219. package/dist/iframe/IFrameSnapExecutor.js +27 -0
  220. package/dist/iframe/IFrameSnapExecutor.js.map +1 -0
  221. package/dist/iframe/IFrameSnapExecutor.mjs +27 -0
  222. package/dist/iframe/IFrameSnapExecutor.mjs.map +1 -0
  223. package/dist/iframe/index.js +35 -0
  224. package/dist/iframe/index.js.map +1 -0
  225. package/dist/iframe/index.mjs +35 -0
  226. package/dist/iframe/index.mjs.map +1 -0
  227. package/dist/index.js +9 -0
  228. package/dist/index.js.map +1 -0
  229. package/dist/index.mjs +9 -0
  230. package/dist/index.mjs.map +1 -0
  231. package/dist/logging.js +8 -0
  232. package/dist/logging.js.map +1 -0
  233. package/dist/logging.mjs +8 -0
  234. package/dist/logging.mjs.map +1 -0
  235. package/dist/node-process/ChildProcessSnapExecutor.js +27 -0
  236. package/dist/node-process/ChildProcessSnapExecutor.js.map +1 -0
  237. package/dist/node-process/ChildProcessSnapExecutor.mjs +27 -0
  238. package/dist/node-process/ChildProcessSnapExecutor.mjs.map +1 -0
  239. package/dist/node-process/index.js +31 -0
  240. package/dist/node-process/index.js.map +1 -0
  241. package/dist/node-process/index.mjs +31 -0
  242. package/dist/node-process/index.mjs.map +1 -0
  243. package/dist/node-thread/ThreadSnapExecutor.js +27 -0
  244. package/dist/node-thread/ThreadSnapExecutor.js.map +1 -0
  245. package/dist/node-thread/ThreadSnapExecutor.mjs +27 -0
  246. package/dist/node-thread/ThreadSnapExecutor.mjs.map +1 -0
  247. package/dist/node-thread/index.js +31 -0
  248. package/dist/node-thread/index.js.map +1 -0
  249. package/dist/node-thread/index.mjs +31 -0
  250. package/dist/node-thread/index.mjs.map +1 -0
  251. package/dist/proxy/ProxySnapExecutor.js +8 -0
  252. package/dist/proxy/ProxySnapExecutor.js.map +1 -0
  253. package/dist/proxy/ProxySnapExecutor.mjs +8 -0
  254. package/dist/proxy/ProxySnapExecutor.mjs.map +1 -0
  255. package/dist/proxy/index.js +9 -0
  256. package/dist/proxy/index.js.map +1 -0
  257. package/dist/proxy/index.mjs +9 -0
  258. package/dist/proxy/index.mjs.map +1 -0
  259. package/dist/tsconfig.build.tsbuildinfo +1 -0
  260. package/dist/types/common/utils.d.ts +7 -0
  261. package/dist/types/vendor/global.d.js +1 -0
  262. package/dist/types/vendor/global.d.js.map +1 -0
  263. package/dist/types/vendor/global.d.mjs +1 -0
  264. package/dist/types/vendor/global.d.mjs.map +1 -0
  265. package/dist/types/vendor/readable-stream.d.js +1 -0
  266. package/dist/types/vendor/readable-stream.d.js.map +1 -0
  267. package/dist/types/vendor/readable-stream.d.mjs +1 -0
  268. package/dist/types/vendor/readable-stream.d.mjs.map +1 -0
  269. package/dist/webview/WebViewExecutorStream.js +8 -0
  270. package/dist/webview/WebViewExecutorStream.js.map +1 -0
  271. package/dist/webview/WebViewExecutorStream.mjs +8 -0
  272. package/dist/webview/WebViewExecutorStream.mjs.map +1 -0
  273. package/dist/webview/index.js +26 -0
  274. package/dist/webview/index.js.map +1 -0
  275. package/dist/webview/index.mjs +26 -0
  276. package/dist/webview/index.mjs.map +1 -0
  277. package/dist/webworker/executor/WebWorkerSnapExecutor.js +27 -0
  278. package/dist/webworker/executor/WebWorkerSnapExecutor.js.map +1 -0
  279. package/dist/webworker/executor/WebWorkerSnapExecutor.mjs +27 -0
  280. package/dist/webworker/executor/WebWorkerSnapExecutor.mjs.map +1 -0
  281. package/dist/webworker/executor/index.js +35 -0
  282. package/dist/webworker/executor/index.js.map +1 -0
  283. package/dist/webworker/executor/index.mjs +35 -0
  284. package/dist/webworker/executor/index.mjs.map +1 -0
  285. package/dist/webworker/pool/WebWorkerPool.js +8 -0
  286. package/dist/webworker/pool/WebWorkerPool.js.map +1 -0
  287. package/dist/webworker/pool/WebWorkerPool.mjs +8 -0
  288. package/dist/webworker/pool/WebWorkerPool.mjs.map +1 -0
  289. package/dist/webworker/pool/index.js +16 -0
  290. package/dist/webworker/pool/index.js.map +1 -0
  291. package/dist/webworker/pool/index.mjs +16 -0
  292. package/dist/webworker/pool/index.mjs.map +1 -0
  293. package/package.json +29 -22
  294. package/dist/cjs/common/BaseSnapExecutor.js +0 -496
  295. package/dist/cjs/common/BaseSnapExecutor.js.map +0 -1
  296. package/dist/cjs/common/commands.js +0 -102
  297. package/dist/cjs/common/commands.js.map +0 -1
  298. package/dist/cjs/common/endowments/commonEndowmentFactory.js +0 -147
  299. package/dist/cjs/common/endowments/commonEndowmentFactory.js.map +0 -1
  300. package/dist/cjs/common/endowments/console.js +0 -134
  301. package/dist/cjs/common/endowments/console.js.map +0 -1
  302. package/dist/cjs/common/endowments/crypto.js +0 -44
  303. package/dist/cjs/common/endowments/crypto.js.map +0 -1
  304. package/dist/cjs/common/endowments/date.js +0 -53
  305. package/dist/cjs/common/endowments/date.js.map +0 -1
  306. package/dist/cjs/common/endowments/index.js +0 -93
  307. package/dist/cjs/common/endowments/index.js.map +0 -1
  308. package/dist/cjs/common/endowments/interval.js +0 -62
  309. package/dist/cjs/common/endowments/interval.js.map +0 -1
  310. package/dist/cjs/common/endowments/math.js +0 -67
  311. package/dist/cjs/common/endowments/math.js.map +0 -1
  312. package/dist/cjs/common/endowments/network.js +0 -303
  313. package/dist/cjs/common/endowments/network.js.map +0 -1
  314. package/dist/cjs/common/endowments/textDecoder.js +0 -28
  315. package/dist/cjs/common/endowments/textDecoder.js.map +0 -1
  316. package/dist/cjs/common/endowments/textEncoder.js +0 -28
  317. package/dist/cjs/common/endowments/textEncoder.js.map +0 -1
  318. package/dist/cjs/common/endowments/timeout.js +0 -64
  319. package/dist/cjs/common/endowments/timeout.js.map +0 -1
  320. package/dist/cjs/common/globalEvents.js +0 -40
  321. package/dist/cjs/common/globalEvents.js.map +0 -1
  322. package/dist/cjs/common/globalObject.js +0 -53
  323. package/dist/cjs/common/globalObject.js.map +0 -1
  324. package/dist/cjs/common/lockdown/lockdown-events.js +0 -74
  325. package/dist/cjs/common/lockdown/lockdown-events.js.map +0 -1
  326. package/dist/cjs/common/lockdown/lockdown-more.js +0 -73
  327. package/dist/cjs/common/lockdown/lockdown-more.js.map +0 -1
  328. package/dist/cjs/common/lockdown/lockdown.js +0 -30
  329. package/dist/cjs/common/lockdown/lockdown.js.map +0 -1
  330. package/dist/cjs/common/sortParams.js +0 -26
  331. package/dist/cjs/common/sortParams.js.map +0 -1
  332. package/dist/cjs/common/utils.js +0 -128
  333. package/dist/cjs/common/utils.js.map +0 -1
  334. package/dist/cjs/common/validation.js +0 -149
  335. package/dist/cjs/common/validation.js.map +0 -1
  336. package/dist/cjs/iframe/IFrameSnapExecutor.js +0 -50
  337. package/dist/cjs/iframe/IFrameSnapExecutor.js.map +0 -1
  338. package/dist/cjs/iframe/index.js +0 -13
  339. package/dist/cjs/iframe/index.js.map +0 -1
  340. package/dist/cjs/index.js +0 -20
  341. package/dist/cjs/index.js.map +0 -1
  342. package/dist/cjs/logging.js +0 -15
  343. package/dist/cjs/logging.js.map +0 -1
  344. package/dist/cjs/node-process/ChildProcessSnapExecutor.js +0 -39
  345. package/dist/cjs/node-process/ChildProcessSnapExecutor.js.map +0 -1
  346. package/dist/cjs/node-process/index.js +0 -11
  347. package/dist/cjs/node-process/index.js.map +0 -1
  348. package/dist/cjs/node-thread/ThreadSnapExecutor.js +0 -39
  349. package/dist/cjs/node-thread/ThreadSnapExecutor.js.map +0 -1
  350. package/dist/cjs/node-thread/index.js +0 -11
  351. package/dist/cjs/node-thread/index.js.map +0 -1
  352. package/dist/cjs/proxy/ProxySnapExecutor.js +0 -183
  353. package/dist/cjs/proxy/ProxySnapExecutor.js.map +0 -1
  354. package/dist/cjs/proxy/index.js +0 -20
  355. package/dist/cjs/proxy/index.js.map +0 -1
  356. package/dist/cjs/webview/WebViewExecutorStream.js +0 -121
  357. package/dist/cjs/webview/WebViewExecutorStream.js.map +0 -1
  358. package/dist/cjs/webview/index.js +0 -19
  359. package/dist/cjs/webview/index.js.map +0 -1
  360. package/dist/cjs/webworker/executor/WebWorkerSnapExecutor.js +0 -45
  361. package/dist/cjs/webworker/executor/WebWorkerSnapExecutor.js.map +0 -1
  362. package/dist/cjs/webworker/executor/index.js +0 -13
  363. package/dist/cjs/webworker/executor/index.js.map +0 -1
  364. package/dist/cjs/webworker/pool/WebWorkerPool.js +0 -248
  365. package/dist/cjs/webworker/pool/WebWorkerPool.js.map +0 -1
  366. package/dist/cjs/webworker/pool/index.js +0 -13
  367. package/dist/cjs/webworker/pool/index.js.map +0 -1
  368. package/dist/esm/common/BaseSnapExecutor.js +0 -486
  369. package/dist/esm/common/BaseSnapExecutor.js.map +0 -1
  370. package/dist/esm/common/commands.js +0 -101
  371. package/dist/esm/common/commands.js.map +0 -1
  372. package/dist/esm/common/endowments/commonEndowmentFactory.js +0 -132
  373. package/dist/esm/common/endowments/commonEndowmentFactory.js.map +0 -1
  374. package/dist/esm/common/endowments/console.js +0 -116
  375. package/dist/esm/common/endowments/console.js.map +0 -1
  376. package/dist/esm/common/endowments/crypto.js +0 -26
  377. package/dist/esm/common/endowments/crypto.js.map +0 -1
  378. package/dist/esm/common/endowments/date.js +0 -43
  379. package/dist/esm/common/endowments/date.js.map +0 -1
  380. package/dist/esm/common/endowments/index.js +0 -92
  381. package/dist/esm/common/endowments/index.js.map +0 -1
  382. package/dist/esm/common/endowments/interval.js +0 -52
  383. package/dist/esm/common/endowments/interval.js.map +0 -1
  384. package/dist/esm/common/endowments/math.js +0 -57
  385. package/dist/esm/common/endowments/math.js.map +0 -1
  386. package/dist/esm/common/endowments/network.js +0 -293
  387. package/dist/esm/common/endowments/network.js.map +0 -1
  388. package/dist/esm/common/endowments/textDecoder.js +0 -18
  389. package/dist/esm/common/endowments/textDecoder.js.map +0 -1
  390. package/dist/esm/common/endowments/textEncoder.js +0 -18
  391. package/dist/esm/common/endowments/textEncoder.js.map +0 -1
  392. package/dist/esm/common/endowments/timeout.js +0 -54
  393. package/dist/esm/common/endowments/timeout.js.map +0 -1
  394. package/dist/esm/common/globalEvents.js +0 -36
  395. package/dist/esm/common/globalEvents.js.map +0 -1
  396. package/dist/esm/common/globalObject.js +0 -36
  397. package/dist/esm/common/globalObject.js.map +0 -1
  398. package/dist/esm/common/lockdown/lockdown-events.js +0 -66
  399. package/dist/esm/common/lockdown/lockdown-events.js.map +0 -1
  400. package/dist/esm/common/lockdown/lockdown-more.js +0 -82
  401. package/dist/esm/common/lockdown/lockdown-more.js.map +0 -1
  402. package/dist/esm/common/lockdown/lockdown.js +0 -24
  403. package/dist/esm/common/lockdown/lockdown.js.map +0 -1
  404. package/dist/esm/common/sortParams.js +0 -29
  405. package/dist/esm/common/sortParams.js.map +0 -1
  406. package/dist/esm/common/utils.js +0 -128
  407. package/dist/esm/common/utils.js.map +0 -1
  408. package/dist/esm/common/validation.js +0 -127
  409. package/dist/esm/common/validation.js.map +0 -1
  410. package/dist/esm/iframe/IFrameSnapExecutor.js +0 -35
  411. package/dist/esm/iframe/IFrameSnapExecutor.js.map +0 -1
  412. package/dist/esm/iframe/index.js +0 -9
  413. package/dist/esm/iframe/index.js.map +0 -1
  414. package/dist/esm/index.js +0 -3
  415. package/dist/esm/index.js.map +0 -1
  416. package/dist/esm/logging.js +0 -10
  417. package/dist/esm/logging.js.map +0 -1
  418. package/dist/esm/node-process/ChildProcessSnapExecutor.js +0 -24
  419. package/dist/esm/node-process/ChildProcessSnapExecutor.js.map +0 -1
  420. package/dist/esm/node-process/index.js +0 -7
  421. package/dist/esm/node-process/index.js.map +0 -1
  422. package/dist/esm/node-thread/ThreadSnapExecutor.js +0 -24
  423. package/dist/esm/node-thread/ThreadSnapExecutor.js.map +0 -1
  424. package/dist/esm/node-thread/index.js +0 -7
  425. package/dist/esm/node-thread/index.js.map +0 -1
  426. package/dist/esm/proxy/ProxySnapExecutor.js +0 -181
  427. package/dist/esm/proxy/ProxySnapExecutor.js.map +0 -1
  428. package/dist/esm/proxy/index.js +0 -3
  429. package/dist/esm/proxy/index.js.map +0 -1
  430. package/dist/esm/webview/WebViewExecutorStream.js +0 -111
  431. package/dist/esm/webview/WebViewExecutorStream.js.map +0 -1
  432. package/dist/esm/webview/index.js +0 -15
  433. package/dist/esm/webview/index.js.map +0 -1
  434. package/dist/esm/webworker/executor/WebWorkerSnapExecutor.js +0 -30
  435. package/dist/esm/webworker/executor/WebWorkerSnapExecutor.js.map +0 -1
  436. package/dist/esm/webworker/executor/index.js +0 -9
  437. package/dist/esm/webworker/executor/index.js.map +0 -1
  438. package/dist/esm/webworker/pool/WebWorkerPool.js +0 -245
  439. package/dist/esm/webworker/pool/WebWorkerPool.js.map +0 -1
  440. package/dist/esm/webworker/pool/index.js +0 -9
  441. package/dist/esm/webworker/pool/index.js.map +0 -1
@@ -1,293 +0,0 @@
1
- function _check_private_redeclaration(obj, privateCollection) {
2
- if (privateCollection.has(obj)) {
3
- throw new TypeError("Cannot initialize the same private elements twice on an object");
4
- }
5
- }
6
- function _class_apply_descriptor_get(receiver, descriptor) {
7
- if (descriptor.get) {
8
- return descriptor.get.call(receiver);
9
- }
10
- return descriptor.value;
11
- }
12
- function _class_apply_descriptor_set(receiver, descriptor, value) {
13
- if (descriptor.set) {
14
- descriptor.set.call(receiver, value);
15
- } else {
16
- if (!descriptor.writable) {
17
- throw new TypeError("attempted to set read only private field");
18
- }
19
- descriptor.value = value;
20
- }
21
- }
22
- function _class_extract_field_descriptor(receiver, privateMap, action) {
23
- if (!privateMap.has(receiver)) {
24
- throw new TypeError("attempted to " + action + " private field on non-instance");
25
- }
26
- return privateMap.get(receiver);
27
- }
28
- function _class_private_field_get(receiver, privateMap) {
29
- var descriptor = _class_extract_field_descriptor(receiver, privateMap, "get");
30
- return _class_apply_descriptor_get(receiver, descriptor);
31
- }
32
- function _class_private_field_init(obj, privateMap, value) {
33
- _check_private_redeclaration(obj, privateMap);
34
- privateMap.set(obj, value);
35
- }
36
- function _class_private_field_set(receiver, privateMap, value) {
37
- var descriptor = _class_extract_field_descriptor(receiver, privateMap, "set");
38
- _class_apply_descriptor_set(receiver, descriptor, value);
39
- return value;
40
- }
41
- import { assert } from '@metamask/utils';
42
- import { withTeardown } from '../utils';
43
- var _teardownRef = /*#__PURE__*/ new WeakMap(), _ogResponse = /*#__PURE__*/ new WeakMap(), _onStart = /*#__PURE__*/ new WeakMap(), _onFinish = /*#__PURE__*/ new WeakMap();
44
- /**
45
- * This class wraps a Response object.
46
- * That way, a teardown process can stop any processes left.
47
- */ class ResponseWrapper {
48
- get body() {
49
- return _class_private_field_get(this, _ogResponse).body;
50
- }
51
- get bodyUsed() {
52
- return _class_private_field_get(this, _ogResponse).bodyUsed;
53
- }
54
- get headers() {
55
- return _class_private_field_get(this, _ogResponse).headers;
56
- }
57
- get ok() {
58
- return _class_private_field_get(this, _ogResponse).ok;
59
- }
60
- get redirected() {
61
- return _class_private_field_get(this, _ogResponse).redirected;
62
- }
63
- get status() {
64
- return _class_private_field_get(this, _ogResponse).status;
65
- }
66
- get statusText() {
67
- return _class_private_field_get(this, _ogResponse).statusText;
68
- }
69
- get type() {
70
- return _class_private_field_get(this, _ogResponse).type;
71
- }
72
- get url() {
73
- return _class_private_field_get(this, _ogResponse).url;
74
- }
75
- async text() {
76
- return await withTeardown((async ()=>{
77
- await _class_private_field_get(this, _onStart).call(this);
78
- try {
79
- return await _class_private_field_get(this, _ogResponse).text();
80
- } finally{
81
- await _class_private_field_get(this, _onFinish).call(this);
82
- }
83
- })(), _class_private_field_get(this, _teardownRef));
84
- }
85
- async arrayBuffer() {
86
- return await withTeardown((async ()=>{
87
- await _class_private_field_get(this, _onStart).call(this);
88
- try {
89
- return await _class_private_field_get(this, _ogResponse).arrayBuffer();
90
- } finally{
91
- await _class_private_field_get(this, _onFinish).call(this);
92
- }
93
- })(), _class_private_field_get(this, _teardownRef));
94
- }
95
- async blob() {
96
- return await withTeardown((async ()=>{
97
- await _class_private_field_get(this, _onStart).call(this);
98
- try {
99
- return await _class_private_field_get(this, _ogResponse).blob();
100
- } finally{
101
- await _class_private_field_get(this, _onFinish).call(this);
102
- }
103
- })(), _class_private_field_get(this, _teardownRef));
104
- }
105
- clone() {
106
- const newResponse = _class_private_field_get(this, _ogResponse).clone();
107
- return new ResponseWrapper(newResponse, _class_private_field_get(this, _teardownRef), _class_private_field_get(this, _onStart), _class_private_field_get(this, _onFinish));
108
- }
109
- async formData() {
110
- return await withTeardown((async ()=>{
111
- await _class_private_field_get(this, _onStart).call(this);
112
- try {
113
- return await _class_private_field_get(this, _ogResponse).formData();
114
- } finally{
115
- await _class_private_field_get(this, _onFinish).call(this);
116
- }
117
- })(), _class_private_field_get(this, _teardownRef));
118
- }
119
- async json() {
120
- return await withTeardown((async ()=>{
121
- await _class_private_field_get(this, _onStart).call(this);
122
- try {
123
- return await _class_private_field_get(this, _ogResponse).json();
124
- } finally{
125
- await _class_private_field_get(this, _onFinish).call(this);
126
- }
127
- })(), _class_private_field_get(this, _teardownRef));
128
- }
129
- constructor(ogResponse, teardownRef, onStart, onFinish){
130
- _class_private_field_init(this, _teardownRef, {
131
- writable: true,
132
- value: void 0
133
- });
134
- _class_private_field_init(this, _ogResponse, {
135
- writable: true,
136
- value: void 0
137
- });
138
- _class_private_field_init(this, _onStart, {
139
- writable: true,
140
- value: void 0
141
- });
142
- _class_private_field_init(this, _onFinish, {
143
- writable: true,
144
- value: void 0
145
- });
146
- _class_private_field_set(this, _ogResponse, ogResponse);
147
- _class_private_field_set(this, _teardownRef, teardownRef);
148
- _class_private_field_set(this, _onStart, onStart);
149
- _class_private_field_set(this, _onFinish, onFinish);
150
- }
151
- }
152
- /**
153
- * Create a network endowment, consisting of a `fetch` function.
154
- * This allows us to provide a teardown function, so that we can cancel
155
- * any pending requests, connections, streams, etc. that may be open when a snap
156
- * is terminated.
157
- *
158
- * This wraps the original implementation of `fetch`,
159
- * to ensure that a bad actor cannot get access to the original function, thus
160
- * potentially preventing the network requests from being torn down.
161
- *
162
- * @param options - An options bag.
163
- * @param options.notify - A reference to the notify function of the snap executor.
164
- * @returns An object containing a wrapped `fetch`
165
- * function, as well as a teardown function.
166
- */ const createNetwork = ({ notify } = {})=>{
167
- assert(notify, 'Notify must be passed to network endowment factory');
168
- // Open fetch calls or open body streams
169
- const openConnections = new Set();
170
- // Track last teardown count
171
- const teardownRef = {
172
- lastTeardown: 0
173
- };
174
- // Remove items from openConnections after they were garbage collected
175
- const cleanup = new FinalizationRegistry(/* istanbul ignore next: can't test garbage collection without modifying node parameters */ (callback)=>callback());
176
- const _fetch = async (input, init)=>{
177
- const abortController = new AbortController();
178
- if (init?.signal !== null && init?.signal !== undefined) {
179
- const originalSignal = init.signal;
180
- // Merge abort controllers
181
- originalSignal.addEventListener('abort', ()=>{
182
- abortController.abort(originalSignal.reason);
183
- }, {
184
- once: true
185
- });
186
- }
187
- let started = false;
188
- const onStart = async ()=>{
189
- if (!started) {
190
- started = true;
191
- await notify({
192
- method: 'OutboundRequest',
193
- params: {
194
- source: 'fetch'
195
- }
196
- });
197
- }
198
- };
199
- let finished = false;
200
- const onFinish = async ()=>{
201
- if (!finished) {
202
- finished = true;
203
- await notify({
204
- method: 'OutboundResponse',
205
- params: {
206
- source: 'fetch'
207
- }
208
- });
209
- }
210
- };
211
- let res;
212
- let openFetchConnection;
213
- return await withTeardown((async ()=>{
214
- try {
215
- await notify({
216
- method: 'OutboundRequest',
217
- params: {
218
- source: 'fetch'
219
- }
220
- });
221
- const fetchPromise = fetch(input, {
222
- ...init,
223
- signal: abortController.signal
224
- });
225
- openFetchConnection = {
226
- cancel: async ()=>{
227
- abortController.abort();
228
- try {
229
- await fetchPromise;
230
- } catch {
231
- /* do nothing */ }
232
- }
233
- };
234
- openConnections.add(openFetchConnection);
235
- res = new ResponseWrapper(await fetchPromise, teardownRef, onStart, onFinish);
236
- } finally{
237
- if (openFetchConnection !== undefined) {
238
- openConnections.delete(openFetchConnection);
239
- }
240
- await notify({
241
- method: 'OutboundResponse',
242
- params: {
243
- source: 'fetch'
244
- }
245
- });
246
- }
247
- if (res.body !== null) {
248
- const body = new WeakRef(res.body);
249
- const openBodyConnection = {
250
- cancel: /* istanbul ignore next: see it.todo('can be torn down during body read') test */ async ()=>{
251
- try {
252
- await body.deref()?.cancel();
253
- } catch {
254
- /* do nothing */ }
255
- }
256
- };
257
- openConnections.add(openBodyConnection);
258
- cleanup.register(res.body, /* istanbul ignore next: can't test garbage collection without modifying node parameters */ ()=>openConnections.delete(openBodyConnection));
259
- }
260
- return harden(res);
261
- })(), teardownRef);
262
- };
263
- const teardownFunction = async ()=>{
264
- teardownRef.lastTeardown += 1;
265
- const promises = [];
266
- openConnections.forEach(({ cancel })=>promises.push(cancel()));
267
- openConnections.clear();
268
- await Promise.all(promises);
269
- };
270
- return {
271
- fetch: harden(_fetch),
272
- // Request, Headers and Response are the endowments injected alongside fetch
273
- // only when 'endowment:network-access' permission is requested,
274
- // therefore these are hardened as part of fetch dependency injection within its factory.
275
- // These endowments are not (and should never be) available by default.
276
- Request: harden(Request),
277
- Headers: harden(Headers),
278
- Response: harden(Response),
279
- teardownFunction
280
- };
281
- };
282
- const endowmentModule = {
283
- names: [
284
- 'fetch',
285
- 'Request',
286
- 'Headers',
287
- 'Response'
288
- ],
289
- factory: createNetwork
290
- };
291
- export default endowmentModule;
292
-
293
- //# sourceMappingURL=network.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/common/endowments/network.ts"],"sourcesContent":["import { assert } from '@metamask/utils';\n\nimport { withTeardown } from '../utils';\nimport type { EndowmentFactoryOptions } from './commonEndowmentFactory';\n\n/**\n * This class wraps a Response object.\n * That way, a teardown process can stop any processes left.\n */\nclass ResponseWrapper implements Response {\n readonly #teardownRef: { lastTeardown: number };\n\n #ogResponse: Response;\n\n #onStart: () => Promise<void>;\n\n #onFinish: () => Promise<void>;\n\n constructor(\n ogResponse: Response,\n teardownRef: { lastTeardown: number },\n onStart: () => Promise<void>,\n onFinish: () => Promise<void>,\n ) {\n this.#ogResponse = ogResponse;\n this.#teardownRef = teardownRef;\n this.#onStart = onStart;\n this.#onFinish = onFinish;\n }\n\n get body(): ReadableStream<Uint8Array> | null {\n return this.#ogResponse.body;\n }\n\n get bodyUsed() {\n return this.#ogResponse.bodyUsed;\n }\n\n get headers() {\n return this.#ogResponse.headers;\n }\n\n get ok() {\n return this.#ogResponse.ok;\n }\n\n get redirected() {\n return this.#ogResponse.redirected;\n }\n\n get status() {\n return this.#ogResponse.status;\n }\n\n get statusText() {\n return this.#ogResponse.statusText;\n }\n\n get type() {\n return this.#ogResponse.type;\n }\n\n get url() {\n return this.#ogResponse.url;\n }\n\n async text() {\n return await withTeardown<string>(\n (async () => {\n await this.#onStart();\n try {\n return await this.#ogResponse.text();\n } finally {\n await this.#onFinish();\n }\n })(),\n this.#teardownRef,\n );\n }\n\n async arrayBuffer(): Promise<ArrayBuffer> {\n return await withTeardown<ArrayBuffer>(\n (async () => {\n await this.#onStart();\n try {\n return await this.#ogResponse.arrayBuffer();\n } finally {\n await this.#onFinish();\n }\n })(),\n this.#teardownRef,\n );\n }\n\n async blob(): Promise<Blob> {\n return await withTeardown<Blob>(\n (async () => {\n await this.#onStart();\n try {\n return await this.#ogResponse.blob();\n } finally {\n await this.#onFinish();\n }\n })(),\n this.#teardownRef,\n );\n }\n\n clone(): Response {\n const newResponse = this.#ogResponse.clone();\n return new ResponseWrapper(\n newResponse,\n this.#teardownRef,\n this.#onStart,\n this.#onFinish,\n );\n }\n\n async formData(): Promise<FormData> {\n return await withTeardown<FormData>(\n (async () => {\n await this.#onStart();\n try {\n return await this.#ogResponse.formData();\n } finally {\n await this.#onFinish();\n }\n })(),\n this.#teardownRef,\n );\n }\n\n async json(): Promise<any> {\n return await withTeardown(\n (async () => {\n await this.#onStart();\n try {\n return await this.#ogResponse.json();\n } finally {\n await this.#onFinish();\n }\n })(),\n this.#teardownRef,\n );\n }\n}\n\n/**\n * Create a network endowment, consisting of a `fetch` function.\n * This allows us to provide a teardown function, so that we can cancel\n * any pending requests, connections, streams, etc. that may be open when a snap\n * is terminated.\n *\n * This wraps the original implementation of `fetch`,\n * to ensure that a bad actor cannot get access to the original function, thus\n * potentially preventing the network requests from being torn down.\n *\n * @param options - An options bag.\n * @param options.notify - A reference to the notify function of the snap executor.\n * @returns An object containing a wrapped `fetch`\n * function, as well as a teardown function.\n */\nconst createNetwork = ({ notify }: EndowmentFactoryOptions = {}) => {\n assert(notify, 'Notify must be passed to network endowment factory');\n // Open fetch calls or open body streams\n const openConnections = new Set<{ cancel: () => Promise<void> }>();\n // Track last teardown count\n const teardownRef = { lastTeardown: 0 };\n\n // Remove items from openConnections after they were garbage collected\n const cleanup = new FinalizationRegistry<() => void>(\n /* istanbul ignore next: can't test garbage collection without modifying node parameters */\n (callback) => callback(),\n );\n\n const _fetch: typeof fetch = async (\n input: RequestInfo | URL,\n init?: RequestInit,\n ): Promise<Response> => {\n const abortController = new AbortController();\n if (init?.signal !== null && init?.signal !== undefined) {\n const originalSignal = init.signal;\n // Merge abort controllers\n originalSignal.addEventListener(\n 'abort',\n () => {\n abortController.abort((originalSignal as any).reason);\n },\n { once: true },\n );\n }\n\n let started = false;\n const onStart = async () => {\n if (!started) {\n started = true;\n await notify({\n method: 'OutboundRequest',\n params: { source: 'fetch' },\n });\n }\n };\n\n let finished = false;\n const onFinish = async () => {\n if (!finished) {\n finished = true;\n await notify({\n method: 'OutboundResponse',\n params: { source: 'fetch' },\n });\n }\n };\n\n let res: Response;\n let openFetchConnection: { cancel: () => Promise<void> } | undefined;\n return await withTeardown(\n (async () => {\n try {\n await notify({\n method: 'OutboundRequest',\n params: { source: 'fetch' },\n });\n const fetchPromise = fetch(input, {\n ...init,\n signal: abortController.signal,\n });\n\n openFetchConnection = {\n cancel: async () => {\n abortController.abort();\n try {\n await fetchPromise;\n } catch {\n /* do nothing */\n }\n },\n };\n openConnections.add(openFetchConnection);\n\n res = new ResponseWrapper(\n await fetchPromise,\n teardownRef,\n onStart,\n onFinish,\n );\n } finally {\n if (openFetchConnection !== undefined) {\n openConnections.delete(openFetchConnection);\n }\n await notify({\n method: 'OutboundResponse',\n params: { source: 'fetch' },\n });\n }\n\n if (res.body !== null) {\n const body = new WeakRef<ReadableStream>(res.body);\n\n const openBodyConnection = {\n cancel:\n /* istanbul ignore next: see it.todo('can be torn down during body read') test */\n async () => {\n try {\n await body.deref()?.cancel();\n } catch {\n /* do nothing */\n }\n },\n };\n openConnections.add(openBodyConnection);\n cleanup.register(\n res.body,\n /* istanbul ignore next: can't test garbage collection without modifying node parameters */\n () => openConnections.delete(openBodyConnection),\n );\n }\n return harden(res);\n })(),\n teardownRef,\n );\n };\n\n const teardownFunction = async () => {\n teardownRef.lastTeardown += 1;\n const promises: Promise<void>[] = [];\n openConnections.forEach(({ cancel }) => promises.push(cancel()));\n openConnections.clear();\n await Promise.all(promises);\n };\n\n return {\n fetch: harden(_fetch),\n // Request, Headers and Response are the endowments injected alongside fetch\n // only when 'endowment:network-access' permission is requested,\n // therefore these are hardened as part of fetch dependency injection within its factory.\n // These endowments are not (and should never be) available by default.\n Request: harden(Request),\n Headers: harden(Headers),\n Response: harden(Response),\n teardownFunction,\n };\n};\n\nconst endowmentModule = {\n names: ['fetch', 'Request', 'Headers', 'Response'] as const,\n factory: createNetwork,\n};\nexport default endowmentModule;\n"],"names":["assert","withTeardown","ResponseWrapper","body","ogResponse","bodyUsed","headers","ok","redirected","status","statusText","type","url","text","onStart","onFinish","teardownRef","arrayBuffer","blob","clone","newResponse","formData","json","constructor","createNetwork","notify","openConnections","Set","lastTeardown","cleanup","FinalizationRegistry","callback","_fetch","input","init","abortController","AbortController","signal","undefined","originalSignal","addEventListener","abort","reason","once","started","method","params","source","finished","res","openFetchConnection","fetchPromise","fetch","cancel","add","delete","WeakRef","openBodyConnection","deref","register","harden","teardownFunction","promises","forEach","push","clear","Promise","all","Request","Headers","Response","endowmentModule","names","factory"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,MAAM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AAS;QAAW;QAAW;KAAW;IAClDC,SAASjD;AACX;AACA,eAAe+C,gBAAgB"}
@@ -1,18 +0,0 @@
1
- /**
2
- * Creates TextDecoder function hardened by SES.
3
- *
4
- * @returns An object with the attenuated `TextDecoder` function.
5
- */ const createTextDecoder = ()=>{
6
- return {
7
- TextDecoder: harden(TextDecoder)
8
- };
9
- };
10
- const endowmentModule = {
11
- names: [
12
- 'TextDecoder'
13
- ],
14
- factory: createTextDecoder
15
- };
16
- export default endowmentModule;
17
-
18
- //# sourceMappingURL=textDecoder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/common/endowments/textDecoder.ts"],"sourcesContent":["/**\n * Creates TextDecoder function hardened by SES.\n *\n * @returns An object with the attenuated `TextDecoder` function.\n */\nconst createTextDecoder = () => {\n return {\n TextDecoder: harden(TextDecoder),\n } as const;\n};\n\nconst endowmentModule = {\n names: ['TextDecoder'] as const,\n factory: createTextDecoder,\n};\nexport default endowmentModule;\n"],"names":["createTextDecoder","TextDecoder","harden","endowmentModule","names","factory"],"mappings":"AAAA;;;;CAIC,GACD,MAAMA,oBAAoB;IACxB,OAAO;QACLC,aAAaC,OAAOD;IACtB;AACF;AAEA,MAAME,kBAAkB;IACtBC,OAAO;QAAC;KAAc;IACtBC,SAASL;AACX;AACA,eAAeG,gBAAgB"}
@@ -1,18 +0,0 @@
1
- /**
2
- * Creates TextEncoder function hardened by SES.
3
- *
4
- * @returns An object with the attenuated `TextEncoder` function.
5
- */ const createTextEncoder = ()=>{
6
- return {
7
- TextEncoder: harden(TextEncoder)
8
- };
9
- };
10
- const endowmentModule = {
11
- names: [
12
- 'TextEncoder'
13
- ],
14
- factory: createTextEncoder
15
- };
16
- export default endowmentModule;
17
-
18
- //# sourceMappingURL=textEncoder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/common/endowments/textEncoder.ts"],"sourcesContent":["/**\n * Creates TextEncoder function hardened by SES.\n *\n * @returns An object with the attenuated `TextEncoder` function.\n */\nconst createTextEncoder = () => {\n return {\n TextEncoder: harden(TextEncoder),\n } as const;\n};\n\nconst endowmentModule = {\n names: ['TextEncoder'] as const,\n factory: createTextEncoder,\n};\nexport default endowmentModule;\n"],"names":["createTextEncoder","TextEncoder","harden","endowmentModule","names","factory"],"mappings":"AAAA;;;;CAIC,GACD,MAAMA,oBAAoB;IACxB,OAAO;QACLC,aAAaC,OAAOD;IACtB;AACF;AAEA,MAAME,kBAAkB;IACtBC,OAAO;QAAC;KAAc;IACtBC,SAASL;AACX;AACA,eAAeG,gBAAgB"}
@@ -1,54 +0,0 @@
1
- import { rpcErrors } from '@metamask/rpc-errors';
2
- const MINIMUM_TIMEOUT = 10;
3
- /**
4
- * Creates a pair of `setTimeout` and `clearTimeout` functions attenuated such
5
- * that:
6
- * - `setTimeout` throws if its "handler" parameter is not a function.
7
- * - `clearTimeout` only clears timeouts created by its sibling `setTimeout`,
8
- * or else no-ops.
9
- *
10
- * @returns An object with the attenuated `setTimeout` and `clearTimeout`
11
- * functions.
12
- */ const createTimeout = ()=>{
13
- const registeredHandles = new Map();
14
- const _setTimeout = (handler, timeout)=>{
15
- if (typeof handler !== 'function') {
16
- throw rpcErrors.internal(`The timeout handler must be a function. Received: ${typeof handler}.`);
17
- }
18
- harden(handler);
19
- const handle = Object.freeze(Object.create(null));
20
- const platformHandle = setTimeout(()=>{
21
- registeredHandles.delete(handle);
22
- handler();
23
- }, Math.max(MINIMUM_TIMEOUT, timeout ?? 0));
24
- registeredHandles.set(handle, platformHandle);
25
- return handle;
26
- };
27
- const _clearTimeout = (handle)=>{
28
- const platformHandle = registeredHandles.get(handle);
29
- if (platformHandle !== undefined) {
30
- clearTimeout(platformHandle);
31
- registeredHandles.delete(handle);
32
- }
33
- };
34
- const teardownFunction = ()=>{
35
- for (const handle of registeredHandles.keys()){
36
- _clearTimeout(handle);
37
- }
38
- };
39
- return {
40
- setTimeout: harden(_setTimeout),
41
- clearTimeout: harden(_clearTimeout),
42
- teardownFunction
43
- };
44
- };
45
- const endowmentModule = {
46
- names: [
47
- 'setTimeout',
48
- 'clearTimeout'
49
- ],
50
- factory: createTimeout
51
- };
52
- export default endowmentModule;
53
-
54
- //# sourceMappingURL=timeout.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/common/endowments/timeout.ts"],"sourcesContent":["import { rpcErrors } from '@metamask/rpc-errors';\n\nconst MINIMUM_TIMEOUT = 10;\n\n/**\n * Creates a pair of `setTimeout` and `clearTimeout` functions attenuated such\n * that:\n * - `setTimeout` throws if its \"handler\" parameter is not a function.\n * - `clearTimeout` only clears timeouts created by its sibling `setTimeout`,\n * or else no-ops.\n *\n * @returns An object with the attenuated `setTimeout` and `clearTimeout`\n * functions.\n */\nconst createTimeout = () => {\n const registeredHandles = new Map<unknown, unknown>();\n const _setTimeout = (handler: TimerHandler, timeout?: number): unknown => {\n if (typeof handler !== 'function') {\n throw rpcErrors.internal(\n `The timeout handler must be a function. Received: ${typeof handler}.`,\n );\n }\n harden(handler);\n const handle = Object.freeze(Object.create(null));\n const platformHandle = setTimeout(() => {\n registeredHandles.delete(handle);\n handler();\n }, Math.max(MINIMUM_TIMEOUT, timeout ?? 0));\n\n registeredHandles.set(handle, platformHandle);\n return handle;\n };\n\n const _clearTimeout = (handle: unknown): void => {\n const platformHandle = registeredHandles.get(handle);\n if (platformHandle !== undefined) {\n clearTimeout(platformHandle as any);\n registeredHandles.delete(handle);\n }\n };\n\n const teardownFunction = (): void => {\n for (const handle of registeredHandles.keys()) {\n _clearTimeout(handle);\n }\n };\n\n return {\n setTimeout: harden(_setTimeout),\n clearTimeout: harden(_clearTimeout),\n teardownFunction,\n } as const;\n};\n\nconst endowmentModule = {\n names: ['setTimeout', 'clearTimeout'] as const,\n factory: createTimeout,\n};\nexport default endowmentModule;\n"],"names":["rpcErrors","MINIMUM_TIMEOUT","createTimeout","registeredHandles","Map","_setTimeout","handler","timeout","internal","harden","handle","Object","freeze","create","platformHandle","setTimeout","delete","Math","max","set","_clearTimeout","get","undefined","clearTimeout","teardownFunction","keys","endowmentModule","names","factory"],"mappings":"AAAA,SAASA,SAAS,QAAQ,uBAAuB;AAEjD,MAAMC,kBAAkB;AAExB;;;;;;;;;CASC,GACD,MAAMC,gBAAgB;IACpB,MAAMC,oBAAoB,IAAIC;IAC9B,MAAMC,cAAc,CAACC,SAAuBC;QAC1C,IAAI,OAAOD,YAAY,YAAY;YACjC,MAAMN,UAAUQ,QAAQ,CACtB,CAAC,kDAAkD,EAAE,OAAOF,QAAQ,CAAC,CAAC;QAE1E;QACAG,OAAOH;QACP,MAAMI,SAASC,OAAOC,MAAM,CAACD,OAAOE,MAAM,CAAC;QAC3C,MAAMC,iBAAiBC,WAAW;YAChCZ,kBAAkBa,MAAM,CAACN;YACzBJ;QACF,GAAGW,KAAKC,GAAG,CAACjB,iBAAiBM,WAAW;QAExCJ,kBAAkBgB,GAAG,CAACT,QAAQI;QAC9B,OAAOJ;IACT;IAEA,MAAMU,gBAAgB,CAACV;QACrB,MAAMI,iBAAiBX,kBAAkBkB,GAAG,CAACX;QAC7C,IAAII,mBAAmBQ,WAAW;YAChCC,aAAaT;YACbX,kBAAkBa,MAAM,CAACN;QAC3B;IACF;IAEA,MAAMc,mBAAmB;QACvB,KAAK,MAAMd,UAAUP,kBAAkBsB,IAAI,GAAI;YAC7CL,cAAcV;QAChB;IACF;IAEA,OAAO;QACLK,YAAYN,OAAOJ;QACnBkB,cAAcd,OAAOW;QACrBI;IACF;AACF;AAEA,MAAME,kBAAkB;IACtBC,OAAO;QAAC;QAAc;KAAe;IACrCC,SAAS1B;AACX;AACA,eAAewB,gBAAgB"}
@@ -1,36 +0,0 @@
1
- import { rpcErrors } from '@metamask/rpc-errors';
2
- import { rootRealmGlobal } from './globalObject';
3
- /**
4
- * Adds an event listener platform agnostically, trying both `globalThis.addEventListener` and `globalThis.process.on`
5
- *
6
- * @param event - The event to listen for.
7
- * @param listener - The listener to be triggered when the event occurs.
8
- * @returns The result of the platform agnostic operation if any.
9
- * @throws If none of the platform options are present.
10
- */ export function addEventListener(event, listener) {
11
- if ('addEventListener' in rootRealmGlobal && typeof rootRealmGlobal.addEventListener === 'function') {
12
- return rootRealmGlobal.addEventListener(event.toLowerCase(), listener);
13
- }
14
- if (rootRealmGlobal.process && 'on' in rootRealmGlobal.process && typeof rootRealmGlobal.process.on === 'function') {
15
- return rootRealmGlobal.process.on(event, listener);
16
- }
17
- throw rpcErrors.internal('Platform agnostic addEventListener failed.');
18
- }
19
- /**
20
- * Removes an event listener platform agnostically, trying both `globalThis.removeEventListener` and `globalThis.process.removeListener`
21
- *
22
- * @param event - The event to remove the listener for.
23
- * @param listener - The currently attached listener.
24
- * @returns The result of the platform agnostic operation if any.
25
- * @throws If none of the platform options are present.
26
- */ export function removeEventListener(event, listener) {
27
- if ('removeEventListener' in rootRealmGlobal && typeof rootRealmGlobal.removeEventListener === 'function') {
28
- return rootRealmGlobal.removeEventListener(event.toLowerCase(), listener);
29
- }
30
- if (rootRealmGlobal.process && 'removeListener' in rootRealmGlobal.process && typeof rootRealmGlobal.process.removeListener === 'function') {
31
- return rootRealmGlobal.process.removeListener(event, listener);
32
- }
33
- throw new Error('Platform agnostic removeEventListener failed');
34
- }
35
-
36
- //# sourceMappingURL=globalEvents.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/common/globalEvents.ts"],"sourcesContent":["import { rpcErrors } from '@metamask/rpc-errors';\n\nimport { rootRealmGlobal } from './globalObject';\n\n/**\n * Adds an event listener platform agnostically, trying both `globalThis.addEventListener` and `globalThis.process.on`\n *\n * @param event - The event to listen for.\n * @param listener - The listener to be triggered when the event occurs.\n * @returns The result of the platform agnostic operation if any.\n * @throws If none of the platform options are present.\n */\nexport function addEventListener(\n event: string,\n listener: (...args: any[]) => void,\n) {\n if (\n 'addEventListener' in rootRealmGlobal &&\n typeof rootRealmGlobal.addEventListener === 'function'\n ) {\n return rootRealmGlobal.addEventListener(event.toLowerCase(), listener);\n }\n\n if (\n rootRealmGlobal.process &&\n 'on' in rootRealmGlobal.process &&\n typeof rootRealmGlobal.process.on === 'function'\n ) {\n return rootRealmGlobal.process.on(event, listener);\n }\n\n throw rpcErrors.internal('Platform agnostic addEventListener failed.');\n}\n\n/**\n * Removes an event listener platform agnostically, trying both `globalThis.removeEventListener` and `globalThis.process.removeListener`\n *\n * @param event - The event to remove the listener for.\n * @param listener - The currently attached listener.\n * @returns The result of the platform agnostic operation if any.\n * @throws If none of the platform options are present.\n */\nexport function removeEventListener(\n event: string,\n listener: (...args: any[]) => void,\n) {\n if (\n 'removeEventListener' in rootRealmGlobal &&\n typeof rootRealmGlobal.removeEventListener === 'function'\n ) {\n return rootRealmGlobal.removeEventListener(event.toLowerCase(), listener);\n }\n\n if (\n rootRealmGlobal.process &&\n 'removeListener' in rootRealmGlobal.process &&\n typeof rootRealmGlobal.process.removeListener === 'function'\n ) {\n return rootRealmGlobal.process.removeListener(event, listener);\n }\n\n throw new Error('Platform agnostic removeEventListener failed');\n}\n"],"names":["rpcErrors","rootRealmGlobal","addEventListener","event","listener","toLowerCase","process","on","internal","removeEventListener","removeListener","Error"],"mappings":"AAAA,SAASA,SAAS,QAAQ,uBAAuB;AAEjD,SAASC,eAAe,QAAQ,iBAAiB;AAEjD;;;;;;;CAOC,GACD,OAAO,SAASC,iBACdC,KAAa,EACbC,QAAkC;IAElC,IACE,sBAAsBH,mBACtB,OAAOA,gBAAgBC,gBAAgB,KAAK,YAC5C;QACA,OAAOD,gBAAgBC,gBAAgB,CAACC,MAAME,WAAW,IAAID;IAC/D;IAEA,IACEH,gBAAgBK,OAAO,IACvB,QAAQL,gBAAgBK,OAAO,IAC/B,OAAOL,gBAAgBK,OAAO,CAACC,EAAE,KAAK,YACtC;QACA,OAAON,gBAAgBK,OAAO,CAACC,EAAE,CAACJ,OAAOC;IAC3C;IAEA,MAAMJ,UAAUQ,QAAQ,CAAC;AAC3B;AAEA;;;;;;;CAOC,GACD,OAAO,SAASC,oBACdN,KAAa,EACbC,QAAkC;IAElC,IACE,yBAAyBH,mBACzB,OAAOA,gBAAgBQ,mBAAmB,KAAK,YAC/C;QACA,OAAOR,gBAAgBQ,mBAAmB,CAACN,MAAME,WAAW,IAAID;IAClE;IAEA,IACEH,gBAAgBK,OAAO,IACvB,oBAAoBL,gBAAgBK,OAAO,IAC3C,OAAOL,gBAAgBK,OAAO,CAACI,cAAc,KAAK,YAClD;QACA,OAAOT,gBAAgBK,OAAO,CAACI,cAAc,CAACP,OAAOC;IACvD;IAEA,MAAM,IAAIO,MAAM;AAClB"}
@@ -1,36 +0,0 @@
1
- var GlobalObjectNames;
2
- (function(GlobalObjectNames) {
3
- GlobalObjectNames[// The globalThis entry is incorrectly identified as shadowing the global
4
- // globalThis.
5
- /* eslint-disable @typescript-eslint/naming-convention */ // eslint-disable-next-line @typescript-eslint/no-shadow
6
- "globalThis"] = "globalThis";
7
- GlobalObjectNames["global"] = "global";
8
- GlobalObjectNames["self"] = "self";
9
- GlobalObjectNames["window"] = "window";
10
- })(GlobalObjectNames || (GlobalObjectNames = {}));
11
- let _rootRealmGlobal;
12
- let _rootRealmGlobalName;
13
- /* istanbul ignore next */ /* eslint-disable no-negated-condition */ if (typeof globalThis !== 'undefined') {
14
- _rootRealmGlobal = globalThis;
15
- _rootRealmGlobalName = GlobalObjectNames.globalThis;
16
- } else if (typeof self !== 'undefined') {
17
- _rootRealmGlobal = self;
18
- _rootRealmGlobalName = GlobalObjectNames.self;
19
- } else if (typeof window !== 'undefined') {
20
- _rootRealmGlobal = window;
21
- _rootRealmGlobalName = GlobalObjectNames.window;
22
- } else if (typeof global !== 'undefined') {
23
- _rootRealmGlobal = global;
24
- _rootRealmGlobalName = GlobalObjectNames.global;
25
- } else {
26
- throw new Error('Unknown realm type; failed to identify global object.');
27
- }
28
- /* eslint-enable no-negated-condition */ /**
29
- * A platform-agnostic alias for the root realm global object.
30
- */ const rootRealmGlobal = _rootRealmGlobal;
31
- /**
32
- * The string literal corresponding to the name of the root realm global object.
33
- */ const rootRealmGlobalName = _rootRealmGlobalName;
34
- export { rootRealmGlobal, rootRealmGlobalName };
35
-
36
- //# sourceMappingURL=globalObject.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/common/globalObject.ts"],"sourcesContent":["enum GlobalObjectNames {\n // The globalThis entry is incorrectly identified as shadowing the global\n // globalThis.\n /* eslint-disable @typescript-eslint/naming-convention */\n // eslint-disable-next-line @typescript-eslint/no-shadow\n globalThis = 'globalThis',\n global = 'global',\n self = 'self',\n window = 'window',\n /* eslint-enable @typescript-eslint/naming-convention */\n}\n\nlet _rootRealmGlobal: typeof globalThis;\nlet _rootRealmGlobalName: string;\n\n/* istanbul ignore next */\n/* eslint-disable no-negated-condition */\nif (typeof globalThis !== 'undefined') {\n _rootRealmGlobal = globalThis;\n _rootRealmGlobalName = GlobalObjectNames.globalThis;\n} else if (typeof self !== 'undefined') {\n _rootRealmGlobal = self;\n _rootRealmGlobalName = GlobalObjectNames.self;\n} else if (typeof window !== 'undefined') {\n _rootRealmGlobal = window;\n _rootRealmGlobalName = GlobalObjectNames.window;\n} else if (typeof global !== 'undefined') {\n _rootRealmGlobal = global;\n _rootRealmGlobalName = GlobalObjectNames.global;\n} else {\n throw new Error('Unknown realm type; failed to identify global object.');\n}\n/* eslint-enable no-negated-condition */\n\n/**\n * A platform-agnostic alias for the root realm global object.\n */\nconst rootRealmGlobal = _rootRealmGlobal;\n\n/**\n * The string literal corresponding to the name of the root realm global object.\n */\nconst rootRealmGlobalName = _rootRealmGlobalName;\n\nexport { rootRealmGlobal, rootRealmGlobalName };\n"],"names":["GlobalObjectNames","globalThis","global","self","window","_rootRealmGlobal","_rootRealmGlobalName","Error","rootRealmGlobal","rootRealmGlobalName"],"mappings":"IAAA;UAAKA,iBAAiB;IAAjBA,kBACH,yEAAyE;IACzE,cAAc;IACd,uDAAuD,GACvD,wDAAwD;IACxDC,gBAAAA;IALGD,kBAMHE,YAAAA;IANGF,kBAOHG,UAAAA;IAPGH,kBAQHI,YAAAA;GARGJ,sBAAAA;AAYL,IAAIK;AACJ,IAAIC;AAEJ,wBAAwB,GACxB,uCAAuC,GACvC,IAAI,OAAOL,eAAe,aAAa;IACrCI,mBAAmBJ;IACnBK,uBAAuBN,kBAAkBC,UAAU;AACrD,OAAO,IAAI,OAAOE,SAAS,aAAa;IACtCE,mBAAmBF;IACnBG,uBAAuBN,kBAAkBG,IAAI;AAC/C,OAAO,IAAI,OAAOC,WAAW,aAAa;IACxCC,mBAAmBD;IACnBE,uBAAuBN,kBAAkBI,MAAM;AACjD,OAAO,IAAI,OAAOF,WAAW,aAAa;IACxCG,mBAAmBH;IACnBI,uBAAuBN,kBAAkBE,MAAM;AACjD,OAAO;IACL,MAAM,IAAIK,MAAM;AAClB;AACA,sCAAsC,GAEtC;;CAEC,GACD,MAAMC,kBAAkBH;AAExB;;CAEC,GACD,MAAMI,sBAAsBH;AAE5B,SAASE,eAAe,EAAEC,mBAAmB,GAAG"}
@@ -1,66 +0,0 @@
1
- // When creating a sandbox, limitation of the events from leaking
2
- // sensitive objects is required. This is done by overriding own properties
3
- // of prototypes of all existing events.
4
- import { hasProperty } from '@metamask/utils';
5
- /**
6
- * Targeted Event objects and properties.
7
- * Note: This is a map of the prototypes that inherit from Events with
8
- * properties that are identified to leak sensitive objects.
9
- * Not all browsers support all event types, so checking its existence is required.
10
- */ const targetEvents = new Map();
11
- if (hasProperty(globalThis, 'UIEvent')) {
12
- targetEvents.set(UIEvent.prototype, [
13
- 'view'
14
- ]);
15
- }
16
- if (hasProperty(globalThis, 'MutationEvent')) {
17
- targetEvents.set(MutationEvent.prototype, [
18
- 'relatedNode'
19
- ]);
20
- }
21
- if (hasProperty(globalThis, 'MessageEvent')) {
22
- targetEvents.set(MessageEvent.prototype, [
23
- 'source'
24
- ]);
25
- }
26
- if (hasProperty(globalThis, 'FocusEvent')) {
27
- targetEvents.set(FocusEvent.prototype, [
28
- 'relatedTarget'
29
- ]);
30
- }
31
- if (hasProperty(globalThis, 'MouseEvent')) {
32
- targetEvents.set(MouseEvent.prototype, [
33
- 'relatedTarget',
34
- 'fromElement',
35
- 'toElement'
36
- ]);
37
- }
38
- if (hasProperty(globalThis, 'TouchEvent')) {
39
- targetEvents.set(TouchEvent.prototype, [
40
- 'targetTouches',
41
- 'touches'
42
- ]);
43
- }
44
- if (hasProperty(globalThis, 'Event')) {
45
- targetEvents.set(Event.prototype, [
46
- 'target',
47
- 'currentTarget',
48
- 'srcElement',
49
- 'composedPath'
50
- ]);
51
- }
52
- /**
53
- * Attenuate Event objects by replacing its own properties.
54
- */ export function executeLockdownEvents() {
55
- targetEvents.forEach((properties, prototype)=>{
56
- for (const property of properties){
57
- Object.defineProperty(prototype, property, {
58
- value: undefined,
59
- configurable: false,
60
- writable: false
61
- });
62
- }
63
- });
64
- }
65
-
66
- //# sourceMappingURL=lockdown-events.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/common/lockdown/lockdown-events.ts"],"sourcesContent":["// When creating a sandbox, limitation of the events from leaking\n// sensitive objects is required. This is done by overriding own properties\n// of prototypes of all existing events.\nimport { hasProperty } from '@metamask/utils';\n\n/**\n * Targeted Event objects and properties.\n * Note: This is a map of the prototypes that inherit from Events with\n * properties that are identified to leak sensitive objects.\n * Not all browsers support all event types, so checking its existence is required.\n */\nconst targetEvents = new Map();\nif (hasProperty(globalThis, 'UIEvent')) {\n targetEvents.set(UIEvent.prototype, ['view']);\n}\nif (hasProperty(globalThis, 'MutationEvent')) {\n targetEvents.set(MutationEvent.prototype, ['relatedNode']);\n}\nif (hasProperty(globalThis, 'MessageEvent')) {\n targetEvents.set(MessageEvent.prototype, ['source']);\n}\nif (hasProperty(globalThis, 'FocusEvent')) {\n targetEvents.set(FocusEvent.prototype, ['relatedTarget']);\n}\nif (hasProperty(globalThis, 'MouseEvent')) {\n targetEvents.set(MouseEvent.prototype, [\n 'relatedTarget',\n 'fromElement',\n 'toElement',\n ]);\n}\nif (hasProperty(globalThis, 'TouchEvent')) {\n targetEvents.set(TouchEvent.prototype, ['targetTouches', 'touches']);\n}\nif (hasProperty(globalThis, 'Event')) {\n targetEvents.set(Event.prototype, [\n 'target',\n 'currentTarget',\n 'srcElement',\n 'composedPath',\n ]);\n}\n\n/**\n * Attenuate Event objects by replacing its own properties.\n */\nexport function executeLockdownEvents() {\n targetEvents.forEach((properties, prototype) => {\n for (const property of properties) {\n Object.defineProperty(prototype, property, {\n value: undefined,\n configurable: false,\n writable: false,\n });\n }\n });\n}\n"],"names":["hasProperty","targetEvents","Map","globalThis","set","UIEvent","prototype","MutationEvent","MessageEvent","FocusEvent","MouseEvent","TouchEvent","Event","executeLockdownEvents","forEach","properties","property","Object","defineProperty","value","undefined","configurable","writable"],"mappings":"AAAA,iEAAiE;AACjE,2EAA2E;AAC3E,wCAAwC;AACxC,SAASA,WAAW,QAAQ,kBAAkB;AAE9C;;;;;CAKC,GACD,MAAMC,eAAe,IAAIC;AACzB,IAAIF,YAAYG,YAAY,YAAY;IACtCF,aAAaG,GAAG,CAACC,QAAQC,SAAS,EAAE;QAAC;KAAO;AAC9C;AACA,IAAIN,YAAYG,YAAY,kBAAkB;IAC5CF,aAAaG,GAAG,CAACG,cAAcD,SAAS,EAAE;QAAC;KAAc;AAC3D;AACA,IAAIN,YAAYG,YAAY,iBAAiB;IAC3CF,aAAaG,GAAG,CAACI,aAAaF,SAAS,EAAE;QAAC;KAAS;AACrD;AACA,IAAIN,YAAYG,YAAY,eAAe;IACzCF,aAAaG,GAAG,CAACK,WAAWH,SAAS,EAAE;QAAC;KAAgB;AAC1D;AACA,IAAIN,YAAYG,YAAY,eAAe;IACzCF,aAAaG,GAAG,CAACM,WAAWJ,SAAS,EAAE;QACrC;QACA;QACA;KACD;AACH;AACA,IAAIN,YAAYG,YAAY,eAAe;IACzCF,aAAaG,GAAG,CAACO,WAAWL,SAAS,EAAE;QAAC;QAAiB;KAAU;AACrE;AACA,IAAIN,YAAYG,YAAY,UAAU;IACpCF,aAAaG,GAAG,CAACQ,MAAMN,SAAS,EAAE;QAChC;QACA;QACA;QACA;KACD;AACH;AAEA;;CAEC,GACD,OAAO,SAASO;IACdZ,aAAaa,OAAO,CAAC,CAACC,YAAYT;QAChC,KAAK,MAAMU,YAAYD,WAAY;YACjCE,OAAOC,cAAc,CAACZ,WAAWU,UAAU;gBACzCG,OAAOC;gBACPC,cAAc;gBACdC,UAAU;YACZ;QACF;IACF;AACF"}