Bug 1517057 - Part 1: Remove support for the unused URI_FORBIDS_COOKIE_ACCESS protocol flag; r=baku
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 02 Jan 2019 15:42:08 +0000
changeset 509375 23a0332b18a1ed07e9ad20eaf1920c79dcf58849
parent 509374 13ddff9cd72f3245d4552f035f45da4caa3f36d1
child 509376 1da34ff3bc95118f93db519784d9e60368e7aade
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1517057
milestone66.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 1517057 - Part 1: Remove support for the unused URI_FORBIDS_COOKIE_ACCESS protocol flag; r=baku Differential Revision: https://phabricator.services.mozilla.com/D15547
extensions/cookie/nsCookiePermission.cpp
netwerk/base/nsIProtocolHandler.idl
--- a/extensions/cookie/nsCookiePermission.cpp
+++ b/extensions/cookie/nsCookiePermission.cpp
@@ -108,33 +108,22 @@ nsCookiePermission::SetAccess(nsIURI *aU
   //
   return mPermMgr->Add(aURI, kPermissionType, aAccess,
                        nsIPermissionManager::EXPIRE_NEVER, 0);
 }
 
 NS_IMETHODIMP
 nsCookiePermission::CanAccess(nsIPrincipal *aPrincipal,
                               nsCookieAccess *aResult) {
-  // Check this protocol doesn't allow cookies
-  bool hasFlags;
-  nsCOMPtr<nsIURI> uri;
-  aPrincipal->GetURI(getter_AddRefs(uri));
-  nsresult rv = NS_URIChainHasFlags(
-      uri, nsIProtocolHandler::URI_FORBIDS_COOKIE_ACCESS, &hasFlags);
-  if (NS_FAILED(rv) || hasFlags) {
-    *aResult = ACCESS_DENY;
-    return NS_OK;
-  }
-
   // Lazily initialize ourselves
   if (!EnsureInitialized()) return NS_ERROR_UNEXPECTED;
 
   // finally, check with permission manager...
-  rv = mPermMgr->TestPermissionFromPrincipal(aPrincipal, kPermissionType,
-                                             (uint32_t *)aResult);
+  nsresult rv = mPermMgr->TestPermissionFromPrincipal(
+      aPrincipal, kPermissionType, (uint32_t *)aResult);
   if (NS_SUCCEEDED(rv)) {
     if (*aResult == nsICookiePermission::ACCESS_SESSION) {
       *aResult = nsICookiePermission::ACCESS_ALLOW;
     }
   }
 
   return rv;
 }
--- a/netwerk/base/nsIProtocolHandler.idl
+++ b/netwerk/base/nsIProtocolHandler.idl
@@ -279,61 +279,55 @@ interface nsIProtocolHandler : nsISuppor
 
     /**
      * Loading channels from this protocol has side-effects that make
      * it unsuitable for saving to a local file.
      */
     const unsigned long URI_NON_PERSISTABLE = (1<<14);
 
     /**
-     * This protocol handler forbids accessing cookies e.g. for mail related
-     * protocols.
-     */
-    const unsigned long URI_FORBIDS_COOKIE_ACCESS = (1<<15);
-
-    /**
      * URIs for this protocol require the webapps permission on the principal
      * when opening URIs for a different domain. See bug#773886
      */
-    const unsigned long URI_CROSS_ORIGIN_NEEDS_WEBAPPS_PERM = (1<<16);
+    const unsigned long URI_CROSS_ORIGIN_NEEDS_WEBAPPS_PERM = (1<<15);
 
     /**
      * Channels for this protocol don't need to spin the event loop to handle
      * Open() and reads on the resulting stream.
      */
-    const unsigned long URI_SYNC_LOAD_IS_OK = (1<<17);
+    const unsigned long URI_SYNC_LOAD_IS_OK = (1<<16);
 
     /**
      * All the origins whose URI has this scheme are considered potentially
      * trustworthy.
      * Per the SecureContext spec, https: and wss: should be considered
      * a priori secure, and implementations may consider other,
      * implementation-specific URI schemes as secure.
      */
-    const unsigned long URI_IS_POTENTIALLY_TRUSTWORTHY = (1<<18);
+    const unsigned long URI_IS_POTENTIALLY_TRUSTWORTHY = (1<<17);
 
     /**
      * This URI may be fetched and the contents are visible to anyone. This is
      * semantically equivalent to the resource being served with all-access CORS
      * headers.
      */
-    const unsigned long URI_FETCHABLE_BY_ANYONE = (1 << 19);
+    const unsigned long URI_FETCHABLE_BY_ANYONE = (1 << 18);
 
     /**
      * If this flag is set, then the origin for this protocol is the full URI
      * spec, not just the scheme + host + port.
      *
      * Note: this is not supported in Firefox.  It is currently only available
      * in Thunderbird and SeaMonkey.
      */
-    const unsigned long ORIGIN_IS_FULL_SPEC = (1 << 20);
+    const unsigned long ORIGIN_IS_FULL_SPEC = (1 << 19);
 
     /**
      * If this flag is set, the URI does not always allow content using the same
      * protocol to link to it.
      */
-    const unsigned long URI_SCHEME_NOT_SELF_LINKABLE = (1 << 21);
+    const unsigned long URI_SCHEME_NOT_SELF_LINKABLE = (1 << 20);
 
     /**
      * The URIs for this protocol can be loaded by extensions.
      */
-    const unsigned long URI_LOADABLE_BY_EXTENSIONS = (1 << 22);
+    const unsigned long URI_LOADABLE_BY_EXTENSIONS = (1 << 21);
 };