Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #include "nsISupports.idl" |
michael@0 | 8 | |
michael@0 | 9 | [scriptable, uuid(3a5c7a0f-f5da-4a8b-a748-d7c5a528f33b)] |
michael@0 | 10 | interface nsINSSErrorsService : nsISupports |
michael@0 | 11 | { |
michael@0 | 12 | /** |
michael@0 | 13 | * @param aNSPRCode An error code obtained using PR_GetError() |
michael@0 | 14 | * @return True if it is error code defined by the NSS library |
michael@0 | 15 | */ |
michael@0 | 16 | boolean isNSSErrorCode(in int32_t aNSPRCode); |
michael@0 | 17 | |
michael@0 | 18 | /** |
michael@0 | 19 | * Function will fail if aNSPRCode is not an NSS error code. |
michael@0 | 20 | * @param aNSPRCode An error code obtained using PR_GetError() |
michael@0 | 21 | * @return The result of the conversion, an XPCOM error code |
michael@0 | 22 | */ |
michael@0 | 23 | nsresult getXPCOMFromNSSError(in int32_t aNSPRCode); |
michael@0 | 24 | |
michael@0 | 25 | /** |
michael@0 | 26 | * Function will fail if aXPCOMErrorCode is not an NSS error code. |
michael@0 | 27 | * @param aXPCOMErrorCode An error code obtain using getXPCOMFromNSSError |
michael@0 | 28 | * return A localized human readable error explanation. |
michael@0 | 29 | */ |
michael@0 | 30 | AString getErrorMessage(in nsresult aXPCOMErrorCode); |
michael@0 | 31 | |
michael@0 | 32 | /** |
michael@0 | 33 | * Function will fail if aXPCOMErrorCode is not an NSS error code. |
michael@0 | 34 | * @param aXPCOMErrorCode An error code obtain using getXPCOMFromNSSError |
michael@0 | 35 | * return the |
michael@0 | 36 | */ |
michael@0 | 37 | uint32_t getErrorClass(in nsresult aXPCOMErrorCode); |
michael@0 | 38 | |
michael@0 | 39 | const unsigned long ERROR_CLASS_SSL_PROTOCOL = 1; |
michael@0 | 40 | const unsigned long ERROR_CLASS_BAD_CERT = 2; |
michael@0 | 41 | |
michael@0 | 42 | /** |
michael@0 | 43 | * The following values define the range of NSPR error codes used by NSS. |
michael@0 | 44 | * NSS remains the authorative source for these numbers, as a result, |
michael@0 | 45 | * the values might change in the future. |
michael@0 | 46 | * The security module will perform a runtime check and assertion |
michael@0 | 47 | * to ensure the values are in synch with NSS. |
michael@0 | 48 | */ |
michael@0 | 49 | const long NSS_SEC_ERROR_BASE = -(0x2000); |
michael@0 | 50 | const long NSS_SEC_ERROR_LIMIT = (NSS_SEC_ERROR_BASE + 1000); |
michael@0 | 51 | const long NSS_SSL_ERROR_BASE = -(0x3000); |
michael@0 | 52 | const long NSS_SSL_ERROR_LIMIT = (NSS_SSL_ERROR_BASE + 1000); |
michael@0 | 53 | }; |