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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 CompileRun( | 387 CompileRun( |
388 "var records;" | 388 "var records;" |
389 "function observer(r) { records = r; };" | 389 "function observer(r) { records = r; };" |
390 "Object.observe(obj, observer);" | 390 "Object.observe(obj, observer);" |
391 "obj.foo = 41;" // triggers a notification | 391 "obj.foo = 41;" // triggers a notification |
392 "proto.foo = 42;"); // does not trigger a notification | 392 "proto.foo = 42;"); // does not trigger a notification |
393 const RecordExpectation expected_records[] = { | 393 const RecordExpectation expected_records[] = { |
394 { obj, "updated", "foo", Number::New(75) } | 394 { obj, "updated", "foo", Number::New(75) } |
395 }; | 395 }; |
396 EXPECT_RECORDS(CompileRun("records"), expected_records); | 396 EXPECT_RECORDS(CompileRun("records"), expected_records); |
397 obj->SetPrototype(Null()); | 397 obj->SetPrototype(Null(isolate.GetIsolate())); |
398 CompileRun("obj.foo = 43"); | 398 CompileRun("obj.foo = 43"); |
399 const RecordExpectation expected_records2[] = { | 399 const RecordExpectation expected_records2[] = { |
400 { obj, "new", "foo", Handle<Value>() } | 400 { obj, "new", "foo", Handle<Value>() } |
401 }; | 401 }; |
402 EXPECT_RECORDS(CompileRun("records"), expected_records2); | 402 EXPECT_RECORDS(CompileRun("records"), expected_records2); |
403 obj->SetPrototype(proto); | 403 obj->SetPrototype(proto); |
404 CompileRun( | 404 CompileRun( |
405 "Object.observe(proto, observer);" | 405 "Object.observe(proto, observer);" |
406 "proto.bar = 1;" | 406 "proto.bar = 1;" |
407 "Object.unobserve(obj, observer);" | 407 "Object.unobserve(obj, observer);" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 instance->Set(String::New("foo"), String::New("bar")); | 716 instance->Set(String::New("foo"), String::New("bar")); |
717 CompileRun(""); // trigger delivery | 717 CompileRun(""); // trigger delivery |
718 const RecordExpectation expected_records2[] = { | 718 const RecordExpectation expected_records2[] = { |
719 { instance, "new", "5", Handle<Value>() }, | 719 { instance, "new", "5", Handle<Value>() }, |
720 { instance, "new", "foo", Handle<Value>() } | 720 { instance, "new", "foo", Handle<Value>() } |
721 }; | 721 }; |
722 EXPECT_RECORDS(CompileRun("records2"), expected_records2); | 722 EXPECT_RECORDS(CompileRun("records2"), expected_records2); |
723 } | 723 } |
724 CHECK(CompileRun("records")->IsNull()); | 724 CHECK(CompileRun("records")->IsNull()); |
725 } | 725 } |
OLD | NEW |