firefox-addon-sdk

JPM [error] Message: SyntaxError: duplicate label

折月煮酒 提交于 2019-12-11 23:32:46
问题 I'm working on a firefox extension and am getting this error message. What does it mean? The only label I have is from: require("sdk/ui/button/action").ActionButton({ id: "show-popup", label: "something that can't possibly be a duplicate", ... Later on I add a background page: require("sdk/page-worker").Page({ contentScript: [ ... some scripts ... ] }); While testing, I get the error: > jpm run -b $(which firefox) JPM [info] Starting jpm run on MyExtensionTitle JPM [info] Creating a new

Self.port is undefined

只谈情不闲聊 提交于 2019-12-11 20:54:35
问题 I have an iframe in popup.html,having id = Receiver, which receives and posts messages. The below code is from popup.js: self.port.on("show", function(title, url) { myApp.initialize(title, url); }); var arr = new Array(); var myApp = { initialize: function (url,title){ arr = []; arr.push(url); arr.push(title); var receiver = document.getElementById('Receiver').contentWindow; receiver.postMessage(arr, "*"); }, sendDetails : function(){ alert("arr :"+arr); }, closeIt : function(){ self.port

Firefox Addon that reacts on click (left)

China☆狼群 提交于 2019-12-11 19:43:55
问题 I am just started to create firefox add on. My first try was to capture the users left click event and display an alert. but this isn't working: window.addEventListener("click", function(e) { alert("blub"); }, false); i also tried it wit "gBrowser". At the end i want to analyze the target element and if it matches some criteria i want to open a new tab with a link generated from data from the target tag. for nearly all parts i found code snippets but first i need the simple click handling.

Firefox Addon SDK Hotkeys and context menu options don't work on Authentication Required Popup

房东的猫 提交于 2019-12-11 13:57:11
问题 I am developing an addon to securely store / retrieve information including user profiles and passwords (an interface to a password manager). It uses a button (or a hotkey) to take information from entry fields and store it. However this does not work on those sites which choose to popup an “Authentication Required” panel. If I add a context menu option to do the same thing this also does not work on that panel. Can anyone think of a way of triggering a function from that panel? 来源: https:/

Why is my add-on panel´s content script no longer responding to port messages after changing contentUrl?

柔情痞子 提交于 2019-12-11 13:26:28
问题 I am building a Firefox add-on using the addon-sdk. The add-on has one button that displays a panel on click. The panel has a content script running it. Now, I need the panel to look different depending on the user's current tab and occasionally show an external url. So, the main.js script tracks the current tab of the user and sends messages to the content script using panel.port.emit() and the content script changes the HTML of the panel to match whatever is needed. However, as I mentioned,

How to run on browser start

徘徊边缘 提交于 2019-12-11 12:59:08
问题 I'm new to Firefox addon development. I have the following code: var windows = require("sdk/windows").browserWindows; windows.on("open", function() { // do stuff }); But this only runs for windows created after the browser is started, not the first one. How can I fix this? I know I could just copy the code outside of the open event, but then it also runs when the addon is installed and I don't want that. 回答1: I found the answer here. exports.main = function (options, callbacks) { if (options

Copy to clipboard in Firefox extension not working

坚强是说给别人听的谎言 提交于 2019-12-11 12:50:33
问题 I want to write a Firefox extension, with copy to clipboard and execute an external program with selected text parameter. I have found this link MDN Using Clipboard for clipboard copy, but is not working. When I try to execute with cfx run always I get this error message (c:\Works\Firefox\addon-sdk-1.17) c:\Works\Firefox\ExternalOpener>cfx run The following lines from file c:\Works\Firefox\ExternalOpener\lib\main.js: 11: const gClipboardHelper = Components.classes["@mozilla.org/widget

firefox, how to get the content of location bar? (more words to pass censorship?)

江枫思渺然 提交于 2019-12-11 12:27:07
问题 I want get what I put in the address bar, such as "hello world", not: var url = tabs.activeTab.url // I don't want this before I press enter in the address bar. Is it possible to do it in an addon? 回答1: If you define this function in your add-on: function getURLBarText() { var { getMostRecentWindow } = require("sdk/window/utils"); var urlBar = getMostRecentWindow().document.getElementById('urlbar'); return urlBar.value; } Then calling getURLBarText() will return whatever is in your active

Firefox addon element abnormally flashing using CSS animation on Mac

我是研究僧i 提交于 2019-12-11 12:26:19
问题 The problem only happens on Mac: The 'Test Link' element flashes abnormally when used in a Firefox addon panel (sdk/panel) when compared to the JSFiddle demo despite they share the same source code. Firefox addon source code: https://drive.google.com/file/d/0BzHBWuszZv5_eWl1RTdIOW84NG8/view?usp=sharing to run download and unzip $ cd CSSFlashing3; cfx run Is there any workaround to the problem because who knows how long does it take for Mozilla to fix this? 来源: https://stackoverflow.com

Firefox ctypes.js cannot open a dll with dependencies

ε祈祈猫儿з 提交于 2019-12-11 10:56:21
问题 I have uploaded a project to Github to show the issue: https://github.com/EamonnLaffey/ctypes-test I am using ctypes.open() to load a dll that simply calls a function of a dependent dll which prints a message. Within the data folder of the extension are the two dlls. There is also an executable, test.exe calls the same function that the extension is trying to call to verify that it is working. To get the path of the dll I set "unpack": true in extension's package.json and call the following