gecko-dev/dom/src/base/nsJSEnvironment.h

76 lines
2.4 KiB
C
Raw Normal View History

1998-07-16 01:16:47 +00:00
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsJSEnvironment_h___
#define nsJSEnvironment_h___
#include "nsIScriptContext.h"
#include "jsapi.h"
class nsIScriptSecurityManager;
class nsIScriptNameSpaceManager;
1998-07-16 01:16:47 +00:00
class nsJSContext : public nsIScriptContext {
private:
JSContext *mContext;
nsIScriptNameSpaceManager* mNameSpaceManager;
PRBool mIsInitialized;
1998-07-16 01:16:47 +00:00
public:
nsJSContext(JSRuntime *aRuntime);
~nsJSContext();
NS_DECL_ISUPPORTS
NS_IMETHOD_(PRBool) EvaluateString(const nsString& aScript,
const char *aURL,
PRUint32 aLineNo,
nsString& aRetValue,
PRBool* aIsUndefined);
NS_IMETHOD_(nsIScriptGlobalObject*) GetGlobalObject();
NS_IMETHOD_(void*) GetNativeContext();
NS_IMETHOD InitClasses();
NS_IMETHOD InitContext(nsIScriptGlobalObject *aGlobalObject);
NS_IMETHOD IsContextInitialized();
NS_IMETHOD AddNamedReference(void *aSlot, void *aScriptObject,
const char *aName);
NS_IMETHOD RemoveReference(void *aSlot, void *aScriptObject);
NS_IMETHOD GC();
NS_IMETHOD GetNameSpaceManager(nsIScriptNameSpaceManager** aInstancePtr);
NS_IMETHOD GetSecurityManager(nsIScriptSecurityManager** aInstancePtr);
nsresult InitializeExternalClasses();
1998-07-16 01:16:47 +00:00
};
class nsJSEnvironment {
private:
JSRuntime *mRuntime;
public:
1998-09-01 19:13:36 +00:00
static nsJSEnvironment *sTheEnvironment;
1998-07-16 01:16:47 +00:00
nsJSEnvironment();
~nsJSEnvironment();
nsIScriptContext* GetNewContext();
static nsJSEnvironment *GetScriptingEnvironment();
1998-07-16 01:16:47 +00:00
};
#endif /* nsJSEnvironment_h___ */