@browserless.io/browserless 2.12.0-beta-3 → 2.12.0-beta-6

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 (199) hide show
  1. package/build/browserless.d.ts +3 -3
  2. package/build/browserless.js +6 -6
  3. package/build/browsers/chromium.cdp.d.ts +13 -13
  4. package/build/browsers/chromium.cdp.js +79 -67
  5. package/build/browsers/chromium.playwright.d.ts +12 -12
  6. package/build/browsers/chromium.playwright.js +44 -36
  7. package/build/browsers/firefox.playwright.d.ts +12 -12
  8. package/build/browsers/firefox.playwright.js +44 -36
  9. package/build/browsers/index.d.ts +17 -16
  10. package/build/browsers/index.js +63 -42
  11. package/build/browsers/webkit.playwright.d.ts +12 -12
  12. package/build/browsers/webkit.playwright.js +47 -39
  13. package/build/config.d.ts +65 -63
  14. package/build/config.js +162 -102
  15. package/build/file-system.d.ts +4 -4
  16. package/build/file-system.js +8 -8
  17. package/build/hooks.d.ts +2 -2
  18. package/build/hooks.js +4 -4
  19. package/build/limiter.d.ts +4 -4
  20. package/build/limiter.js +10 -10
  21. package/build/logger.d.ts +6 -6
  22. package/build/logger.js +12 -12
  23. package/build/metrics.d.ts +12 -12
  24. package/build/metrics.js +23 -23
  25. package/build/monitoring.d.ts +4 -4
  26. package/build/monitoring.js +8 -8
  27. package/build/router.d.ts +8 -8
  28. package/build/router.js +74 -70
  29. package/build/routes/chrome/http/pdf.post.body.json +8 -8
  30. package/build/routes/chrome/http/scrape.post.body.json +8 -8
  31. package/build/routes/chrome/http/screenshot.post.body.json +8 -8
  32. package/build/routes/chromium/http/content.post.body.json +8 -8
  33. package/build/routes/chromium/http/pdf.post.body.json +8 -8
  34. package/build/routes/chromium/http/scrape.post.body.json +8 -8
  35. package/build/routes/chromium/http/screenshot.post.body.json +8 -8
  36. package/build/routes/firefox/ws/playwright.d.ts +1 -1
  37. package/build/routes/firefox/ws/playwright.js +2 -2
  38. package/build/routes/management/http/active.get.d.ts +1 -1
  39. package/build/routes/management/http/active.get.js +3 -1
  40. package/build/routes/management/http/config.get.d.ts +1 -1
  41. package/build/routes/management/http/config.get.js +2 -2
  42. package/build/routes/management/http/metrics-total.get.d.ts +1 -1
  43. package/build/routes/management/http/metrics-total.get.js +2 -2
  44. package/build/routes/management/http/metrics.get.d.ts +1 -1
  45. package/build/routes/management/http/metrics.get.js +2 -2
  46. package/build/routes/management/http/pressure.get.d.ts +1 -1
  47. package/build/routes/management/http/pressure.get.js +2 -2
  48. package/build/routes/management/http/sessions.get.d.ts +1 -1
  49. package/build/routes/management/http/sessions.get.js +2 -2
  50. package/build/routes/management/http/static.get.d.ts +1 -1
  51. package/build/routes/management/http/static.get.js +2 -2
  52. package/build/routes/webkit/ws/playwright.d.ts +1 -1
  53. package/build/routes/webkit/ws/playwright.js +2 -2
  54. package/build/server.d.ts +5 -5
  55. package/build/server.js +11 -11
  56. package/build/shared/browser.ws.d.ts +1 -1
  57. package/build/shared/browser.ws.js +3 -1
  58. package/build/shared/chromium.playwright.ws.d.ts +1 -1
  59. package/build/shared/chromium.playwright.ws.js +2 -2
  60. package/build/shared/chromium.ws.d.ts +1 -1
  61. package/build/shared/chromium.ws.js +3 -1
  62. package/build/shared/content.http.d.ts +1 -1
  63. package/build/shared/content.http.js +2 -2
  64. package/build/shared/download.http.d.ts +1 -1
  65. package/build/shared/download.http.js +60 -58
  66. package/build/shared/function.http.d.ts +1 -1
  67. package/build/shared/function.http.js +2 -2
  68. package/build/shared/json-list.http.d.ts +1 -1
  69. package/build/shared/json-list.http.js +2 -2
  70. package/build/shared/json-new.http.d.ts +1 -1
  71. package/build/shared/json-new.http.js +2 -2
  72. package/build/shared/json-protocol.http.d.ts +1 -1
  73. package/build/shared/json-protocol.http.js +2 -2
  74. package/build/shared/json-version.http.d.ts +1 -1
  75. package/build/shared/json-version.http.js +2 -2
  76. package/build/shared/page.ws.d.ts +1 -1
  77. package/build/shared/page.ws.js +3 -1
  78. package/build/shared/pdf.http.d.ts +1 -1
  79. package/build/shared/pdf.http.js +2 -2
  80. package/build/shared/performance.http.d.ts +1 -1
  81. package/build/shared/performance.http.js +2 -2
  82. package/build/shared/scrape.http.d.ts +1 -1
  83. package/build/shared/scrape.http.js +2 -2
  84. package/build/shared/screenshot.http.d.ts +1 -1
  85. package/build/shared/screenshot.http.js +2 -2
  86. package/build/shared/utils/function/client.d.ts +1 -1
  87. package/build/shared/utils/function/client.js +3 -1
  88. package/build/shim.d.ts +1 -1
  89. package/build/shim.js +2 -2
  90. package/build/token.d.ts +3 -3
  91. package/build/token.js +6 -6
  92. package/build/types.d.ts +5 -5
  93. package/build/webhooks.d.ts +2 -2
  94. package/build/webhooks.js +4 -4
  95. package/extensions/ublock/_locales/eu/messages.json +4 -4
  96. package/extensions/ublock/_locales/hi/messages.json +5 -5
  97. package/extensions/ublock/_locales/kn/messages.json +11 -11
  98. package/extensions/ublock/_locales/nb/messages.json +2 -2
  99. package/extensions/ublock/_locales/no/messages.json +2 -2
  100. package/extensions/ublock/_locales/ro/messages.json +1 -1
  101. package/extensions/ublock/_locales/sv/messages.json +1 -1
  102. package/extensions/ublock/_locales/zh_CN/messages.json +2 -2
  103. package/extensions/ublock/assets/assets.json +3 -8
  104. package/extensions/ublock/assets/resources/scriptlets.js +128 -31
  105. package/extensions/ublock/assets/thirdparties/easylist/easylist.txt +4870 -3560
  106. package/extensions/ublock/assets/thirdparties/easylist/easyprivacy.txt +662 -173
  107. package/extensions/ublock/assets/thirdparties/pgl.yoyo.org/as/serverlist +10 -42
  108. package/extensions/ublock/assets/thirdparties/publicsuffix.org/list/effective_tld_names.dat +241 -80
  109. package/extensions/ublock/assets/thirdparties/urlhaus-filter/urlhaus-filter-online.txt +2093 -1224
  110. package/extensions/ublock/assets/ublock/badlists.txt +2 -0
  111. package/extensions/ublock/assets/ublock/badware.min.txt +408 -287
  112. package/extensions/ublock/assets/ublock/filters.min.txt +947 -645
  113. package/extensions/ublock/assets/ublock/privacy.min.txt +43 -8
  114. package/extensions/ublock/assets/ublock/quick-fixes.min.txt +55 -93
  115. package/extensions/ublock/assets/ublock/unbreak.min.txt +52 -19
  116. package/extensions/ublock/css/1p-filters.css +2 -0
  117. package/extensions/ublock/css/codemirror.css +2 -2
  118. package/extensions/ublock/css/dashboard.css +2 -5
  119. package/extensions/ublock/css/epicker-ui.css +3 -3
  120. package/extensions/ublock/css/fa-icons.css +3 -0
  121. package/extensions/ublock/css/logger-ui-inspector.css +1 -0
  122. package/extensions/ublock/css/logger-ui.css +44 -32
  123. package/extensions/ublock/img/fontawesome/fontawesome-defs.svg +1 -0
  124. package/extensions/ublock/js/3p-filters.js +4 -5
  125. package/extensions/ublock/js/biditrie.js +16 -11
  126. package/extensions/ublock/js/cachestorage.js +37 -37
  127. package/extensions/ublock/js/contentscript-extra.js +0 -2
  128. package/extensions/ublock/js/contentscript.js +1 -6
  129. package/extensions/ublock/js/epicker-ui.js +28 -36
  130. package/extensions/ublock/js/fa-icons.js +1 -0
  131. package/extensions/ublock/js/hntrie.js +19 -13
  132. package/extensions/ublock/js/logger-ui-inspector.js +6 -13
  133. package/extensions/ublock/js/logger-ui.js +264 -264
  134. package/extensions/ublock/js/s14e-serializer.js +267 -264
  135. package/extensions/ublock/js/scriptlet-filtering.js +12 -18
  136. package/extensions/ublock/js/scriptlets/dom-inspector.js +1 -5
  137. package/extensions/ublock/js/scriptlets/epicker.js +53 -59
  138. package/extensions/ublock/js/start.js +0 -8
  139. package/extensions/ublock/js/storage.js +2 -9
  140. package/extensions/ublock/js/vapi-background.js +19 -20
  141. package/extensions/ublock/js/vapi-common.js +2 -7
  142. package/extensions/ublock/js/vapi.js +0 -4
  143. package/extensions/ublock/js/webext.js +23 -15
  144. package/extensions/ublock/logger-ui.html +24 -15
  145. package/extensions/ublock/manifest.json +2 -3
  146. package/package.json +4 -4
  147. package/src/browserless.ts +6 -6
  148. package/src/browsers/chromium.cdp.ts +35 -25
  149. package/src/browsers/chromium.playwright.ts +30 -23
  150. package/src/browsers/firefox.playwright.ts +30 -24
  151. package/src/browsers/index.ts +81 -50
  152. package/src/browsers/webkit.playwright.ts +33 -26
  153. package/src/config.ts +166 -104
  154. package/src/file-system.ts +9 -9
  155. package/src/hooks.ts +4 -4
  156. package/src/limiter.ts +12 -12
  157. package/src/logger.ts +12 -12
  158. package/src/metrics.ts +23 -23
  159. package/src/monitoring.ts +9 -9
  160. package/src/router.ts +31 -31
  161. package/src/routes/chrome/tests/websocket.spec.ts +2 -2
  162. package/src/routes/chromium/tests/websocket.spec.ts +2 -2
  163. package/src/routes/firefox/tests/websocket.spec.ts +2 -4
  164. package/src/routes/firefox/ws/playwright.ts +3 -3
  165. package/src/routes/management/http/active.get.ts +3 -2
  166. package/src/routes/management/http/config.get.ts +2 -2
  167. package/src/routes/management/http/metrics-total.get.ts +2 -2
  168. package/src/routes/management/http/metrics.get.ts +2 -2
  169. package/src/routes/management/http/pressure.get.ts +2 -2
  170. package/src/routes/management/http/sessions.get.ts +2 -2
  171. package/src/routes/management/http/static.get.ts +3 -3
  172. package/src/routes/webkit/tests/websocket.spec.ts +2 -3
  173. package/src/routes/webkit/ws/playwright.ts +3 -3
  174. package/src/server.ts +14 -16
  175. package/src/shared/browser.ws.ts +4 -2
  176. package/src/shared/chromium.playwright.ws.ts +3 -3
  177. package/src/shared/chromium.ws.ts +4 -2
  178. package/src/shared/content.http.ts +3 -3
  179. package/src/shared/download.http.ts +4 -3
  180. package/src/shared/function.http.ts +3 -3
  181. package/src/shared/json-list.http.ts +2 -2
  182. package/src/shared/json-new.http.ts +2 -2
  183. package/src/shared/json-protocol.http.ts +2 -6
  184. package/src/shared/json-version.http.ts +2 -6
  185. package/src/shared/page.ws.ts +4 -2
  186. package/src/shared/pdf.http.ts +3 -3
  187. package/src/shared/performance.http.ts +3 -3
  188. package/src/shared/scrape.http.ts +3 -3
  189. package/src/shared/screenshot.http.ts +3 -3
  190. package/src/shared/utils/function/client.ts +3 -1
  191. package/src/shim.ts +2 -2
  192. package/src/token.ts +7 -7
  193. package/src/types.ts +8 -8
  194. package/src/utils.ts +1 -1
  195. package/src/webhooks.ts +4 -4
  196. package/static/docs/swagger.json +1 -1
  197. package/static/docs/swagger.min.json +1 -1
  198. package/static/function/client.js +3 -1
  199. package/static/function/index.html +3 -1
