зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1375903 - Enable eslint on testing/talos - mechanical changes; r=jmaher
Most of these changes were made by 'mach eslint --fix'.
This commit is contained in:
Родитель
31c7043d79
Коммит
f227d92d5a
|
@ -305,7 +305,12 @@ testing/modules/ajv-4.1.1.js
|
|||
testing/modules/sinon-2.3.2.js
|
||||
# octothorpe used for pref file comment causes parsing error
|
||||
testing/mozbase/mozprofile/tests/files/prefs_with_comments.js
|
||||
testing/talos/**
|
||||
testing/talos/talos/scripts/jszip.min.js
|
||||
testing/talos/talos/tests/canvasmark/**
|
||||
testing/talos/talos/tests/dromaeo/**
|
||||
testing/talos/talos/tests/v8_7/**
|
||||
testing/talos/talos/tests/kraken/**
|
||||
|
||||
testing/web-platform/**
|
||||
testing/xpcshell/moz-http2/**
|
||||
testing/xpcshell/node-http2/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// This file is needed to work around a Firefox bug where capability.principal
|
||||
// This file is needed to work around a Firefox bug where capability.principal
|
||||
// prefs in user.js don't get recognized until the second browser launch
|
||||
// which is too late for our purposes of using quit.js. Loading the principals
|
||||
// which is too late for our purposes of using quit.js. Loading the principals
|
||||
// from prefs.js avoids this issue.
|
||||
user_pref("capability.principal.codebase.p0.granted", "UniversalPreferencesWrite UniversalXPConnect UniversalPreferencesRead");
|
||||
user_pref("capability.principal.codebase.p0.id", "file://");
|
||||
|
|
|
@ -33,13 +33,15 @@
|
|||
$("status").style.display = "inline";
|
||||
|
||||
createXpiDataUri(base, files, {
|
||||
onprogress: function(p) { $("status-text").innerHTML = "Preparing ... " + p.toFixed(0) + "%"; },
|
||||
onprogress(p) { $("status-text").innerHTML = "Preparing ... " + p.toFixed(0) + "%"; },
|
||||
|
||||
onerror : function(e) { $("status-text").innerHTML = "Oops, couldn't generate XPI. Reload to retry.<br/>" + e; },
|
||||
onerror(e) { $("status-text").innerHTML = "Oops, couldn't generate XPI. Reload to retry.<br/>" + e; },
|
||||
|
||||
onsuccess : function(u) { $("xpi-link").href = u;
|
||||
$("status").style.display = "none";
|
||||
$("result").style.display = "inline"; }
|
||||
onsuccess(u) {
|
||||
$("xpi-link").href = u;
|
||||
$("status").style.display = "none";
|
||||
$("result").style.display = "inline";
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -30,13 +30,15 @@
|
|||
$("status").style.display = "inline";
|
||||
|
||||
createXpiDataUri(base, files, {
|
||||
onprogress: function(p) { $("status-text").innerHTML = "Preparing ... " + p.toFixed(0) + "%"; },
|
||||
onprogress(p) { $("status-text").innerHTML = "Preparing ... " + p.toFixed(0) + "%"; },
|
||||
|
||||
onerror : function(e) { $("status-text").innerHTML = "Oops, couldn't generate XPI. Reload to retry.<br/>" + e; },
|
||||
onerror(e) { $("status-text").innerHTML = "Oops, couldn't generate XPI. Reload to retry.<br/>" + e; },
|
||||
|
||||
onsuccess : function(u) { $("xpi-link").href = u;
|
||||
$("status").style.display = "none";
|
||||
$("result").style.display = "inline"; }
|
||||
onsuccess(u) {
|
||||
$("xpi-link").href = u;
|
||||
$("status").style.display = "none";
|
||||
$("result").style.display = "inline";
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/**
|
||||
* MozillaFileLogger, a log listener that can write to a local file.
|
||||
*/
|
||||
*/
|
||||
|
||||
//double logging to account for normal mode and ipc mode (mobile_profile only)
|
||||
//Ideally we would remove the dump() and just do ipc logging
|
||||
// double logging to account for normal mode and ipc mode (mobile_profile only)
|
||||
// Ideally we would remove the dump() and just do ipc logging
|
||||
function dumpLog(msg) {
|
||||
dump(msg);
|
||||
MozillaFileLogger.log(msg);
|
||||
|
@ -56,8 +56,8 @@ MozillaFileLogger.init = function(path) {
|
|||
}
|
||||
|
||||
MozillaFileLogger.getLogCallback = function() {
|
||||
return function (msg) {
|
||||
var data = msg.num + " " + msg.level + " " + msg.info.join(' ') + "\n";
|
||||
return function(msg) {
|
||||
var data = msg.num + " " + msg.level + " " + msg.info.join(" ") + "\n";
|
||||
if (MozillaFileLogger._foStream)
|
||||
MozillaFileLogger._foStream.write(data, data.length);
|
||||
|
||||
|
@ -72,21 +72,21 @@ MozillaFileLogger.log = function(msg) {
|
|||
try {
|
||||
if (MozillaFileLogger._foStream)
|
||||
MozillaFileLogger._foStream.write(msg, msg.length);
|
||||
} catch(ex) {}
|
||||
} catch (ex) {}
|
||||
}
|
||||
|
||||
MozillaFileLogger.close = function() {
|
||||
if(MozillaFileLogger._foStream)
|
||||
if (MozillaFileLogger._foStream)
|
||||
MozillaFileLogger._foStream.close();
|
||||
|
||||
|
||||
MozillaFileLogger._foStream = null;
|
||||
MozillaFileLogger._file = null;
|
||||
}
|
||||
|
||||
try {
|
||||
var prefs = Cc['@mozilla.org/preferences-service;1']
|
||||
var prefs = Cc["@mozilla.org/preferences-service;1"]
|
||||
.getService(Ci.nsIPrefBranch2);
|
||||
var filename = prefs.getCharPref('talos.logfile');
|
||||
var filename = prefs.getCharPref("talos.logfile");
|
||||
MozillaFileLogger.init(filename);
|
||||
} catch (ex) {} //pref does not exist, return empty string
|
||||
} catch (ex) {} // pref does not exist, return empty string
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
// relevant parts of our tests.
|
||||
var Profiler;
|
||||
|
||||
(function(){
|
||||
(function() {
|
||||
var _profiler;
|
||||
|
||||
// If this script is loaded in a framescript context, there won't be a
|
||||
|
@ -40,7 +40,7 @@ var Profiler;
|
|||
// (It's not required nor allowed for addons since Firefox 17)
|
||||
// It's used inside talos from non-privileged pages (like during tscroll),
|
||||
// and it works because talos disables all/most security measures.
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
} catch (e) {}
|
||||
|
||||
try {
|
||||
|
@ -71,7 +71,7 @@ var Profiler;
|
|||
* - gecko_profile_threads
|
||||
* - gecko_profile_dir
|
||||
*/
|
||||
initFromObject: function Profiler__initFromObject (obj) {
|
||||
initFromObject: function Profiler__initFromObject(obj) {
|
||||
if (obj &&
|
||||
("gecko_profile_dir" in obj) && typeof obj.gecko_profile_dir == "string" &&
|
||||
("gecko_profile_interval" in obj) && Number.isFinite(obj.gecko_profile_interval * 1) &&
|
||||
|
@ -84,10 +84,10 @@ var Profiler;
|
|||
enabled = true;
|
||||
}
|
||||
},
|
||||
initFromURLQueryParams: function Profiler__initFromURLQueryParams (locationSearch) {
|
||||
initFromURLQueryParams: function Profiler__initFromURLQueryParams(locationSearch) {
|
||||
this.initFromObject(searchToObject(locationSearch));
|
||||
},
|
||||
beginTest: function Profiler__beginTest (testName) {
|
||||
beginTest: function Profiler__beginTest(testName) {
|
||||
currentTest = testName;
|
||||
if (_profiler && enabled) {
|
||||
_profiler.StartProfiler(profiler_entries, profiler_interval,
|
||||
|
@ -98,13 +98,13 @@ var Profiler;
|
|||
}
|
||||
}
|
||||
},
|
||||
finishTest: function Profiler__finishTest () {
|
||||
finishTest: function Profiler__finishTest() {
|
||||
if (_profiler && enabled) {
|
||||
_profiler.dumpProfileToFile(profiler_dir + "/" + currentTest + ".profile");
|
||||
_profiler.StopProfiler();
|
||||
}
|
||||
},
|
||||
finishTestAsync: function Profiler__finishTest () {
|
||||
finishTestAsync: function Profiler__finishTest() {
|
||||
if (!(_profiler && enabled)) {
|
||||
return;
|
||||
}
|
||||
|
@ -141,13 +141,13 @@ var Profiler;
|
|||
});
|
||||
});
|
||||
},
|
||||
finishStartupProfiling: function Profiler__finishStartupProfiling () {
|
||||
finishStartupProfiling: function Profiler__finishStartupProfiling() {
|
||||
if (_profiler && enabled) {
|
||||
_profiler.dumpProfileToFile(profiler_dir + "/startup.profile");
|
||||
_profiler.StopProfiler();
|
||||
}
|
||||
},
|
||||
resume: function Profiler__resume (name, explicit) {
|
||||
resume: function Profiler__resume(name, explicit) {
|
||||
if (_profiler) {
|
||||
if (_profiler.ResumeSampling) {
|
||||
_profiler.ResumeSampling();
|
||||
|
@ -155,7 +155,7 @@ var Profiler;
|
|||
_profiler.AddMarker(explicit ? name : 'Start of test "' + (name || test_name) + '"');
|
||||
}
|
||||
},
|
||||
pause: function Profiler__pause (name, explicit) {
|
||||
pause: function Profiler__pause(name, explicit) {
|
||||
if (_profiler) {
|
||||
if (_profiler.PauseSampling) {
|
||||
_profiler.PauseSampling();
|
||||
|
@ -163,7 +163,7 @@ var Profiler;
|
|||
_profiler.AddMarker(explicit ? name : 'End of test "' + (name || test_name) + '"');
|
||||
}
|
||||
},
|
||||
mark: function Profiler__mark (marker, explicit) {
|
||||
mark: function Profiler__mark(marker, explicit) {
|
||||
if (_profiler) {
|
||||
_profiler.AddMarker(explicit ? marker : 'Profiler: "' + (marker || test_name) + '"');
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ function initializeMemoryCollector(callback, args) {
|
|||
var os = Components.classes["@mozilla.org/observer-service;1"].
|
||||
getService(Components.interfaces.nsIObserverService);
|
||||
|
||||
os.addObserver(function () {
|
||||
os.addObserver(function() {
|
||||
var os = Components.classes["@mozilla.org/observer-service;1"].
|
||||
getService(Components.interfaces.nsIObserverService);
|
||||
|
||||
|
@ -29,13 +29,13 @@ function initializeMemoryCollector(callback, args) {
|
|||
* we will assume there is no child process.
|
||||
*/
|
||||
var event = {
|
||||
notify: function(timer) {
|
||||
notify(timer) {
|
||||
memTimer = null;
|
||||
gChildProcess = false;
|
||||
gMemCallback();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var memTimer = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer);
|
||||
memTimer.initWithCallback(event, 10000, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ var gDisableE10S = false;
|
|||
var gUseE10S = false;
|
||||
var profilingInfo = false;
|
||||
|
||||
//when TEST_DOES_OWN_TIMING, we need to store the time from the page as MozAfterPaint can be slower than pageload
|
||||
// when TEST_DOES_OWN_TIMING, we need to store the time from the page as MozAfterPaint can be slower than pageload
|
||||
var gTime = -1;
|
||||
var gStartTime = -1;
|
||||
var gReference = -1;
|
||||
|
@ -118,7 +118,7 @@ function plInit() {
|
|||
|
||||
try {
|
||||
var args;
|
||||
|
||||
|
||||
/*
|
||||
* Desktop firefox:
|
||||
* non-chrome talos runs - tp-cmdline will create and load pageloader
|
||||
|
@ -172,25 +172,25 @@ function plInit() {
|
|||
pages = plLoadURLsFromURI(fileURI);
|
||||
|
||||
if (!pages) {
|
||||
dumpLine('tp: could not load URLs, quitting');
|
||||
dumpLine("tp: could not load URLs, quitting");
|
||||
plStop(true);
|
||||
}
|
||||
|
||||
if (pages.length == 0) {
|
||||
dumpLine('tp: no pages to test, quitting');
|
||||
dumpLine("tp: no pages to test, quitting");
|
||||
plStop(true);
|
||||
}
|
||||
|
||||
if (startIndex < 0)
|
||||
startIndex = 0;
|
||||
if (endIndex == -1 || endIndex >= pages.length)
|
||||
endIndex = pages.length-1;
|
||||
endIndex = pages.length - 1;
|
||||
if (startIndex > endIndex) {
|
||||
dumpLine("tp: error: startIndex >= endIndex");
|
||||
plStop(true);
|
||||
}
|
||||
|
||||
pages = pages.slice(startIndex,endIndex+1);
|
||||
pages = pages.slice(startIndex, endIndex + 1);
|
||||
pageUrls = pages.map(function(p) { return p.url.spec.toString(); });
|
||||
report = new Report();
|
||||
|
||||
|
@ -220,15 +220,15 @@ function plInit() {
|
|||
|
||||
gPaintWindow = browserWindow;
|
||||
// get our window out of the way
|
||||
window.resizeTo(10,10);
|
||||
window.resizeTo(10, 10);
|
||||
|
||||
var browserLoadFunc = function (ev) {
|
||||
browserWindow.removeEventListener('load', browserLoadFunc, true);
|
||||
var browserLoadFunc = function(ev) {
|
||||
browserWindow.removeEventListener("load", browserLoadFunc, true);
|
||||
|
||||
// do this half a second after load, because we need to be
|
||||
// able to resize the window and not have it get clobbered
|
||||
// by the persisted values
|
||||
setTimeout(function () {
|
||||
setTimeout(function() {
|
||||
// For e10s windows, since bug 1261842, the initial browser is remote unless
|
||||
// it attempts to browse to a URI that should be non-remote (landed at bug 1047603).
|
||||
//
|
||||
|
@ -297,8 +297,8 @@ function plInit() {
|
|||
}, 500);
|
||||
};
|
||||
|
||||
browserWindow.addEventListener('load', browserLoadFunc, true);
|
||||
} catch(e) {
|
||||
browserWindow.addEventListener("load", browserLoadFunc, true);
|
||||
} catch (e) {
|
||||
dumpLine("pageloader exception: " + e);
|
||||
plStop(true);
|
||||
}
|
||||
|
@ -309,10 +309,10 @@ function plPageFlags() {
|
|||
}
|
||||
|
||||
var ContentListener = {
|
||||
receiveMessage: function(message) {
|
||||
receiveMessage(message) {
|
||||
switch (message.name) {
|
||||
case 'PageLoader:LoadEvent': return plLoadHandlerMessage(message);
|
||||
case 'PageLoader:RecordTime': return plRecordTimeMessage(message);
|
||||
case "PageLoader:LoadEvent": return plLoadHandlerMessage(message);
|
||||
case "PageLoader:RecordTime": return plRecordTimeMessage(message);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
@ -337,9 +337,9 @@ function plLoadPage() {
|
|||
// if the page does its own timing, use a capturing handler
|
||||
// to make sure that we can set up the function for content to call
|
||||
|
||||
content.addEventListener('load', plLoadHandlerCapturing, true);
|
||||
content.addEventListener("load", plLoadHandlerCapturing, true);
|
||||
removeLastAddedListener = function() {
|
||||
content.removeEventListener('load', plLoadHandlerCapturing, true);
|
||||
content.removeEventListener("load", plLoadHandlerCapturing, true);
|
||||
if (useMozAfterPaint) {
|
||||
content.removeEventListener("MozAfterPaint", plPaintedCapturing, true);
|
||||
gPaintListener = false;
|
||||
|
@ -351,9 +351,9 @@ function plLoadPage() {
|
|||
|
||||
// XXX we use a capturing event here too -- load events don't bubble up
|
||||
// to the <browser> element. See bug 390263.
|
||||
content.addEventListener('load', plLoadHandler, true);
|
||||
content.addEventListener("load", plLoadHandler, true);
|
||||
removeLastAddedListener = function() {
|
||||
content.removeEventListener('load', plLoadHandler, true);
|
||||
content.removeEventListener("load", plLoadHandler, true);
|
||||
if (useMozAfterPaint) {
|
||||
gPaintWindow.removeEventListener("MozAfterPaint", plPainted, true);
|
||||
gPaintListener = false;
|
||||
|
@ -364,11 +364,11 @@ function plLoadPage() {
|
|||
// If the test browser is remote (e10s / IPC) we need to use messages to watch for page load
|
||||
if (gUseE10S) {
|
||||
let mm = content.selectedBrowser.messageManager;
|
||||
mm.addMessageListener('PageLoader:LoadEvent', ContentListener);
|
||||
mm.addMessageListener('PageLoader:RecordTime', ContentListener);
|
||||
mm.addMessageListener("PageLoader:LoadEvent", ContentListener);
|
||||
mm.addMessageListener("PageLoader:RecordTime", ContentListener);
|
||||
removeLastAddedMsgListener = function() {
|
||||
mm.removeMessageListener('PageLoader:LoadEvent', ContentListener);
|
||||
mm.removeMessageListener('PageLoader:RecordTime', ContentListener);
|
||||
mm.removeMessageListener("PageLoader:LoadEvent", ContentListener);
|
||||
mm.removeMessageListener("PageLoader:RecordTime", ContentListener);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -401,7 +401,7 @@ function startAndLoadURI(pageName) {
|
|||
|
||||
function getTestName() { // returns tp5n
|
||||
var pageName = pages[pageIndex].url.spec;
|
||||
let parts = pageName.split('/');
|
||||
let parts = pageName.split("/");
|
||||
if (parts.length > 4) {
|
||||
return parts[4];
|
||||
}
|
||||
|
@ -410,7 +410,7 @@ function getTestName() { // returns tp5n
|
|||
|
||||
function getCurrentPageShortName() {
|
||||
var pageName = pages[pageIndex].url.spec;
|
||||
let parts = pageName.split('/');
|
||||
let parts = pageName.split("/");
|
||||
if (parts.length > 5) {
|
||||
return parts[5];
|
||||
}
|
||||
|
@ -422,16 +422,16 @@ function loadFail() {
|
|||
numRetries++;
|
||||
|
||||
if (numRetries >= maxRetries) {
|
||||
dumpLine('__FAILTimeout in ' + getTestName() + '__FAIL');
|
||||
dumpLine('__FAILTimeout (' + numRetries + '/' + maxRetries + ') exceeded on ' + pageName + '__FAIL');
|
||||
dumpLine("__FAILTimeout in " + getTestName() + "__FAIL");
|
||||
dumpLine("__FAILTimeout (" + numRetries + "/" + maxRetries + ") exceeded on " + pageName + "__FAIL");
|
||||
Profiler.finishTest();
|
||||
plStop(true);
|
||||
} else {
|
||||
dumpLine('__WARNTimeout (' + numRetries + '/' + maxRetries + ') exceeded on ' + pageName + '__WARN');
|
||||
dumpLine("__WARNTimeout (" + numRetries + "/" + maxRetries + ") exceeded on " + pageName + "__WARN");
|
||||
// TODO: make this a cleaner cleanup
|
||||
pageCycle--;
|
||||
content.removeEventListener('load', plLoadHandler, true);
|
||||
content.removeEventListener('load', plLoadHandlerCapturing, true);
|
||||
content.removeEventListener("load", plLoadHandler, true);
|
||||
content.removeEventListener("load", plLoadHandlerCapturing, true);
|
||||
content.removeEventListener("MozAfterPaint", plPaintedCapturing, true);
|
||||
content.removeEventListener("MozAfterPaint", plPainted, true);
|
||||
gPaintWindow.removeEventListener("MozAfterPaint", plPaintedCapturing, true);
|
||||
|
@ -440,7 +440,7 @@ function loadFail() {
|
|||
removeLastAddedMsgListener = null;
|
||||
gPaintListener = false;
|
||||
|
||||
//TODO: consider adding a tab and removing the old tab?!?
|
||||
// TODO: consider adding a tab and removing the old tab?!?
|
||||
setTimeout(plLoadPage, delay);
|
||||
}
|
||||
}
|
||||
|
@ -455,7 +455,7 @@ var plNextPage = async function() {
|
|||
await Profiler.finishTestAsync();
|
||||
}
|
||||
|
||||
if (pageIndex < pages.length-1) {
|
||||
if (pageIndex < pages.length - 1) {
|
||||
pageIndex++;
|
||||
if (profilingInfo) {
|
||||
Profiler.beginTest(getCurrentPageShortName());
|
||||
|
@ -502,7 +502,7 @@ function forceContentGC() {
|
|||
function plRecordTime(time) {
|
||||
var pageName = pages[pageIndex].url.spec;
|
||||
var i = pageIndex
|
||||
if (i < pages.length-1) {
|
||||
if (i < pages.length - 1) {
|
||||
i++;
|
||||
} else {
|
||||
i = 0;
|
||||
|
@ -512,8 +512,8 @@ function plRecordTime(time) {
|
|||
recordedName = pageUrls[pageIndex];
|
||||
}
|
||||
if (typeof(time) == "string") {
|
||||
var times = time.split(',');
|
||||
var names = recordedName.split(',');
|
||||
var times = time.split(",");
|
||||
var names = recordedName.split(",");
|
||||
for (var t = 0; t < times.length; t++) {
|
||||
if (names.length == 1) {
|
||||
report.recordTime(names, times[t]);
|
||||
|
@ -525,31 +525,31 @@ function plRecordTime(time) {
|
|||
report.recordTime(recordedName, time);
|
||||
}
|
||||
if (noisy) {
|
||||
dumpLine("Cycle " + (cycle+1) + "(" + pageCycle + ")" + ": loaded " + pageName + " (next: " + nextName + ")");
|
||||
dumpLine("Cycle " + (cycle + 1) + "(" + pageCycle + ")" + ": loaded " + pageName + " (next: " + nextName + ")");
|
||||
}
|
||||
}
|
||||
|
||||
function plLoadHandlerCapturing(evt) {
|
||||
// make sure we pick up the right load event
|
||||
if (evt.type != 'load' ||
|
||||
if (evt.type != "load" ||
|
||||
evt.originalTarget.defaultView.frameElement)
|
||||
return;
|
||||
|
||||
//set the tpRecordTime function (called from test pages we load) to store a global time.
|
||||
content.contentWindow.wrappedJSObject.tpRecordTime = function (time, startTime, testName) {
|
||||
// set the tpRecordTime function (called from test pages we load) to store a global time.
|
||||
content.contentWindow.wrappedJSObject.tpRecordTime = function(time, startTime, testName) {
|
||||
gTime = time;
|
||||
gStartTime = startTime;
|
||||
recordedName = testName;
|
||||
setTimeout(plWaitForPaintingCapturing, 0);
|
||||
}
|
||||
|
||||
content.contentWindow.wrappedJSObject.plGarbageCollect = function () {
|
||||
content.contentWindow.wrappedJSObject.plGarbageCollect = function() {
|
||||
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIDOMWindowUtils)
|
||||
.garbageCollect();
|
||||
}
|
||||
|
||||
content.removeEventListener('load', plLoadHandlerCapturing, true);
|
||||
content.removeEventListener("load", plLoadHandlerCapturing, true);
|
||||
removeLastAddedListener = null;
|
||||
|
||||
setTimeout(plWaitForPaintingCapturing, 0);
|
||||
|
@ -561,9 +561,9 @@ function sendScroll() {
|
|||
const SCROLL_TEST_NUM_STEPS = 100;
|
||||
// The page doesn't really use tpRecordTime. Instead, we trigger the scroll test,
|
||||
// and the scroll test will call tpRecordTime which will take us to the next page
|
||||
let details = {target: 'content', stepSize: SCROLL_TEST_STEP_PX, opt_numSteps: SCROLL_TEST_NUM_STEPS};
|
||||
let details = {target: "content", stepSize: SCROLL_TEST_STEP_PX, opt_numSteps: SCROLL_TEST_NUM_STEPS};
|
||||
let mm = content.selectedBrowser.messageManager;
|
||||
mm.sendAsyncMessage("PageLoader:ScrollTest", { details: details });
|
||||
mm.sendAsyncMessage("PageLoader:ScrollTest", { details });
|
||||
}
|
||||
|
||||
function plWaitForPaintingCapturing() {
|
||||
|
@ -616,11 +616,11 @@ function _loadHandlerCapturing() {
|
|||
// the onload handler
|
||||
function plLoadHandler(evt) {
|
||||
// make sure we pick up the right load event
|
||||
if (evt.type != 'load' ||
|
||||
if (evt.type != "load" ||
|
||||
evt.originalTarget.defaultView.frameElement)
|
||||
return;
|
||||
|
||||
content.removeEventListener('load', plLoadHandler, true);
|
||||
content.removeEventListener("load", plLoadHandler, true);
|
||||
setTimeout(waitForPainted, 0);
|
||||
}
|
||||
|
||||
|
@ -749,7 +749,7 @@ function plStopAll(force) {
|
|||
if (force == false) {
|
||||
pageIndex = 0;
|
||||
pageCycle = 1;
|
||||
if (cycle < NUM_CYCLES-1) {
|
||||
if (cycle < NUM_CYCLES - 1) {
|
||||
cycle++;
|
||||
recordedName = null;
|
||||
setTimeout(plLoadPage, delay);
|
||||
|
@ -769,16 +769,16 @@ function plStopAll(force) {
|
|||
}
|
||||
|
||||
if (content) {
|
||||
content.removeEventListener('load', plLoadHandlerCapturing, true);
|
||||
content.removeEventListener('load', plLoadHandler, true);
|
||||
content.removeEventListener("load", plLoadHandlerCapturing, true);
|
||||
content.removeEventListener("load", plLoadHandler, true);
|
||||
if (useMozAfterPaint)
|
||||
content.removeEventListener("MozAfterPaint", plPaintedCapturing, true);
|
||||
content.removeEventListener("MozAfterPaint", plPainted, true);
|
||||
|
||||
if (gUseE10S) {
|
||||
let mm = content.selectedBrowser.messageManager;
|
||||
mm.removeMessageListener('PageLoader:LoadEvent', ContentListener);
|
||||
mm.removeMessageListener('PageLoader:RecordTime', ContentListener);
|
||||
mm.removeMessageListener("PageLoader:LoadEvent", ContentListener);
|
||||
mm.removeMessageListener("PageLoader:RecordTime", ContentListener);
|
||||
|
||||
mm.loadFrameScript("data:,removeEventListener('load', _contentLoadHandler, true);", false, true);
|
||||
}
|
||||
|
@ -804,7 +804,7 @@ function plLoadURLsFromURI(manifestUri) {
|
|||
|
||||
try {
|
||||
fstream.init(uriFile.file, -1, 0, 0);
|
||||
} catch(ex) {
|
||||
} catch (ex) {
|
||||
dumpLine("tp: the file %s doesn't exist" % uriFile.file);
|
||||
return null;
|
||||
}
|
||||
|
@ -814,7 +814,7 @@ function plLoadURLsFromURI(manifestUri) {
|
|||
var d = [];
|
||||
|
||||
var lineNo = 0;
|
||||
var line = {value:null};
|
||||
var line = {value: null};
|
||||
var more;
|
||||
do {
|
||||
lineNo++;
|
||||
|
@ -822,10 +822,10 @@ function plLoadURLsFromURI(manifestUri) {
|
|||
var s = line.value;
|
||||
|
||||
// strip comments (only leading ones)
|
||||
s = s.replace(/^#.*/, '');
|
||||
s = s.replace(/^#.*/, "");
|
||||
|
||||
// strip leading and trailing whitespace
|
||||
s = s.replace(/^\s*/, '').replace(/\s*$/, '');
|
||||
s = s.replace(/^\s*/, "").replace(/\s*$/, "");
|
||||
|
||||
if (!s)
|
||||
continue;
|
||||
|
@ -880,8 +880,8 @@ function plLoadURLsFromURI(manifestUri) {
|
|||
if (pageFilterRegexp && !pageFilterRegexp.test(url.spec))
|
||||
continue;
|
||||
|
||||
d.push({ url: url,
|
||||
flags: flags });
|
||||
d.push({ url,
|
||||
flags });
|
||||
}
|
||||
} while (more);
|
||||
|
||||
|
|
|
@ -40,69 +40,53 @@
|
|||
These files did not have a license
|
||||
*/
|
||||
|
||||
function canQuitApplication()
|
||||
{
|
||||
function canQuitApplication() {
|
||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
if (!os)
|
||||
{
|
||||
if (!os) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
try {
|
||||
var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsPRBool);
|
||||
os.notifyObservers(cancelQuit, "quit-application-requested");
|
||||
|
||||
// Something aborted the quit process.
|
||||
if (cancelQuit.data)
|
||||
{
|
||||
|
||||
// Something aborted the quit process.
|
||||
if (cancelQuit.data) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (ex)
|
||||
{
|
||||
} catch (ex) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function goQuitApplication()
|
||||
{
|
||||
if (!canQuitApplication())
|
||||
{
|
||||
function goQuitApplication() {
|
||||
if (!canQuitApplication()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const kAppStartup = '@mozilla.org/toolkit/app-startup;1';
|
||||
const kAppShell = '@mozilla.org/appshell/appShellService;1';
|
||||
var appService;
|
||||
var forceQuit;
|
||||
const kAppStartup = "@mozilla.org/toolkit/app-startup;1";
|
||||
const kAppShell = "@mozilla.org/appshell/appShellService;1";
|
||||
var appService;
|
||||
var forceQuit;
|
||||
|
||||
if (kAppStartup in Components.classes)
|
||||
{
|
||||
if (kAppStartup in Components.classes) {
|
||||
appService = Components.classes[kAppStartup].
|
||||
getService(Components.interfaces.nsIAppStartup);
|
||||
forceQuit = Components.interfaces.nsIAppStartup.eForceQuit;
|
||||
}
|
||||
else if (kAppShell in Components.classes)
|
||||
{
|
||||
} else if (kAppShell in Components.classes) {
|
||||
appService = Components.classes[kAppShell].
|
||||
getService(Components.interfaces.nsIAppShellService);
|
||||
forceQuit = Components.interfaces.nsIAppShellService.eForceQuit;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw 'goQuitApplication: no AppStartup/appShell';
|
||||
} else {
|
||||
throw "goQuitApplication: no AppStartup/appShell";
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
appService.quit(forceQuit);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
throw('goQuitApplication: ' + ex);
|
||||
} catch (ex) {
|
||||
throw ("goQuitApplication: " + ex);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -66,10 +66,10 @@ Report.prototype.getReport = function() {
|
|||
report += "_x_x_mozilla_page_load_details\n";
|
||||
report += "|i|pagename|runs|\n";
|
||||
|
||||
for (var i=0; i < pages.length; i++) {
|
||||
report += '|'+
|
||||
i + ';'+
|
||||
pages[i].substr(prefixLen) + ';'+
|
||||
for (var i = 0; i < pages.length; i++) {
|
||||
report += "|" +
|
||||
i + ";" +
|
||||
pages[i].substr(prefixLen) + ";" +
|
||||
this.timeVals[pages[i]].join(";") +
|
||||
"\n";
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ Report.prototype.getReport = function() {
|
|||
report += "__end_cc_report\n";
|
||||
}
|
||||
var now = (new Date()).getTime();
|
||||
report += "__startTimestamp" + now + "__endTimestamp\n"; //timestamp for determning shutdown time, used by talos
|
||||
report += "__startTimestamp" + now + "__endTimestamp\n"; // timestamp for determning shutdown time, used by talos
|
||||
|
||||
return report;
|
||||
}
|
||||
|
@ -129,19 +129,19 @@ Report.prototype.getReportSummary = function() {
|
|||
report += "------- Summary: start -------\n";
|
||||
report += "Number of tests: " + pages.length + "\n";
|
||||
|
||||
for (var i=0; i < pages.length; i++) {
|
||||
for (var i = 0; i < pages.length; i++) {
|
||||
var results = this.timeVals[pages[i]].map(function(v) {
|
||||
return Number(v);
|
||||
});
|
||||
|
||||
report += '\n[#'+ i + '] ' + pages[i].substr(prefixLen)
|
||||
+ ' Cycles:' + results.length
|
||||
+ ' Average:' + average(results).toFixed(2)
|
||||
+ ' Median:' + median(results).toFixed(2)
|
||||
+ ' stddev:' + stddev(results).toFixed(2)
|
||||
+ ' (' + (100 * stddev(results) / median(results)).toFixed(1) + '%)'
|
||||
+ (results.length < 5 ? '' : (' stddev-sans-first:' + stddev(results.slice(1)).toFixed(2)))
|
||||
+ '\nValues: ' + results.map(function(v) {
|
||||
report += "\n[#" + i + "] " + pages[i].substr(prefixLen)
|
||||
+ " Cycles:" + results.length
|
||||
+ " Average:" + average(results).toFixed(2)
|
||||
+ " Median:" + median(results).toFixed(2)
|
||||
+ " stddev:" + stddev(results).toFixed(2)
|
||||
+ " (" + (100 * stddev(results) / median(results)).toFixed(1) + "%)"
|
||||
+ (results.length < 5 ? "" : (" stddev-sans-first:" + stddev(results.slice(1)).toFixed(2)))
|
||||
+ "\nValues: " + results.map(function(v) {
|
||||
return v.toFixed(1);
|
||||
}).join(" ")
|
||||
+ "\n";
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
// unprivileged code.
|
||||
// - Please make sure that any changes apply cleanly to all use cases.
|
||||
|
||||
function testScroll(target, stepSize, opt_reportFunc, opt_numSteps)
|
||||
{
|
||||
function testScroll(target, stepSize, opt_reportFunc, opt_numSteps) {
|
||||
var win;
|
||||
if (target == "content") {
|
||||
target = content.wrappedJSObject;
|
||||
|
@ -32,7 +31,7 @@ function testScroll(target, stepSize, opt_reportFunc, opt_numSteps)
|
|||
replyId: 1,
|
||||
|
||||
// dispatch an event to the framescript and register the result/callback event
|
||||
exec: function(commandName, arg, callback, opt_custom_window) {
|
||||
exec(commandName, arg, callback, opt_custom_window) {
|
||||
let win = opt_custom_window || window;
|
||||
let replyEvent = "TalosPowers:ParentExec:ReplyEvent:" + this.replyId++;
|
||||
if (callback) {
|
||||
|
@ -69,10 +68,10 @@ function testScroll(target, stepSize, opt_reportFunc, opt_numSteps)
|
|||
function P_setupReportFn() {
|
||||
return new Promise(function(resolve) {
|
||||
report = opt_reportFunc || win.tpRecordTime;
|
||||
if (report == 'PageLoader:RecordTime') {
|
||||
if (report == "PageLoader:RecordTime") {
|
||||
report = function(duration, start, name) {
|
||||
var msg = { time: duration, startTime: start, testName: name };
|
||||
sendAsyncMessage('PageLoader:RecordTime', msg);
|
||||
sendAsyncMessage("PageLoader:RecordTime", msg);
|
||||
}
|
||||
resolve();
|
||||
return;
|
||||
|
@ -81,13 +80,13 @@ function testScroll(target, stepSize, opt_reportFunc, opt_numSteps)
|
|||
// 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');
|
||||
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
|
||||
imported.src = "../../scripts/talos-debug.js?dummy=" + Date.now(); // For some browsers to re-read
|
||||
document.head.appendChild(imported);
|
||||
return;
|
||||
}
|
||||
|
@ -118,14 +117,14 @@ function testScroll(target, stepSize, opt_reportFunc, opt_numSteps)
|
|||
return (win.performance && win.performance.now) ?
|
||||
win.performance.now() :
|
||||
Date.now();
|
||||
};
|
||||
}
|
||||
|
||||
var isWindow = target.self === target;
|
||||
|
||||
var getPos = isWindow ? function() { return target.pageYOffset; }
|
||||
: function() { return target.scrollTop; };
|
||||
|
||||
var gotoTop = isWindow ? function() { target.scroll(0, 0); ensureScroll(); }
|
||||
var gotoTop = isWindow ? function() { target.scroll(0, 0); ensureScroll(); }
|
||||
: function() { target.scrollTop = 0; ensureScroll(); };
|
||||
|
||||
var doScrollTick = isWindow ? function() { target.scrollBy(0, stepSize); ensureScroll(); }
|
||||
|
@ -230,7 +229,7 @@ function testScroll(target, stepSize, opt_reportFunc, opt_numSteps)
|
|||
stopFrameTimeRecording(handle, function(intervals) {
|
||||
function average(arr) {
|
||||
var sum = 0;
|
||||
for(var i = 0; i < arr.length; i++)
|
||||
for (var i = 0; i < arr.length; i++)
|
||||
sum += arr[i];
|
||||
return arr.length ? sum / arr.length : 0;
|
||||
}
|
||||
|
@ -264,7 +263,7 @@ function testScroll(target, stepSize, opt_reportFunc, opt_numSteps)
|
|||
try {
|
||||
function handleMessageFromChrome(message) {
|
||||
var payload = message.data.details;
|
||||
testScroll(payload.target, payload.stepSize, 'PageLoader:RecordTime', payload.opt_numSteps);
|
||||
testScroll(payload.target, payload.stepSize, "PageLoader:RecordTime", payload.opt_numSteps);
|
||||
}
|
||||
|
||||
addMessageListener("PageLoader:ScrollTest", handleMessageFromChrome);
|
||||
|
|
|
@ -41,10 +41,10 @@
|
|||
// to handle multiple arguments.
|
||||
|
||||
const TP_CMDLINE_CONTRACTID = "@mozilla.org/commandlinehandler/general-startup;1?type=tp";
|
||||
const TP_CMDLINE_CLSID = Components.ID('{8AF052F5-8EFE-4359-8266-E16498A82E8B}');
|
||||
const TP_CMDLINE_CLSID = Components.ID("{8AF052F5-8EFE-4359-8266-E16498A82E8B}");
|
||||
const CATMAN_CONTRACTID = "@mozilla.org/categorymanager;1";
|
||||
const nsISupports = Components.interfaces.nsISupports;
|
||||
|
||||
|
||||
const nsICategoryManager = Components.interfaces.nsICategoryManager;
|
||||
const nsICommandLine = Components.interfaces.nsICommandLine;
|
||||
const nsICommandLineHandler = Components.interfaces.nsICommandLineHandler;
|
||||
|
@ -58,7 +58,7 @@ function PageLoaderCmdLineHandler() {}
|
|||
PageLoaderCmdLineHandler.prototype =
|
||||
{
|
||||
/* nsISupports */
|
||||
QueryInterface : function handler_QI(iid) {
|
||||
QueryInterface: function handler_QI(iid) {
|
||||
if (iid.equals(nsISupports))
|
||||
return this;
|
||||
|
||||
|
@ -69,7 +69,7 @@ PageLoaderCmdLineHandler.prototype =
|
|||
},
|
||||
|
||||
/* nsICommandLineHandler */
|
||||
handle : function handler_handle(cmdLine) {
|
||||
handle: function handler_handle(cmdLine) {
|
||||
var args = {};
|
||||
try {
|
||||
var uristr = cmdLine.handleFlagWithParam("tp", false);
|
||||
|
@ -101,8 +101,7 @@ PageLoaderCmdLineHandler.prototype =
|
|||
args.scrolltest = cmdLine.handleFlag("tpscrolltest", false);
|
||||
args.disableE10s = cmdLine.handleFlag("tpdisable_e10s", false);
|
||||
args.rss = cmdLine.handleFlag("rss", false);
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -116,7 +115,7 @@ PageLoaderCmdLineHandler.prototype =
|
|||
cmdLine.preventDefault = true;
|
||||
},
|
||||
|
||||
helpInfo :
|
||||
helpInfo:
|
||||
" -tp <file> Run pageload perf tests on given manifest\n" +
|
||||
" -tpfilter str Only include pages from manifest that contain str (regexp)\n" +
|
||||
" -tpcycles n Loop through pages n times\n" +
|
||||
|
@ -129,7 +128,7 @@ PageLoaderCmdLineHandler.prototype =
|
|||
" -tpheight height Height of window\n" +
|
||||
" -tbprofilinginfo A JSON object describing profiler settings\n" +
|
||||
" -tpoffline Force offline mode\n" +
|
||||
" -tpnoisy Dump the name of the last loaded page to console\n" +
|
||||
" -tpnoisy Dump the name of the last loaded page to console\n" +
|
||||
" -tptimeout Max amount of time given for a page to load, quit if exceeded\n" +
|
||||
" -tpdelay Amount of time to wait between each pageload\n" +
|
||||
" -tpnoforcecc Don't force cycle collection between each pageload\n" +
|
||||
|
@ -143,8 +142,7 @@ PageLoaderCmdLineHandler.prototype =
|
|||
|
||||
var PageLoaderCmdLineFactory =
|
||||
{
|
||||
createInstance : function(outer, iid)
|
||||
{
|
||||
createInstance(outer, iid) {
|
||||
if (outer != null) {
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
}
|
||||
|
@ -162,8 +160,7 @@ function NSGetFactory(cid) {
|
|||
|
||||
var PageLoaderCmdLineModule =
|
||||
{
|
||||
registerSelf : function(compMgr, fileSpec, location, type)
|
||||
{
|
||||
registerSelf(compMgr, fileSpec, location, type) {
|
||||
compMgr = compMgr.QueryInterface(nsIComponentRegistrar);
|
||||
|
||||
compMgr.registerFactoryLocation(TP_CMDLINE_CLSID,
|
||||
|
@ -179,8 +176,7 @@ var PageLoaderCmdLineModule =
|
|||
TP_CMDLINE_CONTRACTID, true, true);
|
||||
},
|
||||
|
||||
unregisterSelf : function(compMgr, fileSpec, location)
|
||||
{
|
||||
unregisterSelf(compMgr, fileSpec, location) {
|
||||
compMgr = compMgr.QueryInterface(nsIComponentRegistrar);
|
||||
|
||||
compMgr.unregisterFactoryLocation(TP_CMDLINE_CLSID, fileSpec);
|
||||
|
@ -189,13 +185,11 @@ var PageLoaderCmdLineModule =
|
|||
"m-tp", true);
|
||||
},
|
||||
|
||||
getClassObject : function(compMgr, cid, iid)
|
||||
{
|
||||
getClassObject(compMgr, cid, iid) {
|
||||
return NSGetFactory(cid);
|
||||
},
|
||||
|
||||
canUnload : function(compMgr)
|
||||
{
|
||||
canUnload(compMgr) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -11,7 +11,7 @@ function contentDispatchEvent(type, data, sync) {
|
|||
|
||||
var element = new CustomEvent("contentEvent", {
|
||||
bubbles: true,
|
||||
detail: { sync: sync, type: type, data: JSON.stringify(data) }
|
||||
detail: { sync, type, data: JSON.stringify(data) }
|
||||
});
|
||||
document.dispatchEvent(element);
|
||||
}
|
||||
|
@ -24,8 +24,8 @@ function contentAsyncEvent(type, data) {
|
|||
contentDispatchEvent(type, data, 0);
|
||||
}
|
||||
|
||||
//double logging to account for normal mode and ipc mode (mobile_profile only)
|
||||
//Ideally we would remove the dump() and just do ipc logging
|
||||
// double logging to account for normal mode and ipc mode (mobile_profile only)
|
||||
// Ideally we would remove the dump() and just do ipc logging
|
||||
function dumpLog(msg) {
|
||||
dump(msg);
|
||||
MozFileLogger.log(msg);
|
||||
|
@ -82,10 +82,10 @@ MozFileLogger.init = function(path) {
|
|||
}
|
||||
|
||||
MozFileLogger.getLogCallback = function() {
|
||||
return function (msg) {
|
||||
return function(msg) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
var data = msg.num + " " + msg.level + " " + msg.info.join(' ') + "\n";
|
||||
var data = msg.num + " " + msg.level + " " + msg.info.join(" ") + "\n";
|
||||
if (MozFileLogger._foStream)
|
||||
MozFileLogger._foStream.write(data, data.length);
|
||||
|
||||
|
@ -102,7 +102,7 @@ MozFileLogger.log = function(msg) {
|
|||
try {
|
||||
if (MozFileLogger._foStream)
|
||||
MozFileLogger._foStream.write(msg, msg.length);
|
||||
} catch(ex) {}
|
||||
} catch (ex) {}
|
||||
}
|
||||
|
||||
MozFileLogger.close = function() {
|
||||
|
@ -113,17 +113,17 @@ MozFileLogger.close = function() {
|
|||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
if(MozFileLogger._foStream)
|
||||
if (MozFileLogger._foStream)
|
||||
MozFileLogger._foStream.close();
|
||||
|
||||
|
||||
MozFileLogger._foStream = null;
|
||||
MozFileLogger._file = null;
|
||||
}
|
||||
|
||||
try {
|
||||
var prefs = Components.classes['@mozilla.org/preferences-service;1']
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch2);
|
||||
var filename = prefs.getCharPref('talos.logfile');
|
||||
var filename = prefs.getCharPref("talos.logfile");
|
||||
MozFileLogger.init(filename);
|
||||
} catch (ex) {} //pref does not exist, return empty string
|
||||
} catch (ex) {} // pref does not exist, return empty string
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
// relevant parts of our tests.
|
||||
var Profiler;
|
||||
|
||||
(function(){
|
||||
(function() {
|
||||
var _profiler;
|
||||
|
||||
// If this script is loaded in a framescript context, there won't be a
|
||||
|
@ -40,7 +40,7 @@ var Profiler;
|
|||
// (It's not required nor allowed for addons since Firefox 17)
|
||||
// It's used inside talos from non-privileged pages (like during tscroll),
|
||||
// and it works because talos disables all/most security measures.
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
} catch (e) {}
|
||||
|
||||
try {
|
||||
|
@ -71,7 +71,7 @@ var Profiler;
|
|||
* - gecko_profile_threads
|
||||
* - gecko_profile_dir
|
||||
*/
|
||||
initFromObject: function Profiler__initFromObject (obj) {
|
||||
initFromObject: function Profiler__initFromObject(obj) {
|
||||
if (obj &&
|
||||
("gecko_profile_dir" in obj) && typeof obj.gecko_profile_dir == "string" &&
|
||||
("gecko_profile_interval" in obj) && Number.isFinite(obj.gecko_profile_interval * 1) &&
|
||||
|
@ -84,10 +84,10 @@ var Profiler;
|
|||
enabled = true;
|
||||
}
|
||||
},
|
||||
initFromURLQueryParams: function Profiler__initFromURLQueryParams (locationSearch) {
|
||||
initFromURLQueryParams: function Profiler__initFromURLQueryParams(locationSearch) {
|
||||
this.initFromObject(searchToObject(locationSearch));
|
||||
},
|
||||
beginTest: function Profiler__beginTest (testName) {
|
||||
beginTest: function Profiler__beginTest(testName) {
|
||||
currentTest = testName;
|
||||
if (_profiler && enabled) {
|
||||
_profiler.StartProfiler(profiler_entries, profiler_interval,
|
||||
|
@ -98,19 +98,19 @@ var Profiler;
|
|||
}
|
||||
}
|
||||
},
|
||||
finishTest: function Profiler__finishTest () {
|
||||
finishTest: function Profiler__finishTest() {
|
||||
if (_profiler && enabled) {
|
||||
_profiler.dumpProfileToFile(profiler_dir + "/" + currentTest + ".profile");
|
||||
_profiler.StopProfiler();
|
||||
}
|
||||
},
|
||||
finishStartupProfiling: function Profiler__finishStartupProfiling () {
|
||||
finishStartupProfiling: function Profiler__finishStartupProfiling() {
|
||||
if (_profiler && enabled) {
|
||||
_profiler.dumpProfileToFile(profiler_dir + "/startup.profile");
|
||||
_profiler.StopProfiler();
|
||||
}
|
||||
},
|
||||
resume: function Profiler__resume (name, explicit) {
|
||||
resume: function Profiler__resume(name, explicit) {
|
||||
if (_profiler) {
|
||||
if (_profiler.ResumeSampling) {
|
||||
_profiler.ResumeSampling();
|
||||
|
@ -118,7 +118,7 @@ var Profiler;
|
|||
_profiler.AddMarker(explicit ? name : 'Start of test "' + (name || test_name) + '"');
|
||||
}
|
||||
},
|
||||
pause: function Profiler__pause (name, explicit) {
|
||||
pause: function Profiler__pause(name, explicit) {
|
||||
if (_profiler) {
|
||||
if (_profiler.PauseSampling) {
|
||||
_profiler.PauseSampling();
|
||||
|
@ -126,7 +126,7 @@ var Profiler;
|
|||
_profiler.AddMarker(explicit ? name : 'End of test "' + (name || test_name) + '"');
|
||||
}
|
||||
},
|
||||
mark: function Profiler__mark (marker, explicit) {
|
||||
mark: function Profiler__mark(marker, explicit) {
|
||||
if (_profiler) {
|
||||
_profiler.AddMarker(explicit ? marker : 'Profiler: "' + (marker || test_name) + '"');
|
||||
}
|
||||
|
|
|
@ -2,7 +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/. */
|
||||
|
||||
/******************************************************************
|
||||
/** ****************************************************************
|
||||
* window.talosDebug provides some statistical functions
|
||||
* (sum, average, median, stddev) and a tpRecordTime method which
|
||||
* reports some statistics about the data set, including detected
|
||||
|
@ -16,24 +16,24 @@
|
|||
*****************************************************************/
|
||||
window.talosDebug = {
|
||||
// Optional config properties
|
||||
disabled : false,
|
||||
disabled: false,
|
||||
ignore: -1, // Number of items to ignore at the begining of the set. -1 for auto-detect.
|
||||
displayData: false, // If true, will also display all the data points.
|
||||
fixed: 2, // default floating point digits for display.
|
||||
// End of config
|
||||
|
||||
sum: function (values) {
|
||||
return values.reduce(function(a, b){return a + b;});
|
||||
sum(values) {
|
||||
return values.reduce(function(a, b) { return a + b; });
|
||||
},
|
||||
|
||||
average: function (values) {
|
||||
average(values) {
|
||||
var d = window.talosDebug;
|
||||
return values.length ? d.sum(values) / values.length : 999999;
|
||||
},
|
||||
|
||||
median: function (values) {
|
||||
median(values) {
|
||||
var clone = values.slice(0);
|
||||
var sorted = clone.sort(function(a, b){ return (a > b) ? 1 : ((a < b) ? -1 : 0); });
|
||||
var sorted = clone.sort(function(a, b) { return (a > b) ? 1 : ((a < b) ? -1 : 0); });
|
||||
var len = values.length;
|
||||
if (!len)
|
||||
return 999999;
|
||||
|
@ -42,14 +42,14 @@ window.talosDebug = {
|
|||
return (sorted[len / 2] + sorted[len / 2 - 1]) / 2; // Average value of the two middle items.
|
||||
},
|
||||
|
||||
stddev: function (values, avg) {
|
||||
stddev(values, avg) {
|
||||
if (values.length <= 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Math.sqrt(
|
||||
values.map(function (v) { return Math.pow(v - avg, 2); })
|
||||
.reduce(function (a, b) { return a + b; }) / (values.length - 1));
|
||||
values.map(function(v) { return Math.pow(v - avg, 2); })
|
||||
.reduce(function(a, b) { return a + b; }) / (values.length - 1));
|
||||
},
|
||||
|
||||
// Estimate the number of warmup iterations of this data set (in a completely unscrientific way).
|
||||
|
@ -64,7 +64,7 @@ window.talosDebug = {
|
|||
// Now we should have an index which is at least the 2nd value within the stable part.
|
||||
// We get stddev for that index..end (baseStd), and then go backwards as long as stddev is
|
||||
// decreasing or within ~1% of baseStd, and return the earliest index for which it is.
|
||||
detectWarmup: function (values) {
|
||||
detectWarmup(values) {
|
||||
var MIN_WIDTH = 3;
|
||||
var MAX_WIDTH = 7;
|
||||
var d = window.talosDebug;
|
||||
|
@ -113,7 +113,7 @@ window.talosDebug = {
|
|||
return stableFrom;
|
||||
},
|
||||
|
||||
statsDisplay: function (collection) {
|
||||
statsDisplay(collection) {
|
||||
var d = window.talosDebug;
|
||||
var std = d.stddev(collection, d.average(collection));
|
||||
var avg = d.average(collection);
|
||||
|
@ -124,12 +124,12 @@ window.talosDebug = {
|
|||
"\nStdDev: " + std.toFixed(d.fixed) + " (" + (100 * std / (avg ? avg : 1)).toFixed(d.fixed) + "% of average)";
|
||||
},
|
||||
|
||||
tpRecordTime: function (dataCSV) {
|
||||
tpRecordTime(dataCSV) {
|
||||
var d = window.talosDebug;
|
||||
if (d.disabled)
|
||||
return;
|
||||
|
||||
var collection = ("" + dataCSV).split(",").map(function(item){ return parseFloat(item); });
|
||||
var collection = ("" + dataCSV).split(",").map(function(item) { return parseFloat(item); });
|
||||
var res = d.statsDisplay(collection);
|
||||
|
||||
var warmup = (d.ignore >= 0) ? d.ignore : d.detectWarmup(collection);
|
||||
|
@ -145,7 +145,7 @@ window.talosDebug = {
|
|||
}
|
||||
|
||||
if (d.displayData) {
|
||||
var disp = collection.map(function(item){
|
||||
var disp = collection.map(function(item) {
|
||||
return item.toFixed(d.fixed);
|
||||
});
|
||||
if (warmup >= 0)
|
||||
|
@ -168,6 +168,6 @@ window.talosDebug = {
|
|||
}
|
||||
|
||||
// Enable testing outside of talos by providing an alternative report function.
|
||||
if (typeof (tpRecordTime) === 'undefined') {
|
||||
if (typeof (tpRecordTime) === "undefined") {
|
||||
tpRecordTime = window.talosDebug.tpRecordTime;
|
||||
}
|
||||
|
|
|
@ -22,8 +22,7 @@ function createXpiDataUri(base, files, callbacks) {
|
|||
r.open("GET", url, false);
|
||||
r.requestType = "arraybuffer";
|
||||
r.overrideMimeType("text/plain; charset=x-user-defined");
|
||||
try { r.send(); }
|
||||
catch (e) { throw "FileNotRetrieved: " + url + " - " + e; }
|
||||
try { r.send(); } catch (e) { throw "FileNotRetrieved: " + url + " - " + e; }
|
||||
// For 'file://' Firefox sets status=0 on success or throws otherwise
|
||||
// In Firefox 34-ish onwards, success status is 200.
|
||||
if (!(r.readyState == 4 && (r.status == 0 || r.status == 200)))
|
||||
|
@ -53,14 +52,14 @@ function createXpiDataUri(base, files, callbacks) {
|
|||
}
|
||||
}
|
||||
|
||||
return sB64Enc.substr(0, sB64Enc.length - 2 + nMod3) + (nMod3 === 2 ? '' : nMod3 === 1 ? '=' : '==');
|
||||
return sB64Enc.substr(0, sB64Enc.length - 2 + nMod3) + (nMod3 === 2 ? "" : nMod3 === 1 ? "=" : "==");
|
||||
}
|
||||
|
||||
// Create the zip/xpi
|
||||
try {
|
||||
function dummy() {}
|
||||
var onsuccess = callbacks.onsuccess || dummy;
|
||||
var onerror = callbacks.onerror || dummy;
|
||||
var onsuccess = callbacks.onsuccess || dummy;
|
||||
var onerror = callbacks.onerror || dummy;
|
||||
var onprogress = callbacks.onprogress || dummy;
|
||||
|
||||
var zip = new JSZip();
|
||||
|
|
|
@ -34,13 +34,13 @@ nsSessionRestoreTalosTest.prototype = {
|
|||
|
||||
_xpcom_factory: XPCOMUtils.generateSingletonFactory(nsSessionRestoreTalosTest),
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//// nsISupports
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// // nsISupports
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//// nsIObserver
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// // nsIObserver
|
||||
|
||||
observe: function DS_observe(aSubject, aTopic, aData) {
|
||||
switch (aTopic) {
|
||||
|
@ -62,7 +62,7 @@ nsSessionRestoreTalosTest.prototype = {
|
|||
/**
|
||||
* Perform initialization on profile-after-change.
|
||||
*/
|
||||
init: function() {
|
||||
init() {
|
||||
if (StartupPerformance.isRestored) {
|
||||
this.onReady(true);
|
||||
} else {
|
||||
|
@ -82,7 +82,7 @@ nsSessionRestoreTalosTest.prototype = {
|
|||
/**
|
||||
* Session Restore is complete, hurray.
|
||||
*/
|
||||
onReady: function(hasRestoredTabs) {
|
||||
onReady(hasRestoredTabs) {
|
||||
if (hasRestoredTabs) {
|
||||
Services.obs.removeObserver(this, StartupPerformance.RESTORED_TOPIC);
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ nsSessionRestoreTalosTest.prototype = {
|
|||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// Module
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// // Module
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([nsSessionRestoreTalosTest]);
|
||||
|
|
|
@ -24,12 +24,12 @@ addEventListener("load", function() {
|
|||
|
||||
// Report data to Talos, if possible
|
||||
dumpLog("__start_report" +
|
||||
duration +
|
||||
duration +
|
||||
"__end_report\n\n");
|
||||
|
||||
// Next one is required by the test harness but not used
|
||||
dumpLog("__startTimestamp" +
|
||||
Date.now() +
|
||||
Date.now() +
|
||||
"__endTimestamp\n\n");
|
||||
goQuitApplication();
|
||||
});
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
var OPENER_DELAY = 1000; // ms delay between tests
|
||||
var REPEAT_COUNT = 20;
|
||||
var kid, kidStartTime, kidEndTime, windowIndex, openTimes;
|
||||
var auto = document.location.search.split('=')[1]; // ?auto=1
|
||||
var auto = document.location.search.split("=")[1]; // ?auto=1
|
||||
|
||||
/*
|
||||
* tpaint -- measures the amount of time between opening a new window
|
||||
|
@ -44,12 +44,12 @@ function scheduleNextWindow() {
|
|||
function calcMedian( numbers ) {
|
||||
// Avoid changing the original array.
|
||||
var sortedNumbers = Array.from(numbers);
|
||||
sortedNumbers.sort( function (a,b){ return a-b; } );
|
||||
sortedNumbers.sort( function(a, b) { return a - b; } );
|
||||
var n = Math.floor( sortedNumbers.length / 2 );
|
||||
if (sortedNumbers.length % 2) {
|
||||
return sortedNumbers[n];
|
||||
}
|
||||
return ( sortedNumbers[n-1] + sortedNumbers[n] ) / 2;
|
||||
return ( sortedNumbers[n - 1] + sortedNumbers[n] ) / 2;
|
||||
}
|
||||
|
||||
async function reportTimes() {
|
||||
|
@ -71,10 +71,10 @@ async function reportTimes() {
|
|||
med = calcMedian(openTimes);
|
||||
|
||||
if (auto) {
|
||||
dumpLog("__start_report" + openTimes.join('|') + "__end_report");
|
||||
dumpLog("__start_report" + openTimes.join("|") + "__end_report");
|
||||
var now = (new Date()).getTime();
|
||||
dumpLog("__startTimestamp" + now + "__endTimestamp\n");
|
||||
dumpLog("openingTimes="+openTimes.slice(1)+"\n");
|
||||
dumpLog("openingTimes=" + openTimes.slice(1) + "\n");
|
||||
dumpLog("avgOpenTime:" + avg + "\n" );
|
||||
dumpLog("minOpenTime:" + min + "\n" );
|
||||
dumpLog("maxOpenTime:" + max + "\n" );
|
||||
|
@ -86,13 +86,13 @@ async function reportTimes() {
|
|||
} else {
|
||||
alert("Average over " + count + " runs: " + avg + "\n" +
|
||||
"(min=" + min + ", max=" + max + ")\n" +
|
||||
"runs=" + openTimes.join(','));
|
||||
"runs=" + openTimes.join(","));
|
||||
}
|
||||
}
|
||||
|
||||
async function childIsOpen() {
|
||||
kidEndTime = window.performance.now();
|
||||
await TalosContentProfiler.pause('tpaint ' + windowIndex);
|
||||
await TalosContentProfiler.pause("tpaint " + windowIndex);
|
||||
openTimes[windowIndex] = kidEndTime - kidStartTime;
|
||||
scheduleNextWindow();
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ var kidHTML = "<html><meta charset='utf-8'><script>" +
|
|||
var kidURI = "data:text/html," + encodeURI(kidHTML);
|
||||
|
||||
async function openWindow() {
|
||||
await TalosContentProfiler.resume('tpaint ' + windowIndex);
|
||||
await TalosContentProfiler.resume("tpaint " + windowIndex);
|
||||
kidStartTime = window.performance.now();
|
||||
kid = window.open(kidURI);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
// relevant parts of our tests.
|
||||
var Profiler;
|
||||
|
||||
(function(){
|
||||
(function() {
|
||||
var _profiler;
|
||||
|
||||
// If this script is loaded in a framescript context, there won't be a
|
||||
|
@ -40,7 +40,7 @@ var Profiler;
|
|||
// (It's not required nor allowed for addons since Firefox 17)
|
||||
// It's used inside talos from non-privileged pages (like during tscroll),
|
||||
// and it works because talos disables all/most security measures.
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
} catch (e) {}
|
||||
|
||||
try {
|
||||
|
@ -71,7 +71,7 @@ var Profiler;
|
|||
* - gecko_profile_threads
|
||||
* - gecko_profile_dir
|
||||
*/
|
||||
initFromObject: function Profiler__initFromObject (obj) {
|
||||
initFromObject: function Profiler__initFromObject(obj) {
|
||||
if (obj &&
|
||||
("gecko_profile_dir" in obj) && typeof obj.gecko_profile_dir == "string" &&
|
||||
("gecko_profile_interval" in obj) && Number.isFinite(obj.gecko_profile_interval * 1) &&
|
||||
|
@ -84,10 +84,10 @@ var Profiler;
|
|||
enabled = true;
|
||||
}
|
||||
},
|
||||
initFromURLQueryParams: function Profiler__initFromURLQueryParams (locationSearch) {
|
||||
initFromURLQueryParams: function Profiler__initFromURLQueryParams(locationSearch) {
|
||||
this.initFromObject(searchToObject(locationSearch));
|
||||
},
|
||||
beginTest: function Profiler__beginTest (testName) {
|
||||
beginTest: function Profiler__beginTest(testName) {
|
||||
currentTest = testName;
|
||||
if (_profiler && enabled) {
|
||||
_profiler.StartProfiler(profiler_entries, profiler_interval,
|
||||
|
@ -98,19 +98,19 @@ var Profiler;
|
|||
}
|
||||
}
|
||||
},
|
||||
finishTest: function Profiler__finishTest () {
|
||||
finishTest: function Profiler__finishTest() {
|
||||
if (_profiler && enabled) {
|
||||
_profiler.dumpProfileToFile(profiler_dir + "/" + currentTest + ".profile");
|
||||
_profiler.StopProfiler();
|
||||
}
|
||||
},
|
||||
finishStartupProfiling: function Profiler__finishStartupProfiling () {
|
||||
finishStartupProfiling: function Profiler__finishStartupProfiling() {
|
||||
if (_profiler && enabled) {
|
||||
_profiler.dumpProfileToFile(profiler_dir + "/startup.profile");
|
||||
_profiler.StopProfiler();
|
||||
}
|
||||
},
|
||||
resume: function Profiler__resume (name, explicit) {
|
||||
resume: function Profiler__resume(name, explicit) {
|
||||
if (_profiler) {
|
||||
if (_profiler.ResumeSampling) {
|
||||
_profiler.ResumeSampling();
|
||||
|
@ -118,7 +118,7 @@ var Profiler;
|
|||
_profiler.AddMarker(explicit ? name : 'Start of test "' + (name || test_name) + '"');
|
||||
}
|
||||
},
|
||||
pause: function Profiler__pause (name, explicit) {
|
||||
pause: function Profiler__pause(name, explicit) {
|
||||
if (_profiler) {
|
||||
if (_profiler.PauseSampling) {
|
||||
_profiler.PauseSampling();
|
||||
|
@ -126,7 +126,7 @@ var Profiler;
|
|||
_profiler.AddMarker(explicit ? name : 'End of test "' + (name || test_name) + '"');
|
||||
}
|
||||
},
|
||||
mark: function Profiler__mark (marker, explicit) {
|
||||
mark: function Profiler__mark(marker, explicit) {
|
||||
if (_profiler) {
|
||||
_profiler.AddMarker(explicit ? marker : 'Profiler: "' + (marker || test_name) + '"');
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
(function() {
|
||||
const TRESIZE_PREFIX = "tresize@mozilla.org:";
|
||||
|
||||
addEventListener(TRESIZE_PREFIX + "chrome-run-event", function (e) {
|
||||
addEventListener(TRESIZE_PREFIX + "chrome-run-event", function(e) {
|
||||
var uniqueMessageId = TRESIZE_PREFIX + content.document.documentURI + Date.now() + Math.random();
|
||||
|
||||
addMessageListener(TRESIZE_PREFIX + "chrome-run-reply", function done(reply) {
|
||||
|
|
|
@ -28,9 +28,9 @@ function resizeTest() {
|
|||
windowSize += resizeIncrement;
|
||||
window.addEventListener("MozAfterPaint", painted, true);
|
||||
Profiler.resume("resize " + count);
|
||||
dataSet[count] = {'start': window.performance.now()};
|
||||
window.resizeTo(windowSize,windowSize);
|
||||
} catch(ex) { finish([ex + '\n']); }
|
||||
dataSet[count] = {"start": window.performance.now()};
|
||||
window.resizeTo(windowSize, windowSize);
|
||||
} catch (ex) { finish([ex + "\n"]); }
|
||||
}
|
||||
|
||||
function testCompleted() {
|
||||
|
@ -43,16 +43,16 @@ function testCompleted() {
|
|||
total += diff;
|
||||
diffs.push(diff);
|
||||
}
|
||||
var average = (total/count);
|
||||
var average = (total / count);
|
||||
var retVal = [];
|
||||
if (dumpDataSet) {
|
||||
retVal.push('__start_reporttresize-test.html,' + diffs + '__end_report\n');
|
||||
retVal.push("__start_reporttresize-test.html," + diffs + "__end_report\n");
|
||||
} else {
|
||||
retVal.push('__start_report' + average + '__end_report\n');
|
||||
retVal.push("__start_report" + average + "__end_report\n");
|
||||
}
|
||||
retVal.push('__startTimestamp' + Date.now() + '__endTimestamp\n');
|
||||
retVal.push("__startTimestamp" + Date.now() + "__endTimestamp\n");
|
||||
finish(retVal);
|
||||
} catch(ex) { finish([ex + '\n']); }
|
||||
} catch (ex) { finish([ex + "\n"]); }
|
||||
}
|
||||
|
||||
function resizeCompleted() {
|
||||
|
@ -66,8 +66,8 @@ function resizeCompleted() {
|
|||
|
||||
function runTest(callback, locationSearch) {
|
||||
doneCallback = callback;
|
||||
window.moveTo(10,10);
|
||||
window.resizeTo(windowSize,windowSize);
|
||||
window.moveTo(10, 10);
|
||||
window.resizeTo(windowSize, windowSize);
|
||||
Profiler.initFromURLQueryParams(locationSearch);
|
||||
Profiler.beginTest("tresize");
|
||||
resizeTest();
|
||||
|
|
|
@ -21,18 +21,18 @@ async function painted() {
|
|||
|
||||
let startupInfo = await TalosPowersContent.getStartupInfo();
|
||||
|
||||
let startupTime = startupInfo['firstPaint'] - startupInfo['process'];
|
||||
let startupTime = startupInfo["firstPaint"] - startupInfo["process"];
|
||||
|
||||
document.body.textContent = 'Startup time = ' + startupTime + ' ms';
|
||||
document.body.textContent = "Startup time = " + startupTime + " ms";
|
||||
if (window.dump) {
|
||||
dumpLog('__start_report' + startupTime + '__end_report\n\n');
|
||||
dumpLog("__start_report" + startupTime + "__end_report\n\n");
|
||||
}
|
||||
dumpConsoleAndQuit();
|
||||
}
|
||||
|
||||
function failed() {
|
||||
if (window.dump) {
|
||||
dumpLog('BROWSER FAILED TO GENERATE MOZAFTERPAINT IN 5 SECONDS');
|
||||
dumpLog("BROWSER FAILED TO GENERATE MOZAFTERPAINT IN 5 SECONDS");
|
||||
}
|
||||
dumpConsoleAndQuit();
|
||||
}
|
||||
|
@ -41,20 +41,20 @@ function dumpConsoleAndQuit() {
|
|||
var messages = {}
|
||||
|
||||
try {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
var consoleService = Components.classes['@mozilla.org/consoleservice;1'].getService(Components.interfaces.nsIConsoleService);
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var consoleService = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
|
||||
consoleService.getMessageArray(messages, {});
|
||||
} catch(ex) {
|
||||
dumpLog(ex + '\n');
|
||||
} catch (ex) {
|
||||
dumpLog(ex + "\n");
|
||||
}
|
||||
|
||||
for (var i = 0; i < messages.value.length; i++)
|
||||
dumpLog(messages.value[i].message + '\n');
|
||||
dumpLog(messages.value[i].message + "\n");
|
||||
|
||||
// Close window asynchronously, there might still be startup operations that still need to run
|
||||
window.setTimeout(function() {
|
||||
if (window.dump) {
|
||||
dumpLog('__startTimestamp' + Date.now() + '__endTimestamp\n');
|
||||
dumpLog("__startTimestamp" + Date.now() + "__endTimestamp\n");
|
||||
}
|
||||
goQuitApplication();
|
||||
window.close();
|
||||
|
|
|
@ -38,8 +38,8 @@ addMessageListener("TalosContentProfiler:Response", (msg) => {
|
|||
let event = Cu.cloneInto({
|
||||
bubbles: true,
|
||||
detail: {
|
||||
name: name,
|
||||
data: data,
|
||||
name,
|
||||
data,
|
||||
},
|
||||
}, content);
|
||||
content.dispatchEvent(
|
||||
|
@ -91,7 +91,7 @@ addEventListener("TalosPowersContentGetStartupInfo", (e) => {
|
|||
* 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) {
|
||||
addEventListener("TalosPowers:ParentExec:QueryEvent", function(e) {
|
||||
if (content.location.protocol != "file:" &&
|
||||
content.location.hostname != "localhost" &&
|
||||
content.location.hostname != "127.0.0.1") {
|
||||
|
|
|
@ -14,7 +14,7 @@ const FRAME_SCRIPT = "chrome://talos-powers/content/talos-powers-content.js";
|
|||
|
||||
function TalosPowersService() {
|
||||
this.wrappedJSObject = this;
|
||||
};
|
||||
}
|
||||
|
||||
TalosPowersService.prototype = {
|
||||
classDescription: "Talos Powers",
|
||||
|
@ -23,7 +23,7 @@ TalosPowersService.prototype = {
|
|||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
|
||||
|
||||
observe(subject, topic, data) {
|
||||
switch(topic) {
|
||||
switch (topic) {
|
||||
case "profile-after-change":
|
||||
// Note that this observation is registered in the chrome.manifest
|
||||
// for this add-on.
|
||||
|
@ -50,7 +50,7 @@ TalosPowersService.prototype = {
|
|||
},
|
||||
|
||||
receiveMessage(message) {
|
||||
switch(message.name) {
|
||||
switch (message.name) {
|
||||
case "Talos:ForceQuit": {
|
||||
this.forceQuit(message.data);
|
||||
break;
|
||||
|
@ -139,7 +139,7 @@ TalosPowersService.prototype = {
|
|||
* @param marker (string, optional)
|
||||
* A marker to set before pausing.
|
||||
*/
|
||||
profilerPause(marker=null) {
|
||||
profilerPause(marker = null) {
|
||||
if (marker) {
|
||||
Services.profiler.AddMarker(marker);
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ TalosPowersService.prototype = {
|
|||
* @param marker (string, optional)
|
||||
* A marker to set after resuming.
|
||||
*/
|
||||
profilerResume(marker=null) {
|
||||
profilerResume(marker = null) {
|
||||
Services.profiler.ResumeSampling();
|
||||
|
||||
if (marker) {
|
||||
|
@ -175,7 +175,7 @@ TalosPowersService.prototype = {
|
|||
let name = message.data.name;
|
||||
let data = message.data.data;
|
||||
|
||||
switch(name) {
|
||||
switch (name) {
|
||||
case "Profiler:Begin": {
|
||||
this.profilerBegin(data);
|
||||
// profilerBegin will cause the parent to send an async message to any
|
||||
|
@ -235,8 +235,8 @@ TalosPowersService.prototype = {
|
|||
|
||||
try {
|
||||
Services.startup.quit(Services.startup.eForceQuit);
|
||||
} catch(e) {
|
||||
dump('Force Quit failed: ' + e);
|
||||
} catch (e) {
|
||||
dump("Force Quit failed: " + e);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -281,7 +281,7 @@ TalosPowersService.prototype = {
|
|||
ParentExecServices: {
|
||||
|
||||
// arg: ignored. return: handle (number) for use with stopFrameTimeRecording
|
||||
startFrameTimeRecording: function(arg, callback, win) {
|
||||
startFrameTimeRecording(arg, callback, win) {
|
||||
var rv = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.startFrameTimeRecording();
|
||||
|
@ -289,7 +289,7 @@ TalosPowersService.prototype = {
|
|||
},
|
||||
|
||||
// arg: handle from startFrameTimeRecording. return: array with composition intervals
|
||||
stopFrameTimeRecording: function(arg, callback, win) {
|
||||
stopFrameTimeRecording(arg, callback, win) {
|
||||
var rv = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils)
|
||||
.stopFrameTimeRecording(arg);
|
||||
|
@ -302,7 +302,7 @@ TalosPowersService.prototype = {
|
|||
let mm = msg.target.messageManager;
|
||||
mm.sendAsyncMessage("TalosPowers:ParentExec:ReplyMsg", {
|
||||
id: msg.data.id,
|
||||
result: result
|
||||
result
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ var TalosContentProfiler;
|
|||
// (It's not required nor allowed for addons since Firefox 17)
|
||||
// It's used inside talos from non-privileged pages (like during tscroll),
|
||||
// and it works because talos disables all/most security measures.
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
} catch (e) {}
|
||||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
@ -50,13 +50,13 @@ var TalosContentProfiler;
|
|||
* Resolves when a corresponding acknowledgement event is dispatched
|
||||
* on this document.
|
||||
*/
|
||||
function sendEventAndWait(name, data={}) {
|
||||
function sendEventAndWait(name, data = {}) {
|
||||
return new Promise((resolve) => {
|
||||
var event = new CustomEvent("TalosContentProfilerCommand", {
|
||||
bubbles: true,
|
||||
detail: {
|
||||
name: name,
|
||||
data: data,
|
||||
name,
|
||||
data,
|
||||
}
|
||||
});
|
||||
document.dispatchEvent(event);
|
||||
|
@ -107,7 +107,7 @@ var TalosContentProfiler;
|
|||
* gecko_profile_threads (string, comma separated list of threads to filter with)
|
||||
* gecko_profile_dir (string)
|
||||
*/
|
||||
initFromObject(obj={}) {
|
||||
initFromObject(obj = {}) {
|
||||
if (!initted) {
|
||||
if (("gecko_profile_dir" in obj) && typeof obj.gecko_profile_dir == "string" &&
|
||||
("gecko_profile_interval" in obj) && Number.isFinite(obj.gecko_profile_interval * 1) &&
|
||||
|
@ -201,7 +201,7 @@ var TalosContentProfiler;
|
|||
* @returns Promise
|
||||
* Resolves once the Gecko Profiler has resumed.
|
||||
*/
|
||||
resume(marker="") {
|
||||
resume(marker = "") {
|
||||
if (initted) {
|
||||
return sendEventAndWait("Profiler:Resume", { marker });
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ var TalosContentProfiler;
|
|||
* @returns Promise
|
||||
* Resolves once the Gecko Profiler has paused.
|
||||
*/
|
||||
pause(marker="") {
|
||||
pause(marker = "") {
|
||||
if (initted) {
|
||||
return sendEventAndWait("Profiler:Pause", { marker });
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ var TalosParentProfiler;
|
|||
* gecko_profile_threads (string, comma separated list of threads to filter with)
|
||||
* gecko_profile_dir (string)
|
||||
*/
|
||||
initFromObject(obj={}) {
|
||||
initFromObject(obj = {}) {
|
||||
if (!initted) {
|
||||
if (("gecko_profile_dir" in obj) && typeof obj.gecko_profile_dir == "string" &&
|
||||
("gecko_profile_interval" in obj) && Number.isFinite(obj.gecko_profile_interval * 1) &&
|
||||
|
@ -133,12 +133,12 @@ var TalosParentProfiler;
|
|||
if (initted) {
|
||||
let profileFile = profileDir + "/" + currentTest + ".profile";
|
||||
return TalosPowers.profilerFinish(profileFile);
|
||||
} else {
|
||||
}
|
||||
let msg = "You should not call finishTest without having first " +
|
||||
"initted the Profiler";
|
||||
console.error(msg);
|
||||
return Promise.reject(msg);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -164,7 +164,7 @@ var TalosParentProfiler;
|
|||
* @returns Promise
|
||||
* Resolves once the Gecko Profiler has resumed.
|
||||
*/
|
||||
resume(marker="") {
|
||||
resume(marker = "") {
|
||||
if (initted) {
|
||||
TalosPowers.profilerResume(marker);
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ var TalosParentProfiler;
|
|||
* @returns Promise
|
||||
* Resolves once the Gecko Profiler has paused.
|
||||
*/
|
||||
pause(marker="") {
|
||||
pause(marker = "") {
|
||||
if (initted) {
|
||||
TalosPowers.profilerPause(marker);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ var TalosPowersParent;
|
|||
removeEventListener("TalosPowersContentFocused", focused);
|
||||
callback();
|
||||
});
|
||||
};
|
||||
}
|
||||
document.dispatchEvent(new CustomEvent("TalosPowersContentFocus", {
|
||||
bubbles: true,
|
||||
}));
|
||||
|
@ -62,7 +62,7 @@ var TalosPowersParent;
|
|||
replyId: 1,
|
||||
|
||||
// dispatch an event to the framescript and register the result/callback event
|
||||
exec: function(commandName, arg, callback, opt_custom_window) {
|
||||
exec(commandName, arg, callback, opt_custom_window) {
|
||||
let win = opt_custom_window || window;
|
||||
let replyEvent = "TalosPowers:ParentExec:ReplyEvent:" + this.replyId++;
|
||||
if (callback) {
|
||||
|
|
|
@ -6,8 +6,7 @@ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|||
nsIAccessible = Components.interfaces.nsIAccessible;
|
||||
nsIDOMNode = Components.interfaces.nsIDOMNode;
|
||||
|
||||
function initAccessibility()
|
||||
{
|
||||
function initAccessibility() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
if (!gAccService) {
|
||||
var service = Components.classes["@mozilla.org/accessibilityService;1"];
|
||||
|
@ -20,8 +19,7 @@ function initAccessibility()
|
|||
return gAccService;
|
||||
}
|
||||
|
||||
function getAccessible(aAccOrElmOrID, aInterfaces)
|
||||
{
|
||||
function getAccessible(aAccOrElmOrID, aInterfaces) {
|
||||
if (!aAccOrElmOrID) {
|
||||
return null;
|
||||
}
|
||||
|
@ -59,18 +57,17 @@ function getAccessible(aAccOrElmOrID, aInterfaces)
|
|||
}
|
||||
return acc;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
acc.QueryInterface(aInterfaces);
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
|
||||
return acc;
|
||||
}
|
||||
|
||||
// Walk accessible tree of the given identifier to ensure tree creation
|
||||
function ensureAccessibleTree(aAccOrElmOrID)
|
||||
{
|
||||
function ensureAccessibleTree(aAccOrElmOrID) {
|
||||
acc = getAccessible(aAccOrElmOrID);
|
||||
|
||||
var child = acc.firstChild;
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
// based on: http://hacks.mozilla.org/2010/05/better-performance-with-lazy-frame-construction/
|
||||
var ppDate = null;
|
||||
|
||||
function doInsertion()
|
||||
{
|
||||
function doInsertion() {
|
||||
if (!initAccessibility()) {
|
||||
dump("__FAILinit:AccessibilityUnvailable__FAIL");
|
||||
return;
|
||||
|
@ -18,7 +17,7 @@
|
|||
var container = document.getElementById("container");
|
||||
var lastchild = document.getElementById("lastchild");
|
||||
var start = new Date();
|
||||
var i,div;
|
||||
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'/>";
|
||||
|
@ -39,9 +38,8 @@
|
|||
setTimeout(postProcessingRecord, 0, start);
|
||||
}
|
||||
|
||||
function postProcessingRecord(s)
|
||||
{
|
||||
//alert(new Date() - s);
|
||||
function postProcessingRecord(s) {
|
||||
// alert(new Date() - s);
|
||||
tpRecordTime(new Date() - s, s);
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -76,21 +76,20 @@
|
|||
|
||||
</body>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
setTimeout("mutateTable()",100);
|
||||
window.onload = function() {
|
||||
setTimeout("mutateTable()", 100);
|
||||
};
|
||||
function mutateTable() {
|
||||
var htmTable = document.getElementById('datatable');
|
||||
var htmTable = document.getElementById("datatable");
|
||||
var TableRows = [ ];
|
||||
|
||||
// Locate all TR elements of the table
|
||||
var htmRow = htmTable.childNodes[0];
|
||||
while(htmRow) {
|
||||
if(htmRow.nodeType == 1) {
|
||||
if(htmRow.tagName == 'TR') {
|
||||
while (htmRow) {
|
||||
if (htmRow.nodeType == 1) {
|
||||
if (htmRow.tagName == "TR") {
|
||||
TableRows.push(htmRow);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
htmRow = htmRow.childNodes[0];
|
||||
}
|
||||
}
|
||||
|
@ -99,11 +98,11 @@ function mutateTable() {
|
|||
|
||||
var Range = document.createRange();
|
||||
Range.setStartBefore(TableRows[0]);
|
||||
Range.setEndAfter(TableRows[TableRows.length-1]);
|
||||
Range.setEndAfter(TableRows[TableRows.length - 1]);
|
||||
|
||||
// Put all rows into a Fragment
|
||||
var Fragment = document.createDocumentFragment();
|
||||
for(var Index in TableRows) {
|
||||
for (var Index in TableRows) {
|
||||
Fragment.appendChild(TableRows[Index]);
|
||||
}
|
||||
|
||||
|
@ -123,12 +122,11 @@ function mutateTable() {
|
|||
|
||||
document.documentElement.offsetLeft; // flush layout
|
||||
|
||||
setTimeout (postProcessingRecord, 0, start);
|
||||
setTimeout(postProcessingRecord, 0, start);
|
||||
}
|
||||
|
||||
function postProcessingRecord(s)
|
||||
{
|
||||
//alert(new Date() - s);
|
||||
function postProcessingRecord(s) {
|
||||
// alert(new Date() - s);
|
||||
tpRecordTime(new Date() - s, s);
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
// relevant parts of our tests.
|
||||
var Profiler;
|
||||
|
||||
(function(){
|
||||
(function() {
|
||||
var _profiler;
|
||||
|
||||
// If this script is loaded in a framescript context, there won't be a
|
||||
|
@ -40,7 +40,7 @@ var Profiler;
|
|||
// (It's not required nor allowed for addons since Firefox 17)
|
||||
// It's used inside talos from non-privileged pages (like during tscroll),
|
||||
// and it works because talos disables all/most security measures.
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
} catch (e) {}
|
||||
|
||||
try {
|
||||
|
@ -71,7 +71,7 @@ var Profiler;
|
|||
* - gecko_profile_threads
|
||||
* - gecko_profile_dir
|
||||
*/
|
||||
initFromObject: function Profiler__initFromObject (obj) {
|
||||
initFromObject: function Profiler__initFromObject(obj) {
|
||||
if (obj &&
|
||||
("gecko_profile_dir" in obj) && typeof obj.gecko_profile_dir == "string" &&
|
||||
("gecko_profile_interval" in obj) && Number.isFinite(obj.gecko_profile_interval * 1) &&
|
||||
|
@ -84,10 +84,10 @@ var Profiler;
|
|||
enabled = true;
|
||||
}
|
||||
},
|
||||
initFromURLQueryParams: function Profiler__initFromURLQueryParams (locationSearch) {
|
||||
initFromURLQueryParams: function Profiler__initFromURLQueryParams(locationSearch) {
|
||||
this.initFromObject(searchToObject(locationSearch));
|
||||
},
|
||||
beginTest: function Profiler__beginTest (testName) {
|
||||
beginTest: function Profiler__beginTest(testName) {
|
||||
currentTest = testName;
|
||||
if (_profiler && enabled) {
|
||||
_profiler.StartProfiler(profiler_entries, profiler_interval,
|
||||
|
@ -98,19 +98,19 @@ var Profiler;
|
|||
}
|
||||
}
|
||||
},
|
||||
finishTest: function Profiler__finishTest () {
|
||||
finishTest: function Profiler__finishTest() {
|
||||
if (_profiler && enabled) {
|
||||
_profiler.dumpProfileToFile(profiler_dir + "/" + currentTest + ".profile");
|
||||
_profiler.StopProfiler();
|
||||
}
|
||||
},
|
||||
finishStartupProfiling: function Profiler__finishStartupProfiling () {
|
||||
finishStartupProfiling: function Profiler__finishStartupProfiling() {
|
||||
if (_profiler && enabled) {
|
||||
_profiler.dumpProfileToFile(profiler_dir + "/startup.profile");
|
||||
_profiler.StopProfiler();
|
||||
}
|
||||
},
|
||||
resume: function Profiler__resume (name, explicit) {
|
||||
resume: function Profiler__resume(name, explicit) {
|
||||
if (_profiler) {
|
||||
if (_profiler.ResumeSampling) {
|
||||
_profiler.ResumeSampling();
|
||||
|
@ -118,7 +118,7 @@ var Profiler;
|
|||
_profiler.AddMarker(explicit ? name : 'Start of test "' + (name || test_name) + '"');
|
||||
}
|
||||
},
|
||||
pause: function Profiler__pause (name, explicit) {
|
||||
pause: function Profiler__pause(name, explicit) {
|
||||
if (_profiler) {
|
||||
if (_profiler.PauseSampling) {
|
||||
_profiler.PauseSampling();
|
||||
|
@ -126,7 +126,7 @@ var Profiler;
|
|||
_profiler.AddMarker(explicit ? name : 'End of test "' + (name || test_name) + '"');
|
||||
}
|
||||
},
|
||||
mark: function Profiler__mark (marker, explicit) {
|
||||
mark: function Profiler__mark(marker, explicit) {
|
||||
if (_profiler) {
|
||||
_profiler.AddMarker(explicit ? marker : 'Profiler: "' + (marker || test_name) + '"');
|
||||
}
|
||||
|
|
|
@ -12,16 +12,16 @@ function $(id) {
|
|||
// take a while (e.g. when triggering the test run)
|
||||
function chromeExec(commandName, data, doneCallback) {
|
||||
// dispatch an event to the framescript which will take it from there.
|
||||
doneCallback = doneCallback || function dummy(){};
|
||||
doneCallback = doneCallback || function dummy() {};
|
||||
dispatchEvent(
|
||||
new CustomEvent("damp@mozilla.org:chrome-exec-event", {
|
||||
bubbles: true,
|
||||
detail: {
|
||||
command: {
|
||||
name: commandName,
|
||||
data: data,
|
||||
data,
|
||||
},
|
||||
doneCallback: doneCallback
|
||||
doneCallback
|
||||
}
|
||||
})
|
||||
);
|
||||
|
@ -36,7 +36,7 @@ function runTest(config, doneCallback) {
|
|||
}
|
||||
|
||||
function sum(values) {
|
||||
return values.reduce(function(a, b){return a + b;});
|
||||
return values.reduce(function(a, b) { return a + b; });
|
||||
}
|
||||
|
||||
function average(values) {
|
||||
|
@ -48,8 +48,8 @@ function stddev(values, avg) {
|
|||
if (values.length <= 1) return 0;
|
||||
|
||||
return Math.sqrt(
|
||||
values.map(function (v) { return Math.pow(v - avg, 2); })
|
||||
.reduce(function (a, b) { return a + b; }) / (values.length - 1));
|
||||
values.map(function(v) { return Math.pow(v - avg, 2); })
|
||||
.reduce(function(a, b) { return a + b; }) / (values.length - 1));
|
||||
}
|
||||
|
||||
var lastResults = '["[no results collected]"]';
|
||||
|
@ -68,11 +68,11 @@ function doneTest(dispResult) {
|
|||
|
||||
for (var i in dispResult) {
|
||||
var di = dispResult[i];
|
||||
var disp = [].concat(di.value).map(function(a){return " " + (isNaN(a) ? -1 : a.toFixed(1));}).join(" ");
|
||||
var disp = [].concat(di.value).map(function(a) { return " " + (isNaN(a) ? -1 : a.toFixed(1)); }).join(" ");
|
||||
dispResult[i] = String(di.name) + ": " + disp;
|
||||
if (di.name.indexOf(".half")>=0 || di.name.indexOf(".all")>=0)
|
||||
dispResult[i] = "<b>"+dispResult[i]+"</b>";
|
||||
if (di.name.indexOf(".raw")>=0)
|
||||
if (di.name.indexOf(".half") >= 0 || di.name.indexOf(".all") >= 0)
|
||||
dispResult[i] = "<b>" + dispResult[i] + "</b>";
|
||||
if (di.name.indexOf(".raw") >= 0)
|
||||
dispResult[i] = "<br/>" + dispResult[i]; // Add space before raw results (which are the first result of an animation)
|
||||
|
||||
// stats:
|
||||
|
@ -96,7 +96,7 @@ function doneTest(dispResult) {
|
|||
dispStats += s + " Average (" + stats[s].length + "): " + average(stats[s]).toFixed(2) + " stddev: " + stddev(stats[s]).toFixed(2) + "<br/>";
|
||||
}
|
||||
|
||||
dispStats +="<hr/><b>Individual animations</b>:<br/>";
|
||||
dispStats += "<hr/><b>Individual animations</b>:<br/>";
|
||||
}
|
||||
$("run-results").innerHTML = "<hr/><br/>Results <button onclick='toClipboard(lastResults)'>[ Copy to clipboard as JSON ]</button>:<br/>" + dispStats + dispResult.join("<br/>");
|
||||
}
|
||||
|
@ -157,4 +157,4 @@ function init() {
|
|||
}
|
||||
}
|
||||
|
||||
addEventListener("load", init);
|
||||
addEventListener("load", init);
|
||||
|
|
|
@ -67,10 +67,10 @@ Utilities:
|
|||
<b>Configure DAMP</b> (CTRL-F5 to reset to talos defaults) <button type="button" onclick="deselectAll()">Deselect all tests</button><br/>
|
||||
<script>
|
||||
for (var test in defaultConfig.subtests) {
|
||||
document.write('<input type="checkbox" id="subtest-' + test + '" ' + (defaultConfig.subtests[test] ? "" : "un") + 'checked>'
|
||||
+ test + '</input>'
|
||||
+ '<span style="color:grey"> ' + testsInfo[test] + '</span>'
|
||||
+ '<br/>');
|
||||
document.write('<input type="checkbox" id="subtest-' + test + '" ' + (defaultConfig.subtests[test] ? "" : "un") + "checked>"
|
||||
+ test + "</input>"
|
||||
+ '<span style="color:grey"> ' + testsInfo[test] + "</span>"
|
||||
+ "<br/>");
|
||||
}
|
||||
</script>
|
||||
<br/>
|
||||
|
|
|
@ -27,7 +27,7 @@ function Damp() {
|
|||
|
||||
Damp.prototype = {
|
||||
|
||||
addTab: function(url) {
|
||||
addTab(url) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let tab = this._win.gBrowser.selectedTab = this._win.gBrowser.addTab(url);
|
||||
let browser = tab.linkedBrowser;
|
||||
|
@ -38,12 +38,12 @@ Damp.prototype = {
|
|||
});
|
||||
},
|
||||
|
||||
closeCurrentTab: function() {
|
||||
closeCurrentTab() {
|
||||
this._win.BrowserCloseTabOrWindow();
|
||||
return this._win.gBrowser.selectedTab;
|
||||
},
|
||||
|
||||
reloadPage: function() {
|
||||
reloadPage() {
|
||||
let startReloadTimestamp = performance.now();
|
||||
return new Promise((resolve, reject) => {
|
||||
let browser = gBrowser.selectedBrowser;
|
||||
|
@ -59,7 +59,7 @@ Damp.prototype = {
|
|||
});
|
||||
},
|
||||
|
||||
openToolbox: function (tool = "webconsole") {
|
||||
openToolbox(tool = "webconsole") {
|
||||
let tab = getActiveTab(getMostRecentBrowserWindow());
|
||||
let target = devtools.TargetFactory.forTab(tab);
|
||||
let startRecordTimestamp = performance.now();
|
||||
|
@ -86,7 +86,7 @@ Damp.prototype = {
|
|||
};
|
||||
}),
|
||||
|
||||
saveHeapSnapshot: function(label) {
|
||||
saveHeapSnapshot(label) {
|
||||
let tab = getActiveTab(getMostRecentBrowserWindow());
|
||||
let target = devtools.TargetFactory.forTab(tab);
|
||||
let toolbox = gDevTools.getToolbox(target);
|
||||
|
@ -104,7 +104,7 @@ Damp.prototype = {
|
|||
});
|
||||
},
|
||||
|
||||
readHeapSnapshot: function(label) {
|
||||
readHeapSnapshot(label) {
|
||||
let start = performance.now();
|
||||
this._snapshot = ThreadSafeChromeUtils.readHeapSnapshot(this._heapSnapshotFilePath);
|
||||
let end = performance.now();
|
||||
|
@ -224,7 +224,7 @@ Damp.prototype = {
|
|||
yield this.testTeardown();
|
||||
}),
|
||||
|
||||
takeCensus: function(label) {
|
||||
takeCensus(label) {
|
||||
let start = performance.now();
|
||||
|
||||
this._snapshot.takeCensus({
|
||||
|
@ -260,7 +260,7 @@ Damp.prototype = {
|
|||
return Promise.resolve();
|
||||
},
|
||||
|
||||
_getToolLoadingTests: function(url, label) {
|
||||
_getToolLoadingTests(url, label) {
|
||||
|
||||
let openToolboxAndLog = Task.async(function*(name, tool) {
|
||||
let {time, toolbox} = yield this.openToolbox(tool);
|
||||
|
@ -380,7 +380,7 @@ Damp.prototype = {
|
|||
_nextCommandIx: 0,
|
||||
_commands: [],
|
||||
_onSequenceComplete: 0,
|
||||
_nextCommand: function() {
|
||||
_nextCommand() {
|
||||
if (this._nextCommandIx >= this._commands.length) {
|
||||
this._onSequenceComplete();
|
||||
return;
|
||||
|
@ -388,7 +388,7 @@ Damp.prototype = {
|
|||
this._commands[this._nextCommandIx++].call(this);
|
||||
},
|
||||
// Each command at the array a function which must call nextCommand once it's done
|
||||
_doSequence: function(commands, onComplete) {
|
||||
_doSequence(commands, onComplete) {
|
||||
this._commands = commands;
|
||||
this._onSequenceComplete = onComplete;
|
||||
this._results = [];
|
||||
|
@ -397,25 +397,25 @@ Damp.prototype = {
|
|||
this._nextCommand();
|
||||
},
|
||||
|
||||
_log: function(str) {
|
||||
_log(str) {
|
||||
if (window.MozillaFileLogger && window.MozillaFileLogger.log)
|
||||
window.MozillaFileLogger.log(str);
|
||||
|
||||
window.dump(str);
|
||||
},
|
||||
|
||||
_logLine: function(str) {
|
||||
_logLine(str) {
|
||||
return this._log(str + "\n");
|
||||
},
|
||||
|
||||
_reportAllResults: function() {
|
||||
_reportAllResults() {
|
||||
var testNames = [];
|
||||
var testResults = [];
|
||||
|
||||
var out = "";
|
||||
for (var i in this._results) {
|
||||
res = this._results[i];
|
||||
var disp = [].concat(res.value).map(function(a){return (isNaN(a) ? -1 : a.toFixed(1));}).join(" ");
|
||||
var disp = [].concat(res.value).map(function(a) { return (isNaN(a) ? -1 : a.toFixed(1)); }).join(" ");
|
||||
out += res.name + ": " + disp + "\n";
|
||||
|
||||
if (!Array.isArray(res.value)) { // Waw intervals array is not reported to talos
|
||||
|
@ -426,15 +426,15 @@ Damp.prototype = {
|
|||
this._log("\n" + out);
|
||||
|
||||
if (content && content.tpRecordTime) {
|
||||
content.tpRecordTime(testResults.join(','), 0, testNames.join(','));
|
||||
content.tpRecordTime(testResults.join(","), 0, testNames.join(","));
|
||||
} else {
|
||||
//alert(out);
|
||||
// alert(out);
|
||||
}
|
||||
},
|
||||
|
||||
_onTestComplete: null,
|
||||
|
||||
_doneInternal: function() {
|
||||
_doneInternal() {
|
||||
this._logLine("DAMP_RESULTS_JSON=" + JSON.stringify(this._results));
|
||||
this._reportAllResults();
|
||||
this._win.gBrowser.selectedTab = this._dampTab;
|
||||
|
@ -496,8 +496,8 @@ Damp.prototype = {
|
|||
});
|
||||
},
|
||||
|
||||
startTest: function(doneCallback, config) {
|
||||
this._onTestComplete = function (results) {
|
||||
startTest(doneCallback, config) {
|
||||
this._onTestComplete = function(results) {
|
||||
Profiler.mark("DAMP - end", true);
|
||||
doneCallback(results);
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
(function() {
|
||||
const PREFIX = "damp@mozilla.org:";
|
||||
|
||||
addEventListener(PREFIX + "chrome-exec-event", function (e) {
|
||||
addEventListener(PREFIX + "chrome-exec-event", function(e) {
|
||||
if (content.document.documentURI.indexOf("chrome://damp/content/damp.html")) {
|
||||
// Can have url fragment. Backward compatible version of !str.startsWidth("prefix")
|
||||
throw new Error("Cannot be used outside of DAMP's launch page");
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<script src="util.js"></script>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
document.head.appendChild(build_rule("span > div", 10000, '{ color: blue; } '));
|
||||
document.head.appendChild(build_rule("span > div", 10000, "{ color: blue; } "));
|
||||
let dom = build_dom(5000, "div");
|
||||
|
||||
let start = performance.now();
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<script src="util.js"></script>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
document.head.appendChild(build_rule("span div", 10000, '{ color: blue; } '));
|
||||
document.head.appendChild(build_rule("span div", 10000, "{ color: blue; } "));
|
||||
let dom = build_dom(5000, "div");
|
||||
|
||||
let start = performance.now();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
function build_dom(n, elemName) {
|
||||
var ours = document.createElement(elemName);
|
||||
if (n != 1) {
|
||||
var leftSize = Math.floor(n/2);
|
||||
var rightSize = Math.floor((n-1)/2);
|
||||
var leftSize = Math.floor(n / 2);
|
||||
var rightSize = Math.floor((n - 1) / 2);
|
||||
ours.appendChild(build_dom(leftSize, elemName));
|
||||
if (rightSize > 0)
|
||||
ours.appendChild(build_dom(rightSize, elemName));
|
||||
|
|
|
@ -40,46 +40,36 @@
|
|||
These files did not have a license
|
||||
*/
|
||||
|
||||
function canQuitApplication()
|
||||
{
|
||||
function canQuitApplication() {
|
||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
if (!os)
|
||||
{
|
||||
if (!os) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsPRBool);
|
||||
os.notifyObservers(cancelQuit, "quit-application-requested", null);
|
||||
|
||||
// Something aborted the quit process.
|
||||
if (cancelQuit.data)
|
||||
{
|
||||
os.notifyObservers(cancelQuit, "quit-application-requested");
|
||||
|
||||
// Something aborted the quit process.
|
||||
if (cancelQuit.data) {
|
||||
return false;
|
||||
}
|
||||
} catch (ex) {
|
||||
}
|
||||
catch (ex)
|
||||
{
|
||||
}
|
||||
os.notifyObservers(null, "quit-application-granted", null);
|
||||
os.notifyObservers(null, "quit-application-granted");
|
||||
return true;
|
||||
}
|
||||
|
||||
function goQuitApplication(waitForSafeBrowsing)
|
||||
{
|
||||
const privs = 'UniversalPreferencesRead UniversalPreferencesWrite ' +
|
||||
'UniversalXPConnect';
|
||||
function goQuitApplication(waitForSafeBrowsing) {
|
||||
const privs = "UniversalPreferencesRead UniversalPreferencesWrite " +
|
||||
"UniversalXPConnect";
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
netscape.security.PrivilegeManager.enablePrivilege(privs);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
throw('goQuitApplication: privilege failure ' + ex);
|
||||
} catch (ex) {
|
||||
throw ("goQuitApplication: privilege failure " + ex);
|
||||
}
|
||||
|
||||
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
|
||||
|
@ -87,7 +77,7 @@ function goQuitApplication(waitForSafeBrowsing)
|
|||
if (xulRuntime.processType == xulRuntime.PROCESS_TYPE_CONTENT) {
|
||||
// If we're running in a remote browser, emit an event for a
|
||||
// frame script to pick up to quit the whole browser.
|
||||
var event = new CustomEvent("TalosQuitApplication", {bubbles:true, detail: {waitForSafeBrowsing}});
|
||||
var event = new CustomEvent("TalosQuitApplication", {bubbles: true, detail: {waitForSafeBrowsing}});
|
||||
document.dispatchEvent(event);
|
||||
return;
|
||||
}
|
||||
|
@ -106,56 +96,45 @@ function goQuitApplication(waitForSafeBrowsing)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!canQuitApplication())
|
||||
{
|
||||
if (!canQuitApplication()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const kAppStartup = '@mozilla.org/toolkit/app-startup;1';
|
||||
const kAppShell = '@mozilla.org/appshell/appShellService;1';
|
||||
var appService;
|
||||
const kAppStartup = "@mozilla.org/toolkit/app-startup;1";
|
||||
const kAppShell = "@mozilla.org/appshell/appShellService;1";
|
||||
var appService;
|
||||
|
||||
if (kAppStartup in Components.classes)
|
||||
{
|
||||
if (kAppStartup in Components.classes) {
|
||||
appService = Components.classes[kAppStartup].
|
||||
getService(Components.interfaces.nsIAppStartup);
|
||||
|
||||
}
|
||||
else if (kAppShell in Components.classes)
|
||||
{
|
||||
} else if (kAppShell in Components.classes) {
|
||||
appService = Components.classes[kAppShell].
|
||||
getService(Components.interfaces.nsIAppShellService);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw 'goQuitApplication: no AppStartup/appShell';
|
||||
} else {
|
||||
throw "goQuitApplication: no AppStartup/appShell";
|
||||
}
|
||||
|
||||
var windowManager = Components.
|
||||
classes['@mozilla.org/appshell/window-mediator;1'].getService();
|
||||
classes["@mozilla.org/appshell/window-mediator;1"].getService();
|
||||
|
||||
var windowManagerInterface = windowManager.
|
||||
QueryInterface(Components.interfaces.nsIWindowMediator);
|
||||
|
||||
var enumerator = windowManagerInterface.getEnumerator(null);
|
||||
|
||||
while (enumerator.hasMoreElements())
|
||||
{
|
||||
while (enumerator.hasMoreElements()) {
|
||||
var domWindow = enumerator.getNext();
|
||||
if (("tryToClose" in domWindow) && !domWindow.tryToClose())
|
||||
{
|
||||
if (("tryToClose" in domWindow) && !domWindow.tryToClose()) {
|
||||
return false;
|
||||
}
|
||||
domWindow.close();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
appService.quit(appService.eForceQuit);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
throw('goQuitApplication: ' + ex);
|
||||
} catch (ex) {
|
||||
throw ("goQuitApplication: " + ex);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -90,7 +90,7 @@ var TabPaint = {
|
|||
|
||||
let gBrowser = browser.ownerGlobal.gBrowser;
|
||||
|
||||
switch(msg.name) {
|
||||
switch (msg.name) {
|
||||
case "TabPaint:Go": {
|
||||
// Our document has loaded, and we're off to the races!
|
||||
this.go(gBrowser).then((results) => {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
let { fromParent, fromContent } = msg.data;
|
||||
|
||||
tpRecordTime([fromParent, fromContent].join(','), 0, "tabpaint-from-parent, tabpaint-from-content");
|
||||
tpRecordTime([fromParent, fromContent].join(","), 0, "tabpaint-from-parent, tabpaint-from-content");
|
||||
});
|
||||
|
||||
mm.addMessageListener("TabPaint:OpenFromContent", function openFromContent() {
|
||||
|
|
|
@ -61,4 +61,4 @@
|
|||
mm.sendAsyncMessage("TabPaint:Painted", { delta });
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -17,24 +17,24 @@ let context = {};
|
|||
let TalosParentProfiler;
|
||||
|
||||
var windowListener = {
|
||||
onOpenWindow: function(aWindow) {
|
||||
onOpenWindow(aWindow) {
|
||||
// Ensure we don't get tiles which contact the network
|
||||
aboutNewTabService.newTabURL = "about:blank";
|
||||
|
||||
// Wait for the window to finish loading
|
||||
let window = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowInternal || Ci.nsIDOMWindow);
|
||||
let cb = function() {
|
||||
window.removeEventListener("load", cb, false);
|
||||
window.removeEventListener("load", cb);
|
||||
loadIntoWindow(window);
|
||||
};
|
||||
window.addEventListener("load", cb, false);
|
||||
window.addEventListener("load", cb);
|
||||
},
|
||||
|
||||
onCloseWindow: function(aWindow) {
|
||||
onCloseWindow(aWindow) {
|
||||
aboutNewTabService.resetNewTabURL();
|
||||
},
|
||||
|
||||
onWindowTitleChange: function(aWindow, aTitle) {
|
||||
onWindowTitleChange(aWindow, aTitle) {
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -67,7 +67,7 @@ function waitForDelayedStartup(win) {
|
|||
Services.obs.removeObserver(onStartup, topic);
|
||||
resolve();
|
||||
}
|
||||
}, topic, false);
|
||||
}, topic);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ function loadTabs(gBrowser, urls) {
|
|||
let listener = {
|
||||
QueryInterface: XPCOMUtils.generateQI(["nsIWebProgressListener",
|
||||
"nsISupportsWeakReference"]),
|
||||
onStateChange: function(aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
|
||||
onStateChange(aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
|
||||
let loadedState = Ci.nsIWebProgressListener.STATE_STOP |
|
||||
Ci.nsIWebProgressListener.STATE_IS_NETWORK;
|
||||
if ((aStateFlags & loadedState) == loadedState &&
|
||||
|
@ -424,21 +424,21 @@ function test(window) {
|
|||
yield switchToTab(initialTab);
|
||||
}
|
||||
|
||||
let output = '<!DOCTYPE html>'+
|
||||
'<html lang="en">'+
|
||||
'<head><title>Tab Switch Results</title></head>'+
|
||||
'<body><h1>Tab switch times</h1>' +
|
||||
'<table>';
|
||||
let output = "<!DOCTYPE html>" +
|
||||
'<html lang="en">' +
|
||||
"<head><title>Tab Switch Results</title></head>" +
|
||||
"<body><h1>Tab switch times</h1>" +
|
||||
"<table>";
|
||||
let time = 0;
|
||||
for(let i in times) {
|
||||
for (let i in times) {
|
||||
time += times[i];
|
||||
output += '<tr><td>' + testURLs[i] + '</td><td>' + times[i] + 'ms</td></tr>';
|
||||
output += "<tr><td>" + testURLs[i] + "</td><td>" + times[i] + "ms</td></tr>";
|
||||
}
|
||||
output += '</table></body></html>';
|
||||
output += "</table></body></html>";
|
||||
dump("total tab switch time:" + time + "\n");
|
||||
|
||||
let resultsTab = win.gBrowser.loadOneTab(
|
||||
'data:text/html;charset=utf-8,' + encodeURIComponent(output), {
|
||||
"data:text/html;charset=utf-8," + encodeURIComponent(output), {
|
||||
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
});
|
||||
let pref = Services.prefs.getBoolPref("browser.tabs.warnOnCloseOtherTabs");
|
||||
|
@ -510,7 +510,7 @@ function handleFile(win, file) {
|
|||
localFile.initWithPath(file);
|
||||
let localURI = Services.io.newFileURI(localFile);
|
||||
let req = new win.XMLHttpRequest();
|
||||
req.open('get', localURI.spec, false);
|
||||
req.open("get", localURI.spec, false);
|
||||
req.send(null);
|
||||
|
||||
|
||||
|
@ -533,7 +533,7 @@ function handleFile(win, file) {
|
|||
}
|
||||
|
||||
var observer = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
observe(aSubject, aTopic, aData) {
|
||||
if (aTopic == "tabswitch-urlfile") {
|
||||
handleFile(aSubject, aData);
|
||||
}
|
||||
|
@ -554,7 +554,7 @@ function startup(aData, aReason) {
|
|||
// Load into any new windows
|
||||
Services.wm.addListener(windowListener);
|
||||
|
||||
Services.obs.addObserver(observer, "tabswitch-urlfile", false);
|
||||
Services.obs.addObserver(observer, "tabswitch-urlfile");
|
||||
|
||||
Services.ppmm.loadProcessScript("chrome://tabswitch/content/tabswitch-content-process.js", true);
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
sendAsyncMessage("tabswitch-do-test");
|
||||
addMessageListener("tabswitch-test-results", function onMessage(msg) {
|
||||
let data = msg.data;
|
||||
content.tpRecordTime(data.times.join(','), 0, data.urls.join(','));
|
||||
content.tpRecordTime(data.times.join(","), 0, data.urls.join(","));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
// relevant parts of our tests.
|
||||
var Profiler;
|
||||
|
||||
(function(){
|
||||
(function() {
|
||||
var _profiler;
|
||||
|
||||
// If this script is loaded in a framescript context, there won't be a
|
||||
|
@ -40,7 +40,7 @@ var Profiler;
|
|||
// (It's not required nor allowed for addons since Firefox 17)
|
||||
// It's used inside talos from non-privileged pages (like during tscroll),
|
||||
// and it works because talos disables all/most security measures.
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
} catch (e) {}
|
||||
|
||||
try {
|
||||
|
@ -71,7 +71,7 @@ var Profiler;
|
|||
* - gecko_profile_threads
|
||||
* - gecko_profile_dir
|
||||
*/
|
||||
initFromObject: function Profiler__initFromObject (obj) {
|
||||
initFromObject: function Profiler__initFromObject(obj) {
|
||||
if (obj &&
|
||||
("gecko_profile_dir" in obj) && typeof obj.gecko_profile_dir == "string" &&
|
||||
("gecko_profile_interval" in obj) && Number.isFinite(obj.gecko_profile_interval * 1) &&
|
||||
|
@ -84,10 +84,10 @@ var Profiler;
|
|||
enabled = true;
|
||||
}
|
||||
},
|
||||
initFromURLQueryParams: function Profiler__initFromURLQueryParams (locationSearch) {
|
||||
initFromURLQueryParams: function Profiler__initFromURLQueryParams(locationSearch) {
|
||||
this.initFromObject(searchToObject(locationSearch));
|
||||
},
|
||||
beginTest: function Profiler__beginTest (testName) {
|
||||
beginTest: function Profiler__beginTest(testName) {
|
||||
currentTest = testName;
|
||||
if (_profiler && enabled) {
|
||||
_profiler.StartProfiler(profiler_entries, profiler_interval,
|
||||
|
@ -98,19 +98,19 @@ var Profiler;
|
|||
}
|
||||
}
|
||||
},
|
||||
finishTest: function Profiler__finishTest () {
|
||||
finishTest: function Profiler__finishTest() {
|
||||
if (_profiler && enabled) {
|
||||
_profiler.dumpProfileToFile(profiler_dir + "/" + currentTest + ".profile");
|
||||
_profiler.StopProfiler();
|
||||
}
|
||||
},
|
||||
finishStartupProfiling: function Profiler__finishStartupProfiling () {
|
||||
finishStartupProfiling: function Profiler__finishStartupProfiling() {
|
||||
if (_profiler && enabled) {
|
||||
_profiler.dumpProfileToFile(profiler_dir + "/startup.profile");
|
||||
_profiler.StopProfiler();
|
||||
}
|
||||
},
|
||||
resume: function Profiler__resume (name, explicit) {
|
||||
resume: function Profiler__resume(name, explicit) {
|
||||
if (_profiler) {
|
||||
if (_profiler.ResumeSampling) {
|
||||
_profiler.ResumeSampling();
|
||||
|
@ -118,7 +118,7 @@ var Profiler;
|
|||
_profiler.AddMarker(explicit ? name : 'Start of test "' + (name || test_name) + '"');
|
||||
}
|
||||
},
|
||||
pause: function Profiler__pause (name, explicit) {
|
||||
pause: function Profiler__pause(name, explicit) {
|
||||
if (_profiler) {
|
||||
if (_profiler.PauseSampling) {
|
||||
_profiler.PauseSampling();
|
||||
|
@ -126,7 +126,7 @@ var Profiler;
|
|||
_profiler.AddMarker(explicit ? name : 'End of test "' + (name || test_name) + '"');
|
||||
}
|
||||
},
|
||||
mark: function Profiler__mark (marker, explicit) {
|
||||
mark: function Profiler__mark(marker, explicit) {
|
||||
if (_profiler) {
|
||||
_profiler.AddMarker(explicit ? marker : 'Profiler: "' + (marker || test_name) + '"');
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
(function() {
|
||||
const TART_PREFIX = "tart@mozilla.org:";
|
||||
|
||||
addEventListener(TART_PREFIX + "chrome-exec-event", function (e) {
|
||||
addEventListener(TART_PREFIX + "chrome-exec-event", function(e) {
|
||||
if (content.document.documentURI.indexOf("chrome://tart/content/tart.html")) {
|
||||
// Can have url fragment. Backward compatible version of !str.startsWidth("prefix")
|
||||
throw new Error("Cannot be used outside of TART's launch page");
|
||||
|
@ -21,4 +21,4 @@
|
|||
id: uniqueMessageId
|
||||
});
|
||||
}, false);
|
||||
})()
|
||||
})()
|
||||
|
|
|
@ -18,16 +18,16 @@ function $(id) {
|
|||
// take a while (e.g. when triggering the test run)
|
||||
function chromeExec(commandName, data, doneCallback) {
|
||||
// dispatch an event to the framescript which will take it from there.
|
||||
doneCallback = doneCallback || function dummy(){};
|
||||
doneCallback = doneCallback || function dummy() {};
|
||||
dispatchEvent(
|
||||
new CustomEvent("tart@mozilla.org:chrome-exec-event", {
|
||||
bubbles: true,
|
||||
detail: {
|
||||
command: {
|
||||
name: commandName,
|
||||
data: data,
|
||||
data,
|
||||
},
|
||||
doneCallback: doneCallback
|
||||
doneCallback
|
||||
}
|
||||
})
|
||||
);
|
||||
|
@ -51,7 +51,7 @@ function runTest(config, doneCallback) {
|
|||
|
||||
|
||||
function sum(values) {
|
||||
return values.reduce(function(a, b){return a + b;});
|
||||
return values.reduce(function(a, b) { return a + b; });
|
||||
}
|
||||
|
||||
function average(values) {
|
||||
|
@ -63,8 +63,8 @@ function stddev(values, avg) {
|
|||
if (values.length <= 1) return 0;
|
||||
|
||||
return Math.sqrt(
|
||||
values.map(function (v) { return Math.pow(v - avg, 2); })
|
||||
.reduce(function (a, b) { return a + b; }) / (values.length - 1));
|
||||
values.map(function(v) { return Math.pow(v - avg, 2); })
|
||||
.reduce(function(a, b) { return a + b; }) / (values.length - 1));
|
||||
}
|
||||
|
||||
var lastResults = '["[no results collected]"]';
|
||||
|
@ -83,11 +83,11 @@ function doneTest(dispResult) {
|
|||
|
||||
for (var i in dispResult) {
|
||||
var di = dispResult[i];
|
||||
var disp = [].concat(di.value).map(function(a){return " " + (isNaN(a) ? -1 : a.toFixed(1));}).join(" ");
|
||||
var disp = [].concat(di.value).map(function(a) { return " " + (isNaN(a) ? -1 : a.toFixed(1)); }).join(" ");
|
||||
dispResult[i] = String(di.name) + ": " + disp;
|
||||
if (di.name.indexOf(".half")>=0 || di.name.indexOf(".all")>=0)
|
||||
dispResult[i] = "<b>"+dispResult[i]+"</b>";
|
||||
if (di.name.indexOf(".raw")>=0)
|
||||
if (di.name.indexOf(".half") >= 0 || di.name.indexOf(".all") >= 0)
|
||||
dispResult[i] = "<b>" + dispResult[i] + "</b>";
|
||||
if (di.name.indexOf(".raw") >= 0)
|
||||
dispResult[i] = "<br/>" + dispResult[i]; // Add space before raw results (which are the first result of an animation)
|
||||
|
||||
// stats:
|
||||
|
@ -111,7 +111,7 @@ function doneTest(dispResult) {
|
|||
dispStats += s + " Average (" + stats[s].length + "): " + average(stats[s]).toFixed(2) + " stddev: " + stddev(stats[s]).toFixed(2) + "<br/>";
|
||||
}
|
||||
|
||||
dispStats +="<hr/><b>Individual animations</b>:<br/>";
|
||||
dispStats += "<hr/><b>Individual animations</b>:<br/>";
|
||||
}
|
||||
$("run-results").innerHTML = "<hr/><br/>Results <button onclick='toClipboard(lastResults)'>[ Copy to clipboard as JSON ]</button>:<br/>" + dispStats + dispResult.join("<br/>");
|
||||
}
|
||||
|
@ -263,10 +263,10 @@ Utilities:
|
|||
<b>Configure TART</b> (CTRL-F5 to reset to talos defaults) <button type="button" onclick="deselectAll()">Deselect all tests</button><br/>
|
||||
<script>
|
||||
for (var test in defaultConfig.subtests) {
|
||||
document.write('<input type="checkbox" id="subtest-' + test + '" ' + (defaultConfig.subtests[test] ? "" : "un") + 'checked>'
|
||||
+ test + '</input>'
|
||||
+ '<span style="color:grey"> ' + testsInfo[test] + '</span>'
|
||||
+ '<br/>');
|
||||
document.write('<input type="checkbox" id="subtest-' + test + '" ' + (defaultConfig.subtests[test] ? "" : "un") + "checked>"
|
||||
+ test + "</input>"
|
||||
+ '<span style="color:grey"> ' + testsInfo[test] + "</span>"
|
||||
+ "<br/>");
|
||||
}
|
||||
$("subtest-simple3open3closeDpiCurrent").checked = false; // Disabled by default for talos
|
||||
</script>
|
||||
|
|
|
@ -39,41 +39,41 @@ Tart.prototype = {
|
|||
// Detectors may support keepListening(e) to indicate to keep waiting before continuing to the next animation.
|
||||
|
||||
tabDetector: {
|
||||
arm: function(handler, win) {
|
||||
arm(handler, win) {
|
||||
win.gBrowser.tabContainer.addEventListener("transitionend", handler);
|
||||
},
|
||||
|
||||
measureNow: function(e) {
|
||||
measureNow(e) {
|
||||
return (e.type == "transitionend" && e.propertyName == "max-width");
|
||||
},
|
||||
|
||||
cleanup: function (handler, win) {
|
||||
cleanup(handler, win) {
|
||||
win.gBrowser.tabContainer.removeEventListener("transitionend", handler);
|
||||
}
|
||||
},
|
||||
|
||||
customizeEnterDetector: {
|
||||
arm: function(handler, win) {
|
||||
arm(handler, win) {
|
||||
win.gNavToolbox.addEventListener("customizationready", handler);
|
||||
},
|
||||
|
||||
measureNow: function(e) {
|
||||
measureNow(e) {
|
||||
return (e.type == "customizationready");
|
||||
},
|
||||
|
||||
cleanup: function (handler, win) {
|
||||
cleanup(handler, win) {
|
||||
win.gNavToolbox.removeEventListener("customizationready", handler);
|
||||
}
|
||||
},
|
||||
|
||||
makeNewTabURLChangePromise: function(url) {
|
||||
makeNewTabURLChangePromise(url) {
|
||||
let promise = new Promise(resolve => {
|
||||
Services.obs.addObserver(function observer(subject, topic, data) {
|
||||
Services.obs.removeObserver(observer, topic);
|
||||
if (data == url) {
|
||||
resolve();
|
||||
}
|
||||
}, "newtab-url-changed", false);
|
||||
}, "newtab-url-changed");
|
||||
});
|
||||
if (url === "about:newtab") {
|
||||
aboutNewTabService.resetNewTabURL();
|
||||
|
@ -86,40 +86,40 @@ Tart.prototype = {
|
|||
// Same as customizeEnterDetector, but stops recording when the CSS animation ends
|
||||
// The detector then waits until customizationready
|
||||
customizeEnterCssDetector: {
|
||||
arm: function(handler, win) {
|
||||
arm(handler, win) {
|
||||
win.gNavToolbox.addEventListener("customizationready", handler);
|
||||
win.gNavToolbox.addEventListener("customization-transitionend", handler);
|
||||
},
|
||||
|
||||
measureNow: function(e) {
|
||||
measureNow(e) {
|
||||
return (e.type == "customization-transitionend");
|
||||
},
|
||||
|
||||
keepListening: function (e) {
|
||||
keepListening(e) {
|
||||
return (e.type != "customizationready");
|
||||
},
|
||||
|
||||
cleanup: function (handler, win) {
|
||||
cleanup(handler, win) {
|
||||
win.gNavToolbox.removeEventListener("customization-transitionend", handler);
|
||||
win.gNavToolbox.removeEventListener("customizationready", handler);
|
||||
}
|
||||
},
|
||||
|
||||
customizeExitDetector: {
|
||||
arm: function(handler, win) {
|
||||
arm(handler, win) {
|
||||
win.gNavToolbox.addEventListener("aftercustomization", handler);
|
||||
},
|
||||
|
||||
measureNow: function(e) {
|
||||
measureNow(e) {
|
||||
return (e.type == "aftercustomization");
|
||||
},
|
||||
|
||||
cleanup: function (handler, win) {
|
||||
cleanup(handler, win) {
|
||||
win.gNavToolbox.removeEventListener("aftercustomization", handler);
|
||||
}
|
||||
},
|
||||
|
||||
clickNewTab: function() {
|
||||
clickNewTab() {
|
||||
this._endDetection = this.tabDetector;
|
||||
this._win.BrowserOpenTab();
|
||||
// Modifying the style for each tab right after opening seems like it could regress performance,
|
||||
|
@ -134,55 +134,55 @@ Tart.prototype = {
|
|||
// Per-tab min-width on open it is then.
|
||||
|
||||
// --> many-tabs case which requires modified max-width will not go into v1. No need for now.
|
||||
//this._win.gBrowser.selectedTab.style.minWidth = "1px"; // Prevent overflow regrdless of DPI scale.
|
||||
// this._win.gBrowser.selectedTab.style.minWidth = "1px"; // Prevent overflow regrdless of DPI scale.
|
||||
|
||||
return this._win.gBrowser.selectedTab;
|
||||
},
|
||||
|
||||
|
||||
clickCloseCurrentTab: function() {
|
||||
clickCloseCurrentTab() {
|
||||
this._endDetection = this.tabDetector;
|
||||
this._win.BrowserCloseTabOrWindow();
|
||||
return this._win.gBrowser.selectedTab;
|
||||
},
|
||||
|
||||
fadeOutCurrentTab: function() {
|
||||
fadeOutCurrentTab() {
|
||||
this._endDetection = this.tabDetector;
|
||||
this._win.gBrowser.selectedTab.removeAttribute("fadein");
|
||||
},
|
||||
|
||||
fadeInCurrentTab: function() {
|
||||
fadeInCurrentTab() {
|
||||
this._endDetection = this.tabDetector;
|
||||
this._win.gBrowser.selectedTab.setAttribute("fadein", "true");
|
||||
},
|
||||
|
||||
|
||||
addSomeChromeUriTab: function() {
|
||||
addSomeChromeUriTab() {
|
||||
this._endDetection = this.tabDetector;
|
||||
this._win.gBrowser.selectedTab = this._win.gBrowser.addTab("chrome://tart/content/blank.icon.html");
|
||||
},
|
||||
|
||||
triggerCustomizeEnter: function() {
|
||||
triggerCustomizeEnter() {
|
||||
this._endDetection = this.customizeEnterDetector;
|
||||
this._win.gCustomizeMode.enter();
|
||||
},
|
||||
|
||||
triggerCustomizeEnterCss: function() {
|
||||
triggerCustomizeEnterCss() {
|
||||
this._endDetection = this.customizeEnterCssDetector;
|
||||
this._win.gCustomizeMode.enter();
|
||||
},
|
||||
|
||||
triggerCustomizeExit: function() {
|
||||
triggerCustomizeExit() {
|
||||
this._endDetection = this.customizeExitDetector;
|
||||
this._win.gCustomizeMode.exit();
|
||||
},
|
||||
|
||||
|
||||
pinTart: function() {
|
||||
pinTart() {
|
||||
return this._win.gBrowser.pinTab(this._tartTab);
|
||||
},
|
||||
|
||||
unpinTart: function() {
|
||||
unpinTart() {
|
||||
return this._win.gBrowser.unpinTab(this._tartTab);
|
||||
},
|
||||
|
||||
|
@ -194,11 +194,11 @@ Tart.prototype = {
|
|||
_results: [],
|
||||
_config: {subtests: [], repeat: 1, rest: 500, tickle: true, controlProfiler: true},
|
||||
|
||||
_animate: function(preWaitMs, triggerFunc, onDoneCallback, isReportResult, name, referenceDuration) {
|
||||
_animate(preWaitMs, triggerFunc, onDoneCallback, isReportResult, name, referenceDuration) {
|
||||
var self = this;
|
||||
var recordingHandle;
|
||||
var timeoutId = 0;
|
||||
var detector; //will be assigned after calling trigger.
|
||||
var detector; // will be assigned after calling trigger.
|
||||
var rAF = window.requestAnimationFrame || window.mozRequestAnimationFrame;
|
||||
const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
|
@ -225,7 +225,7 @@ Tart.prototype = {
|
|||
|
||||
var last = performance.now();
|
||||
function rec() {
|
||||
//self._win.getComputedStyle(self._win.gBrowser.selectedTab).width; // force draw - not good - too much regression
|
||||
// self._win.getComputedStyle(self._win.gBrowser.selectedTab).width; // force draw - not good - too much regression
|
||||
if (_abortRecording) return;
|
||||
|
||||
var now = performance.now();
|
||||
|
@ -311,7 +311,7 @@ Tart.prototype = {
|
|||
}
|
||||
|
||||
// If detector supports keepListening, use it, otherwise - measurement indicates the end.
|
||||
if (detector.keepListening ? detector.keepListening(e) : !isMeasureNow){
|
||||
if (detector.keepListening ? detector.keepListening(e) : !isMeasureNow) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
@ -341,7 +341,7 @@ Tart.prototype = {
|
|||
|
||||
function tickleLoop() {
|
||||
if (i++ < ((isReportResult && self._config.tickle) ? 17 : 0)) {
|
||||
self._win.document.getElementById(id).style.opacity = i%10 /10 + .05; // just some style modification which will force redraw
|
||||
self._win.document.getElementById(id).style.opacity = i % 10 / 10 + .05; // just some style modification which will force redraw
|
||||
return rAF(tickleLoop);
|
||||
}
|
||||
|
||||
|
@ -369,7 +369,7 @@ Tart.prototype = {
|
|||
_nextCommandIx: 0,
|
||||
_commands: [],
|
||||
_onSequenceComplete: 0,
|
||||
_nextCommand: function() {
|
||||
_nextCommand() {
|
||||
if (this._nextCommandIx >= this._commands.length) {
|
||||
this._onSequenceComplete();
|
||||
return;
|
||||
|
@ -377,7 +377,7 @@ Tart.prototype = {
|
|||
this._commands[this._nextCommandIx++]();
|
||||
},
|
||||
// Each command at the array a function which must call nextCommand once it's done
|
||||
_doSequence: function(commands, onComplete) {
|
||||
_doSequence(commands, onComplete) {
|
||||
this._commands = commands;
|
||||
this._onSequenceComplete = onComplete;
|
||||
this._results = [];
|
||||
|
@ -386,25 +386,25 @@ Tart.prototype = {
|
|||
this._nextCommand();
|
||||
},
|
||||
|
||||
_log: function(str) {
|
||||
_log(str) {
|
||||
if (window.MozillaFileLogger && window.MozillaFileLogger.log)
|
||||
window.MozillaFileLogger.log(str);
|
||||
|
||||
window.dump(str);
|
||||
},
|
||||
|
||||
_logLine: function(str) {
|
||||
_logLine(str) {
|
||||
return this._log(str + "\n");
|
||||
},
|
||||
|
||||
_reportAllResults: function() {
|
||||
_reportAllResults() {
|
||||
var testNames = [];
|
||||
var testResults = [];
|
||||
|
||||
var out = "";
|
||||
for (var i in this._results) {
|
||||
res = this._results[i];
|
||||
var disp = [].concat(res.value).map(function(a){return (isNaN(a) ? -1 : a.toFixed(1));}).join(" ");
|
||||
var disp = [].concat(res.value).map(function(a) { return (isNaN(a) ? -1 : a.toFixed(1)); }).join(" ");
|
||||
out += res.name + ": " + disp + "\n";
|
||||
|
||||
if (!Array.isArray(res.value)) { // Waw intervals array is not reported to talos
|
||||
|
@ -415,15 +415,15 @@ Tart.prototype = {
|
|||
this._log("\n" + out);
|
||||
|
||||
if (content && content.tpRecordTime) {
|
||||
content.tpRecordTime(testResults.join(','), 0, testNames.join(','));
|
||||
content.tpRecordTime(testResults.join(","), 0, testNames.join(","));
|
||||
} else {
|
||||
//alert(out);
|
||||
// alert(out);
|
||||
}
|
||||
},
|
||||
|
||||
_onTestComplete: null,
|
||||
|
||||
_doneInternal: function() {
|
||||
_doneInternal() {
|
||||
this._logLine("TART_RESULTS_JSON=" + JSON.stringify(this._results));
|
||||
this._reportAllResults();
|
||||
this._win.gBrowser.selectedTab = this._tartTab;
|
||||
|
@ -433,7 +433,7 @@ Tart.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
_startTest: function() {
|
||||
_startTest() {
|
||||
|
||||
// Save prefs and states which will change during the test, to get restored when done.
|
||||
var origNewtabEnabled = Services.prefs.getBoolPref("browser.newtabpage.enabled");
|
||||
|
@ -454,7 +454,7 @@ Tart.prototype = {
|
|||
var customizeExit = this.triggerCustomizeExit.bind(this);
|
||||
|
||||
var next = this._nextCommand.bind(this);
|
||||
var rest = 500; //500ms default rest before measuring an animation
|
||||
var rest = 500; // 500ms default rest before measuring an animation
|
||||
if (this._config.rest) {
|
||||
rest = this._config.rest;
|
||||
}
|
||||
|
@ -491,7 +491,7 @@ Tart.prototype = {
|
|||
|
||||
var subtests = {
|
||||
init: [ // This is called before each subtest, so it's safe to assume the following prefs:
|
||||
function(){
|
||||
function() {
|
||||
Services.prefs.setBoolPref("browser.newtabpage.enabled", true);
|
||||
Services.prefs.setBoolPref("browser.newtab.preload", false);
|
||||
self.pinTart();
|
||||
|
@ -501,7 +501,7 @@ Tart.prototype = {
|
|||
|
||||
restore: [
|
||||
// Restore prefs which were modified during the test
|
||||
function(){
|
||||
function() {
|
||||
Services.prefs.setBoolPref("browser.newtabpage.enabled", origNewtabEnabled);
|
||||
Services.prefs.setBoolPref("browser.newtab.preload", origPreload);
|
||||
Services.prefs.setCharPref("layout.css.devPixelsPerPx", origDpi);
|
||||
|
@ -511,154 +511,156 @@ Tart.prototype = {
|
|||
],
|
||||
|
||||
simple: [
|
||||
function(){Services.prefs.setCharPref("layout.css.devPixelsPerPx", "1"); next();},
|
||||
function(){animate(0, addTab, next);},
|
||||
function(){animate(0, closeCurrentTab, next);},
|
||||
function() { Services.prefs.setCharPref("layout.css.devPixelsPerPx", "1"); next(); },
|
||||
function() { animate(0, addTab, next); },
|
||||
function() { animate(0, closeCurrentTab, next); },
|
||||
|
||||
function(){animate(rest, addTab, next, true, "simple-open-DPI1", tabRefDuration);},
|
||||
function(){animate(rest, closeCurrentTab, next, true, "simple-close-DPI1", tabRefDuration);}
|
||||
function() { animate(rest, addTab, next, true, "simple-open-DPI1", tabRefDuration); },
|
||||
function() { animate(rest, closeCurrentTab, next, true, "simple-close-DPI1", tabRefDuration); }
|
||||
],
|
||||
|
||||
iconDpi1: [
|
||||
function(){
|
||||
function() {
|
||||
Services.prefs.setCharPref("layout.css.devPixelsPerPx", "1");
|
||||
self.makeNewTabURLChangePromise("chrome://tart/content/blank.icon.html").then(next);
|
||||
},
|
||||
function(){animate(0, addTab, next);},
|
||||
function(){animate(0, closeCurrentTab, next);},
|
||||
function() { animate(0, addTab, next); },
|
||||
function() { animate(0, closeCurrentTab, next); },
|
||||
|
||||
function(){animate(rest, addTab, next, true, "icon-open-DPI1", tabRefDuration);},
|
||||
function(){animate(rest, closeCurrentTab, next, true, "icon-close-DPI1", tabRefDuration);}
|
||||
function() { animate(rest, addTab, next, true, "icon-open-DPI1", tabRefDuration); },
|
||||
function() { animate(rest, closeCurrentTab, next, true, "icon-close-DPI1", tabRefDuration); }
|
||||
],
|
||||
|
||||
iconDpi2: [
|
||||
function(){
|
||||
function() {
|
||||
Services.prefs.setCharPref("layout.css.devPixelsPerPx", "2");
|
||||
self.makeNewTabURLChangePromise("chrome://tart/content/blank.icon.html").then(next);
|
||||
},
|
||||
function(){animate(0, addTab, next);},
|
||||
function(){animate(0, closeCurrentTab, next);},
|
||||
function() { animate(0, addTab, next); },
|
||||
function() { animate(0, closeCurrentTab, next); },
|
||||
|
||||
function(){animate(rest, addTab, next, true, "icon-open-DPI2", tabRefDuration);},
|
||||
function(){animate(rest, closeCurrentTab, next, true, "icon-close-DPI2", tabRefDuration);}
|
||||
function() { animate(rest, addTab, next, true, "icon-open-DPI2", tabRefDuration); },
|
||||
function() { animate(rest, closeCurrentTab, next, true, "icon-close-DPI2", tabRefDuration); }
|
||||
],
|
||||
|
||||
newtabNoPreload: [
|
||||
function(){
|
||||
function() {
|
||||
Services.prefs.setCharPref("layout.css.devPixelsPerPx", "-1");
|
||||
Services.prefs.setBoolPref("browser.newtab.preload", false);
|
||||
self.makeNewTabURLChangePromise("about:newtab").then(next);
|
||||
},
|
||||
function(){animate(rest, addTab, next, true, "newtab-open-preload-no", tabRefDuration);},
|
||||
function(){animate(0, closeCurrentTab, next);}
|
||||
function() { animate(rest, addTab, next, true, "newtab-open-preload-no", tabRefDuration); },
|
||||
function() { animate(0, closeCurrentTab, next); }
|
||||
],
|
||||
|
||||
newtabYesPreload: [
|
||||
function(){
|
||||
function() {
|
||||
Services.prefs.setCharPref("layout.css.devPixelsPerPx", "-1");
|
||||
Services.prefs.setBoolPref("browser.newtab.preload", true);
|
||||
self.makeNewTabURLChangePromise("about:newtab").then(next);
|
||||
},
|
||||
function(){animate(0, addTab, next);},
|
||||
function(){animate(0, closeCurrentTab, next);},
|
||||
function() { animate(0, addTab, next); },
|
||||
function() { animate(0, closeCurrentTab, next); },
|
||||
|
||||
function(){animate(1000, addTab, next, true, "newtab-open-preload-yes", tabRefDuration);},
|
||||
function(){animate(0, closeCurrentTab, next);}
|
||||
function() { animate(1000, addTab, next, true, "newtab-open-preload-yes", tabRefDuration); },
|
||||
function() { animate(0, closeCurrentTab, next); }
|
||||
],
|
||||
|
||||
simple3open3closeDpiCurrent: [
|
||||
function(){animate(rest, addTab, next, true, "simple3-1-open-DPIcurrent", tabRefDuration);},
|
||||
function(){animate(rest, addTab, next, true, "simple3-2-open-DPIcurrent", tabRefDuration);},
|
||||
function(){animate(rest, addTab, next, true, "simple3-3-open-DPIcurrent", tabRefDuration);},
|
||||
function() { animate(rest, addTab, next, true, "simple3-1-open-DPIcurrent", tabRefDuration); },
|
||||
function() { animate(rest, addTab, next, true, "simple3-2-open-DPIcurrent", tabRefDuration); },
|
||||
function() { animate(rest, addTab, next, true, "simple3-3-open-DPIcurrent", tabRefDuration); },
|
||||
|
||||
function(){animate(rest, closeCurrentTab, next, true, "simple3-3-close-DPIcurrent", tabRefDuration);},
|
||||
function(){animate(rest, closeCurrentTab, next, true, "simple3-2-close-DPIcurrent", tabRefDuration);},
|
||||
function(){animate(rest, closeCurrentTab, next, true, "simple3-1-close-DPIcurrent", tabRefDuration);}
|
||||
function() { animate(rest, closeCurrentTab, next, true, "simple3-3-close-DPIcurrent", tabRefDuration); },
|
||||
function() { animate(rest, closeCurrentTab, next, true, "simple3-2-close-DPIcurrent", tabRefDuration); },
|
||||
function() { animate(rest, closeCurrentTab, next, true, "simple3-1-close-DPIcurrent", tabRefDuration); }
|
||||
],
|
||||
|
||||
multi: [
|
||||
function(){
|
||||
function() {
|
||||
Services.prefs.setCharPref("layout.css.devPixelsPerPx", "1.0");
|
||||
self.makeNewTabURLChangePromise("chrome://tart/content/blank.icon.html").then(next);
|
||||
},
|
||||
|
||||
function(){animate(0, addTab, next);},
|
||||
function(){animate(0, addTab, next);},
|
||||
function(){animate(0, addTab, next);},
|
||||
function(){animate(0, addTab, next);},
|
||||
function(){animate(0, addTab, next);},
|
||||
function(){animate(0, addTab, next);},
|
||||
function() { animate(0, addTab, next); },
|
||||
function() { animate(0, addTab, next); },
|
||||
function() { animate(0, addTab, next); },
|
||||
function() { animate(0, addTab, next); },
|
||||
function() { animate(0, addTab, next); },
|
||||
function() { animate(0, addTab, next); },
|
||||
|
||||
function(){animate(rest*2, addTab, next, true, "multi-open-DPI1", tabRefDuration);},
|
||||
function(){animate(rest*2, closeCurrentTab, next, true, "multi-close-DPI1", tabRefDuration);},
|
||||
function() { animate(rest * 2, addTab, next, true, "multi-open-DPI1", tabRefDuration); },
|
||||
function() { animate(rest * 2, closeCurrentTab, next, true, "multi-close-DPI1", tabRefDuration); },
|
||||
|
||||
function(){Services.prefs.setCharPref("layout.css.devPixelsPerPx", "2"); next();},
|
||||
function(){animate(0, addTab, next);},
|
||||
function(){animate(0, closeCurrentTab, next);},
|
||||
function(){animate(rest*2, addTab, next, true, "multi-open-DPI2", tabRefDuration);},
|
||||
function(){animate(rest*2, closeCurrentTab, next, true, "multi-close-DPI2", tabRefDuration);},
|
||||
function() { Services.prefs.setCharPref("layout.css.devPixelsPerPx", "2"); next(); },
|
||||
function() { animate(0, addTab, next); },
|
||||
function() { animate(0, closeCurrentTab, next); },
|
||||
function() { animate(rest * 2, addTab, next, true, "multi-open-DPI2", tabRefDuration); },
|
||||
function() { animate(rest * 2, closeCurrentTab, next, true, "multi-close-DPI2", tabRefDuration); },
|
||||
|
||||
function(){Services.prefs.setCharPref("layout.css.devPixelsPerPx", "-1"); next();},
|
||||
function() { Services.prefs.setCharPref("layout.css.devPixelsPerPx", "-1"); next(); },
|
||||
|
||||
function(){animate(0, closeCurrentTab, next);},
|
||||
function(){animate(0, closeCurrentTab, next);},
|
||||
function(){animate(0, closeCurrentTab, next);},
|
||||
function(){animate(0, closeCurrentTab, next);},
|
||||
function(){animate(0, closeCurrentTab, next);},
|
||||
function(){animate(0, closeCurrentTab, next);},
|
||||
function() { animate(0, closeCurrentTab, next); },
|
||||
function() { animate(0, closeCurrentTab, next); },
|
||||
function() { animate(0, closeCurrentTab, next); },
|
||||
function() { animate(0, closeCurrentTab, next); },
|
||||
function() { animate(0, closeCurrentTab, next); },
|
||||
function() { animate(0, closeCurrentTab, next); },
|
||||
],
|
||||
|
||||
simpleFadeDpiCurrent: [
|
||||
function(){self.makeNewTabURLChangePromise("about:blank").then(next);},
|
||||
function() { self.makeNewTabURLChangePromise("about:blank").then(next); },
|
||||
|
||||
function(){animate(0, addTab, next);},
|
||||
function(){animate(rest, fadeout, next, true, "simpleFade-close-DPIcurrent", tabRefDuration);},
|
||||
function(){animate(rest, fadein, next, true, "simpleFade-open-DPIcurrent", tabRefDuration);},
|
||||
function(){animate(0, closeCurrentTab, next);},
|
||||
function() { animate(0, addTab, next); },
|
||||
function() { animate(rest, fadeout, next, true, "simpleFade-close-DPIcurrent", tabRefDuration); },
|
||||
function() { animate(rest, fadein, next, true, "simpleFade-open-DPIcurrent", tabRefDuration); },
|
||||
function() { animate(0, closeCurrentTab, next); },
|
||||
],
|
||||
|
||||
iconFadeDpiCurrent: [
|
||||
function(){self.makeNewTabURLChangePromise("chrome://tart/content/blank.icon.html").then(next);},
|
||||
function() { self.makeNewTabURLChangePromise("chrome://tart/content/blank.icon.html").then(next); },
|
||||
|
||||
function(){animate(0, addTab, next);},
|
||||
function(){animate(rest, fadeout, next, true, "iconFade-close-DPIcurrent", tabRefDuration);},
|
||||
function(){animate(rest, fadein, next, true, "iconFade-open-DPIcurrent", tabRefDuration);},
|
||||
function(){animate(0, closeCurrentTab, next);},
|
||||
function() { animate(0, addTab, next); },
|
||||
function() { animate(rest, fadeout, next, true, "iconFade-close-DPIcurrent", tabRefDuration); },
|
||||
function() { animate(rest, fadein, next, true, "iconFade-open-DPIcurrent", tabRefDuration); },
|
||||
function() { animate(0, closeCurrentTab, next); },
|
||||
],
|
||||
|
||||
iconFadeDpi2: [
|
||||
function(){
|
||||
function() {
|
||||
Services.prefs.setCharPref("layout.css.devPixelsPerPx", "2");
|
||||
self.makeNewTabURLChangePromise("chrome://tart/content/blank.icon.html").then(next);
|
||||
},
|
||||
function(){animate(0, addTab, next);},
|
||||
function(){animate(rest, fadeout, next, true, "iconFade-close-DPI2", tabRefDuration);},
|
||||
function(){animate(rest, fadein, next, true, "iconFade-open-DPI2", tabRefDuration);},
|
||||
function(){animate(0, closeCurrentTab, next);},
|
||||
function() { animate(0, addTab, next); },
|
||||
function() { animate(rest, fadeout, next, true, "iconFade-close-DPI2", tabRefDuration); },
|
||||
function() { animate(rest, fadein, next, true, "iconFade-open-DPI2", tabRefDuration); },
|
||||
function() { animate(0, closeCurrentTab, next); },
|
||||
],
|
||||
|
||||
lastTabFadeDpiCurrent: [
|
||||
function(){self._win.gBrowser.selectedTab = self._win.gBrowser.tabs[gBrowser.tabs.length - 1];
|
||||
next();},
|
||||
function(){animate(rest, fadeout, next, true, "lastTabFade-close-DPIcurrent", tabRefDuration);},
|
||||
function(){animate(rest, fadein, next, true, "lastTabFade-open-DPIcurrent", tabRefDuration);},
|
||||
function() {
|
||||
self._win.gBrowser.selectedTab = self._win.gBrowser.tabs[gBrowser.tabs.length - 1];
|
||||
next();
|
||||
},
|
||||
function() { animate(rest, fadeout, next, true, "lastTabFade-close-DPIcurrent", tabRefDuration); },
|
||||
function() { animate(rest, fadein, next, true, "lastTabFade-open-DPIcurrent", tabRefDuration); },
|
||||
],
|
||||
|
||||
customize: [
|
||||
// Test australis customize mode animation with default DPI.
|
||||
function(){Services.prefs.setCharPref("layout.css.devPixelsPerPx", "-1"); next();},
|
||||
function() { Services.prefs.setCharPref("layout.css.devPixelsPerPx", "-1"); next(); },
|
||||
// Adding a non-newtab since the behavior of exiting customize mode which was entered on newtab may change. See bug 957202.
|
||||
function(){animate(0, addSomeTab, next);},
|
||||
function() { animate(0, addSomeTab, next); },
|
||||
|
||||
// The prefixes 1- and 2- were added because talos cuts common prefixes on all "pages", which ends up as "customize-e" prefix.
|
||||
function(){animate(rest, customizeEnter, next, true, "1-customize-enter", custRefDuration);},
|
||||
function(){animate(rest, customizeExit, next, true, "2-customize-exit", custRefDuration);},
|
||||
function() { animate(rest, customizeEnter, next, true, "1-customize-enter", custRefDuration); },
|
||||
function() { animate(rest, customizeExit, next, true, "2-customize-exit", custRefDuration); },
|
||||
|
||||
// Measures the CSS-animation-only part of entering into customize mode
|
||||
function(){animate(rest, customizeEnterCss, next, true, "3-customize-enter-css", custRefDuration);},
|
||||
function(){animate(0, customizeExit, next);},
|
||||
function() { animate(rest, customizeEnterCss, next, true, "3-customize-enter-css", custRefDuration); },
|
||||
function() { animate(0, customizeExit, next); },
|
||||
|
||||
function(){animate(0, closeCurrentTab, next);}
|
||||
function() { animate(0, closeCurrentTab, next); }
|
||||
]
|
||||
};
|
||||
|
||||
|
@ -676,8 +678,8 @@ Tart.prototype = {
|
|||
this._doSequence(sequenceArray, this._doneInternal);
|
||||
},
|
||||
|
||||
startTest: function(doneCallback, config) {
|
||||
this._onTestComplete = function (results) {
|
||||
startTest(doneCallback, config) {
|
||||
this._onTestComplete = function(results) {
|
||||
Profiler.mark("TART - end", true);
|
||||
doneCallback(results);
|
||||
};
|
||||
|
|
|
@ -15,9 +15,9 @@ var start2 = 0;
|
|||
var paintedFramesStart2 = 0;
|
||||
var testIndex = 0;
|
||||
var test = [
|
||||
'testsrc.240p.120fps.mp4',
|
||||
'testsrc.480p.60fps.webm',
|
||||
'testsrc.1080p.60fps.mp4',
|
||||
"testsrc.240p.120fps.mp4",
|
||||
"testsrc.480p.60fps.webm",
|
||||
"testsrc.1080p.60fps.mp4",
|
||||
];
|
||||
var viewModeIndex = 0;
|
||||
// Remove fullscreen mode since it causes intermittent failures on try server. See bug 1192317.
|
||||
|
@ -29,10 +29,10 @@ function init() {
|
|||
}
|
||||
|
||||
function content_focused() {
|
||||
vdo = document.getElementById('vdo');
|
||||
vdo.addEventListener('loadeddata', prepare, false);
|
||||
document.addEventListener('fullscreenchange', fullscreen);
|
||||
document.addEventListener('mozfullscreenchange', fullscreen);
|
||||
vdo = document.getElementById("vdo");
|
||||
vdo.addEventListener("loadeddata", prepare);
|
||||
document.addEventListener("fullscreenchange", fullscreen);
|
||||
document.addEventListener("mozfullscreenchange", fullscreen);
|
||||
runTest();
|
||||
}
|
||||
|
||||
|
@ -47,18 +47,18 @@ function fullscreen(event) {
|
|||
|
||||
function runTest() {
|
||||
// Windows XP cannot play mp4 clip due to the lack of gmp-eme-plugin, so skip it.
|
||||
if (window.navigator.oscpu == 'Windows NT 5.1' && test[testIndex].indexOf('mp4') >= 0) {
|
||||
if (window.navigator.oscpu == "Windows NT 5.1" && test[testIndex].indexOf("mp4") >= 0) {
|
||||
nextTest();
|
||||
}
|
||||
vdo.setAttribute('src', 'clips/' + test[testIndex]);
|
||||
vdo.setAttribute("src", "clips/" + test[testIndex]);
|
||||
vdo.load();
|
||||
}
|
||||
|
||||
function prepare() {
|
||||
if (viewMode[viewModeIndex] == 'fullscreen') {
|
||||
if (viewMode[viewModeIndex] == "fullscreen") {
|
||||
// Fullscreen mode
|
||||
vdo.setAttribute('width', '100%');
|
||||
vdo.setAttribute('height', '100%');
|
||||
vdo.setAttribute("width", "100%");
|
||||
vdo.setAttribute("height", "100%");
|
||||
if (document.body.requestFullscreen) {
|
||||
document.body.requestFullscreen();
|
||||
} else if (document.body.mozRequestFullScreen) {
|
||||
|
@ -66,8 +66,8 @@ function prepare() {
|
|||
}
|
||||
} else {
|
||||
readyToStart = true;
|
||||
vdo.setAttribute('width', vdo.videoWidth * viewMode[viewModeIndex]);
|
||||
vdo.setAttribute('height', vdo.videoHeight * viewMode[viewModeIndex]);
|
||||
vdo.setAttribute("width", vdo.videoWidth * viewMode[viewModeIndex]);
|
||||
vdo.setAttribute("height", vdo.videoHeight * viewMode[viewModeIndex]);
|
||||
startTest();
|
||||
}
|
||||
}
|
||||
|
@ -90,12 +90,12 @@ function measurementEnded() {
|
|||
var paintedFramesEnd = vdo.mozPaintedFrames;
|
||||
var timePerFrame1 = (start2 - start1) / (paintedFramesStart2 - paintedFramesStart1);
|
||||
var timePerFrame2 = (end - start2) / (paintedFramesEnd - paintedFramesStart2);
|
||||
testResult.names.push(test[testIndex] + '_scale_' + viewMode[viewModeIndex] + '_startup');
|
||||
testResult.names.push(test[testIndex] + "_scale_" + viewMode[viewModeIndex] + "_startup");
|
||||
testResult.values.push(timePerFrame1);
|
||||
testResult.names.push(test[testIndex] + '_scale_' + viewMode[viewModeIndex] + '_inclip');
|
||||
testResult.names.push(test[testIndex] + "_scale_" + viewMode[viewModeIndex] + "_inclip");
|
||||
testResult.values.push(timePerFrame2);
|
||||
|
||||
if (viewMode[viewModeIndex] == 'fullscreen') {
|
||||
if (viewMode[viewModeIndex] == "fullscreen") {
|
||||
// Exit fullscreen mode
|
||||
if (document.exitFullscreen) {
|
||||
document.exitFullscreen();
|
||||
|
@ -122,20 +122,20 @@ function nextTest() {
|
|||
}
|
||||
|
||||
function reportResult() {
|
||||
var msg = '';
|
||||
var msg = "";
|
||||
for (var i = 0; i < testResult.names.length; i++) {
|
||||
msg += testResult.names[i] + ' = ' + testResult.values[i] + ' ms/frame\n\n';
|
||||
msg += testResult.names[i] + " = " + testResult.values[i] + " ms/frame\n\n";
|
||||
}
|
||||
|
||||
dump(msg); // Put the readable report at talos run-log
|
||||
|
||||
if (window.tpRecordTime) {
|
||||
// Within talos - report the results
|
||||
return tpRecordTime(testResult.values.join(','), 0, testResult.names.join(','));
|
||||
} else {
|
||||
return tpRecordTime(testResult.values.join(","), 0, testResult.names.join(","));
|
||||
}
|
||||
// Local run in a plain browser, display the formatted report
|
||||
alert(msg);
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
<script language="javascript" type="text/javascript">
|
||||
const kTotalTicks = 100;
|
||||
var start;
|
||||
var gl = document.createElement('canvas').getContext('webgl');
|
||||
var gl = document.createElement("canvas").getContext("webgl");
|
||||
gl.bindTexture(gl.TEXTURE_2D, gl.createTexture());
|
||||
var video;
|
||||
video = document.createElement('video');
|
||||
video = document.createElement("video");
|
||||
video.src = "../../../video/clips/testsrc.1080p.60fps.mp4";
|
||||
video.addEventListener('playing', playingListener, true); // loadstart?
|
||||
video.addEventListener("playing", playingListener, true); // loadstart?
|
||||
video.loop = true;
|
||||
|
||||
function init() {
|
||||
|
@ -23,9 +23,8 @@ function content_focused() {
|
|||
video.play();
|
||||
}
|
||||
|
||||
function playingListener()
|
||||
{
|
||||
video.removeEventListener('playing', playingListener, true);
|
||||
function playingListener() {
|
||||
video.removeEventListener("playing", playingListener, true);
|
||||
start = performance.now();
|
||||
tick();
|
||||
}
|
||||
|
@ -46,18 +45,18 @@ function tick() {
|
|||
|
||||
function reportResult(totalTime, totalTicks) {
|
||||
var meanTickTime = totalTime / totalTicks;
|
||||
var desc = 'Mean tick time across ' + totalTicks + ' ticks: ';
|
||||
var text = desc + meanTickTime + ' ms\n';
|
||||
var desc = "Mean tick time across " + totalTicks + " ticks: ";
|
||||
var text = desc + meanTickTime + " ms\n";
|
||||
|
||||
dump('[talos glvideo result] ' + text);
|
||||
dump("[talos glvideo result] " + text);
|
||||
|
||||
if (window.tpRecordTime) {
|
||||
// Within talos - report the results
|
||||
return tpRecordTime(meanTickTime, 0, desc);
|
||||
} else {
|
||||
// Local run in a plain browser, display the formatted report
|
||||
alert('[talos glvideo result] ' + text);
|
||||
}
|
||||
// Local run in a plain browser, display the formatted report
|
||||
alert("[talos glvideo result] " + text);
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
"use strict";
|
||||
|
||||
"use strict";
|
||||
|
||||
// Empty background script
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
"use strict";
|
||||
|
||||
"use strict";
|
||||
|
||||
// Empty content script
|
||||
|
|
|
@ -65,7 +65,10 @@ security/nss/
|
|||
security/sandbox/chromium/
|
||||
testing/gtest/gmock/
|
||||
testing/gtest/gtest/
|
||||
testing/talos/talos/tests/canvasmark/
|
||||
testing/talos/talos/tests/dromaeo/
|
||||
testing/talos/talos/tests/kraken/
|
||||
testing/talos/talos/tests/v8_7/
|
||||
third_party/aom/
|
||||
third_party/python/blessings/
|
||||
third_party/python/configobj/
|
||||
|
|
Загрузка…
Ссылка в новой задаче