aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--content/noscript.js20
-rw-r--r--html/display_panel/content/main_panel.js4
-rw-r--r--main_background.js4
-rw-r--r--test/spec/LibreJSSpec.js12
4 files changed, 29 insertions, 11 deletions
diff --git a/content/noscript.js b/content/noscript.js
index 9ea2f08..9cf1ac1 100644
--- a/content/noscript.js
+++ b/content/noscript.js
@@ -20,16 +20,20 @@
*/
"use strict";
{
- browser.runtime.onMessage.addListener(async m => {
+ const showNoScript = () => {
+ for (const noscript of document.querySelectorAll(
+ 'noscript:not([data-librejs-nodisplay])')) {
+ const replacement = document.createElement('span');
+ replacement.innerHTML = noscript.innerHTML;
+ noscript.replaceWith(replacement);
+ }
+ };
+
+ browser.runtime.onMessage.addListener(m => {
if (m.action === 'forceNoscript') {
try {
- debug("Received message", m);
- for (const noscript of document.querySelectorAll(
- 'noscript:not([data-librejs-nodisplay])')) {
- const replacement = document.createElement('span');
- replacement.innerHTML = noscript.innerHTML;
- noscript.replaceWith(replacement);
- }
+ console.log("Received message", m);
+ showNoScript();
} catch (e) {
console.error(e);
}
diff --git a/html/display_panel/content/main_panel.js b/html/display_panel/content/main_panel.js
index dc3ee2d..e2988d6 100644
--- a/html/display_panel/content/main_panel.js
+++ b/html/display_panel/content/main_panel.js
@@ -93,8 +93,8 @@ document.querySelector("#complain").onclick = _ => {
close();
}
-document.querySelector("#force-noscript").onclick = async _ => {
- await browser.tabs.sendMessage(currentReport.tabId, {
+document.querySelector("#force-noscript").onclick = _ => {
+ browser.tabs.sendMessage(currentReport.tabId, {
action: 'forceNoscript'
});
document.querySelector("#force-noscript").disabled = true;
diff --git a/main_background.js b/main_background.js
index 87b80ae..ab70d00 100644
--- a/main_background.js
+++ b/main_background.js
@@ -891,7 +891,9 @@ async function initAddon() {
editHtml,
handleScript,
ExternalLicenses,
- ListManager, ListStore, Storage,
+ ListManager,
+ ListStore,
+ Storage
};
// create or focus the autotest tab if it's a debugging session
if ((await browser.management.getSelf()).installType === 'development') {
diff --git a/test/spec/LibreJSSpec.js b/test/spec/LibreJSSpec.js
index 7828bcb..70ec339 100644
--- a/test/spec/LibreJSSpec.js
+++ b/test/spec/LibreJSSpec.js
@@ -257,6 +257,18 @@ describe('LibreJS\' components', () => {
});
});
+ describe('FIXME: dummy test to get noscript.js displayed in the console debugger', () => {
+ beforeAll(async () => {
+ await browser.tabs.executeScript(tab.id, {
+ file: '/content/noscript.js'
+ });
+ });
+
+ it('IGNORE ME', () => {
+ expect(1).toBe(1);
+ });
+ });
+
describe('The external (Web Labels) license checker', () => {
let { ExternalLicenses } = LibreJS;
let check;