From f7c3bb7006ceae17c92b977588a1a180faf48168 Mon Sep 17 00:00:00 2001 From: Gabor Krizsanits Date: Wed, 19 Sep 2012 10:53:42 +0200 Subject: [PATCH] Bug 791845 - mozMatchesSelectorStub should return false on error. r=bholley --- js/xpconnect/crashtests/791845.html | 16 ++++++++++++++++ js/xpconnect/crashtests/crashtests.list | 1 + js/xpconnect/wrappers/XrayWrapper.cpp | 6 ++++-- 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 js/xpconnect/crashtests/791845.html diff --git a/js/xpconnect/crashtests/791845.html b/js/xpconnect/crashtests/791845.html new file mode 100644 index 000000000000..7c3a6d2ae4ef --- /dev/null +++ b/js/xpconnect/crashtests/791845.html @@ -0,0 +1,16 @@ + + + + + + + + diff --git a/js/xpconnect/crashtests/crashtests.list b/js/xpconnect/crashtests/crashtests.list index 59b77ace4c38..0c23ac23a6fb 100644 --- a/js/xpconnect/crashtests/crashtests.list +++ b/js/xpconnect/crashtests/crashtests.list @@ -45,3 +45,4 @@ asserts(1) load 753162.html # We hit bug 675518 or bug 680086 here. load 754311.html load 776328.html load 776333.html +load 791845.html diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp index 91f7b592c50e..30a97c22b17f 100644 --- a/js/xpconnect/wrappers/XrayWrapper.cpp +++ b/js/xpconnect/wrappers/XrayWrapper.cpp @@ -653,9 +653,11 @@ Is(JSObject *wrapper) static JSBool mozMatchesSelectorStub(JSContext *cx, unsigned argc, jsval *vp) { - if (argc < 1) + if (argc < 1) { JS_ReportError(cx, "Not enough arguments"); - + return false; + } + JSObject *wrapper = JS_THIS_OBJECT(cx, vp); JSString *selector = JS_ValueToString(cx, JS_ARGV(cx, vp)[0]); nsDependentJSString selectorStr;