Script may be loaded twice if deferred
Hey, this is a bit of a weird one.
The problem is that JavaScript files may be included more than once when deferred and a stylesheet is loaded. I have written a minimal example for reproduction of the behaviour on my machine below. I'm using Firefox 80.0.1 on a 64-bit Ubuntu machine with NoScript 11.0.44 and Firefox Multi-Account Containers 7.0.2.
I was able to narrow the problem down to interaction between NoScript and Firefox Multi-Account Containers. Aside from not occurring deterministically, the problem also only occurred when:
- at least one stylesheet was included
- the
scripttag has thedeferattribute - the HTML file was visited via the
fileprotocol (no problems when opened via a local webserver)
For potential reproduction, create the three files described below and visit the HTML file via file://, refreshing until a SyntaxError: redeclaration of let NSTest occurs:
- An HTML file with arbitrary name:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>NoScript Test</title>
<link href="nstest.css" rel="stylesheet">
<script src="nstest.js" defer></script>
</head>
<body>
</body>
</html>
- An empty CSS file named "nstest.css".
- A JavaScript file named "nstest.js":
class NSTest {
static init() {
console.log("NSTest.init()");
}
}
NSTest.init();
I have not opened an issue in the Multi-Account Containers repository.