@@ -76,7 +76,7 @@
76
76
  "description": "Message to be read by screen readers"
77
77
  },
78
78
  "popupPowerSwitchInfo2": {
79
- "message": "Click to enable uBlock₀ for this site.",
79
+ "message": " ಸೈಟ್‌ಗಾಗಿ uBlock₀ ಸಕ್ರಿಯಗೊಳಿಸಲು ಕ್ಲಿಕ್ ಮಾಡಿ.",
80
80
  "description": "Message to be read by screen readers"
81
81
  },
82
82
  "popupBlockedRequestPrompt": {
@@ -128,7 +128,7 @@
128
128
  "description": "Tooltip used for the logger icon in the panel"
129
129
  },
130
130
  "popupTipReport": {
131
- "message": "Report an issue on this website",
131
+ "message": "ublock origin ಗೆ ಸಂಬಂಧಿಸಿದ ವೆಬ್‌ಸೈಟ್‌ನಲ್ಲಿ ಸಮಸ್ಯೆಯನ್ನು ವರದಿ ಮಾಡಿ",
132
132
  "description": "Tooltip used for the 'chat' icon in the panel"
133
133
  },
134
134
  "popupTipNoPopups": {
@@ -180,7 +180,7 @@
180
180
  "description": "Tooltip for the no-remote-fonts per-site switch"
181
181
  },
182
182
  "popupTipNoScripting1": {
183
- "message": "Click to disable JavaScript on this site",
183
+ "message": " ಸೈಟ್‌ನಲ್ಲಿ ಜಾವಾಸ್ಕ್ರಿಪ್ಟ್ ಅನ್ನು ನಿಷ್ಕ್ರಿಯಗೊಳಿಸಲು ಕ್ಲಿಕ್ ಮಾಡಿ",
184
184
  "description": "Tooltip for the no-scripting per-site switch"
185
185
  },
186
186
  "popupTipNoScripting2": {
@@ -388,7 +388,7 @@
388
388
  "description": ""
389
389
  },
390
390
  "settingsNoScriptingPrompt": {
391
- "message": "Disable JavaScript",
391
+ "message": "ಜಾವಾಸ್ಕ್ರಿಪ್ಟ್ ಅನ್ನು ನಿಷ್ಕ್ರಿಯಗೊಳಿಸಿ",
392
392
  "description": "The default state for the per-site no-scripting switch"
393
393
  },
394
394
  "settingsNoCSPReportsPrompt": {
@@ -424,7 +424,7 @@
424
424
  "description": "Appears at the top of the _3rd-party filters_ pane"
425
425
  },
426
426
  "3pListsOfBlockedHostsPerListStats": {
427
- "message": "{{used}} used out of {{total}}",
427
+ "message": "{{total}} ರಿಂದ {{used}} ಬಳಸಲುಗುವುತಿದೆ ",
428
428
  "description": "Appears aside each filter list in the _3rd-party filters_ pane"
429
429
  },
430
430
  "3pAutoUpdatePrompt1": {
@@ -520,7 +520,7 @@
520
520
  "description": "used as a tooltip for the out-of-date icon beside a list"
521
521
  },
522
522
  "3pViewContent": {
523
- "message": "view content",
523
+ "message": "ವಿಷಯವನ್ನು ವೀಕ್ಷಿಸಿ",
524
524
  "description": "used as a tooltip for eye icon beside a list"
525
525
  },
526
526
  "3pLastUpdate": {
@@ -552,7 +552,7 @@
552
552
  "description": "Button in the 'My filters' pane"
553
553
  },
554
554
  "1pExport": {
555
- "message": "ರಫ್ತು",
555
+ "message": "ರಫ್ತು...",
556
556
  "description": "Button in the 'My filters' pane"
557
557
  },
558
558
  "1pExportFilename": {
@@ -580,7 +580,7 @@
580
580
  "description": "This will persist temporary rules"
581
581
  },
582
582
  "rulesEdit": {
583
- "message": "ಸಂಪಾದಿಸಿ",
583
+ "message": "ತಿದ್ದಿ ",
584
584
  "description": "Will enable manual-edit mode (textarea)"
585
585
  },
586
586
  "rulesEditSave": {
@@ -660,7 +660,7 @@
660
660
  "description": "English: URL"
661
661
  },
662
662
  "logRequestsHeaderFilter": {
663
- "message": "Filter",
663
+ "message": "ಫಿಲ್ಟರ್",
664
664
  "description": "English: Filter"
665
665
  },
666
666
  "logAll": {
@@ -716,7 +716,7 @@
716
716
  "description": "Tooltip for the button to bring up logger output filtering options"
717
717
  },
718
718
  "loggerRowFiltererBuiltinNot": {
719
- "message": "Not",
719
+ "message": "ಅಲ್ಲದ ",
720
720
  "description": "A keyword in the built-in row filtering expression"
721
721
  },
722
722
  "loggerRowFiltererBuiltinEventful": {
@@ -780,7 +780,7 @@
780
780
  "description": "Label to identify the URL of an entry"
781
781
  },
782
782
  "loggerURLFilteringHeader": {
783
- "message": "URL rule",
783
+ "message": "URL ನಿಯಮ ",
784
784
  "description": "Small header to identify the dynamic URL filtering section"
785
785
  },
786
786
  "loggerURLFilteringContextLabel": {
@@ -540,11 +540,11 @@
540
540
  "description": "Warning against copy-pasting filters from random sources"
541
541
  },
