|
@@ -0,0 +1,123 @@
|
|
|
+# HG changeset patch
|
|
|
+# User Tim Taubert <ttaubert@mozilla.com>
|
|
|
+# Date 1512047188 -3600
|
|
|
+# Node ID fc91ce7557173426c0f705133411300c57bc4307
|
|
|
+# Parent c081853a30c7b333e1cfde7e3be9faa93dce5b0b
|
|
|
+Bug 1333140 - Remove WEBCRYPTO_METHOD_SECURE histogram r=keeler
|
|
|
+
|
|
|
+diff --git a/dom/base/SubtleCrypto.cpp b/dom/base/SubtleCrypto.cpp
|
|
|
+--- a/dom/base/SubtleCrypto.cpp
|
|
|
++++ b/dom/base/SubtleCrypto.cpp
|
|
|
+@@ -4,62 +4,47 @@
|
|
|
+ * 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 "mozilla/dom/SubtleCrypto.h"
|
|
|
+
|
|
|
+ #include "mozilla/dom/Promise.h"
|
|
|
+ #include "mozilla/dom/SubtleCryptoBinding.h"
|
|
|
+ #include "mozilla/dom/WebCryptoTask.h"
|
|
|
+-#include "mozilla/Telemetry.h"
|
|
|
+
|
|
|
+ namespace mozilla {
|
|
|
+ namespace dom {
|
|
|
+
|
|
|
+ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(SubtleCrypto, mParent)
|
|
|
+ NS_IMPL_CYCLE_COLLECTING_ADDREF(SubtleCrypto)
|
|
|
+ NS_IMPL_CYCLE_COLLECTING_RELEASE(SubtleCrypto)
|
|
|
+ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SubtleCrypto)
|
|
|
+ NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
|
|
+ NS_INTERFACE_MAP_ENTRY(nsISupports)
|
|
|
+ NS_INTERFACE_MAP_END
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ SubtleCrypto::SubtleCrypto(nsIGlobalObject* aParent)
|
|
|
+ : mParent(aParent)
|
|
|
+- , mRecordedTelemetry(false)
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+ JSObject*
|
|
|
+ SubtleCrypto::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
|
|
+ {
|
|
|
+ return SubtleCryptoBinding::Wrap(aCx, this, aGivenProto);
|
|
|
+ }
|
|
|
+
|
|
|
+-void
|
|
|
+-SubtleCrypto::RecordTelemetryOnce() {
|
|
|
+- if (mRecordedTelemetry) {
|
|
|
+- return;
|
|
|
+- }
|
|
|
+-
|
|
|
+- mRecordedTelemetry = true;
|
|
|
+- JSObject* global = mParent->GetGlobalJSObject();
|
|
|
+- bool isSecure = JS_GetIsSecureContext(js::GetObjectCompartment(global));
|
|
|
+- Telemetry::Accumulate(Telemetry::WEBCRYPTO_METHOD_SECURE, isSecure);
|
|
|
+-}
|
|
|
+-
|
|
|
+ #define SUBTLECRYPTO_METHOD_BODY(Operation, aRv, ...) \
|
|
|
+ MOZ_ASSERT(mParent); \
|
|
|
+ RefPtr<Promise> p = Promise::Create(mParent, aRv); \
|
|
|
+ if (aRv.Failed()) { \
|
|
|
+ return nullptr; \
|
|
|
+ } \
|
|
|
+- RecordTelemetryOnce(); \
|
|
|
+ RefPtr<WebCryptoTask> task = \
|
|
|
+ WebCryptoTask::Create ## Operation ## Task(__VA_ARGS__); \
|
|
|
+ if (!task) { \
|
|
|
+ aRv.Throw(NS_ERROR_OUT_OF_MEMORY); \
|
|
|
+ return nullptr; \
|
|
|
+ } \
|
|
|
+ task->DispatchWithPromise(p); \
|
|
|
+ return p.forget();
|
|
|
+diff --git a/dom/base/SubtleCrypto.h b/dom/base/SubtleCrypto.h
|
|
|
+--- a/dom/base/SubtleCrypto.h
|
|
|
++++ b/dom/base/SubtleCrypto.h
|
|
|
+@@ -114,18 +114,15 @@ public:
|
|
|
+ CryptoKey& unwrappingKey,
|
|
|
+ const ObjectOrString& unwrapAlgorithm,
|
|
|
+ const ObjectOrString& unwrappedKeyAlgorithm,
|
|
|
+ bool extractable,
|
|
|
+ const Sequence<nsString>& keyUsages,
|
|
|
+ ErrorResult& aRv);
|
|
|
+
|
|
|
+ private:
|
|
|
+- void RecordTelemetryOnce();
|
|
|
+-
|
|
|
+ nsCOMPtr<nsIGlobalObject> mParent;
|
|
|
+- bool mRecordedTelemetry;
|
|
|
+ };
|
|
|
+
|
|
|
+ } // namespace dom
|
|
|
+ } // namespace mozilla
|
|
|
+
|
|
|
+ #endif // mozilla_dom_SubtleCrypto_h
|
|
|
+diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json
|
|
|
+--- a/toolkit/components/telemetry/Histograms.json
|
|
|
++++ b/toolkit/components/telemetry/Histograms.json
|
|
|
+@@ -7729,24 +7729,16 @@
|
|
|
+ },
|
|
|
+ "WEBCRYPTO_METHOD": {
|
|
|
+ "record_in_processes": ["main", "content"],
|
|
|
+ "expires_in_version": "never",
|
|
|
+ "kind": "enumerated",
|
|
|
+ "n_values": 20,
|
|
|
+ "description": "Methods invoked under window.crypto.subtle (0=encrypt, 1=decrypt, 2=sign, 3=verify, 4=digest, 5=generateKey, 6=deriveKey, 7=deriveBits, 8=importKey, 9=exportKey, 10=wrapKey, 11=unwrapKey)"
|
|
|
+ },
|
|
|
+- "WEBCRYPTO_METHOD_SECURE": {
|
|
|
+- "alert_emails": ["seceng-telemetry@mozilla.com"],
|
|
|
+- "record_in_processes": ["main", "content"],
|
|
|
+- "expires_in_version": "60",
|
|
|
+- "kind": "boolean",
|
|
|
+- "bug_numbers": [1333140],
|
|
|
+- "description": "Whether a method invoked under window.crypto.subtle is in a secure context"
|
|
|
+- },
|
|
|
+ "WEBCRYPTO_ALG": {
|
|
|
+ "record_in_processes": ["main", "content"],
|
|
|
+ "expires_in_version": "never",
|
|
|
+ "kind": "enumerated",
|
|
|
+ "n_values": 30,
|
|
|
+ "description": "Algorithms used with WebCrypto (see table in WebCryptoTask.cpp)"
|
|
|
+ },
|
|
|
+ "MASTER_PASSWORD_ENABLED": {
|