Backed out 3 changesets (bug 1134073) because maybe it broke the clipboard tests
authorWes Kocher <wkocher@mozilla.com>
Fri, 03 Jun 2016 14:01:27 -0700
changeset 339376 ab5e81678aaae8da42e11e8daf118e2a9c90baac
parent 339375 b5b132baef727992998454cfa8bb2c2aefe3f4ad
child 339377 219c434c410e9778ede7ea4310fc718826fd6fdc
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1134073
milestone49.0a1
backs outa43d99734390d98a6430d2e0900222651546456e
572ebec612e811adc0333a3b486bc25b680957bb
f12a69ba912259a1e1aaf26cf5f116a8c5948a7e
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
Backed out 3 changesets (bug 1134073) because maybe it broke the clipboard tests Backed out changeset a43d99734390 (bug 1134073) Backed out changeset 572ebec612e8 (bug 1134073) Backed out changeset f12a69ba9122 (bug 1134073)
devtools/client/locales/en-US/netmonitor.dtd
devtools/client/netmonitor/netmonitor-controller.js
devtools/client/netmonitor/netmonitor-view.js
devtools/client/netmonitor/netmonitor.xul
devtools/client/netmonitor/panel.js
devtools/client/netmonitor/test/browser.ini
devtools/client/netmonitor/test/browser_net_cause.js
devtools/client/netmonitor/test/browser_net_cause_redirect.js
devtools/client/netmonitor/test/browser_net_image-tooltip.js
devtools/client/netmonitor/test/browser_net_service-worker-status.js
devtools/client/netmonitor/test/head.js
devtools/client/netmonitor/test/html_cause-test-page.html
devtools/client/netmonitor/test/service-workers/status-codes-service-worker.js
devtools/client/netmonitor/test/service-workers/status-codes.html
devtools/client/netmonitor/test/sjs_hsts-test-server.sjs
devtools/client/themes/netmonitor.css
devtools/server/actors/webconsole.js
devtools/shared/webconsole/client.js
devtools/shared/webconsole/network-monitor.js
--- a/devtools/client/locales/en-US/netmonitor.dtd
+++ b/devtools/client/locales/en-US/netmonitor.dtd
@@ -34,20 +34,16 @@
 <!-- LOCALIZATION NOTE (netmonitorUI.toolbar.file): This is the label displayed
   -  in the network table toolbar, above the "file" column. -->
 <!ENTITY netmonitorUI.toolbar.file        "File">
 
 <!-- LOCALIZATION NOTE (netmonitorUI.toolbar.domain): This is the label displayed
   -  in the network table toolbar, above the "domain" column. -->
 <!ENTITY netmonitorUI.toolbar.domain      "Domain">
 
-<!-- LOCALIZATION NOTE (netmonitorUI.toolbar.cause): This is the label displayed
-  -  in the network table toolbar, above the "cause" column. -->
-<!ENTITY netmonitorUI.toolbar.cause        "Cause">
-
 <!-- LOCALIZATION NOTE (netmonitorUI.toolbar.type): This is the label displayed
   -  in the network table toolbar, above the "type" column. -->
 <!ENTITY netmonitorUI.toolbar.type        "Type">
 
 <!-- LOCALIZATION NOTE (netmonitorUI.toolbar.transferred): This is the label displayed
   -  in the network table toolbar, above the "transferred" column, which is the
   -  compressed / encoded size. -->
 <!ENTITY netmonitorUI.toolbar.transferred "Transferred">
