tor-browser

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

construct_with_date.js (807B)


      1 // Copyright (C) 2015 André Bargull. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-date-value
      6 description: Date constructor called with Date object
      7 info: |
      8  20.3.2.2 Date ( value )
      9 
     10  ...
     11  3. If NewTarget is not undefined, then
     12    a. If Type(value) is Object and value has a [[DateValue]] internal slot, then
     13      i. Let tv be thisTimeValue(value).
     14 es6id: 20.3.2.2
     15 ---*/
     16 
     17 var dateValue = 1438560000000;
     18 
     19 var oldDate = new Date(dateValue);
     20 oldDate.toString = function() {
     21  throw new Test262Error("toString() method called");
     22 };
     23 oldDate.valueOf = function() {
     24  throw new Test262Error("valueOf() method called");
     25 };
     26 
     27 var newDate = new Date(oldDate);
     28 
     29 assert.sameValue(newDate.getTime(), dateValue, "Same date value");
     30 
     31 reportCompare(0, 0);