diff --git a/content/base/public/nsContentUtils.h b/content/base/public/nsContentUtils.h index 2fc113d72462..2dd50c83a382 100644 --- a/content/base/public/nsContentUtils.h +++ b/content/base/public/nsContentUtils.h @@ -1477,7 +1477,7 @@ public: // Returns PR_FALSE if something erroneous happened. PRBool Push(nsPIDOMEventTarget *aCurrentTarget); // If a null JSContext is passed to Push(), that will cause no - // Push() to happen and an error to be returned. + // push to happen and false to be returned. PRBool Push(JSContext *cx); // Explicitly push a null JSContext on the the stack PRBool PushNull(); diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index a6c83eae862b..d599ed143c19 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -2712,6 +2712,13 @@ nsCxPusher::Push(nsPIDOMEventTarget *aCurrentTarget) nsCOMPtr scx; nsresult rv = aCurrentTarget->GetContextForEventHandlers(getter_AddRefs(scx)); NS_ENSURE_SUCCESS(rv, PR_FALSE); + + if (!scx) { + // Nothing to do here, I guess. Have to return true so that event firing + // will still work correctly even if there is no associated JSContext + return PR_TRUE; + } + JSContext* cx = nsnull; if (scx) {