зеркало из https://github.com/mozilla/gecko-dev.git
61 строка
1.9 KiB
HTML
61 строка
1.9 KiB
HTML
<!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">
|
|
/*
|
|
* 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(e) {
|
|
cb(frame, e.detail.message);
|
|
}, {once: true});
|
|
|
|
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((recFrame, recResult) => {
|
|
is(recResult, "ok", "retrieved keys successfully");
|
|
recFrame.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>
|