diff --git a/dom/src/base/nsDOMScriptObjectFactory.cpp b/dom/src/base/nsDOMScriptObjectFactory.cpp index df3958a7e02..4ec84314732 100644 --- a/dom/src/base/nsDOMScriptObjectFactory.cpp +++ b/dom/src/base/nsDOMScriptObjectFactory.cpp @@ -316,13 +316,18 @@ static nsresult CreateXPConnectException(nsresult aResult, nsIException *aDefaultException, nsIException **_retval) { - nsresult rv = NS_OK; - nsCOMPtr exception( - do_CreateInstance("@mozilla.org/js/xpc/Exception;1", &rv)); - NS_ENSURE_SUCCESS(rv, rv); + // See whether we already have a useful XPConnect exception. If we + // do, let's not create one with _less_ information! + nsCOMPtr exception(do_QueryInterface(aDefaultException)); + if (!exception) { + nsresult rv = NS_OK; + exception = do_CreateInstance("@mozilla.org/js/xpc/Exception;1", &rv); + NS_ENSURE_SUCCESS(rv, rv); - rv = exception->Initialize(nsnull, aResult, nsnull, nsnull, nsnull, nsnull); - NS_ENSURE_SUCCESS(rv, rv); + rv = exception->Initialize(nsnull, aResult, nsnull, nsnull, nsnull, + nsnull); + NS_ENSURE_SUCCESS(rv, rv); + } NS_ADDREF(*_retval = exception); return NS_OK; diff --git a/dom/tests/mochitest/bugs/Makefile.in b/dom/tests/mochitest/bugs/Makefile.in index 05933eee464..e079cdd5e1c 100644 --- a/dom/tests/mochitest/bugs/Makefile.in +++ b/dom/tests/mochitest/bugs/Makefile.in @@ -45,6 +45,7 @@ include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/rules.mk _TEST_FILES = \ + test_bug291377.html \ test_bug308856.html \ test_bug333983.html \ test_bug342448.html \ diff --git a/dom/tests/mochitest/bugs/test_bug291377.html b/dom/tests/mochitest/bugs/test_bug291377.html new file mode 100644 index 00000000000..a9f66cf694e --- /dev/null +++ b/dom/tests/mochitest/bugs/test_bug291377.html @@ -0,0 +1,42 @@ + + + + + Test for Bug 291377 + + + + + +Mozilla Bug 291377 +

+ +
+
+
+ + + diff --git a/js/src/xpconnect/src/xpcexception.cpp b/js/src/xpconnect/src/xpcexception.cpp index 1977fd36835..326d975599b 100644 --- a/js/src/xpconnect/src/xpcexception.cpp +++ b/js/src/xpconnect/src/xpcexception.cpp @@ -121,9 +121,6 @@ nsXPCException::GetNSResultCount() NS_INTERFACE_MAP_BEGIN(nsXPCException) NS_INTERFACE_MAP_ENTRY(nsIException) NS_INTERFACE_MAP_ENTRY(nsIXPCException) -#ifdef XPC_USE_SECURITY_CHECKED_COMPONENT - NS_INTERFACE_MAP_ENTRY(nsISecurityCheckedComponent) -#endif NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIException) NS_IMPL_QUERY_CLASSINFO(nsXPCException) NS_INTERFACE_MAP_END_THREADSAFE @@ -484,43 +481,3 @@ nsXPCException::NewException(const char *aMessage, *exceptn = NS_STATIC_CAST(nsIXPCException*, e); return NS_OK; } - -#ifdef XPC_USE_SECURITY_CHECKED_COMPONENT - -/* string canCreateWrapper (in nsIIDPtr iid); */ -NS_IMETHODIMP -nsXPCException::CanCreateWrapper(const nsIID * iid, char **_retval) -{ - *_retval = xpc_CloneAllAccess(); - return NS_OK; -} - -/* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */ -NS_IMETHODIMP -nsXPCException::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval) -{ - static const char* allowed[] = { "toString", nsnull}; - - *_retval = xpc_CheckAccessList(methodName, allowed); - return NS_OK; -} - -/* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */ -NS_IMETHODIMP -nsXPCException::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval) -{ - static const char* allowed[] = { "message", "result", "name", nsnull}; - - *_retval = xpc_CheckAccessList(propertyName, allowed); - return NS_OK; -} - -/* string canSetProperty (in nsIIDPtr iid, in wstring propertyName); */ -NS_IMETHODIMP -nsXPCException::CanSetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval) -{ - // If you have to ask, then the answer is NO - *_retval = nsnull; - return NS_OK; -} -#endif diff --git a/js/src/xpconnect/src/xpcmodule.cpp b/js/src/xpconnect/src/xpcmodule.cpp index acb5b79ca8e..dcebc10cbc7 100644 --- a/js/src/xpconnect/src/xpcmodule.cpp +++ b/js/src/xpconnect/src/xpcmodule.cpp @@ -85,7 +85,7 @@ static const nsModuleComponentInfo components[] = { {nsnull, NS_JS_ID_CID, XPC_ID_CONTRACTID, nsJSIDConstructor }, {nsnull, NS_XPCONNECT_CID, XPC_XPCONNECT_CONTRACTID, nsIXPConnectConstructor }, {nsnull, NS_XPC_THREAD_JSCONTEXT_STACK_CID, XPC_CONTEXT_STACK_CONTRACTID, nsIJSContextStackConstructor }, - {nsnull, NS_XPCEXCEPTION_CID, XPC_EXCEPTION_CONTRACTID, nsXPCExceptionConstructor, nsnull, nsnull, nsnull, NS_CI_INTERFACE_GETTER_NAME(nsXPCException), nsnull, &NS_CLASSINFO_NAME(nsXPCException)}, + {nsnull, NS_XPCEXCEPTION_CID, XPC_EXCEPTION_CONTRACTID, nsXPCExceptionConstructor, nsnull, nsnull, nsnull, NS_CI_INTERFACE_GETTER_NAME(nsXPCException), nsnull, &NS_CLASSINFO_NAME(nsXPCException), nsIClassInfo::DOM_OBJECT }, {nsnull, NS_JS_RUNTIME_SERVICE_CID, XPC_RUNTIME_CONTRACTID, nsIJSRuntimeServiceConstructor}, {NS_SCRIPTERROR_CLASSNAME, NS_SCRIPTERROR_CID, NS_SCRIPTERROR_CONTRACTID, nsScriptErrorConstructor }, {nsnull, SCRIPTABLE_INTERFACES_CID, NS_SCRIPTABLE_INTERFACES_CONTRACTID, nsXPCComponents_InterfacesConstructor, 0, 0, 0, 0, 0, 0, nsIClassInfo::THREADSAFE }, diff --git a/js/src/xpconnect/src/xpcprivate.h b/js/src/xpconnect/src/xpcprivate.h index 54496a9d7b5..61c8c2b84e5 100644 --- a/js/src/xpconnect/src/xpcprivate.h +++ b/js/src/xpconnect/src/xpcprivate.h @@ -2609,9 +2609,6 @@ private: class nsXPCException : public nsIXPCException -#ifdef XPC_USE_SECURITY_CHECKED_COMPONENT - , public nsISecurityCheckedComponent -#endif { public: NS_DEFINE_STATIC_CID_ACCESSOR(NS_XPCEXCEPTION_CID) @@ -2619,9 +2616,6 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSIEXCEPTION NS_DECL_NSIXPCEXCEPTION -#ifdef XPC_USE_SECURITY_CHECKED_COMPONENT - NS_DECL_NSISECURITYCHECKEDCOMPONENT -#endif static nsresult NewException(const char *aMessage, nsresult aResult,