firefox-addon-sdk

How to make a Firefox Extension URL Button show a string when hovered over

心不动则不痛 提交于 2019-12-17 16:56:16
问题 I have made my full FF extension, and there is a button in the URL bar. The boss now wants the button to show a certain string when you hover over it. Here is my current code for the button: var loadURLButton = function(doc, urlBtnClick) { var urlBarIcons = doc.getElementById('urlbar-icons') var btn = doc.createElement('toolbarbutton'); btn.setAttribute('id', 'urlbutton'); btn.setAttribute('image', require('sdk/self').data.url("canNone.png")); btn.addEventListener('command', urlBtnClick,

How do I use the canvas drawWindow function in an addon created using the addon sdk?

我的梦境 提交于 2019-12-17 16:27:02
问题 I've create a Firefox addon using the addon sdk. I'm trying to use the canvas drawWindow function. I've got the following code to use the function, where ctx refers to a canvas context, that I got with canvas.getContext("2d") . ctx.drawWindow(window, 0, 0, 100, 200, "rgb(255,255,255)"); When I run this code, within a script that is attached using tabs.activeTab.attach({ contentScriptFile: data.url("app.js") // app.js contains the above line of code }); I get the following error: TypeError:

can't debug hanging $.post in firefox extension

南笙酒味 提交于 2019-12-14 02:27:28
问题 I'm developing this extension https://builder.addons.mozilla.org/addon/1022928/latest/ The code central to this question is in Data/panel.js And it's working pretty well, except that whenever I hit "Gem" to post a jquery call, it just hangs at the loading icon, I don't get any feedback in the console as to why the call is not going through and being processed as it should. So how do I debug that with the new firefox add-on sdk builder beta. I've tried writing to console.log(), and I've read

How to allow addon's content script access Javascript variables from the current tab?

微笑、不失礼 提交于 2019-12-13 19:52:57
问题 Supposed my add-on has to access a Javascript variable from a webpage. Let's take https://mozilla.org. There is a global variable called optimizelyCode . My addon will only work if this variable is accessible. How do I let my pageMod do that? To experiment, here are some tutorial scripts: var widgets = require("sdk/widget"); var tabs = require("sdk/tabs"); var widget = widgets.Widget({ id: "mozilla-link", label: "Mozilla website", contentURL: "http://www.mozilla.org/favicon.ico", onClick:

Access selected text within a Hotkey object

拥有回忆 提交于 2019-12-13 17:45:54
问题 Is it possible to grab user's selected text within Hotkey 's scope? Defined in Addon/lib/main.js : var showHotKey = Hotkey({ combo: "accel-f1", onPress: function() { Addon.saveText(window.getSelection().toString()); } }); Error .. error: Addon: An exception occurred. ReferenceError: window is not defined resource://org/Addon/lib/main.js 14 Traceback (most recent call last): File "resource://gre/modules/commonjs/sdk/keyboard/observer.js", line 39, in handleEvent this._emit(event.type, event,

HTML5 File API in Firefox Addon SDK

吃可爱长大的小学妹 提交于 2019-12-13 14:21:02
问题 Is there a way to access Html5 file api in Fire Fox addon sdk in the content script? This is needed in order to store user added words and their meanings. The data can grow large and so local storage isn't an option. window.requestFileSystem3 = window.requestFileSystem || window.webkitRequestFileSystem; gives me the error TypeError: window.requestFileSystem3 is not a function . I am asking this because i am porting this code from a Google Chrome Extension which allows accessing the file api

Getting mouse coordinates in SDK first-time right-click

我只是一个虾纸丫 提交于 2019-12-13 07:35:55
问题 For an SDK add-on, I am trying to detect, on right-click, the closest page anchor (as described here). Since JavaScript apparently has no way to query the mouse coordinates without first creating a mouse event listener, and since I don't want an expensive mouseover listener running all of the time on every single page! (and polling to rebuild a mouse listener is ugly and not fully accurate anyways), I was hoping I could get the mouse coordinates from a click event. Unfortunately, although

How to Create XUL Toolbar via Javascript?

試著忘記壹切 提交于 2019-12-13 07:28:10
问题 With the coming of multi-process Firefox I have decided to re-write my addon using the Addon-SDK. My addon is mainly a toolbar with an extensive set of menus. The addonsdk does not provide any way to build menus. So I found this method by which I can add them to an existing toolbar. However, I cannot find any way to create menus like this and add them to an Addon-SDK toolbar. So I thought I would just create the toolbar the same way I am creating the menus. So, I am basically trying to create

How to Signing a Firefox Extension

允我心安 提交于 2019-12-13 05:22:42
问题 I want to signing the Firefox extension. I have search on internet regarding signing the extension and found the URL https://developer.mozilla.org/en/docs/Signing_a_XPI. I have gone through the instructions given in this site. But could not sign-in the extension. In my case signtool and certutil commands are not running. if anyone know the process of signing the Firefox extension then please let me know. Thanks. 回答1: The document you followed is for old developer-certificate signing and is

How do I delete cross site cookies with Firefox 22+ extension?

廉价感情. 提交于 2019-12-13 05:12:18
问题 I am attempting to add a function to my Firefox extension to trigger an event to delete cookies from site B when a button on site A is clicked. Site A and B do not share a domain but site B is running in an iframe injected into site A. I need the click event in the Firefox content script to trigger an event either in the content script or the Firefox extension main to delete all of the cookies from site B. I have the click listener assigned to the button and firing. I have already achieved