blob: 19529fc7ca044facc35a500abce826ce7f6ee68a [file] [log] [blame]
<p>This page tests whether a cached [[put]] consults setters in the prototype chain.
If the test passes, you'll see two PASS messages below.</p>
<pre id="console"></pre>
<script>
if (window.testRunner)
testRunner.dumpAsText();
function log(s)
{
document.getElementById("console").appendChild(document.createTextNode(s));
}
(function() {
var xSetterCalled = false;
function MyConstructor()
{
this.x = 1;
}
new MyConstructor;
new MyConstructor;
Object.prototype.__defineSetter__("x", function(x) { xSetterCalled = true; });
new MyConstructor;
log(xSetterCalled ? "PASS: 'x' setter was called.\n" : "FAIL: 'x' setter was not called.\n");
})();
(function() {
var xSetterCalled = false;
function makeO()
{
var o = { };
o.x = 1;
return o;
}
makeO();
makeO();
Object.prototype.__defineSetter__("x", function(x) { xSetterCalled = true; });
makeO();
log(xSetterCalled ? "PASS: 'x' setter was called.\n" : "FAIL: 'x' setter was not called.\n");
})();
</script>