mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
Bug 771908 - Get rid of Wrapper::leave; r=bholley, sr=mrbkap
This commit is contained in:
parent
1a49fcfa1a
commit
90aa687a21
@ -80,11 +80,6 @@ Wrapper::enter(JSContext *cx, JSObject *wrapper, jsid id, Action act, bool *bp)
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
Wrapper::leave(JSContext *cx, JSObject *wrapper)
|
||||
{
|
||||
}
|
||||
|
||||
JS_FRIEND_API(JSObject *)
|
||||
js::UnwrapObject(JSObject *wrapped, bool stopAtOuter, unsigned *flagsp)
|
||||
{
|
||||
@ -112,7 +107,6 @@ js::UnwrapObjectChecked(JSContext *cx, JSObject *obj)
|
||||
return rvOnFailure ? obj : NULL;
|
||||
obj = Wrapper::wrappedObject(obj);
|
||||
JS_ASSERT(obj);
|
||||
handler->leave(cx, wrapper);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
@ -134,9 +128,7 @@ IndirectWrapper::IndirectWrapper(unsigned flags) : Wrapper(flags),
|
||||
bool status; \
|
||||
if (!enter(cx, wrapper, id, act, &status)) \
|
||||
return status; \
|
||||
bool ok = (op); \
|
||||
leave(cx, wrapper); \
|
||||
return ok; \
|
||||
return (op); \
|
||||
JS_END_MACRO
|
||||
|
||||
#define SET(action) CHECKED(action, SET)
|
||||
@ -338,7 +330,6 @@ DirectWrapper::obj_toString(JSContext *cx, JSObject *wrapper)
|
||||
return NULL;
|
||||
}
|
||||
JSString *str = IndirectProxyHandler::obj_toString(cx, wrapper);
|
||||
leave(cx, wrapper);
|
||||
return str;
|
||||
}
|
||||
|
||||
@ -357,7 +348,6 @@ DirectWrapper::fun_toString(JSContext *cx, JSObject *wrapper, unsigned indent)
|
||||
return NULL;
|
||||
}
|
||||
JSString *str = IndirectProxyHandler::fun_toString(cx, wrapper, indent);
|
||||
leave(cx, wrapper);
|
||||
return str;
|
||||
}
|
||||
|
||||
|
@ -94,10 +94,6 @@ class JS_FRIEND_API(Wrapper)
|
||||
* on the underlying object's |id| property. In the case when |act| is CALL,
|
||||
* |id| is generally JSID_VOID.
|
||||
*
|
||||
* leave() allows the policy to undo various scoped state changes taken in
|
||||
* enter(). If enter() succeeds, leave() must be called upon completion of
|
||||
* the approved action.
|
||||
*
|
||||
* The |act| parameter to enter() specifies the action being performed. GET,
|
||||
* SET, and CALL are self-explanatory, but PUNCTURE requires more
|
||||
* explanation:
|
||||
@ -119,8 +115,6 @@ class JS_FRIEND_API(Wrapper)
|
||||
*/
|
||||
virtual bool enter(JSContext *cx, JSObject *wrapper, jsid id, Action act,
|
||||
bool *bp);
|
||||
|
||||
virtual void leave(JSContext *cx, JSObject *wrapper);
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -776,24 +776,6 @@ ContentScriptHasUniversalXPConnect()
|
||||
return false;
|
||||
}
|
||||
|
||||
class AutoLeaveHelper
|
||||
{
|
||||
public:
|
||||
AutoLeaveHelper(js::Wrapper &xray, JSContext *cx, JSObject *wrapper)
|
||||
: xray(xray), cx(cx), wrapper(wrapper)
|
||||
{
|
||||
}
|
||||
~AutoLeaveHelper()
|
||||
{
|
||||
xray.leave(cx, wrapper);
|
||||
}
|
||||
|
||||
private:
|
||||
js::Wrapper &xray;
|
||||
JSContext *cx;
|
||||
JSObject *wrapper;
|
||||
};
|
||||
|
||||
bool
|
||||
XPCWrappedNativeXrayTraits::resolveOwnProperty(JSContext *cx, js::Wrapper &jsWrapper,
|
||||
JSObject *wrapper, JSObject *holder, jsid id,
|
||||
@ -816,8 +798,6 @@ XPCWrappedNativeXrayTraits::resolveOwnProperty(JSContext *cx, js::Wrapper &jsWra
|
||||
if (!jsWrapper.enter(cx, wrapper, id, action, &status))
|
||||
return status;
|
||||
|
||||
AutoLeaveHelper helper(jsWrapper, cx, wrapper);
|
||||
|
||||
desc->obj = wrapper;
|
||||
desc->attrs = JSPROP_ENUMERATE|JSPROP_SHARED;
|
||||
if (id == rt->GetStringID(XPCJSRuntime::IDX_BASEURIOBJECT))
|
||||
@ -1263,8 +1243,6 @@ XrayWrapper<Base, Traits>::getPropertyDescriptor(JSContext *cx, JSObject *wrappe
|
||||
if (!this->enter(cx, wrapper, id, action, &status))
|
||||
return status;
|
||||
|
||||
AutoLeaveHelper helper(*this, cx, wrapper);
|
||||
|
||||
typename Traits::ResolvingId resolving(wrapper, id);
|
||||
|
||||
// Redirect access straight to the wrapper if we should be transparent.
|
||||
@ -1301,8 +1279,6 @@ XrayWrapper<Base, Traits>::getPropertyDescriptor(JSContext *cx, JSObject *wrappe
|
||||
if (!this->enter(cx, wrapper, id, action, &status))
|
||||
return status;
|
||||
|
||||
AutoLeaveHelper helper(*this, cx, wrapper);
|
||||
|
||||
desc->obj = wrapper;
|
||||
desc->attrs = JSPROP_ENUMERATE|JSPROP_SHARED;
|
||||
desc->getter = wrappedJSObject_getter;
|
||||
@ -1369,8 +1345,6 @@ XrayWrapper<Base, Traits>::getOwnPropertyDescriptor(JSContext *cx, JSObject *wra
|
||||
if (!this->enter(cx, wrapper, id, action, &status))
|
||||
return status;
|
||||
|
||||
AutoLeaveHelper helper(*this, cx, wrapper);
|
||||
|
||||
typename Traits::ResolvingId resolving(wrapper, id);
|
||||
|
||||
// NB: Nothing we do here acts on the wrapped native itself, so we don't
|
||||
|
Loading…
Reference in New Issue
Block a user