Bug 1359204 - Use SystemPrincipal as TriggeringPrincipal when loading page as view-source. r=bz a=gchang
authorChristoph Kerschbaumer <ckerschb@christophkerschbaumer.com>
Wed, 10 May 2017 18:43:04 +0200
changeset 581834 1c5f3f6b6dc2e1eba5abbfae2c2d083618c6adb7
parent 581833 3ee9312263c7ffcc83949291181a12b0de0e56c7
child 581835 a2a06bf22eaddd2d59da7c8a61e328f9587ca3cd
push id59898
push userfmarier@mozilla.com
push dateFri, 19 May 2017 23:56:54 +0000
reviewersbz, gchang
bugs1359204
milestone54.0
Bug 1359204 - Use SystemPrincipal as TriggeringPrincipal when loading page as view-source. r=bz a=gchang
docshell/base/nsDocShell.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -5663,16 +5663,21 @@ nsDocShell::LoadPage(nsISupports* aPageD
     newSpec.Append(spec);
 
     rv = NS_NewURI(getter_AddRefs(newUri), newSpec);
     if (NS_FAILED(rv)) {
       return rv;
     }
     shEntry->SetURI(newUri);
     shEntry->SetOriginalURI(nullptr);
+    // shEntry's current triggering principal is whoever loaded that page initially.
+    // But now we're doing another load of the page, via an API that is only exposed
+    // to system code.  The triggering principal for this load should be the system
+    // principal.
+    shEntry->SetTriggeringPrincipal(nsContentUtils::GetSystemPrincipal());
   }
 
   rv = LoadHistoryEntry(shEntry, LOAD_HISTORY);
   return rv;
 }
 
 NS_IMETHODIMP
 nsDocShell::GetCurrentDescriptor(nsISupports** aPageDescriptor)