craig says i need more callbacks
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- This exists to load NaCl into context for the background script -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<!--
|
||||
Trying to figure out why TweetNaCl isn't loading
|
||||
|
||||
ok so the problem is not an invalid hash, it's something specific
|
||||
to nacl
|
||||
|
||||
to have an inline script, its hash must be specified in
|
||||
manifest.json
|
||||
|
||||
example (integrity key is not necessary, it is there purely for
|
||||
comment purposes)
|
||||
|
||||
beginning of line
|
||||
V
|
||||
| <script integrity="sha256-8T3dvQxHPNQvgxzCemw3KGUCM5RhknpCQF6pCcTdFTw=">console.log('bg-test-inline.js line 1!');
|
||||
|</script>
|
||||
|
||||
newline is there for hash purposes
|
||||
|
||||
this works if and only if
|
||||
'sha256-8T3dvQxHPNQvgxzCemw3KGUCM5RhknpCQF6pCcTdFTw=' is included
|
||||
in the manifest.json
|
||||
|
||||
example (top level key):
|
||||
|
||||
"content_security_policy" : "script-src 'self' 'sha256-8T3dvQxHPNQvgxzCemw3KGUCM5RhknpCQF6pCcTdFTw='; object-src 'self'",
|
||||
|
||||
Absent that explicit allow, I get this error from Firefox:
|
||||
|
||||
Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”).
|
||||
|
||||
Refs:
|
||||
1. https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/content_security_policy
|
||||
2. https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_Security_Policy#inline_javascript
|
||||
|
||||
If I include the same script as a file,
|
||||
|
||||
<script src="bg-test-inline.js"></script>
|
||||
|
||||
this works irrespective of if I specify it as allowable in the manifest
|
||||
|
||||
nacl is just refusing to load
|
||||
|
||||
Loading failed for the <script> with source “moz-extension://eafd6a74-b75b-4312-9a34-8087b68395e7/dist/jex_include/local-nacl-1.0.3/nacl.js”.
|
||||
|
||||
I initially thought it was a hash problem, but it is not
|
||||
|
||||
TweetNaCL doesn't work as an ES6 module, it works by destructively
|
||||
updating the window namespace. This I think was necessary before
|
||||
ES6, and that behavior is retained either because of laziness or
|
||||
because of backward compatibility reasons.
|
||||
|
||||
hmm
|
||||
|
||||
so this just plainly doesn't work and i cannot figure out why
|
||||
|
||||
<script src="dist/jex_include/local-nacl-1.0.3/nacl.js"></script>
|
||||
|
||||
oh my god
|
||||
|
||||
<script src="dist/jex_include/local-tweetnacl-1.0.3/dist/nacl.js"></script>
|
||||
|
||||
i got the url wrong
|
||||
|
||||
i hate myself
|
||||
|
||||
ok well glad we got that sorted out at least
|
||||
|
||||
And i discovered a future potential pitfall
|
||||
-->
|
||||
|
||||
<script src="../dist/jex_include/local-tweetnacl-1.0.3/dist/nacl.js"></script>
|
||||
|
||||
<!-- same but for blakejs
|
||||
<script src="./dist/jex_include/local-blakejs-1.2.1/dist/index.js"></script>
|
||||
-->
|
||||
|
||||
<!--
|
||||
this is a non-issue
|
||||
-->
|
||||
<script type="module" src="../dist/background.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Is this message good or bad?</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Is this message good or bad?</h1>
|
||||
|
||||
<pre id="message"></pre>
|
||||
|
||||
<br>
|
||||
<button id="good">Good</button>
|
||||
<br>
|
||||
<button id="bad">Bad</button>
|
||||
|
||||
<script type="module" src="./msg_confirm.js"></script>
|
||||
|
||||
<body>
|
||||
</html>
|
||||
@@ -0,0 +1,25 @@
|
||||
console.log('ur mom');
|
||||
var result = null;
|
||||
document.getElementById('good').onclick = () => { console.log('click good'); result = 'good' }
|
||||
document.getElementById('bad').onclick = () => { console.log('click bad'); result = 'bad' }
|
||||
|
||||
browser.runtime.onMessage.addListener((msg) => {
|
||||
console.error("ERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRROR");
|
||||
console.log('msg', msg);
|
||||
//document.getElementById("message").innerHTML = msg_str;
|
||||
|
||||
//const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
||||
|
||||
//while (true) {
|
||||
// if (result === 'good') {
|
||||
// console.log('good');
|
||||
// return true;
|
||||
// }
|
||||
// else if (result === 'bad') {
|
||||
// console.log('bad');
|
||||
// return false;
|
||||
// }
|
||||
// else
|
||||
// await sleep(100);
|
||||
//}
|
||||
});
|
||||
@@ -0,0 +1,74 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<style type="text/css">
|
||||
body {
|
||||
background: #d6efff;
|
||||
width: 400px;
|
||||
font-family: monospace, sans-serif;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<table width="100%" style="background: #dad1ff; border: 2px solid #6c5d96; border-radius: 5px;">
|
||||
<tr>
|
||||
<td><img src="../art/jrx-icon-48.png" style="width: 32px; height: 32px;"></td>
|
||||
<td style="font-size: 32px; text-align: center; font-weight: bold">
|
||||
JÆCK RUSSELL
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div style="margin-top: 5px; width: 95%; background: #d9ffd6; border: 1px solid #6c5d96; border-radius: 5px;">
|
||||
<table >
|
||||
<tr>
|
||||
<td><img src="../art/keypair.svg" style="width: 32px; height: 32px;"></td>
|
||||
<td style="justify-content: center; font-size: 28px; text-align: center; font-weight: bold">
|
||||
KEYPAIRS
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p id="no-keypairs">You have no keypairs yet. Either generate a new one or
|
||||
recover one you already have.</p>
|
||||
<ul id="keypairs"></ul>
|
||||
<!-- recover from faert phrase -->
|
||||
<form>
|
||||
<button id="generate-btn">Generate New Keypair</button>
|
||||
</form>
|
||||
<!-- recover from faert phrase -->
|
||||
<form>
|
||||
<label for="faert-input">FÆRT Phrase:</label>
|
||||
<input id="faert-input"></input>
|
||||
<button id="faert-btn">Recover Keypair from FÆRT Phrase</button>
|
||||
</form>
|
||||
<!-- recover from seed phrase
|
||||
<form>
|
||||
<label for="seed-input">Seed Phrase:</label>
|
||||
<input id="seed-input"></input>
|
||||
<button id="seed-btn">Recover Keypair from Seed Phrase</button>
|
||||
</form>
|
||||
-->
|
||||
</div>
|
||||
|
||||
<pre id="scratch"></pre>
|
||||
|
||||
<!--
|
||||
<div style="margin-top: 5px; width: 95%; background: #d9ffd6; border: 1px solid #6c5d96; border-radius: 5px;">
|
||||
<table>
|
||||
<tr>
|
||||
<td><img src="../art/keypair.svg" style="width: 32px; height: 32px;"></td>
|
||||
<td style="justify-content: center; font-size: 28px; text-align: center; font-weight: bold">
|
||||
KEYPAIRS
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
-->
|
||||
|
||||
|
||||
<script type="module" src="./dist/popup.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user