Closed Bug 1287522 Opened 4 years ago Closed 4 years ago

Wrong evaluation order in RegExp.prototype.toString

Categories

(Core :: JavaScript: Standard Library, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla50
Tracking Status
firefox47 --- affected
firefox48 --- affected
firefox49 --- affected
firefox-esr45 --- affected
firefox50 --- fixed

People

(Reporter: anba, Assigned: arai)

References

()

Details

Attachments

(1 file)

ToString needs to be applied before retrieving the "flags" property.


Test case:
---
RegExp.prototype.toString.call({
  get source() {
    print("get source");
    return {toString() {print("source-tostring")}};
  },
  get flags() {
    print("get flags");
    return {toString() {print("flags-tostring")}};
  },
});
---

Expected: Prints "source-tostring" before "get flags"
Actual: Prints "source-tostring" after "get flags"
Added explicit ToString call to pattern and flags, in correct order, and renumbered the spec steps.
Assignee: nobody → arai.unmht
Attachment #8772226 - Flags: review?(evilpies)
Attachment #8772226 - Flags: review?(evilpies) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/49bef2408c15ae8e76ee485bd8c338573fa8a1c7
Bug 1287522 - Apply ToString in correct order in RegExp.prototype.toString. r=evilpie
https://hg.mozilla.org/mozilla-central/rev/49bef2408c15
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
You need to log in before you can comment on or make changes to this bug.