Chromium Code Reviews| Index: Source/bindings/v8/custom/V8ErrorEventCustom.cpp |
| diff --git a/Source/bindings/v8/custom/V8WorkerCustom.cpp b/Source/bindings/v8/custom/V8ErrorEventCustom.cpp |
| similarity index 61% |
| copy from Source/bindings/v8/custom/V8WorkerCustom.cpp |
| copy to Source/bindings/v8/custom/V8ErrorEventCustom.cpp |
| index 74ec3f881d5640a58dda55a7e2aec442f43525b2..71f0b4c5c042a2657a994fb610fc08fbd6abb934 100644 |
| --- a/Source/bindings/v8/custom/V8WorkerCustom.cpp |
| +++ b/Source/bindings/v8/custom/V8ErrorEventCustom.cpp |
| @@ -1,5 +1,5 @@ |
| /* |
| - * Copyright (C) 2009 Google Inc. All rights reserved. |
| + * Copyright (C) 2013 Google Inc. All rights reserved. |
| * |
| * Redistribution and use in source and binary forms, with or without |
| * modification, are permitted provided that the following conditions are |
| @@ -29,40 +29,40 @@ |
| */ |
| #include "config.h" |
| +#include "V8ErrorEvent.h" |
| -#include "V8Worker.h" |
| -#include "bindings/v8/ExceptionState.h" |
| +#include "RuntimeEnabledFeatures.h" |
| +#include "V8Event.h" |
| +#include "bindings/v8/DOMWrapperWorld.h" |
| +#include "bindings/v8/Dictionary.h" |
| +#include "bindings/v8/ScriptState.h" |
| #include "bindings/v8/SerializedScriptValue.h" |
| #include "bindings/v8/V8Binding.h" |
| -#include "bindings/v8/V8Utilities.h" |
| +#include "bindings/v8/V8DOMWrapper.h" |
| +#include "bindings/v8/V8HiddenPropertyName.h" |
| +#include "core/dom/ContextFeatures.h" |
| #include "core/page/Frame.h" |
| -#include "core/workers/Worker.h" |
| -#include "core/workers/WorkerGlobalScope.h" |
| -#include "wtf/ArrayBuffer.h" |
| namespace WebCore { |
| -void V8Worker::postMessageMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args) |
| +static v8::Handle<v8::Value> cacheState(v8::Handle<v8::Object> errorWrapper, v8::Handle<v8::Value> error) |
| { |
|
dcarney
2013/07/30 10:48:55
this function can go
|
| - Worker* worker = V8Worker::toNative(args.Holder()); |
| - MessagePortArray ports; |
| - ArrayBufferArray arrayBuffers; |
| - if (args.Length() > 1) { |
| - if (!extractTransferables(args[1], ports, arrayBuffers, args.GetIsolate())) |
| - return; |
| - } |
| - bool didThrow = false; |
| - RefPtr<SerializedScriptValue> message = |
| - SerializedScriptValue::create(args[0], |
| - &ports, |
| - &arrayBuffers, |
| - didThrow, |
| - args.GetIsolate()); |
| - if (didThrow) |
| + errorWrapper->SetHiddenValue(V8HiddenPropertyName::error(), error); |
| + return error; |
| +} |
| + |
| + |
| +void V8ErrorEvent::errorAttrGetterCustom(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| +{ |
| + ErrorEvent* event = V8ErrorEvent::toNative(info.Holder()); |
| + v8::Handle<v8::Object> error = event->error().v8Value()->ToObject(); |
| + |
| + if (DOMWrapperWorld::current()->worldId() != error->GetHiddenValue(V8HiddenPropertyName::worldId())->IntegerValue()) { |
| + v8SetReturnValue(info, v8::Null(info.GetIsolate())); |
| return; |
| - ExceptionState es(args.GetIsolate()); |
| - worker->postMessage(message.release(), &ports, es); |
| - es.throwIfNeeded(); |
| + } |
| + |
| + v8SetReturnValue(info, error); |
| } |
| } // namespace WebCore |