Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / script-tests / with-scope-gc.js
bloba661de8e09613a6eba452f8c32e16a38afdf725a
1 description(
2 'Tests to make sure that dynamic scope objects are correctly protected from GC. To pass we need to not crash.'
3 );
5 function gc()
7 if (this.GCController)
8 GCController.collectAll();
9 else
10 for (var i = 0; i < 10000; ++i) // Allocate a sufficient number of objects to force a GC.
11 ({});
14 (function() {
15 try {
16 // Immediate value for scope
17 with(1) { gc(); a; }
18 } catch(e) {
20 })();
22 (function() {
23 try {
24 // Real object for scope
25 var local;
26 with (local = {}) {
27 z=null;
28 {}; {}; [1,2,3,4*{}]; // Clobber any temporaries the scope may exist in
29 gc();
32 } catch (e) {
34 })();
36 (function() {
37 try {
38 // Test catch blocks for the heck of it
39 try {
40 throw 1;
41 } catch(e) {
42 gc();
45 } catch (e) {
47 })();