tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

regress-466905-04.js (1254B)


      1 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 //-----------------------------------------------------------------------------
      7 var BUGNUMBER = 466905;
      8 var summary = 'Prototypes of sandboxed arrays';
      9 var actual = '';
     10 var expect = '';
     11 
     12 
     13 //-----------------------------------------------------------------------------
     14 test();
     15 //-----------------------------------------------------------------------------
     16 
     17 function test()
     18 {
     19  printBugNumber(BUGNUMBER);
     20  printStatus (summary);
     21 
     22  if (typeof evalcx != 'function')
     23  {
     24    expect = actual = 'Test skipped: requires evalcx support';
     25  }
     26  else
     27  {
     28    expect = true;
     29 
     30    function createArray()
     31    {
     32      var a;                
     33      for (var i = 0; i < 10; i++)
     34        a = [1, 2, 3, 4, 5];
     35      return a;
     36    }
     37 
     38    var sandbox = evalcx("lazy");
     39    sandbox.createArray = createArray;
     40    var p1 = Object.getPrototypeOf(createArray());
     41    var p2 = Object.getPrototypeOf(evalcx("createArray()", sandbox));
     42    print(actual = (p1 === p2));
     43  }
     44 
     45  reportCompare(expect, actual, summary);
     46 }