Bug 1328847 - Part 2: Change SEC_NORMAL to SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL where null principal is used. rs=bustage-fix
authorJorg K <jorgk@jorgk.com>
Thu, 05 Jan 2017 08:25:00 +0100
changeset 20964 efaa986897703cad3db5558fd266ba769be08541
parent 20963 3796ede640a571f0fd962c8d906f87fd9cafed52
child 20965 1d934dcb80bcf60a56355e5b981de7bf3b25a902
push id12713
push usermozilla@jorgk.com
push dateThu, 05 Jan 2017 21:53:09 +0000
treeherdercomm-central@1d934dcb80bc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbustage-fix
bugs1328847
Bug 1328847 - Part 2: Change SEC_NORMAL to SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL where null principal is used. rs=bustage-fix
mailnews/addrbook/src/nsAbContentHandler.cpp
mailnews/addrbook/src/nsAddbookProtocolHandler.cpp
mailnews/base/src/nsMessenger.cpp
mailnews/compose/src/nsMsgAttachmentHandler.cpp
mailnews/compose/src/nsMsgComposeService.cpp
mailnews/compose/src/nsSmtpService.cpp
mailnews/compose/src/nsURLFetcher.cpp
mailnews/imap/src/nsImapProtocol.cpp
--- a/mailnews/addrbook/src/nsAbContentHandler.cpp
+++ b/mailnews/addrbook/src/nsAbContentHandler.cpp
@@ -120,17 +120,17 @@ nsAbContentHandler::HandleContent(const 
     NS_ENSURE_SUCCESS(rv, rv);
 
     // create a stream loader to handle the v-card data
     nsCOMPtr<nsIStreamLoader> streamLoader;
     rv = NS_NewStreamLoader(getter_AddRefs(streamLoader),
                             uri,
                             this,
                             nullPrincipal,
-                            nsILoadInfo::SEC_NORMAL,
+                            nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
                             nsIContentPolicy::TYPE_OTHER);
     NS_ENSURE_SUCCESS(rv, rv);
 
   }
   else // The content-type was not application/x-addvcard...
     return NS_ERROR_WONT_HANDLE_CONTENT;
 
   return rv;
--- a/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp
+++ b/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp
@@ -109,18 +109,21 @@ nsAddbookProtocolHandler::GenerateXMLOut
   }
 
   nsCOMPtr<nsIPrincipal> nullPrincipal =
     do_CreateInstance("@mozilla.org/nullprincipal;1", &rv);
   NS_ASSERTION(NS_SUCCEEDED(rv), "CreateInstance of nullprincipalfailed.");
   if (NS_FAILED(rv))
       return rv;
 
-  return NS_NewInputStreamChannel(_retval, aURI, inStr,
-                                  nullPrincipal, nsILoadInfo::SEC_NORMAL,
+  return NS_NewInputStreamChannel(_retval,
+                                  aURI,
+                                  inStr,
+                                  nullPrincipal,
+                                  nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
                                   nsIContentPolicy::TYPE_OTHER,
                                   NS_LITERAL_CSTRING("text/xml"));
 }
 
 NS_IMETHODIMP
 nsAddbookProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **_retval)
 {
   return NewChannel2(aURI, nullptr, _retval);
@@ -174,20 +177,24 @@ nsAddbookProtocolHandler::NewChannel2(ns
                                                 aLoadInfo);
       }
 
       nsCOMPtr<nsIPrincipal> nullPrincipal =
         do_CreateInstance("@mozilla.org/nullprincipal;1", &rv);
       NS_ASSERTION(NS_SUCCEEDED(rv), "CreateInstance of nullprincipal failed.");
       if (NS_FAILED(rv))
           return rv;
