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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 LocalContext context(CcTest::isolate()); | 680 LocalContext context(CcTest::isolate()); |
681 CompileRun("var obj = {};" | 681 CompileRun("var obj = {};" |
682 "var records = null;" | 682 "var records = null;" |
683 "var observer = function(r) { records = r };" | 683 "var observer = function(r) { records = r };" |
684 "Object.observe(obj, observer);"); | 684 "Object.observe(obj, observer);"); |
685 Local<Value> obj = | 685 Local<Value> obj = |
686 context->Global() | 686 context->Global() |
687 ->Get(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj")) | 687 ->Get(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj")) |
688 .ToLocalChecked(); | 688 .ToLocalChecked(); |
689 Local<Object>::Cast(obj) | 689 Local<Object>::Cast(obj) |
690 ->SetHiddenValue(v8_str("foo"), Null(CcTest::isolate())); | 690 ->SetPrivate(v8::Isolate::GetCurrent()->GetCurrentContext(), |
| 691 v8::Private::New(CcTest::isolate(), v8_str("foo")), |
| 692 Null(CcTest::isolate())) |
| 693 .FromJust(); |
691 CompileRun(""); // trigger delivery | 694 CompileRun(""); // trigger delivery |
692 CHECK(CompileRun("records")->IsNull()); | 695 CHECK(CompileRun("records")->IsNull()); |
693 } | 696 } |
694 | 697 |
695 | 698 |
696 TEST(GetNotifierFromOtherContext) { | 699 TEST(GetNotifierFromOtherContext) { |
697 HandleScope scope(CcTest::isolate()); | 700 HandleScope scope(CcTest::isolate()); |
698 LocalContext context(CcTest::isolate()); | 701 LocalContext context(CcTest::isolate()); |
699 CompileRun("var obj = {};"); | 702 CompileRun("var obj = {};"); |
700 Local<Value> instance = CompileRun("obj"); | 703 Local<Value> instance = CompileRun("obj"); |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 v8::Isolate::GetCurrent()->GetCurrentContext()) | 1030 v8::Isolate::GetCurrent()->GetCurrentContext()) |
1028 .ToLocalChecked(); | 1031 .ToLocalChecked(); |
1029 env->Global() | 1032 env->Global() |
1030 ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"), | 1033 ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"), |
1031 new_instance) | 1034 new_instance) |
1032 .FromJust(); | 1035 .FromJust(); |
1033 v8::TryCatch try_catch(isolate); | 1036 v8::TryCatch try_catch(isolate); |
1034 CompileRun("Object.getNotifier(obj)"); | 1037 CompileRun("Object.getNotifier(obj)"); |
1035 CHECK(try_catch.HasCaught()); | 1038 CHECK(try_catch.HasCaught()); |
1036 } | 1039 } |
OLD | NEW |