VandanRogheliya

Bug 1380676 - Patch 3 (content.window.performance.now())

Jun 13th, 2020
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.60 KB | None | 0 0
  1. # HG changeset patch
  2. # User VandanRogheliya <[email protected]>
  3. # Date 1591978922 -19800
  4. # Fri Jun 12 21:52:02 2020 +0530
  5. # Node ID d5e1de43be4ac5d20b34f972e1a3d3fe49dfa9d5
  6. # Parent 10ad7868f3ca27cb90db9bd1d392ff4d7852a0cd
  7. Bug 1380676 - Date.now() instances replaced with performance.now(). r=sparky
  8.  
  9. diff --git a/testing/talos/talos/pageloader/chrome/pageloader.js b/testing/talos/talos/pageloader/chrome/pageloader.js
  10. --- a/testing/talos/talos/pageloader/chrome/pageloader.js
  11. +++ b/testing/talos/talos/pageloader/chrome/pageloader.js
  12. @@ -404,17 +404,17 @@ function plLoadPage() {
  13. function startAndLoadURI(pageName) {
  14. if (!(plPageFlags() & TEST_DOES_OWN_TIMING)) {
  15. // Resume the profiler because we're really measuring page load time.
  16. // If the test is doing its own timing, it'll also need to do its own
  17. // profiler pausing / resuming.
  18. TalosParentProfiler.resume("Starting to load URI " + pageName);
  19. }
  20.  
  21. - start_time = Date.now();
  22. + start_time = content.window.performance.now();
  23. if (loadNoCache) {
  24. content.loadURI(pageName, {
  25. triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
  26. flags: Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE,
  27. });
  28. } else {
  29. content.loadURI(pageName, {
  30. triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
  31. @@ -527,19 +527,19 @@ var plNextPage = async function() {
  32. pageIndex++;
  33. recordedName = null;
  34. pageCycle = 1;
  35. doNextPage = true;
  36. }
  37.  
  38. if (doNextPage) {
  39. if (forceCC) {
  40. - var tccstart = new Date();
  41. + var tccstart = content.window.performance.now();
  42. window.windowUtils.garbageCollect();
  43. - var tccend = new Date();
  44. + var tccend = content.window.performance.now();
  45. report.recordCCTime(tccend - tccstart);
  46.  
  47. // Now asynchronously trigger GC / CC in the content process
  48. await forceContentGC();
  49. }
  50.  
  51. setTimeout(plLoadPage, delay);
  52. } else {
  53. @@ -728,17 +728,17 @@ function _loadHandlerCapturing() {
  54. dumpLine(
  55. "tp: Capturing onload handler used with page that doesn't do its own timing?"
  56. );
  57. plStop(true);
  58. }
  59.  
  60. if (useMozAfterPaint) {
  61. if (gStartTime != null && gStartTime >= 0) {
  62. - gTime = new Date() - gStartTime;
  63. + gTime = content.window.performance.now() - gStartTime;
  64. gStartTime = -1;
  65. }
  66. }
  67.  
  68. if (gTime !== -1) {
  69. plRecordTime(gTime);
  70. TalosParentProfiler.pause("capturing load handler fired");
  71. gTime = -1;
  72. @@ -783,17 +783,17 @@ function _loadHandler(paint_time = 0) {
  73. failTimeout.clear();
  74. var end_time = 0;
  75.  
  76. if (paint_time !== 0) {
  77. // window.performance.timing.timeToNonBlankPaint is a timestamp
  78. // this may have a value for hero element (also a timestamp)
  79. end_time = paint_time;
  80. } else {
  81. - end_time = Date.now();
  82. + end_time = content.window.performance.now();
  83. }
  84.  
  85. var duration;
  86. if (usePDFPaint) {
  87. // PDF paint uses performance.now(), so the time does not need to be
  88. // adjusted from the start time.
  89. duration = end_time;
  90. } else {
  91. @@ -833,22 +833,23 @@ function plLoadHandlerMessage(message) {
  92. failTimeout.clear();
  93.  
  94. if (plPageFlags() & EXECUTE_SCROLL_TEST) {
  95. // Let the page settle down after its load event, then execute the scroll test.
  96. setTimeout(sendScroll, 500);
  97. } else if (plPageFlags() & TEST_DOES_OWN_TIMING) {
  98. var time;
  99.  
  100. - if (typeof gStartTime != "number") {
  101. - gStartTime = Date.parse(gStartTime);
  102. - }
  103. + //content.window.performance.now() returns a typeof number so no need to check
  104. + // if (typeof gStartTime != "number") {
  105. + // gStartTime = Date.parse(gStartTime);
  106. + // }
  107. if (gTime !== -1) {
  108. if (useMozAfterPaint && gStartTime >= 0) {
  109. - time = Date.now() - gStartTime;
  110. + time = content.window.performance.now() - gStartTime;
  111. gStartTime = -1;
  112. } else if (!useMozAfterPaint) {
  113. time = gTime;
  114. }
  115. gTime = -1;
  116. }
  117.  
  118. if (time !== undefined) {
  119. diff --git a/testing/talos/talos/pageloader/chrome/report.js b/testing/talos/talos/pageloader/chrome/report.js
  120. --- a/testing/talos/talos/pageloader/chrome/report.js
  121. +++ b/testing/talos/talos/pageloader/chrome/report.js
  122. @@ -85,17 +85,17 @@ Report.prototype.getReport = function()
  123. }
  124. report += "__end_tp_report\n";
  125.  
  126. if (this.showTotalCCTime) {
  127. report += "__start_cc_report\n";
  128. report += "_x_x_mozilla_cycle_collect," + this.totalCCTime + "\n";
  129. report += "__end_cc_report\n";
  130. }
  131. - var now = new Date().getTime(); // eslint-disable-line mozilla/avoid-Date-timing
  132. + var now = content.window.performance.now(); // eslint-disable-line mozilla/avoid-Date-timing
  133. report += "__startTimestamp" + now + "__endTimestamp\n"; // timestamp for determning shutdown time, used by talos
  134.  
  135. return report;
  136. };
  137.  
  138. Report.prototype.getReportSummary = function() {
  139. function average(arr) {
  140. var sum = 0;
  141. diff --git a/testing/talos/talos/pageloader/chrome/tscroll.js b/testing/talos/talos/pageloader/chrome/tscroll.js
  142. --- a/testing/talos/talos/pageloader/chrome/tscroll.js
  143. +++ b/testing/talos/talos/pageloader/chrome/tscroll.js
  144. @@ -87,17 +87,19 @@ function testScroll(target, stepSize, op
  145. if (!report && document.head) {
  146. var imported = document.createElement("script");
  147. imported.addEventListener("load", function() {
  148. report = tpRecordTime;
  149. resolve();
  150. });
  151.  
  152. // eslint-disable-next-line mozilla/avoid-Date-timing
  153. - imported.src = "../../scripts/talos-debug.js?dummy=" + Date.now(); // For some browsers to re-read
  154. + imported.src =
  155. + "../../scripts/talos-debug.js?dummy=" +
  156. + content.window.performance.now(); // For some browsers to re-read
  157. document.head.appendChild(imported);
  158. return;
  159. }
  160.  
  161. resolve();
  162. });
  163. }
  164.  
  165. @@ -123,17 +125,17 @@ function testScroll(target, stepSize, op
  166. return new Promise(function(resolve) {
  167. win.addEventListener("MozAfterPaint", () => resolve(), { once: true });
  168. });
  169. }
  170.  
  171. function myNow() {
  172. return win.performance && win.performance.now
  173. ? win.performance.now()
  174. - : Date.now(); // eslint-disable-line mozilla/avoid-Date-timing
  175. + : content.window.performance.now(); // eslint-disable-line mozilla/avoid-Date-timing
  176. }
  177.  
  178. var isWindow = target.self === target;
  179.  
  180. var getPos = isWindow
  181. ? function() {
  182. return target.pageYOffset;
  183. }
  184. diff --git a/testing/talos/talos/startup_test/sessionrestore/addon/api.js b/testing/talos/talos/startup_test/sessionrestore/addon/api.js
  185. --- a/testing/talos/talos/startup_test/sessionrestore/addon/api.js
  186. +++ b/testing/talos/talos/startup_test/sessionrestore/addon/api.js
  187. @@ -123,17 +123,21 @@ this.sessionrestore = class extends Exte
  188. : startup_info.sessionRestored;
  189. let duration = restoreTime - startup_info.process;
  190.  
  191. // Report data to Talos, if possible.
  192. dump("__start_report" + duration + "__end_report\n\n");
  193.  
  194. // Next one is required by the test harness but not used.
  195. // eslint-disable-next-line mozilla/avoid-Date-timing
  196. - dump("__startTimestamp" + Date.now() + "__endTimestamp\n\n");
  197. + dump(
  198. + "__startTimestamp" +
  199. + content.window.performance.now() +
  200. + "__endTimestamp\n\n"
  201. + );
  202. } catch (ex) {
  203. dump(`SessionRestoreTalosTest: error ${ex}\n`);
  204. dump(ex.stack);
  205. dump("\n");
  206. }
  207.  
  208. Services.startup.quit(Services.startup.eForceQuit);
  209. }
  210. diff --git a/testing/talos/talos/startup_test/startup_about_home_paint/addon/api.js b/testing/talos/talos/startup_test/startup_about_home_paint/addon/api.js
  211. --- a/testing/talos/talos/startup_test/startup_about_home_paint/addon/api.js
  212. +++ b/testing/talos/talos/startup_test/startup_about_home_paint/addon/api.js
  213. @@ -52,17 +52,21 @@ this.startup_about_home_paint = class ex
  214. await this.wait(1000);
  215. ChromeUtils.idleDispatch(() => {
  216. this.checkForTelemetry();
  217. });
  218. } else {
  219. // Got our measurement.
  220. dump("__start_report" + measurement + "__end_report\n\n");
  221. // eslint-disable-next-line mozilla/avoid-Date-timing
  222. - dump("__startTimestamp" + Date.now() + "__endTimestamp\n");
  223. + dump(
  224. + "__startTimestamp" +
  225. + content.window.performance.now() +
  226. + "__endTimestamp\n"
  227. + );
  228.  
  229. let env = Cc["@mozilla.org/process/environment;1"].getService(
  230. Ci.nsIEnvironment
  231. );
  232.  
  233. if (env.exists("TPPROFILINGINFO")) {
  234. let profilingInfo = env.get("TPPROFILINGINFO");
  235. if (profilingInfo !== null) {
  236. diff --git a/testing/talos/talos/startup_test/tspaint_test.html b/testing/talos/talos/startup_test/tspaint_test.html
  237. --- a/testing/talos/talos/startup_test/tspaint_test.html
  238. +++ b/testing/talos/talos/startup_test/tspaint_test.html
  239. @@ -44,17 +44,17 @@ function failed() {
  240.  
  241. function dumpConsoleAndQuit() {
  242. TalosPowersContent.dumpConsole();
  243.  
  244. // Close window asynchronously, there might still be startup operations that still need to run
  245. window.setTimeout(function() {
  246. if (window.dump) {
  247. // eslint-disable-next-line mozilla/avoid-Date-timing
  248. - dump("__startTimestamp" + Date.now() + "__endTimestamp\n");
  249. + dump("__startTimestamp" + content.window.performance.now() + "__endTimestamp\n");
  250. }
  251. TalosPowersContent.goQuitApplication();
  252. }, 0);
  253. }
  254.  
  255. window.addEventListener("MozAfterPaint", painted, true);
  256. setTimeout(failed, 5000);
  257.  
  258. diff --git a/testing/talos/talos/talos-powers/chrome/talos-powers-content.js b/testing/talos/talos/talos-powers/chrome/talos-powers-content.js
  259. --- a/testing/talos/talos/talos-powers/chrome/talos-powers-content.js
  260. +++ b/testing/talos/talos/talos-powers/chrome/talos-powers-content.js
  261. @@ -162,17 +162,17 @@ addEventListener(
  262. throw new Error(
  263. "TalosPowers:ParentExec may only be used with local content"
  264. );
  265. }
  266. let uniqueMessageId =
  267. "TalosPowers:ParentExec:" +
  268. content.document.documentURI +
  269. // eslint-disable-next-line mozilla/avoid-Date-timing
  270. - Date.now() +
  271. + content.window.performance.now() +
  272. Math.random();
  273.  
  274. // Listener for the reply from the parent process
  275. addMessageListener("TalosPowers:ParentExec:ReplyMsg", function done(reply) {
  276. if (reply.data.id != uniqueMessageId) {
  277. return;
  278. }
  279.  
  280. diff --git a/testing/talos/talos/tests/a11y/dhtml.html b/testing/talos/talos/tests/a11y/dhtml.html
  281. --- a/testing/talos/talos/tests/a11y/dhtml.html
  282. +++ b/testing/talos/talos/tests/a11y/dhtml.html
  283. @@ -13,17 +13,17 @@
  284. if (!initAccessibility()) {
  285. dump("__FAILinit:AccessibilityUnvailable__FAIL");
  286. return;
  287. }
  288.  
  289. TalosContentProfiler.resume("dhtml test start", true).then(() => {
  290. var container = document.getElementById("container");
  291. var lastchild = document.getElementById("lastchild");
  292. - var start = new Date(); // eslint-disable-line mozilla/avoid-Date-timing
  293. + var start = content.window.performance.now(); // eslint-disable-line mozilla/avoid-Date-timing
  294. var i, div;
  295. for (i = 0; i < 2000; i++) {
  296. div = document.createElement("div");
  297. div.innerHTML = "<input type='text' value='a bc def g hijkl mn op qrs'/>";
  298. container.insertBefore(div, lastchild);
  299. }
  300. for (i = 0; i < 2000; i++) {
  301. div = document.createElement("div");
  302. @@ -40,17 +40,17 @@
  303. }
  304. document.documentElement.offsetLeft; // flush layout
  305. setTimeout(postProcessingRecord, 0, start);
  306. });
  307. }
  308.  
  309. function postProcessingRecord(s) {
  310. // alert(new Date() - s);
  311. - let delta = new Date() - s; // eslint-disable-line mozilla/avoid-Date-timing
  312. + let delta = content.window.performance.now() - s; // eslint-disable-line mozilla/avoid-Date-timing
  313. TalosContentProfiler.pause("dhtml test finish", true).then(() => {
  314. tpRecordTime(delta, s);
  315. });
  316. }
  317. </script>
  318. </head>
  319. <body onload="doInsertion();">
  320. <div id="container" role="application"><div id="lastchild"></div></div>
  321. diff --git a/testing/talos/talos/tests/a11y/tablemutation.html b/testing/talos/talos/tests/a11y/tablemutation.html
  322. --- a/testing/talos/talos/tests/a11y/tablemutation.html
  323. +++ b/testing/talos/talos/tests/a11y/tablemutation.html
  324. @@ -113,28 +113,28 @@ function mutateTable() {
  325. if (!initAccessibility()) {
  326. dump("__FAILinit:AccessibilityUnvailable__FAIL");
  327. return;
  328. }
  329.  
  330. ensureAccessibleTreeForId("start");
  331.  
  332. TalosContentProfiler.resume("tablemutation start", true).then(() => {
  333. - var start = new Date(); // eslint-disable-line mozilla/avoid-Date-timing
  334. + var start = content.window.performance.now(); // eslint-disable-line mozilla/avoid-Date-timing
  335.  
  336. // Cause all kinds of crazy events
  337. Range.deleteContents();
  338. Range.insertNode(Fragment);
  339.  
  340. document.documentElement.offsetLeft; // flush layout
  341.  
  342. setTimeout(postProcessingRecord, 0, start);
  343. });
  344. }
  345.  
  346. function postProcessingRecord(s) {
  347. // alert(new Date() - s);
  348. - let delta = new Date() - s; // eslint-disable-line mozilla/avoid-Date-timing
  349. + let delta = content.window.performance.now() - s; // eslint-disable-line mozilla/avoid-Date-timing
  350. TalosContentProfiler.pause("tablemutation finish", true).then(() => {
  351. tpRecordTime(delta, s);
  352. });
  353. }
  354. </script>
  355. diff --git a/testing/talos/talos/tests/scroll/scroll.manifest.develop b/testing/talos/talos/tests/scroll/scroll.manifest.develop
  356. new file mode 100644
  357. --- /dev/null
  358. +++ b/testing/talos/talos/tests/scroll/scroll.manifest.develop
  359. @@ -0,0 +1,6 @@
  360. +% http://127.0.0.1:52555/tests/scroll/tiled.html
  361. +% http://127.0.0.1:52555/tests/scroll/tiled-fixed.html
  362. +% http://127.0.0.1:52555/tests/scroll/tiled-downscale.html
  363. +% http://127.0.0.1:52555/tests/scroll/tiled-fixed-downscale.html
  364. +% http://127.0.0.1:52555/tests/scroll/iframe.svg
  365. +% http://127.0.0.1:52555/tests/scroll/reader.htm
  366. diff --git a/testing/talos/talos/tests/svg_opacity/svg_opacity.manifest.develop b/testing/talos/talos/tests/svg_opacity/svg_opacity.manifest.develop
  367. new file mode 100644
  368. --- /dev/null
  369. +++ b/testing/talos/talos/tests/svg_opacity/svg_opacity.manifest.develop
  370. @@ -0,0 +1,4 @@
  371. +# opacity tests
  372. +
  373. +http://127.0.0.1:52555/tests/svg_opacity/big-optimizable-group-opacity-2500.svg
  374. +http://127.0.0.1:52555/tests/svg_opacity/small-group-opacity-2500.svg
  375. diff --git a/testing/talos/talos/tests/svg_static/svg_static.manifest.develop b/testing/talos/talos/tests/svg_static/svg_static.manifest.develop
  376. new file mode 100644
  377. --- /dev/null
  378. +++ b/testing/talos/talos/tests/svg_static/svg_static.manifest.develop
  379. @@ -0,0 +1,8 @@
  380. +# gearflowers image
  381. +http://127.0.0.1:52555/tests/svg_static/gearflowers.svg
  382. +
  383. +# some generic image compositing tests
  384. +http://127.0.0.1:52555/tests/svg_static/composite-scale.svg
  385. +http://127.0.0.1:52555/tests/svg_static/composite-scale-opacity.svg
  386. +http://127.0.0.1:52555/tests/svg_static/composite-scale-rotate.svg
  387. +http://127.0.0.1:52555/tests/svg_static/composite-scale-rotate-opacity.svg
  388. diff --git a/testing/talos/talos/tests/svgx/svgx.manifest.develop b/testing/talos/talos/tests/svgx/svgx.manifest.develop
  389. new file mode 100644
  390. --- /dev/null
  391. +++ b/testing/talos/talos/tests/svgx/svgx.manifest.develop
  392. @@ -0,0 +1,14 @@
  393. +# Painting multiple complex paths
  394. +% http://127.0.0.1:52555/tests/svgx/hixie-001.xml
  395. +# Painting multiple complex paths with transparency
  396. +% http://127.0.0.1:52555/tests/svgx/hixie-002.xml
  397. +# Painting text
  398. +% http://127.0.0.1:52555/tests/svgx/hixie-003.xml
  399. +# Painting images
  400. +% http://127.0.0.1:52555/tests/svgx/hixie-004.xml
  401. +# Painting linear gradients
  402. +% http://127.0.0.1:52555/tests/svgx/hixie-005.xml
  403. +# Painting radial gradients
  404. +% http://127.0.0.1:52555/tests/svgx/hixie-006.xml
  405. +# World Map
  406. +% http://127.0.0.1:52555/tests/svgx/hixie-007.xml
  407. \ No newline at end of file
  408. diff --git a/testing/talos/talos/tests/tabpaint/api.js b/testing/talos/talos/tests/tabpaint/api.js
  409. --- a/testing/talos/talos/tests/tabpaint/api.js
  410. +++ b/testing/talos/talos/tests/tabpaint/api.js
  411. @@ -126,19 +126,22 @@ this.tabpaint = class extends ExtensionA
  412. * @return Promise
  413. * Resolves once the tab has been fully removed. Resolves
  414. * with the time (in ms) it took to open the tab from the parent.
  415. */
  416. async openTabFromParent(gBrowser, target) {
  417. TalosParentProfiler.resume("tabpaint parent start");
  418.  
  419. // eslint-disable-next-line mozilla/avoid-Date-timing
  420. - gBrowser.selectedTab = gBrowser.addTab(`${target}?${Date.now()}`, {
  421. - triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
  422. - });
  423. + gBrowser.selectedTab = gBrowser.addTab(
  424. + `${target}?${content.window.performance.now()}`,
  425. + {
  426. + triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
  427. + }
  428. + );
  429.  
  430. let { tab, delta } = await this.whenTabShown();
  431. TalosParentProfiler.pause("tabpaint parent end");
  432. await this.removeTab(tab);
  433. return delta;
  434. }
  435.  
  436. /**
  437. diff --git a/testing/talos/talos/tests/tabpaint/tabpaint.html b/testing/talos/talos/tests/tabpaint/tabpaint.html
  438. --- a/testing/talos/talos/tests/tabpaint/tabpaint.html
  439. +++ b/testing/talos/talos/tests/tabpaint/tabpaint.html
  440. @@ -10,17 +10,17 @@ function init() {
  441. window.addEventListener("TabPaint:FinalResults", (event) => {
  442. let { fromParent, fromContent } = event.detail;
  443.  
  444. tpRecordTime([fromParent, fromContent].join(","), 0, "tabpaint-from-parent, tabpaint-from-content");
  445. }, {once: true});
  446.  
  447. window.addEventListener("TabPaint:OpenFromContent", (event) => {
  448. let target = document.getElementById("target");
  449. - let now = Date.now(); // eslint-disable-line mozilla/avoid-Date-timing
  450. + let now = content.window.performance.now(); // eslint-disable-line mozilla/avoid-Date-timing
  451.  
  452. target.href = `${targetURL.href}?${now}`;
  453. target.click();
  454. });
  455.  
  456. async function tryPing() {
  457. let pingPromise = new Promise(resolve => {
  458. window.addEventListener("TabPaint:Pong", resolve, {once: true});
  459. diff --git a/testing/talos/talos/tests/tabpaint/tabpaint.manifest.develop b/testing/talos/talos/tests/tabpaint/tabpaint.manifest.develop
  460. new file mode 100644
  461. --- /dev/null
  462. +++ b/testing/talos/talos/tests/tabpaint/tabpaint.manifest.develop
  463. @@ -0,0 +1,2 @@
  464. +% http://127.0.0.1:54398/tests/tabpaint/tabpaint.html
  465. +
  466. diff --git a/testing/talos/talos/tests/tart/addon/content/framescript.js b/testing/talos/talos/tests/tart/addon/content/framescript.js
  467. --- a/testing/talos/talos/tests/tart/addon/content/framescript.js
  468. +++ b/testing/talos/talos/tests/tart/addon/content/framescript.js
  469. @@ -26,17 +26,20 @@
  470.  
  471. if (e.detail.command.name == "ping") {
  472. dispatchReply();
  473. return;
  474. }
  475.  
  476. var uniqueMessageId =
  477. // eslint-disable-next-line mozilla/avoid-Date-timing
  478. - TART_PREFIX + content.document.documentURI + Date.now() + Math.random();
  479. + TART_PREFIX +
  480. + content.document.documentURI +
  481. + content.window.performance.now() +
  482. + Math.random();
  483.  
  484. addMessageListener(TART_PREFIX + "chrome-exec-reply", function done(
  485. reply
  486. ) {
  487. if (reply.data.id == uniqueMessageId) {
  488. removeMessageListener(TART_PREFIX + "chrome-exec-reply", done);
  489. dispatchReply(reply.data.result);
  490. }
  491. diff --git a/testing/talos/talos/tests/tart/tart.manifest.develop b/testing/talos/talos/tests/tart/tart.manifest.develop
  492. new file mode 100644
  493. --- /dev/null
  494. +++ b/testing/talos/talos/tests/tart/tart.manifest.develop
  495. @@ -0,0 +1,1 @@
  496. +% http://127.0.0.1:52555/tests/tart/tart.html#auto
  497. diff --git a/testing/talos/talos/tests/tresize/addon/content/framescript.js b/testing/talos/talos/tests/tresize/addon/content/framescript.js
  498. --- a/testing/talos/talos/tests/tresize/addon/content/framescript.js
  499. +++ b/testing/talos/talos/tests/tresize/addon/content/framescript.js
  500. @@ -3,17 +3,17 @@
  501.  
  502. addEventListener(
  503. TRESIZE_PREFIX + "chrome-run-event",
  504. function(e) {
  505. var uniqueMessageId =
  506. TRESIZE_PREFIX +
  507. content.document.documentURI +
  508. // eslint-disable-next-line mozilla/avoid-Date-timing
  509. - Date.now() +
  510. + content.window.performance.now() +
  511. Math.random();
  512.  
  513. addMessageListener(TRESIZE_PREFIX + "chrome-run-reply", function done(
  514. reply
  515. ) {
  516. if (reply.data.id == uniqueMessageId) {
  517. removeMessageListener(TRESIZE_PREFIX + "chrome-run-reply", done);
  518. content.wrappedJSObject.tpRecordTime(reply.data.result.average);
Add Comment
Please, Sign In to add comment