2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* 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/. */
|
2011-09-18 02:22:17 -07:00
|
|
|
#ifndef nsJSEnvironment_h
|
|
|
|
#define nsJSEnvironment_h
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#include "nsIScriptContext.h"
|
|
|
|
#include "nsIScriptRuntime.h"
|
2012-03-24 01:18:21 -07:00
|
|
|
#include "nsIScriptGlobalObject.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "jsapi.h"
|
2012-01-25 10:59:55 -08:00
|
|
|
#include "jsfriendapi.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIObserver.h"
|
|
|
|
#include "nsIXPCScriptNotify.h"
|
|
|
|
#include "prtime.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2012-01-25 10:59:55 -08:00
|
|
|
#include "nsIXPConnect.h"
|
2012-03-11 00:53:05 -08:00
|
|
|
#include "nsIArray.h"
|
2012-06-14 19:31:55 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsIXPConnectJSObjectHolder;
|
2011-09-22 15:13:36 -07:00
|
|
|
class nsRootedJSValueArray;
|
2011-10-03 12:11:31 -07:00
|
|
|
class nsScriptNameSpaceManager;
|
2011-04-28 15:48:52 -07:00
|
|
|
namespace mozilla {
|
2011-04-28 15:48:51 -07:00
|
|
|
template <class> class Maybe;
|
2010-03-29 22:51:52 -07:00
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-03-12 16:25:03 -07:00
|
|
|
// The amount of time we wait between a request to GC (due to leaving
|
|
|
|
// a page) and doing the actual GC.
|
|
|
|
#define NS_GC_DELAY 4000 // ms
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsJSContext : public nsIScriptContext,
|
2009-02-12 04:06:59 -08:00
|
|
|
public nsIXPCScriptNotify
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsJSContext(JSRuntime *aRuntime);
|
|
|
|
virtual ~nsJSContext();
|
|
|
|
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2009-05-07 11:19:36 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsJSContext,
|
|
|
|
nsIScriptContext)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-05-18 05:28:37 -07:00
|
|
|
virtual nsIScriptObjectPrincipal* GetObjectPrincipal();
|
|
|
|
|
2012-03-24 01:18:21 -07:00
|
|
|
virtual void SetGlobalObject(nsIScriptGlobalObject* aGlobalObject)
|
|
|
|
{
|
|
|
|
mGlobalObjectRef = aGlobalObject;
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual nsresult EvaluateString(const nsAString& aScript,
|
2011-10-29 13:11:51 -07:00
|
|
|
JSObject* aScopeObject,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIPrincipal *principal,
|
2011-12-19 09:47:52 -08:00
|
|
|
nsIPrincipal *originPrincipal,
|
2007-03-22 10:30:00 -07:00
|
|
|
const char *aURL,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aLineNo,
|
2012-03-29 14:09:13 -07:00
|
|
|
JSVersion aVersion,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsAString *aRetValue,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool* aIsUndefined);
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual nsresult EvaluateStringWithValue(const nsAString& aScript,
|
2011-11-15 23:50:19 -08:00
|
|
|
JSObject* aScopeObject,
|
|
|
|
nsIPrincipal* aPrincipal,
|
|
|
|
const char* aURL,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aLineNo,
|
|
|
|
uint32_t aVersion,
|
2011-11-15 23:50:20 -08:00
|
|
|
JS::Value* aRetValue,
|
2011-11-15 23:50:19 -08:00
|
|
|
bool* aIsUndefined);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
virtual nsresult CompileScript(const PRUnichar* aText,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aTextLength,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIPrincipal *principal,
|
|
|
|
const char *aURL,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aLineNo,
|
|
|
|
uint32_t aVersion,
|
2012-08-07 10:39:47 -07:00
|
|
|
nsScriptObjectHolder<JSScript>& aScriptObject,
|
|
|
|
bool aSaveSource = false);
|
2011-10-29 13:15:43 -07:00
|
|
|
virtual nsresult ExecuteScript(JSScript* aScriptObject,
|
2011-10-29 13:10:49 -07:00
|
|
|
JSObject* aScopeObject,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsAString* aRetValue,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool* aIsUndefined);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
virtual nsresult CompileEventHandler(nsIAtom *aName,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aArgCount,
|
2007-03-22 10:30:00 -07:00
|
|
|
const char** aArgNames,
|
|
|
|
const nsAString& aBody,
|
2012-08-22 08:56:38 -07:00
|
|
|
const char *aURL, uint32_t aLineNo,
|
|
|
|
uint32_t aVersion,
|
2012-10-03 02:44:18 -07:00
|
|
|
bool aIsXBL,
|
2011-12-18 02:05:12 -08:00
|
|
|
nsScriptObjectHolder<JSObject>& aHandler);
|
2011-10-29 13:19:03 -07:00
|
|
|
virtual nsresult CallEventHandler(nsISupports* aTarget, JSObject* aScope,
|
2011-11-26 02:09:20 -08:00
|
|
|
JSObject* aHandler,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIArray *argv, nsIVariant **rv);
|
|
|
|
virtual nsresult BindCompiledEventHandler(nsISupports *aTarget,
|
2011-10-29 13:18:21 -07:00
|
|
|
JSObject *aScope,
|
2011-11-26 02:11:35 -08:00
|
|
|
JSObject* aHandler,
|
2011-12-18 02:05:12 -08:00
|
|
|
nsScriptObjectHolder<JSObject>& aBoundHandler);
|
2011-11-26 02:07:55 -08:00
|
|
|
virtual nsresult CompileFunction(JSObject* aTarget,
|
2007-03-22 10:30:00 -07:00
|
|
|
const nsACString& aName,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aArgCount,
|
2007-03-22 10:30:00 -07:00
|
|
|
const char** aArgArray,
|
|
|
|
const nsAString& aBody,
|
|
|
|
const char* aURL,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aLineNo,
|
|
|
|
uint32_t aVersion,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aShared,
|
2012-10-03 02:44:18 -07:00
|
|
|
bool aIsXBL,
|
2011-11-26 02:08:42 -08:00
|
|
|
JSObject** aFunctionObject);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
virtual nsIScriptGlobalObject *GetGlobalObject();
|
2012-04-12 11:21:12 -07:00
|
|
|
inline nsIScriptGlobalObject *GetGlobalObjectRef() { return mGlobalObjectRef; };
|
|
|
|
|
2011-09-18 02:22:17 -07:00
|
|
|
virtual JSContext* GetNativeContext();
|
2011-10-29 13:06:17 -07:00
|
|
|
virtual JSObject* GetNativeGlobal();
|
2010-07-15 15:16:29 -07:00
|
|
|
virtual nsresult InitContext();
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool IsContextInitialized();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual void ScriptEvaluated(bool aTerminated);
|
2012-03-11 00:49:15 -08:00
|
|
|
virtual void SetTerminationFunction(nsScriptTerminationFunc aFunc,
|
|
|
|
nsIDOMWindow* aRef);
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool GetScriptsEnabled();
|
|
|
|
virtual void SetScriptsEnabled(bool aEnabled, bool aFireTimeouts);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-03-11 00:50:22 -08:00
|
|
|
virtual nsresult SetProperty(JSObject* aTarget, const char* aPropName, nsISupports* aVal);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool GetProcessingScriptTag();
|
|
|
|
virtual void SetProcessingScriptTag(bool aResult);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool GetExecutingScript();
|
2009-11-19 15:11:44 -08:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual void SetGCOnDestruction(bool aGCOnDestruction);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-11-26 02:19:45 -08:00
|
|
|
virtual nsresult InitClasses(JSObject* aGlobalObj);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
virtual void WillInitializeContext();
|
|
|
|
virtual void DidInitializeContext();
|
|
|
|
|
2011-10-29 13:12:47 -07:00
|
|
|
virtual nsresult Serialize(nsIObjectOutputStream* aStream, JSScript* aScriptObject);
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual nsresult Deserialize(nsIObjectInputStream* aStream,
|
2011-12-18 02:05:12 -08:00
|
|
|
nsScriptObjectHolder<JSScript>& aResult);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
virtual nsresult DropScriptObject(void *object);
|
|
|
|
virtual nsresult HoldScriptObject(void *object);
|
|
|
|
|
2009-06-11 17:52:47 -07:00
|
|
|
virtual void EnterModalState();
|
|
|
|
virtual void LeaveModalState();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECL_NSIXPCSCRIPTNOTIFY
|
|
|
|
|
|
|
|
static void LoadStart();
|
2007-10-21 09:46:54 -07:00
|
|
|
static void LoadEnd();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-06-30 14:16:32 -07:00
|
|
|
enum IsCompartment {
|
|
|
|
CompartmentGC,
|
|
|
|
NonCompartmentGC
|
|
|
|
};
|
|
|
|
|
|
|
|
enum IsShrinking {
|
|
|
|
ShrinkingGC,
|
|
|
|
NonShrinkingGC
|
|
|
|
};
|
|
|
|
|
|
|
|
enum IsIncremental {
|
|
|
|
IncrementalGC,
|
|
|
|
NonIncrementalGC
|
|
|
|
};
|
|
|
|
|
2012-05-09 11:53:23 -07:00
|
|
|
static void GarbageCollectNow(js::gcreason::Reason reason,
|
2012-06-30 14:16:32 -07:00
|
|
|
IsIncremental aIncremental = NonIncrementalGC,
|
|
|
|
IsCompartment aCompartment = NonCompartmentGC,
|
2012-07-31 18:39:39 -07:00
|
|
|
IsShrinking aShrinking = NonShrinkingGC,
|
|
|
|
int64_t aSliceMillis = 0);
|
2011-12-27 03:59:29 -08:00
|
|
|
static void ShrinkGCBuffersNow();
|
2012-01-30 12:06:18 -08:00
|
|
|
// If aExtraForgetSkippableCalls is -1, forgetSkippable won't be
|
|
|
|
// called even if the previous collection was GC.
|
2012-07-30 07:20:58 -07:00
|
|
|
static void CycleCollectNow(nsICycleCollectorListener *aListener = nullptr,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aExtraForgetSkippableCalls = 0,
|
2012-06-27 08:10:20 -07:00
|
|
|
bool aForced = true);
|
2011-02-16 15:47:12 -08:00
|
|
|
|
2012-02-17 14:35:20 -08:00
|
|
|
static void PokeGC(js::gcreason::Reason aReason, int aDelay = 0);
|
2011-02-16 15:47:12 -08:00
|
|
|
static void KillGCTimer();
|
|
|
|
|
2011-12-27 03:59:29 -08:00
|
|
|
static void PokeShrinkGCBuffers();
|
|
|
|
static void KillShrinkGCBuffersTimer();
|
|
|
|
|
2011-02-16 15:47:12 -08:00
|
|
|
static void MaybePokeCC();
|
|
|
|
static void KillCCTimer();
|
2012-05-09 11:53:23 -07:00
|
|
|
static void KillFullGCTimer();
|
2012-06-10 21:27:59 -07:00
|
|
|
static void KillInterSliceGCTimer();
|
2011-02-16 15:47:12 -08:00
|
|
|
|
2012-01-25 10:59:55 -08:00
|
|
|
virtual void GC(js::gcreason::Reason aReason);
|
2009-02-12 04:06:59 -08:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
static uint32_t CleanupsSinceLastGC();
|
2012-01-30 12:06:18 -08:00
|
|
|
|
2012-01-26 07:03:21 -08:00
|
|
|
nsIScriptGlobalObject* GetCachedGlobalObject()
|
|
|
|
{
|
|
|
|
// Verify that we have a global so that this
|
|
|
|
// does always return a null when GetGlobalObject() is null.
|
|
|
|
JSObject* global = JS_GetGlobalObject(mContext);
|
2012-07-30 07:20:58 -07:00
|
|
|
return global ? mGlobalObjectRef.get() : nullptr;
|
2012-01-26 07:03:21 -08:00
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
nsresult InitializeExternalClasses();
|
|
|
|
|
|
|
|
// Helper to convert xpcom datatypes to jsvals.
|
2010-01-25 08:48:07 -08:00
|
|
|
nsresult ConvertSupportsTojsvals(nsISupports *aArgs,
|
2011-10-29 13:06:17 -07:00
|
|
|
JSObject *aScope,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t *aArgc,
|
2010-01-25 08:48:07 -08:00
|
|
|
jsval **aArgv,
|
2011-09-22 15:13:36 -07:00
|
|
|
mozilla::Maybe<nsRootedJSValueArray> &aPoolRelease);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsresult AddSupportsPrimitiveTojsvals(nsISupports *aArg, jsval *aArgv);
|
|
|
|
|
|
|
|
// given an nsISupports object (presumably an event target or some other
|
|
|
|
// DOM object), get (or create) the JSObject wrapping it.
|
2011-10-29 13:17:00 -07:00
|
|
|
nsresult JSObjectFromInterface(nsISupports *aSup, JSObject *aScript,
|
2007-03-22 10:30:00 -07:00
|
|
|
JSObject **aRet);
|
|
|
|
|
2009-05-19 19:11:01 -07:00
|
|
|
// Report the pending exception on our mContext, if any. This
|
|
|
|
// function will set aside the frame chain on mContext before
|
|
|
|
// reporting.
|
|
|
|
void ReportPendingException();
|
2007-03-22 10:30:00 -07:00
|
|
|
private:
|
2009-05-07 11:19:36 -07:00
|
|
|
void DestroyJSContext();
|
|
|
|
|
|
|
|
nsrefcnt GetCCRefcnt();
|
2007-11-01 15:51:57 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
JSContext *mContext;
|
2012-05-09 11:53:23 -07:00
|
|
|
bool mActive;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
protected:
|
|
|
|
struct TerminationFuncHolder;
|
|
|
|
friend struct TerminationFuncHolder;
|
2008-11-26 14:54:40 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
struct TerminationFuncClosure
|
|
|
|
{
|
|
|
|
TerminationFuncClosure(nsScriptTerminationFunc aFunc,
|
|
|
|
nsISupports* aArg,
|
|
|
|
TerminationFuncClosure* aNext) :
|
|
|
|
mTerminationFunc(aFunc),
|
|
|
|
mTerminationFuncArg(aArg),
|
|
|
|
mNext(aNext)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
~TerminationFuncClosure()
|
|
|
|
{
|
|
|
|
delete mNext;
|
|
|
|
}
|
2008-11-26 14:54:40 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsScriptTerminationFunc mTerminationFunc;
|
|
|
|
nsCOMPtr<nsISupports> mTerminationFuncArg;
|
|
|
|
TerminationFuncClosure* mNext;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TerminationFuncHolder
|
|
|
|
{
|
|
|
|
TerminationFuncHolder(nsJSContext* aContext)
|
|
|
|
: mContext(aContext),
|
|
|
|
mTerminations(aContext->mTerminations)
|
|
|
|
{
|
2012-07-30 07:20:58 -07:00
|
|
|
aContext->mTerminations = nullptr;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
~TerminationFuncHolder()
|
|
|
|
{
|
|
|
|
// Have to be careful here. mContext might have picked up new
|
|
|
|
// termination funcs while the script was evaluating. Prepend whatever
|
|
|
|
// we have to the current termination funcs on the context (since our
|
|
|
|
// termination funcs were posted first).
|
|
|
|
if (mTerminations) {
|
|
|
|
TerminationFuncClosure* cur = mTerminations;
|
|
|
|
while (cur->mNext) {
|
|
|
|
cur = cur->mNext;
|
|
|
|
}
|
|
|
|
cur->mNext = mContext->mTerminations;
|
|
|
|
mContext->mTerminations = mTerminations;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nsJSContext* mContext;
|
|
|
|
TerminationFuncClosure* mTerminations;
|
|
|
|
};
|
2008-11-26 14:54:40 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
TerminationFuncClosure* mTerminations;
|
|
|
|
|
|
|
|
private:
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mIsInitialized;
|
|
|
|
bool mScriptsEnabled;
|
|
|
|
bool mGCOnDestruction;
|
|
|
|
bool mProcessingScriptTag;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mExecuteDepth;
|
|
|
|
uint32_t mDefaultJSOptions;
|
2008-01-18 13:28:42 -08:00
|
|
|
PRTime mOperationCallbackTime;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-06-11 17:52:47 -07:00
|
|
|
PRTime mModalStateTime;
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mModalStateDepth;
|
2009-06-11 17:52:47 -07:00
|
|
|
|
2012-05-09 11:53:23 -07:00
|
|
|
nsJSContext *mNext;
|
|
|
|
nsJSContext **mPrev;
|
|
|
|
|
2010-09-03 14:15:50 -07:00
|
|
|
// mGlobalObjectRef ensures that the outer window stays alive as long as the
|
|
|
|
// context does. It is eventually collected by the cycle collector.
|
2011-04-28 13:28:54 -07:00
|
|
|
nsCOMPtr<nsIScriptGlobalObject> mGlobalObjectRef;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-10-10 08:04:34 -07:00
|
|
|
static int JSOptionChangedCallback(const char *pref, void *data);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-09-06 15:21:43 -07:00
|
|
|
static JSBool DOMOperationCallback(JSContext *cx);
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class nsIJSRuntimeService;
|
|
|
|
|
2012-06-14 19:31:55 -07:00
|
|
|
class nsJSRuntime MOZ_FINAL : public nsIScriptRuntime
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// let people who can see us use our runtime for convenience.
|
|
|
|
static JSRuntime *sRuntime;
|
|
|
|
|
|
|
|
public:
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2011-11-15 23:50:19 -08:00
|
|
|
virtual already_AddRefed<nsIScriptContext> CreateContext();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
virtual nsresult DropScriptObject(void *object);
|
|
|
|
virtual nsresult HoldScriptObject(void *object);
|
2008-11-26 14:54:40 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
static void Startup();
|
2008-09-11 06:20:56 -07:00
|
|
|
static void Shutdown();
|
2007-03-22 10:30:00 -07:00
|
|
|
// Setup all the statics etc - safe to call multiple times after Startup()
|
|
|
|
static nsresult Init();
|
2007-11-13 02:35:49 -08:00
|
|
|
// Get the NameSpaceManager, creating if necessary
|
|
|
|
static nsScriptNameSpaceManager* GetNameSpaceManager();
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
// An interface for fast and native conversion to/from nsIArray. If an object
|
|
|
|
// supports this interface, JS can reach directly in for the argv, and avoid
|
|
|
|
// nsISupports conversion. If this interface is not supported, the object will
|
|
|
|
// be queried for nsIArray, and everything converted via xpcom objects.
|
|
|
|
#define NS_IJSARGARRAY_IID \
|
2012-03-11 00:53:05 -08:00
|
|
|
{ 0xb6acdac8, 0xf5c6, 0x432c, \
|
|
|
|
{ 0xa8, 0x6e, 0x33, 0xee, 0xb1, 0xb0, 0xcd, 0xdc } }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-03-11 00:53:05 -08:00
|
|
|
class nsIJSArgArray : public nsIArray
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IJSARGARRAY_IID)
|
|
|
|
// Bug 312003 describes why this must be "void **", but after calling argv
|
|
|
|
// may be cast to jsval* and the args found at:
|
|
|
|
// ((jsval*)argv)[0], ..., ((jsval*)argv)[argc - 1]
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual nsresult GetArgs(uint32_t *argc, void **argv) = 0;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsIJSArgArray, NS_IJSARGARRAY_IID)
|
|
|
|
|
|
|
|
/* factory functions */
|
|
|
|
nsresult NS_CreateJSRuntime(nsIScriptRuntime **aRuntime);
|
|
|
|
|
|
|
|
/* prototypes */
|
2008-09-06 15:21:43 -07:00
|
|
|
void NS_ScriptErrorReporter(JSContext *cx, const char *message, JSErrorReport *report);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-07-17 12:09:13 -07:00
|
|
|
JSObject* NS_DOMReadStructuredClone(JSContext* cx,
|
Bug 708735 - Use <stdint.h> types in JSAPI and throughout SpiderMonkey. Continue to provide the {u,}int{8,16,32,64} and JS{Uint,Int}{8,16,32,64} integer types through a single header, however, for a simpler backout strategy -- and also to ease the transition for embedders. r=timeless on switching the jsd API to use the <stdint.h> types, r=luke, r=dmandelin
2011-12-08 19:54:10 -08:00
|
|
|
JSStructuredCloneReader* reader, uint32_t tag,
|
|
|
|
uint32_t data, void* closure);
|
2011-07-17 12:09:13 -07:00
|
|
|
|
|
|
|
JSBool NS_DOMWriteStructuredClone(JSContext* cx,
|
|
|
|
JSStructuredCloneWriter* writer,
|
|
|
|
JSObject* obj, void *closure);
|
|
|
|
|
Bug 708735 - Use <stdint.h> types in JSAPI and throughout SpiderMonkey. Continue to provide the {u,}int{8,16,32,64} and JS{Uint,Int}{8,16,32,64} integer types through a single header, however, for a simpler backout strategy -- and also to ease the transition for embedders. r=timeless on switching the jsd API to use the <stdint.h> types, r=luke, r=dmandelin
2011-12-08 19:54:10 -08:00
|
|
|
void NS_DOMStructuredCloneError(JSContext* cx, uint32_t errorid);
|
2011-07-17 12:09:13 -07:00
|
|
|
|
2011-09-18 02:22:17 -07:00
|
|
|
#endif /* nsJSEnvironment_h */
|