Bug 1341589 - Set triggeringPrincipal on history entry for view-source loads. r=gijs, a=lizzard
authorChristoph Kerschbaumer <ckerschb@christophkerschbaumer.com>
Thu, 02 Mar 2017 17:32:02 +0100
changeset 378986 e6da0317da15c446bad3ad5e4e57a506f15d2d81
parent 378985 50b08b8cf6d98a38c427ea6338d088b2d9f8e0ac
child 378987 9f2bf992c9a8ce0b8311b1eead9ac21d6887b287
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)
reviewersgijs, lizzard
bugs1341589
milestone53.0
Bug 1341589 - Set triggeringPrincipal on history entry for view-source loads. r=gijs, a=lizzard
toolkit/components/viewsource/content/viewSource-content.js
--- a/toolkit/components/viewsource/content/viewSource-content.js
+++ b/toolkit/components/viewsource/content/viewSource-content.js
@@ -325,16 +325,18 @@ var ViewSourceContent = {
       return;
     }
 
     let shEntrySource = pageDescriptor.QueryInterface(Ci.nsISHEntry);
     let shEntry = Cc["@mozilla.org/browser/session-history-entry;1"]
                     .createInstance(Ci.nsISHEntry);
     shEntry.setURI(BrowserUtils.makeURI(viewSrcURL, null, null));
     shEntry.setTitle(viewSrcURL);
+    let systemPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
+    shEntry.triggeringPrincipal = systemPrincipal;
     shEntry.loadType = Ci.nsIDocShellLoadInfo.loadHistory;
     shEntry.cacheKey = shEntrySource.cacheKey;
     docShell.QueryInterface(Ci.nsIWebNavigation)
             .sessionHistory
             .QueryInterface(Ci.nsISHistoryInternal)
             .addEntry(shEntry, true);
   },