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

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

Issue 114363002: Structured cloning: improve DataCloneError reporting. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased + reset V8TestInterfaceConstructor.cpp result Created 7 years 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
« no previous file with comments | « Source/bindings/v8/V8Utilities.h ('k') | Source/bindings/v8/custom/V8DedicatedWorkerGlobalScopeCustom.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/V8Utilities.cpp
diff --git a/Source/bindings/v8/V8Utilities.cpp b/Source/bindings/v8/V8Utilities.cpp
index 6a70b502c3213f2eae85f46223165d2affe7e430..4476736a76ee5d9342564e133580e104cf80a50a 100644
--- a/Source/bindings/v8/V8Utilities.cpp
+++ b/Source/bindings/v8/V8Utilities.cpp
@@ -64,7 +64,7 @@ void createHiddenDependency(v8::Handle<v8::Object> object, v8::Local<v8::Value>
cacheArray->Set(v8::Integer::New(cacheArray->Length(), isolate), value);
}
-bool extractTransferables(v8::Local<v8::Value> value, MessagePortArray& ports, ArrayBufferArray& arrayBuffers, bool& notASequence, v8::Isolate* isolate)
+bool extractTransferables(v8::Local<v8::Value> value, int argumentIndex, MessagePortArray& ports, ArrayBufferArray& arrayBuffers, ExceptionState& exceptionState, v8::Isolate* isolate)
{
if (isUndefinedOrNull(value)) {
ports.resize(0);
@@ -77,7 +77,7 @@ bool extractTransferables(v8::Local<v8::Value> value, MessagePortArray& ports, A
v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(value);
length = array->Length();
} else if (toV8Sequence(value, length, isolate).IsEmpty()) {
- notASequence = true;
+ exceptionState.throwTypeError(ExceptionMessages::notAnArrayTypeArgumentOrValue(argumentIndex + 1));
return false;
}
@@ -88,7 +88,7 @@ bool extractTransferables(v8::Local<v8::Value> value, MessagePortArray& ports, A
v8::Local<v8::Value> transferrable = transferrables->Get(i);
// Validation of non-null objects, per HTML5 spec 10.3.3.
if (isUndefinedOrNull(transferrable)) {
- setDOMException(DataCloneError, isolate);
+ exceptionState.throwDOMException(DataCloneError, "Value at index " + String::number(i) + " is an untransferable " + (transferrable->IsUndefined() ? "'undefined'" : "'null'") + " value.");
return false;
}
// Validation of Objects implementing an interface, per WebIDL spec 4.1.15.
@@ -96,14 +96,14 @@ bool extractTransferables(v8::Local<v8::Value> value, MessagePortArray& ports, A
RefPtr<MessagePort> port = V8MessagePort::toNative(v8::Handle<v8::Object>::Cast(transferrable));
// Check for duplicate MessagePorts.
if (ports.contains(port)) {
- setDOMException(DataCloneError, isolate);
+ exceptionState.throwDOMException(DataCloneError, "Message port at index " + String::number(i) + " is a duplicate of an earlier port.");
return false;
}
ports.append(port.release());
} else if (V8ArrayBuffer::hasInstance(transferrable, isolate, worldType(isolate)))
arrayBuffers.append(V8ArrayBuffer::toNative(v8::Handle<v8::Object>::Cast(transferrable)));
else {
- setDOMException(DataCloneError, isolate);
+ exceptionState.throwDOMException(DataCloneError, "Value at index " + String::number(i) + " does not have a transferable type.");
return false;
}
}
« no previous file with comments | « Source/bindings/v8/V8Utilities.h ('k') | Source/bindings/v8/custom/V8DedicatedWorkerGlobalScopeCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698