Bug 1226119 - Clear pending exception from script cache writing failure. r=bholley
This commit is contained in:
@@ -65,8 +65,11 @@ WriteCachedScript(StartupCache* cache, nsACString& uri, JSContext* cx,
|
||||
|
||||
uint32_t size;
|
||||
void* data = JS_EncodeScript(cx, script, &size);
|
||||
if (!data)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!data) {
|
||||
// JS_EncodeScript may have set a pending exception.
|
||||
JS_ClearPendingException(cx);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(size);
|
||||
nsresult rv = cache->PutBuffer(PromiseFlatCString(uri).get(), static_cast<char*>(data), size);
|
||||
@@ -83,8 +86,11 @@ WriteCachedFunction(StartupCache* cache, nsACString& uri, JSContext* cx,
|
||||
uint32_t size;
|
||||
void* data =
|
||||
JS_EncodeInterpretedFunction(cx, JS_GetFunctionObject(function), &size);
|
||||
if (!data)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!data) {
|
||||
// JS_EncodeInterpretedFunction may have set a pending exception.
|
||||
JS_ClearPendingException(cx);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(size);
|
||||
nsresult rv = cache->PutBuffer(PromiseFlatCString(uri).get(), static_cast<char*>(data), size);
|
||||
|
||||
Reference in New Issue
Block a user