Bug 1065185 - Explicitly expose indexed properties in COW array test. r=bz
authorBobby Holley <bobbyholley@gmail.com>
Fri, 03 Oct 2014 10:05:50 +0200
changeset 208540 c244a7df8cfe82c109e4c4d65267191468ef997e
parent 208539 5f82762afba953e866884feb0cdc2e6d8bad57e0
child 208541 34dbc25304b9357942a337297b5bb9c0626ede76
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersbz
bugs1065185
milestone35.0a1
Bug 1065185 - Explicitly expose indexed properties in COW array test. r=bz
js/xpconnect/tests/chrome/test_bug760109.xul
js/xpconnect/tests/unit/test_bug853709.js
--- a/js/xpconnect/tests/chrome/test_bug760109.xul
+++ b/js/xpconnect/tests/chrome/test_bug760109.xul
@@ -75,17 +75,21 @@ https://bugzilla.mozilla.org/show_bug.cg
     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__ = {};
+  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/unit/test_bug853709.js
+++ b/js/xpconnect/tests/unit/test_bug853709.js
@@ -2,16 +2,17 @@ const Cu = Components.utils;
 
 function setupChromeSandbox() {
   this.chromeObj = {a: 2, __exposedProps__: {a: "rw", b: "rw"} };
   this._b = 3;
   Object.defineProperty(chromeObj, 'b', { configurable: true,
                                           get: function() { return _b; },
                                           set: function(val) { _b = val; } });
   this.chromeArr = [4, 2, 1];
+  this.chromeArr["__exposedProps__"] = { "1": "rw" };
 }
 
 function checkDefineThrows(sb, obj, prop, desc) {
   var result = Cu.evalInSandbox('(function() { try { Object.defineProperty(' + obj + ', "' + prop + '", ' + desc.toSource() + '); return "nothrow"; } catch (e) { return e.toString(); }})();', sb);
   do_check_neq(result, 'nothrow');
   do_check_true(!!/denied/.exec(result));
   do_check_true(result.indexOf(prop) != -1); // Make sure the prop name is in the error message.
 }