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 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 } | 685 } |
686 | 686 |
687 | 687 |
688 TEST(DontLeakContextOnNotifierPerformChange) { | 688 TEST(DontLeakContextOnNotifierPerformChange) { |
689 HandleScope scope(CcTest::isolate()); | 689 HandleScope scope(CcTest::isolate()); |
690 Handle<Value> foo = String::NewFromUtf8(CcTest::isolate(), "foo"); | 690 Handle<Value> foo = String::NewFromUtf8(CcTest::isolate(), "foo"); |
691 LocalContext context(CcTest::isolate()); | 691 LocalContext context(CcTest::isolate()); |
692 context->SetSecurityToken(foo); | 692 context->SetSecurityToken(foo); |
693 CompileRun("var obj = {};"); | 693 CompileRun("var obj = {};"); |
694 Handle<Value> object = CompileRun("obj"); | 694 Handle<Value> object = CompileRun("obj"); |
| 695 Handle<Value> notifier = CompileRun("Object.getNotifier(obj)"); |
695 { | 696 { |
696 HandleScope scope(CcTest::isolate()); | 697 HandleScope scope(CcTest::isolate()); |
697 LocalContext context2(CcTest::isolate()); | 698 LocalContext context2(CcTest::isolate()); |
698 context2->SetSecurityToken(foo); | 699 context2->SetSecurityToken(foo); |
699 context2->Global()->Set(String::NewFromUtf8(CcTest::isolate(), "obj"), | 700 context2->Global()->Set(String::NewFromUtf8(CcTest::isolate(), "obj"), |
700 object); | 701 object); |
701 CompileRun("var n = Object.getNotifier(obj);" | 702 context2->Global()->Set(String::NewFromUtf8(CcTest::isolate(), "notifier"), |
702 "n.performChange('foo', function() {});"); | 703 notifier); |
| 704 CompileRun("var obj2 = {};" |
| 705 "var notifier2 = Object.getNotifier(obj2);" |
| 706 "notifier2.performChange.call(" |
| 707 "notifier, 'foo', function(){})"); |
703 } | 708 } |
704 | 709 |
705 v8::V8::ContextDisposedNotification(); | 710 v8::V8::ContextDisposedNotification(); |
706 CheckSurvivingGlobalObjectsCount(1); | 711 CheckSurvivingGlobalObjectsCount(1); |
707 } | 712 } |
OLD | NEW |