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
--- 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;
}
}