mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1565680 - Track time to render first page of PDF in talos. r=jmaher
Adds a new pageload test that captures the "pagerendered" event from PDF.js. Differential Revision: https://phabricator.services.mozilla.com/D37935 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
b991d302fe
commit
275407fe9d
@ -13,7 +13,7 @@
|
||||
"tests": ["tart_flex", "ts_paint_flex"]
|
||||
},
|
||||
"other": {
|
||||
"tests": ["a11yr", "ts_paint", "twinopen", "sessionrestore", "sessionrestore_no_auto_restore", "tabpaint", "cpstartup", "startup_about_home_paint"]
|
||||
"tests": ["a11yr", "ts_paint", "twinopen", "sessionrestore", "sessionrestore_no_auto_restore", "tabpaint", "cpstartup", "startup_about_home_paint", "pdfpaint"]
|
||||
},
|
||||
"sessionrestore-many-windows": {
|
||||
"tests": ["sessionrestore_many_windows"]
|
||||
|
@ -124,6 +124,8 @@ def create_parser(mach_interface=False):
|
||||
help="defines an extra user preference")
|
||||
add_arg("--firstNonBlankPaint", action='store_true', dest="fnbpaint",
|
||||
help="Wait for firstNonBlankPaint event before recording the time")
|
||||
add_arg("--pdfPaint", action='store_true', dest="pdfpaint",
|
||||
help="Wait for the first page of a PDF to be rendered")
|
||||
add_arg('--webServer', dest='webserver',
|
||||
help="DEPRECATED")
|
||||
if not mach_interface:
|
||||
|
@ -38,6 +38,7 @@ DEFAULTS = dict(
|
||||
tpcycles=10,
|
||||
tpmozafterpaint=False,
|
||||
tphero=False,
|
||||
pdfpaint=True,
|
||||
fnbpaint=False,
|
||||
firstpaint=False,
|
||||
format_pagename=True,
|
||||
@ -72,6 +73,7 @@ GLOBAL_OVERRIDES = (
|
||||
'tpmozafterpaint',
|
||||
'tphero',
|
||||
'fnbpaint',
|
||||
'pdfpaint',
|
||||
'firstpaint',
|
||||
'userready',
|
||||
)
|
||||
@ -227,6 +229,7 @@ def get_test(config, global_overrides, counters, test_instance):
|
||||
firstPaint = getattr(test_instance, 'firstpaint', None)
|
||||
userReady = getattr(test_instance, 'userready', None)
|
||||
firstNonBlankPaint = getattr(test_instance, 'fnbpaint', None)
|
||||
pdfPaint = getattr(test_instance, 'pdfpaint', None)
|
||||
|
||||
test_instance.update(**global_overrides)
|
||||
|
||||
@ -242,6 +245,8 @@ def get_test(config, global_overrides, counters, test_instance):
|
||||
test_instance.userready = userReady
|
||||
if hero is not None:
|
||||
test_instance.tphero = hero
|
||||
if pdfPaint is not None:
|
||||
test_instance.pdfpaint = pdfPaint
|
||||
|
||||
# fix up url
|
||||
url = getattr(test_instance, 'url', None)
|
||||
|
22
testing/talos/talos/pageloader/chrome/lh_pdfpaint.js
Normal file
22
testing/talos/talos/pageloader/chrome/lh_pdfpaint.js
Normal file
@ -0,0 +1,22 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
function _pdfPaintHandler() {
|
||||
content.window.addEventListener(
|
||||
"pagerendered",
|
||||
e => {
|
||||
sendAsyncMessage("PageLoader:LoadEvent", {
|
||||
time: e.detail.timestamp,
|
||||
name: "pdfpaint",
|
||||
});
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
}
|
||||
|
||||
addEventListener(
|
||||
"load",
|
||||
// eslint-disable-next-line no-undef
|
||||
contentLoadHandlerCallback(_pdfPaintHandler),
|
||||
true
|
||||
);
|
@ -39,6 +39,8 @@ var forceCC = true;
|
||||
var useMozAfterPaint = false;
|
||||
var useFNBPaint = false;
|
||||
var isFNBPaintPending = false;
|
||||
var usePDFPaint = false;
|
||||
var isPDFPaintPending = false;
|
||||
var useHero = false;
|
||||
var gPaintWindow = window;
|
||||
var gPaintListener = false;
|
||||
@ -140,6 +142,7 @@ function plInit() {
|
||||
);
|
||||
useHero = Services.prefs.getBoolPref("talos.tphero", false);
|
||||
useFNBPaint = Services.prefs.getBoolPref("talos.fnbpaint", false);
|
||||
usePDFPaint = Services.prefs.getBoolPref("talos.pdfpaint", false);
|
||||
loadNoCache = Services.prefs.getBoolPref("talos.tploadnocache", false);
|
||||
scrollTest = Services.prefs.getBoolPref("talos.tpscrolltest", false);
|
||||
useBrowserChrome = Services.prefs.getBoolPref("talos.tpchrome", false);
|
||||
@ -269,6 +272,12 @@ function plInit() {
|
||||
false,
|
||||
true
|
||||
);
|
||||
} else if (usePDFPaint) {
|
||||
content.selectedBrowser.messageManager.loadFrameScript(
|
||||
"chrome://pageloader/content/lh_pdfpaint.js",
|
||||
false,
|
||||
true
|
||||
);
|
||||
} else {
|
||||
content.selectedBrowser.messageManager.loadFrameScript(
|
||||
"chrome://pageloader/content/lh_dummy.js",
|
||||
@ -376,6 +385,10 @@ function plLoadPage() {
|
||||
isFNBPaintPending = true;
|
||||
}
|
||||
|
||||
if (usePDFPaint) {
|
||||
isPDFPaintPending = true;
|
||||
}
|
||||
|
||||
startAndLoadURI(pageName);
|
||||
}
|
||||
|
||||
@ -486,6 +499,14 @@ var plNextPage = async function() {
|
||||
}
|
||||
}
|
||||
|
||||
if (usePDFPaint) {
|
||||
// don't move to next page until we've received pdfpaint
|
||||
if (isPDFPaintPending) {
|
||||
dumpLine("Waiting for pdfpaint");
|
||||
await waitForPDFPaint();
|
||||
}
|
||||
}
|
||||
|
||||
if (profilingInfo) {
|
||||
await TalosParentProfiler.finishTest();
|
||||
}
|
||||
@ -553,6 +574,19 @@ function waitForFNBPaint() {
|
||||
});
|
||||
}
|
||||
|
||||
function waitForPDFPaint() {
|
||||
return new Promise(resolve => {
|
||||
function checkForPDFPaint() {
|
||||
if (!isPDFPaintPending) {
|
||||
resolve();
|
||||
} else {
|
||||
setTimeout(checkForPDFPaint, 200);
|
||||
}
|
||||
}
|
||||
checkForPDFPaint();
|
||||
});
|
||||
}
|
||||
|
||||
function forceContentGC() {
|
||||
return new Promise(resolve => {
|
||||
let mm = browserWindow.gBrowser.selectedBrowser.messageManager;
|
||||
@ -748,7 +782,14 @@ function _loadHandler(paint_time = 0) {
|
||||
end_time = Date.now();
|
||||
}
|
||||
|
||||
var duration = end_time - start_time;
|
||||
var duration;
|
||||
if (usePDFPaint) {
|
||||
// PDF paint uses performance.now(), so the time does not need to be
|
||||
// adjusted from the start time.
|
||||
duration = end_time;
|
||||
} else {
|
||||
duration = end_time - start_time;
|
||||
}
|
||||
TalosParentProfiler.pause("Bubbling load handler fired.");
|
||||
|
||||
// does this page want to do its own timing?
|
||||
@ -775,6 +816,8 @@ function plLoadHandlerMessage(message) {
|
||||
if (message.json.name == "fnbpaint") {
|
||||
// we've received fnbpaint; no longer pending for this current pageload
|
||||
isFNBPaintPending = false;
|
||||
} else if (message.json.name == "pdfpaint") {
|
||||
isPDFPaintPending = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ def set_tp_preferences(test, browser_config):
|
||||
test[cycle_var] = 2
|
||||
|
||||
CLI_bool_options = ['tpchrome', 'tphero', 'tpmozafterpaint', 'tploadnocache', 'tpscrolltest',
|
||||
'fnbpaint']
|
||||
'fnbpaint', 'pdfpaint']
|
||||
CLI_options = ['tpcycles', 'tppagecycles', 'tptimeout', 'tpmanifest']
|
||||
for key in CLI_bool_options:
|
||||
_pref_name = "talos.%s" % key
|
||||
|
@ -253,7 +253,7 @@ class PageloaderTest(Test):
|
||||
'profile_path', 'xperf_providers', 'xperf_user_providers', 'xperf_stackwalk',
|
||||
'format_pagename', 'filters', 'preferences', 'extensions', 'setup', 'cleanup',
|
||||
'lower_is_better', 'alert_threshold', 'unit', 'webextensions', 'profile',
|
||||
'subtest_alerts', 'perfherder_framework']
|
||||
'subtest_alerts', 'perfherder_framework', 'pdfpaint']
|
||||
|
||||
|
||||
class QuantumPageloadTest(PageloaderTest):
|
||||
@ -292,6 +292,22 @@ class twinopen(PageloaderTest):
|
||||
}
|
||||
|
||||
|
||||
@register_test()
|
||||
class pdfpaint(PageloaderTest):
|
||||
"""
|
||||
Tests the amount of time it takes for the the first page of a PDF to
|
||||
be rendered.
|
||||
"""
|
||||
tpmanifest = '${talos}/tests/pdfpaint/pdfpaint.manifest'
|
||||
tppagecycles = 20
|
||||
gecko_profile_entries = 1000000
|
||||
pdfpaint = True
|
||||
unit = 'ms'
|
||||
preferences = {
|
||||
'pdfjs.eventBusDispatchToDOM': True
|
||||
}
|
||||
|
||||
|
||||
@register_test()
|
||||
class cpstartup(PageloaderTest):
|
||||
"""
|
||||
|
1
testing/talos/talos/tests/pdfpaint/pdfpaint.manifest
Normal file
1
testing/talos/talos/tests/pdfpaint/pdfpaint.manifest
Normal file
@ -0,0 +1 @@
|
||||
http://localhost/tests/pdfpaint/tracemonkey.pdf
|
BIN
testing/talos/talos/tests/pdfpaint/tracemonkey.pdf
Normal file
BIN
testing/talos/talos/tests/pdfpaint/tracemonkey.pdf
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user