Bug 688093 - Updating the reflect.js post spec changes. r=Ms2ger
authorAtul Aggarwal <atulagrwl@gmail.com>
Tue, 08 Nov 2011 18:44:48 +0530
changeset 80032 b2f23e353c64b12df6deb4000a132f9f22ce39b7
parent 80031 9543018be98c9b7a209bde174a91cc156b1944ce
child 80033 052bf8bd491ea9dbb7aeca52ea30c1b25266e209
push id323
push userrcampbell@mozilla.com
push dateTue, 15 Nov 2011 21:58:36 +0000
treeherderfx-team@3ea216303184 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMs2ger
bugs688093
milestone10.0a1
Bug 688093 - Updating the reflect.js post spec changes. r=Ms2ger
content/html/content/test/reflect.js
--- a/content/html/content/test/reflect.js
+++ b/content/html/content/test/reflect.js
@@ -463,32 +463,22 @@ function reflectBoolean(aParameters)
 function reflectInt(aParameters)
 {
   // Expected value returned by .getAttribute() when |value| has been previously passed to .setAttribute().
   function expectedGetAttributeResult(value) {
     return (value !== null) ? String(value) : "";
   }
 
   function stringToInteger(value, nonNegative, defaultValue) {
-    if (nonNegative === false) {
-      // Parse: Ignore leading whitespace, find [+/-][numbers]
-      var result = /^[ \t\n\f\r]*([\+\-]?[0-9]+)/.exec(value);
-      if (result) {
-        if (-0x80000000 <= result[1] && result[1] <= 0x7FFFFFFF) {
-          // If the value is within allowed value range for signed integer, return value
-          return result[1];
-        }
-      }
-    } else {
-      var result = /^[ \t\n\f\r]*(\+?[0-9]+)/.exec(value);
-      if (result) {
-        if (0 <= result[1] && result[1] <= 0x7FFFFFFF) {
-          // If the value is within allowed value range for non-negative integer, return value
-          return result[1];
-        }
+    // Parse: Ignore leading whitespace, find [+/-][numbers]
+    var result = /^[ \t\n\f\r]*([\+\-]?[0-9]+)/.exec(value);
+    if (result) {
+      if ((nonNegative ? 0:-0x80000000) <= result[1] && result[1] <= 0x7FFFFFFF) {
+        // If the value is within allowed value range for signed/unsigned integer, return value
+        return result[1];
       }
     }
     return defaultValue;
   }
 
   // Expected value returned by .getAttribute(attr) or .attr if |value| has been set via the IDL attribute.
   function expectedIdlAttributeResult(value) {
     // This returns the result of calling the ES ToInt32 algorithm on value.
@@ -546,20 +536,16 @@ function reflectInt(aParameters)
 
     is(element.getAttribute(attr), expectedGetAttributeResult(v), element.localName + ".setAttribute(" +
       attr + ", " + v + "), " + element.localName + ".getAttribute(" + attr + ") ");
 
     if (intValue == -2147483648 && element[attr] == defaultValue) {
       //TBD: Bug 586761: .setAttribute(attr, -2147483648) --> element[attr] == defaultValue instead of -2147483648
       todo_is(element[attr], intValue, "Bug 586761: " + element.localName +
         ".setAttribute(value, " + v + "), " + element.localName + "[" + attr + "] ");
-    } else if ((v === "-0" || v == "-0xABCDEF") && nonNegative) {
-      //TBD: Bug 688093: Non-negative integers should return defaultValue when attempting to reflect "-0"
-      todo_is(element[attr], intValue, "Bug 688093: " + element.localName +
-        ".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
     } else {
       is(element[attr], intValue, element.localName +
         ".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
     }
     element.removeAttribute(attr);
 
     if (nonNegative && expectedIdlAttributeResult(v) < 0) {
       try {