Bug 1319009 - View Source shows a blank New Tab with a forced charset. r=mconley, r=mossop, a=jcristau
authorMarco Bonardo <mbonardo@mozilla.com>
Mon, 21 Nov 2016 18:32:27 +0100
changeset 367645 50ad21cb103d067ebc2bb9ba894a2b81477a7f65
parent 367644 e2b684e88818351936e88bb8f1135a9826d89a32
child 367646 be41fbd836e36b4a85d3889fc87ac3382f5cdf43
push id1369
push userjlorenzo@mozilla.com
push dateMon, 27 Feb 2017 14:59:41 +0000
treeherdermozilla-release@d75a1dba431f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley, mossop, jcristau
bugs1319009
milestone52.0a2
Bug 1319009 - View Source shows a blank New Tab with a forced charset. r=mconley, r=mossop, a=jcristau MozReview-Commit-ID: 7P7gdH8Ltmm
toolkit/components/viewsource/content/viewSource-content.js
--- a/toolkit/components/viewsource/content/viewSource-content.js
+++ b/toolkit/components/viewsource/content/viewSource-content.js
@@ -286,17 +286,19 @@ var ViewSourceContent = {
    *        loading.
    * @param forcedCharSet (optional)
    *        The document character set to use instead of the default one.
    */
   loadSource(URL, pageDescriptor, lineNumber, forcedCharSet) {
     const viewSrcURL = "view-source:" + URL;
 
     if (forcedCharSet) {
-      docShell.charset = forcedCharSet;
+      try {
+        docShell.charset = forcedCharSet;
+      } catch (e) { /* invalid charset */ }
     }
 
     if (lineNumber && lineNumber > 0) {
       let doneLoading = (event) => {
         // Ignore possible initial load of about:blank
         if (this.isAboutBlank ||
             !content.document.body) {
           return;