Bug 1065186 - Fix up test suite to not rely on COWed Arrays. r=gabor
authorBobby Holley <bobbyholley@gmail.com>
Thu, 16 Oct 2014 14:12:36 +0200
changeset 210668 d6aadffaf23948b6f1b4b5994a42755e2fd60633
parent 210667 916675800e05cad075b60e71f859b61c55d845ad
child 210669 ce796ac8901b15e09e41b4d6fc6608e2d8ec17f1
push id50515
push userbobbyholley@gmail.com
push dateThu, 16 Oct 2014 12:13:56 +0000
treeherdermozilla-inbound@ce796ac8901b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgabor
bugs1065186
milestone36.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 1065186 - Fix up test suite to not rely on COWed Arrays. r=gabor
js/xpconnect/tests/chrome/test_bug1065185.html
js/xpconnect/tests/chrome/test_bug760109.xul
js/xpconnect/tests/chrome/test_bug866823.xul
--- a/js/xpconnect/tests/chrome/test_bug1065185.html
+++ b/js/xpconnect/tests/chrome/test_bug1065185.html
@@ -35,30 +35,16 @@ https://bugzilla.mozilla.org/show_bug.cg
       case 1:
         doMonitor([/access to property a/i]);
         window[0].wrappedJSObject.probe = { a: 2 };
         is(window[0].eval('probe.a'), undefined, "Non-exposed prop undefined");
         is(window[0].eval('probe.a'), undefined, "Non-exposed prop undefined again");
         endMonitor();
         break;
       case 2:
-        doMonitor([/access to property 0/i]);
-        window[0].wrappedJSObject.probe = [42];
-        is(window[0].eval('probe[0]'), undefined, "Element undefined");
-        is(window[0].eval('probe.length'), undefined, "Length undefined");
-        endMonitor();
-        break;
-      case 3:
-        doMonitor([/access to property length/i]);
-        window[0].wrappedJSObject.probe = { a: 'verboten', b: [42], __exposedProps__: { 'b' : 'r' }};
-        is(window[0].eval('probe.b.length'), undefined, "Length undefined");
-        is(window[0].eval('probe.a'), undefined, "property undefined");
-        endMonitor();
-        break;
-      case 4:
         SimpleTest.finish();
         break;
       default:
         ok(false, "Unexpected load");
         SimpleTest.finish();
         break;
     }
   }
--- a/js/xpconnect/tests/chrome/test_bug760109.xul
+++ b/js/xpconnect/tests/chrome/test_bug760109.xul
@@ -20,51 +20,42 @@ https://bugzilla.mozilla.org/show_bug.cg
 
   /** Test for COW prototype remapping.**/
 
   // This gets decompiled and run inside the sandbox.
   function sandboxCode() {
 
     // Check that COWs for objects with standard prototypes use the standard
     // prototype in the home compartment.
-    ok(Object.getPrototypeOf(chromeArray) === Array.prototype,
-       "Array prototype remapped properly");
     var protoProto = Object.getPrototypeOf(Object.getPrototypeOf(chromeObject));
     ok(protoProto === Object.prototype,
        "Object prototype remapped properly");
 
     // Check |constructor|.
     // Note that the 'constructor' property of the underlying chrome object
     // will be resolved on SomeConstructor.prototype, which has an empty
     // __exposedProps__. This means that we shouldn't remap the property, even
     // though we'd also be able to find it on Object.prototype. Some recent
     // refactoring has made it possible to do the right thing here.
     is(typeof chromeObject.constructor, "undefined", "Object constructor does what we expect");
-    ok(chromeArray.constructor === Array, "Array constructor remapped properly");
   }
 
   // We use a constructor to create the test object so that there's an
   // intermediate object on the prototype chain between the instance and the
   // standard prototype.
   function SomeConstructor() {
     this.foo = 2;
     this.bar = 3;
     this.baz = 4;
     this.__exposedProps__ = {foo: 'r', baz: 'rw'};
   }
   SomeConstructor.prototype.__exposedProps__ = {};
 
   const Cu = Components.utils;
   var sb = new Cu.Sandbox('http://www.example.org');
-  sb.chromeArray = ['a', 'b', 'z'];
-  sb.chromeArray.__exposedProps__ = { length: 'rw' };
-  for (var i = 0; i < 10; ++i) {
-    sb.chromeArray.__exposedProps__[i] = 'rw';
-  }
-
   sb.chromeObject = new SomeConstructor();
   sb.ok = ok;
   sb.is = is;
   Cu.evalInSandbox('(' + sandboxCode.toSource() + ')();', sb);
 
   ]]>
   </script>
 </window>
--- a/js/xpconnect/tests/chrome/test_bug866823.xul
+++ b/js/xpconnect/tests/chrome/test_bug866823.xul
@@ -28,24 +28,24 @@ https://bugzilla.mozilla.org/show_bug.cg
     // for whom the extender may not waive.
     var sb = new Cu.Sandbox(iwin, { wantXrays: true });
     sb.iwin = iwin;
     ok(Cu.evalInSandbox('iwin.wrappedJSObject.top == iwin.top', sb), "Waiver does not propagate");
     Cu.evalInSandbox('iwin.wrappedJSObject.waiver = iwin.wrappedJSObject', sb);
     ok(iwin.wrappedJSObject.eval('waiver == window'), "Waivers disappear same-compartment");
 
     // Make sure that COW prototype always happens.
-    sb.arrayProto = Array.prototype;
-    ok(Cu.evalInSandbox('arrayProto == Array.prototype', sb),
+    sb.objProto = Object.prototype;
+    ok(Cu.evalInSandbox('objProto == Object.prototype', sb),
                         "Prototype remapping should happen even when the object isn't used as a prototype");
 
     // Make sure that prototype remapping happens even for nsEP.
     var sbEP = new Cu.Sandbox(['http://example.org']);
-    sb.epArrayProto = sbEP.Array.prototype;
-    ok(Cu.evalInSandbox('epArrayProto == Array.prototype', sb),
+    sb.epObjProto = sbEP.Object.prototype;
+    ok(Cu.evalInSandbox('epObjProto == Object.prototype', sb),
                         "Prototype remapping should happen for all non-subsuming access");
 
     SimpleTest.finish();
   }
 
   ]]>
   </script>
   <iframe id="ifr" onload="go();" type="content" src="http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html" />