Bug 1358038 - Add "Race Cache With Network" status. r=Honza

Summary: Bug 1358038 - Add "Race Cache With Network" status. r=Honza

Reviewers: Honza

Subscribers: flod

Bug #: 1358038

Differential Revision: https://phabricator.services.mozilla.com/D8018
***
Update more pieces to show "Race Cache With Network" status
***
Remove unneeded lines
***
Update comment
***
Update comment
This commit is contained in:
tanhengyeow 2019-04-15 16:43:50 +08:00
Родитель 2f0f64f3fb
Коммит 67808459ac
8 изменённых файлов: 30 добавлений и 5 удалений

Просмотреть файл

@ -145,6 +145,11 @@ responseTruncated=Response has been truncated
# in the response tab of the network details pane for an HTML preview. # in the response tab of the network details pane for an HTML preview.
responsePreview=Preview responsePreview=Preview
# LOCALIZATION NOTE (networkMenu.raced): This is the label displayed
# in the network menu specifying the transfer or a request is
# raced. %S refers to the current transfer size.
networkMenu.raced=%S (raced)
# LOCALIZATION NOTE (networkMenu.sortedAsc): This is the tooltip displayed # LOCALIZATION NOTE (networkMenu.sortedAsc): This is the tooltip displayed
# in the network table toolbar, for any column that is sorted ascending. # in the network table toolbar, for any column that is sorted ascending.
networkMenu.sortedAsc=Sorted ascending networkMenu.sortedAsc=Sorted ascending
@ -221,7 +226,7 @@ networkMenu.sizeUnavailable=—
networkMenu.sizeUnavailable.title=Transferred size is not available networkMenu.sizeUnavailable.title=Transferred size is not available
# LOCALIZATION NOTE (networkMenu.sizeCached): This is the label displayed # LOCALIZATION NOTE (networkMenu.sizeCached): This is the label displayed
# in the network menu specifying the transferred of a request is # in the network menu specifying the transfer or a request is
# cached. # cached.
networkMenu.sizeCached=cached networkMenu.sizeCached=cached

Просмотреть файл

@ -18,6 +18,7 @@ const SIZE_UNAVAILABLE_TITLE = L10N.getStr("networkMenu.sizeUnavailable.title");
const UPDATED_TRANSFERRED_PROPS = [ const UPDATED_TRANSFERRED_PROPS = [
"transferredSize", "transferredSize",
"fromCache", "fromCache",
"isRacing",
"fromServiceWorker", "fromServiceWorker",
]; ];
@ -33,7 +34,13 @@ class RequestListColumnTransferredSize extends Component {
} }
render() { render() {
const { fromCache, fromServiceWorker, status, transferredSize } = this.props.item; const {
fromCache,
fromServiceWorker,
status,
transferredSize,
isRacing,
} = this.props.item;
let text; let text;
if (fromCache || status === "304") { if (fromCache || status === "304") {
@ -42,6 +49,9 @@ class RequestListColumnTransferredSize extends Component {
text = SIZE_SERVICE_WORKER; text = SIZE_SERVICE_WORKER;
} else if (typeof transferredSize == "number") { } else if (typeof transferredSize == "number") {
text = getFormattedSize(transferredSize); text = getFormattedSize(transferredSize);
if (isRacing && typeof isRacing == "boolean") {
text = L10N.getFormatStr("networkMenu.raced", text);
}
} else if (transferredSize === null) { } else if (transferredSize === null) {
text = SIZE_UNAVAILABLE; text = SIZE_UNAVAILABLE;
} }

Просмотреть файл

@ -95,6 +95,7 @@ const UPDATED_REQ_ITEM_PROPS = [
"status", "status",
"statusText", "statusText",
"fromCache", "fromCache",
"isRacing",
"fromServiceWorker", "fromServiceWorker",
"method", "method",
"url", "url",

Просмотреть файл

@ -361,6 +361,7 @@ class FirefoxDataProvider {
case "securityInfo": case "securityInfo":
this.pushRequestToQueue(actor, { this.pushRequestToQueue(actor, {
securityState: networkInfo.securityState, securityState: networkInfo.securityState,
isRacing: packet.isRacing,
}); });
break; break;
case "responseStart": case "responseStart":

Просмотреть файл

@ -119,6 +119,7 @@ const UPDATE_PROPS = [
"status", "status",
"statusText", "statusText",
"httpVersion", "httpVersion",
"isRacing",
"securityState", "securityState",
"securityInfo", "securityInfo",
"securityInfoAvailable", "securityInfoAvailable",

Просмотреть файл

@ -400,16 +400,16 @@ const NetworkEventActor = protocol.ActorClassWithSpec(networkEventSpec, {
* @param object info * @param object info
* The object containing security information. * The object containing security information.
*/ */
addSecurityInfo(info) { addSecurityInfo(info, isRacing) {
// Ignore calls when this actor is already destroyed // Ignore calls when this actor is already destroyed
if (!this.actorID) { if (!this.actorID) {
return; return;
} }
this._securityInfo = info; this._securityInfo = info;
this.emit("network-event-update:security-info", "securityInfo", { this.emit("network-event-update:security-info", "securityInfo", {
state: info.state, state: info.state,
isRacing: isRacing,
}); });
}, },

Просмотреть файл

@ -295,7 +295,13 @@ NetworkResponseListener.prototype = {
const secinfo = this.httpActivity.channel.securityInfo; const secinfo = this.httpActivity.channel.securityInfo;
const info = NetworkHelper.parseSecurityInfo(secinfo, this.httpActivity); const info = NetworkHelper.parseSecurityInfo(secinfo, this.httpActivity);
this.httpActivity.owner.addSecurityInfo(info); let isRacing = false;
const channel = this.httpActivity.channel;
if (channel instanceof Ci.nsICacheInfoChannel) {
isRacing = channel.isRacing();
}
this.httpActivity.owner.addSecurityInfo(info, isRacing);
}), }),
/** /**

Просмотреть файл

@ -130,6 +130,7 @@ const networkEventSpec = generateActorSpec({
updateType: Arg(0, "string"), updateType: Arg(0, "string"),
state: Option(1, "string"), state: Option(1, "string"),
isRacing: Option(1, "boolean"),
}, },
"network-event-update:response-content": { "network-event-update:response-content": {