author | Ryan VanderMeulen <ryanvm@gmail.com> |
Thu, 13 Aug 2015 14:46:28 -0400 | |
changeset 257616 | 4b35236fc76ea0459df47db884fec8c94b93ed7f |
parent 257615 | 10878e179e4c19f98030f78771d032173d7d1991 |
child 257627 | 2da2a86204a391252856ba8b29915a46e943da0c |
child 257711 | 5b2b7e9f2e56eea9df0d96350516d9f2701af89b |
push id | 29223 |
push user | kwierso@gmail.com |
push date | Thu, 13 Aug 2015 22:18:08 +0000 |
treeherder | mozilla-central@4b35236fc76e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 1188750 |
milestone | 43.0a1 |
backs out | 7bf71f3a4465c056791ef79ba73b85b14dccb1dc 6ec8b34e2bc62bf6b43d56212a0c95c83141b9e2 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
dom/crypto/CryptoKey.cpp | file | annotate | diff | comparison | revisions | |
dom/crypto/moz.build | file | annotate | diff | comparison | revisions | |
dom/crypto/test/file_indexedDB.html | file | annotate | diff | comparison | revisions | |
dom/crypto/test/mochitest.ini | file | annotate | diff | comparison | revisions | |
dom/crypto/test/test_indexedDB.html | file | annotate | diff | comparison | revisions |
--- a/dom/crypto/CryptoKey.cpp +++ b/dom/crypto/CryptoKey.cpp @@ -1,17 +1,16 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "pk11pub.h" #include "cryptohi.h" -#include "nsNSSComponent.h" #include "ScopedNSSTypes.h" #include "mozilla/dom/CryptoKey.h" #include "mozilla/dom/WebCryptoCommon.h" #include "mozilla/dom/SubtleCryptoBinding.h" #include "mozilla/dom/ToJSValue.h" // Templates taken from security/nss/lib/cryptohi/seckey.c // These would ideally be exported by NSS and until that @@ -1245,21 +1244,16 @@ CryptoKey::WriteStructuredClone(JSStruct bool CryptoKey::ReadStructuredClone(JSStructuredCloneReader* aReader) { nsNSSShutDownPreventionLock locker; if (isAlreadyShutDown()) { return false; } - // Ensure that NSS is initialized. - if (!EnsureNSSInitializedChromeOrContent()) { - return false; - } - uint32_t version; CryptoBuffer sym, priv, pub; bool read = JS_ReadUint32Pair(aReader, &mAttributes, &version) && (version == CRYPTOKEY_SC_VERSION) && ReadBuffer(aReader, sym) && ReadBuffer(aReader, priv) && ReadBuffer(aReader, pub) &&
--- a/dom/crypto/moz.build +++ b/dom/crypto/moz.build @@ -22,12 +22,11 @@ UNIFIED_SOURCES += [ FAIL_ON_WARNINGS = True include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'xul' LOCAL_INCLUDES += [ '/security/manager/ssl', - '/security/pkix/include', ] MOCHITEST_MANIFESTS += ['test/mochitest.ini']
deleted file mode 100644 --- a/dom/crypto/test/file_indexedDB.html +++ /dev/null @@ -1,82 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <title>Bug 1188750 - WebCrypto must ensure NSS is initialized before deserializing</title> -</head> -<body> - <script type="application/javascript;version=1.8"> - let db; - - function err(resolve) { - return e => resolve(e.target.error.message); - } - - function openDatabase() { - return new Promise((resolve, reject) => { - let request = indexedDB.open("keystore", 1); - - request.onerror = err(reject); - request.onsuccess = function (event) { - db = event.target.result; - resolve(); - }; - - request.onupgradeneeded = function(event) { - db = event.target.result; - let objectStore = db.createObjectStore("keys", {autoIncrement: true}); - objectStore.transaction.oncomplete = resolve; - }; - }); - } - - function storeKey(key) { - return new Promise((resolve, reject) => { - let transaction = db.transaction("keys", "readwrite"); - transaction.objectStore("keys").put(key, key.type); - - transaction.onabort = err(reject); - transaction.onerror = err(reject); - - transaction.oncomplete = function () { - resolve(key); - }; - }); - }; - - function retrieveKey() { - return new Promise((resolve, reject) => { - let transaction = db.transaction("keys", "readonly"); - let cursor = transaction.objectStore("keys").openCursor(); - - cursor.onerror = err(reject); - cursor.onabort = err(reject); - - cursor.onsuccess = function (event) { - try { - let result = event.target.result; - resolve(result && result.value); - } catch (e) { - reject(e.message); - } - }; - }); - } - - function generateKey() { - let algorithm = { - name: "RSASSA-PKCS1-v1_5", - hash: "SHA-256", - modulusLength: 1024, - publicExponent: new Uint8Array([0x01, 0x00, 0x01]) - }; - - return crypto.subtle.generateKey(algorithm, true, ["sign", "verify"]); - } - - openDatabase() - .then(retrieveKey).then(generateKey).then(storeKey) - .then(() => alert("ok")).catch(alert); - </script> -</body> -</html>
--- a/dom/crypto/test/mochitest.ini +++ b/dom/crypto/test/mochitest.ini @@ -1,19 +1,17 @@ [DEFAULT] # Bug 1010743 - Re-enable WebCrypto tests on b2g skip-if = (buildapp == 'b2g') support-files = - file_indexedDB.html test-array.js test-vectors.js test_WebCrypto.css util.js -[test_indexedDB.html] [test_WebCrypto.html] [test_WebCrypto_DH.html] [test_WebCrypto_ECDH.html] [test_WebCrypto_ECDSA.html] [test_WebCrypto_JWK.html] [test_WebCrypto_Normalize.html] [test_WebCrypto_PBKDF2.html] [test_WebCrypto_Reject_Generating_Keys_Without_Usages.html]
deleted file mode 100644 --- a/dom/crypto/test/test_indexedDB.html +++ /dev/null @@ -1,60 +0,0 @@ -<!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] - ]}, runTest); - }); - </script> -</body> -</html>