Closed Bug 516826 Opened 15 years ago Closed 15 years ago

Non-important print statement affects results

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: mrbkap, Assigned: jorendorff)

Details

(Whiteboard: [sg:dupe 513160])

This is probably due to a bug in recording, but the general idea is: $ cat testa.js var obj = {} var k; var i; var f = obj.f = function() { for (i = 0; i < 5; ++i) k = this; return k; } obj.f() assertEq(f().isInner, false); $ cat testb.js var obj = {} var k; var i; var f = obj.f = function() { print(); for (i = 0; i < 5; ++i) k = this; return k; } obj.f() assertEq(f().isInner, false); $ tracer-obj/js -j -z testa.js $ tracer-obj/js -j -z testb.js testb.js:6: TypeError: Assertion failed: got true, expected false
Assignee: general → jorendorff
I just noticed: initializing |k = {}| and |i = 0| before the calls makes the bug disappear.
The tests in comment 0 are unit tests for bug 513160. Both tests now pass. To reproduce this bug you must revert the fix for bug 513160: hg export 2b8f660c66cd | patch -p1 -R Then you might reasonably think both tests should fail. Actually testa passes and testb fails. I can't reproduce what Blake says in comment 1. So I blame this on bug 513160. I suspect what's happening here is that calling print(); does something to the bottommost stack frame that causes the bug not to happen. So of course the test then passes. Note that it's not anything specific about print(). Call any global function and the test is disrupted. Tentatively this WORKSFORME. Blake, is this analysis completely bogus?
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → WORKSFORME
Whiteboard: [sg:dupe 513160]
Group: core-security → core-security-release
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.