Bug 1293476 - Decouple URI_SAFE_TO_LOAD_IN_SECURE_CONTEXT and MAKE_LINKABLE. r=dveditz, a=gchang
authorHenry Chang <hchang@mozilla.com>
Mon, 15 Aug 2016 16:22:59 +0800
changeset 350025 2031351aaad91af6de7d332f05af8c135d243054
parent 350024 06a16c8ce5546898a555b971ba291d3b87414c5b
child 350026 7521a722866717c7bc4665c3a1f5d3882f52dc05
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdveditz, gchang
bugs1293476
milestone50.0a2
Bug 1293476 - Decouple URI_SAFE_TO_LOAD_IN_SECURE_CONTEXT and MAKE_LINKABLE. r=dveditz, a=gchang MozReview-Commit-ID: FZEemKDafEg
netwerk/protocol/about/nsAboutProtocolHandler.cpp
--- a/netwerk/protocol/about/nsAboutProtocolHandler.cpp
+++ b/netwerk/protocol/about/nsAboutProtocolHandler.cpp
@@ -84,21 +84,27 @@ nsAboutProtocolHandler::GetFlagsForURI(n
       // Swallow this and just tell the consumer the default:
       return NS_OK;
     }
     uint32_t aboutModuleFlags = 0;
     rv = aboutMod->GetURIFlags(aURI, &aboutModuleFlags);
     // This should never happen, so pass back the error:
     NS_ENSURE_SUCCESS(rv, rv);
 
-    // If marked as safe, and marked linkable, pass 'safe' flags.
-    if ((aboutModuleFlags & nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT) &&
-        (aboutModuleFlags & nsIAboutModule::MAKE_LINKABLE)) {
-        *aFlags = URI_NORELATIVE | URI_NOAUTH | URI_LOADABLE_BY_ANYONE |
-            URI_SAFE_TO_LOAD_IN_SECURE_CONTEXT;
+    // Secure (https) pages can load safe about pages without becoming
+    // mixed content.
+    if (aboutModuleFlags & nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT) {
+        *aFlags |= URI_SAFE_TO_LOAD_IN_SECURE_CONTEXT;
+        // about: pages can only be loaded by unprivileged principals
+        // if they are marked as LINKABLE
+        if (aboutModuleFlags & nsIAboutModule::MAKE_LINKABLE) {
+            // Replace URI_DANGEROUS_TO_LOAD with URI_LOADABLE_BY_ANYONE.
+            *aFlags &= ~URI_DANGEROUS_TO_LOAD;
+            *aFlags |= URI_LOADABLE_BY_ANYONE;
+        }
     }
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAboutProtocolHandler::NewURI(const nsACString &aSpec,
                                const char *aCharset, // ignore charset info
                                nsIURI *aBaseURI,