Bug 1333210, r=honzab,ckerschb a=jcristau
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Mon, 23 Jan 2017 22:18:21 +0000
changeset 378045 8d73c486834d5f2dc25c584cb6610e19038f7251
parent 378044 0055af50eaefd44bf5f55745d17c0e86cc710d7d
child 378046 e0080533f0ef9f0fadcdd90f0af1f1a2b1679ac0
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershonzab, ckerschb, jcristau
bugs1333210
milestone53.0a2
Bug 1333210, r=honzab,ckerschb a=jcristau MozReview-Commit-ID: 2Gu8sv36Yyy
devtools/client/jsonview/converter-child.js
devtools/client/jsonview/test/browser_jsonview_valid_json.js
--- a/devtools/client/jsonview/converter-child.js
+++ b/devtools/client/jsonview/converter-child.js
@@ -105,16 +105,20 @@ Converter.prototype = {
     // Sets the charset if it is available. (For documents loaded from the
     // filesystem, this is not set.)
     this.charset =
       request.QueryInterface(Ci.nsIChannel).contentCharset || "UTF-8";
 
     this.channel = request;
     this.channel.contentType = "text/html";
     this.channel.contentCharset = "UTF-8";
+    // 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.
+    this.channel.loadInfo.resetPrincipalsToNullPrincipal();
 
     this.listener.onStartRequest(this.channel, context);
   },
 
   /**
    * This should go something like this:
    * 1. Make sure we have a unicode string.
    * 2. Convert it to a Javascript object.
--- a/devtools/client/jsonview/test/browser_jsonview_valid_json.js
+++ b/devtools/client/jsonview/test/browser_jsonview_valid_json.js
@@ -5,17 +5,19 @@
 
 "use strict";
 
 const TEST_JSON_URL = URL_ROOT + "valid_json.json";
 
 add_task(function* () {
   info("Test valid JSON started");
 
-  yield addJsonViewTab(TEST_JSON_URL);
+  let tab = yield addJsonViewTab(TEST_JSON_URL);
+
+  ok(tab.linkedBrowser.contentPrincipal.isNullPrincipal, "Should have null principal");
 
   let countBefore = yield getElementCount(".jsonPanelBox .treeTable .treeRow");
   ok(countBefore == 3, "There must be three rows");
 
   let objectCellCount = yield getElementCount(
     ".jsonPanelBox .treeTable .objectCell");
   ok(objectCellCount == 1, "There must be one object cell");