Closed Bug 1420179 Opened 7 years ago Closed 7 years ago

test framework: shared-head refreshTab takes an unused tab argument

Categories

(DevTools :: Framework, enhancement, P3)

58 Branch
enhancement

Tracking

(firefox59 fixed)

RESOLVED FIXED
Firefox 59
Tracking Status
firefox59 --- fixed

People

(Reporter: jdescottes, Assigned: jdescottes)

Details

Attachments

(1 file)

See https://searchfox.org/mozilla-central/rev/33c90c196bc405e628bc868a4f4ba29b992478c0/devtools/client/framework/test/shared-head.js#179-185 

The argument is not used.

- remove the argument
- udpate JSDoc
- update all callers
- rename method to refreshSelectedTab
Severity: normal → enhancement
Priority: -- → P3
Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
https://treeherder.mozilla.org/#/jobs?repo=try&revision=84766303856478970c4dc71df042205f76cbca4d

Ended up keeping the name and adding support for the argument as an optional thing. It's not used for now, but refreshSelectedTab felt like too many letters and not enough flexible, could bite us in the future.
Comment on attachment 8931399 [details]
Bug 1420179 - support tab argument in devtools shared-head refreshTab;

https://reviewboard.mozilla.org/r/202530/#review207884

Seems legit

::: devtools/client/framework/test/shared-head.js:179
(Diff revision 1)
> -var refreshTab = Task.async(function*(tab) {
> +var refreshTab = Task.async(function* (tab) {
>    info("Refreshing tab.");
>    const finished = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
> -  gBrowser.reloadTab(gBrowser.selectedTab);
> +  gBrowser.reloadTab(tab || gBrowser.selectedTab);
>    yield finished;
>    info("Tab finished refreshing.");
>  });

since we're refactoring things, could this be transformed to a plain async await function ?

::: devtools/client/framework/test/shared-head.js:179
(Diff revision 1)
>  /**
> - * Refresh the given tab.
> - * @param {Object} tab The tab to be refreshed.
> + * Refresh the provided tab.
> + * @param {Object} tab The tab to be refreshed. Defaults to the currently selected tab.
>   * @return Promise<undefined> resolved when the tab is successfully refreshed.
>   */
> -var refreshTab = Task.async(function*(tab) {
> +var refreshTab = Task.async(function* (tab) {

could we use (tab = gBrowser.selectedTab) ?
Attachment #8931399 - Flags: review?(nchevobbe) → review+
Thanks for the review, fixed the raised issues.
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/dc14f9701349
support tab argument in devtools shared-head refreshTab;r=nchevobbe
https://hg.mozilla.org/mozilla-central/rev/dc14f9701349
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 59
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: