tor-browser

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

performanceentry-tojson.any.js (632B)


      1 test(() => {
      2  performance.mark('markName');
      3  performance.measure('measureName');
      4 
      5  const entries = performance.getEntries();
      6  const performanceEntryKeys = [
      7    'name',
      8    'entryType',
      9    'startTime',
     10    'duration'
     11  ];
     12  for (let i = 0; i < entries.length; ++i) {
     13    assert_equals(typeof(entries[i].toJSON), 'function');
     14    const json = entries[i].toJSON();
     15    assert_equals(typeof(json), 'object');
     16    for (const key of performanceEntryKeys) {
     17      assert_equals(json[key], entries[i][key],
     18        `entries[${i}].toJSON().${key} should match entries[${i}].${key}`);
     19    }
     20  }
     21 }, 'Test toJSON() in PerformanceEntry');