Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: test/mjsunit/es6/promises.js

Issue 1536013002: [promise] make Promise.resolve match spec (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Re-add mjsunit/es6/promises.js fixups Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/js/promise.js ('k') | test/test262/test262.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 29 matching lines...) Expand all
40 assertEquals("[object Promise]", 40 assertEquals("[object Promise]",
41 Object.prototype.toString.call(new Promise(function() {}))); 41 Object.prototype.toString.call(new Promise(function() {})));
42 })(); 42 })();
43 43
44 44
45 function clear(o) { 45 function clear(o) {
46 if (o === null || (typeof o !== 'object' && typeof o !== 'function')) return 46 if (o === null || (typeof o !== 'object' && typeof o !== 'function')) return
47 clear(o.__proto__) 47 clear(o.__proto__)
48 var properties = getOwnPropertyNames(o) 48 var properties = getOwnPropertyNames(o)
49 for (var i in properties) { 49 for (var i in properties) {
50 // Do not clobber Object.prototype.toString, which is used by tests.
51 if (properties[i] === "toString") continue;
50 clearProp(o, properties[i]) 52 clearProp(o, properties[i])
51 } 53 }
52 } 54 }
53 55
54 function clearProp(o, name) { 56 function clearProp(o, name) {
55 var poisoned = {caller: 0, callee: 0, arguments: 0} 57 var poisoned = {caller: 0, callee: 0, arguments: 0}
56 try { 58 try {
57 var x = o[name] 59 var x = o[name]
58 o[name] = undefined 60 o[name] = undefined
59 clear(x) 61 clear(x)
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 d6.resolve(6) 1045 d6.resolve(6)
1044 assertTrue(log === "dncncnx6", "subclass/chain") 1046 assertTrue(log === "dncncnx6", "subclass/chain")
1045 1047
1046 log = "" 1048 log = ""
1047 Promise.all([11, Promise.accept(12), 13, MyPromise.accept(14), 15, 16]) 1049 Promise.all([11, Promise.accept(12), 13, MyPromise.accept(14), 15, 16])
1048 1050
1049 assertTrue(log === "nx14", "subclass/all/arg") 1051 assertTrue(log === "nx14", "subclass/all/arg")
1050 1052
1051 log = "" 1053 log = ""
1052 MyPromise.all([21, Promise.accept(22), 23, MyPromise.accept(24), 25, 26]) 1054 MyPromise.all([21, Promise.accept(22), 23, MyPromise.accept(24), 25, 26])
1053 assertTrue(log === "nx24nnx21nnnnx23nnnx25nnx26n", "subclass/all/self") 1055 assertTrue(log === "nx24nnx21nnx[object Promise]nnx23nnnx25nnx26n",
1056 "subclass/all/self")
1054 })(); 1057 })();
1055 1058
1056 (function() { 1059 (function() {
1057 'use strict'; 1060 'use strict';
1058 1061
1059 class Pact extends Promise { } 1062 class Pact extends Promise { }
1060 class Vow extends Pact { } 1063 class Vow extends Pact { }
1061 class Oath extends Vow { } 1064 class Oath extends Vow { }
1062 1065
1063 Oath.constructor = Vow; 1066 Oath.constructor = Vow;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 var p = Promise.resolve(); 1108 var p = Promise.resolve();
1106 var callCount = 0; 1109 var callCount = 0;
1107 defineProperty(p, "constructor", { 1110 defineProperty(p, "constructor", {
1108 get: function() { ++callCount; return Promise; } 1111 get: function() { ++callCount; return Promise; }
1109 }); 1112 });
1110 p.then(); 1113 p.then();
1111 assertEquals(1, callCount); 1114 assertEquals(1, callCount);
1112 })(); 1115 })();
1113 1116
1114 assertAsyncDone() 1117 assertAsyncDone()
OLDNEW
« no previous file with comments | « src/js/promise.js ('k') | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698