Bug 1397989 - Make sure to only set non-empty values as the content-type of a document in the remote browser binding. r=mconley
authorMike de Boer <mdeboer@mozilla.com>
Tue, 10 Oct 2017 19:14:01 +0200
changeset 385348 4c86b1f93b8482ea3097a4edb51bb8c0e8dc67fc
parent 385347 5a90656e4da6b9d2979f77fc12a911b0b894bef0
child 385349 f580e00e8f62b7c53844d97948b396e6a1752f7f
push id32652
push userarchaeopteryx@coole-files.de
push dateTue, 10 Oct 2017 21:49:31 +0000
treeherdermozilla-central@f1ecd5c26948 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1397989
milestone58.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 1397989 - Make sure to only set non-empty values as the content-type of a document in the remote browser binding. r=mconley 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;
       }
     }