Port bug 1587062 - Move SandboxFlags from DocShell to BrowsingContext. rs=bustage-fix
authorJorg K <jorgk@jorgk.com>
Mon, 28 Oct 2019 19:04:45 +0100
changeset 37376 6797b9e2d931c09eded207fb833579a86b3c4c27
parent 37375 7e30a34a0d7f9b3e66741548d7a44e9488ec3e16
child 37377 eed3e970361e97ddefd899e871270cbeb0c76ac4
push id396
push userclokep@gmail.com
push dateMon, 06 Jan 2020 23:11:57 +0000
reviewersbustage-fix
bugs1587062
Port bug 1587062 - Move SandboxFlags from DocShell to BrowsingContext. rs=bustage-fix
mailnews/base/src/nsMsgContentPolicy.cpp
--- a/mailnews/base/src/nsMsgContentPolicy.cpp
+++ b/mailnews/base/src/nsMsgContentPolicy.cpp
@@ -813,22 +813,20 @@ nsresult nsMsgContentPolicy::SetDisableI
 
   if (!isAllowedContent) {
     // Disable JavaScript on message URLs.
     rv = docShell->SetAllowJavascript(false);
     NS_ENSURE_SUCCESS(rv, rv);
     rv = docShell->SetAllowContentRetargetingOnChildren(false);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    uint32_t sandboxFlags;
-    rv = docShell->GetSandboxFlags(&sandboxFlags);
-    sandboxFlags |= SANDBOXED_FORMS;
-    NS_ENSURE_SUCCESS(rv, rv);
-    rv = docShell->SetSandboxFlags(sandboxFlags);
-    NS_ENSURE_SUCCESS(rv, rv);
+    RefPtr<mozilla::dom::BrowsingContext> browsingContext =
+        docShell->GetBrowsingContext();
+    browsingContext->SetSandboxFlags(browsingContext->GetSandboxFlags() |
+                                     SANDBOXED_FORMS);
   } else {
     // JavaScript is allowed on non-message URLs.
     rv = docShell->SetAllowJavascript(true);
     NS_ENSURE_SUCCESS(rv, rv);
     rv = docShell->SetAllowContentRetargetingOnChildren(true);
     NS_ENSURE_SUCCESS(rv, rv);
   }