Bug 326628 try #2 - remove window.pkcs11 and fix the device manager not to use that API, r=kaie
authorBenjamin Smedberg <benjamin@smedbergs.us>
Thu, 28 May 2009 19:36:21 -0700
changeset 28823 4414591c887fa7483b078a94ea1c9204035927b7
parent 28822 da44a9ed6ab25d7424044a0185e1f3e33f4b7565
child 28824 5005b48c78ae1bf07103ecc8878bbd26c02df909
push id7278
push userjst@mozilla.com
push dateFri, 29 May 2009 02:37:07 +0000
treeherdermozilla-central@4414591c887f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskaie
bugs326628
milestone1.9.2a1pre
Bug 326628 try #2 - remove window.pkcs11 and fix the device manager not to use that API, r=kaie
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfoID.h
dom/base/nsGlobalWindow.cpp
dom/base/nsGlobalWindow.h
security/manager/pki/resources/content/device_manager.js
security/manager/ssl/public/Makefile.in
security/manager/ssl/public/nsIPKCS11.idl
security/manager/ssl/src/nsCrypto.cpp
security/manager/ssl/src/nsCrypto.h
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -327,17 +327,16 @@
 #include "nsIDOMRangeException.h"
 #include "nsIDOMNodeIterator.h"
 #include "nsIDOMTreeWalker.h"
 #include "nsIDOMXULDocument.h"
 #include "nsIDOMXULElement.h"
 #include "nsIDOMXULCommandDispatcher.h"
 #include "nsIDOMCrypto.h"
 #include "nsIDOMCRMFObject.h"
-#include "nsIDOMPkcs11.h"
 #include "nsIControllers.h"
 #include "nsISelection.h"
 #include "nsIBoxObject.h"
 #ifdef MOZ_XUL
 #include "nsITreeSelection.h"
 #include "nsITreeContentView.h"
 #include "nsITreeView.h"
 #include "nsIXULTemplateBuilder.h"
@@ -852,18 +851,16 @@ static nsDOMClassInfoData sClassInfoData
                            DEFAULT_SCRIPTABLE_FLAGS)
 #endif
 
   // Crypto classes
   NS_DEFINE_CLASSINFO_DATA(Crypto, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(CRMFObject, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
-  NS_DEFINE_CLASSINFO_DATA(Pkcs11, nsDOMGenericSH,
-                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
   // DOM Traversal classes
   NS_DEFINE_CLASSINFO_DATA(TreeWalker, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
   // We are now trying to preserve binary compat in classinfo.  No
   // more putting things in those categories up there.  New entries
   // are to be added to the end of the list
@@ -2641,20 +2638,16 @@ nsDOMClassInfo::Init()
   DOM_CLASSINFO_MAP_BEGIN(Crypto, nsIDOMCrypto)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMCrypto)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(CRMFObject, nsIDOMCRMFObject)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMCRMFObject)
   DOM_CLASSINFO_MAP_END
 
-  DOM_CLASSINFO_MAP_BEGIN(Pkcs11, nsIDOMPkcs11)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMPkcs11)
-  DOM_CLASSINFO_MAP_END
-
   DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(XMLStylesheetProcessingInstruction, nsIDOMProcessingInstruction)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMProcessingInstruction)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMLinkStyle)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Node)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ChromeWindow, nsIDOMWindow)
