Chromium Code Reviews| Index: Source/bindings/v8/V8DOMWindowOrWorkerContextErrorHandler.cpp |
| diff --git a/Source/bindings/v8/V8WindowErrorHandler.cpp b/Source/bindings/v8/V8DOMWindowOrWorkerContextErrorHandler.cpp |
| similarity index 77% |
| rename from Source/bindings/v8/V8WindowErrorHandler.cpp |
| rename to Source/bindings/v8/V8DOMWindowOrWorkerContextErrorHandler.cpp |
| index 46c6469960b8898b4e1e3a02cf1dd6362e7ffc66..c127addf6c6cba9c59d979717e6a1669b2e8fa83 100644 |
| --- a/Source/bindings/v8/V8WindowErrorHandler.cpp |
| +++ b/Source/bindings/v8/V8DOMWindowOrWorkerContextErrorHandler.cpp |
| @@ -29,22 +29,22 @@ |
| */ |
| #include "config.h" |
| - |
| -#include "bindings/v8/V8WindowErrorHandler.h" |
| +#include "bindings/v8/V8DOMWindowOrWorkerContextErrorHandler.h" |
| #include "bindings/v8/ScriptController.h" |
| #include "bindings/v8/V8Binding.h" |
| +#include "bindings/v8/V8RecursionScope.h" |
| #include "core/dom/ErrorEvent.h" |
| #include "core/dom/EventNames.h" |
| namespace WebCore { |
| -V8WindowErrorHandler::V8WindowErrorHandler(v8::Local<v8::Object> listener, bool isInline) |
| +V8DOMWindowOrWorkerContextErrorHandler::V8DOMWindowOrWorkerContextErrorHandler(v8::Local<v8::Object> listener, bool isInline) |
| : V8EventListener(listener, isInline) |
| { |
| } |
| -v8::Local<v8::Value> V8WindowErrorHandler::callListenerFunction(ScriptExecutionContext* context, v8::Handle<v8::Value> jsEvent, Event* event) |
| +v8::Local<v8::Value> V8DOMWindowOrWorkerContextErrorHandler::callListenerFunction(ScriptExecutionContext* context, v8::Handle<v8::Value> jsEvent, Event* event) |
| { |
| if (!event->hasInterface(eventNames().interfaceForErrorEvent)) |
| return V8EventListener::callListenerFunction(context, jsEvent, event); |
| @@ -59,12 +59,16 @@ v8::Local<v8::Value> V8WindowErrorHandler::callListenerFunction(ScriptExecutionC |
| v8::Handle<v8::Value> parameters[3] = { v8String(errorEvent->message(), isolate), v8String(errorEvent->filename(), isolate), v8Integer(errorEvent->lineno(), isolate) }; |
| v8::TryCatch tryCatch; |
| tryCatch.SetVerbose(true); |
| - returnValue = ScriptController::callFunctionWithInstrumentation(0, callFunction, thisValue, 3, parameters); |
| + if (worldType(isolate) == WorkerWorld) { |
| + V8RecursionScope recursionScope(context); |
| + returnValue = callFunction->Call(thisValue, 3, parameters); |
| + } else |
| + returnValue = ScriptController::callFunctionWithInstrumentation(0, callFunction, thisValue, 3, parameters); |
|
haraken
2013/05/20 02:50:30
I don't fully understand why we pass 0 instead of
|
| } |
| return returnValue; |
| } |
| -bool V8WindowErrorHandler::shouldPreventDefault(v8::Local<v8::Value> returnValue) |
| +bool V8DOMWindowOrWorkerContextErrorHandler::shouldPreventDefault(v8::Local<v8::Value> returnValue) |
| { |
| return returnValue->IsBoolean() && returnValue->BooleanValue(); |
| } |