Bug 751286 - eventPhase NONE constant, r=sicking

This commit is contained in:
Olli Pettay 2012-05-03 13:59:51 +03:00
Родитель 90c267c38a
Коммит 928443e854
4 изменённых файлов: 12 добавлений и 4 удалений

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

@ -427,7 +427,8 @@ nsDOMEvent::GetEventPhase(PRUint16* aEventPhase)
{
// Note, remember to check that this works also
// if or when Bug 235441 is fixed.
if (mEvent->currentTarget == mEvent->target ||
if ((mEvent->currentTarget &&
mEvent->currentTarget == mEvent->target) ||
((mEvent->flags & NS_EVENT_FLAG_CAPTURE) &&
(mEvent->flags & NS_EVENT_FLAG_BUBBLE))) {
*aEventPhase = nsIDOMEvent::AT_TARGET;
@ -436,7 +437,7 @@ nsDOMEvent::GetEventPhase(PRUint16* aEventPhase)
} else if (mEvent->flags & NS_EVENT_FLAG_BUBBLE) {
*aEventPhase = nsIDOMEvent::BUBBLING_PHASE;
} else {
*aEventPhase = 0;
*aEventPhase = nsIDOMEvent::NONE;
}
return NS_OK;
}

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

@ -64,7 +64,9 @@ ok(e.type, "hello", "Wrong event type!");
ok(!e.isTrusted, "Event shouldn't be trusted!");
ok(!e.bubbles, "Event shouldn't bubble!");
ok(!e.cancelable, "Event shouldn't be cancelable!");
is(e.eventPhase, Event.NONE, "Wrong event phase");
document.dispatchEvent(e);
is(e.eventPhase, Event.NONE, "Wrong event phase");
is(receivedEvent, e, "Wrong event!");
e = new Event("hello", { bubbles: true, cancelable: true });

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

@ -157,7 +157,7 @@ function testCreateEvent()
is(evt.detail, 3, "Unexpected detail for user-generated event");
is(evt.target, null, "Unexpected event target");
is(evt.currentTarget, null, "Unexpected event current target");
is(evt.eventPhase, evt.AT_TARGET);
is(evt.eventPhase, evt.NONE);
is(evt.bubbles, false, "Event should not bubble");
is(evt.cancelable, false, "Event should not be cancelable");
is(evt.view, null, "Event view should be null");

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

@ -46,13 +46,18 @@ interface nsIDOMEventTarget;
* the Document Object Model.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Events/
* http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html and
* http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
*/
[scriptable, uuid(e85cff74-951f-45c1-be0c-89442ea2f500)]
interface nsIDOMEvent : nsISupports
{
// PhaseType
/**
* The event isn't being dispatched.
*/
const unsigned short NONE = 0;
/**
* The current event phase is the capturing phase.
*/