Bug 889714 - Reduce the number of places where we pull |env| off cx. r=mrbkap

This commit is contained in:
Bobby Holley 2013-07-16 20:38:45 -07:00
parent 876b1ecb3d
commit fdd9f43154
2 changed files with 12 additions and 10 deletions

View File

@ -487,14 +487,16 @@ typedef enum JSShellErrNum
#undef MSGDEF
} JSShellErrNum;
static void
ProcessFile(JSContext *cx,
JS::Handle<JSObject*> obj,
const char *filename,
FILE *file,
JSBool forceTTY)
} /* anonymous namespace */
void
XPCShellEnvironment::ProcessFile(JSContext *cx,
JS::Handle<JSObject*> obj,
const char *filename,
FILE *file,
JSBool forceTTY)
{
XPCShellEnvironment* env = Environment(cx);
XPCShellEnvironment* env = this;
nsCxPusher pusher;
pusher.Push(env->GetContext());
@ -599,8 +601,6 @@ ProcessFile(JSContext *cx,
fprintf(stdout, "\n");
}
} /* anonymous namespace */
NS_IMETHODIMP_(nsrefcnt)
XPCShellDirProvider::AddRef()
{
@ -811,7 +811,7 @@ bool
XPCShellEnvironment::EvaluateString(const nsString& aString,
nsString* aResult)
{
XPCShellEnvironment* env = Environment(mCx);
XPCShellEnvironment* env = this;
nsCxPusher pusher;
pusher.Push(env->GetContext());

View File

@ -28,6 +28,8 @@ public:
static XPCShellEnvironment* CreateEnvironment();
~XPCShellEnvironment();
void ProcessFile(JSContext *cx, JS::Handle<JSObject*> obj,
const char *filename, FILE *file, JSBool forceTTY);
bool EvaluateString(const nsString& aString,
nsString* aResult = nullptr);