Index: third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp |
diff --git a/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp b/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp |
index f2a8be4e39a38c7f30aafb55075aec6c9dd5f064..a8ef6189e2196ee21dc12aa38420120d348559fc 100644 |
--- a/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp |
+++ b/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModules.cpp |
@@ -57,10 +57,6 @@ namespace blink { |
static v8::Local<v8::Value> deserializeIDBValueData(v8::Isolate*, |
const IDBValue*); |
-static v8::Local<v8::Value> deserializeIDBValue( |
- v8::Isolate*, |
- v8::Local<v8::Object> creationContext, |
- const IDBValue*); |
static v8::Local<v8::Value> deserializeIDBValueArray( |
v8::Isolate*, |
v8::Local<v8::Object> creationContext, |
@@ -394,16 +390,21 @@ static v8::Local<v8::Value> deserializeIDBValueData(v8::Isolate* isolate, |
} |
// Deserialize the entire IDBValue (injecting key & keypath if present). |
-static v8::Local<v8::Value> deserializeIDBValue( |
- v8::Isolate* isolate, |
- v8::Local<v8::Object> creationContext, |
- const IDBValue* value) { |
+v8::Local<v8::Value> deserializeIDBValue(v8::Isolate* isolate, |
+ v8::Local<v8::Object> creationContext, |
+ const IDBValue* value) { |
ASSERT(isolate->InContext()); |
if (!value || value->isNull()) |
return v8::Null(isolate); |
v8::Local<v8::Value> v8Value = deserializeIDBValueData(isolate, value); |
- if (value->primaryKey()) { |
+ |
+ // De-serialization failures are currently handled by returning null. This is |
+ // sub-optimal, as it can cause IndexedDB to return incorrect data. The check |
jsbell
2017/04/03 19:31:52
Maybe note that null is a perfectly valid IDB valu
pwnall
2017/04/04 00:55:12
Done.
|
+ // below is the minimal work needed to avoid a crash. A proper solution would |
jsbell
2017/04/03 19:31:52
Since this comment tracks future work, rephrase as
pwnall
2017/04/04 00:55:12
I used the crbug targeted by this CL, because the
|
+ // require SerializedScriptValue to throw rather than returning null when it |
jsbell
2017/04/03 19:31:52
Return an empty handle?
I wouldn't expect SSV API
pwnall
2017/04/04 00:55:12
Done.
I switched to your suggestion of suggesting
|
+ // encounters errors. |
+ if (value->primaryKey() && !v8Value->IsNull()) { |
jsbell
2017/04/03 19:31:52
I wonder if we want to have more comments/DCHECKs
pwnall
2017/04/04 00:55:12
I think that there is a check at a higher level --
|
v8::Local<v8::Value> key = |
ToV8(value->primaryKey(), creationContext, isolate); |
if (key.IsEmpty()) |