Name collision with Promise

RESOLVED FIXED in Firefox 25

Status

()

Firefox
Developer Tools
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: baku, Assigned: past)

Tracking

(Blocks: 1 bug)

unspecified
Firefox 25
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
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");
(Reporter)

Updated

5 years ago
Blocks: 884279
(Reporter)

Updated

5 years ago
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?
(Reporter)

Comment 3

5 years ago
Yes, It does.
(Assignee)

Comment 4

5 years ago
I'll work on this.
Assignee: nobody → past
Status: NEW → ASSIGNED
(Assignee)

Comment 5

5 years ago
Created attachment 773344 [details] [diff] [review]
Rename Promise to promise to avoid collisions with the forthcoming DOM Promise implementation

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?
(Assignee)

Comment 9

5 years ago
(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
Last Resolved: 5 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 25
(Reporter)

Updated

5 years ago
Blocks: 875289
You need to log in before you can comment on or make changes to this bug.