Files
palemoon27/ipc/testshell/XPCShellEnvironment.h
T
roytam1 95ffc37bac import change from rmottola/Arctic-Fox:
- Bug 1097987 part 1. Change some JS shell function signatures to make it clearer that they are always working with globals, not arbitrary objects. (5f45873a2)
- Bug 1097987 part 2. Change JS shell's Run to always compile/execute the script in global scope instead of using its this object. (807880f9e)
- Bug 1097987 part 3. Change XPCShellEnvironment to only use JS_ExecuteScript in global scopes. (7cffe2855)
- Bug 1097987 part 4. Change mozJSSubScriptLoader to use the scopechain version of JS_ExecuteScript as needed. (3abe5d5c9)
- Bug 1097987 part 5. Change XPCShellImpl to use the scopechain version of JS_ExecuteScript as needed. (4642566c3)
- Bug 1097987 part 6. Require callers of JS_ExecuteScript to either use the global as the scope or pass in an explicit scopechain. (c4a2a811f)
- Bug 1097987 part 7. Require callers of JS::Evaluate to either use the global as the scope or pass in an explicit scopechain. (694c09eb3)
- Bug 1143793 part 1. Remove the obj argument of JS_CompileScript. (929d8fd58)
- Bug 1143793 part 2. Remove the obj argument of JS_CompileUCScript. (9c577f67c)
- Bug 1143793 part 3. Stop passing null as the obj argument of JS::Compile. (86a715f63)
- Bug 1143793 part 4. Stop supporting load.call(somerandomobj) in xpcshell. r=bholley (ed2bc21b4)
- Bug 1143793 part 5. Release-assert that a script being executed against a non-global scopechain is not compileAndGo. (bcb9ae600)
- Bug 1143793 part 6. Drop the obj argument of JS::Compile. This is technically a behavior change for the shell's disfile() function, but I really doubt anyone is doing disfile.call(someObj). (5f99a59bd)
- pointer style (c02ff21de)
- Bug 1135039: Apply swizzle type policy changes in Ion too (effc49369)
- pointer style again (b47813875)
2019-04-25 10:00:04 +08:00

65 lines
1.4 KiB
C++

/* 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/. */
#ifndef _IPC_TESTSHELL_XPCSHELLENVIRONMENT_H_
#define _IPC_TESTSHELL_XPCSHELLENVIRONMENT_H_
#include "base/basictypes.h"
#include <string>
#include <stdio.h>
#include "nsCOMPtr.h"
#include "nsDebug.h"
#include "nsString.h"
#include "nsJSPrincipals.h"
#include "nsContentUtils.h"
#include "js/RootingAPI.h"
#include "js/TypeDecls.h"
struct JSPrincipals;
namespace mozilla {
namespace ipc {
class XPCShellEnvironment
{
public:
static XPCShellEnvironment* CreateEnvironment();
~XPCShellEnvironment();
void ProcessFile(JSContext *cx, const char *filename, FILE *file, bool forceTTY);
bool EvaluateString(const nsString& aString,
nsString* aResult = nullptr);
JSPrincipals* GetPrincipal() {
return nsJSPrincipals::get(nsContentUtils::GetSystemPrincipal());
}
JSObject* GetGlobalObject() {
return mGlobalHolder;
}
void SetIsQuitting() {
mQuitting = true;
}
bool IsQuitting() {
return mQuitting;
}
protected:
XPCShellEnvironment();
bool Init();
private:
JS::PersistentRooted<JSObject *> mGlobalHolder;
bool mQuitting;
};
} /* namespace ipc */
} /* namespace mozilla */
#endif /* _IPC_TESTSHELL_XPCSHELLENVIRONMENT_H_ */