Bug 899804 - Make CPOWs handle instanceof with WebIDL interfaces (r=bz,dvander)
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "JavaScriptChild.h"
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "xpcprivate.h"
|
||||
#include "jsfriendapi.h"
|
||||
@@ -625,3 +626,27 @@ JavaScriptChild::AnswerInstanceOf(const ObjectId &objId, const JSIID &iid, Retur
|
||||
|
||||
return ok(rs);
|
||||
}
|
||||
|
||||
bool
|
||||
JavaScriptChild::AnswerDOMInstanceOf(const ObjectId &objId, const int &prototypeID,
|
||||
const int &depth,
|
||||
ReturnStatus *rs, bool *instanceof)
|
||||
{
|
||||
AutoSafeJSContext cx;
|
||||
JSAutoRequest request(cx);
|
||||
|
||||
*instanceof = false;
|
||||
|
||||
RootedObject obj(cx, findObject(objId));
|
||||
if (!obj)
|
||||
return false;
|
||||
|
||||
JSAutoCompartment comp(cx, obj);
|
||||
|
||||
JSBool tmp;
|
||||
if (!mozilla::dom::InterfaceHasInstance(cx, prototypeID, depth, obj, &tmp))
|
||||
return fail(cx, rs);
|
||||
*instanceof = tmp;
|
||||
|
||||
return ok(rs);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user