зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1162772, part 1 - Allow CompartmentCreationOptions to store Secure Context state. r=jorendorff
MozReview-Commit-ID: 4edUIF2rcBR
This commit is contained in:
Родитель
42f9c7021b
Коммит
9f2ce06d3b
|
@ -2216,7 +2216,8 @@ class JS_PUBLIC_API(CompartmentCreationOptions)
|
|||
preserveJitCode_(false),
|
||||
cloneSingletons_(false),
|
||||
experimentalDateTimeFormatFormatToPartsEnabled_(false),
|
||||
sharedMemoryAndAtomics_(false)
|
||||
sharedMemoryAndAtomics_(false),
|
||||
secureContext_(false)
|
||||
{
|
||||
zone_.spec = JS::FreshZone;
|
||||
}
|
||||
|
@ -2299,6 +2300,16 @@ class JS_PUBLIC_API(CompartmentCreationOptions)
|
|||
bool getSharedMemoryAndAtomicsEnabled() const;
|
||||
CompartmentCreationOptions& setSharedMemoryAndAtomicsEnabled(bool flag);
|
||||
|
||||
// This flag doesn't affect JS engine behavior. It is used by Gecko to
|
||||
// mark whether content windows and workers are "Secure Context"s. See
|
||||
// https://w3c.github.io/webappsec-secure-contexts/
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1162772#c34
|
||||
bool secureContext() const { return secureContext_; }
|
||||
CompartmentCreationOptions& setSecureContext(bool flag) {
|
||||
secureContext_ = flag;
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
JSAddonId* addonId_;
|
||||
JSTraceOp traceGlobal_;
|
||||
|
@ -2312,6 +2323,7 @@ class JS_PUBLIC_API(CompartmentCreationOptions)
|
|||
bool cloneSingletons_;
|
||||
bool experimentalDateTimeFormatFormatToPartsEnabled_;
|
||||
bool sharedMemoryAndAtomics_;
|
||||
bool secureContext_;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -143,6 +143,12 @@ JS_NewObjectWithoutMetadata(JSContext* cx, const JSClass* clasp, JS::Handle<JSOb
|
|||
return JS_NewObjectWithGivenProto(cx, clasp, proto);
|
||||
}
|
||||
|
||||
JS_FRIEND_API(bool)
|
||||
JS_GetIsSecureContext(JSCompartment* compartment)
|
||||
{
|
||||
return compartment->creationOptions().secureContext();
|
||||
}
|
||||
|
||||
JS_FRIEND_API(JSPrincipals*)
|
||||
JS_GetCompartmentPrincipals(JSCompartment* compartment)
|
||||
{
|
||||
|
|
|
@ -147,6 +147,9 @@ typedef void
|
|||
extern JS_FRIEND_API(void)
|
||||
JS_SetAccumulateTelemetryCallback(JSRuntime* rt, JSAccumulateTelemetryDataCallback callback);
|
||||
|
||||
extern JS_FRIEND_API(bool)
|
||||
JS_GetIsSecureContext(JSCompartment* compartment);
|
||||
|
||||
extern JS_FRIEND_API(JSPrincipals*)
|
||||
JS_GetCompartmentPrincipals(JSCompartment* compartment);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче