Bug 1065185 - Explicitly expose indexed properties in COW array test. r=bz
--- 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.
}