--- a/devtools/client/netmonitor/netmonitor-controller.js
+++ b/devtools/client/netmonitor/netmonitor-controller.js
@@ -428,23 +428,16 @@ var NetMonitorController = {
 
   /**
    * Getter that tells if the server can do network performance statistics.
    * @type boolean
    */
   get supportsPerfStats() {
     return this.tabClient &&
            (this.tabClient.traits.reconfigure || !this._target.isApp);
-  },
-
-  /**
-   * Open a given source in Debugger
-   */
-  viewSourceInDebugger(sourceURL, sourceLine) {
-    return this._toolbox.viewSourceInDebugger(sourceURL, sourceLine);
   }
 };
 
 /**
  * Functions handling target-related lifetime events.
  */
 function TargetEventsHandler() {
   this._onTabNavigated = this._onTabNavigated.bind(this);
@@ -631,24 +624,22 @@ NetworkEventsHandler.prototype = {
    * @param object networkInfo
    *        The network request information.
    */
   _onNetworkEvent: function (type, networkInfo) {
     let { actor,
       startedDateTime,
       request: { method, url },
       isXHR,
-      cause,
       fromCache,
       fromServiceWorker
     } = networkInfo;
 
     NetMonitorView.RequestsMenu.addRequest(
-      actor, startedDateTime, method, url, isXHR, cause, fromCache,
-        fromServiceWorker
+      actor, startedDateTime, method, url, isXHR, fromCache, fromServiceWorker
     );
     window.emit(EVENTS.NETWORK_EVENT, actor);
   },
 
   /**
    * The "networkEventUpdate" message type handler.
    *
    * @param string type
--- a/devtools/client/netmonitor/netmonitor-view.js
+++ b/devtools/client/netmonitor/netmonitor-view.js
@@ -25,19 +25,17 @@ const {LocalizationHelper} = require("de
 const {PrefsHelper} = require("devtools/client/shared/prefs");
 const {ViewHelpers, Heritage, WidgetMethods, setNamedTimeout} =
   require("devtools/client/shared/widgets/view-helpers");
 
 /**
  * Localization convenience methods.
  */
 const NET_STRINGS_URI = "chrome://devtools/locale/netmonitor.properties";
-const WEBCONSOLE_STRINGS_URI = "chrome://devtools/locale/webconsole.properties";
 var L10N = new LocalizationHelper(NET_STRINGS_URI);
-const WEBCONSOLE_L10N = new LocalizationHelper(WEBCONSOLE_STRINGS_URI);
 
 // ms
 const WDA_DEFAULT_VERIFY_INTERVAL = 50;
 
 // Use longer timeout during testing as the tests need this process to succeed
 // and two seconds is quite short on slow debug builds. The timeout here should
 // be at least equal to the general mochitest timeout of 45 seconds so that this
 // never gets hit during testing.
@@ -58,18 +56,16 @@ const HTML_NS = "http://www.w3.org/1999/
 const EPSILON = 0.001;
 // 100 KB in bytes
 const SOURCE_SYNTAX_HIGHLIGHT_MAX_FILE_SIZE = 102400;
 // ms
 const RESIZE_REFRESH_RATE = 50;
 // ms
 const REQUESTS_REFRESH_RATE = 50;
 const REQUESTS_TOOLTIP_POSITION = "topcenter bottomleft";
-// tooltip show/hide delay in ms
-const REQUESTS_TOOLTIP_TOGGLE_DELAY = 500;
 // px
 const REQUESTS_TOOLTIP_IMAGE_MAX_DIM = 400;
 // px
 const REQUESTS_WATERFALL_SAFE_BOUNDS = 90;
 // ms
 const REQUESTS_WATERFALL_HEADER_TICKS_MULTIPLE = 5;
 // px
 const REQUESTS_WATERFALL_HEADER_TICKS_SPACING_MIN = 60;
@@ -101,41 +97,16 @@ const CONTENT_MIME_TYPE_MAPPINGS = {
   "/xml": Editor.modes.html,
   "/atom": Editor.modes.html,
   "/soap": Editor.modes.html,
   "/vnd.mpeg.dash.mpd": Editor.modes.html,
   "/rdf": Editor.modes.css,
   "/rss": Editor.modes.css,
   "/css": Editor.modes.css
 };
-const LOAD_CAUSE_STRINGS = {
-  [Ci.nsIContentPolicy.TYPE_INVALID]: "invalid",
-  [Ci.nsIContentPolicy.TYPE_OTHER]: "other",
-  [Ci.nsIContentPolicy.TYPE_SCRIPT]: "script",
-  [Ci.nsIContentPolicy.TYPE_IMAGE]: "img",
-  [Ci.nsIContentPolicy.TYPE_STYLESHEET]: "stylesheet",
-  [Ci.nsIContentPolicy.TYPE_OBJECT]: "object",
-  [Ci.nsIContentPolicy.TYPE_DOCUMENT]: "document",
-  [Ci.nsIContentPolicy.TYPE_SUBDOCUMENT]: "subdocument",
-  [Ci.nsIContentPolicy.TYPE_REFRESH]: "refresh",
-  [Ci.nsIContentPolicy.TYPE_XBL]: "xbl",
-  [Ci.nsIContentPolicy.TYPE_PING]: "ping",
-  [Ci.nsIContentPolicy.TYPE_XMLHTTPREQUEST]: "xhr",
-  [Ci.nsIContentPolicy.TYPE_OBJECT_SUBREQUEST]: "objectSubdoc",
-  [Ci.nsIContentPolicy.TYPE_DTD]: "dtd",
-  [Ci.nsIContentPolicy.TYPE_FONT]: "font",
-  [Ci.nsIContentPolicy.TYPE_MEDIA]: "media",
-  [Ci.nsIContentPolicy.TYPE_WEBSOCKET]: "websocket",
-  [Ci.nsIContentPolicy.TYPE_CSP_REPORT]: "csp",
-  [Ci.nsIContentPolicy.TYPE_XSLT]: "xslt",
-  [Ci.nsIContentPolicy.TYPE_BEACON]: "beacon",
-  [Ci.nsIContentPolicy.TYPE_FETCH]: "fetch",
-  [Ci.nsIContentPolicy.TYPE_IMAGESET]: "imageset",
-  [Ci.nsIContentPolicy.TYPE_WEB_MANIFEST]: "webManifest"
-};
 const DEFAULT_EDITOR_CONFIG = {
   mode: Editor.modes.text,
   readOnly: true,
   lineNumbers: true
 };
 const GENERIC_VARIABLES_VIEW_SETTINGS = {
   lazyEmpty: true,
   // ms
@@ -455,30 +426,16 @@ RequestsMenuView.prototype = Heritage.ex
 
     this.widget = new SideMenuWidget($("#requests-menu-contents"));
     this._splitter = $("#network-inspector-view-splitter");
     this._summary = $("#requests-menu-network-summary-button");
     this._summary.setAttribute("label", L10N.getStr("networkMenu.empty"));
     this.userInputTimer = Cc["@mozilla.org/timer;1"]
       .createInstance(Ci.nsITimer);
 
-    // Create a tooltip for the newly appended network request item.
-    this.tooltip = new Tooltip(document, {
-      closeOnEvents: [{
-        emitter: $("#requests-menu-contents"),
-        event: "scroll",
-        useCapture: true
-      }]
-    });
-    this.tooltip.startTogglingOnHover(this.widget, this._onHover, {
-      toggleDelay: REQUESTS_TOOLTIP_TOGGLE_DELAY,
-      interactive: true
-    });
-    this.tooltip.defaultPosition = REQUESTS_TOOLTIP_POSITION;
-
     Prefs.filters.forEach(type => this.filterOn(type));
     this.sortContents(this._byTiming);
 
     this.allowFocusOnRightClick = true;
     this.maintainSelectionVisible = true;
 
     this.widget.addEventListener("select", this._onSelect, false);
     this.widget.addEventListener("swap", this._onSwap, false);
@@ -675,30 +632,25 @@ RequestsMenuView.prototype = Heritage.ex
    *        A string representation of when the request was started, which
    *        can be parsed by Date (for example "2012-09-17T19:50:03.699Z").
    * @param string method
    *        Specifies the request method (e.g. "GET", "POST", etc.)
    * @param string url
    *        Specifies the request's url.
    * @param boolean isXHR
    *        True if this request was initiated via XHR.
-   * @param object cause
-   *        Specifies the request's cause. Has the following properties:
-   *        - type: nsContentPolicyType constant
-   *        - loadingDocumentUri: URI of the request origin
-   *        - stacktrace: JS stacktrace of the request
    * @param boolean fromCache
    *        Indicates if the result came from the browser cache
    * @param boolean fromServiceWorker
    *        Indicates if the request has been intercepted by a Service Worker
    */
-  addRequest: function (id, startedDateTime, method, url, isXHR, cause,
-    fromCache, fromServiceWorker) {
-    this._addQueue.push([id, startedDateTime, method, url, isXHR, cause,
-      fromCache, fromServiceWorker]);
+  addRequest: function (id, startedDateTime, method, url, isXHR, fromCache,
+    fromServiceWorker) {
+    this._addQueue.push([id, startedDateTime, method, url, isXHR, fromCache,
+      fromServiceWorker]);
 
     // Lazy updating is disabled in some tests.
     if (!this.lazyUpdate) {
       return void this._flushRequests();
     }
 
     this._flushRequestsTask.arm();
     return undefined;
@@ -928,18 +880,17 @@ RequestsMenuView.prototype = Heritage.ex
   /**
    * Create a new custom request form populated with the data from
    * the currently selected request.
    */
   cloneSelectedRequest: function () {
     let selected = this.selectedItem.attachment;
 
     // Create the element node for the network request item.
-    let menuView = this._createMenuView(selected.method, selected.url,
-      selected.cause);
+    let menuView = this._createMenuView(selected.method, selected.url);
 
     // Append a network request item to this container.
     let newItem = this.push([menuView], {
       attachment: Object.create(selected, {
         isCustom: { value: true }
       })
     });
 
@@ -1496,16 +1447,29 @@ RequestsMenuView.prototype = Heritage.ex
       } else {
         requestTarget.setAttribute("odd", "");
         requestTarget.removeAttribute("even");
       }
     }
   },
 
   /**
+   * Refreshes the toggling anchor for the specified item's tooltip.
+   *
+   * @param object item
+   *        The network request item in this container.
+   */
+  refreshTooltip: function (item) {
+    let tooltip = item.attachment.tooltip;
+    tooltip.hide();
+    tooltip.startTogglingOnHover(item.target, this._onHover);
+    tooltip.defaultPosition = REQUESTS_TOOLTIP_POSITION;
+  },
+
+  /**
    * Attaches security icon click listener for the given request menu item.
    *
    * @param object item
    *        The network request item to attach the listener to.
    */
   attachSecurityIconClickListener: function ({ target }) {
     let icon = $(".requests-security-state-icon", target);
     icon.addEventListener("click", this._onSecurityIconClick);
@@ -1541,42 +1505,52 @@ RequestsMenuView.prototype = Heritage.ex
     // Prevent displaying any updates received after the target closed.
     if (NetMonitorView._isDestroyed) {
       return;
     }
 
     let widget = NetMonitorView.RequestsMenu.widget;
     let isScrolledToBottom = widget.isScrolledToBottom();
 
-    for (let [id, startedDateTime, method, url, isXHR, cause, fromCache,
+    for (let [id, startedDateTime, method, url, isXHR, fromCache,
       fromServiceWorker] of this._addQueue) {
       // Convert the received date/time string to a unix timestamp.
       let unixTime = Date.parse(startedDateTime);
 
       // Create the element node for the network request item.
-      let menuView = this._createMenuView(method, url, cause);
+      let menuView = this._createMenuView(method, url);
 
       // Remember the first and last event boundaries.
       this._registerFirstRequestStart(unixTime);
       this._registerLastRequestEnd(unixTime);
 
       // Append a network request item to this container.
       let requestItem = this.push([menuView, id], {
         attachment: {
           startedDeltaMillis: unixTime - this._firstRequestStartedMillis,
           startedMillis: unixTime,
           method: method,
           url: url,
           isXHR: isXHR,
-          cause: cause,
           fromCache: fromCache,
           fromServiceWorker: fromServiceWorker
         }
       });
 
+      // Create a tooltip for the newly appended network request item.
+      requestItem.attachment.tooltip = new Tooltip(document, {
+        closeOnEvents: [{
+          emitter: $("#requests-menu-contents"),
+          event: "scroll",
+          useCapture: true
+        }]
+      });
+
+      this.refreshTooltip(requestItem);
+
       if (id == this._preferredItemId) {
         this.selectedItem = requestItem;
       }
 
       window.emit(EVENTS.REQUEST_ADDED, id);
     }
 
     if (isScrolledToBottom && this._addQueue.length) {
@@ -1775,36 +1749,31 @@ RequestsMenuView.prototype = Heritage.ex
 
   /**
    * Customization function for creating an item's UI.
    *
    * @param string method
    *        Specifies the request method (e.g. "GET", "POST", etc.)
    * @param string url
    *        Specifies the request's url.
-   * @param object cause
-   *        Specifies the request's cause. Has two properties:
-   *        - type: nsContentPolicyType constant
-   *        - uri: URI of the request origin
    * @return nsIDOMNode
    *         The network request view.
    */
-  _createMenuView: function (method, url, cause) {
+  _createMenuView: function (method, url) {
     let template = $("#requests-menu-item-template");
     let fragment = document.createDocumentFragment();
 
+    this.updateMenuView(template, "method", method);
+    this.updateMenuView(template, "url", url);
+
     // Flatten the DOM by removing one redundant box (the template container).
     for (let node of template.childNodes) {
       fragment.appendChild(node.cloneNode(true));
     }
 
-    this.updateMenuView(fragment, "method", method);
-    this.updateMenuView(fragment, "url", url);
-    this.updateMenuView(fragment, "cause", cause);
-
     return fragment;
   },
 
   /**
    * Get a human-readable string from a number of bytes, with the B, KB, MB, or
    * GB value. Note that the transition between abbreviations is by 1000 rather
    * than 1024 in order to keep the displayed digits smaller as "1016 KB" is
    * more awkward than 0.99 MB"
@@ -1926,30 +1895,16 @@ RequestsMenuView.prototype = Heritage.ex
         codeNode.setAttribute("value", value.status);
         break;
       }
       case "statusText": {
         let node = $(".requests-menu-status", target);
         node.setAttribute("tooltiptext", value);
         break;
       }
-      case "cause": {
-        let labelNode = $(".requests-menu-cause-label", target);
-        let text = LOAD_CAUSE_STRINGS[value.type] || "unknown";
-        labelNode.setAttribute("value", text);
-        if (value.loadingDocumentUri) {
-          labelNode.setAttribute("tooltiptext", value.loadingDocumentUri);
-        }
-
-        let stackNode = $(".requests-menu-cause-stack", target);
-        if (value.stacktrace && value.stacktrace.length > 0) {
-          stackNode.removeAttribute("hidden");
-        }
-        break;
-      }
       case "contentSize": {
         let node = $(".requests-menu-size", target);
 
         let text = this.getFormattedSize(value);
 
         node.setAttribute("value", text);
         node.setAttribute("tooltiptext", text);
         break;
@@ -2270,16 +2225,21 @@ RequestsMenuView.prototype = Heritage.ex
     }
   },
 
   /**
    * The swap listener for this container.
    * Called when two items switch places, when the contents are sorted.
    */
   _onSwap: function ({ detail: [firstItem, secondItem] }) {
+    // Sorting will create new anchor nodes for all the swapped request items
+    // in this container, so it's necessary to refresh the Tooltip instances.
+    this.refreshTooltip(firstItem);
+    this.refreshTooltip(secondItem);
+
     // Reattach click listener to the security icons
     this.attachSecurityIconClickListener(firstItem);
     this.attachSecurityIconClickListener(secondItem);
   },
 
   /**
    * The predicate used when deciding whether a popup should be shown
    * over a request item or not.
@@ -2287,100 +2247,36 @@ RequestsMenuView.prototype = Heritage.ex
    * @param nsIDOMNode target
    *        The element node currently being hovered.
    * @param object tooltip
    *        The current tooltip instance.
    * @return {Promise}
    */
   _onHover: Task.async(function* (target, tooltip) {
     let requestItem = this.getItemForElement(target);
-    if (!requestItem) {
+    if (!requestItem || !requestItem.attachment.responseContent) {
       return false;
     }
 
     let hovered = requestItem.attachment;
-    if (hovered.responseContent && target.closest(".requests-menu-icon-and-file")) {
-      return this._setTooltipImageContent(tooltip, requestItem);
-    } else if (hovered.cause && target.closest(".requests-menu-cause-stack")) {
-      return this._setTooltipStackTraceContent(tooltip, requestItem);
-    }
-
-    return false;
-  }),
-
-  _setTooltipImageContent: Task.async(function* (tooltip, requestItem) {
-    let { mimeType, text, encoding } = requestItem.attachment.responseContent.content;
-
-    if (!mimeType || !mimeType.includes("image/")) {
-      return false;
-    }
-
-    let string = yield gNetwork.getString(text);
-    let anchor = $(".requests-menu-icon", requestItem.target);
-    let src = formDataURI(mimeType, encoding, string);
-
-    tooltip.setImageContent(src, {
-      maxDim: REQUESTS_TOOLTIP_IMAGE_MAX_DIM
-    });
-
-    return anchor;
-  }),
-
-  _setTooltipStackTraceContent: Task.async(function* (tooltip, requestItem) {
-    let {stacktrace} = requestItem.attachment.cause;
-
-    if (!stacktrace || stacktrace.length == 0) {
-      return false;
+    let { mimeType, text, encoding } = hovered.responseContent.content;
+
+    if (mimeType && mimeType.includes("image/") && (
+      target.classList.contains("requests-menu-icon") ||
+      target.classList.contains("requests-menu-file"))) {
+      let string = yield gNetwork.getString(text);
+      let anchor = $(".requests-menu-icon", requestItem.target);
+      let src = formDataURI(mimeType, encoding, string);
+
+      tooltip.setImageContent(src, {
+        maxDim: REQUESTS_TOOLTIP_IMAGE_MAX_DIM
+      });
+      return anchor;
     }
-
-    let doc = tooltip.doc;
-    let el = doc.createElement("vbox");
-    el.className = "requests-menu-stack-trace";
-
-    for (let f of stacktrace) {
-      let { functionName, filename, lineNumber, columnNumber } = f;
-
-      let frameEl = doc.createElement("hbox");
-      frameEl.className = "requests-menu-stack-frame devtools-monospace";
-
-      let funcEl = doc.createElement("label");
-      funcEl.className = "requests-menu-stack-frame-function-name";
-      funcEl.setAttribute("value",
-        functionName || WEBCONSOLE_L10N.getStr("stacktrace.anonymousFunction"));
-      frameEl.appendChild(funcEl);
-
-      let fileEl = doc.createElement("label");
-      fileEl.className = "requests-menu-stack-frame-file-name";
-      // Parse a stack frame in format "url -> url"
-      let sourceUrl = filename.split(" -> ").pop();
-      fileEl.setAttribute("value", sourceUrl);
-      fileEl.setAttribute("tooltiptext", sourceUrl);
-      fileEl.setAttribute("crop", "start");
-      frameEl.appendChild(fileEl);
-
-      let lineEl = doc.createElement("label");
-      lineEl.className = "requests-menu-stack-frame-line";
-      lineEl.setAttribute("value", `:${lineNumber}:${columnNumber}`);
-      frameEl.appendChild(lineEl);
-
-      frameEl.addEventListener("click", () => {
-        // avoid an ugly visual artefact when the view is switched to debugger and the
-        // tooltip is hidden only after a delay - the tooltip is moved outside the browser
-        // window.
-        tooltip.hide();
-        NetMonitorController.viewSourceInDebugger(filename, lineNumber);
-      }, false);
-
-      el.appendChild(frameEl);
-    }
-
-    tooltip.content = el;
-    tooltip.panel.setAttribute("wide", "");
-
-    return true;
+    return false;
   }),
 
   /**
    * A handler that opens the security tab in the details view if secure or
    * broken security indicator is clicked.
    */
   _onSecurityIconClick: function (e) {
     let state = this.selectedItem.attachment.securityState;
--- a/devtools/client/netmonitor/netmonitor.xul
+++ b/devtools/client/netmonitor/netmonitor.xul
@@ -216,27 +216,16 @@
                 <button id="requests-menu-domain-button"
                         class="requests-menu-header-button requests-menu-security-and-domain"
                         data-key="domain"
                         label="&netmonitorUI.toolbar.domain;"
                         crop="end"
                         flex="1">
                 </button>
               </hbox>
-              <hbox id="requests-menu-cause-header-box"
-                    class="requests-menu-header requests-menu-cause"
-                    align="center">
-                <button id="requests-menu-cause-button"
-                        class="requests-menu-header-button requests-menu-cause"
-                        data-key="cause"
-                        label="&netmonitorUI.toolbar.cause;"
-                        crop="end"
-                        flex="1">
-                </button>
-              </hbox>
               <hbox id="requests-menu-type-header-box"
                     class="requests-menu-header requests-menu-type"
                     align="center">
                 <button id="requests-menu-type-button"
                         class="requests-menu-header-button requests-menu-type"
                         data-key="type"
                         label="&netmonitorUI.toolbar.type;"
                         crop="end"
@@ -329,20 +318,16 @@
               </hbox>
               <hbox class="requests-menu-subitem requests-menu-security-and-domain"
                     align="center">
                 <image class="requests-security-state-icon" />
                 <label class="plain requests-menu-domain"
                        crop="end"
                        flex="1"/>
               </hbox>
-              <hbox class="requests-menu-subitem requests-menu-cause" align="center">
-                <label class="requests-menu-cause-stack" value="JS" hidden="true"/>
-                <label class="plain requests-menu-cause-label" flex="1" crop="end"/>
-              </hbox>
               <label class="plain requests-menu-subitem requests-menu-type"
                      crop="end"/>
               <label class="plain requests-menu-subitem requests-menu-transferred"
                      crop="end"/>
               <label class="plain requests-menu-subitem requests-menu-size"
                      crop="end"/>
               <hbox class="requests-menu-subitem requests-menu-waterfall"
                     align="center"
--- a/devtools/client/netmonitor/panel.js
+++ b/devtools/client/netmonitor/panel.js
@@ -11,17 +11,16 @@ const { Task } = require("devtools/share
 
 function NetMonitorPanel(iframeWindow, toolbox) {
   this.panelWin = iframeWindow;
   this._toolbox = toolbox;
 
   this._view = this.panelWin.NetMonitorView;
   this._controller = this.panelWin.NetMonitorController;
   this._controller._target = this.target;
-  this._controller._toolbox = this._toolbox;
 
   EventEmitter.decorate(this);
 }
 
 exports.NetMonitorPanel = NetMonitorPanel;
 
 NetMonitorPanel.prototype = {
   /**
--- a/devtools/client/netmonitor/test/browser.ini
+++ b/devtools/client/netmonitor/test/browser.ini
@@ -1,15 +1,14 @@
 [DEFAULT]
 tags = devtools
 subsuite = devtools
 support-files =
   dropmarker.svg
   head.js
-  html_cause-test-page.html
   html_content-type-test-page.html
   html_content-type-without-cache-test-page.html
   html_cors-test-page.html
   html_custom-get-page.html
   html_single-get-page.html
   html_cyrillic-test-page.html
   html_filter-test-page.html
   html_infinite-get-page.html
@@ -29,33 +28,30 @@ support-files =
   html_statistics-test-page.html
   html_status-codes-test-page.html
   html_api-calls-test-page.html
   html_copy-as-curl.html
   html_curl-utils.html
   sjs_content-type-test-server.sjs
   sjs_cors-test-server.sjs
   sjs_https-redirect-test-server.sjs
-  sjs_hsts-test-server.sjs
   sjs_simple-test-server.sjs
   sjs_sorting-test-server.sjs
   sjs_status-codes-test-server.sjs
   test-image.png
   service-workers/status-codes.html
   service-workers/status-codes-service-worker.js
 
 [browser_net_aaa_leaktest.js]
 [browser_net_accessibility-01.js]
 [browser_net_accessibility-02.js]
 skip-if = (toolkit == "cocoa" && e10s) # bug 1252254
 [browser_net_api-calls.js]
 [browser_net_autoscroll.js]
 [browser_net_cached-status.js]
-[browser_net_cause.js]
-[browser_net_cause_redirect.js]
 [browser_net_service-worker-status.js]
 [browser_net_charts-01.js]
 [browser_net_charts-02.js]
 [browser_net_charts-03.js]
 [browser_net_charts-04.js]
 [browser_net_charts-05.js]
 [browser_net_charts-06.js]
 [browser_net_charts-07.js]
deleted file mode 100644
--- a/devtools/client/netmonitor/test/browser_net_cause.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-/**
- * Tests if request cause is reported correctly.
- */
-
-const CAUSE_FILE_NAME = "html_cause-test-page.html";
-const CAUSE_URL = EXAMPLE_URL + CAUSE_FILE_NAME;
-
-const EXPECTED_REQUESTS = [
-  {
-    method: "GET",
-    url: CAUSE_URL,
-    causeType: "document",
-    causeUri: "",
-    // The document load is from JS function in e10s, native in non-e10s
-    hasStack: !gMultiProcessBrowser
-  },
-  {
-    method: "GET",
-    url: EXAMPLE_URL + "stylesheet_request",
-    causeType: "stylesheet",
-    causeUri: CAUSE_URL,
-    hasStack: false
-  },
-  {
-    method: "GET",
-    url: EXAMPLE_URL + "img_request",
-    causeType: "img",
-    causeUri: CAUSE_URL,
-    hasStack: false
-  },
-  {
-    method: "GET",
-    url: EXAMPLE_URL + "xhr_request",
-    causeType: "xhr",
-    causeUri: CAUSE_URL,
-    hasStack: { fn: "performXhrRequest", file: CAUSE_FILE_NAME, line: 22 }
-  },
-  {
-    method: "POST",
-    url: EXAMPLE_URL + "beacon_request",
-    causeType: "beacon",
-    causeUri: CAUSE_URL,
-    hasStack: { fn: "performBeaconRequest", file: CAUSE_FILE_NAME, line: 26 }
-  },
-];
-
-var test = Task.async(function* () {
-  // the initNetMonitor function clears the network request list after the
-  // page is loaded. That's why we first load a bogus page from SIMPLE_URL,
-  // and only then load the real thing from CAUSE_URL - we want to catch
-  // all the requests the page is making, not only the XHRs.
-  // We can't use about:blank here, because initNetMonitor checks that the
-  // page has actually made at least one request.
-  let [, debuggee, monitor] = yield initNetMonitor(SIMPLE_URL);
-  let { RequestsMenu } = monitor.panelWin.NetMonitorView;
-  RequestsMenu.lazyUpdate = false;
-
-  debuggee.location = CAUSE_URL;
-
-  yield waitForNetworkEvents(monitor, EXPECTED_REQUESTS.length);
-
-  is(RequestsMenu.itemCount, EXPECTED_REQUESTS.length,
-    "All the page events should be recorded.");
-
-  EXPECTED_REQUESTS.forEach((spec, i) => {
-    let { method, url, causeType, causeUri, hasStack } = spec;
-
-    let requestItem = RequestsMenu.getItemAtIndex(i);
-    verifyRequestItemTarget(requestItem,
-      method, url, { cause: { type: causeType, loadingDocumentUri: causeUri } }
-    );
-
-    let { stacktrace } = requestItem.attachment.cause;
-    let stackLen = stacktrace ? stacktrace.length : 0;
-
-    if (hasStack) {
-      ok(stacktrace, `Request #${i} has a stacktrace`);
-      ok(stackLen > 0,
-        `Request #${i} (${causeType}) has a stacktrace with ${stackLen} items`);
-
-      // if "hasStack" is object, check the details about the top stack frame
-      if (typeof hasStack === "object") {
-        is(stacktrace[0].functionName, hasStack.fn,
-          `Request #${i} has the correct function on top of the JS stack`);
-        is(stacktrace[0].filename.split("/").pop(), hasStack.file,
-          `Request #${i} has the correct file on top of the JS stack`);
-        is(stacktrace[0].lineNumber, hasStack.line,
-          `Request #${i} has the correct line number on top of the JS stack`);
-      }
-    } else {
-      is(stackLen, 0, `Request #${i} (${causeType}) has an empty stacktrace`);
-    }
-  });
-
-  yield teardown(monitor);
-  finish();
-});
deleted file mode 100644
--- a/devtools/client/netmonitor/test/browser_net_cause_redirect.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-/**
- * Tests if request JS stack is property reported if the request is internally
- * redirected without hitting the network (HSTS is one of such cases)
- */
-
-var test = Task.async(function* () {
-  const EXPECTED_REQUESTS = [
-    // Request to HTTP URL, redirects to HTTPS, has callstack
-    { status: 302, hasStack: true },
-    // Serves HTTPS, sets the Strict-Transport-Security header, no stack
-    { status: 200, hasStack: false },
-    // Second request to HTTP redirects to HTTPS internally
-    { status: 200, hasStack: true },
-  ];
-
-  let [, debuggee, monitor] = yield initNetMonitor(CUSTOM_GET_URL);
-  let { RequestsMenu } = monitor.panelWin.NetMonitorView;
-  RequestsMenu.lazyUpdate = false;
-
-  debuggee.performRequests(2, HSTS_SJS);
-  yield waitForNetworkEvents(monitor, EXPECTED_REQUESTS.length);
-
-  EXPECTED_REQUESTS.forEach(({status, hasStack}, i) => {
-    let { attachment } = RequestsMenu.getItemAtIndex(i);
-
-    is(attachment.status, status, `Request #${i} has the expected status`);
-
-    let { stacktrace } = attachment.cause;
-    let stackLen = stacktrace ? stacktrace.length : 0;
-
-    if (hasStack) {
-      ok(stacktrace, `Request #${i} has a stacktrace`);
-      ok(stackLen > 0, `Request #${i} has a stacktrace with ${stackLen} items`);
-    } else {
-      is(stackLen, 0, `Request #${i} has an empty stacktrace`);
-    }
-  });
-
-  // Send a request to reset the HSTS policy to state before the test
-  debuggee.performRequests(1, HSTS_SJS + "?reset");
-  yield waitForNetworkEvents(monitor, 1);
-
-  yield teardown(monitor);
-  finish();
-});
--- a/devtools/client/netmonitor/test/browser_net_image-tooltip.js
+++ b/devtools/client/netmonitor/test/browser_net_image-tooltip.js
@@ -18,39 +18,42 @@ add_task(function* test() {
   let onEvents = waitForNetworkEvents(monitor, 7);
   let onThumbnail = waitFor(monitor.panelWin, EVENTS.RESPONSE_IMAGE_THUMBNAIL_DISPLAYED);
 
   debuggee.performRequests();
   yield onEvents;
   yield onThumbnail;
 
   info("Checking the image thumbnail after a few requests were made...");
-  yield showTooltipAndVerify(RequestsMenu.tooltip, RequestsMenu.items[5]);
+  yield showTooltipAndVerify(RequestsMenu.items[5]);
 
   // 7 XHRs as before + 1 extra document reload
   onEvents = waitForNetworkEvents(monitor, 8);
   onThumbnail = waitFor(monitor.panelWin, EVENTS.RESPONSE_IMAGE_THUMBNAIL_DISPLAYED);
 
   info("Reloading the debuggee and performing all requests again...");
   yield NetMonitorController.triggerActivity(ACTIVITY_TYPE.RELOAD.WITH_CACHE_ENABLED);
   debuggee.performRequests();
   yield onEvents;
   yield onThumbnail;
 
   info("Checking the image thumbnail after a reload.");
-  yield showTooltipAndVerify(RequestsMenu.tooltip, RequestsMenu.items[6]);
+  yield showTooltipAndVerify(RequestsMenu.items[6]);
 
   yield teardown(monitor);
   finish();
 
   /**
    * Show a tooltip on the {requestItem} and verify that it was displayed
    * with the expected content.
    */
-  function* showTooltipAndVerify(tooltip, requestItem) {
+  function* showTooltipAndVerify(requestItem) {
+    let { tooltip } = requestItem.attachment;
+    ok(tooltip, "There should be a tooltip instance for the image request.");
+
     let anchor = $(".requests-menu-file", requestItem.target);
     yield showTooltipOn(tooltip, anchor);
 
     info("Tooltip was successfully opened for the image request.");
     is(tooltip.content.querySelector("image").src, TEST_IMAGE_DATA_URI,
       "The tooltip's image content is displayed correctly.");
   }
 
--- a/devtools/client/netmonitor/test/browser_net_service-worker-status.js
+++ b/devtools/client/netmonitor/test/browser_net_service-worker-status.js
@@ -8,64 +8,48 @@
  */
 
 // Service workers only work on https
 const URL = EXAMPLE_URL.replace("http:", "https:");
 
 const TEST_URL = URL + "service-workers/status-codes.html";
 
 var test = Task.async(function* () {
-  let [, debuggee, monitor] = yield initNetMonitor(TEST_URL, null, true);
+  let [tab, debuggee, monitor] = yield initNetMonitor(TEST_URL, null, true);
   info("Starting test... ");
 
-  let { NetMonitorView } = monitor.panelWin;
-  let { RequestsMenu } = NetMonitorView;
+  let { document, L10N, NetMonitorView } = monitor.panelWin;
+  let { RequestsMenu, NetworkDetails } = NetMonitorView;
 
   const REQUEST_DATA = [
     {
       method: "GET",
       uri: URL + "service-workers/test/200",
       details: {
         status: 200,
         statusText: "OK (service worker)",
         displayedStatus: "service worker",
         type: "plain",
         fullMimeType: "text/plain; charset=UTF-8"
-      },
-      stackFunctions: ["doXHR", "performRequests"]
+      }
     },
   ];
 
   info("Registering the service worker...");
   yield debuggee.registerServiceWorker();
 
   info("Performing requests...");
   debuggee.performRequests();
   yield waitForNetworkEvents(monitor, REQUEST_DATA.length);
 
   let index = 0;
   for (let request of REQUEST_DATA) {
     let item = RequestsMenu.getItemAtIndex(index);
 
-    info(`Verifying request #${index}`);
+    info("Verifying request #" + index);
     yield verifyRequestItemTarget(item, request.method, request.uri, request.details);
 
-    let { stacktrace } = item.attachment.cause;
-    let stackLen = stacktrace ? stacktrace.length : 0;
-
-    ok(stacktrace, `Request #${index} has a stacktrace`);
-    ok(stackLen >= request.stackFunctions.length,
-      `Request #${index} has a stacktrace with enough (${stackLen}) items`);
-
-    request.stackFunctions.forEach((functionName, j) => {
-      is(stacktrace[j].functionName, functionName,
-      `Request #${index} has the correct function at position #${j} on the stack`);
-    });
-
     index++;
   }
 
-  info("Unregistering the service worker...");
-  yield debuggee.unregisterServiceWorker();
-
   yield teardown(monitor);
   finish();
 });
--- a/devtools/client/netmonitor/test/head.js
+++ b/devtools/client/netmonitor/test/head.js
@@ -45,20 +45,16 @@ const SEND_BEACON_URL = EXAMPLE_URL + "h
 const CORS_URL = EXAMPLE_URL + "html_cors-test-page.html";
 
 const SIMPLE_SJS = EXAMPLE_URL + "sjs_simple-test-server.sjs";
 const CONTENT_TYPE_SJS = EXAMPLE_URL + "sjs_content-type-test-server.sjs";
 const STATUS_CODES_SJS = EXAMPLE_URL + "sjs_status-codes-test-server.sjs";
 const SORTING_SJS = EXAMPLE_URL + "sjs_sorting-test-server.sjs";
 const HTTPS_REDIRECT_SJS = EXAMPLE_URL + "sjs_https-redirect-test-server.sjs";
 const CORS_SJS_PATH = "/browser/devtools/client/netmonitor/test/sjs_cors-test-server.sjs";
-const HSTS_SJS = EXAMPLE_URL + "sjs_hsts-test-server.sjs";
-
-const HSTS_BASE_URL = EXAMPLE_URL;
-const HSTS_PAGE_URL = CUSTOM_GET_URL;
 
 const TEST_IMAGE = EXAMPLE_URL + "test-image.png";
 const TEST_IMAGE_DATA_URI = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz//z8DJQAggJiQOe/fv2fv7Oz8rays/N+VkfG/iYnJfyD/1+rVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw/8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi/G+QKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo+MXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia+CuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq/vLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg/kdypqCg4H8lUIACnQ/SOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD+aDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg==";
 
 const FRAME_SCRIPT_UTILS_URL = "chrome://devtools/content/shared/frame-script-utils.js";
 
 DevToolsUtils.testing = true;
 SimpleTest.registerCleanupFunction(() => {
@@ -283,17 +279,17 @@ function verifyRequestItemTarget(aReques
 
   let requestsMenu = aRequestItem.ownerView;
   let widgetIndex = requestsMenu.indexOfItem(aRequestItem);
   let visibleIndex = requestsMenu.visibleItems.indexOf(aRequestItem);
 
   info("Widget index of item: " + widgetIndex);
   info("Visible index of item: " + visibleIndex);
 
-  let { fuzzyUrl, status, statusText, cause, type, fullMimeType,
+  let { fuzzyUrl, status, statusText, type, fullMimeType,
         transferred, size, time, displayedStatus } = aData;
   let { attachment, target } = aRequestItem;
 
   let uri = Services.io.newURI(aUrl, null, null).QueryInterface(Ci.nsIURL);
   let unicodeUrl = NetworkHelper.convertToUnicode(unescape(aUrl));
   let name = NetworkHelper.convertToUnicode(unescape(uri.fileName || uri.filePath || "/"));
   let query = NetworkHelper.convertToUnicode(unescape(uri.query));
   let hostPort = uri.hostPort;
@@ -335,25 +331,16 @@ function verifyRequestItemTarget(aReques
     let tooltip = target.querySelector(".requests-menu-status").getAttribute("tooltiptext");
     info("Displayed status: " + value);
     info("Displayed code: " + codeValue);
     info("Tooltip status: " + tooltip);
     is(value, displayedStatus ? displayedStatus : status, "The displayed status is correct.");
     is(codeValue, status, "The displayed status code is correct.");
     is(tooltip, status + " " + statusText, "The tooltip status is correct.");
   }
-  if (cause !== undefined) {
-    let causeLabel = target.querySelector(".requests-menu-cause-label");
-    let value = causeLabel.getAttribute("value");
-    let tooltip = causeLabel.getAttribute("tooltiptext");
-    info("Displayed cause: " + value);
-    info("Tooltip cause: " + tooltip);
-    is(value, cause.type, "The displayed cause is correct.");
-    is(tooltip, cause.loadingDocumentUri, "The tooltip cause is correct.")
-  }
   if (type !== undefined) {
     let value = target.querySelector(".requests-menu-type").getAttribute("value");
     let tooltip = target.querySelector(".requests-menu-type").getAttribute("tooltiptext");
     info("Displayed type: " + value);
     info("Tooltip type: " + tooltip);
     is(value, type, "The displayed type is correct.");
     is(tooltip, fullMimeType, "The tooltip type is correct.");
   }
deleted file mode 100644
--- a/devtools/client/netmonitor/test/html_cause-test-page.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!-- Any copyright is dedicated to the Public Domain.
-     http://creativecommons.org/publicdomain/zero/1.0/ -->
-<!doctype html>
-
-<html>
-  <head>
-    <meta charset="utf-8"/>
-    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
-    <meta http-equiv="Pragma" content="no-cache" />
-    <meta http-equiv="Expires" content="0" />
-    <title>Network Monitor test page</title>
-    <link rel="stylesheet" type="text/css" href="stylesheet_request" />
-  </head>
-
-  <body>
-    <p>Request cause test</p>
-    <img src="img_request" />
-    <script type="text/javascript">
-      function performXhrRequest() {
-        var xhr = new XMLHttpRequest();
-        xhr.open("GET", "xhr_request", true);
-        xhr.send();
-      }
-
-      function performBeaconRequest() {
-        navigator.sendBeacon("beacon_request");
-      }
-
-      performXhrRequest();
-      performBeaconRequest();
-    </script>
-  </body>
-</html>
--- a/devtools/client/netmonitor/test/service-workers/status-codes-service-worker.js
+++ b/devtools/client/netmonitor/test/service-workers/status-codes-service-worker.js
@@ -1,15 +1,8 @@
 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-"use strict";
-
-self.addEventListener("activate", event => {
-  // start controlling the already loaded page
-  event.waitUntil(self.clients.claim());
-});
-
-self.addEventListener("fetch", event => {
+addEventListener("fetch", function (event) {
   let response = new Response("Service worker response");
   event.respondWith(response);
 });
--- a/devtools/client/netmonitor/test/service-workers/status-codes.html
+++ b/devtools/client/netmonitor/test/service-workers/status-codes.html
@@ -10,50 +10,30 @@
     <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
   </head>
 
   <body>
     <p>Status codes test</p>
 
     <script type="text/javascript">
-      let swRegistration;
+      function get(url) {
+        return new Promise(done => {
+          let iframe = document.createElement("iframe");
+          iframe.setAttribute("src", url);
+          document.documentElement.appendChild(iframe);
+          iframe.contentWindow.onload = done;
+        });
+      }
 
       function registerServiceWorker() {
-        let sw = navigator.serviceWorker;
-        return sw.register("status-codes-service-worker.js")
-          .then(registration => {
-            swRegistration = registration;
-            console.log("Registered, scope is:", registration.scope);
-            return sw.ready;
-          }).then(() => {
-            // wait until the page is controlled
-            return new Promise(resolve => {
-              if (sw.controller) {
-                resolve();
-              } else {
-                sw.addEventListener('controllerchange', function onControllerChange() {
-                  sw.removeEventListener('controllerchange', onControllerChange);
-                  resolve();
-                });
-              }
-            });
-          }).catch(err => {
-            console.error("Registration failed");
-          });
-      }
-
-      function unregisterServiceWorker() {
-        return swRegistration.unregister();
+        return navigator.serviceWorker.register("status-codes-service-worker.js")
+                        .then(() => navigator.serviceWorker.ready);
       }
 
       function performRequests() {
-        return new Promise(function doXHR(done) {
-          let xhr = new XMLHttpRequest();
-          xhr.open("GET", "test/200", true);
-          xhr.onreadystatechange = done;
-          xhr.send(null);
-        });
+        return get("test/200");
       }
+
     </script>
   </body>
 
 </html>
deleted file mode 100644
--- a/devtools/client/netmonitor/test/sjs_hsts-test-server.sjs
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function handleRequest(request, response) {
-  response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
-  response.setHeader("Pragma", "no-cache");
-  response.setHeader("Expires", "0");
-
-  if (request.queryString === "reset") {
-    // Reset the HSTS policy, prevent influencing other tests
-    response.setStatusLine(request.httpVersion, 200, "OK");
-    response.setHeader("Strict-Transport-Security", "max-age=0");
-    response.write("Resetting HSTS");
-  } else if (request.scheme === "http") {
-    response.setStatusLine(request.httpVersion, 302, "Found");
-    response.setHeader("Location", "https://" + request.host + request.path);
-  } else {
-    response.setStatusLine(request.httpVersion, 200, "OK");
-    response.setHeader("Strict-Transport-Security", "max-age=100");
-    response.write("Page was accessed over HTTPS!");
-  }
-}
--- a/devtools/client/themes/netmonitor.css
+++ b/devtools/client/themes/netmonitor.css
@@ -241,35 +241,16 @@
 
 .requests-menu-type,
 .requests-menu-size {
   max-width: 6em;
   text-align: center;
   width: 8vw;
 }
 
-.requests-menu-cause {
-  max-width: 8em;
-  width: 8vw;
-}
-
-.requests-menu-cause-stack {
-  background-color: var(--theme-body-color-alt);
-  color: var(--theme-body-background);
-  font-size: 8px;
-  font-weight: bold;
-  line-height: 10px;
-  border-radius: 3px;
-  padding: 0 2px;
-  margin: 0;
-  margin-inline-end: 3px;
-  -moz-user-select: none;
-  cursor: pointer;
-}
-
 .requests-menu-transferred {
   max-width: 8em;
   text-align: center;
   width: 8vw;
 }
 
 /* Network requests table: status codes */
 
@@ -690,50 +671,16 @@
   background-color: var(--theme-selection-background-semitransparent);
 }
 
 .requests-menu-filter-button:not(:active)[checked] {
   background-color: var(--theme-selection-background);
   color: var(--theme-selection-color);
 }
 
-/* Requests menu stacktrace tooltip */
-.requests-menu-stack-trace {
-  max-height: 400px;
-  width: 586px;
-  overflow-y: auto;
-}
-
-.requests-menu-stack-frame {
-  color: var(--theme-body-color-alt);
-  cursor: pointer;
-  display: flex;
-}
-
-.requests-menu-stack-frame:hover {
-  background-color: var(--theme-selection-background-semitransparent);
-}
-
-.requests-menu-stack-frame-function-name {
-  color: var(--theme-highlight-blue);
-  cursor: inherit;
-  flex-grow: 1;
-}
-
-.requests-menu-stack-frame-file-name {
-  cursor: inherit;
-  margin-inline-end: 0;
-}
-
-.requests-menu-stack-frame-line {
-  color: var(--theme-highlight-orange);
-  cursor: inherit;
-  margin-inline-start: 0;
-}
-
 /* Performance analysis buttons */
 
 #requests-menu-network-summary-button {
   background: none;
   box-shadow: none;
   border-color: transparent;
   list-style-image: url(images/profiler-stopwatch.svg);
   padding-inline-end: 0;
--- a/devtools/server/actors/webconsole.js
+++ b/devtools/server/actors/webconsole.js
@@ -13,17 +13,16 @@ const { EnvironmentActor } = require("de
 const { ThreadActor } = require("devtools/server/actors/script");
 const { ObjectActor, LongStringActor, createValueGrip, stringIsLong } = require("devtools/server/actors/object");
 const DevToolsUtils = require("devtools/shared/DevToolsUtils");
 const ErrorDocs = require("devtools/server/actors/errordocs");
 
 loader.lazyRequireGetter(this, "NetworkMonitor", "devtools/shared/webconsole/network-monitor", true);
 loader.lazyRequireGetter(this, "NetworkMonitorChild", "devtools/shared/webconsole/network-monitor", true);
 loader.lazyRequireGetter(this, "ConsoleProgressListener", "devtools/shared/webconsole/network-monitor", true);
-loader.lazyRequireGetter(this, "StackTraceCollector", "devtools/shared/webconsole/network-monitor", true);
 loader.lazyRequireGetter(this, "events", "sdk/event/core");
 loader.lazyRequireGetter(this, "ServerLoggingListener", "devtools/shared/webconsole/server-logger", true);
 loader.lazyRequireGetter(this, "JSPropertyProvider", "devtools/shared/webconsole/js-property-provider", true);
 loader.lazyRequireGetter(this, "Parser", "resource://devtools/shared/Parser.jsm", true);
 
 for (let name of ["WebConsoleUtils", "ConsoleServiceListener",
     "ConsoleAPIListener", "addWebConsoleCommands",
     "ConsoleReflowListener", "CONSOLE_WORKER_IDS"]) {
@@ -594,34 +593,30 @@ WebConsoleActor.prototype =
             this.consoleAPIListener =
               new ConsoleAPIListener(window, this);
             this.consoleAPIListener.init();
           }
           startedListeners.push(listener);
           break;
         case "NetworkActivity":
           if (!this.networkMonitor) {
-            // Create a StackTraceCollector that's going to be shared both by the
-            // NetworkMonitorChild (getting messages about requests from parent) and
-            // by the NetworkMonitor that directly watches service workers requests.
-            this.stackTraceCollector = new StackTraceCollector({ window, appId });
-            this.stackTraceCollector.init();
-
             if (appId || messageManager) {
               // Start a network monitor in the parent process to listen to
               // most requests than happen in parent
               this.networkMonitor =
                 new NetworkMonitorChild(appId, messageManager,
                                         this.parentActor.actorID, this);
               this.networkMonitor.init();
               // Spawn also one in the child to listen to service workers
-              this.networkMonitorChild = new NetworkMonitor({ window }, this);
+              this.networkMonitorChild = new NetworkMonitor({ window: window },
+                                                            this);
               this.networkMonitorChild.init();
-            } else {
-              this.networkMonitor = new NetworkMonitor({ window }, this);
+            }
+            else {
+              this.networkMonitor = new NetworkMonitor({ window: window }, this);
               this.networkMonitor.init();
             }
           }
           startedListeners.push(listener);
           break;
         case "FileActivity":
           if (this.window instanceof Ci.nsIDOMWindow) {
             if (!this.consoleProgressListener) {
@@ -700,20 +695,16 @@ WebConsoleActor.prototype =
           if (this.networkMonitor) {
             this.networkMonitor.destroy();
             this.networkMonitor = null;
           }
           if (this.networkMonitorChild) {
             this.networkMonitorChild.destroy();
             this.networkMonitorChild = null;
           }
-          if (this.stackTraceCollector) {
-            this.stackTraceCollector.destroy();
-            this.stackTraceCollector = null;
-          }
           stoppedListeners.push(listener);
           break;
         case "FileActivity":
           if (this.consoleProgressListener) {
             this.consoleProgressListener.stopMonitor(this.consoleProgressListener.
                                                      MONITOR_FILE_ACTIVITY);
             this.consoleProgressListener = null;
           }
@@ -1832,17 +1823,16 @@ NetworkEventActor.prototype =
   {
     return {
       actor: this.actorID,
       startedDateTime: this._startedDateTime,
       timeStamp: Date.parse(this._startedDateTime),
       url: this._request.url,
       method: this._request.method,
       isXHR: this._isXHR,
-      cause: this._cause,
       fromCache: this._fromCache,
       fromServiceWorker: this._fromServiceWorker,
       private: this._private,
     };
   },
 
   /**
    * Releases this actor from the pool.
@@ -1878,17 +1868,16 @@ NetworkEventActor.prototype =
    *
    * @param object aNetworkEvent
    *        The network event associated with this actor.
    */
   init: function NEA_init(aNetworkEvent)
   {
     this._startedDateTime = aNetworkEvent.startedDateTime;
     this._isXHR = aNetworkEvent.isXHR;
-    this._cause = aNetworkEvent.cause;
     this._fromCache = aNetworkEvent.fromCache;
     this._fromServiceWorker = aNetworkEvent.fromServiceWorker;
 
     for (let prop of ["method", "url", "httpVersion", "headersSize"]) {
       this._request[prop] = aNetworkEvent[prop];
     }
 
     this._discardRequestBody = aNetworkEvent.discardRequestBody;
--- a/devtools/shared/webconsole/client.js
+++ b/devtools/shared/webconsole/client.js
@@ -95,17 +95,16 @@ WebConsoleClient.prototype = {
         discardRequestBody: true,
         discardResponseBody: true,
         startedDateTime: actor.startedDateTime,
         request: {
           url: actor.url,
           method: actor.method,
         },
         isXHR: actor.isXHR,
-        cause: actor.cause,
         response: {},
         timings: {},
         // track the list of network event updates
         updates: [],
         private: actor.private,
         fromCache: actor.fromCache,
         fromServiceWorker: actor.fromServiceWorker
       };
--- a/devtools/shared/webconsole/network-monitor.js
+++ b/devtools/shared/webconsole/network-monitor.js
@@ -1,17 +1,17 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set ft= javascript ts=2 et sw=2 tw=80: */
 /* 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/. */
 
 "use strict";
 
-const {Cc, Ci, Cm, Cu, Cr, components} = require("chrome");
+const {Cc, Ci, Cu, Cr} = require("chrome");
 const Services = require("Services");
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 loader.lazyRequireGetter(this, "NetworkHelper",
                          "devtools/shared/webconsole/network-helper");
 loader.lazyRequireGetter(this, "DevToolsUtils",
                          "devtools/shared/DevToolsUtils");
@@ -32,246 +32,16 @@ const HTTP_MOVED_PERMANENTLY = 301;
 const HTTP_FOUND = 302;
 const HTTP_SEE_OTHER = 303;
 const HTTP_TEMPORARY_REDIRECT = 307;
 
 // The maximum number of bytes a NetworkResponseListener can hold: 1 MB
 const RESPONSE_BODY_LIMIT = 1048576;
 
 /**
- * Check if a given network request should be logged by a network monitor
- * based on the specified filters.
- *
- * @param nsIHttpChannel channel
- *        Request to check.
- * @param filters
- *        NetworkMonitor filters to match against.
- * @return boolean
- *         True if the network request should be logged, false otherwise.
- */
-function matchRequest(channel, filters) {
-  // Log everything if no filter is specified
-  if (!filters.topFrame && !filters.window && !filters.appId) {
-    return true;
-  }
-
-  // Ignore requests from chrome or add-on code when we are monitoring
-  // content.
-  // TODO: one particular test (browser_styleeditor_fetch-from-cache.js) needs
-  // the DevToolsUtils.testing check. We will move to a better way to serve
-  // its needs in bug 1167188, where this check should be removed.
-  if (!DevToolsUtils.testing && channel.loadInfo &&
-      channel.loadInfo.loadingDocument === null &&
-      channel.loadInfo.loadingPrincipal ===
-      Services.scriptSecurityManager.getSystemPrincipal()) {
-    return false;
-  }
-
-  if (filters.window) {
-    // Since frames support, this.window may not be the top level content
-    // frame, so that we can't only compare with win.top.
-    let win = NetworkHelper.getWindowForRequest(channel);
-    while (win) {
-      if (win == filters.window) {
-        return true;
-      }
-      if (win.parent == win) {
-        break;
-      }
-      win = win.parent;
-    }
-  }
-
-  if (filters.topFrame) {
-    let topFrame = NetworkHelper.getTopFrameForRequest(channel);
-    if (topFrame && topFrame === filters.topFrame) {
-      return true;
-    }
-  }
-
-  if (filters.appId) {
-    let appId = NetworkHelper.getAppIdForRequest(channel);
-    if (appId && appId == filters.appId) {
-      return true;
-    }
-  }
-
-  // The following check is necessary because beacon channels don't come
-  // associated with a load group. Bug 1160837 will hopefully introduce a
-  // platform fix that will render the following code entirely useless.
-  if (channel.loadInfo &&
-      channel.loadInfo.externalContentPolicyType ==
-      Ci.nsIContentPolicy.TYPE_BEACON) {
-    let nonE10sMatch = filters.window &&
-        channel.loadInfo.loadingDocument === filters.window.document;
-    const loadingPrincipal = channel.loadInfo.loadingPrincipal;
-    let e10sMatch = filters.topFrame &&
-        filters.topFrame.contentPrincipal &&
-        filters.topFrame.contentPrincipal.equals(loadingPrincipal) &&
-        filters.topFrame.contentPrincipal.URI.spec == channel.referrer.spec;
-    let b2gMatch = filters.appId && loadingPrincipal.appId === filters.appId;
-    if (nonE10sMatch || e10sMatch || b2gMatch) {
-      return true;
-    }
-  }
-
-  return false;
-}
-
-/**
- * This is a nsIChannelEventSink implementation that monitors channel redirects and
- * informs the registered StackTraceCollector about the old and new channels.
- */
-const SINK_CLASS_DESCRIPTION = "NetworkMonitor Channel Event Sink";
-const SINK_CLASS_ID = components.ID("{e89fa076-c845-48a8-8c45-2604729eba1d}");
-const SINK_CONTRACT_ID = "@mozilla.org/network/monitor/channeleventsink;1";
-const SINK_CATEGORY_NAME = "net-channel-event-sinks";
-
-function ChannelEventSink() {
-  this.wrappedJSObject = this;
-  this.collectors = new Set();
-}
-
-ChannelEventSink.prototype = {
-  QueryInterface: XPCOMUtils.generateQI([Ci.nsIChannelEventSink]),
-
-  registerCollector(collector) {
-    this.collectors.add(collector);
-  },
-
-  unregisterCollector(collector) {
-    this.collectors.delete(collector);
-
-    if (this.collectors.size == 0) {
-      ChannelEventSinkFactory.unregister();
-    }
-  },
-
-  asyncOnChannelRedirect(oldChannel, newChannel, flags, callback) {
-    for (let collector of this.collectors) {
-      try {
-        collector.onChannelRedirect(oldChannel, newChannel, flags);
-      } catch (ex) {
-        console.error("StackTraceCollector.onChannelRedirect threw an exception", ex);
-      }
-    }
-    callback.onRedirectVerifyCallback(Cr.NS_OK);
-  }
-};
-
-const ChannelEventSinkFactory = XPCOMUtils.generateSingletonFactory(ChannelEventSink);
-
-ChannelEventSinkFactory.register = function () {
-  const registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
-  if (registrar.isCIDRegistered(SINK_CLASS_ID)) {
-    return;
-  }
-
-  registrar.registerFactory(SINK_CLASS_ID,
-                            SINK_CLASS_DESCRIPTION,
-                            SINK_CONTRACT_ID,
-                            ChannelEventSinkFactory);
-
-  XPCOMUtils.categoryManager.addCategoryEntry(SINK_CATEGORY_NAME, SINK_CONTRACT_ID,
-    SINK_CONTRACT_ID, false, true);
-};
-
-ChannelEventSinkFactory.unregister = function () {
-  const registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
-  registrar.unregisterFactory(SINK_CLASS_ID, ChannelEventSinkFactory);
-
-  XPCOMUtils.categoryManager.deleteCategoryEntry(SINK_CATEGORY_NAME, SINK_CONTRACT_ID,
-    false);
-};
-
-ChannelEventSinkFactory.getService = function () {
-  // Make sure the ChannelEventSink service is registered before accessing it
-  ChannelEventSinkFactory.register();
-
-  return Cc[SINK_CONTRACT_ID].getService(Ci.nsIChannelEventSink).wrappedJSObject;
-};
-
-function StackTraceCollector(filters) {
-  this.filters = filters;
-  this.stacktracesById = new Map();
-}
-
-StackTraceCollector.prototype = {
-  init() {
-    Services.obs.addObserver(this, "http-on-opening-request", false);
-    ChannelEventSinkFactory.getService().registerCollector(this);
-  },
-
-  destroy() {
-    Services.obs.removeObserver(this, "http-on-opening-request");
-    ChannelEventSinkFactory.getService().unregisterCollector(this);
-  },
-
-  _saveStackTrace(channel, stacktrace) {
-    this.stacktracesById.set(channel.channelId, stacktrace);
-  },
-
-  observe(subject) {
-    let channel = subject.QueryInterface(Ci.nsIHttpChannel);
-
-    if (!matchRequest(channel, this.filters)) {
-      return;
-    }
-
-    // Convert the nsIStackFrame XPCOM objects to a nice JSON that can be
-    // passed around through message managers etc.
-    let frame = components.stack;
-    let stacktrace = [];
-    if (frame && frame.caller) {
-      frame = frame.caller;
-      while (frame) {
-        stacktrace.push({
-          filename: frame.filename,
-          lineNumber: frame.lineNumber,
-          columnNumber: frame.columnNumber,
-          functionName: frame.name
-        });
-        if (frame.asyncCaller) {
-          frame = frame.asyncCaller;
-        } else {
-          frame = frame.caller;
-        }
-      }
-    }
-
-    this._saveStackTrace(channel, stacktrace);
-  },
-
-  onChannelRedirect(oldChannel, newChannel, flags) {
-    // We can be called with any nsIChannel, but are interested only in HTTP channels
-    try {
-      oldChannel.QueryInterface(Ci.nsIHttpChannel);
-      newChannel.QueryInterface(Ci.nsIHttpChannel);
-    } catch (ex) {
-      return;
-    }
-
-    let oldId = oldChannel.channelId;
-    let stacktrace = this.stacktracesById.get(oldId);
-    if (stacktrace) {
-      this.stacktracesById.delete(oldId);
-      this._saveStackTrace(newChannel, stacktrace);
-    }
-  },
-
-  getStackTrace(channelId) {
-    let trace = this.stacktracesById.get(channelId);
-    this.stacktracesById.delete(channelId);
-    return trace;
-  }
-};
-
-exports.StackTraceCollector = StackTraceCollector;
-
-/**
  * The network response listener implements the nsIStreamListener and
  * nsIRequestObserver interfaces. This is used within the NetworkMonitor feature
  * to get the response body of the request.
  *
  * The code is mostly based on code listings from:
  *
  *   http://www.softwareishard.com/blog/firebug/
  *      nsitraceablechannel-intercept-http-traffic/
@@ -288,16 +58,17 @@ function NetworkResponseListener(owner, 
   this.owner = owner;
   this.receivedData = "";
   this.httpActivity = httpActivity;
   this.bodySize = 0;
   let channel = this.httpActivity.channel;
   this._wrappedNotificationCallbacks = channel.notificationCallbacks;
   channel.notificationCallbacks = this;
 }
+exports.NetworkResponseListener = NetworkResponseListener;
 
 NetworkResponseListener.prototype = {
   QueryInterface:
     XPCOMUtils.generateQI([Ci.nsIStreamListener, Ci.nsIInputStreamCallback,
                            Ci.nsIRequestObserver, Ci.nsIInterfaceRequestor,
                            Ci.nsISupports]),
 
   // nsIInterfaceRequestor implementation
@@ -686,48 +457,56 @@ NetworkResponseListener.prototype = {
  * requests. The nsIObserverService is also used for monitoring
  * http-on-examine-response notifications. All network request information is
  * routed to the remote Web Console.
  *
  * @constructor
  * @param object filters
  *        Object with the filters to use for network requests:
  *        - window (nsIDOMWindow): filter network requests by the associated
- *          window object.
+ *        window object.
  *        - appId (number): filter requests by the appId.
  *        - topFrame (nsIDOMElement): filter requests by their topFrameElement.
  *        Filters are optional. If any of these filters match the request is
  *        logged (OR is applied). If no filter is provided then all requests are
  *        logged.
  * @param object owner
  *        The network monitor owner. This object needs to hold:
  *        - onNetworkEvent(requestInfo, channel, networkMonitor).
- *          This method is invoked once for every new network request and it is
- *          given the following arguments: the initial network request
- *          information, and the channel. The third argument is the NetworkMonitor
- *          instance. onNetworkEvent() must return an object which holds several add*()
- *          methods which are used to add further network request/response
- *          information.
- *        - stackTraceCollector If the owner has this optional property, it will
- *          be used as a StackTraceCollector by the NetworkMonitor.
+ *        This method is invoked once for every new network request and it is
+ *        given the following arguments: the initial network request
+ *        information, and the channel. The third argument is the NetworkMonitor
+ *        instance.
+ *        onNetworkEvent() must return an object which holds several add*()
+ *        methods which are used to add further network request/response
+ *        information.
  */
 function NetworkMonitor(filters, owner) {
-  this.filters = filters;
+  if (filters) {
+    this.window = filters.window;
+    this.appId = filters.appId;
+    this.topFrame = filters.topFrame;
+  }
+  if (!this.window && !this.appId && !this.topFrame) {
+    this._logEverything = true;
+  }
   this.owner = owner;
   this.openRequests = {};
   this.openResponses = {};
   this._httpResponseExaminer =
     DevToolsUtils.makeInfallible(this._httpResponseExaminer).bind(this);
   this._serviceWorkerRequest = this._serviceWorkerRequest.bind(this);
 }
-
 exports.NetworkMonitor = NetworkMonitor;
 
 NetworkMonitor.prototype = {
-  filters: null,
+  _logEverything: false,
+  window: null,
+  appId: null,
+  topFrame: null,
 
   httpTransactionCodes: {
     0x5001: "REQUEST_HEADER",
     0x5002: "REQUEST_BODY_SENT",
     0x5003: "RESPONSE_START",
     0x5004: "RESPONSE_HEADER",
     0x5005: "RESPONSE_COMPLETE",
     0x5006: "TRANSACTION_CLOSE",
@@ -782,17 +561,17 @@ NetworkMonitor.prototype = {
     // everything else only happens in the parent process
     Services.obs.addObserver(this._serviceWorkerRequest,
                              "service-worker-synthesized-response", false);
   },
 
   _serviceWorkerRequest: function (subject, topic, data) {
     let channel = subject.QueryInterface(Ci.nsIHttpChannel);
 
-    if (!matchRequest(channel, this.filters)) {
+    if (!this._matchRequest(channel)) {
       return;
     }
 
     this.interceptedChannels.add(subject);
 
     // On e10s, we never receive http-on-examine-cached-response, so fake one.
     if (Services.appinfo.processType == Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT) {
       this._httpResponseExaminer(channel, "http-on-examine-cached-response");
@@ -818,17 +597,17 @@ NetworkMonitor.prototype = {
         (topic != "http-on-examine-response" &&
          topic != "http-on-examine-cached-response") ||
         !(subject instanceof Ci.nsIHttpChannel)) {
       return;
     }
 
     let channel = subject.QueryInterface(Ci.nsIHttpChannel);
 
-    if (!matchRequest(channel, this.filters)) {
+    if (!this._matchRequest(channel)) {
       return;
     }
 
     let response = {
       id: gSequenceId(),
       channel: channel,
       headers: [],
       cookies: [],
@@ -973,16 +752,94 @@ NetworkMonitor.prototype = {
         this._onTransactionClose(httpActivity);
         break;
       default:
         break;
     }
   }),
 
   /**
+   * Check if a given network request should be logged by this network monitor
+   * instance based on the current filters.
+   *
+   * @private
+   * @param nsIHttpChannel channel
+   *        Request to check.
+   * @return boolean
+   *         True if the network request should be logged, false otherwise.
+   */
+  _matchRequest: function (channel) {
+    if (this._logEverything) {
+      return true;
+    }
+
+    // Ignore requests from chrome or add-on code when we are monitoring
+    // content.
+    // TODO: one particular test (browser_styleeditor_fetch-from-cache.js) needs
+    // the DevToolsUtils.testing check. We will move to a better way to serve
+    // its needs in bug 1167188, where this check should be removed.
+    if (!DevToolsUtils.testing && channel.loadInfo &&
+        channel.loadInfo.loadingDocument === null &&
+        channel.loadInfo.loadingPrincipal ===
+        Services.scriptSecurityManager.getSystemPrincipal()) {
+      return false;
+    }
+
+    if (this.window) {
+      // Since frames support, this.window may not be the top level content
+      // frame, so that we can't only compare with win.top.
+      let win = NetworkHelper.getWindowForRequest(channel);
+      while (win) {
+        if (win == this.window) {
+          return true;
+        }
+        if (win.parent == win) {
+          break;
+        }
+        win = win.parent;
+      }
+    }
+
+    if (this.topFrame) {
+      let topFrame = NetworkHelper.getTopFrameForRequest(channel);
+      if (topFrame && topFrame === this.topFrame) {
+        return true;
+      }
+    }
+
+    if (this.appId) {
+      let appId = NetworkHelper.getAppIdForRequest(channel);
+      if (appId && appId == this.appId) {
+        return true;
+      }
+    }
+
+    // The following check is necessary because beacon channels don't come
+    // associated with a load group. Bug 1160837 will hopefully introduce a
+    // platform fix that will render the following code entirely useless.
+    if (channel.loadInfo &&
+        channel.loadInfo.externalContentPolicyType ==
+        Ci.nsIContentPolicy.TYPE_BEACON) {
+      let nonE10sMatch = this.window &&
+          channel.loadInfo.loadingDocument === this.window.document;
+      const loadingPrincipal = channel.loadInfo.loadingPrincipal;
+      let e10sMatch = this.topFrame &&
+          this.topFrame.contentPrincipal &&
+          this.topFrame.contentPrincipal.equals(loadingPrincipal) &&
+          this.topFrame.contentPrincipal.URI.spec == channel.referrer.spec;
+      let b2gMatch = this.appId && loadingPrincipal.appId === this.appId;
+      if (nonE10sMatch || e10sMatch || b2gMatch) {
+        return true;
+      }
+    }
+
+    return false;
+  },
+
+  /**
    *
    */
   _createNetworkEvent: function (channel, { timestamp, extraStringData,
                                            fromCache, fromServiceWorker }) {
     let win = NetworkHelper.getWindowForRequest(channel);
     let httpActivity = this.createActivityObject(channel);
 
     // see _onRequestBodySent()
@@ -995,51 +852,36 @@ NetworkMonitor.prototype = {
       httpActivity.timings.REQUEST_HEADER = {
         first: timestamp,
         last: timestamp
       };
     }
 
     let event = {};
     event.method = channel.requestMethod;
-    event.channelId = channel.channelId;
     event.url = channel.URI.spec;
     event.private = httpActivity.private;
     event.headersSize = 0;
     event.startedDateTime =
       (timestamp ? new Date(Math.round(timestamp / 1000)) : new Date())
       .toISOString();
     event.fromCache = fromCache;
     event.fromServiceWorker = fromServiceWorker;
     httpActivity.fromServiceWorker = fromServiceWorker;
 
     if (extraStringData) {
       event.headersSize = extraStringData.length;
     }
 
-    // Determine the cause and if this is an XHR request.
-    let causeType = channel.loadInfo.externalContentPolicyType;
-    let loadingPrincipal = channel.loadInfo.loadingPrincipal;
-    let causeUri = loadingPrincipal ? loadingPrincipal.URI : null;
-    let stacktrace;
-    // If this is the parent process, there is no stackTraceCollector - the stack
-    // trace will be added in NetworkMonitorChild._onNewEvent.
-    if (this.owner.stackTraceCollector) {
-      stacktrace = this.owner.stackTraceCollector.getStackTrace(event.channelId);
-    }
-
-    event.cause = {
-      type: causeType,
-      loadingDocumentUri: causeUri ? causeUri.spec : null,
-      stacktrace
-    };
-
+    // Determine if this is an XHR request.
     httpActivity.isXHR = event.isXHR =
-        (causeType === Ci.nsIContentPolicy.TYPE_XMLHTTPREQUEST ||
-         causeType === Ci.nsIContentPolicy.TYPE_FETCH);
+      (channel.loadInfo.externalContentPolicyType ===
+       Ci.nsIContentPolicy.TYPE_XMLHTTPREQUEST ||
+       channel.loadInfo.externalContentPolicyType ===
+       Ci.nsIContentPolicy.TYPE_FETCH);
 
     // Determine the HTTP version.
     let httpVersionMaj = {};
     let httpVersionMin = {};
     channel.QueryInterface(Ci.nsIHttpChannelInternal);
     channel.getRequestVersion(httpVersionMaj, httpVersionMin);
 
     event.httpVersion = "HTTP/" + httpVersionMaj.value + "." +
@@ -1085,21 +927,22 @@ NetworkMonitor.prototype = {
    *
    * @private
    * @param nsIHttpChannel channel
    * @param number timestamp
    * @param string extraStringData
    * @return void
    */
   _onRequestHeader: function (channel, timestamp, extraStringData) {
-    if (!matchRequest(channel, this.filters)) {
+    if (!this._matchRequest(channel)) {
       return;
     }
 
-    this._createNetworkEvent(channel, { timestamp, extraStringData });
+    this._createNetworkEvent(channel, { timestamp: timestamp,
+                                         extraStringData: extraStringData });
   },
 
   /**
    * Create the empty HTTP activity object. This object is used for storing all
    * the request and response information.
    *
    * This is a HAR-like object. Conformance to the spec is not guaranteed at
    * this point.
@@ -1379,17 +1222,18 @@ NetworkMonitor.prototype = {
 
     Services.obs.removeObserver(this._serviceWorkerRequest,
                                 "service-worker-synthesized-response");
 
     this.interceptedChannels.clear();
     this.openRequests = {};
     this.openResponses = {};
     this.owner = null;
-    this.filters = null;
+    this.window = null;
+    this.topFrame = null;
   },
 };
 
 /**
  * The NetworkMonitorChild is used to proxy all of the network activity of the
  * child app process from the main process. The child WebConsoleActor creates an
  * instance of this object.
  *
@@ -1415,33 +1259,33 @@ function NetworkMonitorChild(appId, mess
   this.appId = appId;
   this.connID = connID;
   this.owner = owner;
   this._messageManager = messageManager;
   this._onNewEvent = this._onNewEvent.bind(this);
   this._onUpdateEvent = this._onUpdateEvent.bind(this);
   this._netEvents = new Map();
 }
-
 exports.NetworkMonitorChild = NetworkMonitorChild;
 
 NetworkMonitorChild.prototype = {
   appId: null,
   owner: null,
   _netEvents: null,
   _saveRequestAndResponseBodies: true,
 
   get saveRequestAndResponseBodies() {
     return this._saveRequestAndResponseBodies;
   },
 
   set saveRequestAndResponseBodies(val) {
     this._saveRequestAndResponseBodies = val;
 
     this._messageManager.sendAsyncMessage("debug:netmonitor:" + this.connID, {
+      appId: this.appId,
       action: "setPreferences",
       preferences: {
         saveRequestAndResponseBodies: this._saveRequestAndResponseBodies,
       },
     });
   },
 
   init: function () {
@@ -1453,23 +1297,16 @@ NetworkMonitorChild.prototype = {
     mm.sendAsyncMessage("debug:netmonitor:" + this.connID, {
       appId: this.appId,
       action: "start",
     });
   },
 
   _onNewEvent: DevToolsUtils.makeInfallible(function _onNewEvent(msg) {
     let {id, event} = msg.data;
-
-    // Try to add stack trace to the event data received from parent
-    if (this.owner.stackTraceCollector) {
-      event.cause.stacktrace =
-        this.owner.stackTraceCollector.getStackTrace(event.channelId);
-    }
-
     let actor = this.owner.onNetworkEvent(event);
     this._netEvents.set(id, Cu.getWeakReference(actor));
   }),
 
   _onUpdateEvent: DevToolsUtils.makeInfallible(function _onUpdateEvent(msg) {
     let {id, method, args} = msg.data;
     let weakActor = this._netEvents.get(id);
     let actor = weakActor ? weakActor.get() : null;
@@ -1606,22 +1443,21 @@ NetworkMonitorManager.prototype = {
   /**
    * Handler for "debug:monitor" messages received through the message manager
    * from the content process.
    *
    * @param object msg
    *        Message from the content.
    */
   onNetMonitorMessage: DevToolsUtils.makeInfallible(function (msg) {
-    let {action} = msg.json;
+    let { action, appId } = msg.json;
     // Pipe network monitor data from parent to child via the message manager.
     switch (action) {
       case "start":
         if (!this.netMonitor) {
-          let {appId} = msg.json;
           this.netMonitor = new NetworkMonitor({
             topFrame: this.frame,
             appId: appId,
           }, this);
           this.netMonitor.init();
         }
         break;