| Index: test/webkit/fast/js/Promise-resolve-chain.js
|
| diff --git a/test/webkit/exception-try-finally-scope-error.js b/test/webkit/fast/js/Promise-resolve-chain.js
|
| similarity index 57%
|
| copy from test/webkit/exception-try-finally-scope-error.js
|
| copy to test/webkit/fast/js/Promise-resolve-chain.js
|
| index cfb2b92b5659d6f75b5092274dc7d2b5e8a3261a..558bf53eebf731f18880ea3ee0aa88619b7012ee 100644
|
| --- a/test/webkit/exception-try-finally-scope-error.js
|
| +++ b/test/webkit/fast/js/Promise-resolve-chain.js
|
| @@ -1,4 +1,4 @@
|
| -// Copyright 2013 the V8 project authors. All rights reserved.
|
| +// Copyright 2014 the V8 project authors. All rights reserved.
|
| // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
|
| //
|
| // Redistribution and use in source and binary forms, with or without
|
| @@ -21,39 +21,40 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -description('This test makes sure stack unwinding works correctly in combination with dynamically added scopes');
|
| -
|
| -function gc()
|
| -{
|
| - if (this.GCController)
|
| - GCController.collect();
|
| - else
|
| - for (var i = 0; i < 10000; ++i) // Allocate a sufficient number of objects to force a GC.
|
| - ({});
|
| -}
|
| +// Flags: --harmony
|
| +'use strict';
|
| +description('Test chained Promise resolutions.');
|
|
|
| +var resolve1, resolve2, resolve3;
|
| +var reject4, resolve5, resolve6;
|
| var result;
|
| -function runTest() {
|
| - var test = "outer scope";
|
| - with({test:"inner scope"})
|
| - (function () { try { throw ""; } finally { result = test; shouldBe("result", '"inner scope"'); return;}})()
|
| -}
|
| -runTest();
|
| +var promise1 = new Promise(function(r) { resolve1 = r; });
|
| +var promise2 = new Promise(function(r) { resolve2 = r; });
|
| +var promise3 = new Promise(function(r) { resolve3 = r; });
|
| +var promise4 = new Promise(function(_, r) { reject4 = r; });
|
| +var promise5 = new Promise(function(r) { resolve5 = r; });
|
| +var promise6 = new Promise(function(r) { resolve6 = r; });
|
| +
|
| +resolve3(promise2);
|
| +resolve2(promise1);
|
| +resolve6(promise5);
|
| +resolve5(promise4);
|
|
|
| -try{
|
| -(function() {
|
| - try {
|
| - throw "";
|
| - } catch(y) {
|
| - throw (function(){});
|
| - } finally {
|
| - }
|
| -})()
|
| -}catch(r){
|
| -}
|
| +promise3.then(function(localResult) {
|
| + result = localResult;
|
| + shouldBeEqualToString('result', 'hello');
|
| +}, function() {
|
| + testFailed('rejected');
|
| +});
|
|
|
| -// Just clobber any temporaries
|
| -a=({});
|
| -a*=a*a*a;
|
| +promise6.then(function() {
|
| + testFailed('fulfilled');
|
| + finishJSTest();
|
| +}, function(localResult) {
|
| + result = localResult;
|
| + shouldBeEqualToString('result', 'bye');
|
| + finishJSTest();
|
| +});
|
|
|
| -gc();
|
| +resolve1('hello');
|
| +reject4('bye');
|
|
|