Closed Bug 593645 Opened 15 years ago Closed 14 years ago

use popup.triggerNode instead of document.popupNode for tab context menu

Categories

(Firefox :: Tabbed Browser, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 12

People

(Reporter: fryn, Assigned: fryn)

References

Details

Attachments

(2 files, 2 obsolete files)

Since bug 383930 was fixed and according to Neil Deakin's blog post (http://enndeakin.wordpress.com/2010/08/08/status-update-for-august-7/), document.popupNode is now deprecated. Let's use the new popup.triggerNode instead.
Attachment #472216 - Flags: review?(dao)
Attachment #472216 - Flags: review?(dao) → review+
Attachment #472216 - Flags: approval2.0?
Dao, since we now only show the tab context menu on the tabs themselves, can we also get rid of TabContextMenu.contextTab and just directly use aPopupMenu.triggerNode?
That sounds like it would complicate code currently accessing TabContextMenu.contextTab without direct access to the popup node.
Attachment #472216 - Flags: approval2.0? → approval2.0+
turns out that some tests rely on being able to set document.popupNode arbitarily, so I'll have to fix the tests. Low priority, so I'll come back to this later.
Attachment #472216 - Flags: approval2.0+ → approval2.0-
Comment on attachment 472216 [details] [diff] [review] part 1 of 2 (wait for part 2 to check this in) (In reply to comment #4) Yeah, I warned about that. The tests shouldn't be using document.popupNode like that, even though it's the easy way. popup.triggerNode wasn't available then, so also no need to blame 'em. I'll get to this later.
Attachment #472216 - Attachment description: patch → part 1 of 2 (wait for part 2 to check this in)
Attached patch part 2 of 2: fix tests (obsolete) — Splinter Review
Attachment #579929 - Flags: review?
Comment on attachment 579929 [details] [diff] [review] part 2 of 2: fix tests oops, forgot to fill the requestee field.
Attachment #579929 - Flags: review? → review?(dao)
Comment on attachment 579929 [details] [diff] [review] part 2 of 2: fix tests >+ let tab = gBrowser.tabs[0]; >+ let menu = document.getElementById("tabContextMenu"); >+ menu.openPopup(tab, "end_after", 0, 0, true, false, {target: tab}); >+ TabContextMenu.updateContextMenu(menu); >+ menu.hidePopup(); Can you add a helper function for this in head.js?
Attachment #579929 - Flags: review?(dao)
Attached patch part 2 of 2: fix tests v2 (obsolete) — Splinter Review
(In reply to Dão Gottwald [:dao] from comment #8) ... > Can you add a helper function for this in head.js? Done.
Attachment #579929 - Attachment is obsolete: true
Attachment #589322 - Flags: review?(dao)
Added line to Makefile.in that I forgot.
Attachment #589322 - Attachment is obsolete: true
Attachment #589448 - Flags: review?(dao)
Attachment #589322 - Flags: review?(dao)
Comment on attachment 589448 [details] [diff] [review] part 2 of 2: fix tests v2 >+++ b/browser/base/content/test/browser_visibleTabs_contextMenu.js > function popup(tab) { >- document.popupNode = tab; >- TabContextMenu.updateContextMenu(document.getElementById("tabContextMenu")); >+ let menu = document.getElementById("tabContextMenu"); >+ menu.openPopup(tab, "end_after", 0, 0, true, false, {target: tab}); >+ TabContextMenu.updateContextMenu(menu); > is(TabContextMenu.contextTab, tab, "TabContextMenu context is the expected tab"); >- TabContextMenu.contextTab = null; >+ menu.hidePopup(); > } >+++ b/browser/base/content/test/head.js >+function updateTabContextMenu() { >+ let tab = gBrowser.selectedTab; >+ let menu = document.getElementById("tabContextMenu"); >+ menu.openPopup(tab, "end_after", 0, 0, true, false, {target: tab}); >+ TabContextMenu.updateContextMenu(menu); >+ menu.hidePopup(); >+} updateTabContextMenu can take an optional tab argument and integrate the test that popup() above is doing.
Attachment #589448 - Flags: review?(dao) → review+
Pushed with review comment addressed.
http://mxr.mozilla.org/mozilla-central/search?string=.popupNode&case=1 "Found 72 matching lines in 30 files" Should this bug (have) fix these too? Should they be fixed in a separate bug(s)? Should they not be fixed?
Blocks: 719739
Depends on: 383930
Flags: in-testsuite+
(In reply to Serge Gautherie (:sgautherie) from comment #15) Increased to "Found 106 matching lines in 47 files".
Flags: needinfo?(fryn)
Flags: needinfo?(fryn)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: