aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorhackademix <giorgio@maone.net>2018-10-02 22:21:50 +0200
committerhackademix <giorgio@maone.net>2018-10-02 23:00:22 +0200
commitc82d0a82f4246667e1ac1238be4121fcaffdde6a (patch)
treeae3abfee98187d242a5526795053b2f7d037ffdf /test
parent57a58a82609cc5130942676514b6e99b6f6f317f (diff)
Work around for documentUrl = tab.url = about:blank if tests are launched from XPI
Diffstat (limited to 'test')
-rw-r--r--test/spec/LibreJSSpec.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/spec/LibreJSSpec.js b/test/spec/LibreJSSpec.js
index b2ca40e..eba69b5 100644
--- a/test/spec/LibreJSSpec.js
+++ b/test/spec/LibreJSSpec.js
@@ -43,11 +43,12 @@ describe("LibreJS' components", () => {
let unknownLicensed = `// @license ${unknownLicense.id} ${unknownLicense.magnet}\n${nontrivial}\n// @license-end`;
let malformedLicensed = `// @license\n${nontrivial}`;
- let tab;
+ let tab, documentUrl;
beforeAll(async () => {
let url = browser.extension.getURL("/test/resources/index.html");
tab = (await browser.tabs.query({url}))[0] || (await browser.tabs.create({url}));
+ documentUrl = url;
});
describe("The external script source processor", () => {
@@ -56,7 +57,7 @@ describe("LibreJS' components", () => {
let processScript = async (source, whitelisted = false) =>
await LibreJS.handle_script({
text: source,
- request: {url, tabId: tab.id, documentUrl: tab.url, frameId: 0},
+ request: {url, tabId: tab.id, documentUrl, frameId: 0},
}, whitelisted);
it("should accept whitelisted scripts", async () => {
@@ -175,7 +176,6 @@ describe("LibreJS' components", () => {
let check;
beforeAll(async () => {
- let documentUrl = tab.url;
let args = {tabId: tab.id, frameId: 0, documentUrl};
let resolve = url => new URL(url, documentUrl).href;
check = async url => await ExternalLicenses.check(Object.assign({url: resolve(url)}, args));