зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1306538 - Move js::ReportASCIIErrorWithId to AddonWrapper.cpp. r=arai
This commit is contained in:
Родитель
feb07ab5fd
Коммит
46399d1148
|
@ -1341,21 +1341,6 @@ js::ReportIsNotFunction(JSContext* cx, HandleValue v)
|
|||
return ReportIsNotFunction(cx, v, -1);
|
||||
}
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
js::ReportASCIIErrorWithId(JSContext* cx, const char* msg, HandleId id)
|
||||
{
|
||||
RootedValue idv(cx);
|
||||
if (!JS_IdToValue(cx, id, &idv))
|
||||
return;
|
||||
RootedString idstr(cx, JS::ToString(cx, idv));
|
||||
if (!idstr)
|
||||
return;
|
||||
JSAutoByteString bytes;
|
||||
if (!bytes.encodeUtf8(cx, idstr))
|
||||
return;
|
||||
JS_ReportErrorUTF8(cx, msg, bytes.ptr());
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
bool
|
||||
js::HasObjectMovedOp(JSObject* obj) {
|
||||
|
|
|
@ -2773,9 +2773,6 @@ SetPropertyIgnoringNamedGetter(JSContext* cx, JS::HandleObject obj, JS::HandleId
|
|||
JS::Handle<JS::PropertyDescriptor> ownDesc,
|
||||
JS::ObjectOpResult& result);
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
ReportASCIIErrorWithId(JSContext* cx, const char* msg, JS::HandleId id);
|
||||
|
||||
// This function is for one specific use case, please don't use this for anything else!
|
||||
extern JS_FRIEND_API(bool)
|
||||
ExecuteInGlobalAndReturnScope(JSContext* cx, JS::HandleObject obj, JS::HandleScript script,
|
||||
|
|
|
@ -23,6 +23,21 @@ using namespace JS;
|
|||
|
||||
namespace xpc {
|
||||
|
||||
static inline void
|
||||
ReportASCIIErrorWithId(JSContext* cx, const char* msg, HandleId id)
|
||||
{
|
||||
RootedValue idv(cx);
|
||||
if (!JS_IdToValue(cx, id, &idv))
|
||||
return;
|
||||
RootedString idstr(cx, JS::ToString(cx, idv));
|
||||
if (!idstr)
|
||||
return;
|
||||
JSAutoByteString bytes;
|
||||
if (!bytes.encodeUtf8(cx, idstr))
|
||||
return;
|
||||
JS_ReportErrorUTF8(cx, msg, bytes.ptr());
|
||||
}
|
||||
|
||||
bool
|
||||
InterposeProperty(JSContext* cx, HandleObject target, const nsIID* iid, HandleId id,
|
||||
MutableHandle<PropertyDescriptor> descriptor)
|
||||
|
@ -231,7 +246,7 @@ AddonWrapper<Base>::defineProperty(JSContext* cx, HandleObject wrapper, HandleId
|
|||
if (!interpDesc.object())
|
||||
return Base::defineProperty(cx, wrapper, id, desc, result);
|
||||
|
||||
js::ReportASCIIErrorWithId(cx, "unable to modify interposed property %s", id);
|
||||
ReportASCIIErrorWithId(cx, "unable to modify interposed property %s", id);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -247,7 +262,7 @@ AddonWrapper<Base>::delete_(JSContext* cx, HandleObject wrapper, HandleId id,
|
|||
if (!desc.object())
|
||||
return Base::delete_(cx, wrapper, id, result);
|
||||
|
||||
js::ReportASCIIErrorWithId(cx, "unable to delete interposed property %s", id);
|
||||
ReportASCIIErrorWithId(cx, "unable to delete interposed property %s", id);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче