Closed Bug 1265887 Opened 9 years ago Closed 8 years ago

remove or replace PluralForm.jsm

Categories

(DevTools :: Framework, enhancement, P1)

enhancement

Tracking

(firefox51 fixed)

RESOLVED FIXED
Firefox 51
Iteration:
51.2 - Aug 29
Tracking Status
firefox51 --- fixed

People

(Reporter: tromey, Assigned: jdescottes)

References

(Depends on 2 open bugs)

Details

(Whiteboard: [devtools-html])

Attachments

(2 files)

PluralForm.jsm is loaded in the inspector but perhaps not used.
It should either be removed or replaced for the devtools
de-chrome-ification project.
Do we have a bug for Services.Strings.createBundle ?
PluralForm is part of the localization as well as createBundle. I imagine we need a coherent migration for all l10n APIs.
(In reply to Alexandre Poirot [:ochameau] from comment #1)
> Do we have a bug for Services.Strings.createBundle ?

I just made one.
I think maybe this will be handled by some other track, not sure though.
Depends on: 1266075
Flags: qe-verify-
Priority: -- → P2
No longer blocks: devtools-html-3
Priority: P2 → --
Whiteboard: [devtools-html] → [devtools-html] [triage]
Whiteboard: [devtools-html] [triage] → [devtools-html]
Priority: -- → P2
Blocks: 1290947
We're working on Intl.PluralRules API, but it'll be initially chrome-only.

You could consider using a polyfill - https://github.com/eemeli/IntlPluralRules
Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Priority: P2 → P1
Iteration: --- → 51.2 - Aug 29
Comment on attachment 8783971 [details]
Bug 1265887 - migrate devtools/ from PluralForm.jsm to plural-form.js;

Tom, can you let me know what you think about this approach? I simply took the existing PluralForm jsm, removed the Chrome privileged APIs. 

The only thing that is a bit fishy IMO is that we are relying on a localized string outside of the devtools scope to know the plural rules that should be used. This will work fine when running in chrome, but when running in webpack/content, we won't have access to the file, so for now I decided to default to english.
Attachment #8783971 - Flags: feedback?(ttromey)
Comment on attachment 8783971 [details]
Bug 1265887 - migrate devtools/ from PluralForm.jsm to plural-form.js;

I think depending on that is ok.  IIRC there are some other dependencies
on non-devtools property files as well.
It seems to me that we can either bundle these files or replace them with
our own shims without too much effort.
Attachment #8783971 - Flags: feedback?(ttromey) → feedback+
Thanks for the feedback ! FYI, I opened a bug to take a closer look at non-devtools dependencies: Bug 1297733

Currently blocking this on Bug 1298012. We need to move l10n.js to devtools/shared so that plural-form.js can also be moved there and be used by files in devtools/shared.
Depends on: 1298012
Comment on attachment 8783971 [details]
Bug 1265887 - migrate devtools/ from PluralForm.jsm to plural-form.js;

https://reviewboard.mozilla.org/r/73588/#review72822

Thank you.  This looks good.
Attachment #8783971 - Flags: review?(ttromey) → review+
Comment on attachment 8785910 [details]
Bug 1265887 - Port PluralForm.jsm to plural-form.js (no chrome-privileged APIs);

https://reviewboard.mozilla.org/r/74756/#review72832

Thank you.  This is fine.
Attachment #8785910 - Flags: review?(ttromey) → review+
Thanks for the reviews Tom! Green try at https://treeherder.mozilla.org/#/jobs?repo=try&revision=8e8bdccbfcaf, landing.
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/fx-team/rev/cb74e60bc40a
port PluralForm.jsm to plural-form.js without chrome APIs;r=tromey
https://hg.mozilla.org/integration/fx-team/rev/2c763524c0b6
migrate devtools/ from PluralForm.jsm to plural-form.js;r=tromey
https://hg.mozilla.org/mozilla-central/rev/cb74e60bc40a
https://hg.mozilla.org/mozilla-central/rev/2c763524c0b6
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → Firefox 51
Depends on: 1301933
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: