summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorhackademix2019-10-01 22:48:33 +0200
committerhackademix2019-10-01 22:48:33 +0200
commit242a3a1717f4160f1c91989e80e434a0e67b233e (patch)
tree57f54326efb71be50f90049c7346cfa1a77d5e9a /src/lib
parent958bfba66c339d388487e7131402959c89db7553 (diff)
downloadnoscript-242a3a1717f4160f1c91989e80e434a0e67b233e.tar.gz
noscript-242a3a1717f4160f1c91989e80e434a0e67b233e.tar.xz
noscript-242a3a1717f4160f1c91989e80e434a0e67b233e.zip
Improved console reporting.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/SyncMessage.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/SyncMessage.js b/src/lib/SyncMessage.js
index 2f06d3e..a644507 100644
--- a/src/lib/SyncMessage.js
+++ b/src/lib/SyncMessage.js
@@ -79,7 +79,7 @@
try {
if ((result = l(JSON.parse(msg), sender)) !== undefined) break;
} catch (e) {
- console.error(e, "Processing message %o from %o", msg, sender);
+ console.error("%o processing message %o from %o", e, msg, sender);
}
}
return result instanceof Promise ? (async () => ret(await result)) : ret(result);
@@ -132,17 +132,17 @@
// with "privileged" XHR
browser.runtime.sendMessage({___syncMessageId: msgId});
}
- // adding the payload
- url += `&msg=${encodeURIComponent(JSON.stringify(msg))}`;
+ // then we send the payload using a privileged XHR, which is not subject
+ // to CORS but unfortunately doesn't carry any tab id except on Chromium
+
+ url += `&msg=${encodeURIComponent(JSON.stringify(msg))}`; // adding the payload
+ let r = new XMLHttpRequest();
try {
- // then we send the payload using a privileged XHR, which is not subject
- // to CORS but unfortunately doesn't carry any tab id except on Chromium
- let r = new XMLHttpRequest();
r.open("GET", url, false);
r.send(null);
return JSON.parse(r.responseText);
} catch(e) {
- console.error(`syncMessage error in ${document.URL}: ${e.message}`);
+ console.error(`syncMessage error in ${document.URL}: ${e.message} (response ${r.responseText})`);
}
return null;
};