Bug 1457701 - Use Reps with noGrip:true in netmonitor; r=jryans
authorJan Odvarko <odvarko@gmail.com>
Tue, 08 May 2018 17:18:02 +0200
changeset 417542 c68911c91feeeda49e302ff73564f7a2e97fc616
parent 417541 7858e8a22a6835142fc7aab232d1455c5eb8f5ea
child 417543 508d0fad4bb0bdad3c4225f7269b895a478e68c3
push id33970
push usercsabou@mozilla.com
push dateWed, 09 May 2018 17:26:50 +0000
treeherdermozilla-central@d4d7e793ebe8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjryans
bugs1457701
milestone62.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 1457701 - Use Reps with noGrip:true in netmonitor; r=jryans MozReview-Commit-ID: CqNw6rVGRqL
devtools/client/netmonitor/src/components/HeadersPanel.js
devtools/client/netmonitor/src/components/PropertiesView.js
devtools/client/netmonitor/test/browser.ini
devtools/client/netmonitor/test/browser_net_json-nogrip.js
devtools/client/netmonitor/test/sjs_json-test-server.sjs
--- a/devtools/client/netmonitor/src/components/HeadersPanel.js
+++ b/devtools/client/netmonitor/src/components/HeadersPanel.js
@@ -148,16 +148,17 @@ class HeadersPanel extends Component {
     return (
       div({ className: "treeValueCellDivider" },
         Rep(Object.assign(props, {
           // FIXME: A workaround for the issue in StringRep
           // Force StringRep to crop the text everytime
           member: Object.assign({}, member, { open: false }),
           mode: MODE.TINY,
           cropLimit: 60,
+          noGrip: true,
         })),
         headerDocURL ? MDNLink({
           url: headerDocURL,
         }) : null
       )
     );
   }
 
--- a/devtools/client/netmonitor/src/components/PropertiesView.js
+++ b/devtools/client/netmonitor/src/components/PropertiesView.js
@@ -157,16 +157,17 @@ class PropertiesView extends Component {
     }
 
     return Rep(Object.assign(props, {
       // FIXME: A workaround for the issue in StringRep
       // Force StringRep to crop the text every time
       member: Object.assign({}, member, { open: false }),
       mode: MODE.TINY,
       cropLimit: this.props.cropLimit,
+      noGrip: true,
     }));
   }
 
   sectionIsSearchable(object, section) {
     return !(object[section][EDITOR_CONFIG_ID] || object[section][HTML_PREVIEW_ID]);
   }
 
   shouldRenderSearchBox(object) {
--- a/devtools/client/netmonitor/test/browser.ini
+++ b/devtools/client/netmonitor/test/browser.ini
@@ -129,16 +129,17 @@ skip-if = (os == 'linux' && debug && bit
 [browser_net_headers-alignment.js]
 [browser_net_headers_filter.js]
 [browser_net_headers_sorted.js]
 [browser_net_image-tooltip.js]
 [browser_net_json-b64.js]
 [browser_net_json-null.js]
 [browser_net_json-long.js]
 [browser_net_json-malformed.js]
+[browser_net_json-nogrip.js]
 [browser_net_json_custom_mime.js]
 [browser_net_json_text_mime.js]
 [browser_net_jsonp.js]
 [browser_net_large-response.js]
 [browser_net_leak_on_tab_close.js]
 [browser_net_open_in_debugger.js]
 [browser_net_open_in_style_editor.js]
 [browser_net_open_request_in_tab.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/netmonitor/test/browser_net_json-nogrip.js
@@ -0,0 +1,38 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+/**
+ * Tests if JSON responses with property 'type' are correctly rendered.
+ * (Reps rendering JSON responses should use `noGrip=true`).
+ */
+add_task(async function() {
+  let { tab, monitor } = await initNetMonitor(JSON_BASIC_URL + "?name=nogrip");
+  info("Starting test... ");
+
+  let { document, store, windowRequire } = monitor.panelWin;
+  let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
+
+  store.dispatch(Actions.batchEnable(false));
+
+  await performRequests(monitor, tab, 1);
+
+  let onResponsePanelReady = waitForDOM(document, "#response-panel .CodeMirror-code");
+  store.dispatch(Actions.toggleNetworkDetails());
+  EventUtils.sendMouseEvent({ type: "click" },
+    document.querySelector("#response-tab"));
+  await onResponsePanelReady;
+
+  let tabpanel = document.querySelector("#response-panel");
+  let labels = tabpanel
+    .querySelectorAll("tr:not(.tree-section) .treeLabelCell .treeLabel");
+  let values = tabpanel
+    .querySelectorAll("tr:not(.tree-section) .treeValueCell .objectBox");
+
+  // Verify that an object is rendered: `obj: {…}`
+  is(labels[0].textContent, "obj", "The first json property name is correct.");
+  is(values[0].textContent, "{\u2026}", "The first json property value is correct.");
+
+  await teardown(monitor);
+});
--- a/devtools/client/netmonitor/test/sjs_json-test-server.sjs
+++ b/devtools/client/netmonitor/test/sjs_json-test-server.sjs
@@ -13,10 +13,13 @@ function handleRequest(request, response
   // This server checks the name parameter from the request to decide which JSON object to
   // return.
   let params = request.queryString.split("&");
   let name = (params.filter((s) => s.includes("name="))[0] || "").split("=")[1];
   switch (name) {
     case "null":
       response.write("{ \"greeting\": null }");
       break;
+    case "nogrip":
+      response.write("{\"obj\": {\"type\": \"string\" }}");
+      break;
   }
 }