Bug 1436508 part 2. Remove nsIDOMBeforeUnloadEvent. r=masayuki

MozReview-Commit-ID: 9svlTELngmi
This commit is contained in:
Boris Zbarsky 2018-02-09 11:17:08 -05:00
Родитель 05de0574d2
Коммит d891ae6e2d
7 изменённых файлов: 19 добавлений и 45 удалений

Просмотреть файл

@ -13,21 +13,18 @@ NS_IMPL_ADDREF_INHERITED(BeforeUnloadEvent, Event)
NS_IMPL_RELEASE_INHERITED(BeforeUnloadEvent, Event)
NS_INTERFACE_MAP_BEGIN(BeforeUnloadEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMBeforeUnloadEvent)
NS_INTERFACE_MAP_END_INHERITING(Event)
NS_IMETHODIMP
void
BeforeUnloadEvent::SetReturnValue(const nsAString& aReturnValue)
{
mText = aReturnValue;
return NS_OK; // Don't throw an exception
}
NS_IMETHODIMP
void
BeforeUnloadEvent::GetReturnValue(nsAString& aReturnValue)
{
aReturnValue = mText;
return NS_OK; // Don't throw an exception
}
} // namespace dom

Просмотреть файл

@ -9,13 +9,11 @@
#include "mozilla/dom/BeforeUnloadEventBinding.h"
#include "mozilla/dom/Event.h"
#include "nsIDOMBeforeUnloadEvent.h"
namespace mozilla {
namespace dom {
class BeforeUnloadEvent : public Event,
public nsIDOMBeforeUnloadEvent
class BeforeUnloadEvent : public Event
{
public:
BeforeUnloadEvent(EventTarget* aOwner,
@ -25,6 +23,11 @@ public:
{
}
virtual BeforeUnloadEvent* AsBeforeUnloadEvent() override
{
return this;
}
virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
{
return BeforeUnloadEventBinding::Wrap(aCx, this, aGivenProto);
@ -32,11 +35,8 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// Forward to Event
NS_FORWARD_TO_EVENT
// nsIDOMBeforeUnloadEvent Interface
NS_DECL_NSIDOMBEFOREUNLOADEVENT
void GetReturnValue(nsAString& aReturnValue);
void SetReturnValue(const nsAString& aReturnValue);
protected:
~BeforeUnloadEvent() {}

Просмотреть файл

@ -29,6 +29,7 @@ class nsPresContext;
namespace mozilla {
namespace dom {
class BeforeUnloadEvent;
class EventTarget;
class EventMessageAutoOverride;
// ExtendableEvent is a ServiceWorker event that is not
@ -112,6 +113,12 @@ public:
virtual TimeEvent* AsTimeEvent() { return nullptr; }
// BeforeUnloadEvent is not autogenerated because it has a setter.
virtual BeforeUnloadEvent* AsBeforeUnloadEvent()
{
return nullptr;
}
// nsIDOMEvent Interface
NS_DECL_NSIDOMEVENT

Просмотреть файл

@ -12,7 +12,6 @@
#include "nsIXPConnect.h"
#include "nsIMutableArray.h"
#include "nsVariant.h"
#include "nsIDOMBeforeUnloadEvent.h"
#include "nsGkAtoms.h"
#include "xpcpublic.h"
#include "nsJSEnvironment.h"
@ -22,6 +21,7 @@
#include "mozilla/HoldDropJSObjects.h"
#include "mozilla/JSEventHandler.h"
#include "mozilla/Likely.h"
#include "mozilla/dom/BeforeUnloadEvent.h"
#include "mozilla/dom/ErrorEvent.h"
#include "mozilla/dom/WorkerPrivate.h"
@ -188,7 +188,7 @@ JSEventHandler::HandleEvent(nsIDOMEvent* aEvent)
return rv.StealNSResult();
}
nsCOMPtr<nsIDOMBeforeUnloadEvent> beforeUnload = do_QueryInterface(aEvent);
BeforeUnloadEvent* beforeUnload = event->AsBeforeUnloadEvent();
NS_ENSURE_STATE(beforeUnload);
if (!DOMStringIsNull(retval)) {

Просмотреть файл

@ -8,7 +8,6 @@ with Files("**"):
BUG_COMPONENT = ("Core", "DOM: Events")
XPIDL_SOURCES += [
'nsIDOMBeforeUnloadEvent.idl',
'nsIDOMClipboardEvent.idl',
'nsIDOMCommandEvent.idl',
'nsIDOMCustomEvent.idl',

Просмотреть файл

@ -1,26 +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 "nsISupports.idl"
/**
* The nsIDOMBeforeUnloadEvent interface is the interface for events
* sent to handlers of the "beforeunload" event. This event is
* non-standard. Interface derived from Microsoft IE's event
* implementation.
*
* http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/events.asp
*
*/
[builtinclass, uuid(26c83933-a5a4-455e-8c46-69fa24dfa991)]
interface nsIDOMBeforeUnloadEvent : nsISupports
{
/**
* Attribute used to pass back a return value from a beforeunload
* handler
*/
attribute DOMString returnValue;
};

Просмотреть файл

@ -8,7 +8,6 @@
#include "ShimInterfaceInfo.h"
#include "nsIContainerBoxObject.h"
#include "nsIDOMBeforeUnloadEvent.h"
#include "nsIDOMCanvasRenderingContext2D.h"
#include "nsIDOMCharacterData.h"
#include "nsIDOMClientRect.h"
@ -75,7 +74,6 @@
#include "nsIWebBrowserPersistable.h"
#include "nsIXMLHttpRequest.h"
#include "mozilla/dom/BeforeUnloadEventBinding.h"
#include "mozilla/dom/CanvasRenderingContext2DBinding.h"
#include "mozilla/dom/CharacterDataBinding.h"
#include "mozilla/dom/DOMRectBinding.h"
@ -217,7 +215,6 @@ struct ComponentsInterfaceShimEntry {
const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] =
{
DEFINE_SHIM(BeforeUnloadEvent),
DEFINE_SHIM(CanvasRenderingContext2D),
DEFINE_SHIM(CharacterData),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMClientRect, DOMRectReadOnly),