OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 obj->Set(String::NewFromUtf8(v8_isolate, "foo"), | 321 obj->Set(String::NewFromUtf8(v8_isolate, "foo"), |
322 Number::New(v8_isolate, 7)); | 322 Number::New(v8_isolate, 7)); |
323 obj->Set(1, Number::New(v8_isolate, 2)); | 323 obj->Set(1, Number::New(v8_isolate, 2)); |
324 // ForceSet should work just as well as Set | 324 // ForceSet should work just as well as Set |
325 obj->ForceSet(String::NewFromUtf8(v8_isolate, "foo"), | 325 obj->ForceSet(String::NewFromUtf8(v8_isolate, "foo"), |
326 Number::New(v8_isolate, 3)); | 326 Number::New(v8_isolate, 3)); |
327 obj->ForceSet(Number::New(v8_isolate, 1), Number::New(v8_isolate, 4)); | 327 obj->ForceSet(Number::New(v8_isolate, 1), Number::New(v8_isolate, 4)); |
328 // Setting an indexed element via the property setting method | 328 // Setting an indexed element via the property setting method |
329 obj->Set(Number::New(v8_isolate, 1), Number::New(v8_isolate, 5)); | 329 obj->Set(Number::New(v8_isolate, 1), Number::New(v8_isolate, 5)); |
330 // Setting with a non-String, non-uint32 key | 330 // Setting with a non-String, non-uint32 key |
331 obj->ForceSet(Number::New(v8_isolate, 1.1), Number::New(v8_isolate, 6), | 331 obj->Set(Number::New(v8_isolate, 1.1), Number::New(v8_isolate, 6)); |
332 DontDelete); | |
333 obj->Delete(String::NewFromUtf8(v8_isolate, "foo")); | 332 obj->Delete(String::NewFromUtf8(v8_isolate, "foo")); |
334 obj->Delete(1); | 333 obj->Delete(1); |
335 obj->ForceDelete(Number::New(v8_isolate, 1.1)); | 334 obj->Delete(Number::New(v8_isolate, 1.1)); |
336 | 335 |
337 // Force delivery | 336 // Force delivery |
338 // TODO(adamk): Should the above set methods trigger delivery themselves? | 337 // TODO(adamk): Should the above set methods trigger delivery themselves? |
339 CompileRun("void 0"); | 338 CompileRun("void 0"); |
340 CHECK_EQ(9, CompileRun("records.length")->Int32Value()); | 339 CHECK_EQ(9, CompileRun("records.length")->Int32Value()); |
341 const RecordExpectation expected_records[] = { | 340 const RecordExpectation expected_records[] = { |
342 { obj, "add", "foo", Handle<Value>() }, | 341 { obj, "add", "foo", Handle<Value>() }, |
343 { obj, "add", "1", Handle<Value>() }, | 342 { obj, "add", "1", Handle<Value>() }, |
344 // Note: use 7 not 1 below, as the latter triggers a nifty VS10 compiler bug | 343 // Note: use 7 not 1 below, as the latter triggers a nifty VS10 compiler bug |
345 // where instead of 1.0, a garbage value would be passed into Number::New. | 344 // where instead of 1.0, a garbage value would be passed into Number::New. |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 &AccessorSetter); | 827 &AccessorSetter); |
829 context->Global()->Set(String::NewFromUtf8(isolate, "obj"), object); | 828 context->Global()->Set(String::NewFromUtf8(isolate, "obj"), object); |
830 CompileRun( | 829 CompileRun( |
831 "var records = null;" | 830 "var records = null;" |
832 "Object.observe(obj, function(r) { records = r });" | 831 "Object.observe(obj, function(r) { records = r });" |
833 "obj.accessor = 43;"); | 832 "obj.accessor = 43;"); |
834 CHECK(CompileRun("records")->IsNull()); | 833 CHECK(CompileRun("records")->IsNull()); |
835 CompileRun("Object.defineProperty(obj, 'accessor', { value: 44 });"); | 834 CompileRun("Object.defineProperty(obj, 'accessor', { value: 44 });"); |
836 CHECK(CompileRun("records")->IsNull()); | 835 CHECK(CompileRun("records")->IsNull()); |
837 } | 836 } |
OLD | NEW |