OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 return v8Undefined(); | 72 return v8Undefined(); |
73 } | 73 } |
74 | 74 |
75 static const size_t maximumDepth = 2000; | 75 static const size_t maximumDepth = 2000; |
76 | 76 |
77 static PassRefPtr<IDBKey> createIDBKeyFromValue(v8::Handle<v8::Value> value, Vec
tor<v8::Handle<v8::Array> >& stack, v8::Isolate* isolate) | 77 static PassRefPtr<IDBKey> createIDBKeyFromValue(v8::Handle<v8::Value> value, Vec
tor<v8::Handle<v8::Array> >& stack, v8::Isolate* isolate) |
78 { | 78 { |
79 if (value->IsNumber() && !std::isnan(value->NumberValue())) | 79 if (value->IsNumber() && !std::isnan(value->NumberValue())) |
80 return IDBKey::createNumber(value->NumberValue()); | 80 return IDBKey::createNumber(value->NumberValue()); |
81 if (value->IsString()) | 81 if (value->IsString()) |
82 return IDBKey::createString(toWebCoreString(value)); | 82 return IDBKey::createString(toWebCoreString(value.As<v8::String>())); |
83 if (value->IsDate() && !std::isnan(value->NumberValue())) | 83 if (value->IsDate() && !std::isnan(value->NumberValue())) |
84 return IDBKey::createDate(value->NumberValue()); | 84 return IDBKey::createDate(value->NumberValue()); |
85 if (value->IsArray()) { | 85 if (value->IsArray()) { |
86 v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(value); | 86 v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(value); |
87 | 87 |
88 if (stack.contains(array)) | 88 if (stack.contains(array)) |
89 return 0; | 89 return 0; |
90 if (stack.size() >= maximumDepth) | 90 if (stack.size() >= maximumDepth) |
91 return 0; | 91 return 0; |
92 stack.append(array); | 92 stack.append(array); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 { | 337 { |
338 v8::Isolate* isolate = state ? state->context()->GetIsolate() : v8::Isolate:
:GetCurrent(); | 338 v8::Isolate* isolate = state ? state->context()->GetIsolate() : v8::Isolate:
:GetCurrent(); |
339 v8::HandleScope handleScope(isolate); | 339 v8::HandleScope handleScope(isolate); |
340 v8::Handle<v8::Value> value(scriptValue.v8Value()); | 340 v8::Handle<v8::Value> value(scriptValue.v8Value()); |
341 if (V8IDBKeyRange::HasInstance(value, isolate, worldType(isolate))) | 341 if (V8IDBKeyRange::HasInstance(value, isolate, worldType(isolate))) |
342 return V8IDBKeyRange::toNative(value.As<v8::Object>()); | 342 return V8IDBKeyRange::toNative(value.As<v8::Object>()); |
343 return 0; | 343 return 0; |
344 } | 344 } |
345 | 345 |
346 } // namespace WebCore | 346 } // namespace WebCore |
OLD | NEW |