Bug 1139005 - Need to check the return value of AutoJSAPI.init in canvas EncodeCallback (r=ayang)
authorBill McCloskey <billm@mozilla.com>
Mon, 02 Mar 2015 22:26:06 -0800
changeset 232187 9e83a9eba19fde26f4a7f3d203a0f08366514c4e
parent 232186 dd08b70871f36278e5c43dc03f7f7f4236e353e8
child 232188 fd928bcff5c0e3a7d9d622a99dc88f5bf51c3fa7
push id28372
push usercbook@mozilla.com
push dateFri, 06 Mar 2015 12:07:51 +0000
treeherdermozilla-central@7d85ac833cff [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersayang
bugs1139005
milestone39.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 1139005 - Need to check the return value of AutoJSAPI.init in canvas EncodeCallback (r=ayang)
dom/html/HTMLCanvasElement.cpp
--- a/dom/html/HTMLCanvasElement.cpp
+++ b/dom/html/HTMLCanvasElement.cpp
@@ -556,18 +556,19 @@ HTMLCanvasElement::ToBlob(JSContext* aCx
     // This is called on main thread.
     nsresult ReceiveBlob(already_AddRefed<File> aBlob)
     {
       nsRefPtr<File> blob = aBlob;
       uint64_t size;
       nsresult rv = blob->GetSize(&size);
       if (NS_SUCCEEDED(rv)) {
         AutoJSAPI jsapi;
-        jsapi.Init(mGlobal);
-        JS_updateMallocCounter(jsapi.cx(), size);
+        if (jsapi.Init(mGlobal)) {
+          JS_updateMallocCounter(jsapi.cx(), size);
+        }
       }
 
       nsRefPtr<File> newBlob = new File(mGlobal, blob->Impl());
 
       mozilla::ErrorResult error;
       mFileCallback->Call(*newBlob, error);
 
       mGlobal = nullptr;