summaryrefslogtreecommitdiff
path: root/test/test-sw.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-12-18 17:06:30 -0500
committerGitHub <noreply@github.com>2020-12-18 17:06:30 -0500
commit05d4049f16715194842cf8cdf62345478288ee71 (patch)
treebd64ad1829e8da9f08dc968abddb6f6f8cad6d41 /test/test-sw.js
parent9beb659b178ab922a4d11a821ed6d2f1bce40f96 (diff)
DOMParser replacement (#561)
* Add script to build library files * Add built parse5 library * Add new SimpleDOMParser which uses parse5 * Update license info * Update MV3 build to use the new SimpleDOMParser * Update file exclusions * Hide/clarify license info for MV2 builds
Diffstat (limited to 'test/test-sw.js')
-rw-r--r--test/test-sw.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test-sw.js b/test/test-sw.js
index a2cb9df4..fb8d2f50 100644
--- a/test/test-sw.js
+++ b/test/test-sw.js
@@ -36,6 +36,13 @@ function getAllHtmlScriptPaths(fileName) {
}
}
+function convertBackgroundScriptsToServiceWorkerScripts(scripts) {
+ // Use parse5-based SimpleDOMParser
+ scripts.splice(0, 0, '/mixed/lib/parse5.js');
+ const index = scripts.indexOf('/bg/js/native-simple-dom-parser.js');
+ assert.ok(index >= 0);
+ scripts[index] = '/bg/js/simple-dom-parser.js';
+}
function main() {
try {
@@ -45,6 +52,7 @@ function main() {
const extDir = path.join(rootDir, extDirName);
const scripts = getAllHtmlScriptPaths(path.join(extDir, 'bg', 'background.html'));
+ convertBackgroundScriptsToServiceWorkerScripts(scripts);
const importedScripts = [];
const importScripts = (...scripts2) => {