зеркало из https://github.com/mozilla/gecko-dev.git
Bug 889714 - Stop manually holding onto system JSPrincipals. r=mrbkap
This commit is contained in:
Родитель
5b7d51783b
Коммит
9bc9976c78
|
@ -657,7 +657,6 @@ XPCShellEnvironment::CreateEnvironment()
|
|||
|
||||
XPCShellEnvironment::XPCShellEnvironment()
|
||||
: mCx(NULL),
|
||||
mJSPrincipals(NULL),
|
||||
mQuitting(JS_FALSE)
|
||||
{
|
||||
}
|
||||
|
@ -676,10 +675,6 @@ XPCShellEnvironment::~XPCShellEnvironment()
|
|||
JSRuntime *rt = JS_GetRuntime(mCx);
|
||||
JS_GC(rt);
|
||||
|
||||
if (mJSPrincipals) {
|
||||
JS_DropPrincipals(rt, mJSPrincipals);
|
||||
}
|
||||
|
||||
JS_EndRequest(mCx);
|
||||
JS_DestroyContext(mCx);
|
||||
|
||||
|
@ -749,10 +744,6 @@ XPCShellEnvironment::Init()
|
|||
rv = securityManager->GetSystemPrincipal(getter_AddRefs(principal));
|
||||
if (NS_FAILED(rv)) {
|
||||
fprintf(stderr, "+++ Failed to obtain SystemPrincipal from ScriptSecurityManager service.\n");
|
||||
} else {
|
||||
// fetch the JS principals and stick in a global
|
||||
mJSPrincipals = nsJSPrincipals::get(principal);
|
||||
JS_HoldPrincipals(mJSPrincipals);
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "+++ Failed to get ScriptSecurityManager service, running without principals");
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsJSPrincipals.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
struct JSContext;
|
||||
class JSObject;
|
||||
|
@ -34,7 +36,7 @@ public:
|
|||
nsString* aResult = nullptr);
|
||||
|
||||
JSPrincipals* GetPrincipal() {
|
||||
return mJSPrincipals;
|
||||
return nsJSPrincipals::get(nsContentUtils::GetSystemPrincipal());
|
||||
}
|
||||
|
||||
JSObject* GetGlobalObject() {
|
||||
|
@ -59,7 +61,6 @@ protected:
|
|||
private:
|
||||
JSContext* mCx;
|
||||
nsAutoJSValHolder mGlobalHolder;
|
||||
JSPrincipals* mJSPrincipals;
|
||||
|
||||
JSBool mQuitting;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче