author | Bobby Holley <bobbyholley@gmail.com> |
Tue, 14 Jan 2014 18:49:29 -0800 | |
changeset 163437 | 707abbb92a8ba920caae74fdaf9dc62e6364bc66 |
parent 163436 | b61deb1bee05550378eb468c0bf4b2d9b7163e80 |
child 163438 | 7cc30ae56811cae75aecc277251d1272f9ad2cc8 |
push id | 25996 |
push user | emorley@mozilla.com |
push date | Wed, 15 Jan 2014 15:54:39 +0000 |
treeherder | mozilla-central@dd2cf81c56b7 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mrbkap |
bugs | 951948 |
milestone | 29.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/js/xpconnect/src/XPCWrappedNativeScope.cpp +++ b/js/xpconnect/src/XPCWrappedNativeScope.cpp @@ -2,16 +2,17 @@ * vim: set ts=8 sw=4 et tw=78: * 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/. */ /* Class used to manage the wrapped native objects within a JS scope. */ #include "xpcprivate.h" +#include "XPCWrapper.h" #include "nsContentUtils.h" #include "nsCycleCollectionNoteRootCallback.h" #include "nsPrincipal.h" #include "mozilla/MemoryReporting.h" #include "mozilla/Preferences.h" #include "mozilla/dom/BindingUtils.h" @@ -127,18 +128,22 @@ XPCWrappedNativeScope::IsDyingScope(XPCW } return false; } JSObject* XPCWrappedNativeScope::GetComponentsJSObject() { AutoJSContext cx; - if (!mComponents) - mComponents = new nsXPCComponents(this); + if (!mComponents) { + nsIPrincipal *p = GetPrincipal(); + bool system = XPCWrapper::GetSecurityManager()->IsSystemPrincipal(p); + mComponents = system ? new nsXPCComponents(this) + : new nsXPCComponentsBase(this); + } RootedValue val(cx); xpcObjectHelper helper(mComponents); bool ok = XPCConvert::NativeInterface2JSObject(&val, nullptr, helper, nullptr, nullptr, false, nullptr); if (NS_WARN_IF(!ok)) return nullptr;