Closed Bug 926579 Opened 12 years ago Closed 9 years ago

Find ways to remove duplication between the getWindowsFragment and getTabsFragment function of RecentlyClosedTabsAndWindowsMenuUtils

Categories

(Firefox :: Session Restore, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 52
Tracking Status
firefox52 --- fixed

People

(Reporter: jaws, Assigned: davidmalaschonok, Mentored)

References

Details

(Whiteboard: [see comment #8 for tips to get started on this bug][good first bug][lang=js][outreachy-12])

Attachments

(1 file, 3 obsolete files)

Blocks: 888572
No longer depends on: 888572
Whiteboard: [good first bug][mentor=jaws][lang=js] → [good first bug][mentor=jaws][lang=js] [Australis:M-]
After you make changes to the file, you can run `./mach build browser/components/sessionstore` and then `./mach run` to run the browser. To run the sessionstore tests you can run `./mach mochitest-browser browser/components/sessionstore/test/`. You should join #introduction on irc.mozilla.org to get more detailed help.
Mentor: jaws
Whiteboard: [good first bug][mentor=jaws][lang=js] [Australis:M-] → [good first bug][lang=js] [Australis:M-]
Flags: needinfo?(aveek1)
Whiteboard: [good first bug][lang=js] [Australis:M-] → [good first bug][lang=js][outreachy-12]
The file is located at /browser/components/sessionstore/RecentlyClosedTabsAndWindowsMenuUtils.jsm Inside of the file you will find two functions that look very similar, getTabsFragment and getWindowsFragment. The goal of this bug is to reduce duplication between those two functions by pulling out similar code to some shared functions.
There is no UX branch anymore. You should clone mozilla-central at https://hg.mozilla.org/mozilla-central. Then you can run `./mach build`. Follow the instructions at https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Simple_Firefox_build to get started.
Whiteboard: [good first bug][lang=js][outreachy-12] → [see comment #8 for tips to get started on this bug][good first bug][lang=js][outreachy-12]
I have created a new function by pulling out the similar parts in the two functions. I built it and ran the code. But I want to test the functionality of the parts I have changed. How can I do that?
Flags: needinfo?(jaws)
(In reply to Harithaki from comment #12) > I have created a new function by pulling out the similar parts in the two > functions. I built it and ran the code. But I want to test the functionality > of the parts I have changed. How can I do that? 1. Open up some windows and go to some web pages in them. Now close those windows. Open up some tabs and go to some webpages in them. Now close those tabs. 2. Open the Firefox menu and click on the History button 3. Look at the Recently Closed Windows and Recently Closed Tabs in the menu. The items in the menu should match the windows and tabs that you just closed.
Flags: needinfo?(jaws)
Comment on attachment 8803080 [details] Bug 926579 - Remove duplication in RecentlyClosedTabsAndWindowsMenuUtils through refactoring. https://reviewboard.mozilla.org/r/87304/#review86572 This looks really great! Please make the following changes and re-push to mozreview and I'll land this for you. Thanks! There are a few lines that have trailing whitespace that got introduced with this patch. Please remove all trailing whitespace in this file. ::: browser/components/sessionstore/RecentlyClosedTabsAndWindowsMenuUtils.jsm:115 (Diff revision 1) > function setImage(aWindow, aItem, aElement) { > let iconURL = aItem.image; > // don't initiate a connection just to fetch a favicon (see bug 467828) > if (/^https?:/.test(iconURL)) > iconURL = "moz-anno:favicon:" + iconURL; > > aElement.setAttribute("image", iconURL); > } note, aWindow is unused in this function so it can be removed from the list of arguments. ::: browser/components/sessionstore/RecentlyClosedTabsAndWindowsMenuUtils.jsm:141 (Diff revision 1) > +function createEntry(aTagName, aIsWindowsFragment, aIndex, aClosedTab, > + aWindow, aMenuLabel, aFragment) { > + let doc = aWindow.document; Since we don't need to pass aWindow to setImage anymore, we can change createEntry to take `document` as the argument instead of `window`. Same for createRestoreAllEntry.
Attachment #8803080 - Flags: review?(jaws) → review+
Assignee: nobody → davidmalaschonok
Status: NEW → ASSIGNED
Comment on attachment 8803423 [details] Bug 926579 #2 - Remove unused parameters in RecentlyClosedTabsAndWindowsMenuUtils. https://reviewboard.mozilla.org/r/87702/#review86702 Thanks! I'll merge these two patches and push them to the fx-team repo. After this lands in fx-team, it will get merged to mozilla-central in a day or two. The next day this change will appear in Firefox Nightly. Thanks for your help and very well written patches!
Attachment #8803423 - Flags: review?(jaws) → review+
Comment on attachment 8803485 [details] Bug 926579 - Remove duplication in RecentlyClosedTabsAndWindowsMenuUtils through refactoring. https://reviewboard.mozilla.org/r/87742/#review86710
Attachment #8803485 - Flags: review?(jaws) → review+
Attachment #8803423 - Attachment is obsolete: true
Attachment #8803080 - Attachment is obsolete: true
Attachment #8774114 - Attachment is obsolete: true
Pushed by jwein@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/da1b726ffaee Remove duplication in RecentlyClosedTabsAndWindowsMenuUtils through refactoring. r=jaws
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 52
Thanks for the patch David. Would you like to work on bug 552434 next? I think you'd be well suited since you were able to handle this bug pretty quickly.
Flags: needinfo?(davidmalaschonok)
Thank you for pointing me at it. I'll definitely give it a shot.
Flags: needinfo?(davidmalaschonok)
Depends on: 1313876
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: