Improved console reporting.
This commit is contained in:
parent
958bfba66c
commit
242a3a1717
|
@ -79,7 +79,7 @@
|
||||||
try {
|
try {
|
||||||
if ((result = l(JSON.parse(msg), sender)) !== undefined) break;
|
if ((result = l(JSON.parse(msg), sender)) !== undefined) break;
|
||||||
} catch (e) {
|
} 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);
|
return result instanceof Promise ? (async () => ret(await result)) : ret(result);
|
||||||
|
@ -132,17 +132,17 @@
|
||||||
// with "privileged" XHR
|
// with "privileged" XHR
|
||||||
browser.runtime.sendMessage({___syncMessageId: msgId});
|
browser.runtime.sendMessage({___syncMessageId: msgId});
|
||||||
}
|
}
|
||||||
// adding the payload
|
// then we send the payload using a privileged XHR, which is not subject
|
||||||
url += `&msg=${encodeURIComponent(JSON.stringify(msg))}`;
|
// 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 {
|
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.open("GET", url, false);
|
||||||
r.send(null);
|
r.send(null);
|
||||||
return JSON.parse(r.responseText);
|
return JSON.parse(r.responseText);
|
||||||
} catch(e) {
|
} 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;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue