Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Unified Diff: Source/bindings/v8/V8Initializer.cpp

Issue 22650008: Add 'error' property to exceptions thrown via Worker::importScripts. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/bindings/v8/V8Initializer.cpp
diff --git a/Source/bindings/v8/V8Initializer.cpp b/Source/bindings/v8/V8Initializer.cpp
index fa8be8f0948c6ef17a96a92aa343c1f988aaf8b4..d19cce3fdc1ec02c61321c2a0222f4292286e41e 100644
--- a/Source/bindings/v8/V8Initializer.cpp
+++ b/Source/bindings/v8/V8Initializer.cpp
@@ -35,6 +35,7 @@
#include "bindings/v8/ScriptController.h"
#include "bindings/v8/ScriptProfiler.h"
#include "bindings/v8/V8Binding.h"
+#include "bindings/v8/V8ErrorHandler.h"
#include "bindings/v8/V8GCController.h"
#include "bindings/v8/V8HiddenPropertyName.h"
#include "bindings/v8/V8PerContextData.h"
@@ -46,9 +47,9 @@
#include "core/page/DOMWindow.h"
#include "core/page/Frame.h"
#include "core/platform/MemoryUsageSupport.h"
-#include <v8-debug.h>
#include "wtf/RefPtr.h"
#include "wtf/text/WTFString.h"
+#include <v8-debug.h>
adamk 2013/08/09 17:11:32 This #include seems wrong...
Mike West 2013/08/09 20:34:51 It's already included, this CL just moves it to st
adamk 2013/08/09 21:29:25 Ah, sorry, didn't see this was just a move.
namespace WebCore {
@@ -99,20 +100,9 @@ static void messageHandlerInMainThread(v8::Handle<v8::Message> message, v8::Hand
bool shouldUseDocumentURL = resourceName.IsEmpty() || !resourceName->IsString();
String resource = shouldUseDocumentURL ? firstWindow->document()->url() : toWebCoreString(resourceName);
RefPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, resource, message->GetLineNumber(), message->GetStartColumn());
-
- // messageHandlerInMainThread can be called while we're creating a new context.
- // Since we cannot create a wrapper in the intermediate timing, we need to skip
- // creating a wrapper for |event|.
- DOMWrapperWorld* world = DOMWrapperWorld::current();
- Frame* frame = firstWindow->document()->frame();
- if (world && frame && frame->script()->existingWindowShell(world)) {
- v8::Local<v8::Value> wrappedEvent = toV8(event.get(), v8::Handle<v8::Object>(), v8::Isolate::GetCurrent());
- if (!wrappedEvent.IsEmpty()) {
- ASSERT(wrappedEvent->IsObject());
- v8::Local<v8::Object>::Cast(wrappedEvent)->SetHiddenValue(V8HiddenPropertyName::error(), data);
- }
- }
AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? SharableCrossOrigin : NotSharableCrossOrigin;
+
+ V8ErrorHandler::storeExceptionOnErrorEventWrapper(getScriptExecutionContext(), event.get(), data, v8::Isolate::GetCurrent());
firstWindow->document()->reportException(event.release(), callStack, corsStatus);
}
@@ -183,12 +173,9 @@ static void messageHandlerInWorker(v8::Handle<v8::Message> message, v8::Handle<v
String errorMessage = toWebCoreString(message->Get());
String sourceURL = toWebCoreString(message->GetScriptResourceName());
RefPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, sourceURL, message->GetLineNumber(), message->GetStartColumn());
- v8::Local<v8::Value> wrappedEvent = toV8(event.get(), v8::Handle<v8::Object>(), v8::Isolate::GetCurrent());
- if (!wrappedEvent.IsEmpty()) {
- ASSERT(wrappedEvent->IsObject());
- v8::Local<v8::Object>::Cast(wrappedEvent)->SetHiddenValue(V8HiddenPropertyName::error(), data);
- }
AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? SharableCrossOrigin : NotSharableCrossOrigin;
+
+ V8ErrorHandler::storeExceptionOnErrorEventWrapper(context, event.get(), data, v8::Isolate::GetCurrent());
context->reportException(event.release(), 0, corsStatus);
}

Powered by Google App Engine
This is Rietveld 408576698