Backed out changeset a762568b0299 (bug 1328532) for clipboard bustage a=backout
authorWes Kocher <wkocher@mozilla.com>
Wed, 04 Jan 2017 18:23:22 -0800
changeset 328111 fb9fc60ae669f960520f20db32af251eff4cb808
parent 328110 fa441ec96615aea9c9af2e63b9b8b8599047ff31
child 328112 e7eebf3aeb34b51c958a2cbcdb187d5ddd8ad484
push id85390
push userkwierso@gmail.com
push dateFri, 06 Jan 2017 01:32:55 +0000
treeherdermozilla-inbound@5ae3e55675da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1328532
milestone53.0a1
backs outa762568b0299d8029d7cb33c7309077350126c27
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 changeset a762568b0299 (bug 1328532) for clipboard bustage a=backout
devtools/client/netmonitor/netmonitor-controller.js
devtools/client/netmonitor/requests-menu-view.js
devtools/client/netmonitor/test/browser_net_icon-preview.js
devtools/client/netmonitor/test/browser_net_streaming-response.js
--- a/devtools/client/netmonitor/netmonitor-controller.js
+++ b/devtools/client/netmonitor/netmonitor-controller.js
@@ -706,22 +706,16 @@ NetworkEventsHandler.prototype = {
    *        The long string grip containing the corresponding actor.
    *        If you pass in a plain string (by accident or because you're lazy),
    *        then a promise of the same string is simply returned.
    * @return object Promise
    *         A promise that is resolved when the full string contents
    *         are available, or rejected if something goes wrong.
    */
   getString: function (stringGrip) {
-    // FIXME: this.webConsoleClient will be undefined in mochitest,
-    // so we return string instantly to skip undefined error
-    if (typeof stringGrip === "string") {
-      return stringGrip;
-    }
-
     return this.webConsoleClient.getString(stringGrip);
   }
 };
 
 /**
  * Convenient way of emitting events from the panel window.
  */
 EventEmitter.decorate(window);
--- a/devtools/client/netmonitor/requests-menu-view.js
+++ b/devtools/client/netmonitor/requests-menu-view.js
@@ -203,54 +203,56 @@ RequestsMenuView.prototype = {
   updateRequest: Task.async(function* (id, data) {
     const action = Actions.updateRequest(id, data, true);
     yield this.store.dispatch(action);
 
     let { responseContent, requestPostData } = action.data;
 
     if (responseContent && responseContent.content) {
       let request = getRequestById(this.store.getState(), action.id);
+      let { text, encoding } = responseContent.content;
       if (request) {
         let { mimeType } = request;
-        let { text, encoding } = responseContent.content;
-        let response = yield gNetwork.getString(text);
-        let payload = {};
 
+        // Fetch response data if the response is an image (to display thumbnail)
         if (mimeType.includes("image/")) {
-          payload.responseContentDataUri = formDataURI(mimeType, encoding, response);
-        }
-
-        if (mimeType.includes("text/")) {
-          responseContent.content.text = response;
-          payload.responseContent = responseContent;
-        }
-
-        yield this.store.dispatch(Actions.updateRequest(action.id, payload, true));
-
-        if (mimeType.includes("image/")) {
+          let responseBody = yield gNetwork.getString(text);
+          const dataUri = formDataURI(mimeType, encoding, responseBody);
+          yield this.store.dispatch(Actions.updateRequest(
+            action.id,
+            { responseContentDataUri: dataUri },
+            true
+          ));
           window.emit(EVENTS.RESPONSE_IMAGE_THUMBNAIL_DISPLAYED);
+        // Fetch response text only if the response is html, but not all text/*
+        } else if (mimeType.includes("text/html") && typeof text !== "string") {
+          let responseBody = yield gNetwork.getString(text);
+          responseContent.content.text = responseBody;
+          responseContent = Object.assign({}, responseContent);
+          yield this.store.dispatch(Actions.updateRequest(
+            action.id,
+            { responseContent },
+            true
+          ));
         }
       }
     }
 
     // Search the POST data upload stream for request headers and add
     // them as a separate property, different from the classic headers.
     if (requestPostData && requestPostData.postData) {
       let { text } = requestPostData.postData;
       let postData = yield gNetwork.getString(text);
       const headers = CurlUtils.getHeadersFromMultipartText(postData);
       const headersSize = headers.reduce((acc, { name, value }) => {
         return acc + name.length + value.length + 2;
       }, 0);
-      let payload = {};
-      requestPostData.postData.text = postData;
-      payload.requestPostData = Object.assign({}, requestPostData);
-      payload.requestHeadersFromUploadStream = { headers, headersSize };
-
-      yield this.store.dispatch(Actions.updateRequest(action.id, payload, true));
+      yield this.store.dispatch(Actions.updateRequest(action.id, {
+        requestHeadersFromUploadStream: { headers, headersSize }
+      }, true));
     }
   }),
 
   /**
    * Disable batched updates. Used by tests.
    */
   set lazyUpdate(value) {
     this.store.dispatch(Actions.batchEnable(value));
--- a/devtools/client/netmonitor/test/browser_net_icon-preview.js
+++ b/devtools/client/netmonitor/test/browser_net_icon-preview.js
@@ -12,18 +12,16 @@ add_task(function* () {
 
   let { tab, monitor } = yield initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL);
   info("Starting test... ");
 
   let { $, $all, EVENTS, ACTIVITY_TYPE, NetMonitorView, NetMonitorController,
         gStore } = monitor.panelWin;
   let { RequestsMenu } = NetMonitorView;
 
-  RequestsMenu.lazyUpdate = false;
-
   let wait = waitForEvents();
   yield performRequests();
   yield wait;
 
   info("Checking the image thumbnail when all items are shown.");
   checkImageThumbnail();
 
   gStore.dispatch(Actions.sortBy("size"));
--- a/devtools/client/netmonitor/test/browser_net_streaming-response.js
+++ b/devtools/client/netmonitor/test/browser_net_streaming-response.js
@@ -46,19 +46,19 @@ add_task(function* () {
     document.querySelectorAll("#details-pane tab")[3]);
 
   yield panelWin.once(panelWin.EVENTS.RESPONSE_BODY_DISPLAYED);
   let editor = yield NetMonitorView.editor("#response-content-textarea");
 
   // the hls-m3u8 part
   testEditorContent(editor, REQUESTS[0]);
 
-  wait = panelWin.once(panelWin.EVENTS.RESPONSE_BODY_DISPLAYED);
   RequestsMenu.selectedIndex = 1;
-  yield wait;
+  yield panelWin.once(panelWin.EVENTS.TAB_UPDATED);
+  yield panelWin.once(panelWin.EVENTS.RESPONSE_BODY_DISPLAYED);
 
   // the mpeg-dash part
   testEditorContent(editor, REQUESTS[1]);
 
   return teardown(monitor);
 
   function testEditorContent(e, [ fmt, textRe, mode ]) {
     ok(e.getText().match(textRe),