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.
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
# in the network table toolbar, for any column that is sorted ascending.
networkMenu.sortedAsc=Sorted ascending
@ -221,7 +226,7 @@ networkMenu.sizeUnavailable=—
networkMenu.sizeUnavailable.title=Transferred size is not available
# 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.
networkMenu.sizeCached=cached

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

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

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

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

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

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

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

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

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

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

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

@ -295,7 +295,13 @@ NetworkResponseListener.prototype = {
const secinfo = this.httpActivity.channel.securityInfo;
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"),
state: Option(1, "string"),
isRacing: Option(1, "boolean"),
},
"network-event-update:response-content": {