Bug 1358038 - Add "Race Cache With Network" status. r=Honza
authortanhengyeow <E0032242@u.nus.edu>
Mon, 15 Apr 2019 16:43:50 +0800
changeset 529096 17f5cadc3b29caeb321b4a14f49c8f06596dd64f
parent 528873 f7a15eb24f3de849d7b42dca8b827ade5354df0e
child 529097 f1455cdc78edbbc11dda951ef0944e3cd387fb12
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersHonza
bugs1358038
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
devtools/client/locales/en-US/netmonitor.properties
devtools/client/netmonitor/src/components/RequestListColumnTransferredSize.js
devtools/client/netmonitor/src/components/RequestListItem.js
devtools/client/netmonitor/src/connector/firefox-data-provider.js
devtools/client/netmonitor/src/constants.js
devtools/server/actors/network-event.js
devtools/server/actors/network-monitor/network-response-listener.js
devtools/shared/specs/network-event.js
--- a/devtools/client/locales/en-US/netmonitor.properties
+++ b/devtools/client/locales/en-US/netmonitor.properties
@@ -140,16 +140,21 @@ jsonpScopeName=JSONP → callback %S()
 # in the response tab of the network details pane when the response is over
 # the truncation limit and thus was truncated.
 responseTruncated=Response has been truncated
 
 # LOCALIZATION NOTE (responsePreview): This is the text displayed
 # 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
 
 # LOCALIZATION NOTE (networkMenu.sortedDesc): This is the tooltip displayed
 # in the network table toolbar, for any column that is sorted descending.
 networkMenu.sortedDesc=Sorted descending
 
@@ -216,17 +221,17 @@ networkMenu.sizeGB=%S GB
 networkMenu.sizeUnavailable=—
 
 # LOCALIZATION NOTE (networkMenu.sizeUnavailable.title): This is the tooltip
 # displayed in the network menu specifying that the transferred size of a
 # request is unavailable.
 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
 
 # LOCALIZATION NOTE (networkMenu.sizeServiceWorker): This is the label displayed
 # in the network menu specifying the transferred of a request computed
 # by a service worker.
 networkMenu.sizeServiceWorker=service worker
 
--- a/devtools/client/netmonitor/src/components/RequestListColumnTransferredSize.js
+++ b/devtools/client/netmonitor/src/components/RequestListColumnTransferredSize.js
@@ -13,40 +13,50 @@ const { propertiesEqual } = require("../
 
 const SIZE_CACHED = L10N.getStr("networkMenu.sizeCached");
 const SIZE_SERVICE_WORKER = L10N.getStr("networkMenu.sizeServiceWorker");
 const SIZE_UNAVAILABLE = L10N.getStr("networkMenu.sizeUnavailable");
 const SIZE_UNAVAILABLE_TITLE = L10N.getStr("networkMenu.sizeUnavailable.title");
 const UPDATED_TRANSFERRED_PROPS = [
   "transferredSize",
   "fromCache",
+  "isRacing",
   "fromServiceWorker",
 ];
 
 class RequestListColumnTransferredSize extends Component {
   static get propTypes() {
     return {
       item: PropTypes.object.isRequired,
     };
   }
 
   shouldComponentUpdate(nextProps) {
     return !propertiesEqual(UPDATED_TRANSFERRED_PROPS, this.props.item, nextProps.item);
   }
 
   render() {
-    const { fromCache, fromServiceWorker, status, transferredSize } = this.props.item;
+    const {
+      fromCache,
+      fromServiceWorker,
+      status,
+      transferredSize,
+      isRacing,
+    } = this.props.item;
     let text;
 
     if (fromCache || status === "304") {
       text = SIZE_CACHED;
     } else if (fromServiceWorker) {
       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;
     }
 
     const title = text == SIZE_UNAVAILABLE ? SIZE_UNAVAILABLE_TITLE : text;
 
     return (
       dom.td({
--- a/devtools/client/netmonitor/src/components/RequestListItem.js
+++ b/devtools/client/netmonitor/src/components/RequestListItem.js
@@ -90,16 +90,17 @@ loader.lazyGetter(this, "RequestListColu
  */
 const UPDATED_REQ_ITEM_PROPS = [
   "mimeType",
   "eventTimings",
   "securityState",
   "status",
   "statusText",
   "fromCache",
+  "isRacing",
   "fromServiceWorker",
   "method",
   "url",
   "remoteAddress",
   "cause",
   "contentSize",
   "transferredSize",
   "startedMillis",
--- a/devtools/client/netmonitor/src/connector/firefox-data-provider.js
+++ b/devtools/client/netmonitor/src/connector/firefox-data-provider.js
@@ -356,16 +356,17 @@ class FirefoxDataProvider {
     const { packet, networkInfo } = data;
     const { actor } = networkInfo;
     const { updateType } = packet;
 
     switch (updateType) {
       case "securityInfo":
         this.pushRequestToQueue(actor, {
           securityState: networkInfo.securityState,
+          isRacing: packet.isRacing,
         });
         break;
       case "responseStart":
         this.pushRequestToQueue(actor, {
           httpVersion: networkInfo.response.httpVersion,
           remoteAddress: networkInfo.response.remoteAddress,
           remotePort: networkInfo.response.remotePort,
           status: networkInfo.response.status,
--- a/devtools/client/netmonitor/src/constants.js
+++ b/devtools/client/netmonitor/src/constants.js
@@ -114,16 +114,17 @@ const EVENTS = {
 const UPDATE_PROPS = [
   "method",
   "url",
   "remotePort",
   "remoteAddress",
   "status",
   "statusText",
   "httpVersion",
+  "isRacing",
   "securityState",
   "securityInfo",
   "securityInfoAvailable",
   "mimeType",
   "contentSize",
   "transferredSize",
   "totalTime",
   "eventTimings",
--- a/devtools/server/actors/network-event.js
+++ b/devtools/server/actors/network-event.js
@@ -395,26 +395,26 @@ const NetworkEventActor = protocol.Actor
   },
 
   /**
    * Add connection security information.
    *
    * @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,
     });
   },
 
   /**
    * Add network response headers.
    *
    * @param array headers
    *        The response headers array.
--- a/devtools/server/actors/network-monitor/network-response-listener.js
+++ b/devtools/server/actors/network-monitor/network-response-listener.js
@@ -290,17 +290,23 @@ NetworkResponseListener.prototype = {
 
     // Take the security information from the original nsIHTTPChannel instead of
     // the nsIRequest received in onStartRequest. If response to this request
     // was a redirect from http to https, the request object seems to contain
     // security info for the https request after redirect.
     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);
   }),
 
   /**
    * Fetches cache information from CacheEntry
    * @private
    */
   _fetchCacheInformation: function() {
     const httpActivity = this.httpActivity;
--- a/devtools/shared/specs/network-event.js
+++ b/devtools/shared/specs/network-event.js
@@ -125,16 +125,17 @@ const networkEventSpec = generateActorSp
       response: Option(1, "json"),
     },
 
     "network-event-update:security-info": {
       type: "networkEventUpdate",
       updateType: Arg(0, "string"),
 
       state: Option(1, "string"),
+      isRacing: Option(1, "boolean"),
     },
 
     "network-event-update:response-content": {
       type: "networkEventUpdate",
       updateType: Arg(0, "string"),
 
       mimeType: Option(1, "string"),
       contentSize: Option(1, "number"),