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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // Experimental feature: binary keys | 106 // Experimental feature: binary keys |
107 // https://w3c.github.io/IndexedDB/#steps-to-convert-a-key-to-a-value | 107 // https://w3c.github.io/IndexedDB/#steps-to-convert-a-key-to-a-value |
108 return toV8(DOMArrayBuffer::create(reinterpret_cast<const unsigned char*
>(key->binary()->data()), key->binary()->size()), creationContext, isolate); | 108 return toV8(DOMArrayBuffer::create(reinterpret_cast<const unsigned char*
>(key->binary()->data()), key->binary()->size()), creationContext, isolate); |
109 case IDBKey::DateType: | 109 case IDBKey::DateType: |
110 return v8::Date::New(context, key->date()).ToLocalChecked(); | 110 return v8::Date::New(context, key->date()).ToLocalChecked(); |
111 case IDBKey::ArrayType: | 111 case IDBKey::ArrayType: |
112 { | 112 { |
113 v8::Local<v8::Array> array = v8::Array::New(isolate, key->array().si
ze()); | 113 v8::Local<v8::Array> array = v8::Array::New(isolate, key->array().si
ze()); |
114 for (size_t i = 0; i < key->array().size(); ++i) { | 114 for (size_t i = 0; i < key->array().size(); ++i) { |
115 v8::Local<v8::Value> value = toV8(key->array()[i].get(), creatio
nContext, isolate); | 115 v8::Local<v8::Value> value = toV8(key->array()[i].get(), creatio
nContext, isolate); |
116 if (value.IsEmpty()) | |
117 value = v8::Undefined(isolate); | |
118 if (!v8CallBoolean(array->CreateDataProperty(context, i, value))
) | 116 if (!v8CallBoolean(array->CreateDataProperty(context, i, value))
) |
119 return v8Undefined(); | 117 return v8Undefined(); |
120 } | 118 } |
121 return array; | 119 return array; |
122 } | 120 } |
123 } | 121 } |
124 | 122 |
125 ASSERT_NOT_REACHED(); | 123 ASSERT_NOT_REACHED(); |
126 return v8Undefined(); | 124 return v8Undefined(); |
127 } | 125 } |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 // Deserialize the entire IDBValue (injecting key & keypath if present). | 328 // Deserialize the entire IDBValue (injecting key & keypath if present). |
331 static v8::Local<v8::Value> deserializeIDBValue(v8::Isolate* isolate, v8::Local<
v8::Object> creationContext, const IDBValue* value) | 329 static v8::Local<v8::Value> deserializeIDBValue(v8::Isolate* isolate, v8::Local<
v8::Object> creationContext, const IDBValue* value) |
332 { | 330 { |
333 ASSERT(isolate->InContext()); | 331 ASSERT(isolate->InContext()); |
334 if (!value || value->isNull()) | 332 if (!value || value->isNull()) |
335 return v8::Null(isolate); | 333 return v8::Null(isolate); |
336 | 334 |
337 v8::Local<v8::Value> v8Value = deserializeIDBValueData(isolate, value); | 335 v8::Local<v8::Value> v8Value = deserializeIDBValueData(isolate, value); |
338 if (value->primaryKey()) { | 336 if (value->primaryKey()) { |
339 v8::Local<v8::Value> key = toV8(value->primaryKey(), creationContext, is
olate); | 337 v8::Local<v8::Value> key = toV8(value->primaryKey(), creationContext, is
olate); |
340 if (key.IsEmpty()) | |
341 return v8::Local<v8::Value>(); | |
342 bool injected = injectV8KeyIntoV8Value(isolate, key, v8Value, value->key
Path()); | 338 bool injected = injectV8KeyIntoV8Value(isolate, key, v8Value, value->key
Path()); |
343 ASSERT_UNUSED(injected, injected); | 339 ASSERT_UNUSED(injected, injected); |
344 } | 340 } |
345 | 341 |
346 return v8Value; | 342 return v8Value; |
347 } | 343 } |
348 | 344 |
349 static v8::Local<v8::Value> deserializeIDBValueArray(v8::Isolate* isolate, v8::L
ocal<v8::Object> creationContext, const Vector<RefPtr<IDBValue>>* values) | 345 static v8::Local<v8::Value> deserializeIDBValueArray(v8::Isolate* isolate, v8::L
ocal<v8::Object> creationContext, const Vector<RefPtr<IDBValue>>* values) |
350 { | 346 { |
351 ASSERT(isolate->InContext()); | 347 ASSERT(isolate->InContext()); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 V8ServiceWorkerGlobalScope::installForeignFetch(scriptState, global)
; | 570 V8ServiceWorkerGlobalScope::installForeignFetch(scriptState, global)
; |
575 } | 571 } |
576 } | 572 } |
577 } | 573 } |
578 | 574 |
579 void registerInstallOriginTrialsForModules() | 575 void registerInstallOriginTrialsForModules() |
580 { | 576 { |
581 s_originalInstallOriginTrialsFunction = setInstallOriginTrialsFunction(&inst
allOriginTrialsForModules); | 577 s_originalInstallOriginTrialsFunction = setInstallOriginTrialsFunction(&inst
allOriginTrialsForModules); |
582 } | 578 } |
583 } // namespace blink | 579 } // namespace blink |
OLD | NEW |