Hello mpcomplete,

I'd like you to do a code review.  Please execute
        g4 diff -c 9394907

or point your web browser to
        http://mondrian/9394907

to review the following code:

Change 9394907 by micha...@michaeln-scour2 on 2008/12/12 14:38:09 *pending*

        Fix a crashing bug in Gears for Chrome. JSRunner->NewObject() and 
->NewArray() can return NULL, we have to test for that at callsites.
        
        BUG=1544034
        R=mpcomplete
        [email protected],gears-internal
        DELTA=18  (16 added, 0 deleted, 2 changed)
        OCL=9394907

Affected files ...

... //depot/googleclient/gears/opensource/gears/base/common/js_marshal.cc#16 
edit
... //depot/googleclient/gears/opensource/gears/desktop/desktop.cc#67 edit
... //depot/googleclient/gears/opensource/gears/httprequest/httprequest.cc#26 
edit
... 
//depot/googleclient/gears/opensource/gears/httprequest/httprequest_upload.cc#5 
edit

18 delta lines: 16 added, 0 deleted, 2 changed

The issue description(s) relevant to this code can be found at:
        http://b/issue?id=1544034

or if you are using the old Bugs DB, at:
        http://bugs.corp.google.com/show_bug.cgi?id=1544034

Also consider running:
        g4 lint -c 9394907

which verifies that the changelist doesn't introduce new style violations.

If you can't do the review, please let me know as soon as possible.  During
your review, please ensure that all new code has corresponding unit tests and
that existing unit tests are updated appropriately.  Visit
http://www/eng/code_review.html for more information.

This is a semiautomated message from "g4 mail".  Complaints or suggestions?
Mail [email protected].
Change 9394907 by micha...@michaeln-scour2 on 2008/12/12 14:38:09 *pending*

        Fix a crashing bug in Gears for Chrome. JSRunner->NewObject() and 
->NewArray() can return NULL, we have to test for that at callsites.

Affected files ...

... //depot/googleclient/gears/opensource/gears/base/common/js_marshal.cc#16 
edit
... //depot/googleclient/gears/opensource/gears/desktop/desktop.cc#67 edit
... //depot/googleclient/gears/opensource/gears/httprequest/httprequest.cc#26 
edit
... 
//depot/googleclient/gears/opensource/gears/httprequest/httprequest_upload.cc#5 
edit

==== //depot/googleclient/gears/opensource/gears/base/common/js_marshal.cc#16 - 
C:\p4\michaeln-scour2/googleclient/gears/opensource/gears/base/common/js_marshal.cc
 ====
# action=edit type=text
--- googleclient/gears/opensource/gears/base/common/js_marshal.cc       
2008-12-12 14:51:41.000000000 -0800
+++ googleclient/gears/opensource/gears/base/common/js_marshal.cc       
2008-12-12 14:35:52.000000000 -0800
@@ -250,6 +250,9 @@
     }
     case JSPARAM_OBJECT: {
       scoped_ptr<JsObject> object(js_runner->NewObject());
+      if (!object.get()) {
+        return false;
+      }
       *out = object->token();
 
       std::map<std::string16, MarshaledJsToken*> *o = value_.object_value;
@@ -266,6 +269,9 @@
     }
     case JSPARAM_ARRAY: {
       scoped_ptr<JsArray> array(js_runner->NewArray());
+      if (!array.get()) {
+        return false;
+      }
       *out = array->token();
 
       std::vector<MarshaledJsToken*> *a = value_.array_value;
==== //depot/googleclient/gears/opensource/gears/desktop/desktop.cc#67 - 
C:\p4\michaeln-scour2/googleclient/gears/opensource/gears/desktop/desktop.cc 
====
# action=edit type=text
--- googleclient/gears/opensource/gears/desktop/desktop.cc      2008-12-12 
14:51:41.000000000 -0800
+++ googleclient/gears/opensource/gears/desktop/desktop.cc      2008-12-12 
14:46:57.000000000 -0800
@@ -1100,6 +1100,10 @@
   std::string16 error;
   scoped_ptr<JsObject> result(
       module_environment_->js_runner_->NewObject());
+  if (!result.get()) {
+    context->SetException(STRING16(L"Failed to create a JavaScript object."));
+    return;
+  }
 
 #if BROWSER_FF || (BROWSER_IE && !defined(OS_WINCE)) || BROWSER_WEBKIT
   bool data_available = ::GetDragData(module_environment_.get(),
==== //depot/googleclient/gears/opensource/gears/httprequest/httprequest.cc#26 
- 
C:\p4\michaeln-scour2/googleclient/gears/opensource/gears/httprequest/httprequest.cc
 ====
# action=edit type=text
--- googleclient/gears/opensource/gears/httprequest/httprequest.cc      
2008-12-12 14:51:41.000000000 -0800
+++ googleclient/gears/opensource/gears/httprequest/httprequest.cc      
2008-12-12 14:46:25.000000000 -0800
@@ -651,7 +651,10 @@
     assert(runner);
     if (runner) {
       scoped_ptr<JsObject> js_object(runner->NewObject());
-      assert(js_object.get());
+      if (!js_object.get()) {
+        assert(js_object.get());
+        return;
+      }
       if (content_length_ < 0) {
         // cache on first access
         content_length_ = 0;
==== 
//depot/googleclient/gears/opensource/gears/httprequest/httprequest_upload.cc#5 
- 
C:\p4\michaeln-scour2/googleclient/gears/opensource/gears/httprequest/httprequest_upload.cc
 ====
# action=edit type=text
--- googleclient/gears/opensource/gears/httprequest/httprequest_upload.cc       
2008-12-12 14:51:41.000000000 -0800
+++ googleclient/gears/opensource/gears/httprequest/httprequest_upload.cc       
2008-12-12 14:42:26.000000000 -0800
@@ -73,7 +73,10 @@
     assert(runner);
     if (runner) {
       scoped_ptr<JsObject> js_object(runner->NewObject());
-      assert(js_object.get());
+      if (!js_object.get()) {
+        assert(js_object.get());
+        return;
+      }
       js_object->SetPropertyDouble(STRING16(L"total"),
                                    static_cast<double>(total));
       js_object->SetPropertyDouble(STRING16(L"loaded"),

Reply via email to