Hey guys,
I’m having an issue with one of my addons.
Worked just fine for more than a year, but stopped doing so probably with a recent Firefox update I guess…
What I’m essentially doing is, highlighting a string within a web page, selecting from a right click context menu and passing the highlighted string towards a registry call which calls a windows batch file:
var menuItem = contextMenu.Item({
label: “SQLPlus system”,
context: contextMenu.SelectionContext(),
contentScript: ‘self.on(“click”, function () {’ +
’ var text = window.getSelection().toString();’ +
’ self.postMessage(text);’ +
’});’,
onMessage: function (selectionText){
var index = tabs.activeTab.index;
tabs.open(“sqlpluscmd://”+selection.text.trim()+"/");
//console.log('active: ’ + tabs.activeTab.url);
tabs.activeTab.close();
tabs.activeTab.index = index;
}});
Now… as mentioned, that worked just fine. Until a couple of weeks ago. The tab being closed isn’t the opened one anymore, in this case “sqlpluscmd://”+selection.text.trim()+"/", but the one where I highlighted the string in!!!
For better explenation…
- tab0 a string is highlighted
- tab1 gets opened with url “sqlpluscmd://”+selection.text.trim()+"/"
- tab1 is the active tab since it’s called with tabs.open
- tabs.activeTab.close() kicks in, but closes tab0 instead of tab1
- tab1 stays untouched an active
And since that isn’t enough already, randomly it still closes tab0, as supposed to.
Can’t get a grabb on it… even tried making actively tab1 the active one with something like this:
tabs.open({
url: “sqlpluscmd://”+selection.text.trim()+"/",
onOpen: function onOpen(tab) {
tab.activate();
//console.log(“Tab acivated”);
}
});
Does anyone have a clue what’s going on, what has changed, what I’m doing wrong??
Appriciate any help since that addon is making my daily life at work a looot easier!!
Cheers
David