mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 889714 - Stop manually holding onto system JSPrincipals. r=mrbkap
This commit is contained in:
parent
57ca6f634f
commit
8799208e0d
@ -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;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user