Merge inbound to mozilla-central. a=merge
authorCsoregi Natalia <ncsoregi@mozilla.com>
Mon, 10 Sep 2018 00:43:53 +0300
changeset 491073 9bb0f7fc73ad
parent 491068 f669be991db6 (current diff)
parent 491072 e8b79d20b287 (diff)
child 491075 2b8662a7b155
child 491087 488a82fa06e1
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone64.0a1
first release with
nightly linux32
9bb0f7fc73ad / 64.0a1 / 20180909220130 / files
nightly linux64
9bb0f7fc73ad / 64.0a1 / 20180909220130 / files
nightly mac
9bb0f7fc73ad / 64.0a1 / 20180909220130 / files
nightly win32
9bb0f7fc73ad / 64.0a1 / 20180909220130 / files
nightly win64
9bb0f7fc73ad / 64.0a1 / 20180909220130 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge inbound to mozilla-central. a=merge
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -12893,17 +12893,18 @@ nsIDocument::MaybeAllowStorageForOpener(
   nsAutoString origin;
   nsresult rv = nsContentUtils::GetUTFOrigin(uri, origin);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return;
   }
 
   // We don't care when the asynchronous work finishes here.
   Unused << AntiTrackingCommon::AddFirstPartyStorageAccessGrantedFor(origin,
-                                                                     openerInner);
+                                                                     openerInner,
+                                                                     AntiTrackingCommon::eHeuristic);
 }
 
 bool
 nsIDocument::HasBeenUserGestureActivated()
 {
   if (mUserGestureActivated) {
     return true;
   }
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -7056,17 +7056,18 @@ nsGlobalWindowOuter::MaybeAllowStorageFo
   nsAutoString origin;
   nsresult rv = nsContentUtils::GetUTFOrigin(aURI, origin);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return;
   }
 
   // We don't care when the asynchronous work finishes here.
   Unused << AntiTrackingCommon::AddFirstPartyStorageAccessGrantedFor(origin,
-                                                                     inner);
+                                                                     inner,
+                                                                     AntiTrackingCommon::eHeuristic);
 }
 
 //*****************************************************************************
 // nsGlobalWindowOuter: Helper Functions
 //*****************************************************************************
 
 already_AddRefed<nsIDocShellTreeOwner>
 nsGlobalWindowOuter::GetTreeOwner()
--- a/dom/tests/browser/browser.ini
+++ b/dom/tests/browser/browser.ini
@@ -47,17 +47,17 @@ skip-if = e10s
 [browser_frame_elements.js]
 [browser_hasbeforeunload.js]
 support-files =
   beforeunload_test_page.html
 run-if = e10s
 [browser_largeAllocation_win32.js]
 skip-if = !e10s || os != "win" || processor != "x86" # Large-Allocation requires e10s
 [browser_largeAllocation_non_win32.js]
-skip-if = !e10s || (os == "win" && processor == "x86") || (verify && debug && (os == 'linux')) # Large-Allocation requires e10s
+skip-if = !e10s || (os == "win" && processor == "x86") || (verify && debug && (os == 'linux')) || (os == 'linux') || (os == 'mac' && debug)  # Large-Allocation requires e10s # Bug 1336075
 [browser_localStorage_e10s.js]
 skip-if = !e10s || verify # This is a test of e10s functionality.
 [browser_localStorage_privatestorageevent.js]
 [browser_persist_cookies.js]
 support-files =
   set-samesite-cookies-and-redirect.sjs
   mimeme.sjs
 [browser_test_focus_after_modal_state.js]
