Bug 1462882 - Avoid NPE when filtering using remote-ip. r=jryans, a=RyanVM
authorJan Odvarko <odvarko@gmail.com>
Tue, 22 May 2018 10:34:50 +0200
changeset 473495 d44d4c2a178ffb0af2860fa6a0b7c2640828260d
parent 473494 982e4bff688adbae25274a9f0aca6f288f3fa8e5
child 473496 36c03b72db500ae707a6876cc34c811a639d1ad7
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjryans, RyanVM
bugs1462882
milestone61.0
Bug 1462882 - Avoid NPE when filtering using remote-ip. r=jryans, a=RyanVM MozReview-Commit-ID: IJ2lNgMRCYz
devtools/client/netmonitor/src/utils/filter-text-utils.js
--- a/devtools/client/netmonitor/src/utils/filter-text-utils.js
+++ b/devtools/client/netmonitor/src/utils/filter-text-utils.js
@@ -123,18 +123,18 @@ function isFlagFilterMatch(item, { type,
       let protocol = item.httpVersion;
       match = typeof protocol === "string" ?
                 protocol.toLowerCase().includes(value) : false;
       break;
     case "domain":
       match = item.urlDetails.host.toLowerCase().includes(value);
       break;
     case "remote-ip":
-      match = getFormattedIPAndPort(item.remoteAddress, item.remotePort)
-        .toLowerCase().includes(value);
+      let data = getFormattedIPAndPort(item.remoteAddress, item.remotePort);
+      match = data ? data.toLowerCase().includes(value) : false;
       break;
     case "has-response-header":
       if (typeof item.responseHeaders === "object") {
         let { headers } = item.responseHeaders;
         match = headers.findIndex(h => h.name.toLowerCase() === value) > -1;
       } else {
         match = false;
       }