mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 823348 - Use EnsureCompartmentPrivate In Rewrap and stop checking for null. r=mrbkap
This commit is contained in:
parent
72ddba04a7
commit
1aedd25af4
@ -223,7 +223,12 @@ CompartmentPrivate::~CompartmentPrivate()
|
||||
CompartmentPrivate*
|
||||
EnsureCompartmentPrivate(JSObject *obj)
|
||||
{
|
||||
JSCompartment *c = js::GetObjectCompartment(obj);
|
||||
return EnsureCompartmentPrivate(js::GetObjectCompartment(obj));
|
||||
}
|
||||
|
||||
CompartmentPrivate*
|
||||
EnsureCompartmentPrivate(JSCompartment *c)
|
||||
{
|
||||
CompartmentPrivate *priv = GetCompartmentPrivate(c);
|
||||
if (priv)
|
||||
return priv;
|
||||
|
@ -4342,6 +4342,9 @@ private:
|
||||
CompartmentPrivate*
|
||||
EnsureCompartmentPrivate(JSObject *obj);
|
||||
|
||||
CompartmentPrivate*
|
||||
EnsureCompartmentPrivate(JSCompartment *c);
|
||||
|
||||
inline CompartmentPrivate*
|
||||
GetCompartmentPrivate(JSCompartment *compartment)
|
||||
{
|
||||
|
@ -335,7 +335,7 @@ WrapperFactory::Rewrap(JSContext *cx, JSObject *existing, JSObject *obj,
|
||||
JSObject *proxyProto = wrappedProto;
|
||||
|
||||
Wrapper *wrapper;
|
||||
CompartmentPrivate *targetdata = GetCompartmentPrivate(target);
|
||||
CompartmentPrivate *targetdata = EnsureCompartmentPrivate(target);
|
||||
if (AccessCheck::isChrome(target)) {
|
||||
if (AccessCheck::isChrome(origin)) {
|
||||
wrapper = &CrossCompartmentWrapper::singleton;
|
||||
@ -368,8 +368,7 @@ WrapperFactory::Rewrap(JSContext *cx, JSObject *existing, JSObject *obj,
|
||||
}
|
||||
|
||||
XPCWrappedNative *wn;
|
||||
if (targetdata &&
|
||||
(wn = GetWrappedNative(cx, obj)) &&
|
||||
if ((wn = GetWrappedNative(cx, obj)) &&
|
||||
wn->HasProto() && wn->GetProto()->ClassIsDOMObject()) {
|
||||
wrapper = &FilteringWrapper<SecurityXrayXPCWN, CrossOriginAccessiblePropertiesOnly>::singleton;
|
||||
} else if (mozilla::dom::UseDOMXray(obj)) {
|
||||
@ -429,7 +428,7 @@ WrapperFactory::Rewrap(JSContext *cx, JSObject *existing, JSObject *obj,
|
||||
} else if (IsComponentsObject(obj)) {
|
||||
wrapper = &FilteringWrapper<CrossCompartmentSecurityWrapper,
|
||||
ComponentsObjectPolicy>::singleton;
|
||||
} else if (!targetdata || !targetdata->wantXrays ||
|
||||
} else if (!targetdata->wantXrays ||
|
||||
(type = GetXrayType(obj)) == NotXray) {
|
||||
wrapper = &CrossCompartmentWrapper::singleton;
|
||||
} else if (type == XrayForDOMObject) {
|
||||
|
Loading…
Reference in New Issue
Block a user