Backed out 6 changesets (bug 1189901) for Windows talos g1 and s failures a=backout CLOSED TREE

Backed out changeset 14660f4f2b23 (bug 1189901)
Backed out changeset 647db9f59d9e (bug 1189901)
Backed out changeset 926a610af8a7 (bug 1189901)
Backed out changeset 610b70634239 (bug 1189901)
Backed out changeset 866c0244a7c1 (bug 1189901)
Backed out changeset 081c6b4986a9 (bug 1189901)
This commit is contained in:
Wes Kocher 2016-09-27 11:09:34 -07:00
parent c1505ef26b
commit 887e651a5f
13 changed files with 81 additions and 367 deletions

View File

@ -1,6 +1,9 @@
// Note: This file is used at both tscrollx and tp5o_scroll. With the former as
// unprivileged code.
// - Please make sure that any changes apply cleanly to all use cases.
// Note: The content from here upto '// End scroll test' is duplicated at:
// - talos/tests/scroll/scroll-test.js
// - inside talos/pageloader/chrome/tscroll.js
//
// - Please keep these copies in sync.
// - Pleace make sure that any changes apply cleanly to all use cases.
function testScroll(target, stepSize, opt_reportFunc, opt_numSteps)
{
@ -12,108 +15,10 @@ function testScroll(target, stepSize, opt_reportFunc, opt_numSteps)
win = window;
}
var result = {
names: [],
values: [],
};
// We report multiple results, so we base the name on the path.
// Everything after '/tp5n/' if exists (for tp5o_scroll), or the file name at
// the path if non-empty (e.g. with tscrollx), or the last dir otherwise (e.g.
// 'mydir' for 'http://my.domain/dir1/mydir/').
var href = win.location.href;
var testBaseName = href.split("/tp5n/")[1]
|| href.split("/").pop()
|| href.split("/").splice(-2, 1)[0]
|| "REALLY_WEIRD_URI";
// Verbatim copy from talos-powers/content/TalosPowersContent.js
// If the origin changes, this copy should be updated.
TalosPowersParent = {
replyId: 1,
// dispatch an event to the framescript and register the result/callback event
exec: function(commandName, arg, callback, opt_custom_window) {
let win = opt_custom_window || window;
let replyEvent = "TalosPowers:ParentExec:ReplyEvent:" + this.replyId++;
if (callback) {
win.addEventListener(replyEvent, function rvhandler(e) {
win.removeEventListener(replyEvent, rvhandler);
callback(e.detail);
});
}
win.dispatchEvent(
new win.CustomEvent("TalosPowers:ParentExec:QueryEvent", {
bubbles: true,
detail: {
command: {
name: commandName,
data: arg,
},
listeningTo: replyEvent,
}
})
);
},
};
// End of code from talos-powers
var report;
/**
* Sets up the value of 'report' as a function for reporting the test result[s].
* Chooses between the "usual" tpRecordTime which the pageloader addon injects
* to pages, or a custom function in case we're a framescript which pageloader
* added to the tested page, or a debug tpRecordTime from talos-debug.js if
* running in a plain browser.
*
* @returns Promise
*/
function P_setupReportFn() {
return new Promise(function(resolve) {
report = opt_reportFunc || win.tpRecordTime;
if (report == 'PageLoader:RecordTime') {
report = function(duration, start, name) {
var msg = { time: duration, startTime: start, testName: name };
sendAsyncMessage('PageLoader:RecordTime', msg);
}
resolve();
return;
}
// Not part of the test and does nothing if we're within talos.
// Provides an alternative tpRecordTime (with some stats display) if running in a browser.
if (!report && document.head) {
var imported = document.createElement('script');
imported.addEventListener("load", function() {
report = tpRecordTime;
resolve();
});
imported.src = '../../scripts/talos-debug.js?dummy=' + Date.now(); // For some browsers to re-read
document.head.appendChild(imported);
return;
}
resolve();
});
}
function FP_wait(ms) {
return function() {
return new Promise(function(resolve) {
setTimeout(resolve, ms);
});
};
}
function rAF(fn) {
return content.requestAnimationFrame(fn);
}
function P_rAF() {
return new Promise(function(resolve) {
rAF(resolve);
});
}
function myNow() {
return (win.performance && win.performance.now) ?
@ -132,12 +37,6 @@ function testScroll(target, stepSize, opt_reportFunc, opt_numSteps)
var doScrollTick = isWindow ? function() { target.scrollBy(0, stepSize); ensureScroll(); }
: function() { target.scrollTop += stepSize; ensureScroll(); };
var setSmooth = isWindow ? function() { target.document.scrollingElement.style.scrollBehavior = "smooth"; }
: function() { target.style.scrollBehavior = "smooth"; };
var gotoBottom = isWindow ? function() { target.scrollTo(0, target.scrollMaxY); }
: function() { target.scrollTop = target.scrollHeight; };
function ensureScroll() { // Ensure scroll by reading computed values. screenY is for X11.
if (!this.dummyEnsureScroll) {
this.dummyEnsureScroll = 1;
@ -148,125 +47,86 @@ function testScroll(target, stepSize, opt_reportFunc, opt_numSteps)
// For reference, rAF should fire on vsync, but Gecko currently doesn't use vsync.
// Instead, it uses 1000/layout.frame_rate
// (with 60 as default value when layout.frame_rate == -1).
function P_syncScrollTest() {
return new Promise(function(resolve) {
// We should be at the top of the page now.
var start = myNow();
var lastScrollPos = getPos();
var lastScrollTime = start;
var durations = [];
function startTest()
{
// We should be at the top of the page now.
var start = myNow();
var lastScrollPos = getPos();
var lastScrollTime = start;
var durations = [];
var report = opt_reportFunc || tpRecordTime;
if (report == 'PageLoader:RecordTime') {
report = function(duration) {
var msg = { time: duration, startTime: '', testName: '' };
sendAsyncMessage('PageLoader:RecordTime', msg);
}
}
function tick() {
var now = myNow();
var duration = now - lastScrollTime;
lastScrollTime = now;
function tick() {
var now = myNow();
var duration = now - lastScrollTime;
lastScrollTime = now;
durations.push(duration);
doScrollTick();
durations.push(duration);
doScrollTick();
/* stop scrolling if we can't scroll more, or if we've reached requested number of steps */
if ((getPos() == lastScrollPos) || (opt_numSteps && (durations.length >= (opt_numSteps + 2)))) {
if (typeof(Profiler) !== "undefined") {
Profiler.pause();
}
// Note: The first (1-5) intervals WILL be longer than the rest.
// First interval might include initial rendering and be extra slow.
// Also requestAnimationFrame needs to sync (optimally in 1 frame) after long frames.
// Suggested: Ignore the first 5 intervals.
durations.pop(); // Last step was 0.
durations.pop(); // and the prev one was shorter and with end-of-page logic, ignore both.
if (win.talosDebug)
win.talosDebug.displayData = true; // In a browser: also display all data points.
// For analysis (otherwise, it's too many data points for talos):
var sum = 0;
for (var i = 0; i < durations.length; i++)
sum += Number(durations[i]);
// Report average interval or (failsafe) 0 if no intervls were recorded
result.values.push(durations.length ? sum / durations.length : 0);
result.names.push(testBaseName);
resolve();
return;
/* stop scrolling if we can't scroll more, or if we've reached requested number of steps */
if ((getPos() == lastScrollPos) || (opt_numSteps && (durations.length >= (opt_numSteps + 2)))) {
if (typeof(Profiler) !== "undefined") {
Profiler.pause();
}
lastScrollPos = getPos();
rAF(tick);
// Note: The first (1-5) intervals WILL be longer than the rest.
// First interval might include initial rendering and be extra slow.
// Also requestAnimationFrame needs to sync (optimally in 1 frame) after long frames.
// Suggested: Ignore the first 5 intervals.
durations.pop(); // Last step was 0.
durations.pop(); // and the prev one was shorter and with end-of-page logic, ignore both.
if (win.talosDebug)
win.talosDebug.displayData = true; // In a browser: also display all data points.
// For analysis (otherwise, it's too many data points for talos):
var sum = 0;
for (var i = 0; i < durations.length; i++)
sum += Number(durations[i]);
// Report average interval or (failsafe) 0 if no intervls were recorded
report(durations.length ? sum / durations.length : 0);
return;
}
if (typeof(Profiler) !== "undefined") {
Profiler.resume();
}
lastScrollPos = getPos();
rAF(tick);
});
}
function P_testAPZScroll() {
var APZ_MEASURE_MS = 1000;
function startFrameTimeRecording(cb) {
TalosPowersParent.exec("startFrameTimeRecording", null, cb, win);
}
function stopFrameTimeRecording(handle, cb) {
TalosPowersParent.exec("stopFrameTimeRecording", handle, cb, win);
if (typeof(Profiler) !== "undefined") {
Profiler.resume();
}
return new Promise(function(resolve, reject) {
setSmooth();
var startts = Date.now();
var handle = -1;
startFrameTimeRecording(function(rv) {
handle = rv;
});
// Get the measurements after APZ_MEASURE_MS of scrolling
setTimeout(function() {
var endts = Date.now();
stopFrameTimeRecording(handle, function(intervals) {
function average(arr) {
var sum = 0;
for(var i = 0; i < arr.length; i++)
sum += arr[i];
return arr.length ? sum / arr.length : 0;
}
// remove two frames on each side of the recording to get a cleaner result
result.values.push(average(intervals.slice(2, intervals.length - 2)));
result.names.push("CSSOM." + testBaseName);
resolve();
});
}, APZ_MEASURE_MS);
gotoBottom(); // trigger the APZ scroll
});
rAF(tick);
}
P_setupReportFn()
.then(FP_wait(260))
.then(gotoTop)
.then(P_rAF)
.then(P_syncScrollTest)
.then(gotoTop)
.then(FP_wait(260))
.then(P_testAPZScroll)
.then(function() {
report(result.values.join(","), 0, result.names.join(","));
});
// Not part of the test and does nothing if we're within talos,
// But provides an alternative tpRecordTime (with some stats display) if running in a browser
// If a callback is provided, then we don't need this debug reporting.
if(!opt_reportFunc && document.head) {
var imported = document.createElement('script');
imported.src = '../../scripts/talos-debug.js?dummy=' + Date.now(); // For some browsers to re-read
document.head.appendChild(imported);
}
setTimeout(function(){
gotoTop();
rAF(startTest);
}, 260);
}
// End scroll test - End duplicated code
// This code below here is unique to tscroll.js inside of pageloader
try {
function handleMessageFromChrome(message) {
var payload = message.data.details;
testScroll(payload.target, payload.stepSize, 'PageLoader:RecordTime', payload.opt_numSteps);
}
function handleMessageFromChrome(message) {
var payload = message.data.details;
testScroll(payload.target, payload.stepSize, 'PageLoader:RecordTime', payload.opt_numSteps);
}
addMessageListener("PageLoader:ScrollTest", handleMessageFromChrome);
} catch (e) {}
addMessageListener("PageLoader:ScrollTest", handleMessageFromChrome);

View File

@ -4,7 +4,7 @@
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>pageloader@mozilla.org</em:id>
<em:version>1.0.13</em:version>
<em:version>1.0.12</em:version>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>

View File

@ -2,8 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// This file is loaded as a framescript
var { interfaces: Ci, utils: Cu } = Components;
/**
@ -82,42 +80,3 @@ addEventListener("TalosPowersContentGetStartupInfo", (e) => {
event));
});
});
/* *
* Mediator for the generic ParentExec mechanism.
* Listens for a query event from the content, forwards it as a query message
* to the parent, listens to a parent reply message, and forwards it as a reply
* event for the content to capture.
* The consumer API for this mechanism is at content/TalosPowersContent.js
* and the callees are at ParentExecServices at components/TalosPowersService.js
*/
addEventListener("TalosPowers:ParentExec:QueryEvent", function (e) {
if (content.location.protocol != "file:" &&
content.location.hostname != "localhost" &&
content.location.hostname != "127.0.0.1") {
throw new Error("TalosPowers:ParentExec may only be used with local content");
}
let uniqueMessageId = "TalosPowers:ParentExec:"
+ content.document.documentURI + Date.now() + Math.random();
// Listener for the reply from the parent process
addMessageListener("TalosPowers:ParentExec:ReplyMsg", function done(reply) {
if (reply.data.id != uniqueMessageId)
return;
removeMessageListener("TalosPowers:ParentExec:ReplyMsg", done);
// reply to content via an event
let contentEvent = Cu.cloneInto({
bubbles: true,
detail: reply.data.result
}, content);
content.dispatchEvent(new content.CustomEvent(e.detail.listeningTo, contentEvent));
});
// Send the query to the parent process
sendAsyncMessage("TalosPowers:ParentExec:QueryMsg", {
command: e.detail.command,
id: uniqueMessageId
});
}, false, true); // wantsUntrusted since we're exposing to unprivileged

View File

@ -41,7 +41,6 @@ TalosPowersService.prototype = {
Services.mm.addMessageListener("TalosContentProfiler:Command", this);
Services.mm.addMessageListener("TalosPowersContent:ForceCCAndGC", this);
Services.mm.addMessageListener("TalosPowersContent:GetStartupInfo", this);
Services.mm.addMessageListener("TalosPowers:ParentExec:QueryMsg", this);
Services.obs.addObserver(this, "xpcom-shutdown", false);
},
@ -67,11 +66,6 @@ TalosPowersService.prototype = {
}
case "TalosPowersContent:GetStartupInfo": {
this.receiveGetStartupInfo(message);
break;
}
case "TalosPowers:ParentExec:QueryMsg": {
this.RecieveParentExecCommand(message);
break;
}
}
},
@ -262,58 +256,6 @@ TalosPowersService.prototype = {
startupInfo);
}
},
// These services are exposed to local unprivileged content.
// Each service is a function which accepts an argument, a callback for sending
// the reply (possibly async), and the parent window as a utility.
// arg/reply semantice are service-specific.
// To add a service: add a method at ParentExecServices here, then at the content:
// <script src="chrome://talos-powers-content/content/TalosPowersContent.js"></script>
// and then e.g. TalosPowersParent.exec("sampleParentService", myArg, myCallback)
// Sample service:
/*
// arg: anything. return: sample reply
sampleParentService: function(arg, callback, win) {
win.setTimeout(function() {
callback("sample reply for: " + arg);
}, 500);
},
*/
ParentExecServices: {
// arg: ignored. return: handle (number) for use with stopFrameTimeRecording
startFrameTimeRecording: function(arg, callback, win) {
var rv = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.startFrameTimeRecording();
callback(rv);
},
// arg: handle from startFrameTimeRecording. return: array with composition intervals
stopFrameTimeRecording: function(arg, callback, win) {
var rv = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.stopFrameTimeRecording(arg);
callback(rv);
},
},
RecieveParentExecCommand(msg) {
function sendResult(result) {
let mm = msg.target.messageManager;
mm.sendAsyncMessage("TalosPowers:ParentExec:ReplyMsg", {
id: msg.data.id,
result: result
});
}
let command = msg.data.command;
if (!this.ParentExecServices.hasOwnProperty(command.name))
throw new Error("TalosPowers:ParentExec: Invalid service '" + command.name + "'");
this.ParentExecServices[command.name](command.data, sendResult, msg.target.ownerGlobal);
},
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TalosPowersService]);

View File

@ -2,14 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// This file should be executed by the [possibly unprivileged] consumer, e.g.:
// <script src="chrome://talos-powers-content/content/TalosPowersContent.js"></script>
// and then e.g. TalosPowersParent.exec("sampleParentService", myArg, myCallback)
// It marely sends a query event and possibly listens to a reply event, and does not
// depend on any special privileges.
var TalosPowersContent;
var TalosPowersParent;
(function() {
TalosPowersContent = {
@ -52,40 +45,4 @@ var TalosPowersParent;
});
},
};
/**
* Generic interface to service functions which run at the parent process.
*/
// If including this script proves too much touble, you may embed the following
// code verbatim instead, and keep the copy up to date with its source here:
TalosPowersParent = {
replyId: 1,
// dispatch an event to the framescript and register the result/callback event
exec: function(commandName, arg, callback, opt_custom_window) {
let win = opt_custom_window || window;
let replyEvent = "TalosPowers:ParentExec:ReplyEvent:" + this.replyId++;
if (callback) {
win.addEventListener(replyEvent, function rvhandler(e) {
win.removeEventListener(replyEvent, rvhandler);
callback(e.detail);
});
}
win.dispatchEvent(
new win.CustomEvent("TalosPowers:ParentExec:QueryEvent", {
bubbles: true,
detail: {
command: {
name: commandName,
data: arg,
},
listeningTo: replyEvent,
}
})
);
},
};
// End of possibly embedded code
})();

