Bug 1362268 - Get rid of title in JSON Viewer because produced ugly filename when saving. r=Honza
authorOriol <oriol-bugzilla@hotmail.com>
Thu, 04 May 2017 20:20:00 -0400
changeset 356991 cd18a17db3156e8deb15bf1bfee01d8b5209f71a
parent 356990 aa5d21723b5592784780bd76d88d2ad00ac1e48f
child 356992 844ef25e35bb83515dee2fc36f6eb7fde68c1a77
push id31778
push usercbook@mozilla.com
push dateMon, 08 May 2017 08:07:41 +0000
treeherdermozilla-central@1fda52a1f3b8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersHonza
bugs1362268
milestone55.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 1362268 - Get rid of title in JSON Viewer because produced ugly filename when saving. r=Honza
devtools/client/jsonview/converter-child.js
--- a/devtools/client/jsonview/converter-child.js
+++ b/devtools/client/jsonview/converter-child.js
@@ -160,20 +160,20 @@ Converter.prototype = {
         }
       });
     }
 
     let outputDoc = "";
 
     try {
       headers = JSON.stringify(headers);
-      outputDoc = this.toHTML(this.data, headers, this.uri);
+      outputDoc = this.toHTML(this.data, headers);
     } catch (e) {
       console.error("JSON Viewer ERROR " + e);
-      outputDoc = this.toErrorPage(e, this.data, this.uri);
+      outputDoc = this.toErrorPage(e, this.data);
     }
 
     let storage = Cc["@mozilla.org/storagestream;1"]
       .createInstance(Ci.nsIStorageStream);
 
     storage.init(SEGMENT_SIZE, 0xffffffff, null);
     let out = storage.getOutputStream(0);
 
@@ -200,17 +200,17 @@ Converter.prototype = {
   htmlEncode: function (t) {
     return t !== null ? t.toString()
       .replace(/&/g, "&amp;")
       .replace(/"/g, "&quot;")
       .replace(/</g, "&lt;")
       .replace(/>/g, "&gt;") : "";
   },
 
-  toHTML: function (json, headers, title) {
+  toHTML: function (json, headers) {
     let themeClassName = "theme-" + JsonViewUtils.getCurrentTheme();
     let clientBaseUrl = "resource://devtools/client/";
     let baseUrl = clientBaseUrl + "jsonview/";
     let themeVarsUrl = clientBaseUrl + "themes/variables.css";
     let commonUrl = clientBaseUrl + "themes/common.css";
     let toolbarsUrl = clientBaseUrl + "themes/toolbars.css";
 
     let os;
@@ -223,51 +223,51 @@ Converter.prototype = {
       os = "linux";
     }
 
     let dir = Services.locale.isAppLocaleRTL ? "rtl" : "ltr";
 
     return "<!DOCTYPE html>\n" +
       "<html platform=\"" + os + "\" class=\"" + themeClassName +
         "\" dir=\"" + dir + "\">" +
-      "<head><title>" + this.htmlEncode(title) + "</title>" +
+      "<head>" +
       "<base href=\"" + this.htmlEncode(baseUrl) + "\">" +
       "<link rel=\"stylesheet\" type=\"text/css\" href=\"" +
         themeVarsUrl + "\">" +
       "<link rel=\"stylesheet\" type=\"text/css\" href=\"" +
         commonUrl + "\">" +
       "<link rel=\"stylesheet\" type=\"text/css\" href=\"" +
         toolbarsUrl + "\">" +
       "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/main.css\">" +
       "<script data-main=\"viewer-config\" src=\"lib/require.js\"></script>" +
       "</head><body>" +
       "<div id=\"content\"></div>" +
       "<div id=\"json\">" + this.htmlEncode(json) + "</div>" +
       "<div id=\"headers\">" + this.htmlEncode(headers) + "</div>" +
       "</body></html>";
   },
 
-  toErrorPage: function (error, data, uri) {
+  toErrorPage: function (error, data) {
     // Escape unicode nulls
     data = data.replace("\u0000", "\uFFFD");
 
     let errorInfo = error + "";
 
     let output = "<div id=\"error\">" + "error parsing";
     if (errorInfo.message) {
       output += "<div class=\"errormessage\">" + errorInfo.message + "</div>";
     }
 
     output += "</div><div id=\"json\">" + this.highlightError(data,
       errorInfo.line, errorInfo.column) + "</div>";
 
     let dir = Services.locale.isAppLocaleRTL ? "rtl" : "ltr";
 
     return "<!DOCTYPE html>\n" +
-      "<html><head><title>" + this.htmlEncode(uri + " - Error") + "</title>" +
+      "<html><head>" +
       "<base href=\"" + this.htmlEncode(this.data.url()) + "\">" +
       "</head><body dir=\"" + dir + "\">" +
       output +
       "</body></html>";
   },
 
   // Chrome <-> Content communication