--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -52,16 +52,17 @@
#include "mozilla/dom/ipc/BlobChild.h"
#include "mozilla/dom/ipc/BlobParent.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/TextDecoder.h"
#include "mozilla/dom/TouchEvent.h"
#include "mozilla/dom/ShadowRoot.h"
+#include "mozilla/dom/XULCommandEvent.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/dom/workers/ServiceWorkerManager.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/EventListenerManager.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/gfx/DataSurfaceHelpers.h"
#include "mozilla/IMEStateManager.h"
#include "mozilla/InternalMutationEvent.h"
@@ -127,17 +128,16 @@
#include "nsIDOMEvent.h"
#include "nsIDOMElement.h"
#include "nsIDOMHTMLElement.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMWindowUtils.h"
-#include "nsIDOMXULCommandEvent.h"
#include "nsIDragService.h"
#include "nsIEditor.h"
#include "nsIFormControl.h"
#include "nsIForm.h"
#include "nsIFragmentContentSink.h"
#include "nsContainerFrame.h"
#include "nsIHTMLDocument.h"
#include "nsIIdleService.h"
@@ -6346,38 +6346,37 @@ nsContentUtils::DispatchXULCommand(nsICo
nsIPresShell* aShell,
bool aCtrl,
bool aAlt,
bool aShift,
bool aMeta)
{
NS_ENSURE_STATE(aTarget);
nsIDocument* doc = aTarget->OwnerDoc();
- nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(doc);
- NS_ENSURE_STATE(domDoc);
- nsCOMPtr<nsIDOMEvent> event;
- domDoc->CreateEvent(NS_LITERAL_STRING("xulcommandevent"),
- getter_AddRefs(event));
- nsCOMPtr<nsIDOMXULCommandEvent> xulCommand = do_QueryInterface(event);
- nsresult rv = xulCommand->InitCommandEvent(NS_LITERAL_STRING("command"),
- true, true, doc->GetInnerWindow(),
- 0, aCtrl, aAlt, aShift, aMeta,
- aSourceEvent);
- NS_ENSURE_SUCCESS(rv, rv);
+ nsIPresShell* shell = doc->GetShell();
+ nsPresContext* presContext = nullptr;
+ if (shell) {
+ presContext = shell->GetPresContext();
+ }
+ RefPtr<XULCommandEvent> xulCommand = new XULCommandEvent(doc, presContext,
+ nullptr);
+ xulCommand->InitCommandEvent(NS_LITERAL_STRING("command"), true, true,
+ doc->GetInnerWindow(), 0, aCtrl, aAlt, aShift,
+ aMeta, aSourceEvent);
if (aShell) {
nsEventStatus status = nsEventStatus_eIgnore;
nsCOMPtr<nsIPresShell> kungFuDeathGrip = aShell;
- return aShell->HandleDOMEventWithTarget(aTarget, event, &status);
+ return aShell->HandleDOMEventWithTarget(aTarget, xulCommand, &status);
}
nsCOMPtr<EventTarget> target = do_QueryInterface(aTarget);
NS_ENSURE_STATE(target);
bool dummy;
- return target->DispatchEvent(event, &dummy);
+ return target->DispatchEvent(xulCommand, &dummy);
}
// static
nsresult
nsContentUtils::WrapNative(JSContext *cx, nsISupports *native,
nsWrapperCache *cache, const nsIID* aIID,
JS::MutableHandle<JS::Value> vp, bool aAllowWrapping)
{
--- a/dom/base/nsDeprecatedOperationList.h
+++ b/dom/base/nsDeprecatedOperationList.h
@@ -32,17 +32,16 @@ DEPRECATED_OPERATION(GetSetUserData)
DEPRECATED_OPERATION(MozGetAsFile)
DEPRECATED_OPERATION(UseOfCaptureEvents)
DEPRECATED_OPERATION(UseOfReleaseEvents)
DEPRECATED_OPERATION(UseOfDOM3LoadMethod)
DEPRECATED_OPERATION(ChromeUseOfDOM3LoadMethod)
DEPRECATED_OPERATION(ShowModalDialog)
DEPRECATED_OPERATION(Window_Content)
DEPRECATED_OPERATION(SyncXMLHttpRequest)
-DEPRECATED_OPERATION(DataContainerEvent)
DEPRECATED_OPERATION(Window_Controllers)
DEPRECATED_OPERATION(ImportXULIntoContent)
DEPRECATED_OPERATION(PannerNodeDoppler)
DEPRECATED_OPERATION(NavigatorGetUserMedia)
DEPRECATED_OPERATION(WebrtcDeprecatedPrefix)
DEPRECATED_OPERATION(RTCPeerConnectionGetStreams)
DEPRECATED_OPERATION(AppCache)
DEPRECATED_OPERATION(PrefixedImageSmoothingEnabled)
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -7997,36 +7997,38 @@ nsDocument::GetEventTargetParent(EventCh
return NS_OK;
}
NS_IMETHODIMP
nsDocument::CreateEvent(const nsAString& aEventType, nsIDOMEvent** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
ErrorResult rv;
- *aReturn = nsIDocument::CreateEvent(aEventType, rv).take();
+ *aReturn = nsIDocument::CreateEvent(aEventType, CallerType::System,
+ rv).take();
return rv.StealNSResult();
}
already_AddRefed<Event>
-nsIDocument::CreateEvent(const nsAString& aEventType, ErrorResult& rv) const
+nsIDocument::CreateEvent(const nsAString& aEventType, CallerType aCallerType,
+ ErrorResult& rv) const
{
nsIPresShell *shell = GetShell();
nsPresContext *presContext = nullptr;
if (shell) {
// Retrieve the context
presContext = shell->GetPresContext();
}
// Create event even without presContext.
RefPtr<Event> ev =
EventDispatcher::CreateEvent(const_cast<nsIDocument*>(this), presContext,
- nullptr, aEventType);
+ nullptr, aEventType, aCallerType);
if (!ev) {
rv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return nullptr;
}
WidgetEvent* e = ev->WidgetEventPtr();
e->mFlags.mBubbles = false;
e->mFlags.mCancelable = false;
return ev.forget();
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -6557,17 +6557,18 @@ nsGlobalWindow::DispatchCustomEvent(cons
bool
nsGlobalWindow::DispatchResizeEvent(const CSSIntSize& aSize)
{
MOZ_ASSERT(IsOuterWindow());
ErrorResult res;
RefPtr<Event> domEvent =
- mDoc->CreateEvent(NS_LITERAL_STRING("CustomEvent"), res);
+ mDoc->CreateEvent(NS_LITERAL_STRING("CustomEvent"), CallerType::System,
+ res);
if (res.Failed()) {
return false;
}
// We don't init the AutoJSAPI with ourselves because we don't want it
// reporting errors to our onerror handlers.
AutoJSAPI jsapi;
jsapi.Init();
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -2623,17 +2623,19 @@ public:
CreateComment(const nsAString& aData) const;
already_AddRefed<mozilla::dom::ProcessingInstruction>
CreateProcessingInstruction(const nsAString& target, const nsAString& data,
mozilla::ErrorResult& rv) const;
already_AddRefed<nsINode>
ImportNode(nsINode& aNode, bool aDeep, mozilla::ErrorResult& rv) const;
nsINode* AdoptNode(nsINode& aNode, mozilla::ErrorResult& rv);
already_AddRefed<mozilla::dom::Event>
- CreateEvent(const nsAString& aEventType, mozilla::ErrorResult& rv) const;
+ CreateEvent(const nsAString& aEventType,
+ mozilla::dom::CallerType aCallerType,
+ mozilla::ErrorResult& rv) const;
already_AddRefed<nsRange> CreateRange(mozilla::ErrorResult& rv);
already_AddRefed<mozilla::dom::NodeIterator>
CreateNodeIterator(nsINode& aRoot, uint32_t aWhatToShow,
mozilla::dom::NodeFilter* aFilter,
mozilla::ErrorResult& rv) const;
already_AddRefed<mozilla::dom::NodeIterator>
CreateNodeIterator(nsINode& aRoot, uint32_t aWhatToShow,
mozilla::dom::NodeFilterHolder aFilter,
--- a/dom/canvas/WebGLContextUtils.cpp
+++ b/dom/canvas/WebGLContextUtils.cpp
@@ -6,17 +6,16 @@
#include "WebGLContextUtils.h"
#include "WebGLContext.h"
#include "GLContext.h"
#include "jsapi.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/Preferences.h"
#include "mozilla/Sprintf.h"
-#include "nsIDOMDataContainerEvent.h"
#include "nsIDOMEvent.h"
#include "nsIScriptSecurityManager.h"
#include "nsIVariant.h"
#include "nsPrintfCString.h"
#include "nsServiceManagerUtils.h"
#include <stdarg.h>
#include "WebGLBuffer.h"
#include "WebGLExtensions.h"
deleted file mode 100644
--- a/dom/events/DataContainerEvent.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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 "mozilla/dom/DataContainerEvent.h"
-#include "nsContentUtils.h"
-#include "nsIDocument.h"
-#include "nsIXPConnect.h"
-
-namespace mozilla {
-namespace dom {
-
-DataContainerEvent::DataContainerEvent(EventTarget* aOwner,
- nsPresContext* aPresContext,
- WidgetEvent* aEvent)
- : Event(aOwner, aPresContext, aEvent)
-{
- if (nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(aOwner)) {
- if (nsIDocument* doc = win->GetExtantDoc()) {
- doc->WarnOnceAbout(nsIDocument::eDataContainerEvent);
- }
- }
-}
-
-NS_IMPL_CYCLE_COLLECTION_CLASS(DataContainerEvent)
-
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(DataContainerEvent, Event)
- NS_IMPL_CYCLE_COLLECTION_UNLINK(mData)
-NS_IMPL_CYCLE_COLLECTION_UNLINK_END
-
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(DataContainerEvent, Event)
- NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mData)
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
-
-NS_IMPL_ADDREF_INHERITED(DataContainerEvent, Event)
-NS_IMPL_RELEASE_INHERITED(DataContainerEvent, Event)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(DataContainerEvent)
- NS_INTERFACE_MAP_ENTRY(nsIDOMDataContainerEvent)
-NS_INTERFACE_MAP_END_INHERITING(Event)
-
-NS_IMETHODIMP
-DataContainerEvent::GetData(const nsAString& aKey, nsIVariant** aData)
-{
- NS_ENSURE_ARG_POINTER(aData);
-
- mData.Get(aKey, aData);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-DataContainerEvent::SetData(const nsAString& aKey, nsIVariant* aData)
-{
- NS_ENSURE_ARG(aData);
-
- // Make sure this event isn't already being dispatched.
- NS_ENSURE_STATE(!mEvent->mFlags.mIsBeingDispatched);
- mData.Put(aKey, aData);
- return NS_OK;
-}
-
-void
-DataContainerEvent::SetData(JSContext* aCx, const nsAString& aKey,
- JS::Handle<JS::Value> aVal,
- ErrorResult& aRv)
-{
- if (!nsContentUtils::XPConnect()) {
- aRv = NS_ERROR_FAILURE;
- return;
- }
- nsCOMPtr<nsIVariant> val;
- nsresult rv =
- nsContentUtils::XPConnect()->JSToVariant(aCx, aVal, getter_AddRefs(val));
- if (NS_FAILED(rv)) {
- aRv = rv;
- return;
- }
- aRv = SetData(aKey, val);
-}
-
-} // namespace dom
-} // namespace mozilla
-
-using namespace mozilla;
-using namespace mozilla::dom;
-
-already_AddRefed<DataContainerEvent>
-NS_NewDOMDataContainerEvent(EventTarget* aOwner,
- nsPresContext* aPresContext,
- WidgetEvent* aEvent)
-{
- RefPtr<DataContainerEvent> it =
- new DataContainerEvent(aOwner, aPresContext, aEvent);
- return it.forget();
-}
-
deleted file mode 100644
--- a/dom/events/DataContainerEvent.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#ifndef mozilla_dom_DataContainerEvent_h_
-#define mozilla_dom_DataContainerEvent_h_
-
-#include "mozilla/dom/DataContainerEventBinding.h"
-#include "mozilla/dom/Event.h"
-#include "nsIDOMDataContainerEvent.h"
-#include "nsInterfaceHashtable.h"
-
-namespace mozilla {
-namespace dom {
-
-class DataContainerEvent : public Event,
- public nsIDOMDataContainerEvent
-{
-public:
- DataContainerEvent(EventTarget* aOwner,
- nsPresContext* aPresContext,
- WidgetEvent* aEvent);
-
- NS_DECL_ISUPPORTS_INHERITED
-
- NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DataContainerEvent, Event)
-
- NS_FORWARD_TO_EVENT
-
- NS_DECL_NSIDOMDATACONTAINEREVENT
-
- virtual JSObject*
- WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
- {
- return DataContainerEventBinding::Wrap(aCx, this, aGivenProto);
- }
-
- already_AddRefed<nsIVariant> GetData(const nsAString& aKey)
- {
- nsCOMPtr<nsIVariant> val;
- GetData(aKey, getter_AddRefs(val));
- return val.forget();
- }
-
- void SetData(JSContext* aCx, const nsAString& aKey,
- JS::Handle<JS::Value> aVal, ErrorResult& aRv);
-
-protected:
- ~DataContainerEvent() {}
-
-private:
- nsInterfaceHashtable<nsStringHashKey, nsIVariant> mData;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-already_AddRefed<mozilla::dom::DataContainerEvent>
-NS_NewDOMDataContainerEvent(mozilla::dom::EventTarget* aOwner,
- nsPresContext* aPresContext,
- mozilla::WidgetEvent* aEvent);
-
-#endif // mozilla_dom_DataContainerEvent_h_
--- a/dom/events/EventDispatcher.cpp
+++ b/dom/events/EventDispatcher.cpp
@@ -12,17 +12,16 @@
#include "nsIDocument.h"
#include "nsINode.h"
#include "nsPIDOMWindow.h"
#include "AnimationEvent.h"
#include "BeforeUnloadEvent.h"
#include "ClipboardEvent.h"
#include "CommandEvent.h"
#include "CompositionEvent.h"
-#include "DataContainerEvent.h"
#include "DeviceMotionEvent.h"
#include "DragEvent.h"
#include "GeckoProfiler.h"
#include "KeyboardEvent.h"
#include "mozilla/ContentEvents.h"
#include "mozilla/dom/CloseEvent.h"
#include "mozilla/dom/CustomEvent.h"
#include "mozilla/dom/DeviceOrientationEvent.h"
@@ -897,17 +896,18 @@ EventDispatcher::DispatchDOMEvent(nsISup
}
return NS_ERROR_ILLEGAL_VALUE;
}
/* static */ already_AddRefed<dom::Event>
EventDispatcher::CreateEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetEvent* aEvent,
- const nsAString& aEventType)
+ const nsAString& aEventType,
+ CallerType aCallerType)
{
if (aEvent) {
switch(aEvent->mClass) {
case eMutationEventClass:
return NS_NewDOMMutationEvent(aOwner, aPresContext,
aEvent->AsMutationEvent());
case eGUIEventClass:
case eScrollPortEventClass:
@@ -973,52 +973,40 @@ EventDispatcher::CreateEvent(EventTarget
if (aEventType.LowerCaseEqualsLiteral("mouseevent")) {
LOG_EVENT_CREATION(MOUSEEVENT);
return NS_NewDOMMouseEvent(aOwner, aPresContext, nullptr);
}
if (aEventType.LowerCaseEqualsLiteral("mouseevents")) {
LOG_EVENT_CREATION(MOUSEEVENTS);
return NS_NewDOMMouseEvent(aOwner, aPresContext, nullptr);
}
- if (aEventType.LowerCaseEqualsLiteral("popupevents")) {
- LOG_EVENT_CREATION(POPUPEVENTS);
- return NS_NewDOMMouseEvent(aOwner, aPresContext, nullptr);
- }
if (aEventType.LowerCaseEqualsLiteral("mousescrollevents")) {
LOG_EVENT_CREATION(MOUSESCROLLEVENTS);
return NS_NewDOMMouseScrollEvent(aOwner, aPresContext, nullptr);
}
if (aEventType.LowerCaseEqualsLiteral("dragevent")) {
LOG_EVENT_CREATION(DRAGEVENT);
return NS_NewDOMDragEvent(aOwner, aPresContext, nullptr);
}
- if (aEventType.LowerCaseEqualsLiteral("dragevents")) {
- LOG_EVENT_CREATION(DRAGEVENTS);
- return NS_NewDOMDragEvent(aOwner, aPresContext, nullptr);
- }
if (aEventType.LowerCaseEqualsLiteral("keyboardevent")) {
LOG_EVENT_CREATION(KEYBOARDEVENT);
return NS_NewDOMKeyboardEvent(aOwner, aPresContext, nullptr);
}
if (aEventType.LowerCaseEqualsLiteral("keyevents")) {
LOG_EVENT_CREATION(KEYEVENTS);
return NS_NewDOMKeyboardEvent(aOwner, aPresContext, nullptr);
}
if (aEventType.LowerCaseEqualsLiteral("compositionevent")) {
LOG_EVENT_CREATION(COMPOSITIONEVENT);
return NS_NewDOMCompositionEvent(aOwner, aPresContext, nullptr);
}
if (aEventType.LowerCaseEqualsLiteral("textevent")) {
LOG_EVENT_CREATION(TEXTEVENT);
return NS_NewDOMCompositionEvent(aOwner, aPresContext, nullptr);
}
- if (aEventType.LowerCaseEqualsLiteral("textevents")) {
- LOG_EVENT_CREATION(TEXTEVENTS);
- return NS_NewDOMCompositionEvent(aOwner, aPresContext, nullptr);
- }
if (aEventType.LowerCaseEqualsLiteral("mutationevent")) {
LOG_EVENT_CREATION(MUTATIONEVENT);
return NS_NewDOMMutationEvent(aOwner, aPresContext, nullptr);
}
if (aEventType.LowerCaseEqualsLiteral("mutationevents")) {
LOG_EVENT_CREATION(MUTATIONEVENTS);
return NS_NewDOMMutationEvent(aOwner, aPresContext, nullptr);
}
@@ -1049,82 +1037,33 @@ EventDispatcher::CreateEvent(EventTarget
if (aEventType.LowerCaseEqualsLiteral("events")) {
LOG_EVENT_CREATION(EVENTS);
return NS_NewDOMEvent(aOwner, aPresContext, nullptr);
}
if (aEventType.LowerCaseEqualsLiteral("htmlevents")) {
LOG_EVENT_CREATION(HTMLEVENTS);
return NS_NewDOMEvent(aOwner, aPresContext, nullptr);
}
- if (aEventType.LowerCaseEqualsLiteral("svgevent")) {
- LOG_EVENT_CREATION(SVGEVENT);
- return NS_NewDOMEvent(aOwner, aPresContext, nullptr);
- }
if (aEventType.LowerCaseEqualsLiteral("svgevents")) {
LOG_EVENT_CREATION(SVGEVENTS);
return NS_NewDOMEvent(aOwner, aPresContext, nullptr);
}
if (aEventType.LowerCaseEqualsLiteral("timeevent")) {
LOG_EVENT_CREATION(TIMEEVENT);
return NS_NewDOMTimeEvent(aOwner, aPresContext, nullptr);
}
- if (aEventType.LowerCaseEqualsLiteral("timeevents")) {
- LOG_EVENT_CREATION(TIMEEVENTS);
- return NS_NewDOMTimeEvent(aOwner, aPresContext, nullptr);
- }
- if (aEventType.LowerCaseEqualsLiteral("xulcommandevent")) {
- LOG_EVENT_CREATION(XULCOMMANDEVENT);
- return NS_NewDOMXULCommandEvent(aOwner, aPresContext, nullptr);
- }
- if (aEventType.LowerCaseEqualsLiteral("xulcommandevents")) {
- LOG_EVENT_CREATION(XULCOMMANDEVENTS);
- return NS_NewDOMXULCommandEvent(aOwner, aPresContext, nullptr);
- }
- if (aEventType.LowerCaseEqualsLiteral("commandevent")) {
- LOG_EVENT_CREATION(COMMANDEVENT);
- return NS_NewDOMCommandEvent(aOwner, aPresContext, nullptr);
- }
- if (aEventType.LowerCaseEqualsLiteral("commandevents")) {
- LOG_EVENT_CREATION(COMMANDEVENTS);
- return NS_NewDOMCommandEvent(aOwner, aPresContext, nullptr);
- }
- if (aEventType.LowerCaseEqualsLiteral("datacontainerevent")) {
- LOG_EVENT_CREATION(DATACONTAINEREVENT);
- return NS_NewDOMDataContainerEvent(aOwner, aPresContext, nullptr);
- }
- if (aEventType.LowerCaseEqualsLiteral("datacontainerevents")) {
- LOG_EVENT_CREATION(DATACONTAINEREVENTS);
- return NS_NewDOMDataContainerEvent(aOwner, aPresContext, nullptr);
- }
if (aEventType.LowerCaseEqualsLiteral("messageevent")) {
LOG_EVENT_CREATION(MESSAGEEVENT);
RefPtr<Event> event = new MessageEvent(aOwner, aPresContext, nullptr);
return event.forget();
}
- if (aEventType.LowerCaseEqualsLiteral("notifypaintevent")) {
- LOG_EVENT_CREATION(NOTIFYPAINTEVENT);
- return NS_NewDOMNotifyPaintEvent(aOwner, aPresContext, nullptr);
- }
- if (aEventType.LowerCaseEqualsLiteral("simplegestureevent")) {
- LOG_EVENT_CREATION(SIMPLEGESTUREEVENT);
- return NS_NewDOMSimpleGestureEvent(aOwner, aPresContext, nullptr);
- }
if (aEventType.LowerCaseEqualsLiteral("beforeunloadevent")) {
LOG_EVENT_CREATION(BEFOREUNLOADEVENT);
return NS_NewDOMBeforeUnloadEvent(aOwner, aPresContext, nullptr);
}
- // XXXkhuey this is broken
- if (aEventType.LowerCaseEqualsLiteral("pagetransition")) {
- LOG_EVENT_CREATION(PAGETRANSITION);
- PageTransitionEventInit init;
- RefPtr<Event> event =
- PageTransitionEvent::Constructor(aOwner, EmptyString(), init);
- event->MarkUninitialized();
- return event.forget();
- }
if (aEventType.LowerCaseEqualsLiteral("scrollareaevent")) {
LOG_EVENT_CREATION(SCROLLAREAEVENT);
return NS_NewDOMScrollAreaEvent(aOwner, aPresContext, nullptr);
}
// XXXkhuey Chrome supports popstateevent here, even though it provides no
// initPopStateEvent method. This is nuts ... but copying it is unlikely to
// break the web.
if (aEventType.LowerCaseEqualsLiteral("popstateevent")) {
@@ -1164,16 +1103,31 @@ EventDispatcher::CreateEvent(EventTarget
LOG_EVENT_CREATION(ERROREVENT);
RootedDictionary<ErrorEventInit> init(RootingCx());
RefPtr<Event> event =
ErrorEvent::Constructor(aOwner, EmptyString(), init);
event->MarkUninitialized();
return event.forget();
}
+ // Only allow these events for chrome
+ if (aCallerType == CallerType::System) {
+ if (aEventType.LowerCaseEqualsLiteral("simplegestureevent")) {
+ return NS_NewDOMSimpleGestureEvent(aOwner, aPresContext, nullptr);
+ }
+ if (aEventType.LowerCaseEqualsLiteral("xulcommandevent")) {
+ LOG_EVENT_CREATION(XULCOMMANDEVENT);
+ return NS_NewDOMXULCommandEvent(aOwner, aPresContext, nullptr);
+ }
+ if (aEventType.LowerCaseEqualsLiteral("xulcommandevents")) {
+ LOG_EVENT_CREATION(XULCOMMANDEVENTS);
+ return NS_NewDOMXULCommandEvent(aOwner, aPresContext, nullptr);
+ }
+ }
+
#undef LOG_EVENT_CREATION
// NEW EVENT TYPES SHOULD NOT BE ADDED HERE; THEY SHOULD USE ONLY EVENT
// CONSTRUCTORS
return nullptr;
}
--- a/dom/events/EventDispatcher.h
+++ b/dom/events/EventDispatcher.h
@@ -3,16 +3,17 @@
/* 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/. */
#ifdef MOZILLA_INTERNAL_API
#ifndef mozilla_EventDispatcher_h_
#define mozilla_EventDispatcher_h_
+#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/EventForwards.h"
#include "nsCOMPtr.h"
#include "nsTArray.h"
// Microsoft's API Name hackery sucks
#undef CreateEvent
class nsIContent;
@@ -281,17 +282,19 @@ public:
nsEventStatus* aEventStatus);
/**
* Creates a DOM Event. Returns null if the event type is unsupported.
*/
static already_AddRefed<dom::Event> CreateEvent(dom::EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetEvent* aEvent,
- const nsAString& aEventType);
+ const nsAString& aEventType,
+ dom::CallerType aCallerType =
+ dom::CallerType::System);
/**
* Called at shutting down.
*/
static void Shutdown();
};
} // namespace mozilla
--- a/dom/events/moz.build
+++ b/dom/events/moz.build
@@ -39,17 +39,16 @@ EXPORTS.mozilla += [
EXPORTS.mozilla.dom += [
'AnimationEvent.h',
'BeforeUnloadEvent.h',
'ClipboardEvent.h',
'CommandEvent.h',
'CompositionEvent.h',
'CustomEvent.h',
- 'DataContainerEvent.h',
'DataTransfer.h',
'DataTransferItem.h',
'DataTransferItemList.h',
'DeviceMotionEvent.h',
'DragEvent.h',
'Event.h',
'EventTarget.h',
'FocusEvent.h',
@@ -82,17 +81,16 @@ UNIFIED_SOURCES += [
'AnimationEvent.cpp',
'AsyncEventDispatcher.cpp',
'BeforeUnloadEvent.cpp',
'ClipboardEvent.cpp',
'CommandEvent.cpp',
'CompositionEvent.cpp',
'ContentEventHandler.cpp',
'CustomEvent.cpp',
- 'DataContainerEvent.cpp',
'DataTransfer.cpp',
'DataTransferItem.cpp',
'DataTransferItemList.cpp',
'DeviceMotionEvent.cpp',
'DOMEventTargetHelper.cpp',
'DragEvent.cpp',
'Event.cpp',
'EventDispatcher.cpp',
--- a/dom/events/test/chrome.ini
+++ b/dom/events/test/chrome.ini
@@ -6,17 +6,16 @@ support-files =
bug418986-3.js
bug591249_iframe.xul
bug602962.xul
file_bug679494.html
window_bug617528.xul
test_bug336682.js
[test_bug336682_2.xul]
-[test_bug368835.html]
[test_bug415498.xul]
[test_bug418986-3.xul]
[test_bug524674.xul]
[test_bug586961.xul]
[test_bug591249.xul]
[test_bug602962.xul]
[test_bug617528.xul]
[test_bug679494.xul]
--- a/dom/events/test/mochitest.ini
+++ b/dom/events/test/mochitest.ini
@@ -23,17 +23,16 @@ support-files =
[test_bug299673-1.html]
[test_bug1037990.html]
[test_bug299673-2.html]
[test_bug322588.html]
[test_bug328885.html]
[test_bug336682_1.html]
support-files = test_bug336682.js
[test_bug367781.html]
-[test_bug368835.html]
[test_bug379120.html]
[test_bug391568.xhtml]
[test_bug402089.html]
[test_bug405632.html]
[test_bug409604.html]
skip-if = toolkit == 'android' #TIMED_OUT
[test_bug412567.html]
[test_bug418986-3.html]
--- a/dom/events/test/test_all_synthetic_events.html
+++ b/dom/events/test/test_all_synthetic_events.html
@@ -63,44 +63,31 @@ const kEventConstructors = {
CloseEvent: { create: function (aName, aProps) {
return new CloseEvent(aName, aProps);
},
},
ClipboardEvent: { create: function (aName, aProps) {
return new ClipboardEvent(aName, aProps);
},
},
- CommandEvent: { create: function (aName, aProps) {
- var e = document.createEvent("commandevent");
- e.initCommandEvent(aName, aProps.bubbles, aProps.cancelable,
- aProps.command);
- return e;
- },
- },
CompositionEvent: { create: function (aName, aProps) {
var e = document.createEvent("compositionevent");
e.initCompositionEvent(aName, aProps.bubbles, aProps.cancelable,
aProps.view, aProps.data, aProps.locale);
return e;
},
},
CustomEvent: { create: function (aName, aProps) {
return new CustomEvent(aName, aProps);
},
},
DataErrorEvent: { create: function (aName, aProps) {
return new DataErrorEvent(aName, aProps);
},
},
- DataContainerEvent: { create: function (aName, aProps) {
- var e = document.createEvent("datacontainerevent");
- e.initEvent(aName, aProps.bubbles, aProps.cancelable);
- return e;
- },
- },
DeviceLightEvent: { create: function (aName, aProps) {
return new DeviceLightEvent(aName, aProps);
},
},
DeviceMotionEvent: { create: function (aName, aProps) {
var e = document.createEvent("devicemotionevent");
e.initDeviceMotionEvent(aName, aProps.bubbles, aProps.cancelable, aProps.acceleration,
aProps.accelerationIncludingGravity, aProps.rotationRate,
@@ -266,22 +253,16 @@ const kEventConstructors = {
MutationEvent: { create: function (aName, aProps) {
var e = document.createEvent("mutationevent");
e.initMutationEvent(aName, aProps.bubbles, aProps.cancelable,
aProps.relatedNode, aProps.prevValue, aProps.newValue,
aProps.attrName, aProps.attrChange);
return e;
},
},
- NotifyPaintEvent: { create: function (aName, aProps) {
- var e = document.createEvent("notifypaintevent");
- e.initEvent(aName, aProps.bubbles, aProps.cancelable);
- return e;
- },
- },
OfflineAudioCompletionEvent: { create: "AudioContext" in self
? function (aName, aProps) {
var ac = new AudioContext();
var ab = new AudioBuffer({ length: 42, sampleRate: ac.sampleRate });
aProps.renderedBuffer = ab;
return new OfflineAudioCompletionEvent(aName, aProps);
}
: null,
@@ -329,29 +310,16 @@ const kEventConstructors = {
var e = document.createEvent("scrollareaevent");
e.initScrollAreaEvent(aName, aProps.bubbles, aProps.cancelable,
aProps.view, aProps.details,
aProps.x || 0.0, aProps.y || 0.0,
aProps.width || 0.0, aProps.height || 0.0);
return e;
},
},
- SimpleGestureEvent: { create: function (aName, aProps) {
- var e = document.createEvent("simplegestureevent");
- e.initSimpleGestureEvent(aName, aProps.bubbles, aProps.cancelable,
- aProps.view, aProps.detail,
- aProps.screenX, aProps.screenY,
- aProps.clientX, aProps.clientY,
- aProps.ctrlKey, aProps.altKey, aProps.shiftKey, aProps.metaKey,
- aProps.button, aProps.relatedTarget,
- aProps.allowedDirections, aProps.direction, aProps.delta || 0.0,
- aProps.clickCount);
- return e;
- },
- },
SpeechRecognitionError: { create: function (aName, aProps) {
return new SpeechRecognitionError(aName, aProps);
},
},
SpeechRecognitionEvent: { create: function (aName, aProps) {
return new SpeechRecognitionEvent(aName, aProps);
},
},
deleted file mode 100644
--- a/dom/events/test/test_bug368835.html
+++ /dev/null
@@ -1,101 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=368835
--->
- <head>
- <title>Test for Bug 368835</title>
-
- <link rel="stylesheet" type="text/css" href="http://mochi.test:8888/tests/SimpleTest/test.css" />
-
- <script type="text/javascript" src="http://mochi.test:8888/tests/SimpleTest/SimpleTest.js"></script>
- </head>
-
- <body>
- <a target="_blank"
- href="https://bugzilla.mozilla.org/show_bug.cgi?id=368835">
- Mozilla Bug 368835
- </a>
- <p id="display"></p>
- <div id="content" style="display: none">
- </div>
- <pre id="test">
- <script class="testbody" type="text/javascript">
- function dataContainerEventHandler(aEvent)
- {
- var value = "";
- var isPassed = true;
- try {
- value = aEvent.getData("data1");
- isPassed = true;
- } catch (e) {
- isPassed = false;
- }
-
- ok(isPassed, "getData shouldn't fail.");
- ok(value == "data1", "Wrong value of data.");
-
- is(aEvent.getData("document"), document);
- is(aEvent.getData("window"), window);
- is(aEvent.getData("event"), aEvent);
- is(aEvent.getData("null"), null);
- is(aEvent.getData("1"), 1);
- is(aEvent.getData("1.1"), 1.1);
- is(aEvent.getData("true"), true);
-
- try {
- aEvent.setData("data3", "data3");
- isPassed = false;
- } catch (e) {
- isPassed = true;
- }
-
- ok(isPassed, "setData should fail during event dispatching.");
- }
-
- function doTest()
- {
- var isPassed;
- var event = null;
-
- try {
- event = document.createEvent("datacontainerevents");
- isPassed = true;
- } catch (e) {
- isPassed = false;
- }
-
- ok(isPassed, "Document should know about 'datacontainerevents' event class.");
- ok(("setData" in event), "nsIDOMDataContainerEvent isn't available.");
-
- event.initEvent("dataContainerEvent", true, true);
-
- try {
- event.setData("data1", "data1");
- event.setData("document", document);
- event.setData("window", window);
- event.setData("event", event);
- event.setData("null", null);
- event.setData("1", 1);
- event.setData("1.1", 1.1);
- event.setData("true", true);
- isPassed = true;
- } catch (e) {
- isPassed = false;
- }
-
- ok(isPassed, "setData shouldn't fail when event is initialized.");
-
- document.body.addEventListener("dataContainerEvent",
- dataContainerEventHandler, true);
- document.body.dispatchEvent(event);
- SimpleTest.finish();
- }
-
- SimpleTest.waitForExplicitFinish();
- addLoadEvent(doTest);
- </script>
- </pre>
- </body>
-</html>
-
--- a/dom/interfaces/events/moz.build
+++ b/dom/interfaces/events/moz.build
@@ -8,17 +8,16 @@ with Files("**"):
BUG_COMPONENT = ("Core", "DOM: Events")
XPIDL_SOURCES += [
'nsIDOMAnimationEvent.idl',
'nsIDOMBeforeUnloadEvent.idl',
'nsIDOMClipboardEvent.idl',
'nsIDOMCommandEvent.idl',
'nsIDOMCustomEvent.idl',
- 'nsIDOMDataContainerEvent.idl',
'nsIDOMDataTransfer.idl',
'nsIDOMDragEvent.idl',
'nsIDOMEvent.idl',
'nsIDOMEventListener.idl',
'nsIDOMEventTarget.idl',
'nsIDOMFocusEvent.idl',
'nsIDOMKeyEvent.idl',
'nsIDOMMouseEvent.idl',
deleted file mode 100644
--- a/dom/interfaces/events/nsIDOMDataContainerEvent.idl
+++ /dev/null
@@ -1,30 +0,0 @@
-/* -*- Mode: C++; 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"
-#include "nsIVariant.idl"
-
-[builtinclass, uuid(a9f1f528-d106-4fea-8663-2d7f64b627a9)]
-interface nsIDOMDataContainerEvent : nsISupports
-{
- /**
- * Return the data associated with the given key.
- *
- * @param key the key
- * @return the data associated with the key
- */
- nsIVariant getData(in DOMString key);
-
- /**
- * Set the data for the given key.
- *
- * @param key the data key
- * @param data the data
- * @throws NS_ERROR_UNEXPECTED if the method is called during event
- * dispatch
- */
- void setData(in DOMString key, in nsIVariant data);
-};
-
--- a/dom/locales/en-US/chrome/dom/dom.properties
+++ b/dom/locales/en-US/chrome/dom/dom.properties
@@ -178,18 +178,16 @@ UseOfReleaseEventsWarning=Use of release
UseOfDOM3LoadMethodWarning=Use of document.load() is deprecated. To upgrade your code, use the DOM XMLHttpRequest object. For more help https://developer.mozilla.org/en/XMLHttpRequest
# LOCALIZATION NOTE: Do not translate "window.showModalDialog()" or "window.open()"
ShowModalDialogWarning=Use of window.showModalDialog() is deprecated. Use window.open() instead. For more help https://developer.mozilla.org/en-US/docs/Web/API/Window.open
# LOCALIZATION NOTE: Do not translate "window._content" or "window.content"
Window_ContentWarning=window._content is deprecated. Please use window.content instead.
# LOCALIZATION NOTE: Do not translate "XMLHttpRequest"
SyncXMLHttpRequestWarning=Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help http://xhr.spec.whatwg.org/
ImplicitMetaViewportTagFallback=No meta-viewport tag found. Please explicitly specify one to prevent unexpected behavioural changes in future versions. For more help https://developer.mozilla.org/en/docs/Mozilla/Mobile/Viewport_meta_tag
-# LOCALIZATION NOTE: Do not translate "DataContainerEvent" or "CustomEvent"
-DataContainerEventWarning=Use of DataContainerEvent is deprecated. Use CustomEvent instead.
# LOCALIZATION NOTE: Do not translate "window.controllers"
Window_ControllersWarning=window.controllers is deprecated. Do not use it for UA detection.
ImportXULIntoContentWarning=Importing XUL nodes into a content document is deprecated. This functionality may be removed soon.
XMLDocumentLoadPrincipalMismatch=Use of document.load forbidden on Documents that come from other Windows. Only the Window in which a Document was created is allowed to call .load on that Document. Preferably, use XMLHttpRequest instead.
# LOCALIZATION NOTE: Do not translate "IndexedDB".
IndexedDBTransactionAbortNavigation=An IndexedDB transaction that was not yet complete has been aborted due to page navigation.
# LOCALIZATION NOTE: Do not translate Will-change, %1$S,%2$S are numbers.
IgnoringWillChangeOverBudgetWarning=Will-change memory consumption is too high. Budget limit is the document surface area multiplied by %1$S (%2$S px). Occurrences of will-change over the budget will be ignored.
--- a/dom/smil/test/test_smilTimeEvents.xhtml
+++ b/dom/smil/test/test_smilTimeEvents.xhtml
@@ -143,17 +143,17 @@ function testBackwardsSeekToStart()
gTimeoutID = setTimeout(timeoutFail, gTimeoutDur);
gSvg.setCurrentTime(0);
}
function testCreateEvent()
{
var evt;
try {
- evt = document.createEvent("TimeEvents");
+ evt = document.createEvent("TimeEvent");
} catch (e) {
ok(false, "Failed to create TimeEvent via script: " + e);
return;
}
evt.initTimeEvent("repeatEvent", null, 3);
is(evt.type, "repeatEvent", "Unexpected type for user-generated event");
is(evt.detail, 3, "Unexpected detail for user-generated event");
is(evt.target, null, "Unexpected event target");
--- a/dom/tests/mochitest/general/test_interfaces.js
+++ b/dom/tests/mochitest/general/test_interfaces.js
@@ -183,17 +183,17 @@ var interfaceNamesInGlobalScope =
{name: "ChromeNodeList", xbl: true},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "ChromeWindow", xbl: true},
// IMPORTANT: Do not change this list without review from a DOM peer!
"ClipboardEvent",
// IMPORTANT: Do not change this list without review from a DOM peer!
"CloseEvent",
// IMPORTANT: Do not change this list without review from a DOM peer!
- "CommandEvent",
+ {name: "CommandEvent", xbl: true},
// IMPORTANT: Do not change this list without review from a DOM peer!
"Comment",
// IMPORTANT: Do not change this list without review from a DOM peer!
"CompositionEvent",
// IMPORTANT: Do not change this list without review from a DOM peer!
"ConstantSourceNode",
// IMPORTANT: Do not change this list without review from a DOM peer!
"Controllers",
@@ -844,17 +844,17 @@ var interfaceNamesInGlobalScope =
{name: "ScopedCredential", disabled: true},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "ScopedCredentialInfo", disabled: true},
// IMPORTANT: Do not change this list without review from a DOM peer!
"ShadowRoot", // Bogus, but the test harness forces it on. See bug 1159768.
// IMPORTANT: Do not change this list without review from a DOM peer!
"SharedWorker",
// IMPORTANT: Do not change this list without review from a DOM peer!
- "SimpleGestureEvent",
+ {name: "SimpleGestureEvent", xbl: true},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "SimpleTest", xbl: false},
// IMPORTANT: Do not change this list without review from a DOM peer!
"SourceBuffer",
// IMPORTANT: Do not change this list without review from a DOM peer!
"SourceBufferList",
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "SpeechSynthesisErrorEvent", android: false},
--- a/dom/webidl/CommandEvent.webidl
+++ b/dom/webidl/CommandEvent.webidl
@@ -1,14 +1,15 @@
/* -*- 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/.
*/
+[Func="IsChromeOrXBL"]
interface CommandEvent : Event {
readonly attribute DOMString? command;
void initCommandEvent(DOMString type,
optional boolean canBubble = false,
optional boolean cancelable = false,
optional DOMString? command = null);
};
deleted file mode 100644
--- a/dom/webidl/DataContainerEvent.webidl
+++ /dev/null
@@ -1,30 +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/.
- */
-
-interface nsIVariant;
-
-[ChromeOnly]
-interface DataContainerEvent : Event {
- /**
- * Return the data associated with the given key.
- *
- * @param key the key
- * @return the data associated with the key
- */
- nsIVariant? getData(DOMString? key);
-
- /**
- * Set the data for the given key.
- *
- * @param key the data key
- * @param data the data
- * @throws NS_ERROR_UNEXPECTED if the method is called during event
- * dispatch
- */
- [Throws]
- void setData(DOMString? key, any data);
-};
-
--- a/dom/webidl/Document.webidl
+++ b/dom/webidl/Document.webidl
@@ -68,17 +68,17 @@ interface Document : Node {
[NewObject, Throws]
ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
[Throws]
Node importNode(Node node, optional boolean deep = false);
[Throws]
Node adoptNode(Node node);
- [NewObject, Throws]
+ [NewObject, Throws, NeedsCallerType]
Event createEvent(DOMString interface);
[NewObject, Throws]
Range createRange();
// NodeFilter.SHOW_ALL = 0xFFFFFFFF
[NewObject, Throws]
NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
--- a/dom/webidl/SimpleGestureEvent.webidl
+++ b/dom/webidl/SimpleGestureEvent.webidl
@@ -1,16 +1,17 @@
/* -*- 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/.
*
* For more information see nsIDOMSimpleGestureEvent.idl.
*/
+[Func="IsChromeOrXBL"]
interface SimpleGestureEvent : MouseEvent
{
const unsigned long DIRECTION_UP = 1;
const unsigned long DIRECTION_DOWN = 2;
const unsigned long DIRECTION_LEFT = 4;
const unsigned long DIRECTION_RIGHT = 8;
const unsigned long ROTATION_COUNTERCLOCKWISE = 1;
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -470,17 +470,16 @@ WEBIDL_FILES = [
'CSSStyleDeclaration.webidl',
'CSSStyleRule.webidl',
'CSSStyleSheet.webidl',
'CSSSupportsRule.webidl',
'CSSTransition.webidl',
'CSSValue.webidl',
'CSSValueList.webidl',
'CustomElementRegistry.webidl',
- 'DataContainerEvent.webidl',
'DataTransfer.webidl',
'DataTransferItem.webidl',
'DataTransferItemList.webidl',
'DecoderDoctorNotification.webidl',
'DedicatedWorkerGlobalScope.webidl',
'DelayNode.webidl',
'DesktopNotification.webidl',
'DeviceMotionEvent.webidl',
--- a/js/xpconnect/tests/mochitest/test_bug790732.html
+++ b/js/xpconnect/tests/mochitest/test_bug790732.html
@@ -27,17 +27,18 @@ https://bugzilla.mozilla.org/show_bug.cg
is(Ci.nsIDOMCSSRule.NAMESPACE_RULE, CSSRule.NAMESPACE_RULE);
is(Ci.nsIDOMCSSValue.CSS_PRIMITIVE_VALUE, CSSValue.CSS_PRIMITIVE_VALUE);
is(Ci.nsIDOMEvent.FOCUS, Event.FOCUS);
is(Ci.nsIDOMNSEvent.CLICK, Event.CLICK);
is(Ci.nsIDOMKeyEvent, KeyEvent);
is(Ci.nsIDOMMouseEvent, MouseEvent);
is(Ci.nsIDOMMouseScrollEvent, MouseScrollEvent);
is(Ci.nsIDOMMutationEvent, MutationEvent);
- is(Ci.nsIDOMSimpleGestureEvent, SimpleGestureEvent);
+ // XXX We can't test this here because it's only exposed to chrome
+ //is(Ci.nsIDOMSimpleGestureEvent, SimpleGestureEvent);
is(Ci.nsIDOMUIEvent, UIEvent);
is(Ci.nsIDOMHTMLMediaElement, HTMLMediaElement);
is(Ci.nsIDOMOfflineResourceList, OfflineResourceList);
is(Ci.nsIDOMRange, Range);
is(Ci.nsIDOMSVGLength, SVGLength);
is(Ci.nsIDOMNodeFilter, NodeFilter);
is(Ci.nsIDOMXPathResult, XPathResult);
--- a/testing/talos/talos/scripts/MozillaFileLogger.js
+++ b/testing/talos/talos/scripts/MozillaFileLogger.js
@@ -4,21 +4,20 @@
var ipcMode = false; // running in e10s build and need to use IPC?
function contentDispatchEvent(type, data, sync) {
if (typeof(data) === "undefined") {
data = {};
}
- var element = document.createEvent("datacontainerevent");
- element.initEvent("contentEvent", true, false);
- element.setData("sync", sync);
- element.setData("type", type);
- element.setData("data", JSON.stringify(data));
+ var element = new CustomEvent("contentEvent", {
+ bubbles: true,
+ detail: { sync: sync, type: type, data: JSON.stringify(data) }
+ });
document.dispatchEvent(element);
}
function contentSyncEvent(type, data) {
contentDispatchEvent(type, data, 1);
}
function contentAsyncEvent(type, data) {
--- a/testing/web-platform/meta/dom/nodes/Document-createEvent.html.ini
+++ b/testing/web-platform/meta/dom/nodes/Document-createEvent.html.ini
@@ -43,20 +43,16 @@
[CLOSEEVENT should be an alias for CloseEvent.]
expected: FAIL
bug: https://github.com/whatwg/dom/issues/362, 1314303
[createEvent('CLOSEEVENT') should be initialized correctly.]
expected: FAIL
bug: https://github.com/whatwg/dom/issues/362, 1314303
- [Should throw NOT_SUPPORTED_ERR for pluralized legacy event interface "DragEvents"]
- expected: FAIL
- bug: 1251198
-
[FocusEvent should be an alias for FocusEvent.]
expected: FAIL
bug: https://github.com/whatwg/dom/issues/362, 1314303
[createEvent('FocusEvent') should be initialized correctly.]
expected: FAIL
bug: https://github.com/whatwg/dom/issues/362, 1314303
@@ -143,20 +139,16 @@
[PROGRESSEVENT should be an alias for ProgressEvent.]
expected: FAIL
bug: https://github.com/whatwg/dom/issues/362, 1314303
[createEvent('PROGRESSEVENT') should be initialized correctly.]
expected: FAIL
bug: https://github.com/whatwg/dom/issues/362, 1314303
- [Should throw NOT_SUPPORTED_ERR for pluralized legacy event interface "TextEvents"]
- expected: FAIL
- bug: 1251198
-
[TrackEvent should be an alias for TrackEvent.]
expected: FAIL
bug: https://github.com/whatwg/dom/issues/362, 1314303
[createEvent('TrackEvent') should be initialized correctly.]
expected: FAIL
bug: https://github.com/whatwg/dom/issues/362, 1314303
@@ -243,80 +235,32 @@
[WHEELEVENT should be an alias for WheelEvent.]
expected: FAIL
bug: https://github.com/whatwg/dom/issues/362, 1314303
[createEvent('WHEELEVENT') should be initialized correctly.]
expected: FAIL
bug: https://github.com/whatwg/dom/issues/362, 1314303
- [Should throw NOT_SUPPORTED_ERR for non-legacy event interface "CommandEvent"]
- expected: FAIL
- bug: 1251198
-
- [Should throw NOT_SUPPORTED_ERR for pluralized non-legacy event interface "CommandEvents"]
- expected: FAIL
- bug: 1251198
-
- [Should throw NOT_SUPPORTED_ERR for non-legacy event interface "DataContainerEvent"]
- expected: FAIL
- bug: 1251198
-
- [Should throw NOT_SUPPORTED_ERR for pluralized non-legacy event interface "DataContainerEvents"]
- expected: FAIL
- bug: 1251198
-
[Should throw NOT_SUPPORTED_ERR for pluralized non-legacy event interface "KeyEvents"]
expected: FAIL
bug: 1251198
[Should throw NOT_SUPPORTED_ERR for pluralized non-legacy event interface "MouseScrollEvents"]
expected: FAIL
bug: 1251198
[Should throw NOT_SUPPORTED_ERR for non-legacy event interface "MutationEvent"]
expected: FAIL
bug: 1251198
[Should throw NOT_SUPPORTED_ERR for pluralized non-legacy event interface "MutationEvents"]
expected: FAIL
bug: 1251198
- [Should throw NOT_SUPPORTED_ERR for non-legacy event interface "NotifyPaintEvent"]
- expected: FAIL
- bug: 1251198
-
- [Should throw NOT_SUPPORTED_ERR for non-legacy event interface "PageTransition"]
- expected: FAIL
- bug: 1251198
-
- [Should throw NOT_SUPPORTED_ERR for pluralized non-legacy event interface "PopUpEvents"]
- expected: FAIL
- bug: 1251198
-
[Should throw NOT_SUPPORTED_ERR for non-legacy event interface "ScrollAreaEvent"]
expected: FAIL
bug: 1251198
- [Should throw NOT_SUPPORTED_ERR for non-legacy event interface "SimpleGestureEvent"]
- expected: FAIL
- bug: 1251198
-
- [Should throw NOT_SUPPORTED_ERR for non-legacy event interface "SVGEvent"]
- expected: FAIL
- bug: 1251198
-
[Should throw NOT_SUPPORTED_ERR for non-legacy event interface "TimeEvent"]
expected: FAIL
bug: 1251198
- [Should throw NOT_SUPPORTED_ERR for pluralized non-legacy event interface "TimeEvents"]
- expected: FAIL
- bug: 1251198
-
- [Should throw NOT_SUPPORTED_ERR for non-legacy event interface "XULCommandEvent"]
- expected: FAIL
- bug: 1251198
-
- [Should throw NOT_SUPPORTED_ERR for pluralized non-legacy event interface "XULCommandEvents"]
- expected: FAIL
- bug: 1251198
-
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -368,58 +368,30 @@
},
"CREATE_EVENT_BEFOREUNLOADEVENT" : {
"alert_emails": ["ayg@aryeh.name"],
"description": "Was document.createEvent(\"beforeunloadevent\") ever called",
"expires_in_version": "56",
"kind": "count",
"bug_numbers": [1295588, 1251198]
},
- "CREATE_EVENT_COMMANDEVENT" : {
- "alert_emails": ["ayg@aryeh.name"],
- "description": "Was document.createEvent(\"commandevent\") ever called",
- "expires_in_version": "56",
- "kind": "count",
- "bug_numbers": [1295588, 1251198]
- },
- "CREATE_EVENT_COMMANDEVENTS" : {
- "alert_emails": ["ayg@aryeh.name"],
- "description": "Was document.createEvent(\"commandevents\") ever called",
- "expires_in_version": "56",
- "kind": "count",
- "bug_numbers": [1295588, 1251198]
- },
"CREATE_EVENT_COMPOSITIONEVENT" : {
"alert_emails": ["ayg@aryeh.name"],
"description": "Was document.createEvent(\"compositionevent\") ever called",
"expires_in_version": "56",
"kind": "count",
"bug_numbers": [1295588, 1251198]
},
"CREATE_EVENT_CUSTOMEVENT" : {
"alert_emails": ["ayg@aryeh.name"],
"description": "Was document.createEvent(\"customevent\") ever called",
"expires_in_version": "56",
"kind": "count",
"bug_numbers": [1295588, 1251198]
},
- "CREATE_EVENT_DATACONTAINEREVENT" : {
- "alert_emails": ["ayg@aryeh.name"],
- "description": "Was document.createEvent(\"datacontainerevent\") ever called",
- "expires_in_version": "56",
- "kind": "count",
- "bug_numbers": [1295588, 1251198]
- },
- "CREATE_EVENT_DATACONTAINEREVENTS" : {
- "alert_emails": ["ayg@aryeh.name"],
- "description": "Was document.createEvent(\"datacontainerevents\") ever called",
- "expires_in_version": "56",
- "kind": "count",
- "bug_numbers": [1295588, 1251198]
- },
"CREATE_EVENT_DEVICEMOTIONEVENT" : {
"alert_emails": ["ayg@aryeh.name"],
"description": "Was document.createEvent(\"devicemotionevent\") ever called",
"expires_in_version": "56",
"kind": "count",
"bug_numbers": [1295588, 1251198]
},
"CREATE_EVENT_DEVICEORIENTATIONEVENT" : {
@@ -431,23 +403,16 @@
},
"CREATE_EVENT_DRAGEVENT" : {
"alert_emails": ["ayg@aryeh.name"],
"description": "Was document.createEvent(\"dragevent\") ever called",
"expires_in_version": "56",
"kind": "count",
"bug_numbers": [1295588, 1251198]
},
- "CREATE_EVENT_DRAGEVENTS" : {
- "alert_emails": ["ayg@aryeh.name"],
- "description": "Was document.createEvent(\"dragevents\") ever called",
- "expires_in_version": "56",
- "kind": "count",
- "bug_numbers": [1295588, 1251198]
- },
"CREATE_EVENT_ERROREVENT" : {
"alert_emails": ["ayg@aryeh.name"],
"description": "Was document.createEvent(\"errorevent\") ever called",
"expires_in_version": "56",
"kind": "count",
"bug_numbers": [1295588, 1251198, 1333901]
},
"CREATE_EVENT_EVENT" : {
@@ -529,121 +494,58 @@
},
"CREATE_EVENT_MUTATIONEVENTS" : {
"alert_emails": ["ayg@aryeh.name"],
"description": "Was document.createEvent(\"mutationevents\") ever called",
"expires_in_version": "56",
"kind": "count",
"bug_numbers": [1295588, 1251198]
},
- "CREATE_EVENT_NOTIFYPAINTEVENT" : {
- "alert_emails": ["ayg@aryeh.name"],
- "description": "Was document.createEvent(\"notifypaintevent\") ever called",
- "expires_in_version": "56",
- "kind": "count",
- "bug_numbers": [1295588, 1251198]
- },
- "CREATE_EVENT_PAGETRANSITION" : {
- "alert_emails": ["ayg@aryeh.name"],
- "description": "Was document.createEvent(\"pagetransition\") ever called",
- "expires_in_version": "56",
- "kind": "count",
- "bug_numbers": [1295588, 1251198]
- },
"CREATE_EVENT_POPSTATEEVENT" : {
"alert_emails": ["ayg@aryeh.name"],
"description": "Was document.createEvent(\"popstateevent\") ever called",
"expires_in_version": "56",
"kind": "count",
"bug_numbers": [1295588, 1251198]
},
- "CREATE_EVENT_POPUPEVENTS" : {
- "alert_emails": ["ayg@aryeh.name"],
- "description": "Was document.createEvent(\"popupevents\") ever called",
- "expires_in_version": "56",
- "kind": "count",
- "bug_numbers": [1295588, 1251198]
- },
"CREATE_EVENT_SCROLLAREAEVENT" : {
"alert_emails": ["ayg@aryeh.name"],
"description": "Was document.createEvent(\"scrollareaevent\") ever called",
"expires_in_version": "56",
"kind": "count",
"bug_numbers": [1295588, 1251198]
},
- "CREATE_EVENT_SIMPLEGESTUREEVENT" : {
- "alert_emails": ["ayg@aryeh.name"],
- "description": "Was document.createEvent(\"simplegestureevent\") ever called",
- "expires_in_version": "56",
- "kind": "count",
- "bug_numbers": [1295588, 1251198]
- },
"CREATE_EVENT_STORAGEEVENT" : {
"alert_emails": ["ayg@aryeh.name"],
"description": "Was document.createEvent(\"storageevent\") ever called",
"expires_in_version": "56",
"kind": "count",
"bug_numbers": [1295588, 1251198]
},
- "CREATE_EVENT_SVGEVENT" : {
- "alert_emails": ["ayg@aryeh.name"],
- "description": "Was document.createEvent(\"svgevent\") ever called",
- "expires_in_version": "56",
- "kind": "count",
- "bug_numbers": [1295588, 1251198]
- },
"CREATE_EVENT_SVGEVENTS" : {
"alert_emails": ["ayg@aryeh.name"],
"description": "Was document.createEvent(\"svgevents\") ever called",
"expires_in_version": "56",
"kind": "count",
"bug_numbers": [1295588, 1251198]
},
- "CREATE_EVENT_SVGZOOMEVENT" : {
- "alert_emails": ["ayg@aryeh.name"],
- "description": "Was document.createEvent(\"svgzoomevent\") ever called",
- "expires_in_version": "56",
- "kind": "count",
- "bug_numbers": [1295588, 1251198]
- },
- "CREATE_EVENT_SVGZOOMEVENTS" : {
- "alert_emails": ["ayg@aryeh.name"],
- "description": "Was document.createEvent(\"svgzoomevents\") ever called",
- "expires_in_version": "56",
- "kind": "count",
- "bug_numbers": [1295588, 1251198]
- },
"CREATE_EVENT_TEXTEVENT" : {
"alert_emails": ["ayg@aryeh.name"],
"description": "Was document.createEvent(\"textevent\") ever called",
"expires_in_version": "56",
"kind": "count",
"bug_numbers": [1295588, 1251198]
},
- "CREATE_EVENT_TEXTEVENTS" : {
- "alert_emails": ["ayg@aryeh.name"],
- "description": "Was document.createEvent(\"textevents\") ever called",
- "expires_in_version": "56",
- "kind": "count",
- "bug_numbers": [1295588, 1251198]
- },
"CREATE_EVENT_TIMEEVENT" : {
"alert_emails": ["ayg@aryeh.name"],
"description": "Was document.createEvent(\"timeevent\") ever called",
"expires_in_version": "56",
"kind": "count",
"bug_numbers": [1295588, 1251198]
},
- "CREATE_EVENT_TIMEEVENTS" : {
- "alert_emails": ["ayg@aryeh.name"],
- "description": "Was document.createEvent(\"timeevents\") ever called",
- "expires_in_version": "56",
- "kind": "count",
- "bug_numbers": [1295588, 1251198]
- },
"CREATE_EVENT_TOUCHEVENT" : {
"alert_emails": ["ayg@aryeh.name"],
"description": "Was document.createEvent(\"touchevent\") ever called",
"expires_in_version": "56",
"kind": "count",
"bug_numbers": [1295588, 1251198]
},
"CREATE_EVENT_UIEVENT" : {
--- a/toolkit/components/telemetry/histogram-whitelists.json
+++ b/toolkit/components/telemetry/histogram-whitelists.json
@@ -1831,54 +1831,40 @@
"BROWSER_SHIM_USAGE_BLOCKED",
"CANVAS_WEBGL_ACCL_FAILURE_ID",
"CANVAS_WEBGL_FAILURE_ID",
"CHANGES_OF_TARGET_LANGUAGE",
"CHARSET_OVERRIDE_USED",
"COMPONENTS_SHIM_ACCESSED_BY_CONTENT",
"CONTENT_DOCUMENTS_DESTROYED",
"CREATE_EVENT_BEFOREUNLOADEVENT",
- "CREATE_EVENT_COMMANDEVENT",
- "CREATE_EVENT_COMMANDEVENTS",
"CREATE_EVENT_COMPOSITIONEVENT",
"CREATE_EVENT_CUSTOMEVENT",
- "CREATE_EVENT_DATACONTAINEREVENT",
- "CREATE_EVENT_DATACONTAINEREVENTS",
"CREATE_EVENT_DEVICEMOTIONEVENT",
"CREATE_EVENT_DEVICEORIENTATIONEVENT",
"CREATE_EVENT_DRAGEVENT",
- "CREATE_EVENT_DRAGEVENTS",
"CREATE_EVENT_ERROREVENT",
"CREATE_EVENT_EVENT",
"CREATE_EVENT_EVENTS",
"CREATE_EVENT_HASHCHANGEEVENT",
"CREATE_EVENT_HTMLEVENTS",
"CREATE_EVENT_KEYBOARDEVENT",
"CREATE_EVENT_KEYEVENTS",
"CREATE_EVENT_MESSAGEEVENT",
"CREATE_EVENT_MOUSEEVENT",
"CREATE_EVENT_MOUSEEVENTS",
"CREATE_EVENT_MOUSESCROLLEVENTS",
"CREATE_EVENT_MUTATIONEVENT",
"CREATE_EVENT_MUTATIONEVENTS",
- "CREATE_EVENT_NOTIFYPAINTEVENT",
- "CREATE_EVENT_PAGETRANSITION",
"CREATE_EVENT_POPSTATEEVENT",
- "CREATE_EVENT_POPUPEVENTS",
"CREATE_EVENT_SCROLLAREAEVENT",
- "CREATE_EVENT_SIMPLEGESTUREEVENT",
"CREATE_EVENT_STORAGEEVENT",
- "CREATE_EVENT_SVGEVENT",
"CREATE_EVENT_SVGEVENTS",
- "CREATE_EVENT_SVGZOOMEVENT",
- "CREATE_EVENT_SVGZOOMEVENTS",
"CREATE_EVENT_TEXTEVENT",
- "CREATE_EVENT_TEXTEVENTS",
"CREATE_EVENT_TIMEEVENT",
- "CREATE_EVENT_TIMEEVENTS",
"CREATE_EVENT_TOUCHEVENT",
"CREATE_EVENT_UIEVENT",
"CREATE_EVENT_UIEVENTS",
"CREATE_EVENT_XULCOMMANDEVENT",
"CREATE_EVENT_XULCOMMANDEVENTS",
"CSP_DOCUMENTS_COUNT",
"CSP_UNSAFE_EVAL_DOCUMENTS_COUNT",
"CSP_UNSAFE_INLINE_DOCUMENTS_COUNT",
--- a/toolkit/components/windowwatcher/nsAutoWindowStateHelper.cpp
+++ b/toolkit/components/windowwatcher/nsAutoWindowStateHelper.cpp
@@ -52,17 +52,18 @@ nsAutoWindowStateHelper::DispatchEventTo
// The functions of nsContentUtils do not provide the required behavior,
// so the following is inlined.
nsIDocument* doc = mWindow->GetExtantDoc();
if (!doc) {
return true;
}
ErrorResult rv;
- RefPtr<Event> event = doc->CreateEvent(NS_LITERAL_STRING("Events"), rv);
+ RefPtr<Event> event = doc->CreateEvent(NS_LITERAL_STRING("Events"),
+ CallerType::System, rv);
if (rv.Failed()) {
rv.SuppressException();
return false;
}
event->InitEvent(NS_ConvertASCIItoUTF16(aEventName), true, true);
event->SetTrusted(true);
event->WidgetEventPtr()->mFlags.mOnlyChromeDispatch = true;
--- a/widget/cocoa/nsMenuUtilsX.mm
+++ b/widget/cocoa/nsMenuUtilsX.mm
@@ -24,17 +24,18 @@ using namespace mozilla;
void nsMenuUtilsX::DispatchCommandTo(nsIContent* aTargetContent)
{
NS_PRECONDITION(aTargetContent, "null ptr");
nsIDocument* doc = aTargetContent->OwnerDoc();
if (doc) {
ErrorResult rv;
RefPtr<dom::Event> event =
- doc->CreateEvent(NS_LITERAL_STRING("xulcommandevent"), rv);
+ doc->CreateEvent(NS_LITERAL_STRING("xulcommandevent"),
+ dom::CallerType::System, rv);
nsCOMPtr<nsIDOMXULCommandEvent> command = do_QueryObject(event);
// FIXME: Should probably figure out how to init this with the actual
// pressed keys, but this is a big old edge case anyway. -dwh
if (command &&
NS_SUCCEEDED(command->InitCommandEvent(NS_LITERAL_STRING("command"),
true, true,
doc->GetInnerWindow(), 0,
--- a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
+++ b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
@@ -21,17 +21,16 @@
#include "nsIDOMCommandEvent.h"
#include "nsIDOMComment.h"
#include "nsIDOMCSSPrimitiveValue.h"
#include "nsIDOMCSSStyleDeclaration.h"
#include "nsIDOMCSSStyleSheet.h"
#include "nsIDOMCSSValue.h"
#include "nsIDOMCSSValueList.h"
#include "nsIDOMCustomEvent.h"
-#include "nsIDOMDataContainerEvent.h"
#ifdef MOZ_WEBRTC
#include "nsIDOMDataChannel.h"
#endif
#include "nsIDOMDataTransfer.h"
#include "nsIDOMDOMCursor.h"
#include "nsIDOMDOMException.h"
#include "nsIDOMDOMRequest.h"
#include "nsIDOMDocument.h"
@@ -153,17 +152,16 @@
#include "mozilla/dom/CSSStyleDeclarationBinding.h"
#include "mozilla/dom/CSSStyleSheetBinding.h"
#include "mozilla/dom/CSSValueBinding.h"
#include "mozilla/dom/CSSValueListBinding.h"
#include "mozilla/dom/CustomEventBinding.h"
#ifdef MOZ_WEBRTC
#include "mozilla/dom/DataChannelBinding.h"
#endif
-#include "mozilla/dom/DataContainerEventBinding.h"
#include "mozilla/dom/DataTransferBinding.h"
#include "mozilla/dom/DOMCursorBinding.h"
#include "mozilla/dom/DOMExceptionBinding.h"
#include "mozilla/dom/DOMParserBinding.h"
#include "mozilla/dom/DOMRequestBinding.h"
#include "mozilla/dom/DocumentBinding.h"
#include "mozilla/dom/DocumentFragmentBinding.h"
#include "mozilla/dom/DocumentTypeBinding.h"
@@ -341,17 +339,16 @@ const ComponentsInterfaceShimEntry kComp
DEFINE_SHIM(CSSStyleDeclaration),
DEFINE_SHIM(CSSStyleSheet),
DEFINE_SHIM(CSSValue),
DEFINE_SHIM(CSSValueList),
DEFINE_SHIM(CustomEvent),
#ifdef MOZ_WEBRTC
DEFINE_SHIM(DataChannel),
#endif
- DEFINE_SHIM(DataContainerEvent),
DEFINE_SHIM(DataTransfer),
DEFINE_SHIM(DOMCursor),
DEFINE_SHIM(DOMException),
DEFINE_SHIM(DOMRequest),
DEFINE_SHIM(Document),
DEFINE_SHIM(DocumentFragment),
DEFINE_SHIM(DocumentType),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMDocumentXBL, Document),
--- a/xpfe/appshell/nsXULWindow.cpp
+++ b/xpfe/appshell/nsXULWindow.cpp
@@ -234,17 +234,18 @@ NS_IMETHODIMP nsXULWindow::SetZLevel(uin
nsCOMPtr<nsIContentViewer> cv;
mDocShell->GetContentViewer(getter_AddRefs(cv));
if (cv) {
nsCOMPtr<nsIDocument> doc = cv->GetDocument();
if (doc) {
ErrorResult rv;
RefPtr<dom::Event> event =
- doc->CreateEvent(NS_LITERAL_STRING("Events"),rv);
+ doc->CreateEvent(NS_LITERAL_STRING("Events"), dom::CallerType::System,
+ rv);
if (event) {
event->InitEvent(NS_LITERAL_STRING("windowZLevel"), true, false);
event->SetTrusted(true);
bool defaultActionEnabled;
doc->DispatchEvent(event, &defaultActionEnabled);
}