Closed Bug 885318 Opened 7 years ago Closed 7 years ago

Name collision with Promise

Categories

(DevTools :: General, defect)

defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 25

People

(Reporter: baku, Assigned: past)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

devtools use a lot of Promise objects implemented in JS.
But bug 884279 renames Future to Promise and this makes a name collision.

Talking on IRC on #devtools, we found 2 possible solutions:

a) Rename Promise to JSPromise (or to something else)
b) do some destructuring assignment on import, like: let {resolve, reject, etc. } = Cu.import("promise.js");
Blocks: 884279
Blocks: 885333
Component: General → Developer Tools
Product: Toolkit → Firefox
Duplicate of this bug: 885334
In a separate thread we'd decided that we should be doing s/Promise/promise/g. Would this solve the problem?
Yes, It does.
I'll work on this.
Assignee: nobody → past
Status: NEW → ASSIGNED
This turned out to be a lerger patch than I expected, due to us using lowercase promise as a local variable identifier. Maybe destructuring on import would have resulted in a shorter patch, but I don't know for sure or care. All tests pass locally.
Attachment #773344 - Flags: review?(jwalker)
Comment on attachment 773344 [details] [diff] [review]
Rename Promise to promise to avoid collisions with the forthcoming DOM Promise implementation

Review of attachment 773344 [details] [diff] [review]:
-----------------------------------------------------------------

It's kind of annoying that we can't call 'promise' 'promise' any more. Ho Hum.
Attachment #773344 - Flags: review?(jwalker) → review+
How about migrating to DOM Promise?
(In reply to Masatoshi Kimura [:emk] from comment #8)
> How about migrating to DOM Promise?

This bug is a prerequisite for DOM Future to be renamed to Promise. We will likely migrate to that once its ready and has all the API methods we need.
https://hg.mozilla.org/mozilla-central/rev/d5a0afa466c2
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 25
Blocks: 875289
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.