@browserless.io/browserless 2.5.0 → 2.6.1-beta-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/README.md +55 -36
  3. package/build/config.d.ts +2 -2
  4. package/build/config.js +3 -3
  5. package/build/data/classes.json +1 -1
  6. package/build/data/selectors.json +1 -1
  7. package/build/http.d.ts +1 -0
  8. package/build/http.js +1 -0
  9. package/build/routes/chrome/http/content.post.body.json +8 -8
  10. package/build/routes/chrome/http/pdf.post.body.json +8 -8
  11. package/build/routes/chrome/http/scrape.post.body.json +8 -8
  12. package/build/routes/chrome/http/screenshot.post.body.json +9 -9
  13. package/build/routes/chromium/http/content.post.body.json +8 -8
  14. package/build/routes/chromium/http/pdf.post.body.json +8 -8
  15. package/build/routes/chromium/http/scrape.post.body.json +8 -8
  16. package/build/routes/chromium/http/screenshot.post.body.json +9 -9
  17. package/build/routes/management/http/active.get.d.ts +16 -0
  18. package/build/routes/management/http/active.get.js +17 -0
  19. package/build/routes/management/tests/management.spec.js +7 -0
  20. package/build/server.js +1 -1
  21. package/build/shared/utils/function/handler.js +3 -2
  22. package/build/types.d.ts +6 -4
  23. package/build/types.js +1 -0
  24. package/build/utils.d.ts +1 -1
  25. package/docker/base/Dockerfile +1 -1
  26. package/extensions/ublock/1p-filters.html +4 -3
  27. package/extensions/ublock/3p-filters.html +3 -3
  28. package/extensions/ublock/_locales/ar/messages.json +16 -4
  29. package/extensions/ublock/_locales/az/messages.json +16 -4
  30. package/extensions/ublock/_locales/be/messages.json +19 -7
  31. package/extensions/ublock/_locales/bg/messages.json +16 -4
  32. package/extensions/ublock/_locales/bn/messages.json +33 -21
  33. package/extensions/ublock/_locales/br_FR/messages.json +33 -21
  34. package/extensions/ublock/_locales/bs/messages.json +16 -4
  35. package/extensions/ublock/_locales/ca/messages.json +16 -4
  36. package/extensions/ublock/_locales/cs/messages.json +16 -4
  37. package/extensions/ublock/_locales/cv/messages.json +16 -4
  38. package/extensions/ublock/_locales/cy/messages.json +16 -4
  39. package/extensions/ublock/_locales/da/messages.json +21 -9
  40. package/extensions/ublock/_locales/de/messages.json +17 -5
  41. package/extensions/ublock/_locales/el/messages.json +16 -4
  42. package/extensions/ublock/_locales/en/messages.json +16 -4
  43. package/extensions/ublock/_locales/en_GB/messages.json +16 -4
  44. package/extensions/ublock/_locales/eo/messages.json +17 -5
  45. package/extensions/ublock/_locales/es/messages.json +16 -4
  46. package/extensions/ublock/_locales/et/messages.json +16 -4
  47. package/extensions/ublock/_locales/eu/messages.json +16 -4
  48. package/extensions/ublock/_locales/fa/messages.json +24 -12
  49. package/extensions/ublock/_locales/fi/messages.json +16 -4
  50. package/extensions/ublock/_locales/fil/messages.json +16 -4
  51. package/extensions/ublock/_locales/fr/messages.json +16 -4
  52. package/extensions/ublock/_locales/fy/messages.json +16 -4
  53. package/extensions/ublock/_locales/gl/messages.json +16 -4
  54. package/extensions/ublock/_locales/gu/messages.json +16 -4
  55. package/extensions/ublock/_locales/he/messages.json +25 -13
  56. package/extensions/ublock/_locales/hi/messages.json +31 -19
  57. package/extensions/ublock/_locales/hr/messages.json +16 -4
  58. package/extensions/ublock/_locales/hu/messages.json +16 -4
  59. package/extensions/ublock/_locales/hy/messages.json +17 -5
  60. package/extensions/ublock/_locales/id/messages.json +16 -4
  61. package/extensions/ublock/_locales/it/messages.json +17 -5
  62. package/extensions/ublock/_locales/ja/messages.json +16 -4
  63. package/extensions/ublock/_locales/ka/messages.json +16 -4
  64. package/extensions/ublock/_locales/kk/messages.json +16 -4
  65. package/extensions/ublock/_locales/kn/messages.json +74 -62
  66. package/extensions/ublock/_locales/ko/messages.json +16 -4
  67. package/extensions/ublock/_locales/lt/messages.json +23 -11
  68. package/extensions/ublock/_locales/lv/messages.json +16 -4
  69. package/extensions/ublock/_locales/mk/messages.json +16 -4
  70. package/extensions/ublock/_locales/ml/messages.json +19 -7
  71. package/extensions/ublock/_locales/mr/messages.json +16 -4
  72. package/extensions/ublock/_locales/ms/messages.json +16 -4
  73. package/extensions/ublock/_locales/nb/messages.json +16 -4
  74. package/extensions/ublock/_locales/nl/messages.json +16 -4
  75. package/extensions/ublock/_locales/no/messages.json +16 -4
  76. package/extensions/ublock/_locales/oc/messages.json +16 -4
  77. package/extensions/ublock/_locales/pa/messages.json +16 -4
  78. package/extensions/ublock/_locales/pl/messages.json +17 -5
  79. package/extensions/ublock/_locales/pt_BR/messages.json +16 -4
  80. package/extensions/ublock/_locales/pt_PT/messages.json +16 -4
  81. package/extensions/ublock/_locales/ro/messages.json +17 -5
  82. package/extensions/ublock/_locales/ru/messages.json +16 -4
  83. package/extensions/ublock/_locales/si/messages.json +16 -4
  84. package/extensions/ublock/_locales/sk/messages.json +16 -4
  85. package/extensions/ublock/_locales/sl/messages.json +16 -4
  86. package/extensions/ublock/_locales/so/messages.json +16 -4
  87. package/extensions/ublock/_locales/sq/messages.json +16 -4
  88. package/extensions/ublock/_locales/sr/messages.json +16 -4
  89. package/extensions/ublock/_locales/sv/messages.json +20 -8
  90. package/extensions/ublock/_locales/sw/messages.json +16 -4
  91. package/extensions/ublock/_locales/ta/messages.json +16 -4
  92. package/extensions/ublock/_locales/te/messages.json +16 -4
  93. package/extensions/ublock/_locales/th/messages.json +42 -30
  94. package/extensions/ublock/_locales/tr/messages.json +19 -7
  95. package/extensions/ublock/_locales/uk/messages.json +16 -4
  96. package/extensions/ublock/_locales/ur/messages.json +16 -4
  97. package/extensions/ublock/_locales/vi/messages.json +16 -4
  98. package/extensions/ublock/_locales/zh_CN/messages.json +16 -4
  99. package/extensions/ublock/_locales/zh_TW/messages.json +42 -30
  100. package/extensions/ublock/assets/assets.json +95 -78
  101. package/extensions/ublock/assets/resources/scriptlets.js +70 -24
  102. package/extensions/ublock/assets/thirdparties/easylist/easylist.txt +6258 -3453
  103. package/extensions/ublock/assets/thirdparties/easylist/easyprivacy.txt +277 -40
  104. package/extensions/ublock/assets/thirdparties/pgl.yoyo.org/as/serverlist +8 -32
  105. package/extensions/ublock/assets/thirdparties/publicsuffix.org/list/effective_tld_names.dat +107 -12
  106. package/extensions/ublock/assets/thirdparties/urlhaus-filter/urlhaus-filter-online.txt +1160 -954
  107. package/extensions/ublock/assets/ublock/badlists.txt +1 -2
  108. package/extensions/ublock/assets/ublock/badware.min.txt +395 -270
  109. package/extensions/ublock/assets/ublock/filters.min.txt +1176 -1238
  110. package/extensions/ublock/assets/ublock/privacy.min.txt +32 -31
  111. package/extensions/ublock/assets/ublock/quick-fixes.min.txt +120 -110
  112. package/extensions/ublock/assets/ublock/unbreak.min.txt +75 -36
  113. package/extensions/ublock/css/1p-filters.css +2 -1
  114. package/extensions/ublock/css/3p-filters.css +1 -16
  115. package/extensions/ublock/css/advanced-settings.css +1 -0
  116. package/extensions/ublock/css/asset-viewer.css +1 -0
  117. package/extensions/ublock/css/code-viewer.css +1 -0
  118. package/extensions/ublock/css/codemirror.css +37 -10
  119. package/extensions/ublock/css/common.css +36 -2
  120. package/extensions/ublock/css/dashboard.css +9 -3
  121. package/extensions/ublock/css/devtools.css +1 -0
  122. package/extensions/ublock/css/document-blocked.css +3 -3
  123. package/extensions/ublock/css/dom-inspector.css +1 -0
  124. package/extensions/ublock/css/dyna-rules.css +1 -0
  125. package/extensions/ublock/css/epicker-ui.css +76 -66
  126. package/extensions/ublock/css/fa-icons.css +1 -0
  127. package/extensions/ublock/css/logger-ui.css +2 -0
  128. package/extensions/ublock/css/popup-fenix.css +1 -0
  129. package/extensions/ublock/css/whitelist.css +1 -0
  130. package/extensions/ublock/dashboard.html +20 -13
  131. package/extensions/ublock/devtools.html +2 -0
  132. package/extensions/ublock/dyna-rules.html +2 -2
  133. package/extensions/ublock/img/flags-of-the-world/np.png +0 -0
  134. package/extensions/ublock/img/fontawesome/fontawesome-defs.svg +1 -0
  135. package/extensions/ublock/js/1p-filters.js +72 -23
  136. package/extensions/ublock/js/3p-filters.js +71 -25
  137. package/extensions/ublock/js/asset-viewer.js +1 -0
  138. package/extensions/ublock/js/assets.js +83 -89
  139. package/extensions/ublock/js/background.js +20 -27
  140. package/extensions/ublock/js/base64-custom.js +1 -102
  141. package/extensions/ublock/js/benchmarks.js +36 -21
  142. package/extensions/ublock/js/biditrie.js +8 -23
  143. package/extensions/ublock/js/broadcast.js +2 -4
  144. package/extensions/ublock/js/cachestorage.js +594 -396
  145. package/extensions/ublock/js/codemirror/search.js +49 -37
  146. package/extensions/ublock/js/codemirror/ubo-static-filtering.js +233 -215
  147. package/extensions/ublock/js/contentscript-extra.js +31 -1
  148. package/extensions/ublock/js/cosmetic-filtering.js +35 -33
  149. package/extensions/ublock/js/dashboard.js +11 -7
  150. package/extensions/ublock/js/devtools.js +22 -0
  151. package/extensions/ublock/js/dom.js +2 -2
  152. package/extensions/ublock/js/dyna-rules.js +17 -16
  153. package/extensions/ublock/js/epicker-ui.js +41 -16
  154. package/extensions/ublock/js/fa-icons.js +1 -0
  155. package/extensions/ublock/js/hntrie.js +10 -25
  156. package/extensions/ublock/js/i18n.js +15 -15
  157. package/extensions/ublock/js/logger-ui.js +9 -6
  158. package/extensions/ublock/js/messaging.js +51 -26
  159. package/extensions/ublock/js/pagestore.js +21 -23
  160. package/extensions/ublock/js/popup-fenix.js +35 -22
  161. package/extensions/ublock/js/redirect-engine.js +15 -30
  162. package/extensions/ublock/js/reverselookup.js +1 -1
  163. package/extensions/ublock/js/s14e-serializer.js +1405 -0
  164. package/extensions/ublock/js/scriptlet-filtering-core.js +1 -1
  165. package/extensions/ublock/js/scriptlets/epicker.js +27 -18
  166. package/extensions/ublock/js/settings.js +32 -21
  167. package/extensions/ublock/js/start.js +121 -62
  168. package/extensions/ublock/js/static-ext-filtering-db.js +6 -6
  169. package/extensions/ublock/js/static-ext-filtering.js +17 -28
  170. package/extensions/ublock/js/static-filtering-parser.js +26 -4
  171. package/extensions/ublock/js/static-net-filtering.js +69 -168
  172. package/extensions/ublock/js/storage.js +178 -155
  173. package/extensions/ublock/js/traffic.js +11 -7
  174. package/extensions/ublock/js/vapi-background.js +49 -62
  175. package/extensions/ublock/js/vapi-client.js +13 -16
  176. package/extensions/ublock/js/webext.js +10 -2
  177. package/extensions/ublock/js/whitelist.js +27 -25
  178. package/extensions/ublock/lib/publicsuffixlist/publicsuffixlist.js +3 -7
  179. package/extensions/ublock/manifest.json +2 -1
  180. package/extensions/ublock/web_accessible_resources/epicker-ui.html +5 -8
  181. package/extensions/ublock/whitelist.html +3 -4
  182. package/package.json +12 -12
  183. package/scripts/build-function.js +42 -12
  184. package/src/config.ts +3 -4
  185. package/src/http.ts +1 -0
  186. package/src/routes/management/http/active.get.ts +30 -0
  187. package/src/routes/management/tests/management.spec.ts +13 -0
  188. package/src/server.ts +3 -1
  189. package/src/shared/utils/function/handler.ts +5 -2
  190. package/src/types.ts +2 -1
  191. package/static/docs/swagger.json +57 -11
  192. package/static/docs/swagger.min.json +56 -10
  193. package/static/function/client.js +4155 -3350
  194. package/static/function/index.html +33094 -1
  195. package/extensions/ublock/_locales/ku/messages.json +0 -1294
@@ -109,9 +109,9 @@ vAPI.generateSecret = (size = 1) => {
109
109
  *
110
110
  * */
111
111
 
112
- vAPI.sessionStorage = {
112
+ vAPI.sessionStorage = browser.storage.session || {
113
113
  get() {
114
- return Promise.resolve({});
114
+ return Promise.resolve();
115
115
  },
116
116
  set() {
117
117
  return Promise.resolve();
@@ -122,7 +122,7 @@ vAPI.sessionStorage = {
122
122
  clear() {
123
123
  return Promise.resolve();
124
124
  },
125
- implemented: false,
125
+ unavailable: true,
126
126
  };
127
127
 
128
128
  /*******************************************************************************
@@ -137,46 +137,21 @@ vAPI.sessionStorage = {
137
137
 
138
138
  vAPI.storage = {
139
139
  get(key, ...args) {
140
- if ( vAPI.sessionStorage.implemented !== true ) {
141
- return webext.storage.local.get(key, ...args).catch(reason => {
142
- console.log(reason);
143
- });
144
- }
145
- return vAPI.sessionStorage.get(key, ...args).then(bin => {
146
- const size = Object.keys(bin).length;
147
- if ( size === 1 && typeof key === 'string' && bin[key] === null ) {
148
- return {};
149
- }
150
- if ( size !== 0 ) { return bin; }
151
- return webext.storage.local.get(key, ...args).then(bin => {
152
- if ( bin instanceof Object === false ) { return bin; }
153
- // Mirror empty result as null value in order to prevent
154
- // from falling back to storage.local when there is no need.
155
- const tomirror = Object.assign({}, bin);
156
- if ( typeof key === 'string' && Object.keys(bin).length === 0 ) {
157
- Object.assign(tomirror, { [key]: null });
158
- }
159
- vAPI.sessionStorage.set(tomirror);
160
- return bin;
161
- }).catch(reason => {
162
- console.log(reason);
163
- });
140
+ return webext.storage.local.get(key, ...args).catch(reason => {
141
+ console.log(reason);
164
142
  });
165
143
  },
166
144
  set(...args) {
167
- vAPI.sessionStorage.set(...args);
168
145
  return webext.storage.local.set(...args).catch(reason => {
169
146
  console.log(reason);
170
147
  });
171
148
  },
172
149
  remove(...args) {
173
- vAPI.sessionStorage.remove(...args);
174
150
  return webext.storage.local.remove(...args).catch(reason => {
175
151
  console.log(reason);
176
152
  });
177
153
  },
178
154
  clear(...args) {
179
- vAPI.sessionStorage.clear(...args);
180
155
  return webext.storage.local.clear(...args).catch(reason => {
181
156
  console.log(reason);
182
157
  });
@@ -341,10 +316,10 @@ vAPI.Tabs = class {
341
316
  });
342
317
  }
343
318
 
344
- async executeScript() {
319
+ async executeScript(...args) {
345
320
  let result;
346
321
  try {
347
- result = await webext.tabs.executeScript(...arguments);
322
+ result = await webext.tabs.executeScript(...args);
348
323
  }
349
324
  catch(reason) {
350
325
  }
@@ -458,22 +433,26 @@ vAPI.Tabs = class {
458
433
  // For some reasons, some platforms do not honor the left,top
459
434
  // position when specified. I found that further calling
460
435
  // windows.update again with the same position _may_ help.
436
+ //
437
+ // https://github.com/uBlockOrigin/uBlock-issues/issues/2249
438
+ // Mind that the creation of the popup window might fail.
461
439
  if ( details.popup !== undefined && vAPI.windows instanceof Object ) {
462
- const createDetails = {
440
+ const basicDetails = {
463
441
  url: details.url,
464
442
  type: details.popup,
465
443
  };
466
- if ( details.box instanceof Object ) {
467
- Object.assign(createDetails, details.box);
444
+ const shouldRestorePosition = details.box instanceof Object;
445
+ const extraDetails = shouldRestorePosition
446
+ ? Object.assign({}, basicDetails, details.box)
447
+ : basicDetails;
448
+ const win = await vAPI.windows.create(extraDetails);
449
+ if ( win === null ) {
450
+ if ( shouldRestorePosition === false ) { return; }
451
+ return vAPI.windows.create(basicDetails);
468
452
  }
469
- const win = await vAPI.windows.create(createDetails);
470
- if ( win === null ) { return; }
471
- if ( details.box instanceof Object === false ) { return; }
472
- if (
473
- win.left === details.box.left &&
474
- win.top === details.box.top
475
- ) {
476
- return;
453
+ if ( shouldRestorePosition === false ) { return; }
454
+ if ( win.left === details.box.left ) {
455
+ if ( win.top === details.box.top ) { return; }
477
456
  }
478
457
  vAPI.windows.update(win.id, {
479
458
  left: details.box.left,
@@ -569,7 +548,7 @@ vAPI.Tabs = class {
569
548
  targetURL = vAPI.getURL(targetURL);
570
549
  }
571
550
 
572
- vAPI.tabs.update(tabId, { url: targetURL });
551
+ return vAPI.tabs.update(tabId, { url: targetURL });
573
552
  }
574
553
 
575
554
  async remove(tabId) {
@@ -1671,10 +1650,7 @@ vAPI.cloud = (( ) => {
1671
1650
 
1672
1651
  const push = async function(details) {
1673
1652
  const { datakey, data, encode } = details;
1674
- if (
1675
- data === undefined ||
1676
- typeof data === 'string' && data === ''
1677
- ) {
1653
+ if ( data === undefined || typeof data === 'string' && data === '' ) {
1678
1654
  return deleteChunks(datakey, 0);
1679
1655
  }
1680
1656
  const item = {
@@ -1682,10 +1658,9 @@ vAPI.cloud = (( ) => {
1682
1658
  tstamp: Date.now(),
1683
1659
  data,
1684
1660
  };
1685
- const json = JSON.stringify(item);
1686
1661
  const encoded = encode instanceof Function
1687
- ? await encode(json)
1688
- : json;
1662
+ ? await encode(item)
1663
+ : JSON.stringify(item);
1689
1664
 
1690
1665
  // Chunkify taking into account QUOTA_BYTES_PER_ITEM:
1691
1666
  // https://developer.chrome.com/extensions/storage#property-sync
@@ -1750,13 +1725,16 @@ vAPI.cloud = (( ) => {
1750
1725
  i += 1;
1751
1726
  }
1752
1727
  encoded = encoded.join('');
1753
- const json = decode instanceof Function
1754
- ? await decode(encoded)
1755
- : encoded;
1728
+
1756
1729
  let entry = null;
1757
1730
  try {
1758
- entry = JSON.parse(json);
1759
- } catch(ex) {
1731
+ if ( decode instanceof Function ) {
1732
+ entry = await decode(encoded) || null;
1733
+ }
1734
+ if ( typeof entry === 'string' ) {
1735
+ entry = JSON.parse(entry);
1736
+ }
1737
+ } catch(_) {
1760
1738
  }
1761
1739
  return entry;
1762
1740
  };
@@ -1805,15 +1783,24 @@ vAPI.cloud = (( ) => {
1805
1783
  /******************************************************************************/
1806
1784
  /******************************************************************************/
1807
1785
 
1808
- vAPI.alarms = browser.alarms || {
1809
- create() {
1786
+ vAPI.alarms = {
1787
+ create(...args) {
1788
+ webext.alarms.create(...args);
1810
1789
  },
1811
- clear() {
1790
+ createIfNotPresent(name, ...args) {
1791
+ webext.alarms.get(name).then(details => {
1792
+ if ( details !== undefined ) { return; }
1793
+ webext.alarms.create(name, ...args);
1794
+ });
1795
+ },
1796
+ async clear(...args) {
1797
+ return webext.alarms.clear(...args);
1812
1798
  },
1813
1799
  onAlarm: {
1814
- addListener() {
1815
- }
1816
- }
1800
+ addListener(...args) {
1801
+ webext.alarms.onAlarm.addListener(...args);
1802
+ },
1803
+ },
1817
1804
  };
1818
1805
 
1819
1806
  /******************************************************************************/
@@ -22,10 +22,6 @@
22
22
 
23
23
  // For non-background page
24
24
 
25
- /* globals browser */
26
-
27
- 'use strict';
28
-
29
25
  /******************************************************************************/
30
26
 
31
27
  // https://github.com/chrisaljoudi/uBlock/issues/456
@@ -85,6 +81,7 @@ vAPI.messaging = {
85
81
  portTimerDelay: 10000,
86
82
  msgIdGenerator: 1,
87
83
  pending: new Map(),
84
+ waitStartTime: 0,
88
85
  shuttingDown: false,
89
86
 
90
87
  shutdown: function() {
@@ -115,16 +112,11 @@ vAPI.messaging = {
115
112
  // revisited to isolate the picker dialog DOM from the page DOM.
116
113
  messageListener: function(details) {
117
114
  if ( typeof details !== 'object' || details === null ) { return; }
118
-
119
- // Response to specific message previously sent
120
- if ( details.msgId !== undefined ) {
121
- const resolver = this.pending.get(details.msgId);
122
- if ( resolver !== undefined ) {
123
- this.pending.delete(details.msgId);
124
- resolver(details.msg);
125
- return;
126
- }
127
- }
115
+ if ( details.msgId === undefined ) { return; }
116
+ const resolver = this.pending.get(details.msgId);
117
+ if ( resolver === undefined ) { return; }
118
+ this.pending.delete(details.msgId);
119
+ resolver(details.msg);
128
120
  },
129
121
  messageListenerBound: null,
130
122
 
@@ -203,13 +195,18 @@ vAPI.messaging = {
203
195
  // the main process is no longer reachable: memory leaks and bad
204
196
  // performance become a risk -- especially for long-lived, dynamic
205
197
  // pages. Guard against this.
206
- if ( this.pending.size > 50 ) {
207
- vAPI.shutdown.exec();
198
+ if ( this.pending.size > 64 ) {
199
+ if ( (Date.now() - this.waitStartTime) > 60000 ) {
200
+ vAPI.shutdown.exec();
201
+ }
208
202
  }
209
203
  const port = this.getPort();
210
204
  if ( port === null ) {
211
205
  return Promise.resolve();
212
206
  }
207
+ if ( this.pending.size === 0 ) {
208
+ this.waitStartTime = Date.now();
209
+ }
213
210
  const msgId = this.msgIdGenerator++;
214
211
  const promise = new Promise(resolve => {
215
212
  this.pending.set(msgId, resolve);
@@ -19,8 +19,6 @@
19
19
  Home: https://github.com/gorhill/uBlock
20
20
  */
21
21
 
22
- 'use strict';
23
-
24
22
  // `webext` is a promisified api of `chrome`. Entries are added as
25
23
  // the promisification of uBO progress.
26
24
 
@@ -54,6 +52,15 @@ const promisify = function(thisArg, fnName) {
54
52
  };
55
53
 
56
54
  const webext = {
55
+ // https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/alarms
56
+ alarms: {
57
+ clear: promisifyNoFail(chrome.alarms, 'clear'),
58
+ clearAll: promisifyNoFail(chrome.alarms, 'clearAll'),
59
+ create: promisifyNoFail(chrome.alarms, 'create'),
60
+ get: promisifyNoFail(chrome.alarms, 'get'),
61
+ getAll: promisifyNoFail(chrome.alarms, 'getAll'),
62
+ onAlarm: chrome.alarms.onAlarm,
63
+ },
57
64
  // https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/browserAction
58
65
  browserAction: {
59
66
  setBadgeBackgroundColor: promisifyNoFail(chrome.browserAction, 'setBadgeBackgroundColor'),
@@ -95,6 +102,7 @@ const webext = {
95
102
  query: promisifyNoFail(chrome.tabs, 'query', tabs => Array.isArray(tabs) ? tabs : []),
96
103
  reload: promisifyNoFail(chrome.tabs, 'reload'),
97
104
  remove: promisifyNoFail(chrome.tabs, 'remove'),
105
+ sendMessage: promisifyNoFail(chrome.tabs, 'sendMessage'),
98
106
  update: promisifyNoFail(chrome.tabs, 'update', tab => tab instanceof Object ? tab : null),
99
107
  },
100
108
  // https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webNavigation
@@ -30,12 +30,12 @@ import { dom, qs$ } from './dom.js';
30
30
 
31
31
  const reComment = /^\s*#\s*/;
32
32
 
33
- const directiveFromLine = function(line) {
33
+ function directiveFromLine(line) {
34
34
  const match = reComment.exec(line);
35
35
  return match === null
36
36
  ? line.trim()
37
37
  : line.slice(match.index + match[0].length).trim();
38
- };
38
+ }
39
39
 
40
40
  /******************************************************************************/
41
41
 
@@ -43,7 +43,7 @@ CodeMirror.defineMode("ubo-whitelist-directives", function() {
43
43
  const reRegex = /^\/.+\/$/;
44
44
 
45
45
  return {
46
- token: function(stream) {
46
+ token: function token(stream) {
47
47
  const line = stream.string.trim();
48
48
  stream.skipToEnd();
49
49
  if ( reBadHostname === undefined ) {
@@ -100,18 +100,18 @@ uBlockDashboard.patchCodeMirrorEditor(cmEditor);
100
100
 
101
101
  /******************************************************************************/
102
102
 
103
- const getEditorText = function() {
103
+ function getEditorText() {
104
104
  let text = cmEditor.getValue().replace(/\s+$/, '');
105
105
  return text === '' ? text : text + '\n';
106
- };
106
+ }
107
107
 
108
- const setEditorText = function(text) {
108
+ function setEditorText(text) {
109
109
  cmEditor.setValue(text.replace(/\s+$/, '') + '\n');
110
- };
110
+ }
111
111
 
112
112
  /******************************************************************************/
113
113
 
114
- const whitelistChanged = function() {
114
+ function whitelistChanged() {
115
115
  const whitelistElem = qs$('#whitelist');
116
116
  const bad = qs$(whitelistElem, '.cm-error') !== null;
117
117
  const changedWhitelist = getEditorText().trim();
@@ -119,13 +119,13 @@ const whitelistChanged = function() {
119
119
  qs$('#whitelistApply').disabled = !changed || bad;
120
120
  qs$('#whitelistRevert').disabled = !changed;
121
121
  CodeMirror.commands.save = changed && !bad ? applyChanges : noopFunc;
122
- };
122
+ }
123
123
 
124
124
  cmEditor.on('changes', whitelistChanged);
125
125
 
126
126
  /******************************************************************************/
127
127
 
128
- const renderWhitelist = async function() {
128
+ async function renderWhitelist() {
129
129
  const details = await messaging.send('dashboard', {
130
130
  what: 'getWhitelist',
131
131
  });
@@ -161,11 +161,11 @@ const renderWhitelist = async function() {
161
161
  if ( first ) {
162
162
  cmEditor.clearHistory();
163
163
  }
164
- };
164
+ }
165
165
 
166
166
  /******************************************************************************/
167
167
 
168
- const handleImportFilePicker = function() {
168
+ function handleImportFilePicker() {
169
169
  const file = this.files[0];
170
170
  if ( file === undefined || file.name === '' ) { return; }
171
171
  if ( file.type.indexOf('text') !== 0 ) { return; }
@@ -179,22 +179,22 @@ const handleImportFilePicker = function() {
179
179
  setEditorText(content);
180
180
  };
181
181
  fr.readAsText(file);
182
- };
182
+ }
183
183
 
184
184
  /******************************************************************************/
185
185
 
186
- const startImportFilePicker = function() {
186
+ function startImportFilePicker() {
187
187
  const input = qs$('#importFilePicker');
188
188
  // Reset to empty string, this will ensure an change event is properly
189
189
  // triggered if the user pick a file, even if it is the same as the last
190
190
  // one picked.
191
191
  input.value = '';
192
192
  input.click();
193
- };
193
+ }
194
194
 
195
195
  /******************************************************************************/
196
196
 
197
- const exportWhitelistToFile = function() {
197
+ function exportWhitelistToFile() {
198
198
  const val = getEditorText();
199
199
  if ( val === '' ) { return; }
200
200
  const filename =
@@ -205,42 +205,44 @@ const exportWhitelistToFile = function() {
205
205
  'url': `data:text/plain;charset=utf-8,${encodeURIComponent(val + '\n')}`,
206
206
  'filename': filename
207
207
  });
208
- };
208
+ }
209
209
 
210
210
  /******************************************************************************/
211
211
 
212
- const applyChanges = async function() {
212
+ async function applyChanges() {
213
213
  cachedWhitelist = getEditorText().trim();
214
214
  await messaging.send('dashboard', {
215
215
  what: 'setWhitelist',
216
216
  whitelist: cachedWhitelist,
217
217
  });
218
218
  renderWhitelist();
219
- };
219
+ }
220
220
 
221
- const revertChanges = function() {
221
+ function revertChanges() {
222
222
  setEditorText(cachedWhitelist);
223
- };
223
+ }
224
224
 
225
225
  /******************************************************************************/
226
226
 
227
- const getCloudData = function() {
227
+ function getCloudData() {
228
228
  return getEditorText();
229
- };
229
+ }
230
230
 
231
- const setCloudData = function(data, append) {
231
+ function setCloudData(data, append) {
232
232
  if ( typeof data !== 'string' ) { return; }
233
233
  if ( append ) {
234
234
  data = uBlockDashboard.mergeNewLines(getEditorText().trim(), data);
235
235
  }
236
236
  setEditorText(data.trim());
237
- };
237
+ }
238
238
 
239
239
  self.cloud.onPush = getCloudData;
240
240
  self.cloud.onPull = setCloudData;
241
241
 
242
242
  /******************************************************************************/
243
243
 
244
+ self.wikilink = 'https://github.com/gorhill/uBlock/wiki/Dashboard:-Trusted-sites';
245
+
244
246
  self.hasUnsavedData = function() {
245
247
  return getEditorText().trim() !== cachedWhitelist;
246
248
  };
@@ -13,8 +13,6 @@
13
13
 
14
14
  /*! Home: https://github.com/gorhill/publicsuffixlist.js -- GPLv3 APLv2 */
15
15
 
16
- /* globals WebAssembly, exports:true, module */
17
-
18
16
  'use strict';
19
17
 
20
18
  /*******************************************************************************
@@ -70,7 +68,7 @@ const RULES_PTR_SLOT = 100; // 100 / 400 (400-256=144 => 144>128)
70
68
  const SUFFIX_NOT_FOUND_SLOT = 399; // -- / 399 (safe, see above)
71
69
  const CHARDATA_PTR_SLOT = 101; // 101 / 404
72
70
  const EMPTY_STRING = '';
73
- const SELFIE_MAGIC = 2;
71
+ const SELFIE_MAGIC = 3;
74
72
 
75
73
  let wasmMemory;
76
74
  let pslBuffer32;
@@ -499,9 +497,7 @@ const toSelfie = function(encoder) {
499
497
  }
500
498
  return {
501
499
  magic: SELFIE_MAGIC,
502
- buf32: Array.from(
503
- new Uint32Array(pslBuffer8.buffer, 0, pslByteLength >>> 2)
504
- ),
500
+ buf32: pslBuffer32.subarray(0, pslByteLength >> 2),
505
501
  };
506
502
  };
507
503
 
@@ -524,7 +520,7 @@ const fromSelfie = function(selfie, decoder) {
524
520
  } else if (
525
521
  selfie instanceof Object &&
526
522
  selfie.magic === SELFIE_MAGIC &&
527
- Array.isArray(selfie.buf32)
523
+ selfie.buf32 instanceof Uint32Array
528
524
  ) {
529
525
  byteLength = selfie.buf32.length << 2;
530
526
  allocateBuffers(byteLength);
@@ -97,6 +97,7 @@
97
97
  "page": "dashboard.html"
98
98
  },
99
99
  "permissions": [
100
+ "alarms",
100
101
  "contextMenus",
101
102
  "privacy",
102
103
  "storage",
@@ -111,7 +112,7 @@
111
112
  "storage": {
112
113
  "managed_schema": "managed_storage.json"
113
114
  },
114
- "version": "1.56.0",
115
+ "version": "1.57.2",
115
116
  "web_accessible_resources": [
116
117
  "/web_accessible_resources/*"
117
118
  ]
@@ -15,7 +15,8 @@
15
15
  </head>
16
16
 
17
17
  <body>
18
- <aside>
18
+ <aside style="right: 2px; bottom: 2px;">
19
+ <div id="windowbar"><div id="minimize"><svg viewBox="0 0 64 64"><path d="M 16,48 H 48" /><rect x="16" y="16" height="32" width="32" /></div><div id="move"></div><div id="quit" data-i18n-title="pickerQuit"><svg viewBox="0 0 64 64"><path d="M16 16L48 48M16 48L48 16" /></div></div>
19
20
  <section>
20
21
  <div>
21
22
  <div class="codeMirrorContainer codeMirrorBreakAll cm-theme-override"></div>
@@ -35,14 +36,10 @@
35
36
  </div>
36
37
  <div id="toolbar">
37
38
  <div>
38
- <button id="preview" type="button" data-i18n="pickerPreview">_<span class="hover"></span></button>
39
- </div>
40
- <div id="move"></div>
41
- <div>
42
- <button id="create" type="button" class="preferred" disabled data-i18n="pickerCreate">_<span class="hover"></span></button>
43
39
  <button id="pick" type="button" data-i18n="pickerPick">_<span class="hover"></span></button>
44
- <button id="quit" type="button" data-i18n="pickerQuit">_<span class="hover"></span></button>
40
+ <button id="preview" type="button" data-i18n="pickerPreview">_<span class="hover"></span></button>
45
41
  </div>
42
+ <button id="create" type="button" class="preferred" disabled data-i18n="pickerCreate">_<span class="hover"></span></button>
46
43
  </div>
47
44
  </section>
48
45
  <ul id="candidateFilters">
@@ -56,7 +53,7 @@
56
53
  </li>
57
54
  </ul>
58
55
  </aside>
59
- <svg><path d></path><path d></path></svg>
56
+ <svg id="sea"><path d></path><path d></path></svg>
60
57
 
61
58
  <script src="../lib/codemirror/lib/codemirror.js"></script>
62
59
  <script src="../lib/codemirror/addon/edit/closebrackets.js"></script>
@@ -21,16 +21,15 @@
21
21
 
22
22
  <div class="body">
23
23
  <div id="cloudWidget" class="hide" data-cloud-entry="whitelistPane"></div>
24
-
25
- <p class="vverbose"><span data-i18n="whitelistPrompt"></span> <a class="fa-icon info important" href="https://github.com/gorhill/uBlock/wiki/Dashboard:-Trusted-sites">info-circle</a>
26
- </p>
27
24
  <p>
28
25
  <button id="whitelistApply" class="preferred iconified" type="button" disabled><span class="fa-icon">check</span><span data-i18n="whitelistApply">_</span><span class="hover"></span></button>
29
26
  <button id="whitelistRevert" class="iconified" type="button" disabled><span class="fa-icon">undo</span><span data-i18n="genericRevert">_</span><span class="hover"></span></button>
30
- &emsp;&emsp;
27
+ &emsp;
31
28
  <button id="importWhitelistFromFile" class="iconified" type="button"><span class="fa-icon">download-alt</span><span data-i18n="whitelistImport">_</span><span class="hover"></span></button>
32
29
  <button id="exportWhitelistToFile" class="iconified" type="button"><span class="fa-icon">upload-alt</span><span data-i18n="whitelistExport">_</span><span class="hover"></span></button>
33
30
  </p>
31
+ <p class="vverbose" data-i18n="whitelistPrompt">
32
+ </p>
34
33
  </div>
35
34
  <div id="whitelist" class="codeMirrorContainer cm-theme-override"></div>
36
35
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browserless.io/browserless",
3
- "version": "2.5.0",
3
+ "version": "2.6.1-beta-1",
4
4
  "license": "SSPL",
5
5
  "description": "The browserless platform",
6
6
  "author": "browserless.io",
@@ -52,29 +52,29 @@
52
52
  "del": "^7.0.0",
53
53
  "enjoi": "^9.0.1",
54
54
  "file-type": "^19.0.0",
55
- "get-port": "^7.0.0",
55
+ "get-port": "^7.1.0",
56
56
  "gradient-string": "^2.0.0",
57
57
  "http-proxy": "^1.18.1",
58
58
  "lighthouse": "^11.1.0",
59
59
  "micromatch": "^4.0.4",
60
- "playwright-core": "1.42.1",
61
- "puppeteer-core": "^22.4.1",
60
+ "playwright-core": "1.43.0",
61
+ "puppeteer-core": "^22.6.3",
62
62
  "puppeteer-extra": "^3.3.6",
63
63
  "puppeteer-extra-plugin-stealth": "^2.11.2",
64
64
  "queue": "^7.0.0",
65
- "systeminformation": "^5.22.2"
65
+ "systeminformation": "^5.22.7"
66
66
  },
67
67
  "optionalDependencies": {
68
- "@types/chai": "^4.3.12",
68
+ "@types/chai": "^4.3.14",
69
69
  "@types/debug": "^4.1.12",
70
- "@types/gradient-string": "^1.1.5",
70
+ "@types/gradient-string": "^1.1.6",
71
71
  "@types/http-proxy": "^1.17.14",
72
72
  "@types/micromatch": "^4.0.6",
73
73
  "@types/mocha": "^10.0.6",
74
- "@types/node": "^20.11.27",
74
+ "@types/node": "^20.12.6",
75
75
  "@types/sinon": "^17.0.3",
76
- "@typescript-eslint/eslint-plugin": "^7.2.0",
77
- "@typescript-eslint/parser": "^7.2.0",
76
+ "@typescript-eslint/eslint-plugin": "^7.6.0",
77
+ "@typescript-eslint/parser": "^7.6.0",
78
78
  "assert": "^2.0.0",
79
79
  "chai": "^5.1.0",
80
80
  "cross-env": "^7.0.3",
@@ -85,12 +85,12 @@
85
85
  "eslint-plugin-typescript-sort-keys": "^3.2.0",
86
86
  "extract-zip": "^2.0.1",
87
87
  "marked": "^12.0.1",
88
- "mocha": "^10.3.0",
88
+ "mocha": "^10.4.0",
89
89
  "move-file": "^3.1.0",
90
90
  "prettier": "^3.2.5",
91
91
  "sinon": "^17.0.1",
92
92
  "ts-node": "^10.9.2",
93
- "typescript": "^5.4.2",
93
+ "typescript": "^5.4.4",
94
94
  "typescript-json-schema": "^0.63.0"
95
95
  },
96
96
  "eslintConfig": {