Bug 621464 - Fix xml_replace thinko introduced by 1d1fe1d1e626 (r=lw)
authorAndrew Drake <adrake@mozilla.com>
Fri, 21 Jan 2011 09:31:56 -0800
changeset 61207 e63f5adc428007495c5fa32d9ccfbcfcac149317
parent 61206 143179160c52221606233644bdf50e189b6edc39
child 61208 74190651d91a9744f73b6ebf0360bf3f8580f0c0
push id18277
push usercleary@mozilla.com
push dateTue, 25 Jan 2011 03:52:51 +0000
treeherdermozilla-central@7ee91bd90e7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslw
bugs621464
milestone2.0b10pre
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 621464 - Fix xml_replace thinko introduced by 1d1fe1d1e626 (r=lw)
js/src/jsxml.cpp
js/src/tests/e4x/XML/jstests.list
js/src/tests/e4x/XML/regress-621464.js
--- a/js/src/jsxml.cpp
+++ b/js/src/jsxml.cpp
@@ -6358,17 +6358,17 @@ xml_replace(JSContext *cx, uintN argc, j
     }
 
     xml = CHECK_COPY_ON_WRITE(cx, xml, obj);
     if (!xml)
         return JS_FALSE;
 
     bool haveIndex;
     if (argc == 0) {
-        haveIndex = true;
+        haveIndex = false;
     } else {
         if (!js_IdValIsIndex(cx, vp[2], &index, &haveIndex))
             return JS_FALSE;
     }
 
     if (!haveIndex) {
         /*
          * Call function QName per spec, not ToXMLName, to avoid attribute
--- a/js/src/tests/e4x/XML/jstests.list
+++ b/js/src/tests/e4x/XML/jstests.list
@@ -48,8 +48,9 @@ script 13.4.4.7.js
 script 13.4.4.8.js
 script 13.4.4.9.js
 script regress-291930.js
 script regress-324422-1.js
 skip script regress-324422-2.js # slow
 skip script regress-324688.js # bug 528404 - disable due to random timeouts
 script regress-336921.js
 script regress-376773.js
+script regress-621464.js
new file mode 100644
--- /dev/null
+++ b/js/src/tests/e4x/XML/regress-621464.js
@@ -0,0 +1,51 @@
+/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Andrew Drake
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+
+var BUGNUMBER = 621464;
+var summary = '<x>a</x>.replace() == <x>a</x>';
+
+printBugNumber(BUGNUMBER);
+START(summary);
+
+var expected = <x>a</x>;
+var actual = <x>a</x>.replace();
+
+TEST(0, expected, actual);
+
+END();