diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2019-06-08 17:11:49 -0400 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2019-07-18 22:38:19 -0400 |
commit | 668254e2b2a7b4f1d6da703275b89f3753096f71 (patch) | |
tree | 6120c3a0456fc1983f30685d17920a92b3397998 /js/src/jit-test | |
parent | afb28a43d481075a244b0e18faa8447dfadacf8f (diff) | |
download | UXP-668254e2b2a7b4f1d6da703275b89f3753096f71.tar UXP-668254e2b2a7b4f1d6da703275b89f3753096f71.tar.gz UXP-668254e2b2a7b4f1d6da703275b89f3753096f71.tar.lz UXP-668254e2b2a7b4f1d6da703275b89f3753096f71.tar.xz UXP-668254e2b2a7b4f1d6da703275b89f3753096f71.zip |
903389 - Fix uses of ClassMethodIsNative.
Diffstat (limited to 'js/src/jit-test')
-rw-r--r-- | js/src/jit-test/tests/asm.js/import-function-toPrimitive.js | 26 | ||||
-rw-r--r-- | js/src/jit-test/tests/basic/hasnativemethodpure-optimization.js | 21 |
2 files changed, 47 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/asm.js/import-function-toPrimitive.js b/js/src/jit-test/tests/asm.js/import-function-toPrimitive.js new file mode 100644 index 000000000..aa529b465 --- /dev/null +++ b/js/src/jit-test/tests/asm.js/import-function-toPrimitive.js @@ -0,0 +1,26 @@ +var counter = 0; + +function f(stdlib, foreign) +{ + "use asm"; + var a = +foreign.a; + var b = +foreign.b; + function g() {} + return g; +} + +var foreign = + { + a: function() {}, + b: /value that doesn't coerce purely/, + }; + +foreign.a[Symbol.toPrimitive] = + function() + { + counter++; + return 0; + }; + +f(null, foreign); +assertEq(counter, 1); diff --git a/js/src/jit-test/tests/basic/hasnativemethodpure-optimization.js b/js/src/jit-test/tests/basic/hasnativemethodpure-optimization.js new file mode 100644 index 000000000..2f5e99186 --- /dev/null +++ b/js/src/jit-test/tests/basic/hasnativemethodpure-optimization.js @@ -0,0 +1,21 @@ +load(libdir + "asserts.js"); + +let string = Object.defineProperty(new String("123"), "valueOf", { + get: function() { throw "get-valueOf"; } +}); +assertThrowsValue(() => "" + string, "get-valueOf"); + +string = Object.defineProperty(new String("123"), "toString", { + get: function() { throw "get-toString"; } +}); +assertThrowsValue(() => string.toLowerCase(), "get-toString"); + +string = Object.defineProperty(new String("123"), Symbol.toPrimitive, { + get: function() { throw "get-toPrimitive"; } +}); +assertThrowsValue(() => string.toLowerCase(), "get-toPrimitive"); + +let number = Object.defineProperty(new Number(123), "valueOf", { + get: function() { throw "get-valueOf"; } +}); +assertThrowsValue(() => +number, "get-valueOf");
\ No newline at end of file |