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

Unified Diff: test/mjsunit/contextual-calls.js

Issue 93863006: Revert "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/cctest/test-api.cc ('k') | test/mjsunit/harmony/proxies-function.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/contextual-calls.js
diff --git a/test/mjsunit/contextual-calls.js b/test/mjsunit/contextual-calls.js
deleted file mode 100644
index 10c3e8d82cc1b60a7a9a5faa134e696e49ba033f..0000000000000000000000000000000000000000
--- a/test/mjsunit/contextual-calls.js
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2013 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-var realms = [Realm.current(), Realm.create()];
-globals = [Realm.global(0), Realm.global(1)];
-Realm.shared = {}
-
-function install(name, value) {
- Realm.shared[name] = value;
- for (i in realms) {
- Realm.eval(realms[i], name + " = Realm.shared['" + name + "'];");
- }
-}
-
-install('return_this', function() { return this; });
-install('return_this_strict', function () { 'use strict'; return this; });
-
-// test behaviour of 'with' scope
-for (i in realms) {
- Realm.shared.results = [];
- // in the second case, 'this' is found in the with scope,
- // so the receiver is 'this'
- Realm.eval(realms[i]," \
- with('irrelevant') { \
- Realm.shared.results.push(return_this()); \
- Realm.shared.results.push(return_this_strict()); \
- } \
- with(this) { \
- Realm.shared.results.push(return_this()); \
- Realm.shared.results.push(return_this_strict()); \
- } \
- ");
- assertSame(globals[0], Realm.shared.results[0]);
- assertSame(undefined, Realm.shared.results[1]);
- assertSame(globals[i], Realm.shared.results[2]);
- assertSame(globals[i], Realm.shared.results[3]);
-}
-
-// test 'apply' and 'call'
-for (i in realms) {
- // 'apply' without a receiver is a contextual call
- assertSame(globals[0], Realm.eval(realms[i],'return_this.apply()')) ;
- assertSame(undefined, Realm.eval(realms[i],'return_this_strict.apply()'));
- assertSame(globals[0], Realm.eval(realms[i],'return_this.apply(null)')) ;
- assertSame(null, Realm.eval(realms[i],'return_this_strict.apply(null)'));
- // 'call' without a receiver is a contextual call
- assertSame(globals[0], Realm.eval(realms[i],'return_this.call()')) ;
- assertSame(undefined, Realm.eval(realms[i],'return_this_strict.call()'));
- assertSame(globals[0], Realm.eval(realms[i],'return_this.call(null)')) ;
- assertSame(null, Realm.eval(realms[i],'return_this_strict.call(null)'));
-}
-
-// test ics
-for (var i = 0; i < 4; i++) {
- assertSame(globals[0], return_this());
- assertSame(undefined, return_this_strict());
-}
-
-// BUG(1547)
-
-Realm.eval(realms[0], "var name = 'o'");
-Realm.eval(realms[1], "var name = 'i'");
-
-install('f', function() { return this.name; });
-install('g', function() { "use strict"; return this ? this.name : "u"; });
-
-for (i in realms) {
- result = Realm.eval(realms[i], " \
- (function(){return f();})() + \
- (function(){return (1,f)();})() + \
- (function(){'use strict'; return f();})() + \
- (function(){'use strict'; return (1,f)();})() + \
- (function(){return g();})() + \
- (function(){return (1,g)();})() + \
- (function(){'use strict'; return g();})() + \
- (function(){'use strict'; return (1,g)();})(); \
- ");
- assertSame("oooouuuu", result);
-}
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/mjsunit/harmony/proxies-function.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698