author | Peter Van der Beken <peterv@propagandism.org> |
Tue, 21 Jun 2011 23:12:50 +0200 | |
changeset 78437 | f1d2301aec7cbe9e64eb99b8afe8045f33eb2fdb |
parent 78436 | 4742146da66fc9b5d119f8bd49150530a60e6ac2 |
child 78438 | b88815f00df94c43d46870772ac73c11bf22fbdd |
push id | 21294 |
push user | pvanderbeken@mozilla.com |
push date | Mon, 10 Oct 2011 08:58:09 +0000 |
treeherder | mozilla-central@432f3a96bc2b [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bz, jst, mrbkap |
bugs | 648801 |
milestone | 10.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/js/src/xpconnect/src/Makefile.in +++ b/js/src/xpconnect/src/Makefile.in @@ -78,16 +78,17 @@ CPPSRCS = \ xpcwrappednativeinfo.cpp \ xpcwrappednativejsops.cpp \ xpcwrappednativeproto.cpp \ xpcwrappednativescope.cpp \ xpcJSWeakReference.cpp \ XPCWrapper.cpp \ xpcquickstubs.cpp \ dom_quickstubs.cpp \ + dombindings.cpp \ $(NULL) include $(topsrcdir)/config/config.mk LOCAL_INCLUDES = \ -I$(srcdir)/../wrappers \ -I$(srcdir)/../loader \ -I$(topsrcdir)/js/src \
--- a/js/src/xpconnect/src/dombindings.cpp +++ b/js/src/xpconnect/src/dombindings.cpp @@ -52,16 +52,25 @@ using namespace js; namespace xpc { namespace dom { int HandlerFamily; + +JSBool +Throw(JSContext *cx, nsresult rv) +{ + XPCThrower::Throw(rv, cx); + return JS_FALSE; +} + + // Only set allowNativeWrapper to false if you really know you need it, if in // doubt use true. Setting it to false disables security wrappers. static bool XPCOMObjectToJsval(JSContext *cx, JSObject *scope, xpcObjectHelper &helper, bool allowNativeWrapper, jsval *rval) { // XXX The OBJ_IS_NOT_GLOBAL here is not really right. In // fact, this code is depending on the fact that the @@ -73,17 +82,17 @@ XPCOMObjectToJsval(JSContext *cx, JSObje nsresult rv; if (!XPCConvert::NativeInterface2JSObject(lccx, rval, NULL, helper, NULL, NULL, allowNativeWrapper, OBJ_IS_NOT_GLOBAL, &rv)) { // I can't tell if NativeInterface2JSObject throws JS exceptions // or not. This is a sloppy stab at the right semantics; the // method really ought to be fixed to behave consistently. if (!JS_IsExceptionPending(cx)) - xpc_qsThrow(cx, NS_FAILED(rv) ? rv : NS_ERROR_UNEXPECTED); + Throw(cx, NS_FAILED(rv) ? rv : NS_ERROR_UNEXPECTED); return false; } #ifdef DEBUG JSObject* jsobj = JSVAL_TO_OBJECT(*rval); if (jsobj && !js::GetObjectParent(jsobj)) NS_ASSERTION(js::GetObjectClass(jsobj)->flags & JSCLASS_IS_GLOBAL, "Why did we recreate this wrapper?"); @@ -248,17 +257,17 @@ NodeList<T>::instanceIsNodeListObject(JS { if (XPCWrapper::IsSecurityWrapper(obj)) { if (callee && js::GetObjectGlobal(obj) == js::GetObjectGlobal(callee)) { obj = js::UnwrapObject(obj); } else { obj = XPCWrapper::Unwrap(cx, obj); if (!obj) - return xpc_qsThrow(cx, NS_ERROR_XPC_SECURITY_MANAGER_VETO); + return Throw(cx, NS_ERROR_XPC_SECURITY_MANAGER_VETO); } } if (!js::IsProxy(obj) || (js::GetProxyHandler(obj) != &NodeList<T>::instance)) { // FIXME: Throw a proper DOM exception. JS_ReportError(cx, "type error: wrong object"); return false; } @@ -307,17 +316,17 @@ template<class T> JSBool NodeList<T>::item(JSContext *cx, uintN argc, jsval *vp) { JSObject *obj = JS_THIS_OBJECT(cx, vp); JSObject *callee = JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)); if (!obj || !instanceIsNodeListObject(cx, obj, callee)) return false; if (argc < 1) - return xpc_qsThrow(cx, NS_ERROR_XPC_NOT_ENOUGH_ARGS); + return Throw(cx, NS_ERROR_XPC_NOT_ENOUGH_ARGS); jsval *argv = JS_ARGV(cx, vp); uint32 u; if (!JS_ValueToECMAUint32(cx, argv[0], &u)) return false; T *nodeList = getNodeList(obj); nsIContent *result = nodeList->GetNodeAt(u); return WrapObject(cx, obj, result, result, vp); } @@ -368,17 +377,17 @@ template<> JSBool NodeList<nsIHTMLCollection>::namedItem(JSContext *cx, uintN argc, jsval *vp) { JSObject *obj = JS_THIS_OBJECT(cx, vp); JSObject *callee = JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)); if (!obj || !instanceIsNodeListObject(cx, obj, callee)) return false; if (argc < 1) - return xpc_qsThrow(cx, NS_ERROR_XPC_NOT_ENOUGH_ARGS); + return Throw(cx, NS_ERROR_XPC_NOT_ENOUGH_ARGS); jsval *argv = JS_ARGV(cx, vp); bool hasResult; nsISupports *result; nsWrapperCache *cache; if (!namedItem(cx, obj, &argv[0], &result, &cache, &hasResult)) return JS_FALSE; if (!hasResult) { *vp = JSVAL_NULL;
--- a/js/src/xpconnect/src/dombindings.h +++ b/js/src/xpconnect/src/dombindings.h @@ -39,16 +39,17 @@ #ifndef dombindings_h #define dombindings_h #include "jsapi.h" #include "jsproxy.h" #include "xpcpublic.h" +class nsINode; class nsINodeList; class nsIHTMLCollection; namespace xpc { namespace dom { inline nsWrapperCache* GetWrapperCache(nsWrapperCache *cache)
--- a/js/src/xpconnect/src/qsgen.py +++ b/js/src/xpconnect/src/qsgen.py @@ -1675,17 +1675,16 @@ def writeDefiner(f, conf, interfaces): # the definer function (entry point to this quick stubs file) f.write("JSBool %s_DefineQuickStubs(" % conf.name) f.write("JSContext *cx, JSObject *proto, uintN flags, PRUint32 count, " "const nsID **iids)\n" "{\n") f.write(" return xpc_qsDefineQuickStubs(" "cx, proto, flags, count, iids, %d, tableData);\n" % size) f.write("}\n\n\n") - f.write("#include \"dombindings.cpp\""); stubTopTemplate = '''\ /* THIS FILE IS AUTOGENERATED - DO NOT EDIT */ #include "jsapi.h" #include "jscntxt.h" /* Include nanojit.h early to avoid conflicting with nscore's |#define free|. * NB: needs to be kept in sync with jsbuiltins.h */