--- a/netwerk/locales/en-US/necko.properties
+++ b/netwerk/locales/en-US/necko.properties
@@ -43,11 +43,20 @@ AutomaticAuth=You are about to log in to the site “%1$S” with the username “%2$S”.
 TrackerUriBlocked=The resource at “%1$S” was blocked because content blocking is enabled.
 UnsafeUriBlocked=The resource at “%1$S” was blocked by Safe Browsing.
 CookieBlockedByPermission=Request to access cookies or storage on “%1$S” was blocked because of custom cookie permission.
 CookieBlockedTracker=Request to access cookie or storage on “%1$S” was blocked because it came from a tracker and content blocking is enabled.
 CookieBlockedAll=Request to access cookie or storage on “%1$S” was blocked because we are blocking all storage access requests.
 CookieBlockedForeign=Request to access cookie or storage on “%1$S” was blocked because we are blocking all third-party storage access requests and content blocking is enabled.
 CookieBlockedSlowTrackingContent=The resource at “%1$S” was blocked because content blocking is enabled and the resource was classified as a slow tracking resource.
 
+# LOCALIZATION NOTE (CookieAllowedForOriginOnTrackerByStorageAccessAPI): %3$S, %2$S and %1$S are URLs.
+CookieAllowedForOriginOnTrackerByStorageAccessAPI=Storage access granted for “%3$S” opened by tracker “%2$S” on “%1$S”.
+# LOCALIZATION NOTE (CookieAllowedForTrackerByStorageAccessAPI): %2$S and %1$S are URLs.
+CookieAllowedForTrackerByStorageAccessAPI=Storage access granted for tracker “%2$S” on “%1$S”.
+# LOCALIZATION NOTE (CookieAllowedForOriginOnTrackerByHeuristic): %3$S, %2$S and %1$S are URLs.
+CookieAllowedForOriginOnTrackerByHeuristic=Storage access automatically granted for “%3$S” opened by tracker “%2$S” on “%1$S”.
+# LOCALIZATION NOTE (CookieAllowedForTrackerByHeuristic): %2$S and %1$S are URLs.
+CookieAllowedForTrackerByHeuristic=Storage access automatically granted for tracker “%2$S” on “%1$S”.
+
 # LOCALIZATION NOTE (nsICookieManagerAPIDeprecated): don't localize originAttributes.
 # %1$S is the deprecated API; %2$S is the interface suffix that the given deprecated API belongs to.
 nsICookieManagerAPIDeprecated=“%1$S” is changed. Update your code and pass the correct originAttributes. Read more on MDN: https://developer.mozilla.org/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsICookieManager%2$S
--- a/toolkit/components/antitracking/AntiTrackingCommon.cpp
+++ b/toolkit/components/antitracking/AntiTrackingCommon.cpp
@@ -244,21 +244,86 @@ ReportBlockingToConsole(nsPIDOMWindowOut
 
   nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
                                   NS_LITERAL_CSTRING("Content Blocking"),
                                   doc,
                                   nsContentUtils::eNECKO_PROPERTIES,
                                   message,
                                   params, ArrayLength(params));
 }
