js/src/jit-test/tests/saved-stacks/getters-on-invalid-objects.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 // Test that you can't call the SavedFrame constructor and can only use
     2 // SavedFrame's getters on SavedFrame instances.
     4 load(libdir + "asserts.js");
     6 let proto = Object.getPrototypeOf(saveStack());
     8 // Can't create new SavedFrame instances by hand.
     9 assertThrowsInstanceOf(() => {
    10   new proto.constructor();
    11 }, TypeError);
    13 for (let p of ["source", "line", "column", "functionDisplayName", "parent"]) {
    14   // The getters shouldn't work on the prototype.
    15   assertThrowsInstanceOf(() => proto[p], TypeError);
    17   // Nor should they work on random objects.
    18   let o = {};
    19   Object.defineProperty(o, p, Object.getOwnPropertyDescriptor(proto, p));
    20   assertThrowsInstanceOf(() => o[p], TypeError);
    21 }

mercurial