Bug 1372292 - Update sessionrestore Talos test profiling support. r?Yoric
MozReview-Commit-ID: Hct701O3R8C
--- a/testing/talos/talos/startup_test/sessionrestore/addon/SessionRestoreTalosTest.js
+++ b/testing/talos/talos/startup_test/sessionrestore/addon/SessionRestoreTalosTest.js
@@ -125,16 +125,33 @@ nsSessionRestoreTalosTest.prototype = {
dump("\n");
}
},
/**
* A window is ready for us to open the result tab in.
*/
onWindow(win) {
- win.gBrowser.addTab("chrome://session-restore-test/content/index.html");
+ let args = win.arguments[0];
+ let queryString = "";
+
+ if (args && args instanceof Ci.nsIArray) {
+ // For start-up tests Gecko Profiler arguments are passed to the first URL in
+ // the query string, with the presumption that the tab that is being loaded at
+ // start-up will want to use those arguments with the TalosContentProfiler scripts.
+ //
+ // Because we're actually loading the results (and the content that reports
+ // the results) in a new tab _after_ the window has opened, we need to send
+ // those arguments over to the new tab that we open so that the profiler scripts
+ // will continue to work.
+ Cu.importGlobalProperties(["URL"]);
+ let url = new URL(args.queryElementAt(0, Ci.nsISupportsString).data);
+ queryString = url.search;
+ }
+
+ win.gBrowser.addTab("chrome://session-restore-test/content/index.html" + queryString);
}
};
////////////////////////////////////////////////////////////////////////////////
//// Module
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([nsSessionRestoreTalosTest]);
--- a/testing/talos/talos/startup_test/sessionrestore/addon/content/index.html
+++ b/testing/talos/talos/startup_test/sessionrestore/addon/content/index.html
@@ -1,17 +1,17 @@
<html>
<head>
<meta charset="UTF-8"/>
<title>Session Restore Regression Test</title>
<script type="text/javascript" src="chrome://pageloader/content/MozillaFileLogger.js"></script>
<script type="text/javascript" src="chrome://pageloader/content/quit.js"></script>
-<script type="text/javascript" src="chrome://pageloader/content/Profiler.js"></script>
+<script type="text/javascript" src="chrome://talos-powers-content/content/TalosContentProfiler.js"></script>
<script type="text/javascript" src="chrome://session-restore-test/content/main.js">
</script>
<div>
<strong>Time between sessionRestoreInit and sessionRestored</strong>
<span id="sessionRestoreInit-to-sessionRestored">
(in progress)
</span>
--- a/testing/talos/talos/startup_test/sessionrestore/addon/content/main.js
+++ b/testing/talos/talos/startup_test/sessionrestore/addon/content/main.js
@@ -6,23 +6,23 @@ var Services = Components.utils.import("
const MSG_REQUEST = "session-restore-test?duration";
const MSG_PROVIDE = "session-restore-test:duration";
addEventListener("load", function() {
Services.cpmm.addMessageListener(MSG_PROVIDE,
/**
* Display the result, send it to the harness and quit.
*/
- function finish(msg) {
+ async function finish(msg) {
console.log(`main.js: received data on ${MSG_PROVIDE}`, msg);
Services.cpmm.removeMessageListener(MSG_PROVIDE, finish);
var duration = msg.data.duration;
- Profiler.pause("This test measures the time between sessionRestoreInit and sessionRestored, ignore everything around that");
- Profiler.initFromURLQueryParams(location.search);
- Profiler.finishStartupProfiling();
+ TalosContentProfiler.initFromURLQueryParams(location.search);
+ await TalosContentProfiler.pause("This test measures the time between sessionRestoreInit and sessionRestored, ignore everything around that");
+ await TalosContentProfiler.finishStartupProfiling();
// Show result on screen. Nice but not really necessary.
document.getElementById("sessionRestoreInit-to-sessionRestored").textContent = duration + "ms";
// Report data to Talos, if possible
dumpLog("__start_report" +
duration +
"__end_report\n\n");