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

Unified Diff: test/mjsunit/function-bind.js

Issue 1217603005: [es6] Function bind should preserve [[Prototype]] (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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
« src/runtime/runtime-function.cc ('K') | « src/runtime/runtime-function.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/function-bind.js
diff --git a/test/mjsunit/function-bind.js b/test/mjsunit/function-bind.js
index 23dacf157e6ea85064d4b69a1718c1ddcea1470e..a2efe4f034e163ffbc14cdfc5172f597ee29f94e 100644
--- a/test/mjsunit/function-bind.js
+++ b/test/mjsunit/function-bind.js
@@ -298,3 +298,17 @@ assertThrows(function() { f.arguments = 42; }, TypeError);
// the caller is strict and the callee isn't. A bound function is built-in,
// but not considered strict.
(function foo() { return foo.caller; }).bind()();
+
+
+(function TestProtoIsPreserved() {
+ function fun() {}
+
+ function proto() {}
+ Object.setPrototypeOf(fun, proto);
+ var bound = fun.bind({});
+ assertEquals(proto, Object.getPrototypeOf(bound));
+
+ Object.setPrototypeOf(fun, null);
+ bound = Function.prototype.bind.call(fun, {});
+ assertEquals(null, Object.getPrototypeOf(bound));
+})();
« src/runtime/runtime-function.cc ('K') | « src/runtime/runtime-function.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698