Bug 561244 - e10s: forward JS 'crypto' calls from content->chrome (Part 1/3 - Adding unique define to disable crypto object) r=jst a=blocking-fennec

--HG--
extra : rebase_source : 4ad7c331127b5fc75aebbad45a6a529aabe4f5e6
This commit is contained in:
Mike Kristoffersen 2010-09-29 18:56:46 +02:00
Родитель fbc42d690c
Коммит 5807a1617f
2 изменённых файлов: 18 добавлений и 6 удалений

Просмотреть файл

@ -104,7 +104,9 @@
#include "nsIHTMLDocument.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMHTMLElement.h"
#ifndef MOZ_DISABLE_DOMCRYPTO
#include "nsIDOMCrypto.h"
#endif
#include "nsIDOMDocument.h"
#include "nsIDOM3Document.h"
#include "nsIDOMNSDocument.h"
@ -391,10 +393,10 @@ static PRBool gDOMWindowDumpEnabled = PR_FALSE;
static NS_DEFINE_CID(kXULControllersCID, NS_XULCONTROLLERS_CID);
static const char sJSStackContractID[] = "@mozilla.org/js/xpc/ContextStack;1";
#ifndef MOZ_DISABLE_DOMCRYPTO
static const char kCryptoContractID[] = NS_CRYPTO_CONTRACTID;
static const char kPkcs11ContractID[] = NS_PKCS11_CONTRACTID;
#endif
static const char sPopStatePrefStr[] = "browser.history.allowPopState";
static PRBool
@ -1652,12 +1654,12 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
NS_ENSURE_TRUE(scx, NS_ERROR_NOT_INITIALIZED);
JSContext *cx = (JSContext *)scx->GetNativeContext();
#ifndef MOZ_DISABLE_DOMCRYPTO
// clear smartcard events, our document has gone away.
if (mCrypto) {
mCrypto->SetEnableSmartCardEvents(PR_FALSE);
}
#endif
if (!mDocument) {
// First document load.
@ -3091,6 +3093,9 @@ nsGlobalWindow::RevokeBlobURL(const nsAString& aURL)
NS_IMETHODIMP
nsGlobalWindow::GetCrypto(nsIDOMCrypto** aCrypto)
{
#ifdef MOZ_DISABLE_DOMCRYPTO
return NS_ERROR_NOT_IMPLEMENTED;
#else
FORWARD_TO_OUTER(GetCrypto, (aCrypto), NS_ERROR_NOT_INITIALIZED);
if (!mCrypto) {
@ -3100,6 +3105,7 @@ nsGlobalWindow::GetCrypto(nsIDOMCrypto** aCrypto)
NS_IF_ADDREF(*aCrypto = mCrypto);
return NS_OK;
#endif
}
NS_IMETHODIMP

Просмотреть файл

@ -86,7 +86,9 @@
#include "nsIScriptSecurityManager.h"
#include "nsIEventListenerManager.h"
#include "nsIDOMDocument.h"
#ifndef MOZ_DISABLE_DOMCRYPTO
#include "nsIDOMCrypto.h"
#endif
#include "nsIPrincipal.h"
#include "nsPluginArray.h"
#include "nsMimeTypeArray.h"
@ -142,6 +144,10 @@ class nsRunnable;
class nsDOMOfflineResourceList;
class nsGeolocation;
#ifdef MOZ_DISABLE_DOMCRYPTO
class nsIDOMCrypto;
#endif
extern nsresult
NS_CreateJSTimeoutHandler(nsGlobalWindow *aWindow,
PRBool *aIsInterval,
@ -845,9 +851,9 @@ protected:
nsString mDefaultStatus;
// index 0->language_id 1, so index MAX-1 == language_id MAX
nsGlobalWindowObserver* mObserver;
#ifndef MOZ_DISABLE_DOMCRYPTO
nsCOMPtr<nsIDOMCrypto> mCrypto;
#endif
nsCOMPtr<nsIDOMStorage> mLocalStorage;
nsCOMPtr<nsIDOMStorage> mSessionStorage;