Closed Bug 1363215 Opened 7 years ago Closed 7 years ago

Replace calls to __defineGetter__ and __defineSetter__ on top-level this with Object.defineProperty

Categories

(Firefox :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 55
Tracking Status
firefox55 --- fixed

People

(Reporter: mccr8, Assigned: mccr8)

References

Details

Attachments

(1 file)

__defineGetter__ and __defineSetter__ are deprecated, and their use on top level |this| objects in .jsms gets in the way of bug 1186409, because |this| ends up not being a top-level window, so it doesn't have that method on it. I also fixed a few other places that were in the same file as uses on top-level this to avoid introducing too much inconsistency. I think this is really only needed for the one place I changed this that is in a .jsm. I set configurable and enumerable to true. This seems to be how the old ones are defined per the ECMAScript spec: https://tc39.github.io/ecma262/#sec-additional-ecmascript-features-for-web-browsers Also, this is required to avoid some test failures of the form "test left unexpected property on window" because things like the getter for AddonManager in browser/base/content/browser.js delete the existing property and replace it with a normal one (which is enumerable), so you have to make sure the original getter is also enumerable.
Comment on attachment 8865948 [details] Bug 1363215 - Replace calls to __define{Getter,Setter}__ on top-level this with Object.defineProperty. https://reviewboard.mozilla.org/r/137532/#review140796
Attachment #8865948 - Flags: review?(gijskruitbosch+bugs) → review+
Florian, do we have a bug on switching over to the new/standards syntax and making __define* an eslint error?
Flags: needinfo?(florian)
Pushed by amccreight@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/96dd2e2d8d16 Replace calls to __define{Getter,Setter}__ on top-level this with Object.defineProperty. r=Gijs
(In reply to :Gijs from comment #4) > Florian, do we have a bug on switching over to the new/standards syntax and > making __define* an eslint error? Not that I'm aware of. That's likely scriptable, although the result will be unfortunate where the current version fits on a single line.
Flags: needinfo?(florian)
Pushed by gszorc@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/eab436c452e9 Replace calls to __define{Getter,Setter}__ on top-level this with Object.defineProperty. r=Gijs
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: