"popup" JavaScript doesn't run

https://pastebin.com/raw/PZ28aWRg

That popup HTML works fine in a browser. However, when accessed via the browser’s tool-bar, it seems to do nothing. I.e. the text-field and button appear, but clicking the button doesn’t execute, as it does when the HTML file is viewed as a “standalone unit” in the browser. Why is this?

You can not have inline scripts: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Content_Security_Policy#Inline_JavaScript