Bug 982602 Rename ns(LoadBlocking)AsyncDOMEvent to mozilla::(LoadBlocking)AsyncEventDispatcher r=smaug
This commit is contained in:
@@ -25,7 +25,6 @@
|
|||||||
#include "nsNodeUtils.h"
|
#include "nsNodeUtils.h"
|
||||||
#include "nsTextNode.h"
|
#include "nsTextNode.h"
|
||||||
#include "mozAutoDocUpdate.h"
|
#include "mozAutoDocUpdate.h"
|
||||||
#include "nsAsyncDOMEvent.h"
|
|
||||||
#include "nsWrapperCacheInlines.h"
|
#include "nsWrapperCacheInlines.h"
|
||||||
|
|
||||||
nsIAttribute::nsIAttribute(nsDOMAttributeMap* aAttrMap,
|
nsIAttribute::nsIAttribute(nsDOMAttributeMap* aAttrMap,
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
#include "nsDOMString.h"
|
#include "nsDOMString.h"
|
||||||
#include "nsIScriptSecurityManager.h"
|
#include "nsIScriptSecurityManager.h"
|
||||||
#include "nsIDOMMutationEvent.h"
|
#include "nsIDOMMutationEvent.h"
|
||||||
|
#include "mozilla/AsyncEventDispatcher.h"
|
||||||
#include "mozilla/ContentEvents.h"
|
#include "mozilla/ContentEvents.h"
|
||||||
#include "mozilla/EventListenerManager.h"
|
#include "mozilla/EventListenerManager.h"
|
||||||
#include "mozilla/InternalMutationEvent.h"
|
#include "mozilla/InternalMutationEvent.h"
|
||||||
@@ -99,7 +100,6 @@
|
|||||||
#include "mozilla/css/StyleRule.h" /* For nsCSSSelectorList */
|
#include "mozilla/css/StyleRule.h" /* For nsCSSSelectorList */
|
||||||
#include "nsCSSRuleProcessor.h"
|
#include "nsCSSRuleProcessor.h"
|
||||||
#include "nsRuleProcessorData.h"
|
#include "nsRuleProcessorData.h"
|
||||||
#include "nsAsyncDOMEvent.h"
|
|
||||||
#include "nsTextNode.h"
|
#include "nsTextNode.h"
|
||||||
|
|
||||||
#ifdef MOZ_XUL
|
#ifdef MOZ_XUL
|
||||||
@@ -1946,7 +1946,7 @@ Element::SetAttrAndNotify(int32_t aNamespaceID,
|
|||||||
mutation.mAttrChange = aModType;
|
mutation.mAttrChange = aModType;
|
||||||
|
|
||||||
mozAutoSubtreeModified subtree(OwnerDoc(), this);
|
mozAutoSubtreeModified subtree(OwnerDoc(), this);
|
||||||
(new nsAsyncDOMEvent(this, mutation))->RunDOMEventWhenSafe();
|
(new AsyncEventDispatcher(this, mutation))->RunDOMEventWhenSafe();
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@@ -2131,7 +2131,7 @@ Element::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|||||||
mutation.mAttrChange = nsIDOMMutationEvent::REMOVAL;
|
mutation.mAttrChange = nsIDOMMutationEvent::REMOVAL;
|
||||||
|
|
||||||
mozAutoSubtreeModified subtree(OwnerDoc(), this);
|
mozAutoSubtreeModified subtree(OwnerDoc(), this);
|
||||||
(new nsAsyncDOMEvent(this, mutation))->RunDOMEventWhenSafe();
|
(new AsyncEventDispatcher(this, mutation))->RunDOMEventWhenSafe();
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@@ -2618,12 +2618,12 @@ Element::MozRequestFullScreen()
|
|||||||
NS_LITERAL_CSTRING("DOM"), OwnerDoc(),
|
NS_LITERAL_CSTRING("DOM"), OwnerDoc(),
|
||||||
nsContentUtils::eDOM_PROPERTIES,
|
nsContentUtils::eDOM_PROPERTIES,
|
||||||
error);
|
error);
|
||||||
nsRefPtr<nsAsyncDOMEvent> e =
|
nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||||
new nsAsyncDOMEvent(OwnerDoc(),
|
new AsyncEventDispatcher(OwnerDoc(),
|
||||||
NS_LITERAL_STRING("mozfullscreenerror"),
|
NS_LITERAL_STRING("mozfullscreenerror"),
|
||||||
true,
|
true,
|
||||||
false);
|
false);
|
||||||
e->PostDOMEvent();
|
asyncDispatcher->PostDOMEvent();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "mozilla/dom/FragmentOrElement.h"
|
#include "mozilla/dom/FragmentOrElement.h"
|
||||||
|
|
||||||
|
#include "mozilla/AsyncEventDispatcher.h"
|
||||||
#include "mozilla/EventListenerManager.h"
|
#include "mozilla/EventListenerManager.h"
|
||||||
#include "mozilla/dom/Attr.h"
|
#include "mozilla/dom/Attr.h"
|
||||||
#include "nsDOMAttributeMap.h"
|
#include "nsDOMAttributeMap.h"
|
||||||
@@ -99,7 +100,6 @@
|
|||||||
#include "ChildIterator.h"
|
#include "ChildIterator.h"
|
||||||
#include "mozilla/css/StyleRule.h" /* For nsCSSSelectorList */
|
#include "mozilla/css/StyleRule.h" /* For nsCSSSelectorList */
|
||||||
#include "nsRuleProcessorData.h"
|
#include "nsRuleProcessorData.h"
|
||||||
#include "nsAsyncDOMEvent.h"
|
|
||||||
#include "nsTextNode.h"
|
#include "nsTextNode.h"
|
||||||
#include "mozilla/dom/NodeListBinding.h"
|
#include "mozilla/dom/NodeListBinding.h"
|
||||||
#include "mozilla/dom/UndoManager.h"
|
#include "mozilla/dom/UndoManager.h"
|
||||||
@@ -1123,7 +1123,7 @@ FragmentOrElement::FireNodeInserted(nsIDocument* aDoc,
|
|||||||
mutation.mRelatedNode = do_QueryInterface(aParent);
|
mutation.mRelatedNode = do_QueryInterface(aParent);
|
||||||
|
|
||||||
mozAutoSubtreeModified subtree(aDoc, aParent);
|
mozAutoSubtreeModified subtree(aDoc, aParent);
|
||||||
(new nsAsyncDOMEvent(childContent, mutation))->RunDOMEventWhenSafe();
|
(new AsyncEventDispatcher(childContent, mutation))->RunDOMEventWhenSafe();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,9 +40,9 @@
|
|||||||
#include "nsDOMClassInfo.h"
|
#include "nsDOMClassInfo.h"
|
||||||
#include "nsCxPusher.h"
|
#include "nsCxPusher.h"
|
||||||
|
|
||||||
|
#include "mozilla/AsyncEventDispatcher.h"
|
||||||
#include "mozilla/BasicEvents.h"
|
#include "mozilla/BasicEvents.h"
|
||||||
#include "mozilla/EventListenerManager.h"
|
#include "mozilla/EventListenerManager.h"
|
||||||
#include "nsAsyncDOMEvent.h"
|
|
||||||
#include "nsIDOMNodeFilter.h"
|
#include "nsIDOMNodeFilter.h"
|
||||||
|
|
||||||
#include "nsIDOMStyleSheet.h"
|
#include "nsIDOMStyleSheet.h"
|
||||||
@@ -3981,9 +3981,10 @@ nsDocument::AddStyleSheetToStyleSets(nsIStyleSheet* aSheet)
|
|||||||
cssSheet, __VA_ARGS__); \
|
cssSheet, __VA_ARGS__); \
|
||||||
event->SetTrusted(true); \
|
event->SetTrusted(true); \
|
||||||
event->SetTarget(this); \
|
event->SetTarget(this); \
|
||||||
nsRefPtr<nsAsyncDOMEvent> asyncEvent = new nsAsyncDOMEvent(this, event); \
|
nsRefPtr<AsyncEventDispatcher> asyncDispatcher = \
|
||||||
asyncEvent->mDispatchChromeOnly = true; \
|
new AsyncEventDispatcher(this, event); \
|
||||||
asyncEvent->PostDOMEvent(); \
|
asyncDispatcher->mDispatchChromeOnly = true; \
|
||||||
|
asyncDispatcher->PostDOMEvent(); \
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -8567,12 +8568,12 @@ nsDocument::UnblockOnload(bool aFireSync)
|
|||||||
// event to indicate that the SVG should be considered fully loaded.
|
// event to indicate that the SVG should be considered fully loaded.
|
||||||
// Because scripting is disabled on SVG-as-image documents, this event
|
// Because scripting is disabled on SVG-as-image documents, this event
|
||||||
// is not accessible to content authors. (See bug 837135.)
|
// is not accessible to content authors. (See bug 837135.)
|
||||||
nsRefPtr<nsAsyncDOMEvent> e =
|
nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||||
new nsAsyncDOMEvent(this,
|
new AsyncEventDispatcher(this,
|
||||||
NS_LITERAL_STRING("MozSVGAsImageDocumentLoad"),
|
NS_LITERAL_STRING("MozSVGAsImageDocumentLoad"),
|
||||||
false,
|
false,
|
||||||
false);
|
false);
|
||||||
e->PostDOMEvent();
|
asyncDispatcher->PostDOMEvent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8750,12 +8751,12 @@ NotifyPageHide(nsIDocument* aDocument, void* aData)
|
|||||||
static void
|
static void
|
||||||
DispatchFullScreenChange(nsIDocument* aTarget)
|
DispatchFullScreenChange(nsIDocument* aTarget)
|
||||||
{
|
{
|
||||||
nsRefPtr<nsAsyncDOMEvent> e =
|
nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||||
new nsAsyncDOMEvent(aTarget,
|
new AsyncEventDispatcher(aTarget,
|
||||||
NS_LITERAL_STRING("mozfullscreenchange"),
|
NS_LITERAL_STRING("mozfullscreenchange"),
|
||||||
true,
|
true,
|
||||||
false);
|
false);
|
||||||
e->PostDOMEvent();
|
asyncDispatcher->PostDOMEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -8908,7 +8909,8 @@ nsDocument::MutationEventDispatched(nsINode* aTarget)
|
|||||||
int32_t realTargetCount = realTargets.Count();
|
int32_t realTargetCount = realTargets.Count();
|
||||||
for (int32_t k = 0; k < realTargetCount; ++k) {
|
for (int32_t k = 0; k < realTargetCount; ++k) {
|
||||||
InternalMutationEvent mutation(true, NS_MUTATION_SUBTREEMODIFIED);
|
InternalMutationEvent mutation(true, NS_MUTATION_SUBTREEMODIFIED);
|
||||||
(new nsAsyncDOMEvent(realTargets[k], mutation))->RunDOMEventWhenSafe();
|
(new AsyncEventDispatcher(realTargets[k], mutation))->
|
||||||
|
RunDOMEventWhenSafe();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9071,11 +9073,10 @@ nsDocument::SetReadyStateInternal(ReadyState rs)
|
|||||||
mLoadingTimeStamp = mozilla::TimeStamp::Now();
|
mLoadingTimeStamp = mozilla::TimeStamp::Now();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<nsAsyncDOMEvent> plevent =
|
nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||||
new nsAsyncDOMEvent(this, NS_LITERAL_STRING("readystatechange"), false, false);
|
new AsyncEventDispatcher(this, NS_LITERAL_STRING("readystatechange"),
|
||||||
if (plevent) {
|
false, false);
|
||||||
plevent->RunDOMEventWhenSafe();
|
asyncDispatcher->RunDOMEventWhenSafe();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
@@ -10671,12 +10672,12 @@ nsDocument::RestorePreviousFullScreenState()
|
|||||||
if (!nsContentUtils::HaveEqualPrincipals(fullScreenDoc, doc) ||
|
if (!nsContentUtils::HaveEqualPrincipals(fullScreenDoc, doc) ||
|
||||||
(!nsContentUtils::IsSitePermAllow(doc->NodePrincipal(), "fullscreen") &&
|
(!nsContentUtils::IsSitePermAllow(doc->NodePrincipal(), "fullscreen") &&
|
||||||
!static_cast<nsDocument*>(doc)->mIsApprovedForFullscreen)) {
|
!static_cast<nsDocument*>(doc)->mIsApprovedForFullscreen)) {
|
||||||
nsRefPtr<nsAsyncDOMEvent> e =
|
nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||||
new nsAsyncDOMEvent(doc,
|
new AsyncEventDispatcher(doc,
|
||||||
NS_LITERAL_STRING("MozEnteredDomFullscreen"),
|
NS_LITERAL_STRING("MozEnteredDomFullscreen"),
|
||||||
true,
|
true,
|
||||||
true);
|
true);
|
||||||
e->PostDOMEvent();
|
asyncDispatcher->PostDOMEvent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10760,12 +10761,12 @@ LogFullScreenDenied(bool aLogFailure, const char* aMessage, nsIDocument* aDoc)
|
|||||||
if (!aLogFailure) {
|
if (!aLogFailure) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
nsRefPtr<nsAsyncDOMEvent> e =
|
nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||||
new nsAsyncDOMEvent(aDoc,
|
new AsyncEventDispatcher(aDoc,
|
||||||
NS_LITERAL_STRING("mozfullscreenerror"),
|
NS_LITERAL_STRING("mozfullscreenerror"),
|
||||||
true,
|
true,
|
||||||
false);
|
false);
|
||||||
e->PostDOMEvent();
|
asyncDispatcher->PostDOMEvent();
|
||||||
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
|
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
|
||||||
NS_LITERAL_CSTRING("DOM"), aDoc,
|
NS_LITERAL_CSTRING("DOM"), aDoc,
|
||||||
nsContentUtils::eDOM_PROPERTIES,
|
nsContentUtils::eDOM_PROPERTIES,
|
||||||
@@ -11121,12 +11122,12 @@ nsDocument::RequestFullScreen(Element* aElement,
|
|||||||
// session.
|
// session.
|
||||||
if (!mIsApprovedForFullscreen ||
|
if (!mIsApprovedForFullscreen ||
|
||||||
!nsContentUtils::HaveEqualPrincipals(previousFullscreenDoc, this)) {
|
!nsContentUtils::HaveEqualPrincipals(previousFullscreenDoc, this)) {
|
||||||
nsRefPtr<nsAsyncDOMEvent> e =
|
nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||||
new nsAsyncDOMEvent(this,
|
new AsyncEventDispatcher(this,
|
||||||
NS_LITERAL_STRING("MozEnteredDomFullscreen"),
|
NS_LITERAL_STRING("MozEnteredDomFullscreen"),
|
||||||
true,
|
true,
|
||||||
true);
|
true);
|
||||||
e->PostDOMEvent();
|
asyncDispatcher->PostDOMEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@@ -11278,12 +11279,12 @@ DispatchPointerLockChange(nsIDocument* aTarget)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<nsAsyncDOMEvent> e =
|
nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||||
new nsAsyncDOMEvent(aTarget,
|
new AsyncEventDispatcher(aTarget,
|
||||||
NS_LITERAL_STRING("mozpointerlockchange"),
|
NS_LITERAL_STRING("mozpointerlockchange"),
|
||||||
true,
|
true,
|
||||||
false);
|
false);
|
||||||
e->PostDOMEvent();
|
asyncDispatcher->PostDOMEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -11293,12 +11294,12 @@ DispatchPointerLockError(nsIDocument* aTarget)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<nsAsyncDOMEvent> e =
|
nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||||
new nsAsyncDOMEvent(aTarget,
|
new AsyncEventDispatcher(aTarget,
|
||||||
NS_LITERAL_STRING("mozpointerlockerror"),
|
NS_LITERAL_STRING("mozpointerlockerror"),
|
||||||
true,
|
true,
|
||||||
false);
|
false);
|
||||||
e->PostDOMEvent();
|
asyncDispatcher->PostDOMEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
mozilla::StaticRefPtr<nsPointerLockPermissionRequest> gPendingPointerLockRequest;
|
mozilla::StaticRefPtr<nsPointerLockPermissionRequest> gPendingPointerLockRequest;
|
||||||
|
|||||||
@@ -57,7 +57,6 @@
|
|||||||
|
|
||||||
#include "nsLayoutUtils.h"
|
#include "nsLayoutUtils.h"
|
||||||
#include "nsView.h"
|
#include "nsView.h"
|
||||||
#include "nsAsyncDOMEvent.h"
|
|
||||||
|
|
||||||
#include "nsIURI.h"
|
#include "nsIURI.h"
|
||||||
#include "nsIURL.h"
|
#include "nsIURL.h"
|
||||||
@@ -76,6 +75,7 @@
|
|||||||
#include "AppProcessChecker.h"
|
#include "AppProcessChecker.h"
|
||||||
#include "ContentParent.h"
|
#include "ContentParent.h"
|
||||||
#include "TabParent.h"
|
#include "TabParent.h"
|
||||||
|
#include "mozilla/AsyncEventDispatcher.h"
|
||||||
#include "mozilla/GuardObjects.h"
|
#include "mozilla/GuardObjects.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "mozilla/unused.h"
|
#include "mozilla/unused.h"
|
||||||
@@ -375,12 +375,14 @@ nsFrameLoader::LoadFrame()
|
|||||||
void
|
void
|
||||||
nsFrameLoader::FireErrorEvent()
|
nsFrameLoader::FireErrorEvent()
|
||||||
{
|
{
|
||||||
if (mOwnerContent) {
|
if (!mOwnerContent) {
|
||||||
nsRefPtr<nsAsyncDOMEvent> event =
|
return;
|
||||||
new nsLoadBlockingAsyncDOMEvent(mOwnerContent, NS_LITERAL_STRING("error"),
|
|
||||||
false, false);
|
|
||||||
event->PostDOMEvent();
|
|
||||||
}
|
}
|
||||||
|
nsRefPtr<AsyncEventDispatcher > loadBlockingAsyncDispatcher =
|
||||||
|
new LoadBlockingAsyncEventDispatcher(mOwnerContent,
|
||||||
|
NS_LITERAL_STRING("error"),
|
||||||
|
false, false);
|
||||||
|
loadBlockingAsyncDispatcher->PostDOMEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "mozilla/DebugOnly.h"
|
#include "mozilla/DebugOnly.h"
|
||||||
|
|
||||||
#include "nsGenericDOMDataNode.h"
|
#include "nsGenericDOMDataNode.h"
|
||||||
|
#include "mozilla/AsyncEventDispatcher.h"
|
||||||
#include "mozilla/MemoryReporting.h"
|
#include "mozilla/MemoryReporting.h"
|
||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
#include "mozilla/dom/ShadowRoot.h"
|
#include "mozilla/dom/ShadowRoot.h"
|
||||||
@@ -32,7 +33,6 @@
|
|||||||
#include "nsBindingManager.h"
|
#include "nsBindingManager.h"
|
||||||
#include "nsCCUncollectableMarker.h"
|
#include "nsCCUncollectableMarker.h"
|
||||||
#include "mozAutoDocUpdate.h"
|
#include "mozAutoDocUpdate.h"
|
||||||
#include "nsAsyncDOMEvent.h"
|
|
||||||
|
|
||||||
#include "pldhash.h"
|
#include "pldhash.h"
|
||||||
#include "prprf.h"
|
#include "prprf.h"
|
||||||
@@ -387,7 +387,7 @@ nsGenericDOMDataNode::SetTextInternal(uint32_t aOffset, uint32_t aCount,
|
|||||||
}
|
}
|
||||||
|
|
||||||
mozAutoSubtreeModified subtree(OwnerDoc(), this);
|
mozAutoSubtreeModified subtree(OwnerDoc(), this);
|
||||||
(new nsAsyncDOMEvent(this, mutation))->RunDOMEventWhenSafe();
|
(new AsyncEventDispatcher(this, mutation))->RunDOMEventWhenSafe();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "AccessCheck.h"
|
#include "AccessCheck.h"
|
||||||
#include "jsapi.h"
|
#include "jsapi.h"
|
||||||
#include "mozAutoDocUpdate.h"
|
#include "mozAutoDocUpdate.h"
|
||||||
|
#include "mozilla/AsyncEventDispatcher.h"
|
||||||
#include "mozilla/CORSMode.h"
|
#include "mozilla/CORSMode.h"
|
||||||
#include "mozilla/EventListenerManager.h"
|
#include "mozilla/EventListenerManager.h"
|
||||||
#include "mozilla/InternalMutationEvent.h"
|
#include "mozilla/InternalMutationEvent.h"
|
||||||
@@ -22,7 +23,6 @@
|
|||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
#include "mozilla/dom/Event.h"
|
#include "mozilla/dom/Event.h"
|
||||||
#include "mozilla/dom/ShadowRoot.h"
|
#include "mozilla/dom/ShadowRoot.h"
|
||||||
#include "nsAsyncDOMEvent.h"
|
|
||||||
#include "nsAttrValueOrString.h"
|
#include "nsAttrValueOrString.h"
|
||||||
#include "nsBindingManager.h"
|
#include "nsBindingManager.h"
|
||||||
#include "nsCCUncollectableMarker.h"
|
#include "nsCCUncollectableMarker.h"
|
||||||
@@ -1442,7 +1442,7 @@ nsINode::doInsertChildAt(nsIContent* aKid, uint32_t aIndex,
|
|||||||
mutation.mRelatedNode = do_QueryInterface(this);
|
mutation.mRelatedNode = do_QueryInterface(this);
|
||||||
|
|
||||||
mozAutoSubtreeModified subtree(OwnerDoc(), this);
|
mozAutoSubtreeModified subtree(OwnerDoc(), this);
|
||||||
(new nsAsyncDOMEvent(aKid, mutation))->RunDOMEventWhenSafe();
|
(new AsyncEventDispatcher(aKid, mutation))->RunDOMEventWhenSafe();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#include "imgRequestProxy.h"
|
#include "imgRequestProxy.h"
|
||||||
#include "nsThreadUtils.h"
|
#include "nsThreadUtils.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
#include "nsAsyncDOMEvent.h"
|
|
||||||
#include "nsImageFrame.h"
|
#include "nsImageFrame.h"
|
||||||
|
|
||||||
#include "nsIPresShell.h"
|
#include "nsIPresShell.h"
|
||||||
@@ -45,6 +44,7 @@
|
|||||||
#include "nsSVGEffects.h"
|
#include "nsSVGEffects.h"
|
||||||
|
|
||||||
#include "mozAutoDocUpdate.h"
|
#include "mozAutoDocUpdate.h"
|
||||||
|
#include "mozilla/AsyncEventDispatcher.h"
|
||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
#include "mozilla/dom/ScriptSettings.h"
|
#include "mozilla/dom/ScriptSettings.h"
|
||||||
|
|
||||||
@@ -1039,10 +1039,10 @@ nsImageLoadingContent::FireEvent(const nsAString& aEventType)
|
|||||||
|
|
||||||
nsCOMPtr<nsINode> thisNode = do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
|
nsCOMPtr<nsINode> thisNode = do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
|
||||||
|
|
||||||
nsRefPtr<nsAsyncDOMEvent> event =
|
nsRefPtr<AsyncEventDispatcher> loadBlockingAsyncDispatcher =
|
||||||
new nsLoadBlockingAsyncDOMEvent(thisNode, aEventType, false, false);
|
new LoadBlockingAsyncEventDispatcher(thisNode, aEventType, false, false);
|
||||||
event->PostDOMEvent();
|
loadBlockingAsyncDispatcher->PostDOMEvent();
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
#include "mozilla/gfx/Rect.h"
|
#include "mozilla/gfx/Rect.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "mozilla/Telemetry.h"
|
#include "mozilla/Telemetry.h"
|
||||||
#include "nsAsyncDOMEvent.h"
|
|
||||||
#include "nsAttrValueInlines.h"
|
#include "nsAttrValueInlines.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsDisplayList.h"
|
#include "nsDisplayList.h"
|
||||||
|
|||||||
@@ -1056,14 +1056,14 @@ void
|
|||||||
HTMLFormElement::PostPasswordEvent()
|
HTMLFormElement::PostPasswordEvent()
|
||||||
{
|
{
|
||||||
// Don't fire another add event if we have a pending add event.
|
// Don't fire another add event if we have a pending add event.
|
||||||
if (mFormPasswordEvent.get()) {
|
if (mFormPasswordEventDispatcher.get()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<FormPasswordEvent> event =
|
mFormPasswordEventDispatcher =
|
||||||
new FormPasswordEvent(this, NS_LITERAL_STRING("DOMFormHasPassword"));
|
new FormPasswordEventDispatcher(this,
|
||||||
mFormPasswordEvent = event;
|
NS_LITERAL_STRING("DOMFormHasPassword"));
|
||||||
event->PostDOMEvent();
|
mFormPasswordEventDispatcher->PostDOMEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function return true if the element, once appended, is the last one in
|
// This function return true if the element, once appended, is the last one in
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#ifndef mozilla_dom_HTMLFormElement_h
|
#ifndef mozilla_dom_HTMLFormElement_h
|
||||||
#define mozilla_dom_HTMLFormElement_h
|
#define mozilla_dom_HTMLFormElement_h
|
||||||
|
|
||||||
|
#include "mozilla/AsyncEventDispatcher.h"
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsIForm.h"
|
#include "nsIForm.h"
|
||||||
@@ -20,7 +21,6 @@
|
|||||||
#include "nsInterfaceHashtable.h"
|
#include "nsInterfaceHashtable.h"
|
||||||
#include "nsRefPtrHashtable.h"
|
#include "nsRefPtrHashtable.h"
|
||||||
#include "nsDataHashtable.h"
|
#include "nsDataHashtable.h"
|
||||||
#include "nsAsyncDOMEvent.h"
|
|
||||||
#include "jsfriendapi.h" // For js::ExpandoAndGeneration
|
#include "jsfriendapi.h" // For js::ExpandoAndGeneration
|
||||||
|
|
||||||
class nsIMutableArray;
|
class nsIMutableArray;
|
||||||
@@ -409,24 +409,24 @@ protected:
|
|||||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
||||||
|
|
||||||
void PostPasswordEvent();
|
void PostPasswordEvent();
|
||||||
void EventHandled() { mFormPasswordEvent = nullptr; }
|
void EventHandled() { mFormPasswordEventDispatcher = nullptr; }
|
||||||
|
|
||||||
class FormPasswordEvent : public nsAsyncDOMEvent
|
class FormPasswordEventDispatcher MOZ_FINAL : public AsyncEventDispatcher
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FormPasswordEvent(HTMLFormElement* aEventNode,
|
FormPasswordEventDispatcher(HTMLFormElement* aEventNode,
|
||||||
const nsAString& aEventType)
|
const nsAString& aEventType)
|
||||||
: nsAsyncDOMEvent(aEventNode, aEventType, true, true)
|
: AsyncEventDispatcher(aEventNode, aEventType, true, true)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
NS_IMETHOD Run() MOZ_OVERRIDE
|
NS_IMETHOD Run() MOZ_OVERRIDE
|
||||||
{
|
{
|
||||||
static_cast<HTMLFormElement*>(mEventNode.get())->EventHandled();
|
static_cast<HTMLFormElement*>(mEventNode.get())->EventHandled();
|
||||||
return nsAsyncDOMEvent::Run();
|
return AsyncEventDispatcher::Run();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
nsRefPtr<FormPasswordEvent> mFormPasswordEvent;
|
nsRefPtr<FormPasswordEventDispatcher> mFormPasswordEventDispatcher;
|
||||||
|
|
||||||
class RemoveElementRunnable;
|
class RemoveElementRunnable;
|
||||||
friend class RemoveElementRunnable;
|
friend class RemoveElementRunnable;
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
#include "mozilla/dom/HTMLInputElement.h"
|
#include "mozilla/dom/HTMLInputElement.h"
|
||||||
|
|
||||||
#include "mozilla/ArrayUtils.h"
|
#include "mozilla/ArrayUtils.h"
|
||||||
|
#include "mozilla/AsyncEventDispatcher.h"
|
||||||
#include "mozilla/DebugOnly.h"
|
#include "mozilla/DebugOnly.h"
|
||||||
#include "mozilla/dom/Date.h"
|
#include "mozilla/dom/Date.h"
|
||||||
#include "nsAsyncDOMEvent.h"
|
|
||||||
#include "nsAttrValueInlines.h"
|
#include "nsAttrValueInlines.h"
|
||||||
|
|
||||||
#include "nsIDOMHTMLInputElement.h"
|
#include "nsIDOMHTMLInputElement.h"
|
||||||
@@ -3576,9 +3576,9 @@ HTMLInputElement::CancelRangeThumbDrag(bool aIsForUserEvent)
|
|||||||
if (frame) {
|
if (frame) {
|
||||||
frame->UpdateForValueChange();
|
frame->UpdateForValueChange();
|
||||||
}
|
}
|
||||||
nsRefPtr<nsAsyncDOMEvent> event =
|
nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||||
new nsAsyncDOMEvent(this, NS_LITERAL_STRING("input"), true, false);
|
new AsyncEventDispatcher(this, NS_LITERAL_STRING("input"), true, false);
|
||||||
event->RunDOMEventWhenSafe();
|
asyncDispatcher->RunDOMEventWhenSafe();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5077,9 +5077,10 @@ HTMLInputElement::SetSelectionRange(int32_t aSelectionStart,
|
|||||||
aRv = textControlFrame->SetSelectionRange(aSelectionStart, aSelectionEnd, dir);
|
aRv = textControlFrame->SetSelectionRange(aSelectionStart, aSelectionEnd, dir);
|
||||||
if (!aRv.Failed()) {
|
if (!aRv.Failed()) {
|
||||||
aRv = textControlFrame->ScrollSelectionIntoView();
|
aRv = textControlFrame->ScrollSelectionIntoView();
|
||||||
nsRefPtr<nsAsyncDOMEvent> event =
|
nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||||
new nsAsyncDOMEvent(this, NS_LITERAL_STRING("select"), true, false);
|
new AsyncEventDispatcher(this, NS_LITERAL_STRING("select"),
|
||||||
event->PostDOMEvent();
|
true, false);
|
||||||
|
asyncDispatcher->PostDOMEvent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
|
|
||||||
#include "mozilla/dom/HTMLLinkElement.h"
|
#include "mozilla/dom/HTMLLinkElement.h"
|
||||||
|
|
||||||
|
#include "mozilla/AsyncEventDispatcher.h"
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "mozilla/dom/HTMLLinkElementBinding.h"
|
#include "mozilla/dom/HTMLLinkElementBinding.h"
|
||||||
#include "mozilla/MemoryReporting.h"
|
#include "mozilla/MemoryReporting.h"
|
||||||
#include "nsAsyncDOMEvent.h"
|
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
#include "nsGkAtoms.h"
|
#include "nsGkAtoms.h"
|
||||||
@@ -226,11 +226,11 @@ HTMLLinkElement::CreateAndDispatchEvent(nsIDocument* aDoc,
|
|||||||
strings, eIgnoreCase) != ATTR_VALUE_NO_MATCH)
|
strings, eIgnoreCase) != ATTR_VALUE_NO_MATCH)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nsRefPtr<nsAsyncDOMEvent> event = new nsAsyncDOMEvent(this, aEventName, true,
|
nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||||
true);
|
new AsyncEventDispatcher(this, aEventName, true, true);
|
||||||
// Always run async in order to avoid running script when the content
|
// Always run async in order to avoid running script when the content
|
||||||
// sink isn't expecting it.
|
// sink isn't expecting it.
|
||||||
event->PostDOMEvent();
|
asyncDispatcher->PostDOMEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#include "mozilla/AsyncEventDispatcher.h"
|
||||||
#include "mozilla/dom/HTMLMetaElement.h"
|
#include "mozilla/dom/HTMLMetaElement.h"
|
||||||
#include "mozilla/dom/HTMLMetaElementBinding.h"
|
#include "mozilla/dom/HTMLMetaElementBinding.h"
|
||||||
#include "nsStyleConsts.h"
|
|
||||||
#include "nsAsyncDOMEvent.h"
|
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
|
#include "nsStyleConsts.h"
|
||||||
|
|
||||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Meta)
|
NS_IMPL_NS_NEW_HTML_ELEMENT(Meta)
|
||||||
|
|
||||||
@@ -83,9 +83,9 @@ HTMLMetaElement::CreateAndDispatchEvent(nsIDocument* aDoc,
|
|||||||
if (!aDoc)
|
if (!aDoc)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nsRefPtr<nsAsyncDOMEvent> event = new nsAsyncDOMEvent(this, aEventName, true,
|
nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||||
true);
|
new AsyncEventDispatcher(this, aEventName, true, true);
|
||||||
event->PostDOMEvent();
|
asyncDispatcher->PostDOMEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
JSObject*
|
JSObject*
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "mozilla/dom/HTMLTextAreaElement.h"
|
#include "mozilla/dom/HTMLTextAreaElement.h"
|
||||||
|
|
||||||
#include "mozAutoDocUpdate.h"
|
#include "mozAutoDocUpdate.h"
|
||||||
|
#include "mozilla/AsyncEventDispatcher.h"
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "mozilla/dom/HTMLTextAreaElementBinding.h"
|
#include "mozilla/dom/HTMLTextAreaElementBinding.h"
|
||||||
#include "mozilla/MouseEvents.h"
|
#include "mozilla/MouseEvents.h"
|
||||||
@@ -887,9 +888,10 @@ HTMLTextAreaElement::SetSelectionRange(uint32_t aSelectionStart,
|
|||||||
rv = textControlFrame->SetSelectionRange(aSelectionStart, aSelectionEnd, dir);
|
rv = textControlFrame->SetSelectionRange(aSelectionStart, aSelectionEnd, dir);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
rv = textControlFrame->ScrollSelectionIntoView();
|
rv = textControlFrame->ScrollSelectionIntoView();
|
||||||
nsRefPtr<nsAsyncDOMEvent> event =
|
nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||||
new nsAsyncDOMEvent(this, NS_LITERAL_STRING("select"), true, false);
|
new AsyncEventDispatcher(this, NS_LITERAL_STRING("select"),
|
||||||
event->PostDOMEvent();
|
true, false);
|
||||||
|
asyncDispatcher->PostDOMEvent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,7 +83,6 @@
|
|||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
#include "HTMLFieldSetElement.h"
|
#include "HTMLFieldSetElement.h"
|
||||||
#include "HTMLMenuElement.h"
|
#include "HTMLMenuElement.h"
|
||||||
#include "nsAsyncDOMEvent.h"
|
|
||||||
#include "nsDOMMutationObserver.h"
|
#include "nsDOMMutationObserver.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "mozilla/dom/FromParser.h"
|
#include "mozilla/dom/FromParser.h"
|
||||||
|
|||||||
@@ -75,7 +75,6 @@
|
|||||||
#include "nsContentList.h"
|
#include "nsContentList.h"
|
||||||
#include "mozilla/InternalMutationEvent.h"
|
#include "mozilla/InternalMutationEvent.h"
|
||||||
#include "mozilla/MouseEvents.h"
|
#include "mozilla/MouseEvents.h"
|
||||||
#include "nsAsyncDOMEvent.h"
|
|
||||||
#include "nsIDOMMutationEvent.h"
|
#include "nsIDOMMutationEvent.h"
|
||||||
#include "nsPIDOMWindow.h"
|
#include "nsPIDOMWindow.h"
|
||||||
#include "nsJSPrincipals.h"
|
#include "nsJSPrincipals.h"
|
||||||
|
|||||||
@@ -3,19 +3,26 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "nsAsyncDOMEvent.h"
|
#include "mozilla/AsyncEventDispatcher.h"
|
||||||
#include "nsIDOMEvent.h"
|
|
||||||
#include "nsContentUtils.h"
|
|
||||||
#include "nsEventDispatcher.h"
|
|
||||||
#include "mozilla/BasicEvents.h"
|
#include "mozilla/BasicEvents.h"
|
||||||
#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
|
#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
|
||||||
#include "mozilla/dom/EventTarget.h"
|
#include "mozilla/dom/EventTarget.h"
|
||||||
|
#include "nsContentUtils.h"
|
||||||
|
#include "nsEventDispatcher.h"
|
||||||
|
#include "nsIDOMEvent.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
namespace mozilla {
|
||||||
using namespace mozilla::dom;
|
|
||||||
|
|
||||||
nsAsyncDOMEvent::nsAsyncDOMEvent(nsINode* aEventNode, WidgetEvent& aEvent)
|
using namespace dom;
|
||||||
: mEventNode(aEventNode), mDispatchChromeOnly(false)
|
|
||||||
|
/******************************************************************************
|
||||||
|
* mozilla::AsyncEventDispatcher
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
AsyncEventDispatcher::AsyncEventDispatcher(nsINode* aEventNode,
|
||||||
|
WidgetEvent& aEvent)
|
||||||
|
: mEventNode(aEventNode)
|
||||||
|
, mDispatchChromeOnly(false)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mEventNode);
|
MOZ_ASSERT(mEventNode);
|
||||||
nsEventDispatcher::CreateEvent(aEventNode, nullptr, &aEvent, EmptyString(),
|
nsEventDispatcher::CreateEvent(aEventNode, nullptr, &aEvent, EmptyString(),
|
||||||
@@ -25,7 +32,8 @@ nsAsyncDOMEvent::nsAsyncDOMEvent(nsINode* aEventNode, WidgetEvent& aEvent)
|
|||||||
mEvent->SetTrusted(aEvent.mFlags.mIsTrusted);
|
mEvent->SetTrusted(aEvent.mFlags.mIsTrusted);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsAsyncDOMEvent::Run()
|
NS_IMETHODIMP
|
||||||
|
AsyncEventDispatcher::Run()
|
||||||
{
|
{
|
||||||
if (mEvent) {
|
if (mEvent) {
|
||||||
if (mDispatchChromeOnly) {
|
if (mDispatchChromeOnly) {
|
||||||
@@ -62,19 +70,27 @@ NS_IMETHODIMP nsAsyncDOMEvent::Run()
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsAsyncDOMEvent::PostDOMEvent()
|
nsresult
|
||||||
|
AsyncEventDispatcher::PostDOMEvent()
|
||||||
{
|
{
|
||||||
return NS_DispatchToCurrentThread(this);
|
return NS_DispatchToCurrentThread(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsAsyncDOMEvent::RunDOMEventWhenSafe()
|
void
|
||||||
|
AsyncEventDispatcher::RunDOMEventWhenSafe()
|
||||||
{
|
{
|
||||||
nsContentUtils::AddScriptRunner(this);
|
nsContentUtils::AddScriptRunner(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsLoadBlockingAsyncDOMEvent::~nsLoadBlockingAsyncDOMEvent()
|
/******************************************************************************
|
||||||
|
* mozilla::LoadBlockingAsyncEventDispatcher
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
LoadBlockingAsyncEventDispatcher::~LoadBlockingAsyncEventDispatcher()
|
||||||
{
|
{
|
||||||
if (mBlockedDoc) {
|
if (mBlockedDoc) {
|
||||||
mBlockedDoc->UnblockOnload(true);
|
mBlockedDoc->UnblockOnload(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace mozilla
|
||||||
90
dom/events/AsyncEventDispatcher.h
Normal file
90
dom/events/AsyncEventDispatcher.h
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
/* -*- 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/. */
|
||||||
|
|
||||||
|
#ifndef mozilla_AsyncEventDispatcher_h_
|
||||||
|
#define mozilla_AsyncEventDispatcher_h_
|
||||||
|
|
||||||
|
#include "mozilla/Attributes.h"
|
||||||
|
#include "nsCOMPtr.h"
|
||||||
|
#include "nsIDocument.h"
|
||||||
|
#include "nsIDOMEvent.h"
|
||||||
|
#include "nsINode.h"
|
||||||
|
#include "nsString.h"
|
||||||
|
#include "nsThreadUtils.h"
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use nsAsyncDOMEvent to fire a DOM event that requires safe a stable DOM.
|
||||||
|
* For example, you may need to fire an event from within layout, but
|
||||||
|
* want to ensure that the event handler doesn't mutate the DOM at
|
||||||
|
* the wrong time, in order to avoid resulting instability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class AsyncEventDispatcher : public nsRunnable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AsyncEventDispatcher(nsINode* aEventNode, const nsAString& aEventType,
|
||||||
|
bool aBubbles, bool aDispatchChromeOnly)
|
||||||
|
: mEventNode(aEventNode)
|
||||||
|
, mEventType(aEventType)
|
||||||
|
, mBubbles(aBubbles)
|
||||||
|
, mDispatchChromeOnly(aDispatchChromeOnly)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
AsyncEventDispatcher(nsINode* aEventNode, nsIDOMEvent* aEvent)
|
||||||
|
: mEventNode(aEventNode)
|
||||||
|
, mEvent(aEvent)
|
||||||
|
, mDispatchChromeOnly(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
AsyncEventDispatcher(nsINode* aEventNode, WidgetEvent& aEvent);
|
||||||
|
|
||||||
|
NS_IMETHOD Run() MOZ_OVERRIDE;
|
||||||
|
nsresult PostDOMEvent();
|
||||||
|
void RunDOMEventWhenSafe();
|
||||||
|
|
||||||
|
nsCOMPtr<nsINode> mEventNode;
|
||||||
|
nsCOMPtr<nsIDOMEvent> mEvent;
|
||||||
|
nsString mEventType;
|
||||||
|
bool mBubbles;
|
||||||
|
bool mDispatchChromeOnly;
|
||||||
|
};
|
||||||
|
|
||||||
|
class LoadBlockingAsyncEventDispatcher MOZ_FINAL : public AsyncEventDispatcher
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LoadBlockingAsyncEventDispatcher(nsINode* aEventNode,
|
||||||
|
const nsAString& aEventType,
|
||||||
|
bool aBubbles, bool aDispatchChromeOnly)
|
||||||
|
: AsyncEventDispatcher(aEventNode, aEventType,
|
||||||
|
aBubbles, aDispatchChromeOnly)
|
||||||
|
, mBlockedDoc(aEventNode->OwnerDoc())
|
||||||
|
{
|
||||||
|
if (mBlockedDoc) {
|
||||||
|
mBlockedDoc->BlockOnload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadBlockingAsyncEventDispatcher(nsINode* aEventNode, nsIDOMEvent* aEvent)
|
||||||
|
: AsyncEventDispatcher(aEventNode, aEvent)
|
||||||
|
, mBlockedDoc(aEventNode->OwnerDoc())
|
||||||
|
{
|
||||||
|
if (mBlockedDoc) {
|
||||||
|
mBlockedDoc->BlockOnload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
~LoadBlockingAsyncEventDispatcher();
|
||||||
|
|
||||||
|
private:
|
||||||
|
nsCOMPtr<nsIDocument> mBlockedDoc;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace mozilla
|
||||||
|
|
||||||
|
#endif // mozilla_AsyncEventDispatcher_h_
|
||||||
@@ -6,10 +6,10 @@
|
|||||||
|
|
||||||
#include "ContentEventHandler.h"
|
#include "ContentEventHandler.h"
|
||||||
#include "IMEContentObserver.h"
|
#include "IMEContentObserver.h"
|
||||||
|
#include "mozilla/AsyncEventDispatcher.h"
|
||||||
#include "mozilla/IMEStateManager.h"
|
#include "mozilla/IMEStateManager.h"
|
||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
#include "nsAutoPtr.h"
|
#include "nsAutoPtr.h"
|
||||||
#include "nsAsyncDOMEvent.h"
|
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsGkAtoms.h"
|
#include "nsGkAtoms.h"
|
||||||
#include "nsIAtom.h"
|
#include "nsIAtom.h"
|
||||||
@@ -95,8 +95,8 @@ IMEContentObserver::Init(nsIWidget* aWidget,
|
|||||||
|
|
||||||
if (IMEStateManager::IsTestingIME()) {
|
if (IMEStateManager::IsTestingIME()) {
|
||||||
nsIDocument* doc = aPresContext->Document();
|
nsIDocument* doc = aPresContext->Document();
|
||||||
(new nsAsyncDOMEvent(doc, NS_LITERAL_STRING("MozIMEFocusIn"),
|
(new AsyncEventDispatcher(doc, NS_LITERAL_STRING("MozIMEFocusIn"),
|
||||||
false, false))->RunDOMEventWhenSafe();
|
false, false))->RunDOMEventWhenSafe();
|
||||||
}
|
}
|
||||||
|
|
||||||
aWidget->NotifyIME(IMENotification(NOTIFY_IME_OF_FOCUS));
|
aWidget->NotifyIME(IMENotification(NOTIFY_IME_OF_FOCUS));
|
||||||
@@ -149,8 +149,8 @@ IMEContentObserver::Destroy()
|
|||||||
if (mRootContent) {
|
if (mRootContent) {
|
||||||
if (IMEStateManager::IsTestingIME() && mEditableNode) {
|
if (IMEStateManager::IsTestingIME() && mEditableNode) {
|
||||||
nsIDocument* doc = mEditableNode->OwnerDoc();
|
nsIDocument* doc = mEditableNode->OwnerDoc();
|
||||||
(new nsAsyncDOMEvent(doc, NS_LITERAL_STRING("MozIMEFocusOut"),
|
(new AsyncEventDispatcher(doc, NS_LITERAL_STRING("MozIMEFocusOut"),
|
||||||
false, false))->RunDOMEventWhenSafe();
|
false, false))->RunDOMEventWhenSafe();
|
||||||
}
|
}
|
||||||
mWidget->NotifyIME(IMENotification(NOTIFY_IME_OF_BLUR));
|
mWidget->NotifyIME(IMENotification(NOTIFY_IME_OF_BLUR));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ XPIDL_SOURCES += [
|
|||||||
XPIDL_MODULE = 'content_events'
|
XPIDL_MODULE = 'content_events'
|
||||||
|
|
||||||
EXPORTS += [
|
EXPORTS += [
|
||||||
'nsAsyncDOMEvent.h',
|
|
||||||
'nsDOMEventTargetHelper.h',
|
'nsDOMEventTargetHelper.h',
|
||||||
'nsDOMKeyNameList.h',
|
'nsDOMKeyNameList.h',
|
||||||
'nsEventDispatcher.h',
|
'nsEventDispatcher.h',
|
||||||
@@ -26,6 +25,7 @@ EXPORTS += [
|
|||||||
]
|
]
|
||||||
|
|
||||||
EXPORTS.mozilla += [
|
EXPORTS.mozilla += [
|
||||||
|
'AsyncEventDispatcher.h',
|
||||||
'EventListenerManager.h',
|
'EventListenerManager.h',
|
||||||
'IMEStateManager.h',
|
'IMEStateManager.h',
|
||||||
'InternalMutationEvent.h',
|
'InternalMutationEvent.h',
|
||||||
@@ -67,6 +67,7 @@ if CONFIG['MOZ_WEBSPEECH']:
|
|||||||
|
|
||||||
UNIFIED_SOURCES += [
|
UNIFIED_SOURCES += [
|
||||||
'AnimationEvent.cpp',
|
'AnimationEvent.cpp',
|
||||||
|
'AsyncEventDispatcher.cpp',
|
||||||
'BeforeUnloadEvent.cpp',
|
'BeforeUnloadEvent.cpp',
|
||||||
'ClipboardEvent.cpp',
|
'ClipboardEvent.cpp',
|
||||||
'CommandEvent.cpp',
|
'CommandEvent.cpp',
|
||||||
@@ -90,7 +91,6 @@ UNIFIED_SOURCES += [
|
|||||||
'MutationEvent.cpp',
|
'MutationEvent.cpp',
|
||||||
'NotifyAudioAvailableEvent.cpp',
|
'NotifyAudioAvailableEvent.cpp',
|
||||||
'NotifyPaintEvent.cpp',
|
'NotifyPaintEvent.cpp',
|
||||||
'nsAsyncDOMEvent.cpp',
|
|
||||||
'nsDOMEventTargetHelper.cpp',
|
'nsDOMEventTargetHelper.cpp',
|
||||||
'nsEventDispatcher.cpp',
|
'nsEventDispatcher.cpp',
|
||||||
'nsJSEventListener.cpp',
|
'nsJSEventListener.cpp',
|
||||||
|
|||||||
@@ -1,76 +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/. */
|
|
||||||
|
|
||||||
#ifndef nsAsyncDOMEvent_h___
|
|
||||||
#define nsAsyncDOMEvent_h___
|
|
||||||
|
|
||||||
#include "mozilla/Attributes.h"
|
|
||||||
#include "nsCOMPtr.h"
|
|
||||||
#include "nsThreadUtils.h"
|
|
||||||
#include "nsINode.h"
|
|
||||||
#include "nsIDOMEvent.h"
|
|
||||||
#include "nsString.h"
|
|
||||||
#include "nsIDocument.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use nsAsyncDOMEvent to fire a DOM event that requires safe a stable DOM.
|
|
||||||
* For example, you may need to fire an event from within layout, but
|
|
||||||
* want to ensure that the event handler doesn't mutate the DOM at
|
|
||||||
* the wrong time, in order to avoid resulting instability.
|
|
||||||
*/
|
|
||||||
|
|
||||||
class nsAsyncDOMEvent : public nsRunnable {
|
|
||||||
public:
|
|
||||||
nsAsyncDOMEvent(nsINode *aEventNode, const nsAString& aEventType,
|
|
||||||
bool aBubbles, bool aDispatchChromeOnly)
|
|
||||||
: mEventNode(aEventNode), mEventType(aEventType),
|
|
||||||
mBubbles(aBubbles),
|
|
||||||
mDispatchChromeOnly(aDispatchChromeOnly)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
nsAsyncDOMEvent(nsINode *aEventNode, nsIDOMEvent *aEvent)
|
|
||||||
: mEventNode(aEventNode), mEvent(aEvent), mDispatchChromeOnly(false)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
nsAsyncDOMEvent(nsINode* aEventNode, mozilla::WidgetEvent& aEvent);
|
|
||||||
|
|
||||||
NS_IMETHOD Run() MOZ_OVERRIDE;
|
|
||||||
nsresult PostDOMEvent();
|
|
||||||
void RunDOMEventWhenSafe();
|
|
||||||
|
|
||||||
nsCOMPtr<nsINode> mEventNode;
|
|
||||||
nsCOMPtr<nsIDOMEvent> mEvent;
|
|
||||||
nsString mEventType;
|
|
||||||
bool mBubbles;
|
|
||||||
bool mDispatchChromeOnly;
|
|
||||||
};
|
|
||||||
|
|
||||||
class nsLoadBlockingAsyncDOMEvent : public nsAsyncDOMEvent {
|
|
||||||
public:
|
|
||||||
nsLoadBlockingAsyncDOMEvent(nsINode *aEventNode, const nsAString& aEventType,
|
|
||||||
bool aBubbles, bool aDispatchChromeOnly)
|
|
||||||
: nsAsyncDOMEvent(aEventNode, aEventType, aBubbles, aDispatchChromeOnly),
|
|
||||||
mBlockedDoc(aEventNode->OwnerDoc())
|
|
||||||
{
|
|
||||||
if (mBlockedDoc) {
|
|
||||||
mBlockedDoc->BlockOnload();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nsLoadBlockingAsyncDOMEvent(nsINode *aEventNode, nsIDOMEvent *aEvent)
|
|
||||||
: nsAsyncDOMEvent(aEventNode, aEvent),
|
|
||||||
mBlockedDoc(aEventNode->OwnerDoc())
|
|
||||||
{
|
|
||||||
if (mBlockedDoc) {
|
|
||||||
mBlockedDoc->BlockOnload();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
~nsLoadBlockingAsyncDOMEvent();
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDocument> mBlockedDoc;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -32,11 +32,11 @@
|
|||||||
#include "nsLayoutUtils.h"
|
#include "nsLayoutUtils.h"
|
||||||
#include "nsDisplayList.h"
|
#include "nsDisplayList.h"
|
||||||
#include "nsITheme.h"
|
#include "nsITheme.h"
|
||||||
#include "nsAsyncDOMEvent.h"
|
|
||||||
#include "nsRenderingContext.h"
|
#include "nsRenderingContext.h"
|
||||||
#include "mozilla/Likely.h"
|
#include "mozilla/Likely.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "nsTextNode.h"
|
#include "nsTextNode.h"
|
||||||
|
#include "mozilla/AsyncEventDispatcher.h"
|
||||||
#include "mozilla/LookAndFeel.h"
|
#include "mozilla/LookAndFeel.h"
|
||||||
#include "mozilla/MouseEvents.h"
|
#include "mozilla/MouseEvents.h"
|
||||||
#include "mozilla/unused.h"
|
#include "mozilla/unused.h"
|
||||||
@@ -1552,8 +1552,8 @@ void nsComboboxControlFrame::FireValueChangeEvent()
|
|||||||
{
|
{
|
||||||
// Fire ValueChange event to indicate data value of combo box has changed
|
// Fire ValueChange event to indicate data value of combo box has changed
|
||||||
nsContentUtils::AddScriptRunner(
|
nsContentUtils::AddScriptRunner(
|
||||||
new nsAsyncDOMEvent(mContent, NS_LITERAL_STRING("ValueChange"), true,
|
new AsyncEventDispatcher(mContent, NS_LITERAL_STRING("ValueChange"), true,
|
||||||
false));
|
false));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
#include "nsViewManager.h"
|
#include "nsViewManager.h"
|
||||||
#include "nsIScrollableFrame.h"
|
#include "nsIScrollableFrame.h"
|
||||||
#include "nsPresContext.h"
|
#include "nsPresContext.h"
|
||||||
#include "nsAsyncDOMEvent.h"
|
|
||||||
#include "nsStyleConsts.h"
|
#include "nsStyleConsts.h"
|
||||||
#include "nsIPresShell.h"
|
#include "nsIPresShell.h"
|
||||||
#include "prlog.h"
|
#include "prlog.h"
|
||||||
@@ -78,6 +77,7 @@
|
|||||||
#include "nsRegion.h"
|
#include "nsRegion.h"
|
||||||
#include "nsIFrameInlines.h"
|
#include "nsIFrameInlines.h"
|
||||||
|
|
||||||
|
#include "mozilla/AsyncEventDispatcher.h"
|
||||||
#include "mozilla/EventListenerManager.h"
|
#include "mozilla/EventListenerManager.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "mozilla/LookAndFeel.h"
|
#include "mozilla/LookAndFeel.h"
|
||||||
@@ -2443,10 +2443,10 @@ nsFrame::FireDOMEvent(const nsAString& aDOMEventName, nsIContent *aContent)
|
|||||||
nsIContent* target = aContent ? aContent : mContent;
|
nsIContent* target = aContent ? aContent : mContent;
|
||||||
|
|
||||||
if (target) {
|
if (target) {
|
||||||
nsRefPtr<nsAsyncDOMEvent> event =
|
nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||||
new nsAsyncDOMEvent(target, aDOMEventName, true, false);
|
new AsyncEventDispatcher(target, aDOMEventName, true, false);
|
||||||
if (NS_FAILED(event->PostDOMEvent()))
|
DebugOnly<nsresult> rv = asyncDispatcher->PostDOMEvent();
|
||||||
NS_WARNING("Failed to dispatch nsAsyncDOMEvent");
|
NS_ASSERTION(NS_SUCCEEDED(rv), "AsyncEventDispatcher failed to dispatch");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
|
|
||||||
|
#include "mozilla/AsyncEventDispatcher.h"
|
||||||
#include "mozilla/Selection.h"
|
#include "mozilla/Selection.h"
|
||||||
#include "nsIScriptGlobalObject.h"
|
#include "nsIScriptGlobalObject.h"
|
||||||
#include "nsPIDOMWindow.h"
|
#include "nsPIDOMWindow.h"
|
||||||
@@ -19,7 +20,6 @@
|
|||||||
#include "nsError.h"
|
#include "nsError.h"
|
||||||
|
|
||||||
#include "nsView.h"
|
#include "nsView.h"
|
||||||
#include "nsAsyncDOMEvent.h"
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
// Print Options
|
// Print Options
|
||||||
@@ -1858,7 +1858,7 @@ nsPrintEngine::FirePrintPreviewUpdateEvent()
|
|||||||
// listener bound to this event and therefore no need to dispatch it.
|
// listener bound to this event and therefore no need to dispatch it.
|
||||||
if (mIsDoingPrintPreview && !mIsDoingPrinting) {
|
if (mIsDoingPrintPreview && !mIsDoingPrinting) {
|
||||||
nsCOMPtr<nsIContentViewer> cv = do_QueryInterface(mDocViewerPrint);
|
nsCOMPtr<nsIContentViewer> cv = do_QueryInterface(mDocViewerPrint);
|
||||||
(new nsAsyncDOMEvent(
|
(new AsyncEventDispatcher(
|
||||||
cv->GetDocument(), NS_LITERAL_STRING("printPreviewUpdate"), true, true)
|
cv->GetDocument(), NS_LITERAL_STRING("printPreviewUpdate"), true, true)
|
||||||
)->RunDOMEventWhenSafe();
|
)->RunDOMEventWhenSafe();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#include "mozilla/AsyncEventDispatcher.h"
|
||||||
#include "mozilla/ContentEvents.h"
|
#include "mozilla/ContentEvents.h"
|
||||||
#include "mozilla/DebugOnly.h"
|
#include "mozilla/DebugOnly.h"
|
||||||
#include "mozilla/MathAlgorithms.h"
|
#include "mozilla/MathAlgorithms.h"
|
||||||
@@ -23,7 +24,6 @@
|
|||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsStyleContext.h"
|
#include "nsStyleContext.h"
|
||||||
#include "nsIBoxObject.h"
|
#include "nsIBoxObject.h"
|
||||||
#include "nsAsyncDOMEvent.h"
|
|
||||||
#include "nsIDOMDataContainerEvent.h"
|
#include "nsIDOMDataContainerEvent.h"
|
||||||
#include "nsIDOMMouseEvent.h"
|
#include "nsIDOMMouseEvent.h"
|
||||||
#include "nsIDOMElement.h"
|
#include "nsIDOMElement.h"
|
||||||
@@ -4562,11 +4562,9 @@ nsTreeBodyFrame::FireRowCountChangedEvent(int32_t aIndex, int32_t aCount)
|
|||||||
|
|
||||||
event->SetTrusted(true);
|
event->SetTrusted(true);
|
||||||
|
|
||||||
nsRefPtr<nsAsyncDOMEvent> plevent = new nsAsyncDOMEvent(content, event);
|
nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||||
if (!plevent)
|
new AsyncEventDispatcher(content, event);
|
||||||
return;
|
asyncDispatcher->PostDOMEvent();
|
||||||
|
|
||||||
plevent->PostDOMEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -4644,9 +4642,9 @@ nsTreeBodyFrame::FireInvalidateEvent(int32_t aStartRowIdx, int32_t aEndRowIdx,
|
|||||||
|
|
||||||
event->SetTrusted(true);
|
event->SetTrusted(true);
|
||||||
|
|
||||||
nsRefPtr<nsAsyncDOMEvent> plevent = new nsAsyncDOMEvent(content, event);
|
nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||||
if (plevent)
|
new AsyncEventDispatcher(content, event);
|
||||||
plevent->PostDOMEvent();
|
asyncDispatcher->PostDOMEvent();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#include "mozilla/AsyncEventDispatcher.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsTreeSelection.h"
|
#include "nsTreeSelection.h"
|
||||||
#include "nsIBoxObject.h"
|
#include "nsIBoxObject.h"
|
||||||
@@ -14,11 +15,12 @@
|
|||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsNameSpaceManager.h"
|
#include "nsNameSpaceManager.h"
|
||||||
#include "nsGkAtoms.h"
|
#include "nsGkAtoms.h"
|
||||||
#include "nsAsyncDOMEvent.h"
|
|
||||||
#include "nsEventDispatcher.h"
|
#include "nsEventDispatcher.h"
|
||||||
#include "nsAutoPtr.h"
|
#include "nsAutoPtr.h"
|
||||||
#include "nsComponentManagerUtils.h"
|
#include "nsComponentManagerUtils.h"
|
||||||
|
|
||||||
|
using namespace mozilla;
|
||||||
|
|
||||||
// A helper class for managing our ranges of selection.
|
// A helper class for managing our ranges of selection.
|
||||||
struct nsTreeRange
|
struct nsTreeRange
|
||||||
{
|
{
|
||||||
@@ -650,11 +652,12 @@ NS_IMETHODIMP nsTreeSelection::SetCurrentIndex(int32_t aIndex)
|
|||||||
NS_NAMED_LITERAL_STRING(DOMMenuItemActive, "DOMMenuItemActive");
|
NS_NAMED_LITERAL_STRING(DOMMenuItemActive, "DOMMenuItemActive");
|
||||||
NS_NAMED_LITERAL_STRING(DOMMenuItemInactive, "DOMMenuItemInactive");
|
NS_NAMED_LITERAL_STRING(DOMMenuItemInactive, "DOMMenuItemInactive");
|
||||||
|
|
||||||
nsRefPtr<nsAsyncDOMEvent> event =
|
nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||||
new nsAsyncDOMEvent(treeDOMNode,
|
new AsyncEventDispatcher(treeDOMNode,
|
||||||
(aIndex != -1 ? DOMMenuItemActive : DOMMenuItemInactive),
|
(aIndex != -1 ? DOMMenuItemActive :
|
||||||
true, false);
|
DOMMenuItemInactive),
|
||||||
return event->PostDOMEvent();
|
true, false);
|
||||||
|
return asyncDispatcher->PostDOMEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsTreeSelection::GetCurrentColumn(nsITreeColumn** aCurrentColumn)
|
NS_IMETHODIMP nsTreeSelection::GetCurrentColumn(nsITreeColumn** aCurrentColumn)
|
||||||
@@ -838,9 +841,9 @@ nsTreeSelection::FireOnSelectHandler()
|
|||||||
nsCOMPtr<nsINode> node(do_QueryInterface(elt));
|
nsCOMPtr<nsINode> node(do_QueryInterface(elt));
|
||||||
NS_ENSURE_STATE(node);
|
NS_ENSURE_STATE(node);
|
||||||
|
|
||||||
nsRefPtr<nsAsyncDOMEvent> event =
|
nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||||
new nsAsyncDOMEvent(node, NS_LITERAL_STRING("select"), true, false);
|
new AsyncEventDispatcher(node, NS_LITERAL_STRING("select"), true, false);
|
||||||
event->RunDOMEventWhenSafe();
|
asyncDispatcher->RunDOMEventWhenSafe();
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user