Merge mozilla-central to mozilla-inbound

This commit is contained in:
Marco Bonardo 2011-11-04 21:56:10 +01:00
commit c48ef6e9ea
47 changed files with 131 additions and 50 deletions

View File

@ -422,6 +422,14 @@ nsDOMEvent::StopPropagation()
return NS_OK;
}
NS_IMETHODIMP
nsDOMEvent::StopImmediatePropagation()
{
mEvent->flags |=
(NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY | NS_EVENT_FLAG_STOP_DISPATCH);
return NS_OK;
}
static nsIDocument* GetDocumentForReport(nsEvent* aEvent)
{
nsCOMPtr<nsINode> node = do_QueryInterface(aEvent->currentTarget);

View File

@ -376,9 +376,9 @@ nsEventTargetChainItem::HandleEventTargetChain(nsEventChainPostVisitor& aVisitor
if (!(aFlags & NS_EVENT_FLAG_SYSTEM_EVENT)) {
// Dispatch to the system event group. Make sure to clear the
// STOP_DISPATCH flag since this resets for each event group
// per DOM3 Events.
aVisitor.mEvent->flags &= ~NS_EVENT_FLAG_STOP_DISPATCH;
// STOP_DISPATCH flag since this resets for each event group.
aVisitor.mEvent->flags &=
~(NS_EVENT_FLAG_STOP_DISPATCH | NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY);
// Setting back the original target of the event.
aVisitor.mEvent->target = aVisitor.mEvent->originalTarget;
@ -396,6 +396,11 @@ nsEventTargetChainItem::HandleEventTargetChain(nsEventChainPostVisitor& aVisitor
aCallback,
createdELMs != nsEventListenerManager::sCreatedCount,
aPusher);
// After dispatch, clear all the propagation flags so that
// system group listeners don't affect to the event.
aVisitor.mEvent->flags &=
~(NS_EVENT_FLAG_STOP_DISPATCH | NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY);
}
return NS_OK;

View File

@ -764,6 +764,9 @@ nsEventListenerManager::HandleEventInternal(nsPresContext* aPresContext,
nsAutoPopupStatePusher popupStatePusher(nsDOMEvent::GetEventPopupControlState(aEvent));
bool hasListener = false;
while (iter.HasMore()) {
if (aEvent->flags & NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY) {
break;
}
nsListenerStruct* ls = &iter.GetNext();
// Check that the phase is same in event and event listener.
// Handle only trusted events, except when listener permits untrusted events.

View File

@ -111,6 +111,7 @@ _TEST_FILES = \
test_bug667612.html \
empty.js \
test_bug689564.html \
test_bug698929.html \
$(NULL)
#bug 585630

View File

@ -0,0 +1,47 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=698929
-->
<head>
<title>Test for Bug 698929</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=698929">Mozilla Bug 698929</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 698929 **/
var e = document.createEvent("Event");
e.initEvent("foo", true, true);
var c = 0;
var b = 0;
document.addEventListener("foo",
function() {
++c;
});
document.body.addEventListener("foo", function(e) {
++b;
e.stopImmediatePropagation();
});
document.body.addEventListener("foo", function(e) {
++b;
});
document.body.dispatchEvent(e);
document.documentElement.dispatchEvent(e);
is(c, 1, "Listener in the document should have been called once.");
is(b, 1, "Listener in the body should have been called once.");
</script>
</pre>
</body>
</html>

View File

@ -39,7 +39,7 @@
#include "nsIDOMEvent.idl"
[scriptable, builtinclass, uuid(2c5159dc-7d71-4fc6-a3b3-884ed7586456)]
[scriptable, builtinclass, uuid(52e21085-d6cd-4886-a5eb-19b47d13abf6)]
interface nsIIDBVersionChangeEvent : nsIDOMEvent
{
readonly attribute unsigned long long oldVersion;

View File

@ -43,7 +43,7 @@
* http://dev.w3.org/csswg/css3-animations/#animation-events-
*/
[scriptable, uuid(656d5f7c-c116-4154-8afd-f2c7458c7fb7)]
[scriptable, uuid(cf76ec40-85fb-4623-b637-59a50af36d60)]
interface nsIDOMAnimationEvent : nsIDOMEvent {
readonly attribute DOMString animationName;
readonly attribute float elapsedTime;

View File

@ -48,7 +48,7 @@
*
*/
[scriptable, uuid(da19e9dc-dea2-4a1d-a958-9be375c9799c)]
[scriptable, uuid(d286b454-0ed0-4e4b-b51d-3cf6d8c1299d)]
interface nsIDOMBeforeUnloadEvent : nsIDOMEvent
{
/**

View File

@ -45,7 +45,7 @@
* For more information on this interface, please see
* http://dev.w3.org/html5/websockets/#closeevent
*/
[scriptable, uuid(f83d9d6d-6c0c-418c-b12a-438e76d5866b)]
[scriptable, uuid(07fb24d2-a102-41a2-bdaa-eb5e0d399eba)]
interface nsIDOMCloseEvent : nsIDOMEvent
{
readonly attribute boolean wasClean;

View File

@ -37,7 +37,7 @@
#include "nsIDOMEvent.idl"
[scriptable, uuid(37fb1798-0f76-4870-af6f-0135b4d973c8)]
[scriptable, uuid(cfdbc647-847f-4bd9-8595-5dd0a1592b7b)]
interface nsIDOMCommandEvent : nsIDOMEvent
{
readonly attribute DOMString command;

View File

@ -39,7 +39,7 @@
#include "nsIDOMUIEvent.idl"
[scriptable, uuid(bf01c23c-cf5f-4a8e-86a7-040c6e45d685)]
[scriptable, uuid(9244a692-2827-4f98-8335-fff958d046fc)]
interface nsIDOMCompositionEvent : nsIDOMUIEvent
{
readonly attribute DOMString data;

View File

@ -38,7 +38,7 @@
#include "nsIDOMEvent.idl"
interface nsIVariant;
[scriptable, uuid(e93f84c5-e72f-4429-b797-f0c28d87890f)]
[scriptable, uuid(eee65f98-bb6f-489c-b7e3-40e5f0c90645)]
interface nsIDOMCustomEvent : nsIDOMEvent
{

View File

@ -39,7 +39,7 @@
#include "nsIDOMEvent.idl"
#include "nsIVariant.idl"
[scriptable, uuid(3600d66c-b9ac-4c22-b39a-d64cce619921)]
[scriptable, uuid(ac70e6bd-1f52-45ce-9d63-0aa650480ba1)]
interface nsIDOMDataContainerEvent : nsIDOMEvent
{
/**

View File

@ -53,7 +53,7 @@ interface nsIDOMDeviceRotationRate : nsISupports
};
[scriptable, uuid(66E8D2C9-0826-444C-8FB8-E509BC9615F8)]
[scriptable, uuid(b74dfd3f-0d16-4717-aaf7-8cadfe739532)]
interface nsIDOMDeviceMotionEvent : nsIDOMEvent
{
void initDeviceMotionEvent(in DOMString eventTypeArg,

View File

@ -36,7 +36,7 @@
#include "nsIDOMEvent.idl"
[scriptable, uuid(daf2d570-0ecc-4aa0-aba4-26f60dfcba6a)]
[scriptable, uuid(a9bd91fd-c0a7-44ed-9975-5a58faba3be3)]
interface nsIDOMDeviceOrientationEvent : nsIDOMEvent
{
void initDeviceOrientationEvent(in DOMString eventTypeArg,

View File

@ -40,7 +40,7 @@
interface nsIDOMDataTransfer;
[scriptable, uuid(26b40393-c383-4e9a-977f-e8e1351926eb)]
[scriptable, uuid(74fb5f01-e473-4302-93f5-6f74bdaaddf2)]
interface nsIDOMDragEvent : nsIDOMMouseEvent
{
readonly attribute nsIDOMDataTransfer dataTransfer;

View File

@ -49,7 +49,7 @@ interface nsIDOMEventTarget;
* http://www.w3.org/TR/DOM-Level-2-Events/
*/
[scriptable, uuid(548137e8-fd2c-48c4-8635-3033f7db79e0)]
[scriptable, uuid(e85cff74-951f-45c1-be0c-89442ea2f500)]
interface nsIDOMEvent : nsISupports
{
// PhaseType
@ -174,4 +174,10 @@ interface nsIDOMEvent : nsISupports
* Used to indicate whether preventDefault() has been called for this event.
*/
readonly attribute boolean defaultPrevented;
/**
* Prevents other event listeners from being triggered and,
* unlike Event.stopPropagation() its effect is immediate.
*/
void stopImmediatePropagation();
};

View File

@ -34,7 +34,7 @@
#include "nsIDOMEvent.idl"
[scriptable, uuid(34850f11-8b88-43ce-8d55-9aa8b18753bd)]
[scriptable, uuid(9fc4785c-b769-40e5-8f79-586e01413afd)]
interface nsIDOMHashChangeEvent : nsIDOMEvent
{
readonly attribute DOMString oldURL;

View File

@ -39,7 +39,7 @@
#include "nsIDOMUIEvent.idl"
[scriptable, uuid(ffcfb88a-d1d1-40b9-96e1-e338211d3511)]
[scriptable, uuid(def974c3-b491-481b-bc67-29174af4b26a)]
interface nsIDOMKeyEvent : nsIDOMUIEvent
{
const unsigned long DOM_VK_CANCEL = 0x03;

View File

@ -45,7 +45,7 @@
* For more information on this interface, please see
* http://www.whatwg.org/specs/web-apps/current-work/#messageevent
*/
[scriptable, uuid(9ac4fa26-4d19-4f4e-807e-b30cd0dbe56a)]
[scriptable, uuid(3aca4a44-8e5f-4829-9d59-ce4adbba2b12)]
interface nsIDOMMessageEvent : nsIDOMEvent
{
/**

View File

@ -48,7 +48,7 @@
* http://www.w3.org/TR/DOM-Level-2-Events/
*/
[scriptable, uuid(7e6cb6e1-d3ba-4e60-a6ff-96350187a1e3)]
[scriptable, uuid(7f57aa45-6792-4d8b-ba5b-201533cf0b2f)]
interface nsIDOMMouseEvent : nsIDOMUIEvent
{
readonly attribute long screenX;

View File

@ -38,7 +38,7 @@
#include "nsIDOMMouseEvent.idl"
[scriptable, uuid(eac2ea89-7926-417a-bbc8-bb893e77bebb)]
[scriptable, uuid(159f24b9-2058-40b9-b5bc-6477d192955a)]
interface nsIDOMMouseScrollEvent : nsIDOMMouseEvent
{
const long HORIZONTAL_AXIS = 1;

View File

@ -40,7 +40,7 @@
#include "nsIDOMMouseEvent.idl"
[scriptable, uuid(e680bab6-740a-4097-b5e0-5e9d7d381cbc)]
[scriptable, uuid(268da07b-4c41-4deb-96a2-10985644e6b0)]
interface nsIDOMMozTouchEvent : nsIDOMMouseEvent
{
readonly attribute unsigned long streamId;

View File

@ -39,7 +39,7 @@
#include "nsIDOMEvent.idl"
[scriptable, uuid(8e440d86-886a-4e76-9e59-c13b939c9a4b)]
[scriptable, uuid(72b3ddba-6cbb-4011-ac3b-50bd900b223d)]
interface nsIDOMMutationEvent : nsIDOMEvent
{
const unsigned short MODIFICATION = 1;

View File

@ -40,7 +40,7 @@
#include "nsIDOMEvent.idl"
#include "nsIVariant.idl"
[scriptable, uuid(6250652d-7a6a-49a4-a2ee-9114e1e83427)]
[scriptable, uuid(cd362d2f-a9a1-4127-940d-477ba0e82bd6)]
interface nsIDOMNotifyAudioAvailableEvent : nsIDOMEvent
{
[implicit_jscontext]

View File

@ -45,7 +45,7 @@ interface nsIDOMPaintRequestList;
* event, which fires at a window when painting has happened in
* that window.
*/
[scriptable, uuid(792e5779-7c39-4817-91a7-fdb3fba6428f)]
[scriptable, uuid(5e9e91ad-8638-4e1c-bded-35b51b6df279)]
interface nsIDOMNotifyPaintEvent : nsIDOMEvent
{
/**

View File

@ -44,7 +44,7 @@
* load/unload and saving/restoring a document from session history.
*/
[scriptable, uuid(b712418b-376f-4f75-b156-5d9ad99fe51f)]
[scriptable, uuid(3ca21c34-8391-4c5b-891e-0540a675dbf4)]
interface nsIDOMPageTransitionEvent : nsIDOMEvent
{
/**

View File

@ -36,7 +36,7 @@
interface nsIVariant;
[scriptable, uuid(f3834fd5-0ef5-4ccd-a741-0b6685414342)]
[scriptable, uuid(034f5fcc-9b41-433c-9795-64767051926a)]
interface nsIDOMPopStateEvent : nsIDOMEvent
{
/**

View File

@ -44,7 +44,7 @@ interface nsIURI;
* posted when a popup window is blocked.
*/
[scriptable, uuid(05be571f-c3ea-4959-a340-c57b1591ae4b)]
[scriptable, uuid(853828af-eda7-459a-be7f-9011c20394ae)]
interface nsIDOMPopupBlockedEvent : nsIDOMEvent
{
/**

View File

@ -45,7 +45,7 @@
* the specification is complete and is compatible with the WebKit ProgressEvent.
*/
[scriptable, uuid(6af7022c-d7f8-414c-a11f-a7918f14052b)]
[scriptable, uuid(2377d8a6-9e27-4eb2-a377-9910772b33d3)]
interface nsIDOMProgressEvent : nsIDOMEvent
{
readonly attribute boolean lengthComputable;

View File

@ -37,7 +37,7 @@
#include "nsIDOMUIEvent.idl"
[scriptable, uuid(00028177-32a5-4ea3-b71d-8409beb15225)]
[scriptable, uuid(a382424b-464f-475f-8880-f4ceaca9fde9)]
interface nsIDOMScrollAreaEvent : nsIDOMUIEvent
{
// Scroll area client rect

View File

@ -97,7 +97,7 @@
* consuming events.
*/
[scriptable, uuid(0fdcef08-b4e8-4d41-91a0-4f5d259bfb81)]
[scriptable, uuid(e9bdcc53-1bc0-4cae-9eb3-b215b6be7f70)]
interface nsIDOMSimpleGestureEvent : nsIDOMMouseEvent
{
/* Swipe direction constants */

View File

@ -38,7 +38,7 @@
#include "nsIDOMEvent.idl"
[scriptable, uuid(52bdc7ca-a934-4a40-a2e2-ac83a70b4019)]
[scriptable, uuid(57e2dd86-3c70-4d9c-81d0-856d42e6bc7d)]
interface nsIDOMSmartCardEvent : nsIDOMEvent
{
readonly attribute DOMString tokenName;

View File

@ -65,7 +65,7 @@ interface nsIDOMTouchList : nsISupports {
nsIDOMTouch identifiedTouch(in long identifier);
};
[scriptable, uuid(df94b20b-7998-4f00-935c-ee2c6b179711)]
[scriptable, uuid(0cc687df-0ed5-4b7f-b89d-cbb99b21d23a)]
interface nsIDOMTouchEvent : nsIDOMUIEvent {
readonly attribute nsIDOMTouchList touches;
readonly attribute nsIDOMTouchList targetTouches;

View File

@ -43,7 +43,7 @@
* http://dev.w3.org/csswg/css3-transitions/#transition-events-
*/
[scriptable, uuid(3e49ea4c-6f23-4aff-bd8f-e587edf514ec)]
[scriptable, uuid(9ded6ca5-f5b2-4bf3-9250-e4f7808dc605)]
interface nsIDOMTransitionEvent : nsIDOMEvent {
readonly attribute DOMString propertyName;
readonly attribute float elapsedTime;

View File

@ -47,7 +47,7 @@
* http://www.w3.org/TR/DOM-Level-2-Events/
*/
[scriptable, uuid(4f3032d1-bdc5-4f37-bece-af8056d71c5c)]
[scriptable, uuid(af3f130e-0c22-4613-a150-780a46c22e3a)]
interface nsIDOMUIEvent : nsIDOMEvent
{
readonly attribute nsIDOMWindow view;

View File

@ -40,7 +40,7 @@
interface nsIDOMLSInput;
[scriptable, uuid(b9a2371f-70e9-4657-b0e8-28e15b40857e)]
[scriptable, uuid(89477959-7ce6-4f6f-9885-942e0a2c93cc)]
interface nsIDOMLSProgressEvent : nsIDOMEvent
{
readonly attribute nsIDOMLSInput input;

View File

@ -45,7 +45,7 @@
* http://www.w3.org/TR/SVG/animate.html#InterfaceTimeEvent
*/
[scriptable, uuid(873785cc-d8be-48af-8b30-5c566e3f4e6e)]
[scriptable, uuid(5d7de21b-97c2-4a1d-a1f4-2ae527067660)]
interface nsIDOMTimeEvent : nsIDOMEvent
{
readonly attribute long detail;

View File

@ -48,7 +48,7 @@
interface nsIDOMStorage;
[scriptable, uuid(AE0CB688-68B3-4fb3-9A11-2DA8E620E808)]
[scriptable, uuid(501d7dc8-5b8b-4cce-99ad-16ed1046030a)]
interface nsIDOMStorageEvent : nsIDOMEvent
{
/**

View File

@ -46,7 +46,7 @@
* Event sent to a window when a storage area changes.
*/
[scriptable, uuid(c0178907-847d-41c0-8a62-31301bb946fa)]
[scriptable, uuid(2b3b40fe-4734-4661-b7ff-dc555215db4e)]
interface nsIDOMStorageEventObsolete : nsIDOMEvent
{
/**

View File

@ -42,7 +42,7 @@
* http://www.w3.org/TR/SVG11/script.html#InterfaceSVGEvent
*/
[scriptable, uuid(13aed1cc-a505-45d5-bbc2-0052c6bf200f)]
[scriptable, uuid(40c55169-8b5e-456d-a58b-ee4518d93c40)]
interface nsIDOMSVGEvent : nsIDOMEvent
{
};

View File

@ -45,7 +45,7 @@
interface nsIDOMSVGRect;
interface nsIDOMSVGPoint;
[scriptable, uuid(91f381f0-65ba-4392-bbf9-381fda450d76)]
[scriptable, uuid(85ba3378-83eb-4d26-8917-c5c73c705669)]
interface nsIDOMSVGZoomEvent : nsIDOMUIEvent
{
readonly attribute nsIDOMSVGRect zoomRectScreen;

View File

@ -51,7 +51,7 @@ interface nsIWorkerMessagePort : nsISupports
void postMessage(/* in JSObject aMessage */);
};
[scriptable, uuid(508f2d49-e9a0-4fe8-bd33-321820173b4a)]
[scriptable, uuid(c013e89d-467e-4e77-b011-d00da5c1d957)]
interface nsIWorkerMessageEvent : nsIDOMEvent
{
readonly attribute DOMString data;
@ -67,7 +67,7 @@ interface nsIWorkerMessageEvent : nsIDOMEvent
in nsISupports aSourceArg);
};
[scriptable, uuid(73d82c1d-05de-49c9-a23b-7121ff09a67a)]
[scriptable, uuid(963b856d-61b8-4c4d-bd6e-7bb3664a2993)]
interface nsIWorkerErrorEvent : nsIDOMEvent
{
readonly attribute DOMString message;

View File

@ -43,7 +43,7 @@
#include "nsIDOMUIEvent.idl"
[scriptable, uuid(da4922ca-6dbc-4df6-8187-91f3a71eb48f)]
[scriptable, uuid(980999ae-7702-4c8f-944d-77db4e99583c)]
interface nsIDOMXULCommandEvent : nsIDOMUIEvent
{
/**

View File

@ -2281,13 +2281,16 @@ RasterImage::WriteToDecoder(const char *aBuffer, PRUint32 aCount)
curframe->UnlockImageData();
}
nsresult status = mDecoder->GetDecoderError();
if (NS_SUCCEEDED(status)) {
// Keep track of the total number of bytes written over the lifetime of the
// decoder
mBytesDecoded += aCount;
}
return status;
if (!mDecoder)
return NS_ERROR_FAILURE;
CONTAINER_ENSURE_SUCCESS(mDecoder->GetDecoderError());
// Keep track of the total number of bytes written over the lifetime of the
// decoder
mBytesDecoded += aCount;
return NS_OK;
}
// This function is called in situations where it's clear that we want the

View File

@ -232,6 +232,12 @@ NS_IMETHODIMP nsSmartCardEvent::StopPropagation()
return mInner->StopPropagation();
}
NS_IMETHODIMP nsSmartCardEvent::StopImmediatePropagation()
{
NS_ASSERTION(mInner, "SmartCardEvent called without Init");
return mInner->StopImmediatePropagation();
}
NS_IMETHODIMP nsSmartCardEvent::PreventDefault()
{
NS_ASSERTION(mInner, "SmartCardEvent called without Init");

View File

@ -164,6 +164,8 @@ class nsHashKey;
#define NS_EVENT_RETARGET_TO_NON_NATIVE_ANONYMOUS 0x40000
#define NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY 0x80000
#define NS_EVENT_CAPTURE_MASK (~(NS_EVENT_FLAG_BUBBLE | NS_EVENT_FLAG_NO_CONTENT_DISPATCH))
#define NS_EVENT_BUBBLE_MASK (~(NS_EVENT_FLAG_CAPTURE | NS_EVENT_FLAG_NO_CONTENT_DISPATCH))