Bug 1021156 - Ignore Content-Disposition attachment for OMA FL DRM files on B2G. r=bz
authorAntonio M. Amaya <amac@tid.es>
Wed, 18 Jun 2014 02:47:00 -0400
changeset 189369 bfc6270f98fe47d8be2caad04b642b5988d44d75
parent 189368 08237be918f56e92545a4adbcbdad7fd7c8562d6
child 189370 7c41391a9bc7cdbbed3a2cc054676b1d162aaeb6
push id26985
push userryanvm@gmail.com
push dateWed, 18 Jun 2014 19:59:44 +0000
treeherdermozilla-central@00d973a0bdbf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1021156
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1021156 - Ignore Content-Disposition attachment for OMA FL DRM files on B2G. r=bz
uriloader/base/nsURILoader.cpp
--- a/uriloader/base/nsURILoader.cpp
+++ b/uriloader/base/nsURILoader.cpp
@@ -362,21 +362,36 @@ nsresult nsDocumentOpenInfo::DispatchCon
 
   // Check whether the data should be forced to be handled externally.  This
   // could happen because the Content-Disposition header is set so, or, in the
   // future, because the user has specified external handling for the MIME
   // type.
   bool forceExternalHandling = false;
   uint32_t disposition;
   rv = aChannel->GetContentDisposition(&disposition);
-  if (NS_SUCCEEDED(rv) && disposition == nsIChannel::DISPOSITION_ATTACHMENT)
+
+  bool allowContentDispositionToForceExternalHandling = true;
+
+#ifdef MOZ_B2G
+
+  // On B2G, OMA content files should never be handled by an external handler
+  // (even if the server specifies Content-Disposition: attachment) because the
+  // data should never be stored on an unencrypted form.
+  allowContentDispositionToForceExternalHandling =
+    !mContentType.LowerCaseEqualsASCII("application/vnd.oma.drm.message");
+
+#endif
+
+  if (NS_SUCCEEDED(rv) && (disposition == nsIChannel::DISPOSITION_ATTACHMENT) &&
+      allowContentDispositionToForceExternalHandling) {
     forceExternalHandling = true;
+  }
 
   LOG(("  forceExternalHandling: %s", forceExternalHandling ? "yes" : "no"));
-    
+
   // We're going to try to find a contentListener that can handle our data
   nsCOMPtr<nsIURIContentListener> contentListener;
   // The type or data the contentListener wants.
   nsXPIDLCString desiredContentType;
 
   if (!forceExternalHandling)
   {
     //