| OLD | NEW |
| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 var poisoned = {caller: 0, callee: 0, arguments: 0} | 55 var poisoned = {caller: 0, callee: 0, arguments: 0} |
| 56 try { | 56 try { |
| 57 var x = o[name] | 57 var x = o[name] |
| 58 o[name] = undefined | 58 o[name] = undefined |
| 59 clear(x) | 59 clear(x) |
| 60 } catch(e) {} // assertTrue(name in poisoned) } | 60 } catch(e) {} // assertTrue(name in poisoned) } |
| 61 } | 61 } |
| 62 | 62 |
| 63 // Find intrinsics and null them out. | 63 // Find intrinsics and null them out. |
| 64 var globals = Object.getOwnPropertyNames(this) | 64 var globals = Object.getOwnPropertyNames(this) |
| 65 var whitelist = {Promise: true, TypeError: true} | 65 var whitelist = { |
| 66 Promise: true, |
| 67 TypeError: true, |
| 68 String: true, |
| 69 JSON: true, |
| 70 Error: true, |
| 71 MjsUnitAssertionError: true |
| 72 }; |
| 73 |
| 66 for (var i in globals) { | 74 for (var i in globals) { |
| 67 var name = globals[i] | 75 var name = globals[i] |
| 68 if (name in whitelist || name[0] === name[0].toLowerCase()) delete globals[i] | 76 if (name in whitelist || name[0] === name[0].toLowerCase()) delete globals[i] |
| 69 } | 77 } |
| 70 for (var i in globals) { | 78 for (var i in globals) { |
| 71 if (globals[i]) clearProp(this, globals[i]) | 79 if (globals[i]) clearProp(this, globals[i]) |
| 72 } | 80 } |
| 73 | 81 |
| 74 | 82 |
| 75 var asyncAssertsExpected = 0; | 83 var asyncAssertsExpected = 0; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 90 %EnqueueMicrotask(function() { | 98 %EnqueueMicrotask(function() { |
| 91 if (asyncAssertsExpected === 0) | 99 if (asyncAssertsExpected === 0) |
| 92 assertAsync(true, "all") | 100 assertAsync(true, "all") |
| 93 else if (iteration > 10) // Shouldn't take more. | 101 else if (iteration > 10) // Shouldn't take more. |
| 94 assertAsync(false, "all") | 102 assertAsync(false, "all") |
| 95 else | 103 else |
| 96 assertAsyncDone(iteration + 1) | 104 assertAsyncDone(iteration + 1) |
| 97 }); | 105 }); |
| 98 } | 106 } |
| 99 | 107 |
| 100 | |
| 101 (function() { | 108 (function() { |
| 102 assertThrows(function() { Promise(function() {}) }, TypeError) | 109 assertThrows(function() { Promise(function() {}) }, TypeError) |
| 103 })(); | 110 })(); |
| 104 | 111 |
| 105 (function() { | 112 (function() { |
| 106 assertTrue(new Promise(function() {}) instanceof Promise) | 113 assertTrue(new Promise(function() {}) instanceof Promise) |
| 107 })(); | 114 })(); |
| 108 | 115 |
| 109 (function() { | 116 (function() { |
| 110 assertThrows(function() { new Promise(5) }, TypeError) | 117 assertThrows(function() { new Promise(5) }, TypeError) |
| (...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 Promise.all([11, Promise.accept(12), 13, MyPromise.accept(14), 15, 16]) | 1030 Promise.all([11, Promise.accept(12), 13, MyPromise.accept(14), 15, 16]) |
| 1024 assertTrue(log === "nx14n", "subclass/all/arg") | 1031 assertTrue(log === "nx14n", "subclass/all/arg") |
| 1025 | 1032 |
| 1026 log = "" | 1033 log = "" |
| 1027 MyPromise.all([21, Promise.accept(22), 23, MyPromise.accept(24), 25, 26]) | 1034 MyPromise.all([21, Promise.accept(22), 23, MyPromise.accept(24), 25, 26]) |
| 1028 assertTrue(log === "nx24nnx21nnx23nnnx25nnx26n", "subclass/all/self") | 1035 assertTrue(log === "nx24nnx21nnx23nnnx25nnx26n", "subclass/all/self") |
| 1029 })(); | 1036 })(); |
| 1030 | 1037 |
| 1031 | 1038 |
| 1032 assertAsyncDone() | 1039 assertAsyncDone() |
| OLD | NEW |