From fdd9f43154c7a8dd81416031320b15297e87bb4d Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Tue, 16 Jul 2013 20:38:45 -0700 Subject: [PATCH] Bug 889714 - Reduce the number of places where we pull |env| off cx. r=mrbkap --- ipc/testshell/XPCShellEnvironment.cpp | 20 ++++++++++---------- ipc/testshell/XPCShellEnvironment.h | 2 ++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/ipc/testshell/XPCShellEnvironment.cpp b/ipc/testshell/XPCShellEnvironment.cpp index 51fcd411c1e..eed33a0ee61 100644 --- a/ipc/testshell/XPCShellEnvironment.cpp +++ b/ipc/testshell/XPCShellEnvironment.cpp @@ -487,14 +487,16 @@ typedef enum JSShellErrNum #undef MSGDEF } JSShellErrNum; -static void -ProcessFile(JSContext *cx, - JS::Handle obj, - const char *filename, - FILE *file, - JSBool forceTTY) +} /* anonymous namespace */ + +void +XPCShellEnvironment::ProcessFile(JSContext *cx, + JS::Handle 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()); diff --git a/ipc/testshell/XPCShellEnvironment.h b/ipc/testshell/XPCShellEnvironment.h index 98d068e1112..43674bd5c70 100644 --- a/ipc/testshell/XPCShellEnvironment.h +++ b/ipc/testshell/XPCShellEnvironment.h @@ -28,6 +28,8 @@ public: static XPCShellEnvironment* CreateEnvironment(); ~XPCShellEnvironment(); + void ProcessFile(JSContext *cx, JS::Handle obj, + const char *filename, FILE *file, JSBool forceTTY); bool EvaluateString(const nsString& aString, nsString* aResult = nullptr);