View File

@ -498,9 +498,7 @@ class tp5o_scroll(PageloaderTest):
tpmozafterpaint = False
preferences = {'layout.frame_rate': 0,
'docshell.event_starvation_delay_hint': 1,
'dom.send_after_paint_to_content': False,
'layout.css.scroll-behavior.spring-constant': "'10'",
'toolkit.framesRecording.bufferSize': 10000}
'dom.send_after_paint_to_content': False}
filters = filter.ignore_first.prepare(1) + filter.median.prepare()
unit = '1/FPS'
@ -690,9 +688,7 @@ class tscrollx(PageloaderTest):
""" ASAP mode """
preferences = {'layout.frame_rate': 0,
'docshell.event_starvation_delay_hint': 1,
'dom.send_after_paint_to_content': False,
'layout.css.scroll-behavior.spring-constant': "'10'",
'toolkit.framesRecording.bufferSize': 10000}
'dom.send_after_paint_to_content': False}
filters = filter.ignore_first.prepare(5) + filter.median.prepare()
unit = 'ms'

View File

@ -35,5 +35,5 @@
<!-- this has to come after the iframe for some reason -->
<script type="text/javascript" xlink:href="../../scripts/talos-debug.js"/>
<script type="text/javascript" xlink:href="../../scripts/Profiler.js"/>
<script type="text/javascript" xlink:href="../../pageloader/chrome/tscroll.js"/>
<script type="text/javascript" xlink:href="scroll-test.js"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -4,7 +4,7 @@
<title>Perf test case</title>
<link type="text/css" rel="stylesheet" href="reader.css">
<script src="../../scripts/Profiler.js" type="text/javascript"></script>
<script src="../../pageloader/chrome/tscroll.js" type="text/javascript"></script>
<script src="scroll-test.js" type="text/javascript"></script>
<!--
This resembles the layout of Google Reader as of 2009-11-23
and exposed bug 530686.

