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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 // Deserialize the entire IDBValue (injecting key & keypath if present). | 370 // Deserialize the entire IDBValue (injecting key & keypath if present). |
373 static v8::Local<v8::Value> deserializeIDBValue(v8::Isolate* isolate, v8::Local<
v8::Object> creationContext, const IDBValue* value) | 371 static v8::Local<v8::Value> deserializeIDBValue(v8::Isolate* isolate, v8::Local<
v8::Object> creationContext, const IDBValue* value) |
374 { | 372 { |
375 ASSERT(isolate->InContext()); | 373 ASSERT(isolate->InContext()); |
376 if (!value || value->isNull()) | 374 if (!value || value->isNull()) |
377 return v8::Null(isolate); | 375 return v8::Null(isolate); |
378 | 376 |
379 v8::Local<v8::Value> v8Value = deserializeIDBValueData(isolate, value); | 377 v8::Local<v8::Value> v8Value = deserializeIDBValueData(isolate, value); |
380 if (value->primaryKey()) { | 378 if (value->primaryKey()) { |
381 v8::Local<v8::Value> key = toV8(value->primaryKey(), creationContext, is
olate); | 379 v8::Local<v8::Value> key = toV8(value->primaryKey(), creationContext, is
olate); |
382 if (key.IsEmpty()) | |
383 return v8::Local<v8::Value>(); | |
384 bool injected = injectV8KeyIntoV8Value(isolate, key, v8Value, value->key
Path()); | 380 bool injected = injectV8KeyIntoV8Value(isolate, key, v8Value, value->key
Path()); |
385 ASSERT_UNUSED(injected, injected); | 381 ASSERT_UNUSED(injected, injected); |
386 } | 382 } |
387 | 383 |
388 return v8Value; | 384 return v8Value; |
389 } | 385 } |
390 | 386 |
391 static v8::Local<v8::Value> deserializeIDBValueArray(v8::Isolate* isolate, v8::L
ocal<v8::Object> creationContext, const Vector<RefPtr<IDBValue>>* values) | 387 static v8::Local<v8::Value> deserializeIDBValueArray(v8::Isolate* isolate, v8::L
ocal<v8::Object> creationContext, const Vector<RefPtr<IDBValue>>* values) |
392 { | 388 { |
393 ASSERT(isolate->InContext()); | 389 ASSERT(isolate->InContext()); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 V8ServiceWorkerGlobalScope::installForeignFetch(scriptState, global)
; | 612 V8ServiceWorkerGlobalScope::installForeignFetch(scriptState, global)
; |
617 } | 613 } |
618 } | 614 } |
619 } | 615 } |
620 | 616 |
621 void registerInstallOriginTrialsForModules() | 617 void registerInstallOriginTrialsForModules() |
622 { | 618 { |
623 s_originalInstallOriginTrialsFunction = setInstallOriginTrialsFunction(&inst
allOriginTrialsForModules); | 619 s_originalInstallOriginTrialsFunction = setInstallOriginTrialsFunction(&inst
allOriginTrialsForModules); |
624 } | 620 } |
625 } // namespace blink | 621 } // namespace blink |
OLD | NEW |