firefox-addon-sdk

How to open file in Mozilla Add-on SDK using system default application

假如想象 提交于 2020-05-01 07:23:27
问题 Is there any way to initiate opening file in system default application in Add-on SDK environment, or at least in Firefox plugin in general? I'm looking for multi-platform solution, so I'd rather avoid things like platform detection + require("sdk/system/child_process").exec() + ( open , xdg-open , RUNDLL32.EXE SHELL32.DLL,OpenAs_RunDLL ). Something like Desktop#open from Java world would be ideal. 回答1: The solution is method nsIFile#launch(). Instance of nsIFile based on file path can be

How to open file in Mozilla Add-on SDK using system default application

落爺英雄遲暮 提交于 2020-05-01 07:23:08
问题 Is there any way to initiate opening file in system default application in Add-on SDK environment, or at least in Firefox plugin in general? I'm looking for multi-platform solution, so I'd rather avoid things like platform detection + require("sdk/system/child_process").exec() + ( open , xdg-open , RUNDLL32.EXE SHELL32.DLL,OpenAs_RunDLL ). Something like Desktop#open from Java world would be ideal. 回答1: The solution is method nsIFile#launch(). Instance of nsIFile based on file path can be

Mozilla “Jetpack” Add-On: Anchor Panel to Widget

一世执手 提交于 2020-02-20 06:15:28
问题 I'm making a Jetpack extension in which a widget opens a panel. Clicking the widget opens the panel as expected (anchored in the lower-right corner to the widget). But if I call widget.panel.show() from my code, the panel opens detached from the widget, centered in the screen, floating in space. In short, how can I fix this? Can I simulate a click event on the widget (somehow) instead of calling widget.panel.show()? Can I force the panel to anchor to the widget? This question has a solution

Why the addone button is lost when I enable panel code?

亡梦爱人 提交于 2020-02-06 11:22:13
问题 Once the require("sdk/panel").Panel code is enabled, I cannot find the addone button, even cannot find it in customize page, what's wrong? var buttons = require('sdk/ui/button/action'); var tabs = require("sdk/tabs"); var data = require("sdk/panel").data; // var okentry=require("sdk/panel").Panel({ // contentURL: data.url("okentry.html"), // contentScriptFile: data.url("okentry.js") // }); var button = buttons.ActionButton({ id: "test-panel", label: "ok", icon: { "16": "./icon-16.png", "32":

Why the addone button is lost when I enable panel code?

爷,独闯天下 提交于 2020-02-06 11:22:09
问题 Once the require("sdk/panel").Panel code is enabled, I cannot find the addone button, even cannot find it in customize page, what's wrong? var buttons = require('sdk/ui/button/action'); var tabs = require("sdk/tabs"); var data = require("sdk/panel").data; // var okentry=require("sdk/panel").Panel({ // contentURL: data.url("okentry.html"), // contentScriptFile: data.url("okentry.js") // }); var button = buttons.ActionButton({ id: "test-panel", label: "ok", icon: { "16": "./icon-16.png", "32":

Firefox port.emit and port.on not working in extension

ぐ巨炮叔叔 提交于 2020-02-04 04:09:24
问题 I am trying to make a firefox extension. I need to exchange data with the background script(main.js) so I am trying to use port but it doesn't work. //Content.js self.port.on("alert",function(){alert()});//Listen to message self.port.emit("message",{message:"Hello"}); And in the main.js this is how I add the worker. So bascically, when the content script sends "message", the background script sends "alert" and the content script alerts. That doesn't happen //main.js pageMod.PageMod({ include:

Firefox port.emit and port.on not working in extension

青春壹個敷衍的年華 提交于 2020-02-04 04:07:49
问题 I am trying to make a firefox extension. I need to exchange data with the background script(main.js) so I am trying to use port but it doesn't work. //Content.js self.port.on("alert",function(){alert()});//Listen to message self.port.emit("message",{message:"Hello"}); And in the main.js this is how I add the worker. So bascically, when the content script sends "message", the background script sends "alert" and the content script alerts. That doesn't happen //main.js pageMod.PageMod({ include:

Firefox extension observing response

一笑奈何 提交于 2020-02-02 15:03:09
问题 I am trying using code // This is an active module of the goelvivek (8) Add-on exports.main = function() { var httpRequestObserver = { observe: function(subject, topic, data) { if (topic == "http-on-examine-response") { if(console) console.log(data); } } }; var {Cc, Ci, Cr} = require("chrome"); var observer = require("observer-service"); observerService = Components.classes["@mozilla.org/observer-service;1"]. getService(Components.interfaces.nsIObserverService); observerService.addObserver

FireFox SDK keydown / keyup events

隐身守侯 提交于 2020-01-30 07:54:05
问题 Is it possible to track keydown/keyup events in FireFox addons? I would like to implement something similar as following scenario: After pressing and holding the modifier key panel appears While holding these modifier keys, pressing the other keys will cause some actions with the panel When modifier key released, the panel disappears 回答1: You would need to register your event listener in each browser window for that. The high-level SDK API don't give you direct access to the browser window

How to flush a socket in my code

孤者浪人 提交于 2020-01-26 02:30:20
问题 I'm writing through a socket from a FF add-on to a java server. I write several requests and the server seems to process them one-by-one. In contrast, the responses from the server are processed all at the same time. I've tried flushing the out stream in the server but it does nothing. I don't understand what's going on. I appreciate any help, thank you. EDIT1: May be the add-on (client) is not flushing the input stream, is that possible? I'm using in the java server the out.println so the '