1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Bug 1188750 - WebCrypto must ensure NSS is initialized before deserializing</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"?>
</head>
<body>
<script type="application/javascript;version=1.8">
/*
* Bug 1188750 - The WebCrypto API must ensure that NSS was initialized
* for the current process before trying to deserialize objects like
* CryptoKeys from e.g. IndexedDB.
*/
"use strict";
const TEST_URI = "http://www.example.com/tests/" +
"dom/crypto/test/file_indexedDB.html";
SimpleTest.waitForExplicitFinish();
function createMozBrowserFrame(cb) {
let frame = document.createElement("iframe");
SpecialPowers.wrap(frame).mozbrowser = true;
frame.src = TEST_URI;
frame.addEventListener("mozbrowsershowmodalprompt", function onPrompt(e) {
frame.removeEventListener("mozbrowsershowmodalprompt", onPrompt);
cb(frame, e.detail.message);
});
document.body.appendChild(frame);
}
function runTest() {
// Load the test app once, to generate and store keys.
createMozBrowserFrame((frame, result) => {
is(result, "ok", "stored keys successfully");
frame.remove();
// Load the test app again to retrieve stored keys.
createMozBrowserFrame((frame, result) => {
is(result, "ok", "retrieved keys successfully");
frame.remove();
SimpleTest.finish();
});
});
}
addEventListener("load", function () {
SpecialPowers.addPermission("browser", true, document);
SpecialPowers.pushPrefEnv({set: [
["dom.ipc.browser_frames.oop_by_default", true],
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true]
]}, runTest);
});
</script>
</body>
</html>
|