+
+void
+ReportUnblockingConsole(nsPIDOMWindowInner* aWindow,
+                        const nsAString& aTrackingOrigin,
+                        const nsAString& aGrantedOrigin,
+                        AntiTrackingCommon::StorageAccessGrantedReason aReason)
+{
+  nsCOMPtr<nsIPrincipal> principal =
+    nsGlobalWindowInner::Cast(aWindow)->GetPrincipal();
+  if (NS_WARN_IF(!principal)) {
+    return;
+  }
+
+  nsAutoString origin;
+  nsresult rv = nsContentUtils::GetUTFOrigin(principal, origin);
+  if (NS_WARN_IF(NS_FAILED(rv))) {
+    return;
+  }
+
+  nsCOMPtr<nsIDocShell> docShell = aWindow->GetDocShell();
+  if (NS_WARN_IF(!docShell)) {
+    return;
+  }
+
+  nsCOMPtr<nsIDocument> doc = docShell->GetDocument();
+  if (NS_WARN_IF(!doc)) {
+    return;
+  }
+
+  const char16_t* params[] = { origin.BeginReading(),
+                               aTrackingOrigin.BeginReading(),
+                               aGrantedOrigin.BeginReading() };
+  const char* messageWithDifferentOrigin = nullptr;
+  const char *messageWithSameOrigin = nullptr;
+
+  switch (aReason) {
+    case AntiTrackingCommon::eStorageAccessAPI:
+      messageWithDifferentOrigin = "CookieAllowedForOriginOnTrackerByStorageAccessAPI";
+      messageWithSameOrigin = "CookieAllowedForTrackerByStorageAccessAPI";
+      break;
+
+    case AntiTrackingCommon::eHeuristic:
+      messageWithDifferentOrigin = "CookieAllowedForOriginOnTrackerByHeuristic";
+      messageWithSameOrigin = "CookieAllowedForTrackerByHeuristic";
+      break;
+  }
+
+  if (aTrackingOrigin == aGrantedOrigin) {
+    nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
+                                    NS_LITERAL_CSTRING("Content Blocking"),
+                                    doc,
+                                    nsContentUtils::eNECKO_PROPERTIES,
+                                    messageWithSameOrigin,
+                                    params, 2);
+  } else {
+    nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
+                                    NS_LITERAL_CSTRING("Content Blocking"),
+                                    doc,
+                                    nsContentUtils::eNECKO_PROPERTIES,
+                                    messageWithDifferentOrigin,
+                                    params, 3);
+  }
+}
+
 } // anonymous
 
 /* static */ RefPtr<AntiTrackingCommon::StorageAccessGrantPromise>
 AntiTrackingCommon::AddFirstPartyStorageAccessGrantedFor(const nsAString& aOrigin,
-                                                         nsPIDOMWindowInner* aParentWindow)
+                                                         nsPIDOMWindowInner* aParentWindow,
+                                                         StorageAccessGrantedReason aReason)
 {
   MOZ_ASSERT(aParentWindow);
 
   LOG(("Adding a first-party storage exception for %s...",
        NS_ConvertUTF16toUTF8(aOrigin).get()));
 
   if (StaticPrefs::network_cookie_cookieBehavior() !=
         nsICookieService::BEHAVIOR_REJECT_TRACKER) {
@@ -304,16 +369,19 @@ AntiTrackingCommon::AddFirstPartyStorage
                                                   getter_AddRefs(topLevelStoragePrincipal),
                                                   trackingOrigin)) {
     LOG(("Error while computing the parent principal and tracking origin, bailing out early"));
     return StorageAccessGrantPromise::CreateAndReject(false, __func__);
   }
 
   NS_ConvertUTF16toUTF8 grantedOrigin(aOrigin);
 
