mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1031051: Part 3 - Migrate CloseEvent to the WebIDL code generator. r=smaug
This commit is contained in:
parent
f4f09309a4
commit
e1b3a9ea41
@ -29,7 +29,7 @@
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsIConsoleService.h"
|
||||
#include "nsIDOMCloseEvent.h"
|
||||
#include "mozilla/dom/CloseEvent.h"
|
||||
#include "nsICryptoHash.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsIScriptError.h"
|
||||
@ -928,19 +928,15 @@ WebSocket::CreateAndDispatchCloseEvent(bool aWasClean,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// create an event that uses the CloseEvent interface,
|
||||
// which does not bubble, is not cancelable, and has no default action
|
||||
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
rv = NS_NewDOMCloseEvent(getter_AddRefs(event), this, nullptr, nullptr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDOMCloseEvent> closeEvent = do_QueryInterface(event);
|
||||
rv = closeEvent->InitCloseEvent(NS_LITERAL_STRING("close"),
|
||||
false, false,
|
||||
aWasClean, aCode, aReason);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
CloseEventInit init;
|
||||
init.mBubbles = false;
|
||||
init.mCancelable = false;
|
||||
init.mWasClean = aWasClean;
|
||||
init.mCode = aCode;
|
||||
init.mReason = aReason;
|
||||
|
||||
nsRefPtr<CloseEvent> event =
|
||||
CloseEvent::Constructor(this, NS_LITERAL_STRING("close"), init);
|
||||
event->SetTrusted(true);
|
||||
|
||||
return DispatchDOMEvent(nullptr, event, nullptr, nullptr);
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "GeckoProfiler.h"
|
||||
#include "GeneratedEvents.h"
|
||||
#include "mozilla/ContentEvents.h"
|
||||
#include "mozilla/dom/CloseEvent.h"
|
||||
#include "mozilla/dom/EventTarget.h"
|
||||
#include "mozilla/dom/HashChangeEvent.h"
|
||||
#include "mozilla/dom/StorageEvent.h"
|
||||
@ -823,8 +824,13 @@ EventDispatcher::CreateEvent(EventTarget* aOwner,
|
||||
return NS_NewDOMScrollAreaEvent(aDOMEvent, aOwner, aPresContext, nullptr);
|
||||
if (aEventType.LowerCaseEqualsLiteral("popstateevent"))
|
||||
return NS_NewDOMPopStateEvent(aDOMEvent, aOwner, aPresContext, nullptr);
|
||||
if (aEventType.LowerCaseEqualsLiteral("closeevent"))
|
||||
return NS_NewDOMCloseEvent(aDOMEvent, aOwner, aPresContext, nullptr);
|
||||
if (aEventType.LowerCaseEqualsLiteral("closeevent")) {
|
||||
CloseEventInit init;
|
||||
nsRefPtr<CloseEvent> event =
|
||||
CloseEvent::Constructor(aOwner, EmptyString(), init);
|
||||
event.forget(aDOMEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
if (aEventType.LowerCaseEqualsLiteral("touchevent") &&
|
||||
TouchEvent::PrefEnabled())
|
||||
return NS_NewDOMTouchEvent(aDOMEvent, aOwner, aPresContext, nullptr);
|
||||
|
@ -8,7 +8,6 @@ XPIDL_SOURCES += [
|
||||
'nsIDOMAnimationEvent.idl',
|
||||
'nsIDOMBeforeUnloadEvent.idl',
|
||||
'nsIDOMClipboardEvent.idl',
|
||||
'nsIDOMCloseEvent.idl',
|
||||
'nsIDOMCommandEvent.idl',
|
||||
'nsIDOMCompositionEvent.idl',
|
||||
'nsIDOMCustomEvent.idl',
|
||||
|
@ -1,28 +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"
|
||||
|
||||
/**
|
||||
* The CloseEvent interface is the interface to the event
|
||||
* close on a WebSocket object.
|
||||
*
|
||||
* For more information on this interface, please see
|
||||
* http://dev.w3.org/html5/websockets/#closeevent
|
||||
*/
|
||||
[builtinclass, uuid(0b85dc61-2436-4786-b153-097f5c3a33b6)]
|
||||
interface nsIDOMCloseEvent : nsIDOMEvent
|
||||
{
|
||||
readonly attribute boolean wasClean;
|
||||
readonly attribute unsigned short code;
|
||||
readonly attribute DOMString reason;
|
||||
|
||||
void initCloseEvent(in DOMString aType,
|
||||
in boolean aCanBubble,
|
||||
in boolean aCancelable,
|
||||
in boolean aWasClean,
|
||||
in unsigned short aReasonCode,
|
||||
in DOMString aReason);
|
||||
};
|
@ -10,21 +10,20 @@
|
||||
* http://www.whatwg.org/specs/web-apps/current-work/multipage/network.html#closeevent
|
||||
*/
|
||||
|
||||
[Constructor(DOMString type, optional CloseEventInit eventInitDict), HeaderFile="GeneratedEventClasses.h"]
|
||||
[Constructor(DOMString type, optional CloseEventInit eventInitDict),LegacyEventInit]
|
||||
interface CloseEvent : Event
|
||||
{
|
||||
readonly attribute boolean wasClean;
|
||||
readonly attribute unsigned short code;
|
||||
readonly attribute DOMString? reason;
|
||||
|
||||
// initCloseEvent is a Gecko specific deprecated method.
|
||||
[Throws]
|
||||
void initCloseEvent(DOMString type,
|
||||
boolean canBubble,
|
||||
boolean cancelable,
|
||||
boolean wasClean,
|
||||
unsigned short code,
|
||||
DOMString? reason);
|
||||
void initCloseEvent(DOMString aType,
|
||||
boolean aCanBubble,
|
||||
boolean aCancelable,
|
||||
boolean aWasClean,
|
||||
unsigned short aReasonCode,
|
||||
DOMString? aReason);
|
||||
};
|
||||
|
||||
dictionary CloseEventInit : EventInit
|
||||
|
@ -630,6 +630,7 @@ GENERATED_EVENTS_WEBIDL_FILES = [
|
||||
'CallEvent.webidl',
|
||||
'CallGroupErrorEvent.webidl',
|
||||
'CFStateChangeEvent.webidl',
|
||||
'CloseEvent.webidl',
|
||||
'DataErrorEvent.webidl',
|
||||
'DataStoreChangeEvent.webidl',
|
||||
'DeviceLightEvent.webidl',
|
||||
|
@ -13,7 +13,6 @@ simple_events = [
|
||||
'PageTransitionEvent',
|
||||
'DOMTransactionEvent',
|
||||
'PopStateEvent',
|
||||
'CloseEvent',
|
||||
'DeviceOrientationEvent',
|
||||
'MozApplicationEvent',
|
||||
'SmartCardEvent',
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "nsIDOMClientRect.h"
|
||||
#include "nsIDOMClientRectList.h"
|
||||
#include "nsIDOMClipboardEvent.h"
|
||||
#include "nsIDOMCloseEvent.h"
|
||||
#include "nsIDOMCommandEvent.h"
|
||||
#include "nsIDOMComment.h"
|
||||
#include "nsIDOMCompositionEvent.h"
|
||||
@ -174,7 +173,6 @@
|
||||
#include "mozilla/dom/DOMRectBinding.h"
|
||||
#include "mozilla/dom/DOMRectListBinding.h"
|
||||
#include "mozilla/dom/ClipboardEventBinding.h"
|
||||
#include "mozilla/dom/CloseEventBinding.h"
|
||||
#include "mozilla/dom/CommandEventBinding.h"
|
||||
#include "mozilla/dom/CommentBinding.h"
|
||||
#include "mozilla/dom/CompositionEventBinding.h"
|
||||
@ -384,7 +382,6 @@ const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] =
|
||||
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMClientRect, DOMRectReadOnly),
|
||||
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMClientRectList, DOMRectList),
|
||||
DEFINE_SHIM(ClipboardEvent),
|
||||
DEFINE_SHIM(CloseEvent),
|
||||
DEFINE_SHIM(CommandEvent),
|
||||
DEFINE_SHIM(Comment),
|
||||
DEFINE_SHIM(CompositionEvent),
|
||||
|
Loading…
Reference in New Issue
Block a user