Bug 1397989 - Make sure to only set non-empty values as the content-type of a document in the remote browser binding. r=mconley, a=ritu
authorMike de Boer <mdeboer@mozilla.com>
Tue, 10 Oct 2017 19:14:01 +0200
changeset 432404 250948dc4a6bd4316f128c089ba43abf3d1e87bf
parent 432403 0c7a2975f0a63bb2826b6b556c7bdfc345fddcaf
child 432405 c609f1155d1633d0a9540fad22e6abec3fe59278
push id7950
push userryanvm@gmail.com
push dateThu, 12 Oct 2017 01:17:29 +0000
treeherdermozilla-beta@98a72bed57b7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley, ritu
bugs1397989
milestone57.0
Bug 1397989 - Make sure to only set non-empty values as the content-type of a document in the remote browser binding. r=mconley, a=ritu What happens is the following: - browser-child.js sends a statechange up to RemoteWebProgress.jsm that contains a `documentContentType` value of `null`, along with `requestURI` and `originalRequestURI` _after_ other state changes that did send a valid content-type. - The content-type is used by the WebProgressListener in browser.js to toggle the disabled state of the 'isImage' broadcaster. - The 'isImage' broadcaster is used by the 'cmd_find' and 'cmd_findAgain' commands to determine whether they should be enabled. In this case: not. The fix here is to _not_ set the documentContentType in the browser binding when it's `null`. MozReview-Commit-ID: IELoCrnOH0j
toolkit/modules/RemoteWebProgress.jsm
--- a/toolkit/modules/RemoteWebProgress.jsm
+++ b/toolkit/modules/RemoteWebProgress.jsm
@@ -217,17 +217,21 @@ RemoteWebProgressManager.prototype = {
     if (json.requestURI) {
       request = new RemoteWebProgressRequest(json.requestURI,
                                              json.originalRequestURI,
                                              objects.request);
     }
 
     if (isTopLevel) {
       this._browser._contentWindow = objects.contentWindow;
-      this._browser._documentContentType = json.documentContentType;
+      // Setting a content-type back to `null` is quite nonsensical for the
+      // frontend, especially since we're not expecting it.
+      if (json.documentContentType !== null) {
+        this._browser._documentContentType = json.documentContentType;
+      }
       if (typeof json.inLoadURI != "undefined") {
         this._browser.inLoadURI = json.inLoadURI;
       }
       if (json.charset) {
         this._browser._characterSet = json.charset;
         this._browser._mayEnableCharacterEncodingMenu = json.mayEnableCharacterEncodingMenu;
       }
     }