mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 21:18:35 +00:00
Bug 964061 - Part 1: Convert CRMFObject to WebIDL bindings; r=bzbarsky
--HG-- extra : rebase_source : 39a2b35df50cdd42624fb0e7a14383e8d40cea4b
This commit is contained in:
parent
398927ec10
commit
1b7fdc23c8
@ -150,7 +150,7 @@ Crypto::GetVersion(nsString& aVersion)
|
||||
{
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMCRMFObject>
|
||||
already_AddRefed<mozilla::dom::CRMFObject>
|
||||
Crypto::GenerateCRMFRequest(JSContext* aContext,
|
||||
const nsCString& aReqDN,
|
||||
const nsCString& aRegToken,
|
||||
|
@ -8,7 +8,11 @@
|
||||
#include "nsIDOMCrypto.h"
|
||||
#else
|
||||
#include "nsIDOMCryptoLegacy.h"
|
||||
class nsIDOMCRMFObject;
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class CRMFObject;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "nsPIDOMWindow.h"
|
||||
@ -46,7 +50,7 @@ public:
|
||||
|
||||
virtual void GetVersion(nsString& aVersion);
|
||||
|
||||
virtual already_AddRefed<nsIDOMCRMFObject>
|
||||
virtual already_AddRefed<mozilla::dom::CRMFObject>
|
||||
GenerateCRMFRequest(JSContext* aContext,
|
||||
const nsCString& aReqDN,
|
||||
const nsCString& aRegToken,
|
||||
|
@ -110,9 +110,6 @@
|
||||
#include "nsIDOMCSSStyleRule.h"
|
||||
#include "nsIDOMCSSStyleSheet.h"
|
||||
#include "nsIDOMXULCommandDispatcher.h"
|
||||
#ifndef MOZ_DISABLE_CRYPTOLEGACY
|
||||
#include "nsIDOMCRMFObject.h"
|
||||
#endif
|
||||
#include "nsIControllers.h"
|
||||
#include "nsIBoxObject.h"
|
||||
#ifdef MOZ_XUL
|
||||
@ -228,10 +225,6 @@ static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
|
||||
const uint32_t kDOMClassInfo_##_dom_class##_interfaces = \
|
||||
0;
|
||||
|
||||
#ifndef MOZ_DISABLE_CRYPTOLEGACY
|
||||
DOMCI_DATA_NO_CLASS(CRMFObject)
|
||||
#endif
|
||||
|
||||
DOMCI_DATA_NO_CLASS(ContentFrameMessageManager)
|
||||
DOMCI_DATA_NO_CLASS(ChromeMessageBroadcaster)
|
||||
DOMCI_DATA_NO_CLASS(ChromeMessageSender)
|
||||
@ -354,12 +347,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
DEFAULT_SCRIPTABLE_FLAGS)
|
||||
#endif
|
||||
|
||||
// Crypto classes
|
||||
#ifndef MOZ_DISABLE_CRYPTOLEGACY
|
||||
NS_DEFINE_CLASSINFO_DATA(CRMFObject, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
#endif
|
||||
|
||||
// DOM Chrome Window class.
|
||||
NS_DEFINE_CHROME_XBL_CLASSINFO_DATA(ChromeWindow, nsWindowSH,
|
||||
DEFAULT_SCRIPTABLE_FLAGS |
|
||||
@ -1016,12 +1003,6 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_END
|
||||
#endif
|
||||
|
||||
#ifndef MOZ_DISABLE_CRYPTOLEGACY
|
||||
DOM_CLASSINFO_MAP_BEGIN(CRMFObject, nsIDOMCRMFObject)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCRMFObject)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
#endif
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ChromeWindow, nsIDOMWindow)
|
||||
DOM_CLASSINFO_WINDOW_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMChromeWindow)
|
||||
|
@ -30,11 +30,6 @@ DOMCI_CLASS(TreeSelection)
|
||||
DOMCI_CLASS(TreeContentView)
|
||||
#endif
|
||||
|
||||
// Crypto classes
|
||||
#ifndef MOZ_DISABLE_CRYPTOLEGACY
|
||||
DOMCI_CLASS(CRMFObject)
|
||||
#endif
|
||||
|
||||
// DOM Chrome Window class, almost identical to Window
|
||||
DOMCI_CLASS(ChromeWindow)
|
||||
|
||||
|
@ -251,6 +251,11 @@ DOMInterfaces = {
|
||||
'headerFile': 'nsGeoPosition.h'
|
||||
},
|
||||
|
||||
'CRMFObject': {
|
||||
'headerFile': 'nsCrypto.h',
|
||||
'wrapperCache': False,
|
||||
},
|
||||
|
||||
'Crypto' : {
|
||||
'implicitJSContext': [ 'generateCRMFRequest', 'signText' ],
|
||||
'headerFile': 'Crypto.h'
|
||||
|
@ -210,8 +210,6 @@ var interfaceNamesInGlobalScope =
|
||||
"Controllers",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"ConvolverNode",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "CRMFObject", desktop: true},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"Crypto",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
|
10
dom/webidl/CRMFObject.webidl
Normal file
10
dom/webidl/CRMFObject.webidl
Normal file
@ -0,0 +1,10 @@
|
||||
/* -*- 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/.
|
||||
*/
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface CRMFObject {
|
||||
readonly attribute DOMString request;
|
||||
};
|
@ -19,8 +19,6 @@ interface Crypto {
|
||||
};
|
||||
|
||||
#ifndef MOZ_DISABLE_CRYPTOLEGACY
|
||||
interface CRMFObject;
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface CryptoLegacy {
|
||||
readonly attribute DOMString version;
|
||||
@ -28,13 +26,13 @@ interface CryptoLegacy {
|
||||
[SetterThrows]
|
||||
attribute boolean enableSmartCardEvents;
|
||||
|
||||
[Throws]
|
||||
CRMFObject generateCRMFRequest(ByteString? reqDN,
|
||||
ByteString? regToken,
|
||||
ByteString? authenticator,
|
||||
ByteString? eaCert,
|
||||
ByteString? jsCallback,
|
||||
any... args);
|
||||
[Throws,NewObject]
|
||||
CRMFObject? generateCRMFRequest(ByteString? reqDN,
|
||||
ByteString? regToken,
|
||||
ByteString? authenticator,
|
||||
ByteString? eaCert,
|
||||
ByteString? jsCallback,
|
||||
any... args);
|
||||
|
||||
[Throws]
|
||||
DOMString importUserCertificates(DOMString nickname,
|
||||
|
@ -552,6 +552,11 @@ if CONFIG['MOZ_B2G_FM']:
|
||||
'FMRadio.webidl',
|
||||
]
|
||||
|
||||
if not CONFIG['MOZ_DISABLE_CRYPTOLEGACY']:
|
||||
WEBIDL_FILES += [
|
||||
'CRMFObject.webidl',
|
||||
]
|
||||
|
||||
GENERATED_EVENTS_WEBIDL_FILES = [
|
||||
'BlobEvent.webidl',
|
||||
'CallGroupErrorEvent.webidl',
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
EXPORTS += [
|
||||
'CryptoTask.h',
|
||||
'nsCrypto.h',
|
||||
'nsNSSShutDown.h',
|
||||
'nsRandomGenerator.h',
|
||||
'ScopedNSSTypes.h',
|
||||
|
@ -79,6 +79,9 @@
|
||||
#include <algorithm>
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
#endif
|
||||
#ifndef MOZ_DISABLE_CRYPTOLEGACY
|
||||
#include "mozilla/dom/CRMFObjectBinding.h"
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
@ -214,15 +217,14 @@ NS_INTERFACE_MAP_END_INHERITING(mozilla::dom::Crypto)
|
||||
NS_IMPL_ADDREF_INHERITED(nsCrypto, mozilla::dom::Crypto)
|
||||
NS_IMPL_RELEASE_INHERITED(nsCrypto, mozilla::dom::Crypto)
|
||||
|
||||
// QueryInterface implementation for nsCRMFObject
|
||||
NS_INTERFACE_MAP_BEGIN(nsCRMFObject)
|
||||
// QueryInterface implementation for CRMFObject
|
||||
NS_INTERFACE_MAP_BEGIN(CRMFObject)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCRMFObject)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CRMFObject)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_ADDREF(nsCRMFObject)
|
||||
NS_IMPL_RELEASE(nsCRMFObject)
|
||||
NS_IMPL_ADDREF(CRMFObject)
|
||||
NS_IMPL_RELEASE(CRMFObject)
|
||||
|
||||
// QueryInterface implementation for nsPkcs11
|
||||
#endif // MOZ_DISABLE_CRYPTOLEGACY
|
||||
@ -1858,7 +1860,7 @@ GetISupportsFromContext(JSContext *cx)
|
||||
|
||||
//The top level method which is a member of nsIDOMCrypto
|
||||
//for generate a base64 encoded CRMF request.
|
||||
already_AddRefed<nsIDOMCRMFObject>
|
||||
already_AddRefed<CRMFObject>
|
||||
nsCrypto::GenerateCRMFRequest(JSContext* aContext,
|
||||
const nsCString& aReqDN,
|
||||
const nsCString& aRegToken,
|
||||
@ -1869,7 +1871,6 @@ nsCrypto::GenerateCRMFRequest(JSContext* aContext,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsNSSShutDownPreventionLock locker;
|
||||
nsCOMPtr<nsIDOMCRMFObject> crmf;
|
||||
nsresult nrv;
|
||||
|
||||
uint32_t argc = aArgs.Length();
|
||||
@ -2029,9 +2030,8 @@ nsCrypto::GenerateCRMFRequest(JSContext* aContext,
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
nsCRMFObject *newObject = new nsCRMFObject();
|
||||
nsRefPtr<CRMFObject> newObject = new CRMFObject();
|
||||
newObject->SetCRMFRequest(encodedRequest);
|
||||
crmf = newObject;
|
||||
nsFreeKeyPairInfo(keyids, numRequests);
|
||||
|
||||
// Post an event on the UI queue so that the JS gets called after
|
||||
@ -2080,7 +2080,7 @@ nsCrypto::GenerateCRMFRequest(JSContext* aContext,
|
||||
delete cryptoRunnable;
|
||||
}
|
||||
|
||||
return crmf.forget();
|
||||
return newObject.forget();
|
||||
}
|
||||
|
||||
// Reminder that we inherit the memory passed into us here.
|
||||
@ -2855,29 +2855,29 @@ nsCrypto::DisableRightClick(ErrorResult& aRv)
|
||||
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
nsCRMFObject::nsCRMFObject()
|
||||
CRMFObject::CRMFObject()
|
||||
{
|
||||
}
|
||||
|
||||
nsCRMFObject::~nsCRMFObject()
|
||||
CRMFObject::~CRMFObject()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsCRMFObject::init()
|
||||
JSObject*
|
||||
CRMFObject::WrapObject(JSContext *aCx, JS::Handle<JSObject*> aScope)
|
||||
{
|
||||
return NS_OK;
|
||||
return CRMFObjectBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCRMFObject::GetRequest(nsAString& aRequest)
|
||||
CRMFObject::GetRequest(nsAString& aRequest)
|
||||
{
|
||||
aRequest.Assign(mBase64Request);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsCRMFObject::SetCRMFRequest(char *inRequest)
|
||||
CRMFObject::SetCRMFRequest(char *inRequest)
|
||||
{
|
||||
mBase64Request.AssignWithConversion(inRequest);
|
||||
return NS_OK;
|
||||
|
@ -24,23 +24,29 @@
|
||||
class nsIPSMComponent;
|
||||
class nsIDOMScriptObjectFactory;
|
||||
|
||||
class nsCRMFObject : public nsIDOMCRMFObject
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class CRMFObject : public nsIDOMCRMFObject
|
||||
{
|
||||
public:
|
||||
nsCRMFObject();
|
||||
virtual ~nsCRMFObject();
|
||||
CRMFObject();
|
||||
virtual ~CRMFObject();
|
||||
|
||||
NS_DECL_NSIDOMCRMFOBJECT
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsresult init();
|
||||
|
||||
nsresult SetCRMFRequest(char *inRequest);
|
||||
|
||||
JSObject* WrapObject(JSContext *aCx, JS::Handle<JSObject*> aScope);
|
||||
private:
|
||||
|
||||
nsString mBase64Request;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class nsCrypto: public mozilla::dom::Crypto
|
||||
{
|
||||
public:
|
||||
@ -59,7 +65,7 @@ public:
|
||||
|
||||
virtual void GetVersion(nsString& aVersion) MOZ_OVERRIDE;
|
||||
|
||||
virtual already_AddRefed<nsIDOMCRMFObject>
|
||||
virtual already_AddRefed<mozilla::dom::CRMFObject>
|
||||
GenerateCRMFRequest(JSContext* aContext,
|
||||
const nsCString& aReqDN,
|
||||
const nsCString& aRegToken,
|
||||
|
Loading…
x
Reference in New Issue
Block a user