author | Peter Van der Beken <peterv@propagandism.org> |
Tue, 27 Nov 2012 10:20:05 +0100 | |
changeset 114348 | 7d678d658159f4ebe557072e1510ffc097949f80 |
parent 114347 | ae93793daecd682d55996f9fe6140daf74d181c7 |
child 114349 | 9d18ded603301309aaebc9261db21dd941e16762 |
push id | 23913 |
push user | emorley@mozilla.com |
push date | Wed, 28 Nov 2012 17:11:31 +0000 |
treeherder | mozilla-central@17c267a881cf [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bz |
bugs | 814821, 812333 |
milestone | 20.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -182,17 +182,17 @@ IsDOMObject(JSObject* obj) return IsDOMClass(clasp) || IsDOMProxy(obj, clasp); } // Some callers don't want to set an exception when unwrapping fails // (for example, overload resolution uses unwrapping to tell what sort // of thing it's looking at). // U must be something that a T* can be assigned to (e.g. T* or an nsRefPtr<T>). template <prototypes::ID PrototypeID, class T, typename U> -inline nsresult +MOZ_ALWAYS_INLINE nsresult UnwrapObject(JSContext* cx, JSObject* obj, U& value) { /* First check to see whether we have a DOM object */ const DOMClass* domClass; DOMObjectSlot slot = GetDOMClass(obj, domClass); if (slot == eNonDOMObject) { /* Maybe we have a security wrapper or outer window? */ if (!js::IsWrapper(obj)) {
--- a/js/xpconnect/src/XPCQuickStubs.cpp +++ b/js/xpconnect/src/XPCQuickStubs.cpp @@ -793,37 +793,16 @@ xpc_qsUnwrapThisFromCcxImpl(XPCCallConte nsresult rv = getNative(native, GetOffsets(native, ccx.GetProto()), ccx.GetFlattenedJSObject(), iid, ppThis, pThisRef, vp); if (NS_FAILED(rv)) return xpc_qsThrow(ccx.GetJSContext(), rv); return true; } -JSObject* -xpc_qsUnwrapObj(JS::Value v, nsISupports **ppArgRef, nsresult *rv) -{ - if (v.isNullOrUndefined()) { - *ppArgRef = nullptr; - *rv = NS_OK; - return nullptr; - } - - if (!v.isObject()) { - *ppArgRef = nullptr; - *rv = ((v.isInt32() && v.toInt32() == 0) - ? NS_ERROR_XPC_BAD_CONVERT_JS_ZERO_ISNOT_NULL - : NS_ERROR_XPC_BAD_CONVERT_JS); - return nullptr; - } - - *rv = NS_OK; - return &v.toObject(); -} - nsresult xpc_qsUnwrapArgImpl(JSContext *cx, jsval v, const nsIID &iid, void **ppArg, nsISupports **ppArgRef, jsval *vp) {
--- a/js/xpconnect/src/XPCQuickStubs.h +++ b/js/xpconnect/src/XPCQuickStubs.h @@ -495,18 +495,33 @@ xpc_qsUnwrapThisFromCcx(XPCCallContext & { return xpc_qsUnwrapThisFromCcxImpl(ccx, NS_GET_TEMPLATE_IID(T), reinterpret_cast<void **>(ppThis), pThisRef, pThisVal); } -JSObject* -xpc_qsUnwrapObj(jsval v, nsISupports **ppArgRef, nsresult *rv); +MOZ_ALWAYS_INLINE JSObject* +xpc_qsUnwrapObj(jsval v, nsISupports **ppArgRef, nsresult *rv) +{ + *rv = NS_OK; + if (v.isObject()) { + return &v.toObject(); + } + + if (!v.isNullOrUndefined()) { + *rv = ((v.isInt32() && v.toInt32() == 0) + ? NS_ERROR_XPC_BAD_CONVERT_JS_ZERO_ISNOT_NULL + : NS_ERROR_XPC_BAD_CONVERT_JS); + } + + *ppArgRef = nullptr; + return nullptr; +} nsresult xpc_qsUnwrapArgImpl(JSContext *cx, jsval v, const nsIID &iid, void **ppArg, nsISupports **ppArgRef, jsval *vp); /** Convert a jsval to an XPCOM pointer. */ template <class Interface, class StrongRefType> inline nsresult