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

Unified Diff: test/mjsunit/strict-mode.js

Issue 11417140: Censor .caller if it is a strict function instead of throwing. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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 | « src/accessors.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/strict-mode.js
diff --git a/test/mjsunit/strict-mode.js b/test/mjsunit/strict-mode.js
index 9c9bdfd52d42662f0dcb13e22402e8fc8f1cf5a9..5fb404a7990913cc953fe400315a3e4e455ced4a 100644
--- a/test/mjsunit/strict-mode.js
+++ b/test/mjsunit/strict-mode.js
@@ -1141,9 +1141,9 @@ function CheckPillDescriptor(func, name) {
function strict() {
"use strict";
- return_my_caller();
+ return return_my_caller();
}
- assertThrows(strict, TypeError);
+ assertSame(null, strict());
function non_strict() {
return return_my_caller();
@@ -1155,32 +1155,57 @@ function CheckPillDescriptor(func, name) {
(function TestNonStrictFunctionCallerPill() {
function strict(n) {
"use strict";
- non_strict(n);
+ return non_strict(n);
}
function recurse(n, then) {
if (n > 0) {
- recurse(n - 1);
+ return recurse(n - 1, then);
} else {
return then();
}
}
function non_strict(n) {
- recurse(n, function() { non_strict.caller; });
+ return recurse(n, function() { return non_strict.caller; });
}
function test(n) {
- try {
- recurse(n, function() { strict(n); });
- } catch(e) {
- return e instanceof TypeError;
+ return recurse(n, function() { return strict(n); });
+ }
+
+ for (var i = 0; i < 10; i ++) {
+ assertSame(null, test(i));
+ }
+})();
+
+
+(function TestNonStrictFunctionCallerDescriptorPill() {
+ function strict(n) {
+ "use strict";
+ return non_strict(n);
+ }
+
+ function recurse(n, then) {
+ if (n > 0) {
+ return recurse(n - 1, then);
+ } else {
+ return then();
}
- return false;
+ }
+
+ function non_strict(n) {
+ return recurse(n, function() {
+ return Object.getOwnPropertyDescriptor(non_strict, "caller").value;
+ });
+ }
+
+ function test(n) {
+ return recurse(n, function() { return strict(n); });
}
for (var i = 0; i < 10; i ++) {
- assertEquals(test(i), true);
+ assertSame(null, test(i));
}
})();
« no previous file with comments | « src/accessors.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698