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 163971 648a54eeed1924f0646c4bab288f18a7928ce97f
parent 163970 fbd443bb2208ede14fb012cd955d41fbe33b1f4a
child 163972 1f71357d7de13f2805261d5faba73d5bcd87452b
push id38600
push useramccreight@mozilla.com
push dateFri, 17 Jan 2014 16:06:10 +0000
treeherdermozilla-inbound@648a54eeed19 [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>()) {