зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1484356 [wpt PR 12556] - [UserTiming] Correct measure where start is undefined, a=testonly
Automatic update from web-platform-tests[UserTiming] Correct measure where start is undefined According to spec, if start is undefined for performance.measure(), 0 will be used as the start time. However, the current implementation treats undefined as "null". This CL doesn't solve all the problems. For backward compatibility, L2 should treat undefined passed to start/end as empty, null as a string 'null'. As a temporary fix, we treat both null and undefined as undefined, which is safer than as 'null'. Bug: 876324 Change-Id: I7d74d6be9552d090ab7f28342be9a739017bf59b Reviewed-on: https://chromium-review.googlesource.com/1180345 Commit-Queue: Liquan (Max) Gǔ <maxlg@chromium.org> Reviewed-by: Yoav Weiss <yoav@yoav.ws> Reviewed-by: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: Paul Irish <paulirish@chromium.org> Cr-Commit-Position: refs/heads/master@{#585103} -- wpt-commits: 54525995564877fbf730c679200a5ae8610e5f2f wpt-pr: 12556
This commit is contained in:
Родитель
5ac5d1bbc2
Коммит
395f3500c0
|
@ -646231,7 +646231,7 @@
|
|||
"testharness"
|
||||
],
|
||||
"user-timing/measure.html": [
|
||||
"d114ecd18feee97b2c9a87a9f6a424b18e4ccc9d",
|
||||
"40f71a3362b581f3d0b23f5c0202a5d400a499b9",
|
||||
"testharness"
|
||||
],
|
||||
"user-timing/measure_associated_with_navigation_timing.html": [
|
||||
|
|
|
@ -57,6 +57,18 @@
|
|||
order: undefined,
|
||||
found: false
|
||||
},
|
||||
{
|
||||
name: "measure_no_start_end",
|
||||
startMark: undefined,
|
||||
endMark: "mark_end",
|
||||
startTime: undefined,
|
||||
duration: undefined,
|
||||
entryType: "measure",
|
||||
entryMatch: undefined,
|
||||
order: undefined,
|
||||
found: false
|
||||
},
|
||||
// intentional duplicate of the first measure, used to confirm names can be re-used
|
||||
{
|
||||
name: "measure_no_start_no_end",
|
||||
startMark: undefined,
|
||||
|
@ -69,6 +81,8 @@
|
|||
found: false
|
||||
}
|
||||
];
|
||||
// the index of the duplicate "measure_no_start_no_end"
|
||||
const duplicate_index = TEST_MEASURES.map(m=>m.name).lastIndexOf('measure_no_start_no_end');
|
||||
|
||||
setup({explicit_done: true});
|
||||
|
||||
|
@ -150,9 +164,26 @@
|
|||
scenario.startTime = startMarkValue;
|
||||
|
||||
// when endMark is provided to the measure() call, the value of the mark whose name is
|
||||
// provided is used for the startMark
|
||||
// provided is used for the endMark
|
||||
scenario.duration = endMarkValue - startMarkValue;
|
||||
}
|
||||
else if (scenario.startMark == undefined && scenario.endMark != undefined)
|
||||
{
|
||||
// endMark is defined but startMark is undefined, provide both parameters
|
||||
window.performance.measure(scenario.name, scenario.startMark, scenario.endMark);
|
||||
|
||||
// when startMark isn't provided to the measure() call, a DOMHighResTimeStamp corresponding
|
||||
// to the navigationStart attribute with a timebase of the same attribute is used; this is
|
||||
// equivalent to 0
|
||||
scenario.startTime = 0;
|
||||
|
||||
// when endMark is provided to the measure() call, the value of the mark whose name is
|
||||
// provided is used for the endMark
|
||||
scenario.duration = endMarkValue;
|
||||
} else
|
||||
{
|
||||
test_true(false, 'Test measure scenario unhandled');
|
||||
}
|
||||
}
|
||||
|
||||
// test that expected measures are returned by getEntriesByName
|
||||
|
@ -162,13 +193,13 @@
|
|||
// for all test measures, the test will be validate the test measure against the first entry returned
|
||||
// by getEntriesByName(), except for the last measure, where since it is a duplicate measure, the test
|
||||
// will validate it against the second entry returned by getEntriesByName()
|
||||
test_measure(entries[(i == 3 ? 1 : 0)],
|
||||
test_measure(entries[(i == duplicate_index ? 1 : 0)],
|
||||
"window.performance.getEntriesByName(\"" + TEST_MEASURES[i].name + "\")[" +
|
||||
(i == 3 ? 1 : 0) + "]",
|
||||
(i == duplicate_index ? 1 : 0) + "]",
|
||||
TEST_MEASURES[i].name,
|
||||
TEST_MEASURES[i].startTime,
|
||||
TEST_MEASURES[i].duration);
|
||||
TEST_MEASURES[i].entryMatch = entries[(i == 3 ? 1 : 0)];
|
||||
TEST_MEASURES[i].entryMatch = entries[(i == duplicate_index ? 1 : 0)];
|
||||
}
|
||||
|
||||
// test that expected measures are returned by getEntriesByName with the entryType parameter provided
|
||||
|
@ -176,9 +207,9 @@
|
|||
{
|
||||
entries = window.performance.getEntriesByName(TEST_MEASURES[i].name, "measure");
|
||||
|
||||
test_true(match_entries(entries[(i == 3 ? 1 : 0)], TEST_MEASURES[i].entryMatch),
|
||||
test_true(match_entries(entries[(i == duplicate_index ? 1 : 0)], TEST_MEASURES[i].entryMatch),
|
||||
"window.performance.getEntriesByName(\"" + TEST_MEASURES[i].name + "\", \"measure\")[" +
|
||||
(i == 3 ? 1 : 0) + "] returns an object containing the \"" + TEST_MEASURES[i].name +
|
||||
(i == duplicate_index ? 1 : 0) + "] returns an object containing the \"" + TEST_MEASURES[i].name +
|
||||
"\" measure in the correct order, and its value matches the \"" + TEST_MEASURES[i].name +
|
||||
"\" measure returned by window.performance.getEntriesByName(\"" + TEST_MEASURES[i].name +
|
||||
"\")");
|
||||
|
@ -260,7 +291,7 @@
|
|||
measureEntryListCommand + " returns an object containing the \"" +
|
||||
measureScenarios[i].name + "\" measure, and it's value matches the measure " +
|
||||
"returned by window.performance.getEntriesByName(\"" + measureScenarios[i].name +
|
||||
"\")[" + (i == 3 ? 1 : 0) + "].");
|
||||
"\")[" + (i == duplicate_index ? 1 : 0) + "].");
|
||||
|
||||
measureEntryList[j].found = true;
|
||||
measureScenarios[i].found = true;
|
||||
|
@ -318,6 +349,7 @@
|
|||
provided</li>
|
||||
<li>"measure_start_no_end": created using a measure() call with only the startMark provided</li>
|
||||
<li>"measure_start_end": created using a measure() call with both a startMark or endMark provided</li>
|
||||
<li>"measure_no_start_end": created using a measure() call with only the endMark provided</li>
|
||||
<li>"measure_no_start_no_end": duplicate of the first measure, used to confirm names can be re-used</li>
|
||||
</ul>
|
||||
After creating each measure, the existence of these measures is validated by calling
|
||||
|
|
Загрузка…
Ссылка в новой задаче