summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-23 21:23:30 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-23 21:23:30 +0000
commit89623771ba7288738b16d498d5f2c5404e2f1e10 (patch)
tree035589fe8fadc8653ec4b246db2d64e7aa940e3a
parent947b7fcdc79a7450877e83c6181e548a6ba945e4 (diff)
downloadchromium_src-89623771ba7288738b16d498d5f2c5404e2f1e10.zip
chromium_src-89623771ba7288738b16d498d5f2c5404e2f1e10.tar.gz
chromium_src-89623771ba7288738b16d498d5f2c5404e2f1e10.tar.bz2
Fix the V8 bindings problem that causes crash when an XHR exception is thrown in worker context. This is one of two patches needed for the fix. The other patch is https://bugs.webkit.org/show_bug.cgi?id=26626.
BUG=14753 TEST=WebKit layout tests should cover this. Review URL: http://codereview.chromium.org/144008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19060 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/port/bindings/v8/v8_proxy.cpp41
1 files changed, 26 insertions, 15 deletions
diff --git a/webkit/port/bindings/v8/v8_proxy.cpp b/webkit/port/bindings/v8/v8_proxy.cpp
index 1f2a669..26d727b 100644
--- a/webkit/port/bindings/v8/v8_proxy.cpp
+++ b/webkit/port/bindings/v8/v8_proxy.cpp
@@ -48,6 +48,7 @@
#include "ScriptController.h"
#include "V8CustomBinding.h"
#include "V8DOMMap.h"
+#include "WorkerContextExecutionProxy.h"
namespace WebCore {
@@ -2272,6 +2273,16 @@ void V8Proxy::InitContextIfNeeded()
m_frame->loader()->dispatchWindowObjectAvailable();
}
+template <class T>
+void setDOMExceptionHelper(V8ClassIndex::V8WrapperType type, PassRefPtr<T> exception) {
+ v8::Handle<v8::Value> v8Exception;
+ if (WorkerContextExecutionProxy::retrieve())
+ v8Exception = WorkerContextExecutionProxy::ToV8Object(type, exception.get());
+ else
+ v8Exception = V8Proxy::ToV8Object(type, exception.get());
+
+ v8::ThrowException(v8Exception);
+}
void V8Proxy::SetDOMException(int exception_code)
{
@@ -2284,37 +2295,37 @@ void V8Proxy::SetDOMException(int exception_code)
v8::Handle<v8::Value> exception;
switch (description.type) {
case DOMExceptionType:
- exception = ToV8Object(V8ClassIndex::DOMCOREEXCEPTION,
- DOMCoreException::create(description));
+ setDOMExceptionHelper(V8ClassIndex::DOMCOREEXCEPTION,
+ DOMCoreException::create(description));
break;
case RangeExceptionType:
- exception = ToV8Object(V8ClassIndex::RANGEEXCEPTION,
- RangeException::create(description));
+ setDOMExceptionHelper(V8ClassIndex::RANGEEXCEPTION,
+ RangeException::create(description));
break;
case EventExceptionType:
- exception = ToV8Object(V8ClassIndex::EVENTEXCEPTION,
- EventException::create(description));
+ setDOMExceptionHelper(V8ClassIndex::EVENTEXCEPTION,
+ EventException::create(description));
break;
case XMLHttpRequestExceptionType:
- exception = ToV8Object(V8ClassIndex::XMLHTTPREQUESTEXCEPTION,
- XMLHttpRequestException::create(description));
+ setDOMExceptionHelper(V8ClassIndex::XMLHTTPREQUESTEXCEPTION,
+ XMLHttpRequestException::create(description));
break;
#if ENABLE(SVG)
case SVGExceptionType:
- exception = ToV8Object(V8ClassIndex::SVGEXCEPTION,
- SVGException::create(description));
+ setDOMExceptionHelper(V8ClassIndex::SVGEXCEPTION,
+ SVGException::create(description));
break;
#endif
#if ENABLE(XPATH)
case XPathExceptionType:
- exception = ToV8Object(V8ClassIndex::XPATHEXCEPTION,
- XPathException::create(description));
+ setDOMExceptionHelper(V8ClassIndex::XPATHEXCEPTION,
+ XPathException::create(description));
break;
#endif
+ default:
+ ASSERT(false);
+ break;
}
-
- ASSERT(!exception.IsEmpty());
- v8::ThrowException(exception);
}
v8::Handle<v8::Value> V8Proxy::ThrowError(ErrorType type, const char* message)