Closed Bug 407374 Opened 18 years ago Closed 18 years ago

Destructuring assignment isn't threadsafe

Categories

(Rhino Graveyard :: Core, defect)

x86
Windows XP
defect
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mozilla.bugs, Unassigned)

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11 Build Identifier: CVS HEAD I have a function with destructured parameters (eg function(a, [b]) {...}). This function is called from several threads and the b (in this example) appears to be shared :-( If I rewrite my functions without destructured parameters (eg function(a, ab) { const b = ab[0]; ... } it solves the problem. Compiled & interpreted mode. Reproducible: Always Steps to Reproduce: function f(a, [b]) { java.lang.Thread.sleep(2000); print(a + ";" + b); } spawn(f, [1, [2]]); spawn(f, [3, [4]]); Actual Results: 3;4 1;4 Expected Results: 3;4 1;2
Additional information: b is set in the top level scope.
Attached patch proposed patchSplinter Review
This patche makes the destructuring assignment to set properties in the current scope.
Thanks for the patch. Committed: Checking in Parser.java; /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/Parser.java,v <-- Parser.java new revision: 1.123; previous revision: 1.122 done
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: