Bug 1517136 - Devirtualize and inline the calls in nsSecureBrowserUIImpl::CheckForBlockedContent(); r=baku
☠☠ backed out by cb27ce235427 ☠ ☠
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 02 Jan 2019 10:21:49 -0500
changeset 452825 d801dfa24d7d11e7dca3934ba52a3900c07af660
parent 452824 95343ed265a38b4cc4de4f12189e97948bfea845
child 452826 dc3c29af88812f87abaddd3f1134e7631af8856c
push id35331
push useropoprus@mozilla.com
push dateTue, 08 Jan 2019 10:16:13 +0000
treeherdermozilla-central@60aa2498320d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1517136
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 1517136 - Devirtualize and inline the calls in nsSecureBrowserUIImpl::CheckForBlockedContent(); r=baku Differential Revision: https://phabricator.services.mozilla.com/D15574
docshell/base/nsDocShell.cpp
docshell/base/nsIDocShell.idl
security/manager/ssl/nsSecureBrowserUIImpl.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -1374,69 +1374,16 @@ nsDocShell::GetHasMixedDisplayContentBlo
     bool* aHasMixedDisplayContentBlocked) {
   RefPtr<Document> doc(GetDocument());
   *aHasMixedDisplayContentBlocked =
       doc && doc->GetHasMixedDisplayContentBlocked();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDocShell::GetHasTrackingContentBlocked(bool* aHasTrackingContentBlocked) {
-  RefPtr<Document> doc(GetDocument());
-  *aHasTrackingContentBlocked = doc && doc->GetHasTrackingContentBlocked();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDocShell::GetHasTrackingContentLoaded(bool* aHasTrackingContentLoaded) {
-  RefPtr<Document> doc(GetDocument());
-  *aHasTrackingContentLoaded = doc && doc->GetHasTrackingContentLoaded();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDocShell::GetHasCookiesBlockedByPermission(
-    bool* aHasCookiesBlockedByPermission) {
-  RefPtr<Document> doc(GetDocument());
-  *aHasCookiesBlockedByPermission =
-      doc && doc->GetHasCookiesBlockedByPermission();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDocShell::GetHasCookiesBlockedDueToTrackers(
-    bool* aHasCookiesBlockedDueToTrackers) {
-  RefPtr<Document> doc(GetDocument());
-  *aHasCookiesBlockedDueToTrackers = doc && doc->GetHasTrackingCookiesBlocked();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDocShell::GetHasAllCookiesBeenBlocked(bool* aHasAllCookiesBeenBlocked) {
-  RefPtr<Document> doc(GetDocument());
-  *aHasAllCookiesBeenBlocked = doc && doc->GetHasAllCookiesBlocked();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDocShell::GetHasForeignCookiesBeenBlocked(
-    bool* aHasForeignCookiesBeenBlocked) {
-  RefPtr<Document> doc(GetDocument());
-  *aHasForeignCookiesBeenBlocked = doc && doc->GetHasForeignCookiesBlocked();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDocShell::GetHasCookiesLoaded(bool* aHasCookiesLoaded) {
-  RefPtr<Document> doc(GetDocument());
-  *aHasCookiesLoaded = doc && doc->GetHasCookiesLoaded();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 nsDocShell::GetAllowPlugins(bool* aAllowPlugins) {
   NS_ENSURE_ARG_POINTER(aAllowPlugins);
 
   *aAllowPlugins = mAllowPlugins;
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/docshell/base/nsIDocShell.idl
+++ b/docshell/base/nsIDocShell.idl
@@ -494,59 +494,16 @@ interface nsIDocShell : nsIDocShellTreeI
 
    /**
    * This attribute determines whether a document has Mixed Display Content
    * that has been blocked from loading. Similar behavior to
    * hasMixedActiveContentBlocked.
    */
   [infallible] readonly attribute boolean hasMixedDisplayContentBlocked;
 
-   /**
-   * This attribute determines whether a document has Tracking Content
-   * that has been blocked from loading.
-   */
-   [infallible] readonly attribute boolean hasTrackingContentBlocked;
-
-   /**
-   * This attribute determines whether Tracking Content is loaded on the
-   * document. When it is true, tracking content was not blocked and has
-   * loaded (or is about to load) on the page.
-   */
-  [infallible] readonly attribute boolean hasTrackingContentLoaded;
-
-   /**
-   * This attribute determines whether a document seen cookies or storage
-   * blocked due to a site permission being denied.
-   */
-   [infallible] readonly attribute boolean hasCookiesBlockedByPermission;
-
-   /**
-   * This attribute determines whether a document seen cookies or storage
-   * blocked due to a the request being made by a tracker.
-   */
-   [infallible] readonly attribute boolean hasCookiesBlockedDueToTrackers;
-
-   /**
-   * This attribute determines whether a document seen cookies or storage
-   * blocked due to cookie behavior settings blocking all cookies.
-   */
-   [infallible] readonly attribute boolean hasAllCookiesBeenBlocked;
-
-   /**
-   * This attribute determines whether a document seen cookies or storage
-   * blocked due to cookie behavior settings blocking all third-party cookies.
-   */
-   [infallible] readonly attribute boolean hasForeignCookiesBeenBlocked;
-
-   /**
-   * This attribute determines whether a document seen cookies or storage
-   * attempts ever whether they've been allowed or blocked.
-   */
-   [infallible] readonly attribute boolean hasCookiesLoaded;
-
   /**
    * Disconnects this docshell's editor from its window, and stores the
    * editor data in the open document's session history entry.  This
    * should be called only during page transitions.
    */
   [noscript, notxpcom] void DetachEditorFromWindow();
 
   /**
--- a/security/manager/ssl/nsSecureBrowserUIImpl.cpp
+++ b/security/manager/ssl/nsSecureBrowserUIImpl.cpp
@@ -102,66 +102,72 @@ void nsSecureBrowserUIImpl::CheckForBloc
         sameTypeRoot,
         "No document shell root tree item from document shell tree item!");
     docShell = do_QueryInterface(sameTypeRoot);
     if (!docShell) {
       return;
     }
   }
 
+  RefPtr<Document> doc = docShell->GetDocument();
+  if (!doc) {
+    // If the docshell has no document, then there is no need to update mState.
+    return;
+  }
+
   // Has mixed content been loaded or blocked in nsMixedContentBlocker?
   // This only applies to secure documents even if they're affected by mixed
   // content blocking in which case the STATE_IS_BROKEN bit would be set rather
   // than STATE_IS_SECURE.
   if (((mState & STATE_IS_SECURE) != 0) || ((mState & STATE_IS_BROKEN) != 0)) {
-    if (docShell->GetHasMixedActiveContentLoaded()) {
+    if (doc->GetHasMixedActiveContentLoaded()) {
       mState |= STATE_IS_BROKEN | STATE_LOADED_MIXED_ACTIVE_CONTENT;
       mState &= ~STATE_IS_SECURE;
     }
 
-    if (docShell->GetHasMixedDisplayContentLoaded()) {
+    if (doc->GetHasMixedDisplayContentLoaded()) {
       mState |= STATE_IS_BROKEN | STATE_LOADED_MIXED_DISPLAY_CONTENT;
       mState &= ~STATE_IS_SECURE;
     }
 
-    if (docShell->GetHasMixedActiveContentBlocked()) {
+    if (doc->GetHasMixedActiveContentBlocked()) {
       mState |= STATE_BLOCKED_MIXED_ACTIVE_CONTENT;
     }
 
-    if (docShell->GetHasMixedDisplayContentBlocked()) {
+    if (doc->GetHasMixedDisplayContentBlocked()) {
       mState |= STATE_BLOCKED_MIXED_DISPLAY_CONTENT;
     }
   }
 
   // Has tracking content been blocked or loaded?
-  if (docShell->GetHasTrackingContentBlocked()) {
+  if (doc->GetHasTrackingContentBlocked()) {
     mState |= STATE_BLOCKED_TRACKING_CONTENT;
   }
 
-  if (docShell->GetHasTrackingContentLoaded()) {
+  if (doc->GetHasTrackingContentLoaded()) {
     mState |= STATE_LOADED_TRACKING_CONTENT;
   }
 
-  if (docShell->GetHasCookiesBlockedByPermission()) {
+  if (doc->GetHasCookiesBlockedByPermission()) {
     mState |= STATE_COOKIES_BLOCKED_BY_PERMISSION;
   }
 
-  if (docShell->GetHasCookiesBlockedDueToTrackers()) {
+  if (doc->GetHasTrackingCookiesBlocked()) {
     mState |= STATE_COOKIES_BLOCKED_TRACKER;
   }
 
-  if (docShell->GetHasForeignCookiesBeenBlocked()) {
+  if (doc->GetHasForeignCookiesBlocked()) {
     mState |= STATE_COOKIES_BLOCKED_FOREIGN;
   }
 
-  if (docShell->GetHasAllCookiesBeenBlocked()) {
+  if (doc->GetHasAllCookiesBlocked()) {
     mState |= STATE_COOKIES_BLOCKED_ALL;
   }
 
-  if (docShell->GetHasCookiesLoaded()) {
+  if (doc->GetHasCookiesLoaded()) {
     mState |= STATE_COOKIES_LOADED;
   }
 }
 
 // Helper function to determine if the given URI can be considered secure.
 // Essentially, only "https" URIs can be considered secure. However, the URI we
 // have may be e.g. view-source:https://example.com or
 // wyciwyg://https://example.com, in which case we have to evaluate the