Backed out 2 changesets (bug 1442840) for mochitest devtools failures on devtools/client/jsonview/test/browser_jsonview_url_linkification.js. a=backout
authorCosmin Sabou <csabou@mozilla.com>
Mon, 26 Mar 2018 05:53:44 +0300
changeset 462829 357a7ece1bc2777de4e3f56d60df4a0ab589eada
parent 462828 090520707f4da8ebdca18bd71ade9306851b1677
child 462830 70dcf4f4efa51f6fad39e8e302fc7ef8f667870a
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1442840
milestone60.0
backs out72465600d1f27690cbf3a73bacba075d88cf97ef
f1238ac69cfd801abc49b7b0db7ef9a6ee48ecdd
Backed out 2 changesets (bug 1442840) for mochitest devtools failures on devtools/client/jsonview/test/browser_jsonview_url_linkification.js. a=backout Backed out changeset 72465600d1f2 (bug 1442840) Backed out changeset f1238ac69cfd (bug 1442840)
devtools/client/jsonview/components/JsonPanel.js
devtools/client/jsonview/converter-child.js
--- a/devtools/client/jsonview/components/JsonPanel.js
+++ b/devtools/client/jsonview/components/JsonPanel.js
@@ -83,24 +83,17 @@ define(function (require, exports, modul
       if (isObject(member.value) && member.hasChildren && member.open) {
         return null;
       }
 
       // Render the value (summary) using Reps library.
       return Rep(Object.assign({}, props, {
         cropLimit: 50,
         noGrip: true,
-        openLink(str) {
-          try {
-            let u = new URL(str);
-            if (u.protocol == "https:" || u.protocol == "http:") {
-              window.open(str, "_blank");
-            }
-          } catch (ex) { /* the link might be bust, then we do nothing */ }
-        },
+        omitLinkHref: false,
       }));
     }
 
     renderTree() {
       // Append custom column for displaying values. This column
       // Take all available horizontal space.
       let columns = [{
         id: "value",
--- a/devtools/client/jsonview/converter-child.js
+++ b/devtools/client/jsonview/converter-child.js
@@ -77,37 +77,32 @@ Converter.prototype = {
   },
 
   onStartRequest: function (request, context) {
     // Set the content type to HTML in order to parse the doctype, styles
     // and scripts. The JSON will be manually inserted as text.
     request.QueryInterface(Ci.nsIChannel);
     request.contentType = "text/html";
 
-    // Enforce strict CSP:
-    try {
-      request.QueryInterface(Ci.nsIHttpChannel);
-      request.setResponseHeader("Content-Security-Policy",
-        "default-src 'none' ; script-src resource:; ", false);
-    } catch (ex) {
-      // If this is not an HTTP channel we can't and won't do anything.
-    }
-
     // Don't honor the charset parameter and use UTF-8 (see bug 741776).
     request.contentCharset = "UTF-8";
     this.decoder = new TextDecoder("UTF-8");
 
     // Changing the content type breaks saving functionality. Fix it.
     fixSave(request);
 
     // Because content might still have a reference to this window,
     // force setting it to a null principal to avoid it being same-
     // origin with (other) content.
     request.loadInfo.resetPrincipalToInheritToNullPrincipal();
 
+    // Because the JSON might be served with a CSP, we instrument
+    // the loadinfo so the Document can discard such a CSP.
+    request.loadInfo.allowDocumentToBeAgnosticToCSP = true;
+
     // Start the request.
     this.listener.onStartRequest(request, context);
 
     // Initialize stuff.
     let win = NetworkHelper.getWindowForRequest(request);
     this.data = exportData(win, request);
     insertJsonData(win, this.data.json);
     win.addEventListener("contentMessage", onContentMessage, false, true);