Closed
Bug 784197
Opened 12 years ago
Closed 7 years ago
Default arguments sometimes don't get overridden.
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: espadrine, Unassigned)
Details
(Whiteboard: [js:p3])
I have been using the following code for a month in a patch I write:
…
dump('matching ' + matchProp + '\n');
let props = getMatchedProps(obj, {matchProp:matchProp});
…
function getMatchedProps(aObj, aOptions = {matchProp: ""})
{
dump('got aOptions ' + JSON.stringify(aOptions) + '\n');
// Argument defaults.
aOptions.matchProp = aOptions.matchProp || "";
…
}
Very rarely, I get the following (example) output:
> matching foo
> got aOptions {"matchProp":""}
99% of the time (and, in this example, a split second before the output I pasted above), I do get the following, correct, output:
> matching fo
> got aOptions {"matchProp":"fo"}
As I understand it, there is a tiny edge case that isn't covered.
Worth noting: when this happens, the default argument for that function will stop getting overridden several times in a row, for around fifty times.
Updated•12 years ago
|
Whiteboard: [js:p3]
Assignee | ||
Updated•10 years ago
|
Assignee: general → nobody
Comment 1•7 years ago
|
||
Tentatively marking as WFM given that the default arguments code changed quite a lot in the last five years.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•