[Pkg-mozext-commits] [tabmixplus] 07/34: Tab context menu "Open Links in New Tabs" does not work for about: pages and for chrome:// pages from extensions (NewsFox extension for example)
David Prévot
taffit at moszumanska.debian.org
Mon Jun 27 13:57:56 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository tabmixplus.
commit 7a5e4775f9297dd282042927a9893492adaee920
Author: onemen <tabmix.onemen at gmail.com>
Date: Tue Jun 7 21:09:03 2016 +0300
Tab context menu "Open Links in New Tabs" does not work for about: pages and for chrome:// pages from extensions (NewsFox extension for example)
---
chrome/content/scripts/content.js | 18 +++++-------------
modules/ContextMenu.jsm | 5 ++++-
modules/Utils.jsm | 8 ++++++++
3 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/chrome/content/scripts/content.js b/chrome/content/scripts/content.js
index 2ca0b0b..a111fdd 100644
--- a/chrome/content/scripts/content.js
+++ b/chrome/content/scripts/content.js
@@ -228,9 +228,10 @@ TabmixClickEventHandler = {
// see getHrefFromNodeOnClick in tabmix's ContentClick.jsm
// for the case there is no href
let linkNode = href ? node : LinkNodeUtils.getNodeWithOnClick(event.target);
- if (linkNode)
- linkNode = LinkNodeUtils.wrap(linkNode, this._focusedWindow,
- href && event.button === 0);
+ if (linkNode) {
+ linkNode = LinkNodeUtils.wrap(linkNode, TabmixUtils.focusedWindow(content),
+ href && event.button === 0);
+ }
let result = sendSyncMessage("TabmixContent:Click",
{json: json, href: href, node: linkNode});
@@ -348,14 +349,6 @@ TabmixClickEventHandler = {
return [href ? BrowserUtils.makeURI(href, null, baseURI).spec : null, null,
node && node.ownerDocument.nodePrincipal];
},
-
- get _focusedWindow() {
- let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
-
- let focusedWindow = {};
- fm.getFocusedElementForWindow(content, true, focusedWindow);
- return focusedWindow.value;
- }
};
var AboutNewTabHandler = {
@@ -407,8 +400,7 @@ var ContextMenuHandler = {
}
let links;
- if (TabmixSvc.prefBranch.getBoolPref("openAllLinks") &&
- typeof content.document.getSelection == "function") {
+ if (TabmixSvc.prefBranch.getBoolPref("openAllLinks")) {
links = ContextMenu.getSelectedLinks(content).join("\n");
}
diff --git a/modules/ContextMenu.jsm b/modules/ContextMenu.jsm
index c074c1e..c3cfdc1 100644
--- a/modules/ContextMenu.jsm
+++ b/modules/ContextMenu.jsm
@@ -9,11 +9,14 @@ Cu.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TabmixSvc",
"resource://tabmixplus/Services.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "TabmixUtils",
+ "resource://tabmixplus/Utils.jsm");
this.ContextMenu = {
getSelectedLinks: function(content, check) {
let doc = content.document;
- let selectionObject = doc.getSelection();
+ // get focused window selection
+ let selectionObject = TabmixUtils.focusedWindow(content).getSelection();
if (selectionObject.isCollapsed) // nothing selected
return [];
diff --git a/modules/Utils.jsm b/modules/Utils.jsm
index f3b3369..9430495 100644
--- a/modules/Utils.jsm
+++ b/modules/Utils.jsm
@@ -103,6 +103,14 @@ this.TabmixUtils = {
return null;
},
+ focusedWindow: function(content) {
+ let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
+
+ let focusedWindow = {};
+ fm.getFocusedElementForWindow(content, true, focusedWindow);
+ return focusedWindow.value;
+ },
+
makeInputStream: function(aString) {
let stream = Cc["@mozilla.org/io/string-input-stream;1"]
.createInstance(Ci.nsISupportsCString);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git
More information about the Pkg-mozext-commits
mailing list