diff options
Diffstat (limited to 'chromium/third_party/WebKit/Source/bindings')
16 files changed, 99 insertions, 66 deletions
diff --git a/chromium/third_party/WebKit/Source/bindings/OWNERS b/chromium/third_party/WebKit/Source/bindings/OWNERS index 53d82fa65a9..04eb6bc41ea 100644 --- a/chromium/third_party/WebKit/Source/bindings/OWNERS +++ b/chromium/third_party/WebKit/Source/bindings/OWNERS @@ -1,6 +1,5 @@ abarth@chromium.org adamk@chromium.org -arv@chromium.org ch.dumez@sisa.samsung.com dcarney@chromium.org dglazkov@chromium.org diff --git a/chromium/third_party/WebKit/Source/bindings/scripts/IDLAttributes.txt b/chromium/third_party/WebKit/Source/bindings/scripts/IDLAttributes.txt index bec45e791f4..f3768392a09 100644 --- a/chromium/third_party/WebKit/Source/bindings/scripts/IDLAttributes.txt +++ b/chromium/third_party/WebKit/Source/bindings/scripts/IDLAttributes.txt @@ -59,6 +59,7 @@ GlobalContext=Window|WorkerGlobalScope|SharedWorkerGlobalScope|DedicatedWorkerGl Immutable ImplementedAs=* InitializedByEventConstructor +IsIndex # FIXME: We should remove this extended attribute once the needed refactoring is complete. LegacyImplementedInBaseClass MasqueradesAsUndefined diff --git a/chromium/third_party/WebKit/Source/bindings/scripts/deprecated_code_generator_v8.pm b/chromium/third_party/WebKit/Source/bindings/scripts/deprecated_code_generator_v8.pm index 39c5394140f..c327e692186 100644 --- a/chromium/third_party/WebKit/Source/bindings/scripts/deprecated_code_generator_v8.pm +++ b/chromium/third_party/WebKit/Source/bindings/scripts/deprecated_code_generator_v8.pm @@ -2191,6 +2191,14 @@ END } my $raisesExceptions = $function->extendedAttributes->{"RaisesException"}; + if (!$raisesExceptions) { + foreach my $parameter (@{$function->parameters}) { + if ($parameter->extendedAttributes->{"IsIndex"}) { + $raisesExceptions = 1; + } + } + } + if ($raisesExceptions) { AddToImplIncludes("bindings/v8/ExceptionState.h"); $code .= " ExceptionState es(args.GetIsolate());\n"; @@ -2409,6 +2417,14 @@ sub GenerateParametersCheck } } + if ($parameter->extendedAttributes->{"IsIndex"}) { + AddToImplIncludes("core/dom/ExceptionCode.h"); + $parameterCheckString .= " if (UNLIKELY($parameterName < 0)) {\n"; + $parameterCheckString .= " setDOMException(IndexSizeError, args.GetIsolate());\n"; + $parameterCheckString .= " return;\n"; + $parameterCheckString .= " }\n"; + } + $paramIndex++; } return ($parameterCheckString, $paramIndex, %replacements); @@ -2464,6 +2480,13 @@ sub GenerateSingleConstructorCallback if ($interface->extendedAttributes->{"ConstructorRaisesException"}) { $raisesExceptions = 1; } + if (!$raisesExceptions) { + foreach my $parameter (@{$function->parameters}) { + if ($parameter->extendedAttributes->{"IsIndex"}) { + $raisesExceptions = 1; + } + } + } my @beforeArgumentList; my @afterArgumentList; @@ -2723,6 +2746,13 @@ sub GenerateNamedConstructor if ($interface->extendedAttributes->{"ConstructorRaisesException"}) { $raisesExceptions = 1; } + if (!$raisesExceptions) { + foreach my $parameter (@{$function->parameters}) { + if ($parameter->extendedAttributes->{"IsIndex"}) { + $raisesExceptions = 1; + } + } + } my $maybeObserveFeature = GenerateFeatureObservation($function->extendedAttributes->{"MeasureAs"}); my $maybeDeprecateFeature = GenerateDeprecationNotification($function->extendedAttributes->{"DeprecateAs"}); @@ -4952,6 +4982,10 @@ sub GetNativeType return "double" if $type eq "double"; return "int" if $type eq "long" or $type eq "int" or $type eq "short" or $type eq "byte"; if ($type eq "unsigned long" or $type eq "unsigned int" or $type eq "unsigned short" or $type eq "octet") { + if ($extendedAttributes->{"IsIndex"}) { + # Special-case index arguments because we need to check that they aren't < 0. + return "int"; + } return "unsigned"; } return "long long" if $type eq "long long"; @@ -5031,6 +5065,10 @@ sub JSValueToNativeStatement my $getIsolate = shift; my $nativeType = GetNativeType($type, $extendedAttributes, "parameter"); + if ($type eq "unsigned long" and $extendedAttributes->{"IsIndex"}) { + # Special-case index arguments because we need to check that they aren't < 0. + $nativeType = "int"; + } my $native_value = JSValueToNative($type, $extendedAttributes, $jsValue, $getIsolate); my $code = ""; if ($type eq "DOMString" || IsEnumType($type)) { diff --git a/chromium/third_party/WebKit/Source/bindings/v8/CustomElementConstructorBuilder.cpp b/chromium/third_party/WebKit/Source/bindings/v8/CustomElementConstructorBuilder.cpp index b808512b8a9..02fd9273e7a 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/CustomElementConstructorBuilder.cpp +++ b/chromium/third_party/WebKit/Source/bindings/v8/CustomElementConstructorBuilder.cpp @@ -47,7 +47,6 @@ #include "core/dom/CustomElementCallbackDispatcher.h" #include "core/dom/CustomElementDefinition.h" #include "core/dom/CustomElementDescriptor.h" -#include "core/dom/CustomElementException.h" #include "core/dom/Document.h" #include "wtf/Assertions.h" @@ -69,7 +68,7 @@ bool CustomElementConstructorBuilder::isFeatureAllowed() const return !DOMWrapperWorld::isolatedWorld(m_context); } -bool CustomElementConstructorBuilder::validateOptions(const AtomicString& type, ExceptionState& es) +bool CustomElementConstructorBuilder::validateOptions() { ASSERT(m_prototype.IsEmpty()); @@ -80,21 +79,17 @@ bool CustomElementConstructorBuilder::validateOptions(const AtomicString& type, // is HTMLSpanElement.prototype, has an ambiguity about its // behavior. The spec should be fixed before WebKit implements // it. https://www.w3.org/Bugs/Public/show_bug.cgi?id=20801 - CustomElementException::throwException(CustomElementException::NotYetImplemented, type, es); return false; } v8::Handle<v8::Value> prototypeValue = prototypeScriptValue.v8Value(); - if (prototypeValue.IsEmpty() || !prototypeValue->IsObject()) { - CustomElementException::throwException(CustomElementException::PrototypeNotAnObject, type, es); + if (prototypeValue.IsEmpty() || !prototypeValue->IsObject()) return false; - } m_prototype = prototypeValue.As<v8::Object>(); V8PerContextData* perContextData; if (!(perContextData = V8PerContextData::from(m_context))) { // FIXME: This should generate an InvalidContext exception at a later point. - CustomElementException::throwException(CustomElementException::ContextDestroyedCheckingPrototype, type, es); return false; } @@ -114,7 +109,6 @@ bool CustomElementConstructorBuilder::validateOptions(const AtomicString& type, return true; } - CustomElementException::throwException(CustomElementException::PrototypeDoesNotExtendHTMLElementSVGElementPrototype, type, es); return false; } @@ -176,7 +170,7 @@ v8::Handle<v8::Function> CustomElementConstructorBuilder::retrieveCallback(v8::I return value.As<v8::Function>(); } -bool CustomElementConstructorBuilder::createConstructor(Document* document, CustomElementDefinition* definition, ExceptionState& es) +bool CustomElementConstructorBuilder::createConstructor(Document* document, CustomElementDefinition* definition) { ASSERT(!m_prototype.IsEmpty()); ASSERT(m_constructor.IsEmpty()); @@ -184,16 +178,14 @@ bool CustomElementConstructorBuilder::createConstructor(Document* document, Cust v8::Isolate* isolate = m_context->GetIsolate(); - if (!prototypeIsValid(definition->descriptor().type(), es)) + if (!prototypeIsValid()) return false; v8::Local<v8::FunctionTemplate> constructorTemplate = v8::FunctionTemplate::New(); constructorTemplate->SetCallHandler(constructCustomElement); m_constructor = constructorTemplate->GetFunction(); - if (m_constructor.IsEmpty()) { - CustomElementException::throwException(CustomElementException::ContextDestroyedRegisteringDefinition, definition->descriptor().type(), es); + if (m_constructor.IsEmpty()) return false; - } const CustomElementDescriptor& descriptor = definition->descriptor(); @@ -228,15 +220,15 @@ bool CustomElementConstructorBuilder::createConstructor(Document* document, Cust return true; } -bool CustomElementConstructorBuilder::prototypeIsValid(const AtomicString& type, ExceptionState& es) const +bool CustomElementConstructorBuilder::prototypeIsValid() const { if (m_prototype->InternalFieldCount() || !m_prototype->GetHiddenValue(V8HiddenPropertyName::customElementIsInterfacePrototypeObject()).IsEmpty()) { - CustomElementException::throwException(CustomElementException::PrototypeInUse, type, es); + // Alcreated an interface prototype object. return false; } if (m_prototype->GetPropertyAttributes(v8String("constructor", m_context->GetIsolate())) & v8::DontDelete) { - CustomElementException::throwException(CustomElementException::ConstructorPropertyNotConfigurable, type, es); + // "constructor" is not configurable. return false; } diff --git a/chromium/third_party/WebKit/Source/bindings/v8/CustomElementConstructorBuilder.h b/chromium/third_party/WebKit/Source/bindings/v8/CustomElementConstructorBuilder.h index 84e46bb568a..354fd12aff9 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/CustomElementConstructorBuilder.h +++ b/chromium/third_party/WebKit/Source/bindings/v8/CustomElementConstructorBuilder.h @@ -47,7 +47,6 @@ class CustomElementDefinition; class Dictionary; class Document; class Element; -class ExceptionState; class QualifiedName; class ScriptState; class V8PerContextData; @@ -67,10 +66,10 @@ public: // (returns false), the calls must stop. bool isFeatureAllowed() const; - bool validateOptions(const AtomicString& type, ExceptionState&); + bool validateOptions(); bool findTagName(const AtomicString& customElementType, QualifiedName& tagName); PassRefPtr<CustomElementLifecycleCallbacks> createCallbacks(); - bool createConstructor(Document*, CustomElementDefinition*, ExceptionState&); + bool createConstructor(Document*, CustomElementDefinition*); bool didRegisterDefinition(CustomElementDefinition*) const; // This method collects a return value for the bindings. It is @@ -81,7 +80,7 @@ public: private: static WrapperTypeInfo* findWrapperType(v8::Handle<v8::Value> chain); bool hasValidPrototypeChainFor(V8PerContextData*, WrapperTypeInfo*) const; - bool prototypeIsValid(const AtomicString& type, ExceptionState&) const; + bool prototypeIsValid() const; v8::Handle<v8::Function> retrieveCallback(v8::Isolate*, const char* name); v8::Handle<v8::Context> m_context; diff --git a/chromium/third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp b/chromium/third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp index f9f5604fd51..f2856c68bc5 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp +++ b/chromium/third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp @@ -303,11 +303,4 @@ ProfileNameIdleTimeMap* ScriptProfiler::currentProfileNameIdleTimeMap() return *map; } -void ScriptProfiler::setIdle(bool isIdle) -{ - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - if (v8::CpuProfiler* profiler = isolate->GetCpuProfiler()) - profiler->SetIdle(isIdle); -} - } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/bindings/v8/ScriptProfiler.h b/chromium/third_party/WebKit/Source/bindings/v8/ScriptProfiler.h index 93f25bcb86c..e11979c02de 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/ScriptProfiler.h +++ b/chromium/third_party/WebKit/Source/bindings/v8/ScriptProfiler.h @@ -79,7 +79,6 @@ public: static void initialize(); static void visitNodeWrappers(WrappedNodeVisitor*); static HashMap<String, double>* currentProfileNameIdleTimeMap(); - static void setIdle(bool isIdle); }; } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/bindings/v8/ScriptSourceCode.h b/chromium/third_party/WebKit/Source/bindings/v8/ScriptSourceCode.h index 5bacd8bb116..97046ef4024 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/ScriptSourceCode.h +++ b/chromium/third_party/WebKit/Source/bindings/v8/ScriptSourceCode.h @@ -31,8 +31,8 @@ #ifndef ScriptSourceCode_h #define ScriptSourceCode_h -#include "core/fetch/ResourcePtr.h" -#include "core/fetch/ScriptResource.h" +#include "core/loader/cache/ResourcePtr.h" +#include "core/loader/cache/ScriptResource.h" #include "weborigin/KURL.h" #include "wtf/PassOwnPtr.h" #include "wtf/text/TextPosition.h" diff --git a/chromium/third_party/WebKit/Source/bindings/v8/V8ErrorHandler.cpp b/chromium/third_party/WebKit/Source/bindings/v8/V8ErrorHandler.cpp index f7b9681e8d6..8f8b7c2cde5 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/V8ErrorHandler.cpp +++ b/chromium/third_party/WebKit/Source/bindings/v8/V8ErrorHandler.cpp @@ -31,16 +31,12 @@ #include "config.h" #include "bindings/v8/V8ErrorHandler.h" -#include "V8ErrorEvent.h" #include "bindings/v8/ScriptController.h" #include "bindings/v8/V8Binding.h" #include "bindings/v8/V8HiddenPropertyName.h" #include "bindings/v8/V8ScriptRunner.h" -#include "core/dom/Document.h" #include "core/dom/ErrorEvent.h" #include "core/dom/EventNames.h" -#include "core/dom/ScriptExecutionContext.h" -#include "core/page/Frame.h" namespace WebCore { @@ -77,16 +73,6 @@ v8::Local<v8::Value> V8ErrorHandler::callListenerFunction(ScriptExecutionContext return returnValue; } -// static -void V8ErrorHandler::storeExceptionOnErrorEventWrapper(ErrorEvent* event, v8::Handle<v8::Value> data, v8::Isolate* isolate) -{ - v8::Local<v8::Value> wrappedEvent = toV8(event, v8::Handle<v8::Object>(), isolate); - if (!wrappedEvent.IsEmpty()) { - ASSERT(wrappedEvent->IsObject()); - v8::Local<v8::Object>::Cast(wrappedEvent)->SetHiddenValue(V8HiddenPropertyName::error(), data); - } -} - bool V8ErrorHandler::shouldPreventDefault(v8::Local<v8::Value> returnValue) { return returnValue->IsBoolean() && returnValue->BooleanValue(); diff --git a/chromium/third_party/WebKit/Source/bindings/v8/V8ErrorHandler.h b/chromium/third_party/WebKit/Source/bindings/v8/V8ErrorHandler.h index 92246d3f136..90fdf5f81a0 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/V8ErrorHandler.h +++ b/chromium/third_party/WebKit/Source/bindings/v8/V8ErrorHandler.h @@ -37,9 +37,6 @@ namespace WebCore { -class ErrorEvent; -class Frame; - class V8ErrorHandler : public V8EventListener { public: static PassRefPtr<V8ErrorHandler> create(v8::Local<v8::Object> listener, bool isInline) @@ -47,8 +44,6 @@ public: return adoptRef(new V8ErrorHandler(listener, isInline)); } - static void storeExceptionOnErrorEventWrapper(ErrorEvent*, v8::Handle<v8::Value>, v8::Isolate*); - private: V8ErrorHandler(v8::Local<v8::Object> listener, bool isInline); diff --git a/chromium/third_party/WebKit/Source/bindings/v8/V8Initializer.cpp b/chromium/third_party/WebKit/Source/bindings/v8/V8Initializer.cpp index d2e2d9c26a1..fa8be8f0948 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/V8Initializer.cpp +++ b/chromium/third_party/WebKit/Source/bindings/v8/V8Initializer.cpp @@ -35,7 +35,6 @@ #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" @@ -47,9 +46,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> namespace WebCore { @@ -100,14 +99,20 @@ 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()); - AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? SharableCrossOrigin : NotSharableCrossOrigin; - // This method might be called while we're creating a new context. In this case, we - // avoid storing the exception object, as we can't create a wrapper during context creation. + // 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)) - V8ErrorHandler::storeExceptionOnErrorEventWrapper(event.get(), data, v8::Isolate::GetCurrent()); + 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; firstWindow->document()->reportException(event.release(), callStack, corsStatus); } @@ -178,9 +183,12 @@ 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(event.get(), data, v8::Isolate::GetCurrent()); context->reportException(event.release(), 0, corsStatus); } diff --git a/chromium/third_party/WebKit/Source/bindings/v8/V8ScriptRunner.cpp b/chromium/third_party/WebKit/Source/bindings/v8/V8ScriptRunner.cpp index cab312f6445..700441650cc 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/V8ScriptRunner.cpp +++ b/chromium/third_party/WebKit/Source/bindings/v8/V8ScriptRunner.cpp @@ -30,8 +30,8 @@ #include "bindings/v8/V8GCController.h" #include "bindings/v8/V8RecursionScope.h" #include "core/dom/ScriptExecutionContext.h" -#include "core/fetch/ScriptResource.h" #include "core/loader/CachedMetadata.h" +#include "core/loader/cache/ScriptResource.h" #include "core/platform/chromium/TraceEvent.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/bindings/v8/WorkerScriptController.cpp b/chromium/third_party/WebKit/Source/bindings/v8/WorkerScriptController.cpp index cbbf758d16d..a0d3b2f5b1e 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/WorkerScriptController.cpp +++ b/chromium/third_party/WebKit/Source/bindings/v8/WorkerScriptController.cpp @@ -37,7 +37,6 @@ #include "V8WorkerGlobalScope.h" #include "bindings/v8/ScriptSourceCode.h" #include "bindings/v8/ScriptValue.h" -#include "bindings/v8/V8ErrorHandler.h" #include "bindings/v8/V8GCController.h" #include "bindings/v8/V8Initializer.h" #include "bindings/v8/V8ObjectConstructor.h" @@ -168,7 +167,6 @@ ScriptValue WorkerScriptController::evaluate(const String& script, const String& state->lineNumber = message->GetLineNumber(); state->columnNumber = message->GetStartColumn(); state->sourceURL = toWebCoreString(message->GetScriptResourceName()); - state->exception = ScriptValue(block.Exception()); block.Reset(); } else state->hadException = false; @@ -190,10 +188,10 @@ void WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, RefPtr if (errorEvent) { *errorEvent = m_workerGlobalScope->shouldSanitizeScriptError(state.sourceURL, NotSharableCrossOrigin) ? ErrorEvent::createSanitizedError() : ErrorEvent::create(state.errorMessage, state.sourceURL, state.lineNumber, state.columnNumber); - V8ErrorHandler::storeExceptionOnErrorEventWrapper(errorEvent->get(), state.exception.v8Value(), m_isolate); } else { ASSERT(!m_workerGlobalScope->shouldSanitizeScriptError(state.sourceURL, NotSharableCrossOrigin)); RefPtr<ErrorEvent> event = m_errorEventFromImportedScript ? m_errorEventFromImportedScript.release() : ErrorEvent::create(state.errorMessage, state.sourceURL, state.lineNumber, state.columnNumber); + m_errorEventFromImportedScript.clear(); m_workerGlobalScope->reportException(event, 0, NotSharableCrossOrigin); } } diff --git a/chromium/third_party/WebKit/Source/bindings/v8/WorkerScriptController.h b/chromium/third_party/WebKit/Source/bindings/v8/WorkerScriptController.h index 0697da0b0a6..dd0e5745106 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/WorkerScriptController.h +++ b/chromium/third_party/WebKit/Source/bindings/v8/WorkerScriptController.h @@ -58,7 +58,6 @@ namespace WebCore { int lineNumber; int columnNumber; String sourceURL; - ScriptValue exception; }; class WorkerScriptController { diff --git a/chromium/third_party/WebKit/Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp b/chromium/third_party/WebKit/Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp index b2e35d93b49..87d751da456 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp +++ b/chromium/third_party/WebKit/Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp @@ -94,6 +94,26 @@ void SetTimeoutOrInterval(const v8::FunctionCallbackInfo<v8::Value>& args, bool v8SetReturnValue(args, timerId); } +void V8WorkerGlobalScope::importScriptsMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args) +{ + if (!args.Length()) + return; + + Vector<String> urls; + for (int i = 0; i < args.Length(); i++) { + V8TRYCATCH_VOID(v8::Handle<v8::String>, scriptUrl, args[i]->ToString()); + if (scriptUrl.IsEmpty()) + return; + urls.append(toWebCoreString(scriptUrl)); + } + + WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(args.Holder()); + + ExceptionState es(args.GetIsolate()); + workerGlobalScope->importScripts(urls, es); + es.throwIfNeeded(); +} + void V8WorkerGlobalScope::setTimeoutMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args) { return SetTimeoutOrInterval(args, true); diff --git a/chromium/third_party/WebKit/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp b/chromium/third_party/WebKit/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp index 9d734b6b26d..e9eabc2f481 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp +++ b/chromium/third_party/WebKit/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp @@ -102,14 +102,20 @@ void V8XMLHttpRequest::responseAttrGetterCustom(v8::Local<v8::String> name, cons case XMLHttpRequest::ResponseTypeBlob: { - Blob* blob = xmlHttpRequest->responseBlob(); + ExceptionState es(info.GetIsolate()); + Blob* blob = xmlHttpRequest->responseBlob(es); + if (es.throwIfNeeded()) + return; v8SetReturnValue(info, toV8Fast(blob, info, xmlHttpRequest)); return; } case XMLHttpRequest::ResponseTypeArrayBuffer: { - ArrayBuffer* arrayBuffer = xmlHttpRequest->responseArrayBuffer(); + ExceptionState es(info.GetIsolate()); + ArrayBuffer* arrayBuffer = xmlHttpRequest->responseArrayBuffer(es); + if (es.throwIfNeeded()) + return; if (arrayBuffer && !arrayBuffer->hasDeallocationObserver()) { arrayBuffer->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instance()); v8::V8::AdjustAmountOfExternalAllocatedMemory(arrayBuffer->byteLength()); |