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

Unified Diff: Source/bindings/v8/custom/V8FileCustom.cpp

Issue 111373003: Migrate bindings constructors to the new ExceptionState model. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Ugh. 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/custom/V8BlobCustomHelpers.cpp ('k') | Source/core/dom/DOMURL.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/custom/V8FileCustom.cpp
diff --git a/Source/bindings/v8/custom/V8FileCustom.cpp b/Source/bindings/v8/custom/V8FileCustom.cpp
index 6d787f6496877e5854068f2444f369396d5c159e..ecbb7815d46e122ba9909197976f2bd0e9475019 100644
--- a/Source/bindings/v8/custom/V8FileCustom.cpp
+++ b/Source/bindings/v8/custom/V8FileCustom.cpp
@@ -32,6 +32,7 @@
#include "V8File.h"
#include "RuntimeEnabledFeatures.h"
+#include "bindings/v8/ExceptionState.h"
#include "bindings/v8/custom/V8BlobCustomHelpers.h"
#include "core/fileapi/BlobBuilder.h"
@@ -39,13 +40,17 @@ namespace WebCore {
void V8File::constructorCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
+ ExceptionState exceptionState(ExceptionState::ConstructionContext, "File", info.Holder(), info.GetIsolate());
+
if (!RuntimeEnabledFeatures::fileConstructorEnabled()) {
- throwTypeError("Illegal constructor", info.GetIsolate());
+ exceptionState.throwTypeError("Illegal constructor");
+ exceptionState.throwIfNeeded();
return;
}
if (info.Length() < 2) {
- throwTypeError("File constructor requires at least two arguments", info.GetIsolate());
+ exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, info.Length()));
+ exceptionState.throwIfNeeded();
return;
}
@@ -55,7 +60,8 @@ void V8File::constructorCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
} else {
const int sequenceArgumentIndex = 0;
if (toV8Sequence(info[sequenceArgumentIndex], length, info.GetIsolate()).IsEmpty()) {
- throwTypeError(ExceptionMessages::failedToConstruct("File", ExceptionMessages::notAnArrayTypeArgumentOrValue(sequenceArgumentIndex + 1)), info.GetIsolate());
+ exceptionState.throwTypeError(ExceptionMessages::notAnArrayTypeArgumentOrValue(sequenceArgumentIndex + 1));
+ exceptionState.throwIfNeeded();
return;
}
}
@@ -65,12 +71,15 @@ void V8File::constructorCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
V8BlobCustomHelpers::ParsedProperties properties(true);
if (info.Length() > 2) {
if (!info[2]->IsObject()) {
- throwTypeError(ExceptionMessages::failedToConstruct("File", "The 3rd argument is not of type Object."), info.GetIsolate());
+ exceptionState.throwTypeError("The 3rd argument is not of type Object.");
+ exceptionState.throwIfNeeded();
return;
}
- if (!properties.parseBlobPropertyBag(info[2], "File", info.GetIsolate()))
+ if (!properties.parseBlobPropertyBag(info[2], "File", exceptionState, info.GetIsolate())) {
+ exceptionState.throwIfNeeded();
return;
+ }
} else {
properties.setDefaultLastModified();
}
« no previous file with comments | « Source/bindings/v8/custom/V8BlobCustomHelpers.cpp ('k') | Source/core/dom/DOMURL.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698