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

Unified Diff: test/mjsunit/harmony/proxies-function.js

Issue 104013008: Reland v8:18458 "Load the global proxy from the context of the target function." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/contextual-calls.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/proxies-function.js
diff --git a/test/mjsunit/harmony/proxies-function.js b/test/mjsunit/harmony/proxies-function.js
index 6b8d098442f16fba27bf4647a8d1b2ddc7e4a377..8c91e9ba9ef12fdec6cbb00b69216b63c6981973 100644
--- a/test/mjsunit/harmony/proxies-function.js
+++ b/test/mjsunit/harmony/proxies-function.js
@@ -53,8 +53,7 @@ var receiver
function TestCall(isStrict, callTrap) {
assertEquals(42, callTrap(5, 37))
- // TODO(rossberg): strict mode seems to be broken on x64...
- // assertSame(isStrict ? undefined : global_object, receiver)
+ assertSame(isStrict ? undefined : global_object, receiver)
var handler = {
get: function(r, k) {
@@ -67,8 +66,7 @@ function TestCall(isStrict, callTrap) {
receiver = 333
assertEquals(42, f(11, 31))
- // TODO(rossberg): strict mode seems to be broken on x64...
- // assertSame(isStrict ? undefined : global_object, receiver)
+ assertSame(isStrict ? undefined : global_object, receiver)
receiver = 333
assertEquals(42, o.f(10, 32))
assertSame(o, receiver)
@@ -746,3 +744,31 @@ function TestCalls() {
TestCalls()
*/
+
+var realms = [Realm.create(), Realm.create()];
+Realm.shared = {};
+
+Realm.eval(realms[0], "function f() { return this; };");
+Realm.eval(realms[0], "Realm.shared.f = f;");
+Realm.eval(realms[0], "Realm.shared.fg = this;");
+Realm.eval(realms[1], "function g() { return this; };");
+Realm.eval(realms[1], "Realm.shared.g = g;");
+Realm.eval(realms[1], "Realm.shared.gg = this;");
+
+var fp = Proxy.createFunction({}, Realm.shared.f);
+var gp = Proxy.createFunction({}, Realm.shared.g);
+
+for (var i = 0; i < 10; i++) {
+ assertEquals(Realm.shared.fg, fp());
+ assertEquals(Realm.shared.gg, gp());
+
+ with (this) {
+ assertEquals(Realm.shared.fg, fp());
+ assertEquals(Realm.shared.gg, gp());
+ }
+
+ with ({}) {
+ assertEquals(Realm.shared.fg, fp());
+ assertEquals(Realm.shared.gg, gp());
+ }
+}
« no previous file with comments | « test/mjsunit/contextual-calls.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698