зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1164764 - Make all the various DeadObjectProxy handler methods call a single function to report a dead object, rather than repeating the same function call/arguments everywhere. r=evilpies
--HG-- extra : rebase_source : 29bff897378a0d7a9e9ca60da3f2360ff54b8334
This commit is contained in:
Родитель
83591bfe77
Коммит
76df03b3d7
|
@ -14,11 +14,17 @@
|
||||||
using namespace js;
|
using namespace js;
|
||||||
using namespace js::gc;
|
using namespace js::gc;
|
||||||
|
|
||||||
|
static void
|
||||||
|
ReportDead(JSContext *cx)
|
||||||
|
{
|
||||||
|
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DeadObjectProxy::getOwnPropertyDescriptor(JSContext* cx, HandleObject wrapper, HandleId id,
|
DeadObjectProxy::getOwnPropertyDescriptor(JSContext* cx, HandleObject wrapper, HandleId id,
|
||||||
MutableHandle<PropertyDescriptor> desc) const
|
MutableHandle<PropertyDescriptor> desc) const
|
||||||
{
|
{
|
||||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
|
ReportDead(cx);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +33,7 @@ DeadObjectProxy::defineProperty(JSContext* cx, HandleObject wrapper, HandleId id
|
||||||
Handle<PropertyDescriptor> desc,
|
Handle<PropertyDescriptor> desc,
|
||||||
ObjectOpResult& result) const
|
ObjectOpResult& result) const
|
||||||
{
|
{
|
||||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
|
ReportDead(cx);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +41,7 @@ bool
|
||||||
DeadObjectProxy::ownPropertyKeys(JSContext* cx, HandleObject wrapper,
|
DeadObjectProxy::ownPropertyKeys(JSContext* cx, HandleObject wrapper,
|
||||||
AutoIdVector& props) const
|
AutoIdVector& props) const
|
||||||
{
|
{
|
||||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
|
ReportDead(cx);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,14 +49,14 @@ bool
|
||||||
DeadObjectProxy::delete_(JSContext* cx, HandleObject wrapper, HandleId id,
|
DeadObjectProxy::delete_(JSContext* cx, HandleObject wrapper, HandleId id,
|
||||||
ObjectOpResult& result) const
|
ObjectOpResult& result) const
|
||||||
{
|
{
|
||||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
|
ReportDead(cx);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DeadObjectProxy::enumerate(JSContext* cx, HandleObject wrapper, MutableHandleObject objp) const
|
DeadObjectProxy::enumerate(JSContext* cx, HandleObject wrapper, MutableHandleObject objp) const
|
||||||
{
|
{
|
||||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
|
ReportDead(cx);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +70,7 @@ DeadObjectProxy::getPrototype(JSContext* cx, HandleObject proxy, MutableHandleOb
|
||||||
bool
|
bool
|
||||||
DeadObjectProxy::preventExtensions(JSContext* cx, HandleObject proxy, ObjectOpResult& result) const
|
DeadObjectProxy::preventExtensions(JSContext* cx, HandleObject proxy, ObjectOpResult& result) const
|
||||||
{
|
{
|
||||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
|
ReportDead(cx);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,14 +86,14 @@ DeadObjectProxy::isExtensible(JSContext* cx, HandleObject proxy, bool* extensibl
|
||||||
bool
|
bool
|
||||||
DeadObjectProxy::call(JSContext* cx, HandleObject wrapper, const CallArgs& args) const
|
DeadObjectProxy::call(JSContext* cx, HandleObject wrapper, const CallArgs& args) const
|
||||||
{
|
{
|
||||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
|
ReportDead(cx);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DeadObjectProxy::construct(JSContext* cx, HandleObject wrapper, const CallArgs& args) const
|
DeadObjectProxy::construct(JSContext* cx, HandleObject wrapper, const CallArgs& args) const
|
||||||
{
|
{
|
||||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
|
ReportDead(cx);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +101,7 @@ bool
|
||||||
DeadObjectProxy::nativeCall(JSContext* cx, IsAcceptableThis test, NativeImpl impl,
|
DeadObjectProxy::nativeCall(JSContext* cx, IsAcceptableThis test, NativeImpl impl,
|
||||||
CallArgs args) const
|
CallArgs args) const
|
||||||
{
|
{
|
||||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
|
ReportDead(cx);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,14 +109,14 @@ bool
|
||||||
DeadObjectProxy::hasInstance(JSContext* cx, HandleObject proxy, MutableHandleValue v,
|
DeadObjectProxy::hasInstance(JSContext* cx, HandleObject proxy, MutableHandleValue v,
|
||||||
bool* bp) const
|
bool* bp) const
|
||||||
{
|
{
|
||||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
|
ReportDead(cx);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DeadObjectProxy::objectClassIs(HandleObject obj, ESClassValue classValue, JSContext* cx) const
|
DeadObjectProxy::objectClassIs(HandleObject obj, ESClassValue classValue, JSContext* cx) const
|
||||||
{
|
{
|
||||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
|
ReportDead(cx);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,13 +129,14 @@ DeadObjectProxy::className(JSContext* cx, HandleObject wrapper) const
|
||||||
JSString*
|
JSString*
|
||||||
DeadObjectProxy::fun_toString(JSContext* cx, HandleObject proxy, unsigned indent) const
|
DeadObjectProxy::fun_toString(JSContext* cx, HandleObject proxy, unsigned indent) const
|
||||||
{
|
{
|
||||||
|
ReportDead(cx);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DeadObjectProxy::regexp_toShared(JSContext* cx, HandleObject proxy, RegExpGuard* g) const
|
DeadObjectProxy::regexp_toShared(JSContext* cx, HandleObject proxy, RegExpGuard* g) const
|
||||||
{
|
{
|
||||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
|
ReportDead(cx);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +144,7 @@ bool
|
||||||
DeadObjectProxy::defaultValue(JSContext* cx, HandleObject obj, JSType hint,
|
DeadObjectProxy::defaultValue(JSContext* cx, HandleObject obj, JSType hint,
|
||||||
MutableHandleValue vp) const
|
MutableHandleValue vp) const
|
||||||
{
|
{
|
||||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
|
ReportDead(cx);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,18 @@
|
||||||
|
|
||||||
using namespace js;
|
using namespace js;
|
||||||
|
|
||||||
|
static void
|
||||||
|
ReportUnwrapDenied(JSContext *cx)
|
||||||
|
{
|
||||||
|
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED);
|
||||||
|
}
|
||||||
|
|
||||||
template <class Base>
|
template <class Base>
|
||||||
bool
|
bool
|
||||||
SecurityWrapper<Base>::enter(JSContext* cx, HandleObject wrapper, HandleId id,
|
SecurityWrapper<Base>::enter(JSContext* cx, HandleObject wrapper, HandleId id,
|
||||||
Wrapper::Action act, bool* bp) const
|
Wrapper::Action act, bool* bp) const
|
||||||
{
|
{
|
||||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED);
|
ReportUnwrapDenied(cx);
|
||||||
*bp = false;
|
*bp = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -26,7 +32,7 @@ bool
|
||||||
SecurityWrapper<Base>::nativeCall(JSContext* cx, IsAcceptableThis test, NativeImpl impl,
|
SecurityWrapper<Base>::nativeCall(JSContext* cx, IsAcceptableThis test, NativeImpl impl,
|
||||||
CallArgs args) const
|
CallArgs args) const
|
||||||
{
|
{
|
||||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED);
|
ReportUnwrapDenied(cx);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +41,7 @@ bool
|
||||||
SecurityWrapper<Base>::setPrototype(JSContext* cx, HandleObject wrapper, HandleObject proto,
|
SecurityWrapper<Base>::setPrototype(JSContext* cx, HandleObject wrapper, HandleObject proto,
|
||||||
ObjectOpResult& result) const
|
ObjectOpResult& result) const
|
||||||
{
|
{
|
||||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED);
|
ReportUnwrapDenied(cx);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +50,7 @@ bool
|
||||||
SecurityWrapper<Base>::setImmutablePrototype(JSContext* cx, HandleObject wrapper,
|
SecurityWrapper<Base>::setImmutablePrototype(JSContext* cx, HandleObject wrapper,
|
||||||
bool* succeeded) const
|
bool* succeeded) const
|
||||||
{
|
{
|
||||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED);
|
ReportUnwrapDenied(cx);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +135,7 @@ bool
|
||||||
SecurityWrapper<Base>::watch(JSContext* cx, HandleObject proxy,
|
SecurityWrapper<Base>::watch(JSContext* cx, HandleObject proxy,
|
||||||
HandleId id, HandleObject callable) const
|
HandleId id, HandleObject callable) const
|
||||||
{
|
{
|
||||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED);
|
ReportUnwrapDenied(cx);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +144,7 @@ bool
|
||||||
SecurityWrapper<Base>::unwatch(JSContext* cx, HandleObject proxy,
|
SecurityWrapper<Base>::unwatch(JSContext* cx, HandleObject proxy,
|
||||||
HandleId id) const
|
HandleId id) const
|
||||||
{
|
{
|
||||||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED);
|
ReportUnwrapDenied(cx);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче