Reviewers: Sven Panne,
Description:
Add test to check that Function.caller must not expose native functions.
[email protected]
BUG=v8:105
Please review this at https://chromiumcodereview.appspot.com/13166002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
A + test/mjsunit/regress/regress-105.js
Index: test/mjsunit/regress/regress-105.js
diff --git a/test/mjsunit/regress/regress-2489.js
b/test/mjsunit/regress/regress-105.js
similarity index 80%
copy from test/mjsunit/regress/regress-2489.js
copy to test/mjsunit/regress/regress-105.js
index
882c4f794a88e24d1d64e86a466b27c39f51e625..9a4d5c4744a3f970101c4a17d37a21ad8f618f83
100644
--- a/test/mjsunit/regress/regress-2489.js
+++ b/test/mjsunit/regress/regress-105.js
@@ -25,26 +25,20 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --allow-natives-syntax
-
-"use strict";
-
-function f(a, b) {
- return g("c", "d");
+var custom_valueOf = function() {
+ assertEquals(Number, custom_valueOf.caller);
+ return 2;
}
-function g(a, b) {
- g.constructor.apply(this, arguments);
+var custom_toString = function() {
+ assertEquals(String, custom_toString.caller);
+ return "I used to be an adventurer like you";
}
-g.constructor = function(a, b) {
- assertEquals("c", a);
- assertEquals("d", b);
-}
+var object = {};
+object.valueOf = custom_valueOf;
+object.toString = custom_toString;
+
+assertEquals(2, Number(object));
+assertEquals('I', String(object)[0]);
-f("a", "b");
-f("a", "b");
-%OptimizeFunctionOnNextCall(f);
-f("a", "b");
-g.x = "deopt";
-f("a", "b");
--
--
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/groups/opt_out.