--- a/dom/base/nsDOMClassInfoID.h
+++ b/dom/base/nsDOMClassInfoID.h
@@ -184,17 +184,16 @@ enum nsDOMClassInfoID {
 #ifdef MOZ_XUL
   eDOMClassInfo_TreeSelection_id,
   eDOMClassInfo_TreeContentView_id,
 #endif
 
   // Crypto classes
   eDOMClassInfo_Crypto_id,
   eDOMClassInfo_CRMFObject_id,
-  eDOMClassInfo_Pkcs11_id,
   
   // DOM Traversal classes
   eDOMClassInfo_TreeWalker_id,
 
   // Rect object used by getComputedStyle
   eDOMClassInfo_CSSRect_id,
 
   // DOM Chrome Window class, almost identical to Window
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -102,17 +102,16 @@
 #include "nsIDOMElement.h"
 #include "nsIDOMDocumentEvent.h"
 #include "nsIDOMEvent.h"
 #include "nsIDOMHTMLDocument.h"
 #include "nsIDOMHTMLElement.h"
 #include "nsIDOMKeyEvent.h"
 #include "nsIDOMMessageEvent.h"
 #include "nsIDOMPopupBlockedEvent.h"
-#include "nsIDOMPkcs11.h"
 #include "nsIDOMOfflineResourceList.h"
 #include "nsIDOMGeoGeolocation.h"
 #include "nsDOMString.h"
 #include "nsIEmbeddingSiteWindow2.h"
 #include "nsThreadUtils.h"
 #include "nsIEventStateManager.h"
 #include "nsIHttpProtocolHandler.h"
 #include "nsIJSContextStack.h"
@@ -2958,24 +2957,17 @@ nsGlobalWindow::GetCrypto(nsIDOMCrypto**
   NS_IF_ADDREF(*aCrypto = mCrypto);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetPkcs11(nsIDOMPkcs11** aPkcs11)
 {
-  FORWARD_TO_OUTER(GetPkcs11, (aPkcs11), NS_ERROR_NOT_INITIALIZED);
-
-  if (!mPkcs11) {
-    mPkcs11 = do_CreateInstance(kPkcs11ContractID);
-  }
-
-  NS_IF_ADDREF(*aPkcs11 = mPkcs11);
-
+  *aPkcs11 = nsnull;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetControllers(nsIControllers** aResult)
 {
   FORWARD_TO_OUTER(GetControllers, (aResult), NS_ERROR_NOT_INITIALIZED);
 
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -79,17 +79,16 @@
 #include "nsITimer.h"
 #include "nsIWebBrowserChrome.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDOMModalContentWindow.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsIEventListenerManager.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMCrypto.h"
-#include "nsIDOMPkcs11.h"
 #include "nsIPrincipal.h"
 #include "nsPluginArray.h"
 #include "nsMimeTypeArray.h"
 #include "nsIXPCScriptable.h"
 #include "nsPoint.h"
 #include "nsSize.h"
 #include "mozFlushType.h"
 #include "prclist.h"
@@ -703,17 +702,16 @@ protected:
   nsString                      mStatus;
   nsString                      mDefaultStatus;
   // index 0->language_id 1, so index MAX-1 == language_id MAX
   nsCOMPtr<nsIScriptContext>    mScriptContexts[NS_STID_ARRAY_UBOUND];
   void *                        mScriptGlobals[NS_STID_ARRAY_UBOUND];
   nsGlobalWindowObserver*       mObserver;
 
   nsCOMPtr<nsIDOMCrypto>        mCrypto;
-  nsCOMPtr<nsIDOMPkcs11>        mPkcs11;
 
   nsCOMPtr<nsIDOMStorage>      mLocalStorage;
 
   nsCOMPtr<nsISupports>         mInnerWindowHolders[NS_STID_ARRAY_UBOUND];
   nsCOMPtr<nsIPrincipal> mOpenerScriptPrincipal; // strong; used to determine
                                                  // whether to clear scope
 
   // These member variable are used only on inner windows.
--- a/security/manager/pki/resources/content/device_manager.js
+++ b/security/manager/pki/resources/content/device_manager.js
@@ -43,16 +43,18 @@ const nsIPKCS11Slot = Components.interfa
 const nsIPKCS11Module = Components.interfaces.nsIPKCS11Module;
 const nsPKCS11ModuleDB = "@mozilla.org/security/pkcs11moduledb;1";
 const nsIPKCS11ModuleDB = Components.interfaces.nsIPKCS11ModuleDB;
 const nsIPK11Token = Components.interfaces.nsIPK11Token;
 const nsPK11TokenDB = "@mozilla.org/security/pk11tokendb;1";
 const nsIPK11TokenDB = Components.interfaces.nsIPK11TokenDB;
 const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock;
 const nsDialogParamBlock = "@mozilla.org/embedcomp/dialogparam;1";
+const nsIPKCS11 = Components.interfaces.nsIPKCS11;
+const nsPKCS11ContractID = "@mozilla.org/security/pkcs11;1";
 
 var bundle;
 var secmoddb;
 var skip_enable_buttons = false;
 
 /* Do the initial load of all PKCS# modules and list them. */
 function LoadModules()
 {
@@ -60,16 +62,41 @@ function LoadModules()
   secmoddb = Components.classes[nsPKCS11ModuleDB].getService(nsIPKCS11ModuleDB);
   window.crypto.enableSmartCardEvents = true;
   document.addEventListener("smartcard-insert", onSmartCardChange, false);
   document.addEventListener("smartcard-remove", onSmartCardChange, false);
 
   RefreshDeviceList();
 }
 
+function getPKCS11()
+{
+  return Components.classes[nsPKCS11ContractID].getService(nsIPKCS11);
+}
+
+function getNSSString(name)
+{
+  return srGetStrBundle("chrome://pipnss/locale/pipnss.properties").
+    GetStringFromName(name);
+}
+
+function doPrompt(msg)
+{
+  let prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].
+    getService(Components.interfaces.nsIPromptService);
+  prompts.alert(window, null, msg);
+}
+
+function doConfirm(msg)
+{
+  let prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].
+    getService(Components.interfaces.nsIPromptService);
+  return prompts.confirm(window, null, msg);
+}
+
 function RefreshDeviceList()
 {
   var modules = secmoddb.listModules();
   var done = false;
 
   try {
     modules.isDone();
   } catch (e) { done = true; }
@@ -393,23 +420,27 @@ function doLoad()
               "chrome,centerscreen,modal");
   ClearDeviceList();
   RefreshDeviceList();
 }
 
 function deleteSelected()
 {
   getSelectedItem();
-  if (selected_module) {
-    var retval = pkcs11.deletemodule(selected_module.name);
-    if (retval == 1 || retval == 2) {
-      // successful deletion of internal or external module
-      selected_module = null;
-      return true;
+  if (selected_module &&
+      doConfirm(getNSSString("DelModuleWarning"))) {
+    try {
+      getPKCS11().deleteModule(selected_module.name);
     }
+    catch (e) {
+      doPrompt(getNSSString("DelModuleError"));
+      return false;
+    }
+    selected_module = null;
+    return true;
   }
   return false;
 }
 
 function doUnload()
 {
   if (deleteSelected()) {
     ClearDeviceList();
@@ -455,17 +486,27 @@ function doBrowseFiles()
     pathbox.setAttribute("value", fp.file.persistentDescriptor);
   }
 }
 
 function doLoadDevice()
 {
   var name_box = document.getElementById("device_name");
   var path_box = document.getElementById("device_path");
-  pkcs11.addmodule(name_box.value, path_box.value, 0,0);
+  try {
+    getPKCS11().addModule(name_box.value, path_box.value, 0,0);
+  }
+  catch (e) {
+    if (e.result == Components.results.NS_ERROR_ILLEGAL_VALUE)
+      doPrompt(getNSSString("AddModuleDup"));
+    else
+      doPrompt(getNSSString("AddModuleFailure"));
+
+    return false;
+  }
   return true;
 }
 
 // -------------------------------------   Old code
 
 function showTokenInfo()
 {
   //ClearInfoList();
--- a/security/manager/ssl/public/Makefile.in
+++ b/security/manager/ssl/public/Makefile.in
@@ -66,16 +66,17 @@ XPIDLSRCS = \
     nsIAssociatedContentSecurity.idl \
     nsICertOverrideService.idl \
     nsIRecentBadCertsService.idl \
     nsIFormSigningDialog.idl \
     nsIX509Cert2.idl \
     nsIX509Cert3.idl \
     nsIX509CertDB2.idl \
     nsIX509CertList.idl \
+    nsIPKCS11.idl \
     nsIPKCS11Slot.idl \
     nsIPK11TokenDB.idl \
     nsICertPickDialogs.idl \
     nsIClientAuthDialogs.idl \
     nsIDOMCryptoDialogs.idl \
     nsIGenKeypairInfoDlg.idl \
     nsITokenDialogs.idl \
     nsITokenPasswordDialogs.idl \
new file mode 100644
--- /dev/null
+++ b/security/manager/ssl/public/nsIPKCS11.idl
@@ -0,0 +1,49 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2000
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Johnny Stenback <jst@netscape.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsISupports.idl"
+
+[scriptable, uuid(5743f870-958e-4f02-aef2-c0afeef67f05)]
+interface nsIPKCS11 : nsISupports
+{
+  void deleteModule(in AString moduleName);
+  void addModule(in AString moduleName,
+                 in AString libraryFullPath,
+                 in long cryptoMechanismFlags,
+                 in long cipherFlags);
+};
--- a/security/manager/ssl/src/nsCrypto.cpp
+++ b/security/manager/ssl/src/nsCrypto.cpp
@@ -246,19 +246,18 @@ NS_INTERFACE_MAP_BEGIN(nsCRMFObject)
   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CRMFObject)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_ADDREF(nsCRMFObject)
 NS_IMPL_RELEASE(nsCRMFObject)
 
 // QueryInterface implementation for nsPkcs11
 NS_INTERFACE_MAP_BEGIN(nsPkcs11)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMPkcs11)
+  NS_INTERFACE_MAP_ENTRY(nsIPKCS11)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Pkcs11)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_ADDREF(nsPkcs11)
 NS_IMPL_RELEASE(nsPkcs11)
 
 // ISupports implementation for nsCryptoRunnable
 NS_IMPL_ISUPPORTS1(nsCryptoRunnable, nsIRunnable)
 
@@ -2940,117 +2939,58 @@ confirm_user(const PRUnichar *message)
     }
   }
 
   return (buttonPressed == 0);
 }
 
 //Delete a PKCS11 module from the user's profile.
 NS_IMETHODIMP
