Fixed potentially infinite loop in SyncMessage Firefox implementation.

This commit is contained in:
hackademix 2020-08-03 19:59:00 +02:00
parent 546277aaff
commit 51c9ac2c83
1 changed files with 10 additions and 2 deletions

View File

@ -240,10 +240,18 @@
};
let onBeforeScript = e => {
while(typeof canScript() === "undefined") {
if(typeof canScript() === "undefined") {
suspend();
}
if (!canScript()) {
let allowed = canScript();
if (typeof allowed === "undefined") {
let script = e.target.cloneNode(true);
e.target.replaceWith(script);
console.debug("sendSyncMessage deferring", script);
e.preventDefault();
return;
}
if (!allowed) {
console.debug("sendSyncMessage blocked a script element", e.target);
e.preventDefault();
}