| 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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 } else { | 485 } else { |
| 486 value = v8::Object::New(isolate); | 486 value = v8::Object::New(isolate); |
| 487 if (!v8CallBoolean(object->CreateDataProperty(context, property, value))) | 487 if (!v8CallBoolean(object->CreateDataProperty(context, property, value))) |
| 488 return false; | 488 return false; |
| 489 } | 489 } |
| 490 } | 490 } |
| 491 | 491 |
| 492 // Implicit properties don't need to be set. The caller is not required to | 492 // Implicit properties don't need to be set. The caller is not required to |
| 493 // be aware of this, so this is an expected no-op. The caller can verify | 493 // be aware of this, so this is an expected no-op. The caller can verify |
| 494 // that the value is correct via assertPrimaryKeyValidOrInjectable. | 494 // that the value is correct via assertPrimaryKeyValidOrInjectable. |
| 495 if (isImplicitProperty(isolate, value, keyPathElements.last())) | 495 if (isImplicitProperty(isolate, value, keyPathElements.back())) |
| 496 return true; | 496 return true; |
| 497 | 497 |
| 498 // If it's not an implicit property of value, value must be an object. | 498 // If it's not an implicit property of value, value must be an object. |
| 499 v8::Local<v8::Object> object = value.As<v8::Object>(); | 499 v8::Local<v8::Object> object = value.As<v8::Object>(); |
| 500 v8::Local<v8::String> property = v8String(isolate, keyPathElements.last()); | 500 v8::Local<v8::String> property = v8String(isolate, keyPathElements.back()); |
| 501 if (!v8CallBoolean(object->CreateDataProperty(context, property, key))) | 501 if (!v8CallBoolean(object->CreateDataProperty(context, property, key))) |
| 502 return false; | 502 return false; |
| 503 | 503 |
| 504 return true; | 504 return true; |
| 505 } | 505 } |
| 506 | 506 |
| 507 // Verify that an value can have an generated key inserted at the location | 507 // Verify that an value can have an generated key inserted at the location |
| 508 // specified by the key path (by injectV8KeyIntoV8Value) when the object is | 508 // specified by the key path (by injectV8KeyIntoV8Value) when the object is |
| 509 // later deserialized. | 509 // later deserialized. |
| 510 bool canInjectIDBKeyIntoScriptValue(v8::Isolate* isolate, | 510 bool canInjectIDBKeyIntoScriptValue(v8::Isolate* isolate, |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 if (expectedKey && expectedKey->isEqual(value->primaryKey())) | 617 if (expectedKey && expectedKey->isEqual(value->primaryKey())) |
| 618 return; | 618 return; |
| 619 | 619 |
| 620 bool injected = injectV8KeyIntoV8Value( | 620 bool injected = injectV8KeyIntoV8Value( |
| 621 isolate, keyValue.v8Value(), scriptValue.v8Value(), value->keyPath()); | 621 isolate, keyValue.v8Value(), scriptValue.v8Value(), value->keyPath()); |
| 622 DCHECK(injected); | 622 DCHECK(injected); |
| 623 } | 623 } |
| 624 #endif | 624 #endif |
| 625 | 625 |
| 626 } // namespace blink | 626 } // namespace blink |
| OLD | NEW |