-      
-      return NS_NewInputStreamChannel(_retval, aURI, pipeIn,
-          nullPrincipal, nsILoadInfo::SEC_NORMAL, nsIContentPolicy::TYPE_OTHER,
-          NS_LITERAL_CSTRING("application/x-addvcard"));
+
+      return NS_NewInputStreamChannel(_retval,
+                                      aURI,
+                                      pipeIn,
+                                      nullPrincipal,
+                                      nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+                                      nsIContentPolicy::TYPE_OTHER,
+                                      NS_LITERAL_CSTRING("application/x-addvcard"));
   }
 
   nsString output;
   rv = GeneratePrintOutput(addbookUrl, output);
   if (NS_FAILED(rv)) {
     output.AssignLiteral("failed to print. url=");
     nsAutoCString spec;
     rv = aURI->GetSpec(spec);
--- a/mailnews/base/src/nsMessenger.cpp
+++ b/mailnews/base/src/nsMessenger.cpp
@@ -1103,17 +1103,17 @@ nsMessenger::SaveAs(const nsACString& aU
       if (NS_FAILED(rv))
         goto done;
 
       saveListener->m_channel = nullptr;
       rv = NS_NewInputStreamChannel(getter_AddRefs(saveListener->m_channel),
                                     url,
                                     nullptr,
                                     nullPrincipal,
-                                    nsILoadInfo::SEC_NORMAL,
+                                    nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
                                     nsIContentPolicy::TYPE_OTHER);
       NS_ASSERTION(NS_SUCCEEDED(rv), "NS_NewChannel failed");
       if (NS_FAILED(rv))
         goto done;
 
       nsCOMPtr<nsIStreamConverterService> streamConverterService = do_GetService("@mozilla.org/streamConverters;1");
       nsCOMPtr<nsISupports> channelSupport = do_QueryInterface(saveListener->m_channel);
 
--- a/mailnews/compose/src/nsMsgAttachmentHandler.cpp
+++ b/mailnews/compose/src/nsMsgAttachmentHandler.cpp
@@ -656,17 +656,17 @@ nsMsgAttachmentHandler::SnarfMsgAttachme
       NS_ASSERTION(NS_SUCCEEDED(rv), "CreateInstance of nullprincipal failed.");
       if (NS_FAILED(rv))
         goto done;
 
       rv = NS_NewInputStreamChannel(getter_AddRefs(m_converter_channel),
                                     aURL,
                                     nullptr,
                                     nullPrincipal,
-                                    nsILoadInfo::SEC_NORMAL,
+                                    nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
                                     nsIContentPolicy::TYPE_OTHER);
       if (NS_FAILED(rv))
         goto done;
 
       rv = m_mime_parser->AsyncConvertData("message/rfc822", "message/rfc822",
                                            strListener, m_converter_channel);
       if (NS_FAILED(rv))
         goto done;
--- a/mailnews/compose/src/nsMsgComposeService.cpp
+++ b/mailnews/compose/src/nsMsgComposeService.cpp
@@ -1347,21 +1347,21 @@ nsMsgComposeService::RunMessageThroughMi
   nsCOMPtr<nsIPrincipal> nullPrincipal =
     do_CreateInstance("@mozilla.org/nullprincipal;1", &rv);
   NS_ASSERTION(NS_SUCCEEDED(rv), "CreateInstance of nullprincipal failed");
   if (NS_FAILED(rv))
     return rv;
 
   nsCOMPtr<nsIChannel> channel;
   rv = NS_NewInputStreamChannel(getter_AddRefs(channel),
-                     url,
-                     nullptr,
-                     nullPrincipal,
-                     nsILoadInfo::SEC_NORMAL,
-                     nsIContentPolicy::TYPE_OTHER);
+                                url,
+                                nullptr,
+                                nullPrincipal,
+                                nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+                                nsIContentPolicy::TYPE_OTHER);
   NS_ASSERTION(NS_SUCCEEDED(rv), "NS_NewChannel failed.");
   if (NS_FAILED(rv))
     return rv;
 
   nsCOMPtr<nsIStreamConverter> converter = do_QueryInterface(mimeConverter);
   rv = converter->AsyncConvertData(nullptr, nullptr, nullptr, channel);
   NS_ENSURE_SUCCESS(rv, rv);
 
--- a/mailnews/compose/src/nsSmtpService.cpp
+++ b/mailnews/compose/src/nsSmtpService.cpp
@@ -352,18 +352,21 @@ NS_IMETHODIMP nsSmtpService::NewChannel2
   }
 
   nsCOMPtr<nsIPrincipal> nullPrincipal =
     do_CreateInstance("@mozilla.org/nullprincipal;1", &rv);
   NS_ASSERTION(NS_SUCCEEDED(rv), "CreateInstance of nullprincipal failed.");
   if (NS_FAILED(rv))
     return rv;
 
-  return NS_NewInputStreamChannel(_retval, aURI, pipeIn,
-                                  nullPrincipal, nsILoadInfo::SEC_NORMAL,
+  return NS_NewInputStreamChannel(_retval,
+                                  aURI,
+                                  pipeIn,
+                                  nullPrincipal,
+                                  nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
                                   nsIContentPolicy::TYPE_OTHER,
                                   NS_LITERAL_CSTRING("application/x-mailto"));
 }
 
 NS_IMETHODIMP
 nsSmtpService::GetServers(nsISimpleEnumerator **aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
--- a/mailnews/compose/src/nsURLFetcher.cpp
+++ b/mailnews/compose/src/nsURLFetcher.cpp
@@ -320,17 +320,17 @@ nsURLFetcher::FireURLRequest(nsIURI *aUR
   nsCOMPtr<nsIPrincipal> nullPrincipal =
     do_CreateInstance("@mozilla.org/nullprincipal;1", &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIChannel> channel;
   rv = NS_NewChannel(getter_AddRefs(channel),
                      aURL,
                      nullPrincipal,
-                     nsILoadInfo::SEC_NORMAL,
+                     nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
                      nsIContentPolicy::TYPE_OTHER,
                      nullptr, // aLoadGroup
                      this); // aCallbacks
   NS_ENSURE_SUCCESS(rv, rv);
 
   return pURILoader->OpenURI(channel, false, this);
 }
 
--- a/mailnews/imap/src/nsImapProtocol.cpp
+++ b/mailnews/imap/src/nsImapProtocol.cpp
@@ -723,17 +723,17 @@ nsresult nsImapProtocol::SetupWithUrl(ns
       NS_ENSURE_SUCCESS(rv, rv);
 
       // there are several imap operations that aren't initiated via a nsIChannel::AsyncOpen call on the mock channel.
       // such as selecting a folder. nsImapProtocol now insists on a mock channel when processing a url.
       nsCOMPtr<nsIChannel> channel;
       rv = NS_NewChannel(getter_AddRefs(channel),
                          aURL,
                          nullPrincipal,
-                         nsILoadInfo::SEC_NORMAL,
+                         nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
                          nsIContentPolicy::TYPE_OTHER);
       m_mockChannel = do_QueryInterface(channel);
 
       // Certain imap operations (not initiated by the IO Service via AsyncOpen) can be interrupted by  the stop button on the toolbar.
       // We do this by using the loadgroup of the docshell for the message pane. We really shouldn't be doing this..
       // See the comment in nsMsgMailNewsUrl::GetLoadGroup.
       nsCOMPtr<nsILoadGroup> loadGroup;
       mailnewsUrl->GetLoadGroup(getter_AddRefs(loadGroup)); // get the message pane load group