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:
Jeff Walden 2014-10-22 08:42:25 -07:00
Родитель 83591bfe77
Коммит 76df03b3d7
2 изменённых файлов: 32 добавлений и 19 удалений

Просмотреть файл

@ -14,11 +14,17 @@
using namespace js;
using namespace js::gc;
static void
ReportDead(JSContext *cx)
{
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
}
bool
DeadObjectProxy::getOwnPropertyDescriptor(JSContext* cx, HandleObject wrapper, HandleId id,
MutableHandle<PropertyDescriptor> desc) const
{
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
ReportDead(cx);
return false;
}
@ -27,7 +33,7 @@ DeadObjectProxy::defineProperty(JSContext* cx, HandleObject wrapper, HandleId id
Handle<PropertyDescriptor> desc,
ObjectOpResult& result) const
{
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
ReportDead(cx);
return false;
}
@ -35,7 +41,7 @@ bool
DeadObjectProxy::ownPropertyKeys(JSContext* cx, HandleObject wrapper,
AutoIdVector& props) const
{
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
ReportDead(cx);
return false;
}
@ -43,14 +49,14 @@ bool
DeadObjectProxy::delete_(JSContext* cx, HandleObject wrapper, HandleId id,
ObjectOpResult& result) const
{
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
ReportDead(cx);
return false;
}
bool
DeadObjectProxy::enumerate(JSContext* cx, HandleObject wrapper, MutableHandleObject objp) const
{
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
ReportDead(cx);
return false;
}
@ -64,7 +70,7 @@ DeadObjectProxy::getPrototype(JSContext* cx, HandleObject proxy, MutableHandleOb
bool
DeadObjectProxy::preventExtensions(JSContext* cx, HandleObject proxy, ObjectOpResult& result) const
{
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
ReportDead(cx);
return false;
}
@ -80,14 +86,14 @@ DeadObjectProxy::isExtensible(JSContext* cx, HandleObject proxy, bool* extensibl
bool
DeadObjectProxy::call(JSContext* cx, HandleObject wrapper, const CallArgs& args) const
{
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
ReportDead(cx);
return false;
}
bool
DeadObjectProxy::construct(JSContext* cx, HandleObject wrapper, const CallArgs& args) const
{
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
ReportDead(cx);
return false;
}
@ -95,7 +101,7 @@ bool
DeadObjectProxy::nativeCall(JSContext* cx, IsAcceptableThis test, NativeImpl impl,
CallArgs args) const
{
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
ReportDead(cx);
return false;
}
@ -103,14 +109,14 @@ bool
DeadObjectProxy::hasInstance(JSContext* cx, HandleObject proxy, MutableHandleValue v,
bool* bp) const
{
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
ReportDead(cx);
return false;
}
bool
DeadObjectProxy::objectClassIs(HandleObject obj, ESClassValue classValue, JSContext* cx) const
{
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
ReportDead(cx);
return false;
}
@ -123,13 +129,14 @@ DeadObjectProxy::className(JSContext* cx, HandleObject wrapper) const
JSString*
DeadObjectProxy::fun_toString(JSContext* cx, HandleObject proxy, unsigned indent) const
{
ReportDead(cx);
return nullptr;
}
bool
DeadObjectProxy::regexp_toShared(JSContext* cx, HandleObject proxy, RegExpGuard* g) const
{
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
ReportDead(cx);
return false;
}
@ -137,7 +144,7 @@ bool
DeadObjectProxy::defaultValue(JSContext* cx, HandleObject obj, JSType hint,
MutableHandleValue vp) const
{
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
ReportDead(cx);
return false;
}

Просмотреть файл

@ -11,12 +11,18 @@
using namespace js;
static void
ReportUnwrapDenied(JSContext *cx)
{
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED);
}
template <class Base>
bool
SecurityWrapper<Base>::enter(JSContext* cx, HandleObject wrapper, HandleId id,
Wrapper::Action act, bool* bp) const
{
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED);
ReportUnwrapDenied(cx);
*bp = false;
return false;
}
@ -26,7 +32,7 @@ bool
SecurityWrapper<Base>::nativeCall(JSContext* cx, IsAcceptableThis test, NativeImpl impl,
CallArgs args) const
{
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED);
ReportUnwrapDenied(cx);
return false;
}
@ -35,7 +41,7 @@ bool
SecurityWrapper<Base>::setPrototype(JSContext* cx, HandleObject wrapper, HandleObject proto,
ObjectOpResult& result) const
{
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED);
ReportUnwrapDenied(cx);
return false;
}
@ -44,7 +50,7 @@ bool
SecurityWrapper<Base>::setImmutablePrototype(JSContext* cx, HandleObject wrapper,
bool* succeeded) const
{
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED);
ReportUnwrapDenied(cx);
return false;
}
@ -129,7 +135,7 @@ bool
SecurityWrapper<Base>::watch(JSContext* cx, HandleObject proxy,
HandleId id, HandleObject callable) const
{
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED);
ReportUnwrapDenied(cx);
return false;
}
@ -138,7 +144,7 @@ bool
SecurityWrapper<Base>::unwatch(JSContext* cx, HandleObject proxy,
HandleId id) const
{
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED);
ReportUnwrapDenied(cx);
return false;
}