Changes between Version 3 and Version 6 of Ticket #7338


Ignore:
Timestamp:
03/26/2019 01:15:37 PM (17 months ago)
Author:
kzar
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #7338

    • Property Blocked By changed from to 7371, 7381
  • Ticket #7338 – Description

    v3 v6  
    55Some APIs we use still exist for Service Workers, but not under the `window` Object. Alter references to those, to not include `window`. Specifically `window.Notification`, `window.clearInterval`, `window.navigator`, `window.setInterval` and `window.setTimeout`. 
    66 
    7 Some APIs we use won't be accessible under Service Workers, remove/replace use of those. Specifically: `DOMParser`, `Image`, `XMLHttpRequest`, `document.addEventListener`, `document.createElement`, `document.documentElement.appendChild`, `document.documentElement.removeChild`, `document.querySelector`, `document.readyState`, `document.removeEventListener` and `window.confirm`. 
     7Some APIs we use won't be accessible under Service Workers, remove/replace use of those. Specifically:  
    88 
     9- In `lib/icon.js` we use `Image` to load the icon images, then `document.createElement` to create a `canvas` with their contents as an optimisation (#7253). No plan so far. 
     10- In `lib/subscriptionInit.js` we use `DOMParser` to parse `subscriptions.xml`. We plan to switch to JSON with #7371. 
     11- In `lib/compat.js` we configure `XMLHttpRequest`, for later use in the core code. We plan to switch to the `fetch` API in the core code with #7381, then we won't need to configure `XMLHttpRequest` any more. 
     12- In `lib/utils.js` we use `document.addEventListener`, `document.removeEventListener` and `document.readyState` in order to provide `Utils.runAsync` which is used by the core code. Once we stop using `runAsync` with #FIXME, we can remove this code. 
     13- In `lib/filterValidation.js` we use `document.createElement`, `document.documentElement.appendChild`, `document.documentElement.removeChild` and `document.querySelector` to create a `style` element which we use to test if a given CSS selector is valid. No plan so far. 
     14- In `lib/notificationHelper.js` we use `window.confirm` as a fall back for question notifications, where the `Notification` API is faulty/unavailable. No plan so far. 
     15 
     16=== Notes === 
    917To confirm which APIs might not exist in Service Workers you can change the ESLint environment from `browser` to `serviceworker` for our scripts which run in the background page. But note, I found false positives were flagged, specifically: `URL`, `console.error`, `console.trace`, `fetch` and `indexedDB`.