Bug 1436865 - Remove nsIDOMCrypto. r?bz
MozReview-Commit-ID: 4bQVSF94bbz
--- a/dom/base/Crypto.cpp
+++ b/dom/base/Crypto.cpp
@@ -17,39 +17,32 @@
using mozilla::dom::ContentChild;
namespace mozilla {
namespace dom {
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Crypto)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
- NS_INTERFACE_MAP_ENTRY(nsIDOMCrypto)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(Crypto)
NS_IMPL_CYCLE_COLLECTING_RELEASE(Crypto)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Crypto, mParent, mSubtle)
-Crypto::Crypto()
+Crypto::Crypto(nsIGlobalObject* aParent)
+ : mParent(aParent)
{
}
Crypto::~Crypto()
{
}
-void
-Crypto::Init(nsIGlobalObject* aParent)
-{
- mParent = do_QueryInterface(aParent);
- MOZ_ASSERT(mParent);
-}
-
/* virtual */ JSObject*
Crypto::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return CryptoBinding::Wrap(aCx, this, aGivenProto);
}
void
Crypto::GetRandomValues(JSContext* aCx, const ArrayBufferView& aArray,
--- a/dom/base/Crypto.h
+++ b/dom/base/Crypto.h
@@ -1,55 +1,48 @@
/* -*- 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/. */
#ifndef mozilla_dom_Crypto_h
#define mozilla_dom_Crypto_h
-#include "nsIDOMCrypto.h"
#include "mozilla/dom/SubtleCrypto.h"
#include "nsIGlobalObject.h"
#include "nsWrapperCache.h"
#include "mozilla/dom/TypedArray.h"
-#define NS_DOMCRYPTO_CID \
- {0x929d9320, 0x251e, 0x11d4, { 0x8a, 0x7c, 0x00, 0x60, 0x08, 0xc8, 0x44, 0xc3} }
namespace mozilla {
class ErrorResult;
namespace dom {
-class Crypto : public nsIDOMCrypto,
- public nsWrapperCache
+class Crypto final : public nsISupports,
+ public nsWrapperCache
{
protected:
virtual ~Crypto();
public:
- Crypto();
-
- NS_DECL_NSIDOMCRYPTO
+ explicit Crypto(nsIGlobalObject* aParent);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Crypto)
void
GetRandomValues(JSContext* aCx, const ArrayBufferView& aArray,
JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv);
SubtleCrypto*
Subtle();
- // WebIDL
-
nsIGlobalObject*
GetParentObject() const
{
return mParent;
}
virtual JSObject*
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
--- a/dom/base/nsGlobalWindowInner.cpp
+++ b/dom/base/nsGlobalWindowInner.cpp
@@ -3028,18 +3028,17 @@ nsGlobalWindowInner::GetApplicationCache
dummy.SuppressException();
return applicationCache.forget();
}
Crypto*
nsGlobalWindowInner::GetCrypto(ErrorResult& aError)
{
if (!mCrypto) {
- mCrypto = new Crypto();
- mCrypto->Init(this);
+ mCrypto = new Crypto(this);
}
return mCrypto;
}
mozilla::dom::U2F*
nsGlobalWindowInner::GetU2f(ErrorResult& aError)
{
if (!mU2F) {
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -1707,18 +1707,16 @@ addExternalIface('MozObserver', nativeTy
addExternalIface('MozRDFCompositeDataSource', nativeType='nsIRDFCompositeDataSource',
notflattened=True)
addExternalIface('MozRDFResource', nativeType='nsIRDFResource', notflattened=True)
addExternalIface('MozTreeView', nativeType='nsITreeView',
headerFile='nsITreeView.h', notflattened=True)
addExternalIface('MozWakeLockListener', headerFile='nsIDOMWakeLockListener.h')
addExternalIface('nsIBrowserDOMWindow', nativeType='nsIBrowserDOMWindow',
notflattened=True)
-addExternalIface('nsIDOMCrypto', nativeType='nsIDOMCrypto',
- headerFile='Crypto.h')
addExternalIface('nsIFile', nativeType='nsIFile', notflattened=True)
addExternalIface('nsILoadGroup', nativeType='nsILoadGroup',
headerFile='nsILoadGroup.h', notflattened=True)
addExternalIface('nsIMessageBroadcaster', nativeType='nsIMessageBroadcaster',
headerFile='nsIMessageManager.h', notflattened=True)
addExternalIface('nsIMessageSender', nativeType='nsIMessageSender',
headerFile='nsIMessageManager.h', notflattened=True)
addExternalIface('nsIPrintSettings', nativeType='nsIPrintSettings',
--- a/dom/interfaces/base/domstubs.idl
+++ b/dom/interfaces/base/domstubs.idl
@@ -50,11 +50,8 @@ interface nsIDOMEventTarget;
interface nsIDOMEventListener;
// HTML
interface nsIDOMHTMLFormElement;
interface nsIDOMHTMLHeadElement;
// Range
interface nsIDOMRange;
-
-// Crypto
-interface nsIDOMCrypto;
--- a/dom/interfaces/base/moz.build
+++ b/dom/interfaces/base/moz.build
@@ -14,17 +14,16 @@ XPIDL_SOURCES += [
'nsIContentPermissionPrompt.idl',
'nsIContentPrefService2.idl',
'nsIContentProcess.idl',
'nsIContentURIGrouper.idl',
'nsIDOMChromeWindow.idl',
'nsIDOMClientRect.idl',
'nsIDOMClientRectList.idl',
'nsIDOMConstructor.idl',
- 'nsIDOMCrypto.idl',
'nsIDOMGlobalPropertyInitializer.idl',
'nsIDOMHistory.idl',
'nsIDOMModalContentWindow.idl',
'nsIDOMScreen.idl',
'nsIDOMWindow.idl',
'nsIDOMWindowCollection.idl',
'nsIDOMWindowUtils.idl',
'nsIFocusManager.idl',
deleted file mode 100644
--- a/dom/interfaces/base/nsIDOMCrypto.idl
+++ /dev/null
@@ -1,14 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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 "nsISupports.idl"
-
-interface nsIGlobalObject;
-
-[uuid(48d7f7fd-bb85-4c04-9b8b-5cd9131acdef)]
-interface nsIDOMCrypto : nsISupports
-{
- [notxpcom] void init(in nsIGlobalObject parent);
-};
--- a/dom/webidl/Window.webidl
+++ b/dom/webidl/Window.webidl
@@ -18,17 +18,16 @@
* https://webaudio.github.io/web-audio-api/#widl-Window-audioWorklet
* https://drafts.css-houdini.org/css-paint-api-1/#dom-window-paintworklet
*/
interface ApplicationCache;
interface IID;
interface nsIBrowserDOMWindow;
interface nsIMessageBroadcaster;
-interface nsIDOMCrypto;
interface XULControllers;
// http://www.whatwg.org/specs/web-apps/current-work/
[PrimaryGlobal, LegacyUnenumerableNamedProperties, NeedResolve]
/*sealed*/ interface Window : EventTarget {
// the current browsing context
[Unforgeable, Constant, StoreInSlot,
CrossOriginReadable] readonly attribute Window window;
--- a/dom/workers/WorkerScope.cpp
+++ b/dom/workers/WorkerScope.cpp
@@ -155,18 +155,17 @@ WorkerGlobalScope::GetConsole(ErrorResul
}
Crypto*
WorkerGlobalScope::GetCrypto(ErrorResult& aError)
{
mWorkerPrivate->AssertIsOnWorkerThread();
if (!mCrypto) {
- mCrypto = new Crypto();
- mCrypto->Init(this);
+ mCrypto = new Crypto(this);
}
return mCrypto;
}
already_AddRefed<CacheStorage>
WorkerGlobalScope::GetCaches(ErrorResult& aRv)
{
--- a/js/xpconnect/src/Sandbox.cpp
+++ b/js/xpconnect/src/Sandbox.cpp
@@ -229,18 +229,17 @@ SandboxImport(JSContext* cx, unsigned ar
static bool
SandboxCreateCrypto(JSContext* cx, JS::HandleObject obj)
{
MOZ_ASSERT(JS_IsGlobalObject(obj));
nsIGlobalObject* native = xpc::NativeGlobal(obj);
MOZ_ASSERT(native);
- dom::Crypto* crypto = new dom::Crypto();
- crypto->Init(native);
+ dom::Crypto* crypto = new dom::Crypto(native);
JS::RootedObject wrapped(cx, crypto->WrapObject(cx, nullptr));
return JS_DefineProperty(cx, obj, "crypto", wrapped, JSPROP_ENUMERATE);
}
#ifdef MOZ_WEBRTC
static bool
SandboxCreateRTCIdentityProvider(JSContext* cx, JS::HandleObject obj)
{