mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1009351 - Add link text to mozbrowser context menu data. r=smaug
This commit is contained in:
parent
ada0098088
commit
dc42453d34
@ -13,6 +13,8 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/BrowserElementPromptService.jsm");
|
||||
|
||||
let kLongestReturnedString = 128;
|
||||
|
||||
// Event whitelisted for bubbling.
|
||||
let whitelistedEvents = [
|
||||
Ci.nsIDOMKeyEvent.DOM_VK_ESCAPE, // Back button.
|
||||
@ -695,7 +697,8 @@ BrowserElementChild.prototype = {
|
||||
_getSystemCtxMenuData: function(elem) {
|
||||
if ((elem instanceof Ci.nsIDOMHTMLAnchorElement && elem.href) ||
|
||||
(elem instanceof Ci.nsIDOMHTMLAreaElement && elem.href)) {
|
||||
return {uri: elem.href};
|
||||
return {uri: elem.href,
|
||||
text: elem.textContent.substring(0, kLongestReturnedString)};
|
||||
}
|
||||
if (elem instanceof Ci.nsIImageLoadingContent && elem.currentURI) {
|
||||
return {uri: elem.currentURI.spec};
|
||||
|
@ -25,6 +25,10 @@ function checkInnerContextMenu() {
|
||||
sendContextMenuTo('#inner-link', function onContextMenu(detail) {
|
||||
is(detail.systemTargets.length, 1, 'Includes anchor data');
|
||||
is(detail.contextmenu.items.length, 2, 'Inner clicks trigger correct menu');
|
||||
var target = detail.systemTargets[0];
|
||||
is(target.nodeName, 'A', 'Reports correct nodeName');
|
||||
is(target.data.uri, 'foo.html', 'Reports correct uri');
|
||||
is(target.data.text, 'Menu 1', 'Reports correct link text');
|
||||
|
||||
checkCustomContextMenu();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user