Bug 1319009 - View Source shows a blank New Tab with a forced charset. r=standard8
MozReview-Commit-ID: 7P7gdH8Ltmm
--- 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;