mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 867414 - Rename SafeAutoJSContext to AutoSafeJSContext. r=bholley
This commit is contained in:
parent
e2c0eef9eb
commit
754efdf384
@ -491,7 +491,7 @@ nsPrincipal::SetDomain(nsIURI* aDomain)
|
||||
|
||||
// Recompute all wrappers between compartments using this principal and other
|
||||
// non-chrome compartments.
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
JSPrincipals *principals = nsJSPrincipals::get(static_cast<nsIPrincipal*>(this));
|
||||
bool success = js::RecomputeWrappers(cx, js::ContentCompartmentsOnly(),
|
||||
js::CompartmentsWithPrincipals(principals));
|
||||
|
@ -2585,7 +2585,7 @@ nsScriptSecurityManager::InitPolicies()
|
||||
}
|
||||
|
||||
// Get a JS context - we need it to create internalized strings later.
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
rv = InitDomainPolicy(cx, "default", mDefaultPolicy);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -2361,12 +2361,12 @@ private:
|
||||
};
|
||||
|
||||
/**
|
||||
* SafeAutoJSContext is similar to AutoJSContext but will only return the safe
|
||||
* AutoSafeJSContext is similar to AutoJSContext but will only return the safe
|
||||
* JS context. That means it will never call ::GetCurrentJSContext().
|
||||
*/
|
||||
class MOZ_STACK_CLASS SafeAutoJSContext : public AutoJSContext {
|
||||
class MOZ_STACK_CLASS AutoSafeJSContext : public AutoJSContext {
|
||||
public:
|
||||
SafeAutoJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
|
||||
AutoSafeJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -6805,7 +6805,7 @@ AutoJSContext::operator JSContext*()
|
||||
return mCx;
|
||||
}
|
||||
|
||||
SafeAutoJSContext::SafeAutoJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
|
||||
AutoSafeJSContext::AutoSafeJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
|
||||
: AutoJSContext(true MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)
|
||||
{
|
||||
}
|
||||
|
@ -975,7 +975,7 @@ void
|
||||
nsFrameScriptExecutor::Shutdown()
|
||||
{
|
||||
if (sCachedScripts) {
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
JSAutoRequest ar(cx);
|
||||
NS_ASSERTION(sCachedScripts != nullptr, "Need cached scripts");
|
||||
sCachedScripts->Enumerate(CachedScriptUnrooter, cx);
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "nsDOMClassInfoID.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
using mozilla::SafeAutoJSContext;
|
||||
using mozilla::AutoSafeJSContext;
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_1(nsEventListenerInfo, mListener)
|
||||
|
||||
@ -110,7 +110,7 @@ nsEventListenerInfo::ToSource(nsAString& aResult)
|
||||
{
|
||||
aResult.SetIsVoid(true);
|
||||
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
{
|
||||
// Extra block to finish the auto request before calling pop
|
||||
JSAutoRequest ar(cx);
|
||||
@ -144,7 +144,7 @@ nsEventListenerInfo::GetDebugObject(nsISupports** aRetVal)
|
||||
jsd->GetIsOn(&isOn);
|
||||
NS_ENSURE_TRUE(isOn, NS_OK);
|
||||
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
{
|
||||
// Extra block to finish the auto request before calling pop
|
||||
JSAutoRequest ar(cx);
|
||||
|
@ -1602,7 +1602,7 @@ nsDOMClassInfo::Init()
|
||||
sSecMan = sm;
|
||||
NS_ADDREF(sSecMan);
|
||||
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
|
||||
DOM_CLASSINFO_WINDOW_MAP_ENTRIES(nsGlobalWindow::HasIndexedDBSupport())
|
||||
|
@ -1317,7 +1317,7 @@ MainThreadDictionaryBase::ParseJSON(const nsAString& aJSON,
|
||||
Maybe<JSAutoCompartment>& aAc,
|
||||
Maybe< JS::Rooted<JS::Value> >& aVal)
|
||||
{
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
JS::Rooted<JSObject*> global(cx, JS_GetGlobalObject(cx));
|
||||
aAr.construct(static_cast<JSContext*>(cx));
|
||||
aAc.construct(static_cast<JSContext*>(cx), global);
|
||||
|
@ -191,7 +191,7 @@ CallbackObjectHolderBase::ToXPCOMCallback(CallbackObject* aCallback,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
|
||||
JS::Rooted<JSObject*> callback(cx, aCallback->Callback());
|
||||
|
||||
|
@ -341,7 +341,7 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
|
||||
JS::Rooted<JSObject*> obj(cx);
|
||||
if (NS_FAILED(wrappedJS->GetJSObject(obj.address())) || !obj) {
|
||||
|
@ -208,7 +208,7 @@ IDBFactory::Create(ContentParent* aContentParent,
|
||||
do_CreateInstance("@mozilla.org/nullprincipal;1");
|
||||
NS_ENSURE_TRUE(principal, NS_ERROR_FAILURE);
|
||||
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
JSAutoRequest ar(cx);
|
||||
|
||||
nsIXPConnect* xpc = nsContentUtils::XPConnect();
|
||||
|
@ -387,7 +387,7 @@ IndexedDBDatabaseParent::HandleRequestEvent(nsIDOMEvent* aEvent,
|
||||
nsIXPConnect* xpc = nsContentUtils::XPConnect();
|
||||
MOZ_ASSERT(xpc);
|
||||
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
|
||||
JS::Rooted<JS::Value> result(cx);
|
||||
rv = mOpenRequest->GetResult(result.address());
|
||||
|
@ -1926,7 +1926,7 @@ nsJSNPRuntime::OnPluginDestroy(NPP npp)
|
||||
|
||||
// Use the safe JSContext here as we're not always able to find the
|
||||
// JSContext associated with the NPP any more.
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
JSAutoRequest ar(cx);
|
||||
|
||||
if (sNPObjWrappers.ops) {
|
||||
|
@ -1262,7 +1262,7 @@ _getstringidentifier(const NPUTF8* name)
|
||||
NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_getstringidentifier called from the wrong thread\n"));
|
||||
}
|
||||
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
JSAutoRequest ar(cx);
|
||||
return doGetIdentifier(cx, name);
|
||||
}
|
||||
@ -1275,7 +1275,7 @@ _getstringidentifiers(const NPUTF8** names, int32_t nameCount,
|
||||
NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_getstringidentifiers called from the wrong thread\n"));
|
||||
}
|
||||
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
JSAutoRequest ar(cx);
|
||||
|
||||
for (int32_t i = 0; i < nameCount; ++i) {
|
||||
|
@ -22,7 +22,7 @@ PluginIdentifierParent::RecvRetain()
|
||||
mTemporaryRefs = 0;
|
||||
|
||||
// Intern the jsid if necessary.
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
JS::Rooted<jsid> id(cx, NPIdentifierToJSId(mIdentifier));
|
||||
if (JSID_IS_INT(id)) {
|
||||
return true;
|
||||
|
@ -707,7 +707,7 @@ nsGeolocationService::HandleMozsettingChanged(const PRUnichar* aData)
|
||||
// The string that we're interested in will be a JSON string that looks like:
|
||||
// {"key":"gelocation.enabled","value":true}
|
||||
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
|
||||
nsDependentString dataStr(aData);
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
|
@ -109,7 +109,7 @@ AutoMounterSetting::Observe(nsISupports* aSubject,
|
||||
// The string that we're interested in will be a JSON string that looks like:
|
||||
// {"key":"ums.autoMount","value":true}
|
||||
|
||||
mozilla::SafeAutoJSContext cx;
|
||||
mozilla::AutoSafeJSContext cx;
|
||||
nsDependentString dataStr(aData);
|
||||
JS::Value val;
|
||||
if (!JS_ParseJSON(cx, dataStr.get(), dataStr.Length(), &val) ||
|
||||
|
@ -341,7 +341,7 @@ SystemWorkerManager::Init()
|
||||
NS_ASSERTION(NS_IsMainThread(), "We can only initialize on the main thread");
|
||||
NS_ASSERTION(!mShutdown, "Already shutdown!");
|
||||
|
||||
mozilla::SafeAutoJSContext cx;
|
||||
mozilla::AutoSafeJSContext cx;
|
||||
|
||||
nsresult rv = InitWifi(cx);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -168,7 +168,7 @@ TimeZoneSettingObserver::Observe(nsISupports *aSubject,
|
||||
// The string that we're interested in will be a JSON string that looks like:
|
||||
// {"key":"time.timezone","value":"America/Chicago"}
|
||||
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
|
||||
// Parse the JSON value.
|
||||
nsDependentString dataStr(aData);
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
}
|
||||
void Notify(const SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo)
|
||||
{
|
||||
mozilla::SafeAutoJSContext cx;
|
||||
mozilla::AutoSafeJSContext cx;
|
||||
JSAutoRequest ar(cx);
|
||||
JS_ClearDateCaches(cx);
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ MOZ_STATIC_ASSERT(MAX_WORKERS_PER_DOMAIN >= 1,
|
||||
} \
|
||||
\
|
||||
if (!workers.IsEmpty()) { \
|
||||
SafeAutoJSContext cx; \
|
||||
AutoSafeJSContext cx; \
|
||||
JSAutoRequest ar(cx); \
|
||||
for (uint32_t index = 0; index < workers.Length(); index++) { \
|
||||
workers[index]-> _func (cx, __VA_ARGS__); \
|
||||
@ -1172,7 +1172,7 @@ RuntimeService::Cleanup()
|
||||
currentThread = NS_GetCurrentThread();
|
||||
NS_ASSERTION(currentThread, "This should never be null!");
|
||||
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
JSAutoRequest ar(cx);
|
||||
|
||||
for (uint32_t index = 0; index < workers.Length(); index++) {
|
||||
|
@ -76,7 +76,7 @@ using mozilla::MutexAutoLock;
|
||||
using mozilla::TimeDuration;
|
||||
using mozilla::TimeStamp;
|
||||
using mozilla::dom::workers::exceptions::ThrowDOMExceptionForNSResult;
|
||||
using mozilla::SafeAutoJSContext;
|
||||
using mozilla::AutoSafeJSContext;
|
||||
|
||||
USING_WORKERS_NAMESPACE
|
||||
using namespace mozilla::dom::workers::events;
|
||||
@ -629,7 +629,7 @@ public:
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
JSAutoRequest ar(cx);
|
||||
|
||||
mFinishedWorker->Finish(cx);
|
||||
|
@ -1119,7 +1119,7 @@ public:
|
||||
nsCOMPtr<nsIVariant> variant;
|
||||
|
||||
if (mBody.data()) {
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
JSAutoRequest ar(cx);
|
||||
nsIXPConnect* xpc = nsContentUtils::XPConnect();
|
||||
NS_ASSERTION(xpc, "This should never be null!");
|
||||
@ -1376,7 +1376,7 @@ Proxy::HandleEvent(nsIDOMEvent* aEvent)
|
||||
}
|
||||
|
||||
{
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
JSAutoRequest ar(cx);
|
||||
runnable->Dispatch(cx);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "jswrapper.h"
|
||||
|
||||
extern PRLogModuleInfo *MCD;
|
||||
using mozilla::SafeAutoJSContext;
|
||||
using mozilla::AutoSafeJSContext;
|
||||
|
||||
//*****************************************************************************
|
||||
|
||||
@ -50,7 +50,7 @@ nsresult CentralizedAdminPrefManagerInit()
|
||||
|
||||
|
||||
// Create a sandbox.
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
JSAutoRequest ar(cx);
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> sandbox;
|
||||
rv = xpc->CreateSandbox(cx, principal, getter_AddRefs(sandbox));
|
||||
@ -70,7 +70,7 @@ nsresult CentralizedAdminPrefManagerInit()
|
||||
nsresult CentralizedAdminPrefManagerFinish()
|
||||
{
|
||||
if (autoconfigSb) {
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
JSAutoRequest ar(cx);
|
||||
JSAutoCompartment(cx, autoconfigSb);
|
||||
JS_RemoveObjectRoot(cx, &autoconfigSb);
|
||||
@ -113,7 +113,7 @@ nsresult EvaluateAdminConfigScript(const char *js_buffer, size_t length,
|
||||
return rv;
|
||||
}
|
||||
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
JSAutoRequest ar(cx);
|
||||
JSAutoCompartment ac(cx, autoconfigSb);
|
||||
|
||||
|
@ -3011,7 +3011,7 @@ JSObject *
|
||||
XPCJSRuntime::GetJunkScope()
|
||||
{
|
||||
if (!mJunkScope) {
|
||||
SafeAutoJSContext cx;
|
||||
AutoSafeJSContext cx;
|
||||
SandboxOptions options(cx);
|
||||
options.sandboxName.AssignASCII("XPConnect Junk Compartment");
|
||||
JSAutoRequest ac(cx);
|
||||
|
Loading…
Reference in New Issue
Block a user