Bug 1458687 - [1.0] Remove obsolete isUserTriggered argument in nsContentUtils::TriggerLink. r=smaug
authorEugen Sawin <esawin@mozilla.com>
Wed, 02 May 2018 20:08:44 +0200
changeset 791143 6580f1d8857df294a99c12f40ecb9b8e4e807354
parent 791142 1eb83ac9acee5653c4a8eb80e847a7b8391d8f41
child 791144 895146c6b6bcb5a1fa447cdcb54f1925a5ce862a
push id108712
push userrwood@mozilla.com
push dateThu, 03 May 2018 16:01:49 +0000
reviewerssmaug
bugs1458687
milestone61.0a1
Bug 1458687 - [1.0] Remove obsolete isUserTriggered argument in nsContentUtils::TriggerLink. r=smaug
dom/base/Element.cpp
dom/base/nsContentUtils.cpp
dom/base/nsContentUtils.h
layout/generic/nsImageFrame.cpp
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -3241,17 +3241,17 @@ Element::GetEventTargetParentForLinks(Ev
     aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
     MOZ_FALLTHROUGH;
   case eFocus: {
     InternalFocusEvent* focusEvent = aVisitor.mEvent->AsFocusEvent();
     if (!focusEvent || !focusEvent->mIsRefocus) {
       nsAutoString target;
       GetLinkTarget(target);
       nsContentUtils::TriggerLink(this, aVisitor.mPresContext, absURI, target,
-                                  false, true, true);
+                                  /* click */ false, /* isTrusted */ true);
       // Make sure any ancestor links don't also TriggerLink
       aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
     }
     break;
   }
   case eMouseOut:
     aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
     MOZ_FALLTHROUGH;
@@ -3353,17 +3353,17 @@ Element::PostHandleEventForLinks(EventCh
   case eLegacyDOMActivate:
     {
       if (aVisitor.mEvent->mOriginalTarget == this) {
         nsAutoString target;
         GetLinkTarget(target);
         const InternalUIEvent* activeEvent = aVisitor.mEvent->AsUIEvent();
         MOZ_ASSERT(activeEvent);
         nsContentUtils::TriggerLink(this, aVisitor.mPresContext, absURI, target,
-                                    true, true, activeEvent->IsTrustable());
+                                    /* click */ true, activeEvent->IsTrustable());
         aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
       }
     }
     break;
 
   case eKeyPress:
     {
       WidgetKeyboardEvent* keyEvent = aVisitor.mEvent->AsKeyboardEvent();
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -5486,18 +5486,17 @@ nsContentUtils::CombineResourcePrincipal
   *aResourcePrincipal = sSystemPrincipal;
   return true;
 }
 
 /* static */
 void
 nsContentUtils::TriggerLink(nsIContent *aContent, nsPresContext *aPresContext,
                             nsIURI *aLinkURI, const nsString &aTargetSpec,
-                            bool aClick, bool aIsUserTriggered,
-                            bool aIsTrusted)
+                            bool aClick, bool aIsTrusted)
 {
   NS_ASSERTION(aPresContext, "Need a nsPresContext");
   NS_PRECONDITION(aLinkURI, "No link URI");
 
   if (aContent->IsEditable()) {
     return;
   }
 
@@ -5510,20 +5509,17 @@ nsContentUtils::TriggerLink(nsIContent *
     handler->OnOverLink(aContent, aLinkURI, aTargetSpec.get());
     return;
   }
 
   // Check that this page is allowed to load this URI.
   nsresult proceed = NS_OK;
 
   if (sSecurityManager) {
-    uint32_t flag =
-      aIsUserTriggered ?
-      (uint32_t)nsIScriptSecurityManager::STANDARD :
-      (uint32_t)nsIScriptSecurityManager::LOAD_IS_AUTOMATIC_DOCUMENT_REPLACEMENT;
+    uint32_t flag = static_cast<uint32_t>(nsIScriptSecurityManager::STANDARD);
     proceed =
       sSecurityManager->CheckLoadURIWithPrincipal(aContent->NodePrincipal(),
                                                   aLinkURI, flag);
   }
 
   // Only pass off the click event if the script security manager says it's ok.
   // We need to rest aTargetSpec for forced downloads.
   if (NS_SUCCEEDED(proceed)) {
--- a/dom/base/nsContentUtils.h
+++ b/dom/base/nsContentUtils.h
@@ -1857,26 +1857,22 @@ public:
    * security check using aContent's principal.
    *
    * @param aContent the node on which a link was triggered.
    * @param aPresContext the pres context, must be non-null.
    * @param aLinkURI the URI of the link, must be non-null.
    * @param aTargetSpec the target (like target=, may be empty).
    * @param aClick whether this was a click or not (if false, this method
    *               assumes you just hovered over the link).
-   * @param aIsUserTriggered whether the user triggered the link. This would be
-   *                         false for loads from auto XLinks or from the
-   *                         click() method if we ever implement it.
    * @param aIsTrusted If false, JS Context will be pushed to stack
    *                   when the link is triggered.
    */
   static void TriggerLink(nsIContent *aContent, nsPresContext *aPresContext,
                           nsIURI *aLinkURI, const nsString& aTargetSpec,
-                          bool aClick, bool aIsUserTriggered,
-                          bool aIsTrusted);
+                          bool aClick, bool aIsTrusted);
 
   /**
    * Get the link location.
    */
   static void GetLinkLocation(mozilla::dom::Element* aElement,
                               nsString& aLocationString);
 
   /**
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -2079,17 +2079,17 @@ nsImageFrame::HandleEvent(nsPresContext*
           NS_ENSURE_SUCCESS(rv, rv);
 
           bool clicked = false;
           if (aEvent->mMessage == eMouseClick && !aEvent->DefaultPrevented()) {
             *aEventStatus = nsEventStatus_eConsumeDoDefault;
             clicked = true;
           }
           nsContentUtils::TriggerLink(anchorNode, aPresContext, uri, target,
-                                      clicked, true, true);
+                                      clicked, /* isTrusted */ true);
         }
       }
     }
   }
 
   return nsAtomicContainerFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
 }