/* 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/. */
/** * Status code component * Displays HTTP status code icon * Used in RequestListColumnStatus and HeadersPanel
*/ class StatusCode extends Component { static get propTypes() { return {
item: PropTypes.object.isRequired,
};
}
// `data-code` refers to the status-code // `data-status-code` can be one of "cached", "service worker" // or the status-code itself // For example - if a resource is cached, `data-code` would be 200 // and the `data-status-code` would be "cached" return div(
{},
statusInfo.map(info => { if (!info.status) { returnnull;
} return span(
{
className: "requests-list-status-code status-code",
onMouseOver({ target }) { if (info.status && info.statusText && !target.title) {
target.title = getStatusTooltip(item);
}
}, "data-status-code": info.code, "data-code": info.status,
},
info.status
);
})
);
}
}
function getStatusTooltip(item) { const { fromCache, fromServiceWorker, status, statusText } = item;
let title; if (fromCache && fromServiceWorker) {
title = L10N.getFormatStr( "netmonitor.status.tooltip.cachedworker",
status,
statusText
);
} elseif (fromCache) {
title = L10N.getFormatStr( "netmonitor.status.tooltip.cached",
status,
statusText
);
} elseif (fromServiceWorker) {
title = L10N.getFormatStr( "netmonitor.status.tooltip.worker",
status,
statusText
);
} else {
title = L10N.getFormatStr( "netmonitor.status.tooltip.simple",
status,
statusText
);
} return title;
}
module.exports = StatusCode;
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.