mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1031051: Part 5 - Migrate PopupBlockedEvent to the WebIDL code generator. r=smaug
This commit is contained in:
parent
6121a4eee2
commit
6f55b1b11b
@ -851,7 +851,7 @@ HTMLInputElement::InitColorPicker()
|
||||
}
|
||||
|
||||
if (IsPopupBlocked()) {
|
||||
nsGlobalWindow::FirePopupBlockedEvent(doc, win, nullptr, EmptyString(), EmptyString());
|
||||
win->FirePopupBlockedEvent(doc, nullptr, EmptyString(), EmptyString());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -898,7 +898,7 @@ HTMLInputElement::InitFilePicker(FilePickerType aType)
|
||||
}
|
||||
|
||||
if (IsPopupBlocked()) {
|
||||
nsGlobalWindow::FirePopupBlockedEvent(doc, win, nullptr, EmptyString(), EmptyString());
|
||||
win->FirePopupBlockedEvent(doc, nullptr, EmptyString(), EmptyString());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,6 @@
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMPopupBlockedEvent.h"
|
||||
#include "nsIDOMPopStateEvent.h"
|
||||
#include "nsIDOMOfflineResourceList.h"
|
||||
#include "nsPIDOMStorage.h"
|
||||
@ -217,6 +216,7 @@
|
||||
#include "mozilla/dom/Console.h"
|
||||
#include "mozilla/dom/FunctionBinding.h"
|
||||
#include "mozilla/dom/HashChangeEvent.h"
|
||||
#include "mozilla/dom/PopupBlockedEvent.h"
|
||||
#include "mozilla/dom/WindowBinding.h"
|
||||
#include "nsITabChild.h"
|
||||
#include "mozilla/dom/MediaQueryList.h"
|
||||
@ -7380,31 +7380,33 @@ bool IsPopupBlocked(nsIDocument* aDoc)
|
||||
return permission == nsIPopupWindowManager::DENY_POPUP;
|
||||
}
|
||||
|
||||
/* static */
|
||||
void
|
||||
nsGlobalWindow::FirePopupBlockedEvent(nsIDocument* aDoc,
|
||||
nsIDOMWindow *aRequestingWindow, nsIURI *aPopupURI,
|
||||
const nsAString &aPopupWindowName,
|
||||
const nsAString &aPopupWindowFeatures)
|
||||
nsIURI* aPopupURI,
|
||||
const nsAString& aPopupWindowName,
|
||||
const nsAString& aPopupWindowFeatures)
|
||||
{
|
||||
if (aDoc) {
|
||||
// Fire a "DOMPopupBlocked" event so that the UI can hear about
|
||||
// blocked popups.
|
||||
nsCOMPtr<nsIDOMDocument> doc = do_QueryInterface(aDoc);
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
doc->CreateEvent(NS_LITERAL_STRING("PopupBlockedEvents"), getter_AddRefs(event));
|
||||
if (event) {
|
||||
nsCOMPtr<nsIDOMPopupBlockedEvent> pbev(do_QueryInterface(event));
|
||||
pbev->InitPopupBlockedEvent(NS_LITERAL_STRING("DOMPopupBlocked"),
|
||||
true, true, aRequestingWindow,
|
||||
aPopupURI, aPopupWindowName,
|
||||
aPopupWindowFeatures);
|
||||
event->SetTrusted(true);
|
||||
MOZ_ASSERT(aDoc);
|
||||
|
||||
bool defaultActionEnabled;
|
||||
aDoc->DispatchEvent(event, &defaultActionEnabled);
|
||||
}
|
||||
}
|
||||
// Fire a "DOMPopupBlocked" event so that the UI can hear about
|
||||
// blocked popups.
|
||||
PopupBlockedEventInit init;
|
||||
init.mBubbles = true;
|
||||
init.mCancelable = true;
|
||||
init.mRequestingWindow = this;
|
||||
init.mPopupWindowURI = aPopupURI;
|
||||
init.mPopupWindowName = aPopupWindowName;
|
||||
init.mPopupWindowFeatures = aPopupWindowFeatures;
|
||||
|
||||
nsRefPtr<PopupBlockedEvent> event =
|
||||
PopupBlockedEvent::Constructor(aDoc,
|
||||
NS_LITERAL_STRING("DOMPopupBlocked"),
|
||||
init);
|
||||
|
||||
event->SetTrusted(true);
|
||||
|
||||
bool defaultActionEnabled;
|
||||
aDoc->DispatchEvent(event, &defaultActionEnabled);
|
||||
}
|
||||
|
||||
static void FirePopupWindowEvent(nsIDocument* aDoc)
|
||||
@ -7541,7 +7543,7 @@ nsGlobalWindow::FireAbuseEvents(bool aBlocked, bool aWindow,
|
||||
|
||||
// fire an event chock full of informative URIs
|
||||
if (aBlocked) {
|
||||
FirePopupBlockedEvent(topDoc, this, popupURI, aPopupWindowName,
|
||||
FirePopupBlockedEvent(topDoc, popupURI, aPopupWindowName,
|
||||
aPopupWindowFeatures);
|
||||
}
|
||||
if (aWindow)
|
||||
|
@ -682,10 +682,11 @@ public:
|
||||
mCleanedUp);
|
||||
}
|
||||
|
||||
static void FirePopupBlockedEvent(nsIDocument* aDoc,
|
||||
nsIDOMWindow *aRequestingWindow, nsIURI *aPopupURI,
|
||||
const nsAString &aPopupWindowName,
|
||||
const nsAString &aPopupWindowFeatures);
|
||||
virtual void
|
||||
FirePopupBlockedEvent(nsIDocument* aDoc,
|
||||
nsIURI* aPopupURI,
|
||||
const nsAString& aPopupWindowName,
|
||||
const nsAString& aPopupWindowFeatures) MOZ_OVERRIDE;
|
||||
|
||||
virtual uint32_t GetSerial() {
|
||||
return mSerial;
|
||||
|
@ -60,8 +60,8 @@ enum UIStateChangeType
|
||||
};
|
||||
|
||||
#define NS_PIDOMWINDOW_IID \
|
||||
{ 0x33403513, 0x6e4a, 0x4985, \
|
||||
{ 0x99, 0x8d, 0xfc, 0x02, 0x81, 0x6e, 0xb9, 0xf2 } }
|
||||
{ 0x71412748, 0x6368, 0x4332, \
|
||||
{ 0x82, 0x66, 0xff, 0xaa, 0x19, 0xda, 0x09, 0x7c } }
|
||||
|
||||
class nsPIDOMWindow : public nsIDOMWindowInternal
|
||||
{
|
||||
@ -705,6 +705,15 @@ public:
|
||||
OpenNoNavigate(const nsAString& aUrl, const nsAString& aName,
|
||||
const nsAString& aOptions, nsIDOMWindow **_retval) = 0;
|
||||
|
||||
/**
|
||||
* Fire a popup blocked event on the document.
|
||||
*/
|
||||
virtual void
|
||||
FirePopupBlockedEvent(nsIDocument* aDoc,
|
||||
nsIURI* aPopupURI,
|
||||
const nsAString& aPopupWindowName,
|
||||
const nsAString& aPopupWindowFeatures) = 0;
|
||||
|
||||
// Inner windows only.
|
||||
void AddAudioContext(mozilla::dom::AudioContext* aAudioContext);
|
||||
void RemoveAudioContext(mozilla::dom::AudioContext* aAudioContext);
|
||||
|
@ -776,8 +776,6 @@ EventDispatcher::CreateEvent(EventTarget* aOwner,
|
||||
if (aEventType.LowerCaseEqualsLiteral("textevent") ||
|
||||
aEventType.LowerCaseEqualsLiteral("textevents"))
|
||||
return NS_NewDOMUIEvent(aDOMEvent, aOwner, aPresContext, nullptr);
|
||||
if (aEventType.LowerCaseEqualsLiteral("popupblockedevents"))
|
||||
return NS_NewDOMPopupBlockedEvent(aDOMEvent, aOwner, aPresContext, nullptr);
|
||||
if (aEventType.LowerCaseEqualsLiteral("deviceorientationevent"))
|
||||
return NS_NewDOMDeviceOrientationEvent(aDOMEvent, aOwner, aPresContext, nullptr);
|
||||
if (aEventType.LowerCaseEqualsLiteral("devicemotionevent"))
|
||||
|
@ -30,7 +30,6 @@ XPIDL_SOURCES += [
|
||||
'nsIDOMPageTransitionEvent.idl',
|
||||
'nsIDOMPaintRequest.idl',
|
||||
'nsIDOMPopStateEvent.idl',
|
||||
'nsIDOMPopupBlockedEvent.idl',
|
||||
'nsIDOMRecordErrorEvent.idl',
|
||||
'nsIDOMScrollAreaEvent.idl',
|
||||
'nsIDOMSimpleGestureEvent.idl',
|
||||
|
@ -1,49 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsIDOMEvent.idl"
|
||||
|
||||
interface nsIURI;
|
||||
|
||||
/**
|
||||
* The nsIDOMPopupBlockedEvent interface is the datatype for events
|
||||
* posted when a popup window is blocked.
|
||||
*/
|
||||
|
||||
[builtinclass, uuid(f6e77f79-d178-419d-8177-dfae4392d318)]
|
||||
interface nsIDOMPopupBlockedEvent : nsIDOMEvent
|
||||
{
|
||||
/**
|
||||
* The window object that attempted to open the blocked popup
|
||||
* (i.e. the window object on which open() was called).
|
||||
*/
|
||||
readonly attribute nsIDOMWindow requestingWindow;
|
||||
|
||||
|
||||
/**
|
||||
* The URI of the window that was blocked.
|
||||
*/
|
||||
readonly attribute nsIURI popupWindowURI;
|
||||
|
||||
/**
|
||||
* The window name passed to the window.open() call
|
||||
* (as the second argument)
|
||||
*/
|
||||
readonly attribute DOMString popupWindowName;
|
||||
|
||||
/**
|
||||
* The string of features passed to the window.open() call
|
||||
* (as the third argument)
|
||||
*/
|
||||
readonly attribute DOMString popupWindowFeatures;
|
||||
|
||||
void initPopupBlockedEvent(in DOMString typeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in nsIDOMWindow requestingWindow,
|
||||
in nsIURI popupWindowURI,
|
||||
in DOMString popupWindowName,
|
||||
in DOMString popupWindowFeatures);
|
||||
};
|
@ -1378,12 +1378,13 @@ MediaManager::GetUserMedia(bool aPrivileged,
|
||||
}
|
||||
uint32_t permission;
|
||||
nsCOMPtr<nsIDocument> doc = aWindow->GetExtantDoc();
|
||||
pm->TestPermission(doc->NodePrincipal(), &permission);
|
||||
if (permission == nsIPopupWindowManager::DENY_POPUP) {
|
||||
nsGlobalWindow::FirePopupBlockedEvent(
|
||||
doc, aWindow, nullptr, EmptyString(), EmptyString()
|
||||
);
|
||||
return NS_OK;
|
||||
if (doc) {
|
||||
pm->TestPermission(doc->NodePrincipal(), &permission);
|
||||
if (permission == nsIPopupWindowManager::DENY_POPUP) {
|
||||
aWindow->FirePopupBlockedEvent(doc, nullptr, EmptyString(),
|
||||
EmptyString());
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,22 +5,13 @@
|
||||
*/
|
||||
interface URI;
|
||||
|
||||
[Constructor(DOMString type, optional PopupBlockedEventInit eventInitDict), HeaderFile="GeneratedEventClasses.h"]
|
||||
[Constructor(DOMString type, optional PopupBlockedEventInit eventInitDict)]
|
||||
interface PopupBlockedEvent : Event
|
||||
{
|
||||
readonly attribute Window? requestingWindow;
|
||||
readonly attribute URI? popupWindowURI;
|
||||
readonly attribute DOMString? popupWindowName;
|
||||
readonly attribute DOMString? popupWindowFeatures;
|
||||
|
||||
[Throws]
|
||||
void initPopupBlockedEvent(DOMString type,
|
||||
boolean canBubble,
|
||||
boolean cancelable,
|
||||
Window? requestingWindow,
|
||||
URI? popupWindowURI,
|
||||
DOMString? popupWindowName,
|
||||
DOMString? popupWindowFeatures);
|
||||
};
|
||||
|
||||
dictionary PopupBlockedEventInit : EventInit
|
||||
|
@ -647,6 +647,7 @@ GENERATED_EVENTS_WEBIDL_FILES = [
|
||||
'MozOtaStatusEvent.webidl',
|
||||
'MozSmsEvent.webidl',
|
||||
'MozStkCommandEvent.webidl',
|
||||
'PopupBlockedEvent.webidl',
|
||||
'ProgressEvent.webidl',
|
||||
'RTCDataChannelEvent.webidl',
|
||||
'RTCPeerConnectionIceEvent.webidl',
|
||||
|
@ -23,7 +23,6 @@ simple_events = [
|
||||
'SpeechSynthesisEvent',
|
||||
#endif
|
||||
'DeviceStorageChangeEvent',
|
||||
'PopupBlockedEvent',
|
||||
'RecordErrorEvent',
|
||||
#ifdef MOZ_WEBSPEECH
|
||||
'SpeechRecognitionEvent',
|
||||
|
@ -124,7 +124,6 @@
|
||||
#include "nsIDOMPaintRequest.h"
|
||||
#include "nsIDOMParser.h"
|
||||
#include "nsIDOMPopStateEvent.h"
|
||||
#include "nsIDOMPopupBlockedEvent.h"
|
||||
#include "nsIDOMProcessingInstruction.h"
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsIDOMRecordErrorEvent.h"
|
||||
@ -280,7 +279,6 @@
|
||||
#include "mozilla/dom/PageTransitionEventBinding.h"
|
||||
#include "mozilla/dom/PaintRequestBinding.h"
|
||||
#include "mozilla/dom/PopStateEventBinding.h"
|
||||
#include "mozilla/dom/PopupBlockedEventBinding.h"
|
||||
#include "mozilla/dom/PositionErrorBinding.h"
|
||||
#include "mozilla/dom/ProcessingInstructionBinding.h"
|
||||
#include "mozilla/dom/RangeBinding.h"
|
||||
@ -489,7 +487,6 @@ const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] =
|
||||
DEFINE_SHIM(PaintRequest),
|
||||
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMParser, DOMParser),
|
||||
DEFINE_SHIM(PopStateEvent),
|
||||
DEFINE_SHIM(PopupBlockedEvent),
|
||||
DEFINE_SHIM(ProcessingInstruction),
|
||||
DEFINE_SHIM(Range),
|
||||
DEFINE_SHIM(RecordErrorEvent),
|
||||
|
Loading…
Reference in New Issue
Block a user