542
542
  "1pEnableMyFiltersLabel": {
543
- "message": "Enable my custom filters",
543
+ "message": "Aktiver mine egendefinerte filtre",
544
544
  "description": "Label for the checkbox use to enable/disable 'My filters' list"
545
545
  },
546
546
  "1pTrustMyFiltersLabel": {
547
- "message": "Allow custom filters requiring trust",
547
+ "message": "Tillat egendefinerte filtre som krever tiltro",
548
548
  "description": "Label for the checkbox use to trust the content of 'My filters' list"
549
549
  },
550
550
  "1pImport": {
@@ -540,11 +540,11 @@
540
540
  "description": "Warning against copy-pasting filters from random sources"
541
541
  },
542
542
  "1pEnableMyFiltersLabel": {
543
- "message": "Enable my custom filters",
543
+ "message": "Aktiver mine egendefinerte filtre",
544
544
  "description": "Label for the checkbox use to enable/disable 'My filters' list"
545
545
  },
546
546
  "1pTrustMyFiltersLabel": {
547
- "message": "Allow custom filters requiring trust",
547
+ "message": "Tillat egendefinerte filtre som krever tiltro",
548
548
  "description": "Label for the checkbox use to trust the content of 'My filters' list"
549
549
  },
550
550
  "1pImport": {
@@ -484,7 +484,7 @@
484
484
  "description": "Filter lists section name"
485
485
  },
486
486
  "3pGroupSocial": {
487
- "message": "Social widgets",
487
+ "message": "Widget-uri sociale",
488
488
  "description": "Filter lists section name"
489
489
  },
490
490
  "3pGroupCookies": {
@@ -104,7 +104,7 @@
104
104
  "description": "For the new mobile-friendly popup design"
105
105
  },
106
106
  "popupBlockedSinceInstall_v2": {
107
- "message": "Blockerat sedan installationen",
107
+ "message": "Blockerat sedan installation",
108
108
  "description": "For the new mobile-friendly popup design"
109
109
  },
110
110
  "popupDomainsConnected_v2": {
@@ -540,11 +540,11 @@
540
540
  "description": "Warning against copy-pasting filters from random sources"
541
541
  },
542
542
  "1pEnableMyFiltersLabel": {
543
- "message": "Enable my custom filters",
543
+ "message": "启用自定义过滤规则",
544
544
  "description": "Label for the checkbox use to enable/disable 'My filters' list"
545
545
  },
546
546
  "1pTrustMyFiltersLabel": {
547
- "message": "Allow custom filters requiring trust",
547
+ "message": "允许需信任的自定义过滤规则",
548
548
  "description": "Label for the checkbox use to trust the content of 'My filters' list"
549
549
  },
550
550
  "1pImport": {
@@ -763,16 +763,11 @@
763
763
  "content": "filters",
764
764
  "group": "regions",
765
765
  "off": true,
766
- "title": "🇳🇱nl 🇧🇪be: EasyDutch",
766
+ "title": "🇳🇱nl 🇧🇪be: AdGuard Dutch",
767
767
  "tags": "ads afrikaans be belgië frisian dutch flemish nederlands netherlands nl sr suriname za",
768
768
  "lang": "af fy nl",
769
- "contentURL": "https://easydutch-ubo.github.io/EasyDutch/EasyDutch.txt",
770
- "cdnURLs": [
771
- "https://easydutch-ubo.github.io/EasyDutch/EasyDutch.all.txt",
772
- "https://cdn.jsdelivr.net/gh/EasyDutch-uBO/EasyDutch@gh-pages/EasyDutch.all.txt",
773
- "https://cdn.statically.io/gh/EasyDutch-uBO/EasyDutch/gh-pages/EasyDutch.all.txt"
774
- ],
775
- "supportURL": "https://github.com/EasyDutch-uBO/EasyDutch/"
769
+ "contentURL": "https://filters.adtidy.org/extension/ublock/filters/8.txt",
770
+ "supportURL": "https://kb.adguard.com/en/general/adguard-ad-filters"
776
771
  },
777
772
  "NOR-0": {
778
773
  "content": "filters",
@@ -155,6 +155,12 @@ function safeSelf() {
155
155
  }, []);
156
156
  return this.Object_fromEntries(entries);
157
157
  },
158
+ onIdle(fn, options) {
159
+ if ( self.requestIdleCallback ) {
160
+ return self.requestIdleCallback(fn, options);
161
+ }
162
+ return self.requestAnimationFrame(fn);
163
+ },
158
164
  };
159
165
  scriptletGlobals.safeSelf = safe;
160
166
  if ( scriptletGlobals.bcSecret === undefined ) { return safe; }
