Closed Bug 627065 Opened 13 years ago Closed 13 years ago

"Copy Link Location" doesn't work on links on pages open in the sidebar

Categories

(Firefox :: General, defect)

defect
Not set
major

Tracking

()

VERIFIED FIXED
Tracking Status
blocking2.0 --- final+

People

(Reporter: mayhemer, Assigned: enndeakin)

References

Details

(Keywords: regression, Whiteboard: [softblocker])

Attachments

(1 file, 2 obsolete files)

The link address is not copied to clipboard.

No idea of a regression range but I first noted that a long ago, just didn't get to report it.
Summary: "Copy Link Location" doesn't work on links on pages open in sidebars → "Copy Link Location" doesn't work on links on pages open in the sidebar
Mozilla/5.0 (Windows NT 6.1; rv:2.0b10pre) Gecko/20110119 Firefox/4.0b10pre

Able to reproduce. Copy link location does not work when loaded the web pages in windows sidebar. 
Works fine in Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.14pre) Gecko/20110119 Namoroka/3.6.14pre
works: 
Mozilla/5.0 (Windows NT 6.1; rv:2.0b4pre) Gecko/20100809 Minefield/4.0b4pre

broken: 
Mozilla/5.0 (Windows NT 6.1; rv:2.0b4pre) Gecko/20100810 Minefield/4.0b4pre

Pushlog : 
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=fb0c72c4bfb3
&tochange=905529619219
Aravind, if this is simple to fix, we should get it to Fx4 as it is a regression from 3.6.
blocking2.0: --- → ?
Regression -> softblocker.
blocking2.0: ? → final+
Whiteboard: [softblocker]
Attached patch Proposal patch (obsolete) — Splinter Review
I'm not sure whether this is best fix but works fine for me.

http://tbpl.mozilla.org/?tree=MozillaTry&rev=ebc8dbbe674b
Attachment #509440 - Flags: review?(dao)
What regressed this?
Oops, the previous push includes another patch.
http://tbpl.mozilla.org/?tree=MozillaTry&rev=fc17e9e87493

(In reply to comment #6)
> What regressed this?

I can see this error.
> Error: An error occurred executing the cmd_copyLink command: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIController.isCommandEnabled]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: chrome://global/content/globalOverlay.js :: goDoCommand :: line 95"  data: no]
> Source File: chrome://global/content/globalOverlay.js
> Line: 100

And only the copy link location uses goDoCommand() rather than gContextMenu.
Right, but which changeset caused this regression?
http://mxr.mozilla.org/mozilla-central/source/layout/base/nsDocumentViewer.cpp#3290
> 3290             node = pm->GetLastTriggerPopupNode(rootDoc);

this result is null, this is the cause of NS_ERROR_FAILURE.

I suspect http://hg.mozilla.org/mozilla-central/rev/ed8906789d08
Blocks: 383930
[Seems to work OK in SeaMonkey's sidebar. Don't know what would be different.]
Comment on attachment 509440 [details] [diff] [review]
Proposal patch

We should fix the real probelem here.
Attachment #509440 - Flags: review?(dao) → review-
Assignee: nobody → enndeakin
Status: NEW → ASSIGNED
The sidebar is in a child frame and has its own context menu implementation. The document viewer commands assume that the context menu is defined in the toplevel window.

Note that this works in Seamonkey's sidebar as it just uses an overlay and one context menu.
Attached patch fix (obsolete) — Splinter Review
I don't really like setting popupNode, but this should be ok for now.
Attachment #509440 - Attachment is obsolete: true
Attachment #509769 - Flags: review?(dao)
hm, once you set popupNode it stops returning the last opened popup till you clear it. I expect this change to break most of Places context menu items.
If the context menu has a non-null triggerNode, popupNode will be cleared when the context menu is closed.
And what happens in the other case? We rely on popupNode being the last open popup, if this change hits any code path that doesn't clear it, we have broken a bunch of menuitems to save one.
I think we should not rely on setting popupNode and fight to make it read-only asap (at a maximum allow to set it to null), it's really easy to break stuff by setting it.
(In reply to comment #16)
> And what happens in the other case?

What other cases?
Attachment #509769 - Flags: review?(dao) → review+
(In reply to comment #17)
> What other cases?

I was mostly worried about add-ons preventing popupshowing or adding something that could throw during the event propagation. In those cases the menu will be hosed in the sidebar, that was looking like a larger cost than the benefit.
I still think we should make popupNode a readonly attribute, as is triggerNode.
(In reply to comment #18)
> (In reply to comment #17)
> > What other cases?
> 
> I was mostly worried about add-ons preventing popupshowing

I guess the patch should reset document.popupNode to null for gContextMenu.shouldDisplay == false.
Comment on attachment 509769 [details] [diff] [review]
fix

Shouldn't you set the popupNode after you've determined that it's the popup itself that's showing and not one of its submenus?
(In reply to comment #19)
> I guess the patch should reset document.popupNode to null for
> gContextMenu.shouldDisplay == false.

I'll look into this.


(In reply to comment #20)
> Shouldn't you set the popupNode after you've determined that it's the popup
> itself that's showing and not one of its submenus?

That shouldn't affect the outcome but I'll make that change any way.
Attached patch patchSplinter Review
Like so. Also includes test.
Attachment #509769 - Attachment is obsolete: true
Attachment #510329 - Flags: review?(dao)
Comment on attachment 510329 [details] [diff] [review]
patch

>+  EventUtils.synthesizeMouse(link, 5, 5, { type: "contextmenu", button: 2 }, browser.contentWindow);

Use synthesizeMouseAtCenter?
Attachment #510329 - Flags: review?(dao) → review+
http://hg.mozilla.org/mozilla-central/rev/8e716006f397
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Verified using Mozilla/5.0 (Windows NT 6.1; rv:2.0b12) Gecko/20100101 Firefox/4.0b12.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: