Bug 1335368 part 21. Get rid of some IsCallerChrome usage in XPConnect. r=bholley

This commit is contained in:
Boris Zbarsky 2017-02-01 15:43:59 -05:00
Родитель 0b2adf1427
Коммит 970a120fb5
3 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -1274,7 +1274,7 @@ XPCJSContext::InterruptCallback(JSContext* cx)
// returning to the event loop. See how long it's been, and what the limit
// is.
TimeDuration duration = TimeStamp::NowLoRes() - self->mSlowScriptCheckpoint;
bool chrome = nsContentUtils::IsCallerChrome();
bool chrome = nsContentUtils::IsSystemCaller(cx);
const char* prefName = chrome ? PREF_MAX_SCRIPT_RUN_TIME_CHROME
: PREF_MAX_SCRIPT_RUN_TIME_CONTENT;
int32_t limit = Preferences::GetInt(prefName, chrome ? 20 : 10);
@ -3225,7 +3225,7 @@ class XPCJSSourceHook: public js::SourceHook {
*src = nullptr;
*length = 0;
if (!nsContentUtils::IsCallerChrome())
if (!nsContentUtils::IsSystemCaller(cx))
return true;
if (!filename)

Просмотреть файл

@ -200,7 +200,7 @@ XPC_WN_DoubleWrappedGetter(JSContext* cx, unsigned argc, Value* vp)
// It is a double wrapped object. This should really never appear in
// content these days, but addons still do it - see bug 965921.
if (MOZ_UNLIKELY(!nsContentUtils::IsCallerChrome())) {
if (MOZ_UNLIKELY(!nsContentUtils::IsSystemCaller(cx))) {
JS_ReportErrorASCII(cx, "Attempt to use .wrappedJSObject in untrusted code");
return false;
}

Просмотреть файл

@ -1134,7 +1134,7 @@ ReadScriptOrFunction(nsIObjectInputStream* stream, JSContext* cx,
// We don't serialize mutedError-ness of scripts, which is fine as long as
// we only serialize system and XUL-y things. We can detect this by checking
// where the caller wants us to deserialize.
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome() ||
MOZ_RELEASE_ASSERT(nsContentUtils::IsSystemCaller(cx) ||
CurrentGlobalOrNull(cx) == xpc::CompilationScope());
uint32_t size;