Merge mozilla-central to inbound. a=merge CLOSED TREE
authorBrindusan Cristian <cbrindusan@mozilla.com>
Sun, 09 Dec 2018 11:38:48 +0200
changeset 449674 a24d661d8362f388f002a47b3a0d18a265590b65
parent 449673 e9ea0dbc015be66d996deeb7c6e71088488dcea1 (current diff)
parent 449650 88d304c633b6091a21fc64290256ef3fb51b7421 (diff)
child 449675 ff2282b876b65e7a9b1b7e2404c50c18300f0dfa
push idunknown
push userunknown
push dateunknown
reviewersmerge
milestone65.0a1
Merge mozilla-central to inbound. a=merge CLOSED TREE
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -926,52 +926,63 @@
 
       <field name="_animateElement">
         this.arrowScrollbox._scrollButtonDown;
       </field>
 
       <method name="_notifyBackgroundTab">
         <parameter name="aTab"/>
         <body><![CDATA[
-          if (aTab.pinned || aTab.hidden)
-            return;
-
-          var scrollRect = this.arrowScrollbox.scrollClientRect;
-          var tab = aTab.getBoundingClientRect();
-
-          // DOMRect left/right properties are immutable.
-          tab = {left: tab.left, right: tab.right};
-
-          // Is the new tab already completely visible?
-          if (scrollRect.left <= tab.left && tab.right <= scrollRect.right)
+          if (aTab.pinned || aTab.hidden || this.getAttribute("overflow") != "true")
             return;
 
-          if (this.arrowScrollbox.smoothScroll) {
-            let selectedTab = this.selectedItem;
-            let selected = !selectedTab.pinned &&
-                           selectedTab.getBoundingClientRect();
+          this._lastTabToScrollIntoView = aTab;
+          if (!this._backgroundTabScrollPromise) {
+            this._backgroundTabScrollPromise = window.promiseDocumentFlushed(() => {
+              let lastTabRect = this._lastTabToScrollIntoView.getBoundingClientRect();
+              let selectedTab = this.selectedItem;
+              if (selectedTab.pinned) {
+                selectedTab = null;
+              } else {
+                selectedTab = selectedTab.getBoundingClientRect();
+                selectedTab = {left: selectedTab.left, right: selectedTab.right};
+              }
+              delete this._lastTabToScrollIntoView;
+              delete this._backgroundTabScrollPromise;
+              return [
+                this.arrowScrollbox.scrollClientRect,
+                {left: lastTabRect.left, right: lastTabRect.right},
+                selectedTab,
+              ];
+            }).then(([scrollRect, tab, selected]) => {
+              // Is the new tab already completely visible?
+              if (scrollRect.left <= tab.left && tab.right <= scrollRect.right)
+                return;
 
-            // Can we make both the new tab and the selected tab completely visible?
-            if (!selected ||
-                Math.max(tab.right - selected.left, selected.right - tab.left) <=
-                  scrollRect.width) {
-              this.arrowScrollbox.ensureElementIsVisible(aTab);
-              return;
-            }
+              if (this.arrowScrollbox.smoothScroll) {
+                // Can we make both the new tab and the selected tab completely visible?
+                if (!selected ||
+                    Math.max(tab.right - selected.left, selected.right - tab.left) <=
+                      scrollRect.width) {
+                  this.arrowScrollbox.ensureElementIsVisible(aTab);
+                  return;
+                }
 
-            this.arrowScrollbox.scrollByPixels(RTL_UI ?
-                                                 selected.right - scrollRect.right :
-                                                 selected.left - scrollRect.left);
-          }
+                this.arrowScrollbox.scrollByPixels(RTL_UI ?
+                                                     selected.right - scrollRect.right :
+                                                     selected.left - scrollRect.left);
+              }
 
-          if (!this._animateElement.hasAttribute("highlight")) {
-            this._animateElement.setAttribute("highlight", "true");
-            setTimeout(function(ele) {
-              ele.removeAttribute("highlight");
-            }, 150, this._animateElement);
+              if (!this._animateElement.hasAttribute("highlight")) {
+                this._animateElement.setAttribute("highlight", "true");
+                setTimeout(function(ele) {
+                  ele.removeAttribute("highlight");
+                }, 150, this._animateElement);
+              }
+            });
           }
         ]]></body>
       </method>
 
       <method name="_getDragTargetTab">
         <parameter name="event"/>
         <parameter name="isLink"/>
         <body><![CDATA[
--- a/browser/components/urlbar/tests/browser/browser.ini
+++ b/browser/components/urlbar/tests/browser/browser.ini
@@ -4,13 +4,12 @@
 
 [DEFAULT]
 support-files =
   head.js
 
 [browser_UrlbarInput_formatValue.js]
 [browser_UrlbarInput_overflow.js]
 [browser_UrlbarInput_tooltip.js]
-skip-if = os == "win" # Bug 1511655
 [browser_UrlbarInput_trimURLs.js]
 subsuite = clipboard
 [browser_UrlbarInput_unit.js]
 support-files = empty.xul
--- a/dom/base/ContentBlockingLog.h
+++ b/dom/base/ContentBlockingLog.h
@@ -151,30 +151,34 @@ class ContentBlockingLog final {
     }
 
     w.End();
 
     return buffer;
   }
 
   bool HasBlockedAnyOfType(uint32_t aType) {
+    // Note: nothing inside this loop should return false, the goal for the
+    // loop is to scan the log to see if we find a matching entry, and if so
+    // we would return true, otherwise in the end of the function outside of
+    // the loop we take the common `return false;` statement.
     for (auto iter = mLog.Iter(); !iter.Done(); iter.Next()) {
       if (!iter.UserData()) {
         continue;
       }
 
       if (aType == nsIWebProgressListener::STATE_LOADED_TRACKING_CONTENT) {
         if (Get<0>(*iter.UserData())) {
           return true;
         }
       } else if (aType == nsIWebProgressListener::STATE_COOKIES_LOADED) {
-        if (Get<1>(*iter.UserData()).isSome()) {
-          return Get<1>(*iter.UserData()).value();
+        if (Get<1>(*iter.UserData()).isSome() &&
+            Get<1>(*iter.UserData()).value()) {
+          return true;
         }
-        return false;  // false means not blocked, aka not loaded any cookies
       } else {
         for (auto& item : Get<2>(*iter.UserData())) {
           if ((item.mType & aType) != 0) {
             return true;
           }
         }
       }
     }
--- a/dom/base/nsContentPermissionHelper.cpp
+++ b/dom/base/nsContentPermissionHelper.cpp
@@ -518,30 +518,30 @@ ContentPermissionRequestBase::ContentPer
       mRequester(aWindow ? new nsContentPermissionRequester(aWindow) : nullptr),
       mPrefName(aPrefName),
       mType(aType),
       mIsHandlingUserInput(aIsHandlingUserInput) {}
 
 NS_IMETHODIMP
 ContentPermissionRequestBase::GetPrincipal(
     nsIPrincipal** aRequestingPrincipal) {
-  NS_ADDREF(*aRequestingPrincipal = mPrincipal);
+  NS_IF_ADDREF(*aRequestingPrincipal = mPrincipal);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 ContentPermissionRequestBase::GetTopLevelPrincipal(
     nsIPrincipal** aRequestingPrincipal) {
-  NS_ADDREF(*aRequestingPrincipal = mTopLevelPrincipal);
+  NS_IF_ADDREF(*aRequestingPrincipal = mTopLevelPrincipal);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 ContentPermissionRequestBase::GetWindow(mozIDOMWindow** aRequestingWindow) {
-  NS_ADDREF(*aRequestingWindow = mWindow);
+  NS_IF_ADDREF(*aRequestingWindow = mWindow);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 ContentPermissionRequestBase::GetElement(Element** aElement) {
   NS_ENSURE_ARG_POINTER(aElement);
   *aElement = nullptr;
   return NS_OK;
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -5026,16 +5026,17 @@ void nsGlobalWindowOuter::NotifyContentB
   docShell->GetSecurityUI(getter_AddRefs(securityUI));
   if (!securityUI) {
     return;
   }
   securityUI->GetState(&state);
   nsAutoString origin;
   nsContentUtils::GetUTFOrigin(aURIHint, origin);
 
+  bool blockedValue = aBlocked;
   bool unblocked = false;
   if (aState == nsIWebProgressListener::STATE_BLOCKED_TRACKING_CONTENT) {
     doc->SetHasTrackingContentBlocked(aBlocked, origin);
     if (!aBlocked) {
       unblocked = !doc->GetHasTrackingContentBlocked();
     }
   } else if (aState == nsIWebProgressListener::STATE_LOADED_TRACKING_CONTENT) {
     doc->SetHasTrackingContentLoaded(aBlocked, origin);
@@ -5064,24 +5065,26 @@ void nsGlobalWindowOuter::NotifyContentB
       unblocked = !doc->GetHasForeignCookiesBlocked();
     }
   } else if (aState == nsIWebProgressListener::STATE_COOKIES_LOADED) {
     MOZ_ASSERT(!aBlocked,
                "We don't expected to see blocked STATE_COOKIES_LOADED");
     // Note that the logic in this branch is the logical negation of the logic
     // in other branches, since the nsIDocument API we have is phrased in
     // "loaded" terms as opposed to "blocked" terms.
-    doc->SetHasCookiesLoaded(!aBlocked, origin);
-    aBlocked = true;
-    unblocked = false;
+    blockedValue = !aBlocked;
+    doc->SetHasCookiesLoaded(blockedValue, origin);
+    if (!aBlocked) {
+      unblocked = !doc->GetHasCookiesLoaded();
+    }
   } else {
     // Ignore nsIWebProgressListener::STATE_BLOCKED_UNSAFE_CONTENT;
   }
   const uint32_t oldState = state;
-  if (aBlocked) {
+  if (blockedValue) {
     state |= aState;
   } else if (unblocked) {
     state &= ~aState;
   }
 
   if (state == oldState) {
     // Avoid dispatching repeated notifications when nothing has changed
     return;
--- a/taskcluster/taskgraph/decision.py
+++ b/taskcluster/taskgraph/decision.py
@@ -164,18 +164,19 @@ def taskgraph_decision(options, paramete
 
     # write out the public/actions.json file
     write_artifact('actions.json', render_actions_json(tgg.parameters, tgg.graph_config))
 
     # write out the full graph for reference
     full_task_json = tgg.full_task_graph.to_json()
     write_artifact('full-task-graph.json', full_task_json)
 
-    # write out the public/runnable-jobs.json.gz file
+    # write out the public/runnable-jobs.json file
     write_artifact('runnable-jobs.json.gz', full_task_graph_to_runnable_jobs(full_task_json))
+    write_artifact('runnable-jobs.json', full_task_graph_to_runnable_jobs(full_task_json))
 
     # this is just a test to check whether the from_json() function is working
     _, _ = TaskGraph.from_json(full_task_json)
 
     # write out the target task set to allow reproducing this as input
     write_artifact('target-tasks.json', tgg.target_task_set.tasks.keys())
 
     # write out the optimized task graph to describe what will actually happen,
--- a/toolkit/components/antitracking/AntiTrackingCommon.cpp
+++ b/toolkit/components/antitracking/AntiTrackingCommon.cpp
@@ -1447,29 +1447,33 @@ nsresult AntiTrackingCommon::IsOnContent
   MOZ_ASSERT(aDecision == BlockingDecision::eBlock ||
              aDecision == BlockingDecision::eAllow);
 
   if (!aChannel) {
     return;
   }
 
   // Can be called in EITHER the parent or child process.
-  nsCOMPtr<nsIParentChannel> parentChannel;
-  NS_QueryNotificationCallbacks(aChannel, parentChannel);
-  if (parentChannel) {
-    // This channel is a parent-process proxy for a child process request.
-    // Tell the child process channel to do this instead.
-    if (aDecision == BlockingDecision::eBlock) {
-      parentChannel->NotifyTrackingCookieBlocked(aRejectedReason);
-    } else {
-      parentChannel->NotifyCookieAllowed();
+  if (XRE_IsParentProcess()) {
+    nsCOMPtr<nsIParentChannel> parentChannel;
+    NS_QueryNotificationCallbacks(aChannel, parentChannel);
+    if (parentChannel) {
+      // This channel is a parent-process proxy for a child process request.
+      // Tell the child process channel to do this instead.
+      if (aDecision == BlockingDecision::eBlock) {
+        parentChannel->NotifyTrackingCookieBlocked(aRejectedReason);
+      } else {
+        parentChannel->NotifyCookieAllowed();
+      }
     }
     return;
   }
 
+  MOZ_ASSERT(XRE_IsContentProcess());
+
   nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil = services::GetThirdPartyUtil();
   if (!thirdPartyUtil) {
     return;
   }
 
   nsCOMPtr<mozIDOMWindowProxy> win;
   nsresult rv =
       thirdPartyUtil->GetTopWindowForChannel(aChannel, getter_AddRefs(win));