Reviewers: rossberg,
Description:
Remove unnecessary coupling between Promise tests and Object.observe
Many mjsunit tests (as well as the promises-aplus adapter scripts) were
using Object.observe simply for microtask-enqueueing purposes. Replaced
such uses with either Promise.resolve().then() or %EnqueueMicrotask.
Please review this at https://codereview.chromium.org/1246933002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+18, -75 lines):
M test/mjsunit/es6/debug-promises/events.js
M test/mjsunit/es6/debug-promises/reject-caught-all.js
M
test/mjsunit/es6/debug-promises/reject-caught-by-default-reject-handler.js
M test/mjsunit/es6/debug-promises/reject-uncaught-all.js
M test/mjsunit/es6/debug-promises/reject-uncaught-late.js
M test/mjsunit/es6/debug-promises/reject-uncaught-uncaught.js
M test/mjsunit/es6/debug-promises/reject-with-invalid-reject.js
M test/mjsunit/es6/debug-promises/reject-with-throw-in-reject.js
M test/mjsunit/es6/debug-promises/reject-with-undefined-reject.js
M test/mjsunit/es6/debug-promises/throw-caught-all.js
M
test/mjsunit/es6/debug-promises/throw-caught-by-default-reject-handler.js
M test/mjsunit/es6/debug-promises/throw-uncaught-all.js
M test/mjsunit/es6/debug-promises/throw-uncaught-uncaught.js
M test/mjsunit/es6/debug-promises/throw-with-throw-in-reject.js
M test/mjsunit/es6/debug-promises/throw-with-undefined-reject.js
M test/mjsunit/es6/promises.js
M test/promises-aplus/lib/global.js
M test/promises-aplus/lib/mocha.js
Index: test/mjsunit/es6/debug-promises/events.js
diff --git a/test/mjsunit/es6/debug-promises/events.js
b/test/mjsunit/es6/debug-promises/events.js
index
a9f94543f40594450e5ec02d9317a0e605b48f23..3fcb22ff2740985d2a22c79e7c3334a184007c60
100644
--- a/test/mjsunit/es6/debug-promises/events.js
+++ b/test/mjsunit/es6/debug-promises/events.js
@@ -116,9 +116,7 @@ function testDone(iteration) {
}
var iteration = iteration || 0;
- var dummy = {};
- Object.observe(dummy, checkResult);
- dummy.dummy = dummy;
+ %EnqueueMicrotask(checkResult);
}
testDone();
Index: test/mjsunit/es6/debug-promises/reject-caught-all.js
diff --git a/test/mjsunit/es6/debug-promises/reject-caught-all.js
b/test/mjsunit/es6/debug-promises/reject-caught-all.js
index
0fca57730a1430be493d7964cda0c1c18b93fb45..2cee8b9412a1199abaeb0edf06f7b5d1f048088c
100644
--- a/test/mjsunit/es6/debug-promises/reject-caught-all.js
+++ b/test/mjsunit/es6/debug-promises/reject-caught-all.js
@@ -63,10 +63,7 @@ function testDone(iteration) {
}
}
- // Run testDone through the Object.observe processing loop.
- var dummy = {};
- Object.observe(dummy, checkResult);
- dummy.dummy = dummy;
+ Promise.resolve().then(checkResult);
}
testDone(0);
Index:
test/mjsunit/es6/debug-promises/reject-caught-by-default-reject-handler.js
diff --git
a/test/mjsunit/es6/debug-promises/reject-caught-by-default-reject-handler.js
b/test/mjsunit/es6/debug-promises/reject-caught-by-default-reject-handler.js
index
63151df016c9bdaec3e43c145a3ba10f4433b110..2630f6d740d195a83a90cc190f8573a0f60cc101
100644
---
a/test/mjsunit/es6/debug-promises/reject-caught-by-default-reject-handler.js
+++
b/test/mjsunit/es6/debug-promises/reject-caught-by-default-reject-handler.js
@@ -77,10 +77,7 @@ function testDone(iteration) {
}
}
- // Run testDone through the Object.observe processing loop.
- var dummy = {};
- Object.observe(dummy, checkResult);
- dummy.dummy = dummy;
+ Promise.resolve().then(checkResult);
}
testDone(0);
Index: test/mjsunit/es6/debug-promises/reject-uncaught-all.js
diff --git a/test/mjsunit/es6/debug-promises/reject-uncaught-all.js
b/test/mjsunit/es6/debug-promises/reject-uncaught-all.js
index
beaf1878fef9943721a3659be876bd5e06bebad3..e1144e82276528781426ffcd4f4c79cd1c6f7d6a
100644
--- a/test/mjsunit/es6/debug-promises/reject-uncaught-all.js
+++ b/test/mjsunit/es6/debug-promises/reject-uncaught-all.js
@@ -60,10 +60,7 @@ function testDone(iteration) {
}
}
- // Run testDone through the Object.observe processing loop.
- var dummy = {};
- Object.observe(dummy, checkResult);
- dummy.dummy = dummy;
+ Promise.resolve().then(checkResult);
}
testDone(0);
Index: test/mjsunit/es6/debug-promises/reject-uncaught-late.js
diff --git a/test/mjsunit/es6/debug-promises/reject-uncaught-late.js
b/test/mjsunit/es6/debug-promises/reject-uncaught-late.js
index
4a883da13a793972d00fd2f4a9f8311b15b04811..7e10be901f9bf2925a3814303a67ec8142537706
100644
--- a/test/mjsunit/es6/debug-promises/reject-uncaught-late.js
+++ b/test/mjsunit/es6/debug-promises/reject-uncaught-late.js
@@ -67,10 +67,7 @@ function testDone(iteration) {
}
}
- // Run testDone through the Object.observe processing loop.
- var dummy = {};
- Object.observe(dummy, checkResult);
- dummy.dummy = dummy;
+ Promise.resolve().then(checkResult);
}
testDone(0);
Index: test/mjsunit/es6/debug-promises/reject-uncaught-uncaught.js
diff --git a/test/mjsunit/es6/debug-promises/reject-uncaught-uncaught.js
b/test/mjsunit/es6/debug-promises/reject-uncaught-uncaught.js
index
86e2a815e7257360e1995b50b6e39d9da8d583c4..ad19498b2855f92fde50df54e33d5242bee6d8e3
100644
--- a/test/mjsunit/es6/debug-promises/reject-uncaught-uncaught.js
+++ b/test/mjsunit/es6/debug-promises/reject-uncaught-uncaught.js
@@ -60,10 +60,7 @@ function testDone(iteration) {
}
}
- // Run testDone through the Object.observe processing loop.
- var dummy = {};
- Object.observe(dummy, checkResult);
- dummy.dummy = dummy;
+ Promise.resolve().then(checkResult);
}
testDone(0);
Index: test/mjsunit/es6/debug-promises/reject-with-invalid-reject.js
diff --git a/test/mjsunit/es6/debug-promises/reject-with-invalid-reject.js
b/test/mjsunit/es6/debug-promises/reject-with-invalid-reject.js
index
fc6233da8d15e99a72de26147251df207289200b..1d2a8fe61110a7314d92c7f8e0808a96287e78fc
100644
--- a/test/mjsunit/es6/debug-promises/reject-with-invalid-reject.js
+++ b/test/mjsunit/es6/debug-promises/reject-with-invalid-reject.js
@@ -66,10 +66,7 @@ function testDone(iteration) {
}
}
- // Run testDone through the Object.observe processing loop.
- var dummy = {};
- Object.observe(dummy, checkResult);
- dummy.dummy = dummy;
+ Promise.resolve().then(checkResult);
}
testDone(0);
Index: test/mjsunit/es6/debug-promises/reject-with-throw-in-reject.js
diff --git a/test/mjsunit/es6/debug-promises/reject-with-throw-in-reject.js
b/test/mjsunit/es6/debug-promises/reject-with-throw-in-reject.js
index
15e464ec6016b7199da3308b1cea8136c4329eba..a1b65e476ea0663cec08f8151918733ef3d02d4d
100644
--- a/test/mjsunit/es6/debug-promises/reject-with-throw-in-reject.js
+++ b/test/mjsunit/es6/debug-promises/reject-with-throw-in-reject.js
@@ -78,10 +78,7 @@ function testDone(iteration) {
}
}
- // Run testDone through the Object.observe processing loop.
- var dummy = {};
- Object.observe(dummy, checkResult);
- dummy.dummy = dummy;
+ Promise.resolve().then(checkResult);
}
testDone(0);
Index: test/mjsunit/es6/debug-promises/reject-with-undefined-reject.js
diff --git
a/test/mjsunit/es6/debug-promises/reject-with-undefined-reject.js
b/test/mjsunit/es6/debug-promises/reject-with-undefined-reject.js
index
d11c01ff73b6216cab278aa850e7fa45c49cf2d8..bc40d803daed9b7791112b31aa98b855df6ada9d
100644
--- a/test/mjsunit/es6/debug-promises/reject-with-undefined-reject.js
+++ b/test/mjsunit/es6/debug-promises/reject-with-undefined-reject.js
@@ -66,10 +66,7 @@ function testDone(iteration) {
}
}
- // Run testDone through the Object.observe processing loop.
- var dummy = {};
- Object.observe(dummy, checkResult);
- dummy.dummy = dummy;
+ Promise.resolve().then(checkResult);
}
testDone(0);
Index: test/mjsunit/es6/debug-promises/throw-caught-all.js
diff --git a/test/mjsunit/es6/debug-promises/throw-caught-all.js
b/test/mjsunit/es6/debug-promises/throw-caught-all.js
index
2fbf05141d56d018f3115a8a5e82b8cfcd709b43..8fc649651ea758d1c8b729540e09cd89b788fa95
100644
--- a/test/mjsunit/es6/debug-promises/throw-caught-all.js
+++ b/test/mjsunit/es6/debug-promises/throw-caught-all.js
@@ -62,10 +62,7 @@ function testDone(iteration) {
}
}
- // Run testDone through the Object.observe processing loop.
- var dummy = {};
- Object.observe(dummy, checkResult);
- dummy.dummy = dummy;
+ Promise.resolve().then(checkResult);
}
testDone(0);
Index:
test/mjsunit/es6/debug-promises/throw-caught-by-default-reject-handler.js
diff --git
a/test/mjsunit/es6/debug-promises/throw-caught-by-default-reject-handler.js
b/test/mjsunit/es6/debug-promises/throw-caught-by-default-reject-handler.js
index
36b5565e5f807dcf5ef4e763167ce0d5155775d7..785af24448cbe0582ccfdaa4168ee824a6f912d8
100644
---
a/test/mjsunit/es6/debug-promises/throw-caught-by-default-reject-handler.js
+++
b/test/mjsunit/es6/debug-promises/throw-caught-by-default-reject-handler.js
@@ -78,10 +78,7 @@ function testDone(iteration) {
}
}
- // Run testDone through the Object.observe processing loop.
- var dummy = {};
- Object.observe(dummy, checkResult);
- dummy.dummy = dummy;
+ Promise.resolve().then(checkResult);
}
testDone(0);
Index: test/mjsunit/es6/debug-promises/throw-uncaught-all.js
diff --git a/test/mjsunit/es6/debug-promises/throw-uncaught-all.js
b/test/mjsunit/es6/debug-promises/throw-uncaught-all.js
index
72f800bf5b3017b66a52f879260845448c1dd59a..e6dd29d688fb009af19f5e09437b6260f1f0c3a0
100644
--- a/test/mjsunit/es6/debug-promises/throw-uncaught-all.js
+++ b/test/mjsunit/es6/debug-promises/throw-uncaught-all.js
@@ -61,10 +61,7 @@ function testDone(iteration) {
}
}
- // Rerun testDone through the Object.observe processing loop.
- var dummy = {};
- Object.observe(dummy, checkResult);
- dummy.dummy = dummy;
+ Promise.resolve().then(checkResult);
}
testDone(0);
Index: test/mjsunit/es6/debug-promises/throw-uncaught-uncaught.js
diff --git a/test/mjsunit/es6/debug-promises/throw-uncaught-uncaught.js
b/test/mjsunit/es6/debug-promises/throw-uncaught-uncaught.js
index
69aa8ebbd248c2e6fd01770aca7b47126526ce53..faa8629692a7e36e139f0b8be8f46e905bcf02dc
100644
--- a/test/mjsunit/es6/debug-promises/throw-uncaught-uncaught.js
+++ b/test/mjsunit/es6/debug-promises/throw-uncaught-uncaught.js
@@ -61,10 +61,7 @@ function testDone(iteration) {
}
}
- // Run testDone through the Object.observe processing loop.
- var dummy = {};
- Object.observe(dummy, checkResult);
- dummy.dummy = dummy;
+ Promise.resolve().then(checkResult);
}
testDone(0);
Index: test/mjsunit/es6/debug-promises/throw-with-throw-in-reject.js
diff --git a/test/mjsunit/es6/debug-promises/throw-with-throw-in-reject.js
b/test/mjsunit/es6/debug-promises/throw-with-throw-in-reject.js
index
1ea1c7f9ff3eedb0318e9975c86b369ed734fd03..7b540ebaff238f0d5df64c9ce69abd3679918701
100644
--- a/test/mjsunit/es6/debug-promises/throw-with-throw-in-reject.js
+++ b/test/mjsunit/es6/debug-promises/throw-with-throw-in-reject.js
@@ -81,10 +81,7 @@ function testDone(iteration) {
}
}
- // Run testDone through the Object.observe processing loop.
- var dummy = {};
- Object.observe(dummy, checkResult);
- dummy.dummy = dummy;
+ Promise.resolve().then(checkResult);
}
testDone(0);
Index: test/mjsunit/es6/debug-promises/throw-with-undefined-reject.js
diff --git a/test/mjsunit/es6/debug-promises/throw-with-undefined-reject.js
b/test/mjsunit/es6/debug-promises/throw-with-undefined-reject.js
index
94dcdffa225e11a5255801e8d9eccfdd972e50f7..f008928f45f0bcd4f992c52cb80ba2c21c355898
100644
--- a/test/mjsunit/es6/debug-promises/throw-with-undefined-reject.js
+++ b/test/mjsunit/es6/debug-promises/throw-with-undefined-reject.js
@@ -79,10 +79,7 @@ function testDone(iteration) {
}
}
- // Run testDone through the Object.observe processing loop.
- var dummy = {};
- Object.observe(dummy, checkResult);
- dummy.dummy = dummy;
+ Promise.resolve().then(checkResult);
}
testDone(0);
Index: test/mjsunit/es6/promises.js
diff --git a/test/mjsunit/es6/promises.js b/test/mjsunit/es6/promises.js
index
63b6d2f94a9a7ec0799a7ef766845675dc8466fb..e3aeb70561a034c5387563ad850428a91db153f5
100644
--- a/test/mjsunit/es6/promises.js
+++ b/test/mjsunit/es6/promises.js
@@ -29,7 +29,6 @@
// Make sure we don't rely on functions patchable by monkeys.
var call = Function.prototype.call.call.bind(Function.prototype.call)
-var observe = Object.observe;
var getOwnPropertyNames = Object.getOwnPropertyNames;
var defineProperty = Object.defineProperty;
var numberPrototype = Number.prototype;
@@ -88,8 +87,7 @@ function assertAsync(b, s) {
function assertAsyncDone(iteration) {
var iteration = iteration || 0
- var dummy = {}
- observe(dummy,
+ Promise.resolve().then(
function() {
if (asyncAssertsExpected === 0)
assertAsync(true, "all")
@@ -99,7 +97,6 @@ function assertAsyncDone(iteration) {
assertAsyncDone(iteration + 1)
}
)
- dummy.dummy = dummy
}
Index: test/promises-aplus/lib/global.js
diff --git a/test/promises-aplus/lib/global.js
b/test/promises-aplus/lib/global.js
index
1466d2063b5be2351b49a021578cd1091992fbee..e088fe38f31a9dcac0fadbbaaeb71ae634e5130b
100644
--- a/test/promises-aplus/lib/global.js
+++ b/test/promises-aplus/lib/global.js
@@ -34,12 +34,7 @@ var timers = {};
var currentId = 0;
function PostMicrotask(fn) {
- var o = {};
- Object.observe(o, function() {
- fn();
- });
- // Change something to enqueue a microtask.
- o.x = 'hello';
+ Promise.resolve().then(fn);
}
setInterval = function(fn, delay) {
Index: test/promises-aplus/lib/mocha.js
diff --git a/test/promises-aplus/lib/mocha.js
b/test/promises-aplus/lib/mocha.js
index
24d294ef8f829889fbcdccf1a9893f92635c7aea..f09f11130b2c6a901715d757180de4ca478533be
100644
--- a/test/promises-aplus/lib/mocha.js
+++ b/test/promises-aplus/lib/mocha.js
@@ -42,12 +42,7 @@ var assert = require('assert');
var TIMEOUT = 1000;
function PostMicrotask(fn) {
- var o = {};
- Object.observe(o, function() {
- fn();
- });
- // Change something to enqueue a microtask.
- o.x = 'hello';
+ Promise.resolve().then(fn);
}
var context = {
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.