Bug 351036, Combine NS_IMAGE_ERROR and NS_SCRIPT_ERROR, r+sr=jst

This commit is contained in:
Olli.Pettay%helsinki.fi 2006-09-02 10:00:26 +00:00
parent 9fa638f000
commit 64e491c833
12 changed files with 18 additions and 23 deletions

View File

@ -810,7 +810,7 @@ nsImageLoadingContent::Event::Run()
if (mMessage.EqualsLiteral("load")) {
eventMsg = NS_LOAD;
} else {
eventMsg = NS_IMAGE_ERROR;
eventMsg = NS_LOAD_ERROR;
}
nsCOMPtr<nsIContent> ourContent = do_QueryInterface(mContent);

View File

@ -1838,8 +1838,7 @@ nsXMLHttpRequest::Error(nsIDOMEvent* aEvent)
// We need to create the event before nulling out mDocument
nsCOMPtr<nsIDOMEvent> event = aEvent;
// There is no NS_PAGE_ERROR event but NS_SCRIPT_ERROR should be ok.
nsEvent evt(PR_TRUE, NS_SCRIPT_ERROR);
nsEvent evt(PR_TRUE, NS_LOAD_ERROR);
if (!event && errorEventListeners.Count()) {
CreateEvent(&evt, EmptyString(), getter_AddRefs(event));
}

View File

@ -427,7 +427,7 @@ nsDOMEvent::SetEventType(const nsAString& aEventTypeArg)
else if (atom == nsLayoutAtoms::onabort)
mEvent->message = NS_IMAGE_ABORT;
else if (atom == nsLayoutAtoms::onerror)
mEvent->message = NS_IMAGE_ERROR;
mEvent->message = NS_LOAD_ERROR;
} else if (mEvent->eventStructType == NS_MUTATION_EVENT) {
if (atom == nsLayoutAtoms::onDOMAttrModified)
mEvent->message = NS_MUTATION_ATTRMODIFIED;
@ -1033,7 +1033,7 @@ nsDOMEvent::GetEventPopupControlState(nsEvent *aEvent)
break;
case NS_SCRIPT_ERROR_EVENT :
switch(aEvent->message) {
case NS_SCRIPT_ERROR :
case NS_LOAD_ERROR :
// Any error event will allow popups, if enabled in the pref.
if (::PopupAllowedForEvent("error"))
abuse = openControlled;
@ -1139,8 +1139,7 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
return sEventNames[eDOMEvents_unload];
case NS_IMAGE_ABORT:
return sEventNames[eDOMEvents_abort];
case NS_IMAGE_ERROR:
case NS_SCRIPT_ERROR:
case NS_LOAD_ERROR:
return sEventNames[eDOMEvents_error];
case NS_FORM_SUBMIT:
return sEventNames[eDOMEvents_submit];

View File

@ -246,8 +246,7 @@ static const EventDispatchData sFormEvents[] = {
static const EventDispatchData sLoadEvents[] = {
{NS_LOAD, HANDLER(&nsIDOMLoadListener::Load), NS_EVENT_BITS_LOAD_LOAD},
{NS_PAGE_UNLOAD, HANDLER(&nsIDOMLoadListener::Unload),NS_EVENT_BITS_LOAD_UNLOAD},
{NS_IMAGE_ERROR, HANDLER(&nsIDOMLoadListener::Error), NS_EVENT_BITS_LOAD_ERROR},
{NS_SCRIPT_ERROR,HANDLER(&nsIDOMLoadListener::Error), NS_EVENT_BITS_LOAD_ERROR},
{NS_LOAD_ERROR, HANDLER(&nsIDOMLoadListener::Error), NS_EVENT_BITS_LOAD_ERROR},
{NS_BEFORE_PAGE_UNLOAD,HANDLER(&nsIDOMLoadListener::BeforeUnload), NS_EVENT_BITS_LOAD_BEFORE_UNLOAD},
};

View File

@ -580,7 +580,7 @@ nsHTMLScriptElement::ScriptAvailable(nsresult aResult,
{
if (!aIsInline && NS_FAILED(aResult)) {
nsEventStatus status = nsEventStatus_eIgnore;
nsScriptErrorEvent event(PR_TRUE, NS_SCRIPT_ERROR);
nsScriptErrorEvent event(PR_TRUE, NS_LOAD_ERROR);
event.lineNr = aLineNo;
@ -614,7 +614,7 @@ nsHTMLScriptElement::ScriptEvaluated(nsresult aResult,
nsresult rv = NS_OK;
if (!aIsInline) {
nsEventStatus status = nsEventStatus_eIgnore;
PRUint32 type = NS_SUCCEEDED(aResult) ? NS_LOAD : NS_SCRIPT_ERROR;
PRUint32 type = NS_SUCCEEDED(aResult) ? NS_LOAD : NS_LOAD_ERROR;
nsEvent event(PR_TRUE, type);
if (type == NS_LOAD) {
// Load event doesn't bubble.

View File

@ -238,7 +238,7 @@ nsSVGScriptElement::ScriptAvailable(nsresult aResult,
}
nsEventStatus status = nsEventStatus_eIgnore;
nsScriptErrorEvent event(PR_TRUE, NS_SCRIPT_ERROR);
nsScriptErrorEvent event(PR_TRUE, NS_LOAD_ERROR);
event.lineNr = aLineNo;
@ -280,7 +280,7 @@ nsSVGScriptElement::ScriptEvaluated(nsresult aResult,
nsEventStatus status = nsEventStatus_eIgnore;
nsEvent event(PR_TRUE,
NS_SUCCEEDED(aResult) ? NS_LOAD : NS_SCRIPT_ERROR);
NS_SUCCEEDED(aResult) ? NS_LOAD : NS_LOAD_ERROR);
event.flags |= NS_EVENT_FLAG_CANT_BUBBLE;
nsEventDispatcher::Dispatch(NS_STATIC_CAST(nsIContent*, this),
presContext, &event, nsnull, &status);

View File

@ -302,7 +302,7 @@ NS_ScriptErrorReporter(JSContext *cx,
docShell->GetPresContext(getter_AddRefs(presContext));
if (presContext && errorDepth < 2) {
nsScriptErrorEvent errorevent(PR_TRUE, NS_SCRIPT_ERROR);
nsScriptErrorEvent errorevent(PR_TRUE, NS_LOAD_ERROR);
errorevent.fileName = fileName.get();
errorevent.errorMsg = msg.get();

View File

@ -156,7 +156,8 @@ nsJSEventListener::HandleEvent(nsIDOMEvent* aEvent)
nsEvent* event;
priv->GetInternalNSEvent(&event);
if (event->message == NS_SCRIPT_ERROR) {
if (event->message == NS_LOAD_ERROR &&
event->eventStructType == NS_SCRIPT_ERROR_EVENT) {
nsScriptErrorEvent *scriptEvent =
NS_STATIC_CAST(nsScriptErrorEvent*, event);
// Create a temp argv for the error event.

View File

@ -138,7 +138,7 @@ nsresult nsPythonContext::HandlePythonError()
if (!PyErr_Occurred())
return NS_OK;
nsScriptErrorEvent errorevent(PR_TRUE, NS_SCRIPT_ERROR);
nsScriptErrorEvent errorevent(PR_TRUE, NS_LOAD_ERROR);
nsAutoString strFilename;
PyObject *exc, *typ, *tb;

View File

@ -148,7 +148,7 @@ nsImageBoxFrameEvent::Run()
void
FireImageDOMEvent(nsIContent* aContent, PRUint32 aMessage)
{
NS_ASSERTION(aMessage == NS_LOAD || aMessage == NS_IMAGE_ERROR,
NS_ASSERTION(aMessage == NS_LOAD || aMessage == NS_LOAD_ERROR,
"invalid message");
nsCOMPtr<nsIRunnable> event = new nsImageBoxFrameEvent(aContent, aMessage);
@ -567,7 +567,7 @@ NS_IMETHODIMP nsImageBoxFrame::OnStopDecode(imgIRequest *request,
mIntrinsicSize.SizeTo(0, 0);
nsBoxLayoutState state(GetPresContext());
MarkDirty(state);
FireImageDOMEvent(mContent, NS_IMAGE_ERROR);
FireImageDOMEvent(mContent, NS_LOAD_ERROR);
}
return NS_OK;

View File

@ -191,9 +191,6 @@ class nsIDOMEvent;
// ensure that it is drawn using the current system colors.
#define NS_SYSCOLORCHANGED (NS_WINDOW_START + 42)
// Indicates a script error has occurred
#define NS_SCRIPT_ERROR (NS_WINDOW_START + 50)
#define NS_RESIZE_EVENT (NS_WINDOW_START + 60)
#define NS_SCROLL_EVENT (NS_WINDOW_START + 61)
@ -234,7 +231,7 @@ class nsIDOMEvent;
#define NS_LOAD (NS_STREAM_EVENT_START)
#define NS_PAGE_UNLOAD (NS_STREAM_EVENT_START + 1)
#define NS_IMAGE_ABORT (NS_STREAM_EVENT_START + 3)
#define NS_IMAGE_ERROR (NS_STREAM_EVENT_START + 4)
#define NS_LOAD_ERROR (NS_STREAM_EVENT_START + 4)
#define NS_BEFORE_PAGE_UNLOAD (NS_STREAM_EVENT_START + 6)
#define NS_PAGE_RESTORE (NS_STREAM_EVENT_START + 7)

View File

@ -950,7 +950,7 @@ case _value: eventName.AssignWithConversion(_name) ; break
_ASSIGN_eventName(NS_FORM_SUBMIT,"NS_FORM_SUBMIT");
_ASSIGN_eventName(NS_GOTFOCUS,"NS_GOTFOCUS");
_ASSIGN_eventName(NS_IMAGE_ABORT,"NS_IMAGE_ABORT");
_ASSIGN_eventName(NS_IMAGE_ERROR,"NS_IMAGE_ERROR");
_ASSIGN_eventName(NS_LOAD_ERROR,"NS_LOAD_ERROR");
_ASSIGN_eventName(NS_KEY_DOWN,"NS_KEY_DOWN");
_ASSIGN_eventName(NS_KEY_PRESS,"NS_KEY_PRESS");
_ASSIGN_eventName(NS_KEY_UP,"NS_KEY_UP");