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

--HG--
extra : rebase_source : 51211b7aee13eabc71f91e73df4fc6d69e5c624b
This commit is contained in:
Mike de Boer 2017-10-10 19:14:01 +02:00
Родитель 5171c16eb0
Коммит e729ce7f9a
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -222,7 +222,11 @@ RemoteWebProgressManager.prototype = {
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;
}