Bug 1554122 - Rename nsAutoPopupStatePusher* to AutoPopupStatePusher; r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D32457

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Edgar Chen 2019-05-24 12:42:29 +00:00
parent 1b791c15c0
commit 800499a9f9
14 changed files with 29 additions and 30 deletions

View File

@ -3952,7 +3952,7 @@ nsresult nsDocShell::LoadURI(const nsAString& aURI,
} else {
popupState = PopupBlocker::openOverridden;
}
nsAutoPopupStatePusher statePusher(popupState);
AutoPopupStatePusher statePusher(popupState);
bool forceAllowDataURI = loadFlags & LOAD_FLAGS_FORCE_ALLOW_DATA_URI;
@ -12460,7 +12460,7 @@ class OnLinkClickEvent : public Runnable {
nsIContentSecurityPolicy* aCsp);
NS_IMETHOD Run() override {
nsAutoPopupStatePusher popupStatePusher(mPopupState);
AutoPopupStatePusher popupStatePusher(mPopupState);
// We need to set up an AutoJSAPI here for the following reason: When we
// do OnLinkClickSync we'll eventually end up in

View File

@ -444,14 +444,14 @@ void PopupBlocker::ResetLastExternalProtocolIframeAllowed() {
} // namespace dom
} // namespace mozilla
nsAutoPopupStatePusherInternal::nsAutoPopupStatePusherInternal(
AutoPopupStatePusherInternal::AutoPopupStatePusherInternal(
mozilla::dom::PopupBlocker::PopupControlState aState, bool aForce)
: mOldState(
mozilla::dom::PopupBlocker::PushPopupControlState(aState, aForce)) {
mozilla::dom::PopupBlocker::PopupStatePusherCreated();
}
nsAutoPopupStatePusherInternal::~nsAutoPopupStatePusherInternal() {
AutoPopupStatePusherInternal::~AutoPopupStatePusherInternal() {
mozilla::dom::PopupBlocker::PopPopupControlState(mOldState);
mozilla::dom::PopupBlocker::PopupStatePusherDestroyed();
}

View File

@ -72,9 +72,9 @@ class PopupBlocker final {
} // namespace mozilla
#ifdef MOZILLA_INTERNAL_API
# define NS_AUTO_POPUP_STATE_PUSHER nsAutoPopupStatePusherInternal
# define AUTO_POPUP_STATE_PUSHER AutoPopupStatePusherInternal
#else
# define NS_AUTO_POPUP_STATE_PUSHER nsAutoPopupStatePusherExternal
# define AUTO_POPUP_STATE_PUSHER AutoPopupStatePusherExternal
#endif
// Helper class that helps with pushing and popping popup control
@ -82,25 +82,24 @@ class PopupBlocker final {
// part of the layout library than it does in code outside the layout
// library. We give the two object layouts different names so the symbols
// don't conflict, but code should always use the name
// |nsAutoPopupStatePusher|.
class MOZ_RAII NS_AUTO_POPUP_STATE_PUSHER final {
// |AutoPopupStatePusher|.
class MOZ_RAII AUTO_POPUP_STATE_PUSHER final {
public:
#ifdef MOZILLA_INTERNAL_API
explicit NS_AUTO_POPUP_STATE_PUSHER(
explicit AUTO_POPUP_STATE_PUSHER(
mozilla::dom::PopupBlocker::PopupControlState aState,
bool aForce = false);
~NS_AUTO_POPUP_STATE_PUSHER();
~AUTO_POPUP_STATE_PUSHER();
#else
NS_AUTO_POPUP_STATE_PUSHER(
nsPIDOMWindowOuter* aWindow,
mozilla::dom::PopupBlocker::PopupControlState aState)
AUTO_POPUP_STATE_PUSHER(nsPIDOMWindowOuter* aWindow,
mozilla::dom::PopupBlocker::PopupControlState aState)
: mWindow(aWindow), mOldState(openAbused) {
if (aWindow) {
mOldState = PopupBlocker::PushPopupControlState(aState, false);
}
}
~NS_AUTO_POPUP_STATE_PUSHER() {
~AUTO_POPUP_STATE_PUSHER() {
if (mWindow) {
PopupBlocker::PopPopupControlState(mOldState);
}
@ -114,6 +113,6 @@ class MOZ_RAII NS_AUTO_POPUP_STATE_PUSHER final {
mozilla::dom::PopupBlocker::PopupControlState mOldState;
};
#define nsAutoPopupStatePusher NS_AUTO_POPUP_STATE_PUSHER
#define AutoPopupStatePusher AUTO_POPUP_STATE_PUSHER
#endif // mozilla_PopupBlocker_h

View File

@ -5694,7 +5694,7 @@ bool nsGlobalWindowInner::RunTimeoutHandler(Timeout* aTimeout,
// eabled the first time a timeout fires that was created while
// popups were enabled and with a delay less than
// "dom.disable_open_click_delay".
nsAutoPopupStatePusher popupStatePusher(timeout->mPopupState);
AutoPopupStatePusher popupStatePusher(timeout->mPopupState);
// Clear the timeout's popup state, if any, to prevent interval
// timeouts from repeatedly opening poups.

View File

@ -2660,7 +2660,7 @@ bool nsGlobalWindowOuter::ConfirmDialogIfNeeded() {
// Reset popup state while opening a modal dialog, and firing events
// about the dialog, to prevent the current state from being active
// the whole time a modal dialog is open.
nsAutoPopupStatePusher popupStatePusher(PopupBlocker::openAbused, true);
AutoPopupStatePusher popupStatePusher(PopupBlocker::openAbused, true);
bool disableDialog = false;
nsAutoString label, title;
@ -4702,7 +4702,7 @@ bool nsGlobalWindowOuter::AlertOrConfirm(bool aAlert, const nsAString& aMessage,
// Reset popup state while opening a modal dialog, and firing events
// about the dialog, to prevent the current state from being active
// the whole time a modal dialog is open.
nsAutoPopupStatePusher popupStatePusher(PopupBlocker::openAbused, true);
AutoPopupStatePusher popupStatePusher(PopupBlocker::openAbused, true);
// Before bringing up the window, unsuppress painting and flush
// pending reflows.
@ -4790,7 +4790,7 @@ void nsGlobalWindowOuter::PromptOuter(const nsAString& aMessage,
// Reset popup state while opening a modal dialog, and firing events
// about the dialog, to prevent the current state from being active
// the whole time a modal dialog is open.
nsAutoPopupStatePusher popupStatePusher(PopupBlocker::openAbused, true);
AutoPopupStatePusher popupStatePusher(PopupBlocker::openAbused, true);
// Before bringing up the window, unsuppress painting and flush
// pending reflows.
@ -7195,7 +7195,7 @@ nsresult nsGlobalWindowOuter::OpenInternal(
// Reset popup state while opening a window to prevent the
// current state from being active the whole time a modal
// dialog is open.
nsAutoPopupStatePusher popupStatePusher(PopupBlocker::openAbused, true);
AutoPopupStatePusher popupStatePusher(PopupBlocker::openAbused, true);
if (!aCalledNoScript) {
// We asserted at the top of this function that aNavigate is true for

View File

@ -1141,7 +1141,7 @@ void EventListenerManager::HandleEventInternal(nsPresContext* aPresContext,
aEvent->PreventDefault();
}
Maybe<nsAutoPopupStatePusher> popupStatePusher;
Maybe<AutoPopupStatePusher> popupStatePusher;
if (mIsMainThreadELM) {
popupStatePusher.emplace(
PopupBlocker::GetEventPopupControlState(aEvent, *aDOMEvent));

View File

@ -695,7 +695,7 @@ nsresult HTMLFormElement::SubmitSubmission(
nsCOMPtr<nsIDocShell> docShell;
{
nsAutoPopupStatePusher popupStatePusher(mSubmitPopupState);
AutoPopupStatePusher popupStatePusher(mSubmitPopupState);
AutoHandlingUserInputStatePusher userInpStatePusher(
aFormSubmission->IsInitiatedFromUserInput(), nullptr, doc);

View File

@ -194,7 +194,7 @@ bool HTMLLabelElement::PerformAccesskey(bool aKeyCausesActivation,
WidgetMouseEvent::eReal);
event.mInputSource = MouseEvent_Binding::MOZ_SOURCE_KEYBOARD;
nsAutoPopupStatePusher popupStatePusher(
AutoPopupStatePusher popupStatePusher(
aIsTrustedEvent ? PopupBlocker::openAllowed : PopupBlocker::openAbused);
EventDispatcher::Dispatch(static_cast<nsIContent*>(this), presContext,

View File

@ -2343,7 +2343,7 @@ bool nsGenericHTMLElement::PerformAccesskey(bool aKeyCausesActivation,
if (aKeyCausesActivation) {
// Click on it if the users prefs indicate to do so.
nsAutoPopupStatePusher popupStatePusher(
AutoPopupStatePusher popupStatePusher(
aIsTrustedEvent ? PopupBlocker::openAllowed : PopupBlocker::openAbused);
DispatchSimulatedClick(this, aIsTrustedEvent, presContext);
}

View File

@ -217,7 +217,7 @@ nsresult nsJSThunk::EvaluateScript(
}
// Push our popup control state
nsAutoPopupStatePusher popupStatePusher(aPopupState);
AutoPopupStatePusher popupStatePusher(aPopupState);
// Make sure we still have the same inner window as we used to.
nsCOMPtr<nsPIDOMWindowOuter> win = do_QueryInterface(global);

View File

@ -427,7 +427,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(
int32_t blockPopups =
Preferences::GetInt("privacy.popups.disable_from_plugins");
nsAutoPopupStatePusher popupStatePusher(
AutoPopupStatePusher popupStatePusher(
(PopupBlocker::PopupControlState)blockPopups);
// if security checks (in particular CheckLoadURIWithPrincipal) needs

View File

@ -7771,7 +7771,7 @@ nsresult PresShell::EventHandler::HandleEventWithCurrentEventInfo(
AutoHandlingUserInputStatePusher userInpStatePusher(isHandlingUserInput,
aEvent, GetDocument());
nsAutoPopupStatePusher popupStatePusher(
AutoPopupStatePusher popupStatePusher(
PopupBlocker::GetEventPopupControlState(aEvent));
// FIXME. If the event was reused, we need to clear the old target,

View File

@ -1252,7 +1252,7 @@ nsresult nsDocumentViewer::PermitUnloadInternal(uint32_t* aPermitUnloadFlags,
{
// Never permit popups from the beforeunload handler, no matter
// how we get here.
nsAutoPopupStatePusher popupStatePusher(PopupBlocker::openAbused, true);
AutoPopupStatePusher popupStatePusher(PopupBlocker::openAbused, true);
// Never permit dialogs from the beforeunload handler
nsGlobalWindowOuter* globalWindow = nsGlobalWindowOuter::Cast(window);
@ -1460,7 +1460,7 @@ nsDocumentViewer::PageHide(bool aIsUnload) {
// Never permit popups from the unload handler, no matter how we get
// here.
nsAutoPopupStatePusher popupStatePusher(PopupBlocker::openAbused, true);
AutoPopupStatePusher popupStatePusher(PopupBlocker::openAbused, true);
Document::PageUnloadingEventTimeStamp timestamp(mDocument);

View File

@ -1241,7 +1241,7 @@ nsresult nsWindowWatcher::OpenWindowInternal(
// Reset popup state while opening a modal dialog, and firing
// events about the dialog, to prevent the current state from
// being active the whole time a modal dialog is open.
nsAutoPopupStatePusher popupStatePusher(PopupBlocker::openAbused);
AutoPopupStatePusher popupStatePusher(PopupBlocker::openAbused);
newChrome->ShowAsModal();
}