Bug 563120 - test for failure earlier in js_TestXMLEquality (r=waldo)
authorLuke Wagner <lw@mozilla.com>
Sat, 01 May 2010 12:43:43 -0700
changeset 41866 efab4df4fc6f6031146f75d3e4600504e2e863f0
parent 41865 b414c98f9030a6f841c452454c6fcb1fe0a71f3e
child 41867 c6857d0b1e9f078c9eab48f96572f1f01a5bf33a
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerswaldo
bugs563120
milestone1.9.3a5pre
Bug 563120 - test for failure earlier in js_TestXMLEquality (r=waldo)
js/src/jsxml.cpp
--- a/js/src/jsxml.cpp
+++ b/js/src/jsxml.cpp
@@ -5180,34 +5180,32 @@ js_TestXMLEquality(JSContext *cx, JSObje
             if (((xml->xml_class == JSXML_CLASS_TEXT ||
                   xml->xml_class == JSXML_CLASS_ATTRIBUTE) &&
                  HasSimpleContent(vxml)) ||
                 ((vxml->xml_class == JSXML_CLASS_TEXT ||
                   vxml->xml_class == JSXML_CLASS_ATTRIBUTE) &&
                  HasSimpleContent(xml))) {
                 ok = js_EnterLocalRootScope(cx);
                 if (ok) {
-                    str = js_ValueToString(cx, OBJECT_TO_JSVAL(obj));
-                    vstr = js_ValueToString(cx, v);
-                    ok = str && vstr;
+                    ok = (str = js_ValueToString(cx, OBJECT_TO_JSVAL(obj))) &&
+                         (vstr = js_ValueToString(cx, v));
                     if (ok)
                         *bp = js_EqualStrings(str, vstr);
                     js_LeaveLocalRootScope(cx);
                 }
             } else {
                 ok = XMLEquals(cx, xml, vxml, bp);
             }
         }
     } else {
         ok = js_EnterLocalRootScope(cx);
         if (ok) {
             if (HasSimpleContent(xml)) {
-                str = js_ValueToString(cx, OBJECT_TO_JSVAL(obj));
-                vstr = js_ValueToString(cx, v);
-                ok = str && vstr;
+                ok = (str = js_ValueToString(cx, OBJECT_TO_JSVAL(obj))) &&
+                     (vstr = js_ValueToString(cx, v));
                 if (ok)
                     *bp = js_EqualStrings(str, vstr);
             } else if (JSVAL_IS_STRING(v) || JSVAL_IS_NUMBER(v)) {
                 str = js_ValueToString(cx, OBJECT_TO_JSVAL(obj));
                 if (!str) {
                     ok = JS_FALSE;
                 } else if (JSVAL_IS_STRING(v)) {
                     *bp = js_EqualStrings(str, JSVAL_TO_STRING(v));