Closed Bug 787710 Opened 12 years ago Closed 9 years ago

Proxy survives after a refresh

Categories

(Core :: JavaScript Engine, defect)

18 Branch
x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: bruant.d, Unassigned)

References

Details

(Whiteboard: [js:p2])

Attachments

(1 file, 1 obsolete file)

20.00 KB, application/x-gzip
Details
Bug found in Nightly built from http://hg.mozilla.org/mozilla-central/rev/a21fd4d085ad on Linux 32 bits.

I have exposed the test case in a specific tag: https://github.com/DavidBruant/HarmonyProxyLab/tree/survivingProxyBug/ProxyArray
The goal of this code is to emulate native arrays with direct proxies using only "normal objects".

For the very first test, the first time it passes (length of the proxyArray is 0).
After a refresh, the test fails with the proxy having a length of 10 (which it has no reason to, but is the value it certainly was in the previous session).
After another refresh, the test passes. After another refresh, it fails and so on.

It seems that the proxy (or at least some info) survives a refresh, which is pretty bad.
It might be that the proxy (and target) is reallocated at the same place twice, that the memory has not been erased.
David, what are the actual steps to reproduce here?

I tried this:

1)  cd /tmp
2)  git clone https://github.com/DavidBruant/HarmonyProxyLab.git
3)  Load file:///tmp/HarmonyProxyLab/ProxyArray/Arrays.html

I get an error in the error console:

  [10:44:56.451] ReferenceError: VirtualHandler is not defined @
   file:///tmp/HarmonyProxyLab/ProxyArray/ProxyArray.js:11

and an error message in the web page:

  Script error.
  Source: file:///tmp/HarmonyProxyLab/ProxyArray/ProxyArray.js:0

What do I need to do differently here?
(In reply to Boris Zbarsky (:bz) from comment #2)
> 1)  cd /tmp
> 2)  git clone https://github.com/DavidBruant/HarmonyProxyLab.git
3) git checkout survivingProxyBug
> [4])  Load file:///tmp/HarmonyProxyLab/ProxyArray/Arrays.html

checking out generates a warning that you can ignore
I added the tag to be sure to keep in mind the code that has the bug
I'm on a different computer (Linux 64-bits) and I can see the bug here too.
This is weird.  I do see the issue on Mac, but if I make the code look like so:

var a = new ProxyArray();
console.log(a.length);

test('init', function(){
    console.log(a.length)
});

then I reliably see 0 logged from the first log() call, while the second one alternates between 0 and 10.  That's... quite odd.
Whiteboard: [js:p2]
I will take a look at this the coming week
Assignee: general → ejpbruel
Blocks: 703537
Does that still reproduce?
(In reply to Tom Schuster [:evilpie] from comment #7)
> Does that still reproduce?
I still see it (Aurora 23, Linux 64). When trying to comment out some tests, the issue disappears. Really weird...
Attached file Test case (obsolete) —
Open the HTML file in the browser and hit F5 to see the first test switch between success and failure
That testcase relies on a ../qunit.js which it does not include.
Flags: needinfo?(bruant.d)
Attached file Test case
Self-sufficient archive this time
Attachment #752725 - Attachment is obsolete: true
Flags: needinfo?(bruant.d)
(In reply to Boris Zbarsky (:bz) from comment #10)
> That testcase relies on a ../qunit.js which it does not include.
My bad.
Yeah, that reproduces again, thank you.
Assignee: ejpbruel → general
Assignee: general → nobody
Happy to say I cannot reproduce the bug from the self-sufficient archive on Firefox Developer Edition (37.0a2).
The proxy implementation and GC went under major changes, so I guess this is that.
Thanks David, marking as resolved.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: