Bug 951948 - Use nsXPCComponentsBase for everything but system-principaled scopes. r=mrbkap

This commit is contained in:
Bobby Holley 2014-01-14 18:49:29 -08:00
Родитель 8456c88c1c
Коммит 55527375b8
1 изменённых файлов: 7 добавлений и 2 удалений

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

@ -7,6 +7,7 @@
/* 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"
@ -132,8 +133,12 @@ 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);