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

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

Issue 15496007: Validate types of arguments passed to V8InjectedScriptHost custom methods. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: re-order calls to get "cast" closer to check and avoid needless work on error. Created 7 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
diff --git a/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
index 262353a2e73a40d921e2ec06321abca295888859..7f3d08749f2bfe598d3dcc18740e628f9675e8a3 100644
--- a/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
+++ b/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
@@ -277,23 +277,25 @@ v8::Handle<v8::Value> V8InjectedScriptHost::inspectMethodCustom(const v8::Argume
v8::Handle<v8::Value> V8InjectedScriptHost::databaseIdMethodCustom(const v8::Arguments& args)
{
- if (args.Length() < 1)
- return v8::Undefined();
- InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
- Database* database = V8Database::toNative(v8::Handle<v8::Object>::Cast(args[0]));
- if (database)
- return v8StringOrUndefined(host->databaseIdImpl(database), args.GetIsolate());
+ if (args.Length() > 0 && V8Database::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate()))) {
+ Database* database = V8Database::toNative(v8::Handle<v8::Object>::Cast(args[0]));
+ if (database) {
+ InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
+ return v8StringOrUndefined(host->databaseIdImpl(database), args.GetIsolate());
+ }
+ }
return v8::Undefined();
}
v8::Handle<v8::Value> V8InjectedScriptHost::storageIdMethodCustom(const v8::Arguments& args)
{
- if (args.Length() < 1)
- return v8::Undefined();
- InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
- Storage* storage = V8Storage::toNative(v8::Handle<v8::Object>::Cast(args[0]));
- if (storage)
- return v8StringOrUndefined(host->storageIdImpl(storage), args.GetIsolate());
+ if (args.Length() > 0 && V8Storage::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate()))) {
+ Storage* storage = V8Storage::toNative(v8::Handle<v8::Object>::Cast(args[0]));
+ if (storage) {
+ InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
+ return v8StringOrUndefined(host->storageIdImpl(storage), args.GetIsolate());
+ }
+ }
return v8::Undefined();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698