+  ReportUnblockingConsole(aParentWindow, NS_ConvertUTF8toUTF16(trackingOrigin),
+                          aOrigin, aReason);
+
   if (XRE_IsParentProcess()) {
     LOG(("Saving the permission: trackingOrigin=%s, grantedOrigin=%s",
          trackingOrigin.get(), grantedOrigin.get()));
 
     RefPtr<StorageAccessGrantPromise::Private> p = new StorageAccessGrantPromise::Private(__func__);
     SaveFirstPartyStorageAccessGrantedForOriginOnParentProcess(topLevelStoragePrincipal,
                                                                trackingOrigin,
                                                                grantedOrigin,
--- a/toolkit/components/antitracking/AntiTrackingCommon.h
+++ b/toolkit/components/antitracking/AntiTrackingCommon.h
@@ -63,16 +63,22 @@ public:
   IsFirstPartyStorageAccessGrantedFor(nsIHttpChannel* aChannel, nsIURI* aURI,
                                       uint32_t* aRejectedReason);
 
   // This method checks if the principal has the permission to access to the
   // first party storage.
   static bool
   IsFirstPartyStorageAccessGrantedFor(nsIPrincipal* aPrincipal);
 
+  enum StorageAccessGrantedReason
+  {
+    eStorageAccessAPI,
+    eHeuristic,
+  };
+
   // Grant the permission for aOrigin to have access to the first party storage.
   // This method can handle 2 different scenarios:
   // - aParentWindow is a 3rd party context, it opens an aOrigin window and the
   //   user interacts with it. We want to grant the permission at the
   //   combination: top-level + aParentWindow + aOrigin.
   //   Ex: example.net loads an iframe tracker.com, which opens a popup
   //   tracker.prg and the user interacts with it. tracker.org is allowed if
   //   loaded by tracker.com when loaded by example.net.
@@ -81,17 +87,18 @@ public:
   //   want to grant the permission for the 3rd party context to have access to
   //   the first party stoage when loaded in aParentWindow.
   //   Ex: example.net import tracker.com/script.js which does opens a popup and
   //   the user interacts with it. tracker.com is allowed when loaded by
   //   example.net.
   typedef MozPromise<bool, bool, false> StorageAccessGrantPromise;
   static MOZ_MUST_USE RefPtr<StorageAccessGrantPromise>
   AddFirstPartyStorageAccessGrantedFor(const nsAString& aOrigin,
-                                       nsPIDOMWindowInner* aParentWindow);
+                                       nsPIDOMWindowInner* aParentWindow,
+                                       StorageAccessGrantedReason aReason);
 
   // For IPC only.
   static void
   SaveFirstPartyStorageAccessGrantedForOriginOnParentProcess(nsIPrincipal* aPrincipal,
                                                              const nsCString& aParentOrigin,
                                                              const nsCString& aGrantedOrigin,
                                                              FirstPartyStorageAccessGrantedForOriginResolver&& aResolver);
 
--- a/toolkit/themes/linux/global/toolbarbutton.css
+++ b/toolkit/themes/linux/global/toolbarbutton.css
@@ -64,20 +64,16 @@ toolbarbutton[checked="true"]:not(:hover
 toolbarbutton:-moz-lwtheme:not(:hover):not([checked="true"]):not([open="true"]):not([disabled="true"]) {
   text-shadow: inherit;
 }
 
 /* ::::: toolbarbutton menu ::::: */
 
 .toolbarbutton-menu-dropmarker {
   -moz-appearance: toolbarbutton-dropdown !important;
-  list-style-image: none;
-  -moz-image-region: auto;
-  padding: 0;
-  margin: 0;
 }
 
 .toolbarbutton-menu-dropmarker[disabled="true"] {
   padding: 0 !important;
 }
 
 /* ::::: toolbarbutton badged ::::: */
 .toolbarbutton-badge-stack > .toolbarbutton-icon[label]:not([label=""]) {
--- a/toolkit/themes/osx/global/toolbarbutton.css
+++ b/toolkit/themes/osx/global/toolbarbutton.css
@@ -25,20 +25,17 @@ toolbarbutton[disabled="true"]:hover:act
 toolbarbutton[disabled="true"][open="true"] {
   color: -moz-mac-disabledtoolbartext;
 }
 
 /* ::::: toolbarbutton menu ::::: */
 
 .toolbarbutton-menu-dropmarker {
   -moz-appearance: none !important;
-  border: none !important;
-  background-color: transparent !important;
   list-style-image: url("chrome://global/skin/arrow/arrow-dn.png");
-  padding: 0;
   padding-inline-start: 2px;
   width: auto;
 }
 
 .toolbarbutton-menu-dropmarker[disabled="true"] {
   list-style-image: url("chrome://global/skin/arrow/arrow-dn-dis.png");
   padding: 0;
   padding-inline-start: 2px;
--- a/toolkit/themes/windows/global/toolbarbutton.css
+++ b/toolkit/themes/windows/global/toolbarbutton.css
@@ -87,20 +87,21 @@ toolbarbutton[checked="true"]:not([disab
     text-shadow: inherit;
   }
 }
 
 /* ::::: toolbarbutton menu ::::: */
 
 .toolbarbutton-menu-dropmarker {
   -moz-appearance: none !important;
-  padding: 0;
-  width: auto;
-  height: auto;
-  margin-top: 1px;
+  list-style-image: url("chrome://global/skin/icons/arrow-dropdown-12.svg");
+  -moz-context-properties: fill;
+  fill: currentColor;
+  width: 12px;
+  height: 12px;
 }
 
 /* ::::: toolbarbutton badged ::::: */
 
 .toolbarbutton-badge-stack > .toolbarbutton-icon[label]:not([label=""]) {
   margin-inline-end: 0;
 }