View File

@ -9,7 +9,7 @@
}
</style>
<script src="../../scripts/Profiler.js" type="text/javascript"></script>
<script src="../../pageloader/chrome/tscroll.js" type="text/javascript"></script>
<script src="scroll-test.js" type="text/javascript"></script>
</head>
<body onload = "testScroll(window, 5)">
<P>

View File

@ -10,7 +10,7 @@
}
</style>
<script src="../../scripts/Profiler.js" type="text/javascript"></script>
<script src="../../pageloader/chrome/tscroll.js" type="text/javascript"></script>
<script src="scroll-test.js" type="text/javascript"></script>
</head>
<body onload = "testScroll(window, 5)">
<P>

View File

@ -7,7 +7,7 @@
}
</style>
<script src="../../scripts/Profiler.js" type="text/javascript"></script>
<script src="../../pageloader/chrome/tscroll.js" type="text/javascript"></script>
<script src="scroll-test.js" type="text/javascript"></script>
</head>
<body onload = "testScroll(window, 5)">
<P>

View File

@ -6,7 +6,7 @@
}
</style>
<script src="../../scripts/Profiler.js" type="text/javascript"></script>
<script src="../../pageloader/chrome/tscroll.js" type="text/javascript"></script>
<script src="scroll-test.js" type="text/javascript"></script>
</head>
<body onload = "testScroll(window, 5)">
<P>