chromium/third_party/blink/web_tests/fast/js/pic/cached-prototype-setter.html

<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>