-nsPkcs11::Deletemodule(const nsAString& aModuleName, PRInt32* aReturn)
+nsPkcs11::DeleteModule(const nsAString& aModuleName)
 {
   nsNSSShutDownPreventionLock locker;
   nsresult rv;
   nsString errorMessage;
 
   nsCOMPtr<nsINSSComponent> nssComponent(do_GetService(kNSSComponentCID, &rv));
+  if (NS_FAILED(rv))
+    return rv;
+
   if (aModuleName.IsEmpty()) {
-    *aReturn = JS_ERR_BAD_MODULE_NAME;
-    nssComponent->GetPIPNSSBundleString("DelModuleBadName", errorMessage);
-    alertUser(errorMessage.get());
-    return NS_OK;
-  }
-  nsString final;
-  nsAutoString temp;
-  //Make sure the user knows we're trying to do this.
-  nssComponent->GetPIPNSSBundleString("DelModuleWarning", final);
-  final.Append(NS_LITERAL_STRING("\n").get());
-  PRUnichar *tempUni = ToNewUnicode(aModuleName);
-  const PRUnichar *formatStrings[1] = { tempUni };
-  rv = nssComponent->PIPBundleFormatStringFromName("AddModuleName",
-                                                   formatStrings, 1, temp);
-  nsMemory::Free(tempUni);
-  final.Append(temp);
-  if (!confirm_user(final.get())) {
-    *aReturn = JS_ERR_USER_CANCEL_ACTION;
-    return NS_OK;
+    return NS_ERROR_ILLEGAL_VALUE;
   }
   
   char *modName = ToNewCString(aModuleName);
   PRInt32 modType;
   SECStatus srv = SECMOD_DeleteModule(modName, &modType);
   if (srv == SECSuccess) {
     SECMODModule *module = SECMOD_FindModule(modName);
     if (module) {
       nssComponent->ShutdownSmartCardThread(module);
       SECMOD_DestroyModule(module);
     }
-    if (modType == SECMOD_EXTERNAL) {
-      nssComponent->GetPIPNSSBundleString("DelModuleExtSuccess", errorMessage);
-      *aReturn = JS_OK_DEL_EXTERNAL_MOD;
-    } else {
-      nssComponent->GetPIPNSSBundleString("DelModuleIntSuccess", errorMessage);
-      *aReturn = JS_OK_DEL_INTERNAL_MOD;
-    }
+    rv = NS_OK;
   } else {
-    *aReturn = JS_ERR_DEL_MOD;
-    nssComponent->GetPIPNSSBundleString("DelModuleError", errorMessage);
+    rv = NS_ERROR_FAILURE;
   }
-  alertUser(errorMessage.get());
-  return NS_OK;
+  NS_Free(modName);
+  return rv;
 }
 
 //Add a new PKCS11 module to the user's profile.
 NS_IMETHODIMP
-nsPkcs11::Addmodule(const nsAString& aModuleName, 
+nsPkcs11::AddModule(const nsAString& aModuleName, 
                     const nsAString& aLibraryFullPath, 
                     PRInt32 aCryptoMechanismFlags, 
-                    PRInt32 aCipherFlags, PRInt32* aReturn)
+                    PRInt32 aCipherFlags)
 {
   nsNSSShutDownPreventionLock locker;
   nsresult rv;
   nsCOMPtr<nsINSSComponent> nssComponent(do_GetService(kNSSComponentCID, &rv));
-  nsString final;
-  nsAutoString temp;
-
-  rv = nssComponent->GetPIPNSSBundleString("AddModulePrompt", final);
-  if (NS_FAILED(rv))
-    return rv;
-
-  final.Append(NS_LITERAL_STRING("\n").get());
-  
-  PRUnichar *tempUni = ToNewUnicode(aModuleName); 
-  const PRUnichar *formatStrings[1] = { tempUni };
-  rv = nssComponent->PIPBundleFormatStringFromName("AddModuleName",
-                                                   formatStrings, 1, temp);
-  nsMemory::Free(tempUni);
-
-  if (NS_FAILED(rv))
-    return rv;
-
-  final.Append(temp);
-  final.Append(NS_LITERAL_STRING("\n").get());
-
-  tempUni = ToNewUnicode(aLibraryFullPath);
-  formatStrings[0] = tempUni;
-  rv = nssComponent->PIPBundleFormatStringFromName("AddModulePath",
-                                                   formatStrings, 1, temp);
-  nsMemory::Free(tempUni);
-  if (NS_FAILED(rv))
-    return rv;
-
-  final.Append(temp);
-  final.Append(NS_LITERAL_STRING("\n").get());
- 
-  if (!confirm_user(final.get())) {
-    // The user has canceled. So let's return now.
-    *aReturn = JS_ERR_USER_CANCEL_ACTION;
-    return NS_OK;
-  }
-  
+
   char *moduleName = ToNewCString(aModuleName);
   char *fullPath   = ToNewCString(aLibraryFullPath);
   PRUint32 mechFlags = SECMOD_PubMechFlagstoInternal(aCryptoMechanismFlags);
   PRUint32 cipherFlags = SECMOD_PubCipherFlagstoInternal(aCipherFlags);
   SECStatus srv = SECMOD_AddNewModule(moduleName, fullPath, 
                                       mechFlags, cipherFlags);
   if (srv == SECSuccess) {
     SECMODModule *module = SECMOD_FindModule(moduleName);
@@ -3062,27 +3002,18 @@ nsPkcs11::Addmodule(const nsAString& aMo
 
   nsMemory::Free(moduleName);
   nsMemory::Free(fullPath);
 
   // The error message we report to the user depends directly on 
   // what the return value for SEDMOD_AddNewModule is
   switch (srv) {
   case SECSuccess:
-    nssComponent->GetPIPNSSBundleString("AddModuleSuccess", final);
-    *aReturn = JS_OK_ADD_MOD;
-    break;
+    return NS_OK;
   case SECFailure:
-    nssComponent->GetPIPNSSBundleString("AddModuleFailure", final);
-    *aReturn = JS_ERR_ADD_MOD;
-    break;
+    return NS_ERROR_FAILURE;
   case -2:
-    nssComponent->GetPIPNSSBundleString("AddModuleDup", final);
-    *aReturn = JS_ERR_ADD_DUPLICATE_MOD;
-    break;
-  default:
-    NS_ASSERTION(0,"Bogus return value, this should never happen");
-    return NS_ERROR_FAILURE;
+    return NS_ERROR_ILLEGAL_VALUE;
   }
-  alertUser(final.get());
-  return NS_OK;
+  NS_ASSERTION(0,"Bogus return value, this should never happen");
+  return NS_ERROR_FAILURE;
 }
 
--- a/security/manager/ssl/src/nsCrypto.h
+++ b/security/manager/ssl/src/nsCrypto.h
@@ -36,17 +36,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #ifndef _nsCrypto_h_
 #define _nsCrypto_h_
 #include "nsCOMPtr.h"
 #include "nsIDOMCRMFObject.h"
 #include "nsIDOMCrypto.h"
-#include "nsIDOMPkcs11.h"
+#include "nsIPKCS11.h"
 #include "nsIRunnable.h"
 #include "nsString.h"
 #include "jsapi.h"
 #include "nsIPrincipal.h"
 
 #define NS_CRYPTO_CLASSNAME "Crypto JavaScript Class"
 #define NS_CRYPTO_CID \
   {0x929d9320, 0x251e, 0x11d4, { 0x8a, 0x7c, 0x00, 0x60, 0x08, 0xc8, 0x44, 0xc3} }
@@ -90,20 +90,20 @@ public:
   NS_DECL_NSIDOMCRYPTO
 
 private:
   static already_AddRefed<nsIPrincipal> GetScriptPrincipal(JSContext *cx);
 
   PRBool mEnableSmartCardEvents;
 };
 
-class nsPkcs11 : public nsIDOMPkcs11
+class nsPkcs11 : public nsIPKCS11
 {
 public:
   nsPkcs11();
   virtual ~nsPkcs11();
 
   NS_DECL_ISUPPORTS
-  NS_DECL_NSIDOMPKCS11
+  NS_DECL_NSIPKCS11
 
 };
 
 #endif //_nsCrypto_h_