@@ -975,7 +981,9 @@ function setCookieFn(
975
981
  name = encodeURIComponent(name);
976
982
  }
977
983
  // https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1
978
- if ( /[^!#-+\--:<-[\]-~]/.test(value) ) {
984
+ // The characters [",] are given a pass from the RFC requirements because
985
+ // apparently browsers do not follow the RFC to the letter.
986
+ if ( /[^ -:<-[\]-~]/.test(value) ) {
979
987
  value = encodeURIComponent(value);
980
988
  }
981
989
 
@@ -1045,17 +1053,21 @@ function setLocalStorageItemFn(
1045
1053
  'false', 'true',
1046
1054
  'on', 'off',
1047
1055
  'yes', 'no',
1056
+ 'accept', 'reject',
1057
+ 'accepted', 'rejected',
1048
1058
  '{}', '[]', '""',
1049
1059
  '$remove$',
1050
1060
  ];
1051
1061
 
1052
1062
  if ( trusted ) {
1053
- if ( value === '$now$' ) {
1054
- value = Date.now();
1055
- } else if ( value === '$currentDate$' ) {
1056
- value = `${Date()}`;
1057
- } else if ( value === '$currentISODate$' ) {
1058
- value = (new Date()).toISOString();
1063
+ if ( value.includes('$now$') ) {
1064
+ value = value.replaceAll('$now$', Date.now());
1065
+ }
1066
+ if ( value.includes('$currentDate$') ) {
1067
+ value = value.replaceAll('$currentDate$', `${Date()}`);
1068
+ }
1069
+ if ( value.includes('$currentISODate$') ) {
1070
+ value = value.replaceAll('$currentISODate$', (new Date()).toISOString());
1059
1071
  }
1060
1072
  } else {
1061
1073
  const normalized = value.toLowerCase();
@@ -2011,12 +2023,19 @@ function noEvalIf(
2011
2023
  ) {
2012
2024
  if ( typeof needle !== 'string' ) { return; }
2013
2025
  const safe = safeSelf();
2026
+ const logPrefix = safe.makeLogPrefix('noeval-if', needle);
2014
2027
  const reNeedle = safe.patternToRegex(needle);
2015
2028
  window.eval = new Proxy(window.eval, { // jshint ignore: line
2016
2029
  apply: function(target, thisArg, args) {
2017
- const a = args[0];
2018
- if ( reNeedle.test(a.toString()) ) { return; }
2019
- return target.apply(thisArg, args);
2030
+ const a = String(args[0]);
2031
+ if ( needle !== '' && reNeedle.test(a) ) {
2032
+ safe.uboLog(logPrefix, 'Prevented:\n', a);
2033
+ return;
2034
+ }
2035
+ if ( needle === '' || safe.logLevel > 1 ) {
2036
+ safe.uboLog(logPrefix, 'Not prevented:\n', a);
2037
+ }
2038
+ return Reflect.apply(target, thisArg, args);
2020
2039
  }
2021
2040
  });
2022
2041
  }
@@ -2171,18 +2190,24 @@ builtinScriptlets.push({
2171
2190
  fn: removeAttr,
2172
2191
  dependencies: [
2173
2192
  'run-at.fn',
2193
+ 'safe-self.fn',
2174
2194
  ],
2175
2195
  });
2176
2196
  function removeAttr(
2177
- token = '',
2178
- selector = '',
2197
+ rawToken = '',
2198
+ rawSelector = '',
2179
2199
  behavior = ''
2180
2200
  ) {
2181
- if ( typeof token !== 'string' ) { return; }
2182
- if ( token === '' ) { return; }
2183
- const tokens = token.split(/\s*\|\s*/);
2184
- if ( selector === '' ) {
2185
- selector = `[${tokens.join('],[')}]`;
2201
+ if ( typeof rawToken !== 'string' ) { return; }
2202
+ if ( rawToken === '' ) { return; }
2203
+ const safe = safeSelf();
2204
+ const logPrefix = safe.makeLogPrefix('remove-attr', rawToken, rawSelector, behavior);
2205
+ const tokens = rawToken.split(/\s*\|\s*/);
2206
+ const selector = tokens
2207
+ .map(a => `${rawSelector}[${CSS.escape(a)}]`)
2208
+ .join(',');
2209
+ if ( safe.logLevel > 1 ) {
2210
+ safe.uboLog(logPrefix, `Target selector:\n\t${selector}`);
2186
2211
  }
2187
2212
  let timer;
2188
2213
  const rmattr = ( ) => {
@@ -2191,7 +2216,9 @@ function removeAttr(
2191
2216
  const nodes = document.querySelectorAll(selector);
2192
2217
  for ( const node of nodes ) {
2193
2218
  for ( const attr of tokens ) {
2219
+ if ( node.hasAttribute(attr) === false ) { continue; }
2194
2220
  node.removeAttribute(attr);
2221
+ safe.uboLog(logPrefix, `Removed attribute '${attr}'`);
2195
2222
  }
2196
2223
  }
2197
2224
  } catch(ex) {
@@ -2211,7 +2238,7 @@ function removeAttr(
2211
2238
  }
2212
2239
  }
2213
2240
  if ( skip ) { return; }
2214
- timer = self.requestIdleCallback(rmattr, { timeout: 17 });
2241
+ timer = safe.onIdle(rmattr, { timeout: 67 });
2215
2242
  };
2216
2243
  const start = ( ) => {
2217
2244
  rmattr();
@@ -2240,27 +2267,34 @@ builtinScriptlets.push({
2240
2267
  world: 'ISOLATED',
2241
2268
  dependencies: [
2242
2269
  'run-at.fn',
2270
+ 'safe-self.fn',
2243
2271
  ],
2244
2272
  });
2245
2273
  function removeClass(
2246
- token = '',
2247
- selector = '',
2274
+ rawToken = '',
2275
+ rawSelector = '',
2248
2276
  behavior = ''
2249
2277
  ) {
2250
- if ( typeof token !== 'string' ) { return; }
2251
- if ( token === '' ) { return; }
2252
- const classTokens = token.split(/\s*\|\s*/);
2253
- if ( selector === '' ) {
2254
- selector = '.' + classTokens.map(a => CSS.escape(a)).join(',.');
2278
+ if ( typeof rawToken !== 'string' ) { return; }
2279
+ if ( rawToken === '' ) { return; }
2280
+ const safe = safeSelf();
2281
+ const logPrefix = safe.makeLogPrefix('remove-class', rawToken, rawSelector, behavior);
2282
+ const tokens = rawToken.split(/\s*\|\s*/);
2283
+ const selector = tokens
2284
+ .map(a => `${rawSelector}.${CSS.escape(a)}`)
2285
+ .join(',');
2286
+ if ( safe.logLevel > 1 ) {
2287
+ safe.uboLog(logPrefix, `Target selector:\n\t${selector}`);
2255
2288
  }
2256
2289
  const mustStay = /\bstay\b/.test(behavior);
2257
2290
  let timer;
2258
- const rmclass = function() {
2291
+ const rmclass = ( ) => {
2259
2292
  timer = undefined;
2260
2293
  try {
2261
2294
  const nodes = document.querySelectorAll(selector);
2262
2295
  for ( const node of nodes ) {
2263
- node.classList.remove(...classTokens);
2296
+ node.classList.remove(...tokens);
2297
+ safe.uboLog(logPrefix, 'Removed class(es)');
2264
2298
  }
2265
2299
  } catch(ex) {
2266
2300
  }
@@ -2282,7 +2316,7 @@ function removeClass(
2282
2316
  }
2283
2317
  }
2284
2318
  if ( skip ) { return; }
2285
- timer = self.requestIdleCallback(rmclass, { timeout: 67 });
2319
+ timer = safe.onIdle(rmclass, { timeout: 67 });
2286
2320
  };
2287
2321
  const observer = new MutationObserver(mutationHandler);
2288
2322
  const start = ( ) => {
@@ -3268,6 +3302,10 @@ function m3uPrune(
3268
3302
  };
3269
3303
  const pruner = text => {
3270
3304
  if ( (/^\s*#EXTM3U/.test(text)) === false ) { return text; }
3305
+ if ( m3uPattern === '' ) {
3306
+ safe.uboLog(` Content:\n${text}`);
3307
+ return text;
3308
+ }
3271
3309
  if ( reM3u.multiline ) {
3272
3310
  reM3u.lastIndex = 0;
3273
3311
  for (;;) {
@@ -3491,7 +3529,7 @@ function hrefSanitizer(
3491
3529
  if ( shouldSanitize ) { break; }
3492
3530
  }
3493
3531
  if ( shouldSanitize === false ) { return; }
3494
- timer = self.requestIdleCallback(( ) => {
3532
+ timer = safe.onIdle(( ) => {
3495
3533
  timer = undefined;
3496
3534
  sanitize();
3497
3535
  });
@@ -3604,6 +3642,9 @@ function spoofCSS(
3604
3642
  const cloackFunc = (fn, thisArg, name) => {
3605
3643
  const trap = fn.bind(thisArg);
3606
3644
  Object.defineProperty(trap, 'name', { value: name });
3645
+ Object.defineProperty(trap, 'toString', {
3646
+ value: ( ) => `function ${name}() { [native code] }`
3647
+ });
3607
3648
  return trap;
3608
3649
  };
3609
3650
  self.getComputedStyle = new Proxy(self.getComputedStyle, {
@@ -3617,7 +3658,7 @@ function spoofCSS(
3617
3658
  get(target, prop, receiver) {
3618
3659
  if ( typeof target[prop] === 'function' ) {
3619
3660
  if ( prop === 'getPropertyValue' ) {
3620
- return cloackFunc(function(prop) {
3661
+ return cloackFunc(function getPropertyValue(prop) {
3621
3662
  return spoofStyle(prop, target[prop]);
3622
3663
  }, target, 'getPropertyValue');
3623
3664
  }
@@ -3736,6 +3777,7 @@ function setCookie(
3736
3777
  'true', 't', 'false', 'f',
3737
3778
  'yes', 'y', 'no', 'n',
3738
3779
  'necessary', 'required',
3780
+ 'approved', 'disapproved',
3739
3781
  ];
3740
3782
  const normalized = value.toLowerCase();
3741
3783
  const match = /^("?)(.+)\1$/.exec(normalized);
@@ -4447,6 +4489,20 @@ function trustedClickElement(
4447
4489
  }
4448
4490
  }
4449
4491
 
4492
+ const getShadowRoot = elem => {
4493
+ // Firefox
4494
+ if ( elem.openOrClosedShadowRoot ) {
4495
+ return elem.openOrClosedShadowRoot;
4496
+ }
4497
+ // Chromium
4498
+ if ( typeof chrome === 'object' ) {
4499
+ if ( chrome.dom && chrome.dom.openOrClosedShadowRoot ) {
4500
+ return chrome.dom.openOrClosedShadowRoot(elem);
4501
+ }
4502
+ }
4503
+ return null;
4504
+ };
4505
+
4450
4506
  const querySelectorEx = (selector, context = document) => {
4451
4507
  const pos = selector.indexOf(' >>> ');
4452
4508
  if ( pos === -1 ) { return context.querySelector(selector); }
@@ -4454,7 +4510,7 @@ function trustedClickElement(
4454
4510
  const inside = selector.slice(pos + 5).trim();
4455
4511
  const elem = context.querySelector(outside);
4456
4512
  if ( elem === null ) { return null; }
4457
- const shadowRoot = elem.shadowRoot;
4513
+ const shadowRoot = getShadowRoot(elem);
4458
4514
  return shadowRoot && querySelectorEx(inside, shadowRoot);
4459
4515
  };
4460
4516
 
@@ -4702,3 +4758,44 @@ function trustedReplaceArgument(
4702
4758
  }
4703
4759
 
4704
4760
  /******************************************************************************/
4761
+
4762
+ builtinScriptlets.push({
4763
+ name: 'trusted-replace-outbound-text.js',
4764
+ requiresTrust: true,
4765
+ fn: trustedReplaceOutboundText,
4766
+ dependencies: [
4767
+ 'proxy-apply.fn',
4768
+ 'safe-self.fn',
4769
+ ],
4770
+ });
4771
+ function trustedReplaceOutboundText(
4772
+ propChain = '',
4773
+ pattern = '',
4774
+ replacement = '',
4775
+ ...args
4776
+ ) {
4777
+ if ( propChain === '' ) { return; }
4778
+ const safe = safeSelf();
4779
+ const logPrefix = safe.makeLogPrefix('trusted-replace-outbound-text', propChain, pattern, replacement, ...args);
4780
+ const rePattern = safe.patternToRegex(pattern);
4781
+ const extraArgs = safe.getExtraArgs(args);
4782
+ const reCondition = safe.patternToRegex(extraArgs.condition || '');
4783
+ const reflector = proxyApplyFn(propChain, function(...args) {
4784
+ const textBefore = reflector(...args);
4785
+ if ( pattern === '' ) {
4786
+ safe.uboLog(logPrefix, 'Outbound text:\n', textBefore);
4787
+ return textBefore;
4788
+ }
4789
+ reCondition.lastIndex = 0;
4790
+ if ( reCondition.test(textBefore) === false ) { return textBefore; }
4791
+ const textAfter = textBefore.replace(rePattern, replacement);
4792
+ if ( textAfter === textBefore ) { return textBefore; }
4793
+ safe.uboLog(logPrefix, 'Matched and replaced');
4794
+ if ( safe.logLevel > 1 ) {
4795
+ safe.uboLog(logPrefix, 'Modified outbound text:\n', textAfter);
4796
+ }
4797
+ return textAfter;
4798
+ });
4799
+ }
4800
+
4801
+ /******************************************************************************/