firefox-addon-sdk

Addon SDK error getting devtools module

。_饼干妹妹 提交于 2020-01-04 09:29:14
问题 I'm adding this code to a Addon-SDK addon: var {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); var {WebConsoleFrame} = devtools.require("devtools/webconsole/webconsole"); Although this works in a normal (old style) addon, with cfx run I get: ModuleNotFoundError: unable to satisfy: require(devtools/webconsole/webconsole) from (thefilename.js) To clarify, I'm trying to add those 2 lines into here: https://github.com/DavidBruant/usefulStackTrace/blob/master/lib

Firefox addon(JPM) - How to pass message from panel's script to content script?

 ̄綄美尐妖づ 提交于 2020-01-04 07:03:53
问题 Im trying to send a click event from panels script(popup.js) to content script(content.js) hers the code that i've tried.and the desired output isnt printing on the console. popup.html <button id="start-btn" onclick="myFunction()">Clip</button> popup.js function myFunction() { addon.port.emit('message', 'hello world'); } content.js self.port.on("message", function(text) { console.log(text); }); index.js(main) var panels = require("sdk/panel"); var self = require("sdk/self"); var data =

Adding background scripts to a firefox add-on

放肆的年华 提交于 2020-01-03 19:32:15
问题 I want to add a file(background.js) which is a background script for my firefox extension. I added content scripts to my main.js using the following code. var panel = panels.Panel({ contentURL: self.data.url("panel.html"), onHide: handleHide, contentScriptFile: [self.data.url("js/jquery.js"), self.data.url("tipsy/jquery.tipsy.js"),, self.data.url("js/settings.js")] }); How do I add background scripts to the main.js file. 回答1: Simply place the file in the lib folder. Except for scripts that

Get content of some file in Firefox SDK main.js

本小妞迷上赌 提交于 2020-01-03 17:15:58
问题 So I'm developing a Firefox addon that adds a bit of HTML to the DOM of any webpage. The idea here is that I'm using a file called template.html as a template, that is located in the data folder inside the addon folder. Next, I would like to use the contents of that template.html file inside a variable, so that I can append it to the DOM. myAddon/data/template.html: <div>{{test}}</div> myAddon/lib/main.js: var template = ... // This is where I want to fetch the contents of template.html.

Override Firefox Insecure Warnings with about:config

半腔热情 提交于 2020-01-02 08:41:06
问题 I am trying to write a simple batch script to take some screenshots of internal webpages on my end and came across the fact that firefox has this ability to render the window to canvas: var canvas = document.createElement('canvas'); var ctx = canvas.getContext("2d"); ctx.drawWindow(window, 0,0, 100, 200, "rgb(255,255,255)"); console.log(canvas.toDataURL("image/png")); However, this seems to be reserved only form extensions and throws an Error: The operation is insecure. I don't need to

Open XUL in a new tab/window using Addon-SDK

纵饮孤独 提交于 2020-01-02 07:14:24
问题 It seems possible according to https://developer.mozilla.org/en-US/Add-ons/SDK/Guides/XUL_Migration_Guide: you can register a chrome: URI, with a skin and locale, and this means you can include XUL windows in an SDK-based add-on. I added a chrome.manifest as instructed with content: content my_addon content/ and put .xul file under chrome/content: myxul.xul then I use tabs.open in main.js: tabs.open("chrome://my_addon/content/myxul.xul"); It returns "File not found" as the new tab is opened:

Firefox Extension/Addon - Detect workspace locked

痴心易碎 提交于 2020-01-02 07:04:33
问题 I'm searching for a solution in my firefox addon to detect when the user workspace has locked/released. In google chrome there is an easy API chrome.idle.onStateChanged.addListener for it, is there something similar in firefox or any possibility to do that, platform independent? By the way, I use the addon sdk. I've already tried the idle service: Cc["@mozilla.org/widget/idleservice;1"].getService(Ci.nsIIdleService) but I just gives me access to some idle timeout or system when go to sleep

Firefox Extension/Addon - Detect workspace locked

你说的曾经没有我的故事 提交于 2020-01-02 07:03:49
问题 I'm searching for a solution in my firefox addon to detect when the user workspace has locked/released. In google chrome there is an easy API chrome.idle.onStateChanged.addListener for it, is there something similar in firefox or any possibility to do that, platform independent? By the way, I use the addon sdk. I've already tried the idle service: Cc["@mozilla.org/widget/idleservice;1"].getService(Ci.nsIIdleService) but I just gives me access to some idle timeout or system when go to sleep

How to programmatically move a tab to another window in a firefox Addon-SDK extension?

删除回忆录丶 提交于 2020-01-02 06:30:33
问题 While it looks like you can change the order of a tab within a window by updating the tab .index property, it doesn't look like the tabs api directly supports the move of a tab to another window. Am I missing something? Is there a viable workaround? 回答1: It is possible through the low level module window/utils . The example below duplicates the active tab across every open window const { getMostRecentBrowserWindow, windows: getWindows } = require("sdk/window/utils"); const { ActionButton } =

How can I use XMLHttpRequest from main.js in a Firefox addon sdk extension. (or something similar) [duplicate]

牧云@^-^@ 提交于 2020-01-02 05:44:07
问题 This question already has answers here : XMLHttpRequest in Firefox Extension (3 answers) Closed 3 years ago . I have a Firefox extension that needs to check for the onUnload event. Basically I want to send a message to my server when the user disables the extension. What I tried doing, was to send a message to one of my content scripts, which would then call XMLHttpRequest. This works fine for any other event the extension triggers, but it would appear that the content scripts get unloaded