Closed
Bug 1429964
Opened 6 years ago
Closed 6 years ago
Re-enable browser_packaged_as_locales.js with dynamically testing app locales
Categories
(Firefox :: New Tab Page, enhancement)
Firefox
New Tab Page
Tracking
()
People
(Reporter: Mardak, Assigned: Mardak)
References
Details
Attachments
(1 file)
Bug 1423703 disabled browser_packaged_as_locales.js because there isn't a good way to dynamically change the app locale for the test. See 1423703 comment 20. gandalf, do you have a bug already that we can set blocking this bug?
Flags: needinfo?(gandalf)
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Updated•6 years ago
|
Assignee: nobody → edilee
Comment hidden (mozreview-request) |
Comment 3•6 years ago
|
||
mozreview-review |
Comment on attachment 8957268 [details] Bug 1429964 - Re-enable browser_packaged_as_locales.js with dynamically testing app locales. https://reviewboard.mozilla.org/r/226188/#review232134 ::: browser/components/newtab/aboutNewTabService.js:20 (Diff revision 1) > > // Dummy references to the files that this service no longer allows loading. > // Bug 1409054 to remove "chrome://browser/content/abouthome/aboutHome.xhtml" > > const TOPIC_APP_QUIT = "quit-application-granted"; > -const TOPIC_LOCALES_CHANGE = "intl:requested-locales-changed"; > +const TOPIC_LOCALES_CHANGE = "intl:app-locales-changed"; Yay! Was planning to poke you about it. Glad to see that! ::: browser/components/newtab/tests/browser/browser_packaged_as_locales.js:10 (Diff revision 1) > > const DEFAULT_URL = "resource://activity-stream/prerendered/en-US/activity-stream-prerendered.html"; > async function getUrlForLocale(locale) { > + const origAvailable = Services.locale.getAvailableLocales(); > + const origRequested = Services.locale.getRequestedLocales(); > + try { Why do you wrap it in try/catch? The only scenario in which any of those LocaleService methods throw is if you pass it an incorrectly formatted BCP47 tag. And in this case, I think it would be better to blow the test rather than silently pass. :)
Attachment #8957268 -
Flags: review?(gandalf) → review+
Assignee | ||
Comment 4•6 years ago
|
||
(In reply to Zibi Braniecki [:gandalf][:zibi] from comment #3) > Why do you wrap it in try/catch? Technically, there's no `catch` ;) ;) The finally is so that code can run after the return statement. But.. I guess I can just make it store the return url value and return that after restoring the locale.
Comment 5•6 years ago
|
||
oh! That got me, I'm not used to use try/finally for that - neat trick. Up to you if you want to change that. Maybe just a docstring explaining the technique for folks like me will be enough? :)
Comment hidden (mozreview-request) |
Assignee | ||
Comment 7•6 years ago
|
||
mozreview-review-reply |
Comment on attachment 8957268 [details] Bug 1429964 - Re-enable browser_packaged_as_locales.js with dynamically testing app locales. https://reviewboard.mozilla.org/r/226188/#review232134 > Why do you wrap it in try/catch? > > The only scenario in which any of those LocaleService methods throw is if you pass it an incorrectly formatted BCP47 tag. > > And in this case, I think it would be better to blow the test rather than silently pass. :) Added comments before for the function and inline
Pushed by edilee@gmail.com: https://hg.mozilla.org/integration/autoland/rev/543721b84a36 Re-enable browser_packaged_as_locales.js with dynamically testing app locales. r=gandalf
Comment 9•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/543721b84a36
Status: NEW → RESOLVED
Closed: 6 years ago
status-firefox60:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 60
Assignee | ||
Updated•6 years ago
|
Iteration: --- → 60.4 - Mar 12
Whiteboard: [blocked]
Updated•5 years ago
|
Component: Activity Streams: Newtab → New Tab Page
You need to log in
before you can comment on or make changes to this bug.
Description
•