Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # HG changeset patch
- # User VandanRogheliya <[email protected]>
- # Date 1591978922 -19800
- # Fri Jun 12 21:52:02 2020 +0530
- # Node ID 30a65946da20ffecd9cfec66ff89aa39dd158c51
- # Parent 10ad7868f3ca27cb90db9bd1d392ff4d7852a0cd
- Bug 1380676 - Date.now() instances replaced with performance.now(). r=sparky
- diff --git a/testing/talos/talos/pageloader/chrome/pageloader.js b/testing/talos/talos/pageloader/chrome/pageloader.js
- --- a/testing/talos/talos/pageloader/chrome/pageloader.js
- +++ b/testing/talos/talos/pageloader/chrome/pageloader.js
- @@ -404,17 +404,17 @@ function plLoadPage() {
- function startAndLoadURI(pageName) {
- if (!(plPageFlags() & TEST_DOES_OWN_TIMING)) {
- // Resume the profiler because we're really measuring page load time.
- // If the test is doing its own timing, it'll also need to do its own
- // profiler pausing / resuming.
- TalosParentProfiler.resume("Starting to load URI " + pageName);
- }
- - start_time = Date.now();
- + start_time = performance.now();
- if (loadNoCache) {
- content.loadURI(pageName, {
- triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
- flags: Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE,
- });
- } else {
- content.loadURI(pageName, {
- triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
- @@ -527,19 +527,19 @@ var plNextPage = async function() {
- pageIndex++;
- recordedName = null;
- pageCycle = 1;
- doNextPage = true;
- }
- if (doNextPage) {
- if (forceCC) {
- - var tccstart = new Date();
- + var tccstart = performance.now();
- window.windowUtils.garbageCollect();
- - var tccend = new Date();
- + var tccend = performance.now();
- report.recordCCTime(tccend - tccstart);
- // Now asynchronously trigger GC / CC in the content process
- await forceContentGC();
- }
- setTimeout(plLoadPage, delay);
- } else {
- @@ -728,17 +728,17 @@ function _loadHandlerCapturing() {
- dumpLine(
- "tp: Capturing onload handler used with page that doesn't do its own timing?"
- );
- plStop(true);
- }
- if (useMozAfterPaint) {
- if (gStartTime != null && gStartTime >= 0) {
- - gTime = new Date() - gStartTime;
- + gTime = performance.now() - gStartTime;
- gStartTime = -1;
- }
- }
- if (gTime !== -1) {
- plRecordTime(gTime);
- TalosParentProfiler.pause("capturing load handler fired");
- gTime = -1;
- @@ -783,17 +783,17 @@ function _loadHandler(paint_time = 0) {
- failTimeout.clear();
- var end_time = 0;
- if (paint_time !== 0) {
- // window.performance.timing.timeToNonBlankPaint is a timestamp
- // this may have a value for hero element (also a timestamp)
- end_time = paint_time;
- } else {
- - end_time = Date.now();
- + end_time = performance.now();
- }
- var duration;
- if (usePDFPaint) {
- // PDF paint uses performance.now(), so the time does not need to be
- // adjusted from the start time.
- duration = end_time;
- } else {
- @@ -833,22 +833,23 @@ function plLoadHandlerMessage(message) {
- failTimeout.clear();
- if (plPageFlags() & EXECUTE_SCROLL_TEST) {
- // Let the page settle down after its load event, then execute the scroll test.
- setTimeout(sendScroll, 500);
- } else if (plPageFlags() & TEST_DOES_OWN_TIMING) {
- var time;
- - if (typeof gStartTime != "number") {
- - gStartTime = Date.parse(gStartTime);
- - }
- + //performance.now() returns a typeof number so no need to check
- + // if (typeof gStartTime != "number") {
- + // gStartTime = Date.parse(gStartTime);
- + // }
- if (gTime !== -1) {
- if (useMozAfterPaint && gStartTime >= 0) {
- - time = Date.now() - gStartTime;
- + time = performance.now() - gStartTime;
- gStartTime = -1;
- } else if (!useMozAfterPaint) {
- time = gTime;
- }
- gTime = -1;
- }
- if (time !== undefined) {
- diff --git a/testing/talos/talos/pageloader/chrome/report.js b/testing/talos/talos/pageloader/chrome/report.js
- --- a/testing/talos/talos/pageloader/chrome/report.js
- +++ b/testing/talos/talos/pageloader/chrome/report.js
- @@ -85,17 +85,17 @@ Report.prototype.getReport = function()
- }
- report += "__end_tp_report\n";
- if (this.showTotalCCTime) {
- report += "__start_cc_report\n";
- report += "_x_x_mozilla_cycle_collect," + this.totalCCTime + "\n";
- report += "__end_cc_report\n";
- }
- - var now = new Date().getTime(); // eslint-disable-line mozilla/avoid-Date-timing
- + var now = performance.now(); // eslint-disable-line mozilla/avoid-Date-timing
- report += "__startTimestamp" + now + "__endTimestamp\n"; // timestamp for determning shutdown time, used by talos
- return report;
- };
- Report.prototype.getReportSummary = function() {
- function average(arr) {
- var sum = 0;
- diff --git a/testing/talos/talos/pageloader/chrome/tscroll.js b/testing/talos/talos/pageloader/chrome/tscroll.js
- --- a/testing/talos/talos/pageloader/chrome/tscroll.js
- +++ b/testing/talos/talos/pageloader/chrome/tscroll.js
- @@ -87,17 +87,18 @@ function testScroll(target, stepSize, op
- if (!report && document.head) {
- var imported = document.createElement("script");
- imported.addEventListener("load", function() {
- report = tpRecordTime;
- resolve();
- });
- // eslint-disable-next-line mozilla/avoid-Date-timing
- - imported.src = "../../scripts/talos-debug.js?dummy=" + Date.now(); // For some browsers to re-read
- + imported.src =
- + "../../scripts/talos-debug.js?dummy=" + performance.now(); // For some browsers to re-read
- document.head.appendChild(imported);
- return;
- }
- resolve();
- });
- }
- @@ -123,17 +124,17 @@ function testScroll(target, stepSize, op
- return new Promise(function(resolve) {
- win.addEventListener("MozAfterPaint", () => resolve(), { once: true });
- });
- }
- function myNow() {
- return win.performance && win.performance.now
- ? win.performance.now()
- - : Date.now(); // eslint-disable-line mozilla/avoid-Date-timing
- + : performance.now(); // eslint-disable-line mozilla/avoid-Date-timing
- }
- var isWindow = target.self === target;
- var getPos = isWindow
- ? function() {
- return target.pageYOffset;
- }
- diff --git a/testing/talos/talos/startup_test/sessionrestore/addon/api.js b/testing/talos/talos/startup_test/sessionrestore/addon/api.js
- --- a/testing/talos/talos/startup_test/sessionrestore/addon/api.js
- +++ b/testing/talos/talos/startup_test/sessionrestore/addon/api.js
- @@ -123,17 +123,17 @@ this.sessionrestore = class extends Exte
- : startup_info.sessionRestored;
- let duration = restoreTime - startup_info.process;
- // Report data to Talos, if possible.
- dump("__start_report" + duration + "__end_report\n\n");
- // Next one is required by the test harness but not used.
- // eslint-disable-next-line mozilla/avoid-Date-timing
- - dump("__startTimestamp" + Date.now() + "__endTimestamp\n\n");
- + dump("__startTimestamp" + performance.now() + "__endTimestamp\n\n");
- } catch (ex) {
- dump(`SessionRestoreTalosTest: error ${ex}\n`);
- dump(ex.stack);
- dump("\n");
- }
- Services.startup.quit(Services.startup.eForceQuit);
- }
- 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
- --- 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
- @@ -52,17 +52,17 @@ this.startup_about_home_paint = class ex
- await this.wait(1000);
- ChromeUtils.idleDispatch(() => {
- this.checkForTelemetry();
- });
- } else {
- // Got our measurement.
- dump("__start_report" + measurement + "__end_report\n\n");
- // eslint-disable-next-line mozilla/avoid-Date-timing
- - dump("__startTimestamp" + Date.now() + "__endTimestamp\n");
- + dump("__startTimestamp" + performance.now() + "__endTimestamp\n");
- let env = Cc["@mozilla.org/process/environment;1"].getService(
- Ci.nsIEnvironment
- );
- if (env.exists("TPPROFILINGINFO")) {
- let profilingInfo = env.get("TPPROFILINGINFO");
- if (profilingInfo !== null) {
- diff --git a/testing/talos/talos/startup_test/tspaint_test.html b/testing/talos/talos/startup_test/tspaint_test.html
- --- a/testing/talos/talos/startup_test/tspaint_test.html
- +++ b/testing/talos/talos/startup_test/tspaint_test.html
- @@ -44,17 +44,17 @@ function failed() {
- function dumpConsoleAndQuit() {
- TalosPowersContent.dumpConsole();
- // Close window asynchronously, there might still be startup operations that still need to run
- window.setTimeout(function() {
- if (window.dump) {
- // eslint-disable-next-line mozilla/avoid-Date-timing
- - dump("__startTimestamp" + Date.now() + "__endTimestamp\n");
- + dump("__startTimestamp" + performance.now() + "__endTimestamp\n");
- }
- TalosPowersContent.goQuitApplication();
- }, 0);
- }
- window.addEventListener("MozAfterPaint", painted, true);
- setTimeout(failed, 5000);
- diff --git a/testing/talos/talos/talos-powers/chrome/talos-powers-content.js b/testing/talos/talos/talos-powers/chrome/talos-powers-content.js
- --- a/testing/talos/talos/talos-powers/chrome/talos-powers-content.js
- +++ b/testing/talos/talos/talos-powers/chrome/talos-powers-content.js
- @@ -162,17 +162,17 @@ addEventListener(
- throw new Error(
- "TalosPowers:ParentExec may only be used with local content"
- );
- }
- let uniqueMessageId =
- "TalosPowers:ParentExec:" +
- content.document.documentURI +
- // eslint-disable-next-line mozilla/avoid-Date-timing
- - Date.now() +
- + performance.now() +
- Math.random();
- // Listener for the reply from the parent process
- addMessageListener("TalosPowers:ParentExec:ReplyMsg", function done(reply) {
- if (reply.data.id != uniqueMessageId) {
- return;
- }
- diff --git a/testing/talos/talos/tests/a11y/dhtml.html b/testing/talos/talos/tests/a11y/dhtml.html
- --- a/testing/talos/talos/tests/a11y/dhtml.html
- +++ b/testing/talos/talos/tests/a11y/dhtml.html
- @@ -13,17 +13,17 @@
- if (!initAccessibility()) {
- dump("__FAILinit:AccessibilityUnvailable__FAIL");
- return;
- }
- TalosContentProfiler.resume("dhtml test start", true).then(() => {
- var container = document.getElementById("container");
- var lastchild = document.getElementById("lastchild");
- - var start = new Date(); // eslint-disable-line mozilla/avoid-Date-timing
- + var start = performance.now(); // eslint-disable-line mozilla/avoid-Date-timing
- var i, div;
- for (i = 0; i < 2000; i++) {
- div = document.createElement("div");
- div.innerHTML = "<input type='text' value='a bc def g hijkl mn op qrs'/>";
- container.insertBefore(div, lastchild);
- }
- for (i = 0; i < 2000; i++) {
- div = document.createElement("div");
- @@ -40,17 +40,17 @@
- }
- document.documentElement.offsetLeft; // flush layout
- setTimeout(postProcessingRecord, 0, start);
- });
- }
- function postProcessingRecord(s) {
- // alert(new Date() - s);
- - let delta = new Date() - s; // eslint-disable-line mozilla/avoid-Date-timing
- + let delta = performance.now() - s; // eslint-disable-line mozilla/avoid-Date-timing
- TalosContentProfiler.pause("dhtml test finish", true).then(() => {
- tpRecordTime(delta, s);
- });
- }
- </script>
- </head>
- <body onload="doInsertion();">
- <div id="container" role="application"><div id="lastchild"></div></div>
- diff --git a/testing/talos/talos/tests/a11y/tablemutation.html b/testing/talos/talos/tests/a11y/tablemutation.html
- --- a/testing/talos/talos/tests/a11y/tablemutation.html
- +++ b/testing/talos/talos/tests/a11y/tablemutation.html
- @@ -113,28 +113,28 @@ function mutateTable() {
- if (!initAccessibility()) {
- dump("__FAILinit:AccessibilityUnvailable__FAIL");
- return;
- }
- ensureAccessibleTreeForId("start");
- TalosContentProfiler.resume("tablemutation start", true).then(() => {
- - var start = new Date(); // eslint-disable-line mozilla/avoid-Date-timing
- + var start = performance.now(); // eslint-disable-line mozilla/avoid-Date-timing
- // Cause all kinds of crazy events
- Range.deleteContents();
- Range.insertNode(Fragment);
- document.documentElement.offsetLeft; // flush layout
- setTimeout(postProcessingRecord, 0, start);
- });
- }
- function postProcessingRecord(s) {
- // alert(new Date() - s);
- - let delta = new Date() - s; // eslint-disable-line mozilla/avoid-Date-timing
- + let delta = performance.now() - s; // eslint-disable-line mozilla/avoid-Date-timing
- TalosContentProfiler.pause("tablemutation finish", true).then(() => {
- tpRecordTime(delta, s);
- });
- }
- </script>
- diff --git a/testing/talos/talos/tests/scroll/scroll.manifest.develop b/testing/talos/talos/tests/scroll/scroll.manifest.develop
- new file mode 100644
- --- /dev/null
- +++ b/testing/talos/talos/tests/scroll/scroll.manifest.develop
- @@ -0,0 +1,6 @@
- +% http://127.0.0.1:52555/tests/scroll/tiled.html
- +% http://127.0.0.1:52555/tests/scroll/tiled-fixed.html
- +% http://127.0.0.1:52555/tests/scroll/tiled-downscale.html
- +% http://127.0.0.1:52555/tests/scroll/tiled-fixed-downscale.html
- +% http://127.0.0.1:52555/tests/scroll/iframe.svg
- +% http://127.0.0.1:52555/tests/scroll/reader.htm
- diff --git a/testing/talos/talos/tests/svg_opacity/svg_opacity.manifest.develop b/testing/talos/talos/tests/svg_opacity/svg_opacity.manifest.develop
- new file mode 100644
- --- /dev/null
- +++ b/testing/talos/talos/tests/svg_opacity/svg_opacity.manifest.develop
- @@ -0,0 +1,4 @@
- +# opacity tests
- +
- +http://127.0.0.1:52555/tests/svg_opacity/big-optimizable-group-opacity-2500.svg
- +http://127.0.0.1:52555/tests/svg_opacity/small-group-opacity-2500.svg
- diff --git a/testing/talos/talos/tests/svg_static/svg_static.manifest.develop b/testing/talos/talos/tests/svg_static/svg_static.manifest.develop
- new file mode 100644
- --- /dev/null
- +++ b/testing/talos/talos/tests/svg_static/svg_static.manifest.develop
- @@ -0,0 +1,8 @@
- +# gearflowers image
- +http://127.0.0.1:52555/tests/svg_static/gearflowers.svg
- +
- +# some generic image compositing tests
- +http://127.0.0.1:52555/tests/svg_static/composite-scale.svg
- +http://127.0.0.1:52555/tests/svg_static/composite-scale-opacity.svg
- +http://127.0.0.1:52555/tests/svg_static/composite-scale-rotate.svg
- +http://127.0.0.1:52555/tests/svg_static/composite-scale-rotate-opacity.svg
- diff --git a/testing/talos/talos/tests/svgx/svgx.manifest.develop b/testing/talos/talos/tests/svgx/svgx.manifest.develop
- new file mode 100644
- --- /dev/null
- +++ b/testing/talos/talos/tests/svgx/svgx.manifest.develop
- @@ -0,0 +1,14 @@
- +# Painting multiple complex paths
- +% http://127.0.0.1:52555/tests/svgx/hixie-001.xml
- +# Painting multiple complex paths with transparency
- +% http://127.0.0.1:52555/tests/svgx/hixie-002.xml
- +# Painting text
- +% http://127.0.0.1:52555/tests/svgx/hixie-003.xml
- +# Painting images
- +% http://127.0.0.1:52555/tests/svgx/hixie-004.xml
- +# Painting linear gradients
- +% http://127.0.0.1:52555/tests/svgx/hixie-005.xml
- +# Painting radial gradients
- +% http://127.0.0.1:52555/tests/svgx/hixie-006.xml
- +# World Map
- +% http://127.0.0.1:52555/tests/svgx/hixie-007.xml
- \ No newline at end of file
- diff --git a/testing/talos/talos/tests/tabpaint/api.js b/testing/talos/talos/tests/tabpaint/api.js
- --- a/testing/talos/talos/tests/tabpaint/api.js
- +++ b/testing/talos/talos/tests/tabpaint/api.js
- @@ -126,17 +126,17 @@ this.tabpaint = class extends ExtensionA
- * @return Promise
- * Resolves once the tab has been fully removed. Resolves
- * with the time (in ms) it took to open the tab from the parent.
- */
- async openTabFromParent(gBrowser, target) {
- TalosParentProfiler.resume("tabpaint parent start");
- // eslint-disable-next-line mozilla/avoid-Date-timing
- - gBrowser.selectedTab = gBrowser.addTab(`${target}?${Date.now()}`, {
- + gBrowser.selectedTab = gBrowser.addTab(`${target}?${performance.now()}`, {
- triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
- });
- let { tab, delta } = await this.whenTabShown();
- TalosParentProfiler.pause("tabpaint parent end");
- await this.removeTab(tab);
- return delta;
- }
- diff --git a/testing/talos/talos/tests/tabpaint/tabpaint.html b/testing/talos/talos/tests/tabpaint/tabpaint.html
- --- a/testing/talos/talos/tests/tabpaint/tabpaint.html
- +++ b/testing/talos/talos/tests/tabpaint/tabpaint.html
- @@ -10,17 +10,17 @@ function init() {
- window.addEventListener("TabPaint:FinalResults", (event) => {
- let { fromParent, fromContent } = event.detail;
- tpRecordTime([fromParent, fromContent].join(","), 0, "tabpaint-from-parent, tabpaint-from-content");
- }, {once: true});
- window.addEventListener("TabPaint:OpenFromContent", (event) => {
- let target = document.getElementById("target");
- - let now = Date.now(); // eslint-disable-line mozilla/avoid-Date-timing
- + let now = performance.now(); // eslint-disable-line mozilla/avoid-Date-timing
- target.href = `${targetURL.href}?${now}`;
- target.click();
- });
- async function tryPing() {
- let pingPromise = new Promise(resolve => {
- window.addEventListener("TabPaint:Pong", resolve, {once: true});
- diff --git a/testing/talos/talos/tests/tabpaint/tabpaint.manifest.develop b/testing/talos/talos/tests/tabpaint/tabpaint.manifest.develop
- new file mode 100644
- --- /dev/null
- +++ b/testing/talos/talos/tests/tabpaint/tabpaint.manifest.develop
- @@ -0,0 +1,2 @@
- +% http://127.0.0.1:52892/tests/tabpaint/tabpaint.html
- +
- diff --git a/testing/talos/talos/tests/tart/addon/content/framescript.js b/testing/talos/talos/tests/tart/addon/content/framescript.js
- --- a/testing/talos/talos/tests/tart/addon/content/framescript.js
- +++ b/testing/talos/talos/tests/tart/addon/content/framescript.js
- @@ -26,17 +26,20 @@
- if (e.detail.command.name == "ping") {
- dispatchReply();
- return;
- }
- var uniqueMessageId =
- // eslint-disable-next-line mozilla/avoid-Date-timing
- - TART_PREFIX + content.document.documentURI + Date.now() + Math.random();
- + TART_PREFIX +
- + content.document.documentURI +
- + performance.now() +
- + Math.random();
- addMessageListener(TART_PREFIX + "chrome-exec-reply", function done(
- reply
- ) {
- if (reply.data.id == uniqueMessageId) {
- removeMessageListener(TART_PREFIX + "chrome-exec-reply", done);
- dispatchReply(reply.data.result);
- }
- diff --git a/testing/talos/talos/tests/tart/tart.manifest.develop b/testing/talos/talos/tests/tart/tart.manifest.develop
- new file mode 100644
- --- /dev/null
- +++ b/testing/talos/talos/tests/tart/tart.manifest.develop
- @@ -0,0 +1,1 @@
- +% http://127.0.0.1:52555/tests/tart/tart.html#auto
- diff --git a/testing/talos/talos/tests/tresize/addon/content/framescript.js b/testing/talos/talos/tests/tresize/addon/content/framescript.js
- --- a/testing/talos/talos/tests/tresize/addon/content/framescript.js
- +++ b/testing/talos/talos/tests/tresize/addon/content/framescript.js
- @@ -3,17 +3,17 @@
- addEventListener(
- TRESIZE_PREFIX + "chrome-run-event",
- function(e) {
- var uniqueMessageId =
- TRESIZE_PREFIX +
- content.document.documentURI +
- // eslint-disable-next-line mozilla/avoid-Date-timing
- - Date.now() +
- + performance.now() +
- Math.random();
- addMessageListener(TRESIZE_PREFIX + "chrome-run-reply", function done(
- reply
- ) {
- if (reply.data.id == uniqueMessageId) {
- removeMessageListener(TRESIZE_PREFIX + "chrome-run-reply", done);
- content.wrappedJSObject.tpRecordTime(reply.data.result.average);
Add Comment
Please, Sign In to add comment