tor-browser

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

bug913445.js (492B)


      1 // |jit-test| skip-if: !this.uneval
      2 
      3 // uneval works on objects with no callable .toSource method.
      4 
      5 var obj = Object.create(null);
      6 assertEq(uneval(obj), "({})");
      7 assertEq(Function.prototype.toSource.call(obj), "({})");
      8 obj.x = 1;
      9 obj.y = 2;
     10 assertEq(uneval(obj), "({x:1, y:2})");
     11 
     12 var d = new Date();
     13 delete Date.prototype.toSource;
     14 assertEq(uneval(d), "({})");
     15 
     16 delete Object.prototype.toSource;
     17 assertEq(uneval({p: 2+2}), "({p:4})");
     18 
     19 assertEq(uneval({toSource: [0]}), "({toSource:[0]})");