Bug 729584 - mozJSComponentLoader::ImportInto needs to wrap exceptions (r=bholley)

--HG--
extra : rebase_source : c5c575a789647348fcca5bf9ef5368873f0016f4
This commit is contained in:
Luke Wagner 2012-02-23 13:50:01 -08:00
parent bca7462e8a
commit e360e8fdf0

View File

@ -1164,19 +1164,21 @@ mozJSComponentLoader::ImportInto(const nsACString & aLocation,
if (!newEntry || !mInProgressImports.Put(key, newEntry))
return NS_ERROR_OUT_OF_MEMORY;
jsval exception = JSVAL_VOID;
JS::Anchor<jsval> exception(JSVAL_VOID);
rv = GlobalForLocation(sourceLocalFile, resURI, &newEntry->global,
&newEntry->location, &exception);
&newEntry->location, &exception.get());
mInProgressImports.Remove(key);
if (NS_FAILED(rv)) {
*_retval = nsnull;
if (!JSVAL_IS_VOID(exception)) {
if (!JSVAL_IS_VOID(exception.get())) {
// An exception was thrown during compilation. Propagate it
// out to our caller so they can report it.
JS_SetPendingException(callercx, exception);
if (!JS_WrapValue(callercx, &exception.get()))
return NS_ERROR_OUT_OF_MEMORY;
JS_SetPendingException(callercx, exception.get());
return NS_OK;
}