Bug 960768 - Check the result of getPendingException in js::UnwindIteratorForException. r=luke
authorAndrew McCreight <continuation@gmail.com>
Fri, 17 Jan 2014 08:05:06 -0800
changeset 163984 648a54eeed1924f0646c4bab288f18a7928ce97f
parent 163983 fbd443bb2208ede14fb012cd955d41fbe33b1f4a
child 163985 1f71357d7de13f2805261d5faba73d5bcd87452b
push id26021
push userryanvm@gmail.com
push dateFri, 17 Jan 2014 19:46:56 +0000
treeherdermozilla-central@316466d0b962 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs960768
milestone29.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
Bug 960768 - Check the result of getPendingException in js::UnwindIteratorForException. r=luke
js/src/jscntxt.h
js/src/jsiter.cpp
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -575,16 +575,17 @@ struct JSContext : public js::ExclusiveC
     void reportAllocationOverflow() {
         js_ReportAllocationOverflow(this);
     }
 
     bool isExceptionPending() {
         return throwing;
     }
 
+    MOZ_WARN_UNUSED_RESULT
     bool getPendingException(JS::MutableHandleValue rval);
 
     void setPendingException(js::Value v);
 
     void clearPendingException() {
         throwing = false;
         unwrappedException_.setUndefined();
     }
--- a/js/src/jsiter.cpp
+++ b/js/src/jsiter.cpp
@@ -974,20 +974,22 @@ js::CloseIterator(JSContext *cx, HandleO
     }
     return true;
 }
 
 bool
 js::UnwindIteratorForException(JSContext *cx, HandleObject obj)
 {
     RootedValue v(cx);
-    cx->getPendingException(&v);
+    bool getOk = cx->getPendingException(&v);
     cx->clearPendingException();
     if (!CloseIterator(cx, obj))
         return false;
+    if (!getOk)
+        return false;
     cx->setPendingException(v);
     return true;
 }
 
 void
 js::UnwindIteratorForUncatchableException(JSContext *cx, JSObject *obj)
 {
     if (obj->is<PropertyIteratorObject>()) {