зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1285173 - Netmonitor perf stats: whenDataAvailable should wait for a nonempty request list r=Honza
MozReview-Commit-ID: F4yi7vUdXsM --HG-- extra : rebase_source : fc0b41c111a7793a51b212a9c327ba6e4cf1bbf4
This commit is contained in:
Родитель
fadc330a3e
Коммит
3ac82a47a4
|
@ -232,7 +232,7 @@ var NetMonitorView = {
|
||||||
// • The response content size and request total time are necessary for
|
// • The response content size and request total time are necessary for
|
||||||
// populating the statistics view.
|
// populating the statistics view.
|
||||||
// • The response mime type is used for categorization.
|
// • The response mime type is used for categorization.
|
||||||
yield whenDataAvailable(requestsView.attachments, [
|
yield whenDataAvailable(requestsView, [
|
||||||
"responseHeaders", "status", "contentSize", "mimeType", "totalTime"
|
"responseHeaders", "status", "contentSize", "mimeType", "totalTime"
|
||||||
]);
|
]);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
|
@ -1189,18 +1189,19 @@ var $all = (selector, target = document) => target.querySelectorAll(selector);
|
||||||
* Makes sure certain properties are available on all objects in a data store.
|
* Makes sure certain properties are available on all objects in a data store.
|
||||||
*
|
*
|
||||||
* @param array dataStore
|
* @param array dataStore
|
||||||
* A list of objects for which to check the availability of properties.
|
* The request view object from which to fetch the item list.
|
||||||
* @param array mandatoryFields
|
* @param array mandatoryFields
|
||||||
* A list of strings representing properties of objects in dataStore.
|
* A list of strings representing properties of objects in dataStore.
|
||||||
* @return object
|
* @return object
|
||||||
* A promise resolved when all objects in dataStore contain the
|
* A promise resolved when all objects in dataStore contain the
|
||||||
* properties defined in mandatoryFields.
|
* properties defined in mandatoryFields.
|
||||||
*/
|
*/
|
||||||
function whenDataAvailable(dataStore, mandatoryFields) {
|
function whenDataAvailable(requestsView, mandatoryFields) {
|
||||||
let deferred = promise.defer();
|
let deferred = promise.defer();
|
||||||
|
|
||||||
let interval = setInterval(() => {
|
let interval = setInterval(() => {
|
||||||
if (dataStore.every(item => {
|
const { attachments } = requestsView;
|
||||||
|
if (attachments.length > 0 && attachments.every(item => {
|
||||||
return mandatoryFields.every(field => field in item);
|
return mandatoryFields.every(field => field in item);
|
||||||
})) {
|
})) {
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче