diff --git a/mozilla/content/events/src/nsEventListenerManager.cpp b/mozilla/content/events/src/nsEventListenerManager.cpp index 60a27e0a5b6..dd5e5d3a0ae 100644 --- a/mozilla/content/events/src/nsEventListenerManager.cpp +++ b/mozilla/content/events/src/nsEventListenerManager.cpp @@ -816,6 +816,7 @@ nsEventListenerManager::AddScriptEventListener(nsISupports *aObject, handler); if (rv == NS_ERROR_ILLEGAL_VALUE) { NS_WARNING("Probably a syntax error in the event handler!"); + context->ReportPendingException(); return NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA; } NS_ENSURE_SUCCESS(rv, rv); diff --git a/mozilla/dom/public/nsIScriptContext.h b/mozilla/dom/public/nsIScriptContext.h index b34252ee937..84fd98a4d53 100644 --- a/mozilla/dom/public/nsIScriptContext.h +++ b/mozilla/dom/public/nsIScriptContext.h @@ -57,9 +57,9 @@ class nsScriptObjectHolder; typedef void (*nsScriptTerminationFunc)(nsISupports* aRef); #define NS_ISCRIPTCONTEXT_IID \ -{ /* {09316a0e-8d05-4d26-9efd-8f907a7c79d2} */ \ - 0x09316a0e, 0x8d05, 0x4d26, \ - { 0x9e, 0xfd, 0x8f, 0x90, 0x7a, 0x7c, 0x79, 0xd2 } } +{ /* {e7b9871d-3adc-4bf7-850d-7fb9554886bf} */ \ + 0xe7b9871d, 0x3adc, 0x4bf7, \ + { 0x85, 0x0d, 0x7f, 0xb9, 0x55, 0x48, 0x86, 0xbf } } /* This MUST match JSVERSION_DEFAULT. This version stuff if we don't know what language we have is a little silly... */ @@ -451,6 +451,9 @@ public: */ virtual nsresult DropScriptObject(void *object) = 0; virtual nsresult HoldScriptObject(void *object) = 0; + + /* Report a pending exception if there is one on the native context */ + virtual void ReportPendingException() = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptContext, NS_ISCRIPTCONTEXT_IID) diff --git a/mozilla/dom/src/base/nsJSEnvironment.cpp b/mozilla/dom/src/base/nsJSEnvironment.cpp index 3b96305db97..68c9a6236d0 100644 --- a/mozilla/dom/src/base/nsJSEnvironment.cpp +++ b/mozilla/dom/src/base/nsJSEnvironment.cpp @@ -3549,6 +3549,14 @@ nsJSContext::DropScriptObject(void* aScriptObject) return NS_OK; } +void +nsJSContext::ReportPendingException() +{ + if (mIsInitialized && ::JS_IsExceptionPending(mContext)) { + ::JS_ReportPendingException(mContext); + } +} + /********************************************************************** * nsJSRuntime implementation *********************************************************************/ diff --git a/mozilla/dom/src/base/nsJSEnvironment.h b/mozilla/dom/src/base/nsJSEnvironment.h index 1b05adce2a4..dec747d9f9b 100644 --- a/mozilla/dom/src/base/nsJSEnvironment.h +++ b/mozilla/dom/src/base/nsJSEnvironment.h @@ -166,6 +166,8 @@ public: virtual nsresult DropScriptObject(void *object); virtual nsresult HoldScriptObject(void *object); + virtual void ReportPendingException(); + NS_DECL_NSIXPCSCRIPTNOTIFY NS_DECL_NSITIMERCALLBACK diff --git a/mozilla/extensions/python/dom/src/nsPyContext.cpp b/mozilla/extensions/python/dom/src/nsPyContext.cpp index 54df062a9da..0def7c34f48 100644 --- a/mozilla/extensions/python/dom/src/nsPyContext.cpp +++ b/mozilla/extensions/python/dom/src/nsPyContext.cpp @@ -933,3 +933,9 @@ nsPythonContext::HoldScriptObject(void *object) } return NS_OK; } + +void +nsPythonContext::ReportPendingException() +{ + // Not sure there's anything to do here +} diff --git a/mozilla/extensions/python/dom/src/nsPyContext.h b/mozilla/extensions/python/dom/src/nsPyContext.h index e576b0042bb..5fb60ac37cd 100644 --- a/mozilla/extensions/python/dom/src/nsPyContext.h +++ b/mozilla/extensions/python/dom/src/nsPyContext.h @@ -213,6 +213,8 @@ public: virtual nsresult HoldScriptObject(void *object); virtual nsresult DropScriptObject(void *object); + virtual void ReportPendingException(); + NS_DECL_NSITIMERCALLBACK PyObject *PyObject_FromInterface(nsISupports *target,