firefox-addon-sdk

jsonp callback error

感情迁移 提交于 2019-12-23 12:19:26
问题 I'm using firefox addon builder. Running this code errors with "callback is not defined" function callback(data) { window.alert(data.status); } $.ajax({ url: "http://apps.compete.com/sites/google.com/trended/rank/?apikey=210e634a0b3af972daa908a447c735c1&start_date=201112&end_date=201112&jsonp=?", dataType: "jsonp", jsonp: "jsonp", jsonpCallback: "callback" }); This is the api documentation: https://www.compete.com/developer/documentation/ 回答1: I'm assuming that you are running this from a

firefox extension works through sdk but not when installed in browser - compatibility issue?

℡╲_俬逩灬. 提交于 2019-12-23 08:56:57
问题 ---Update---- After experimenting more with this, I've determined that the contentScript I have written is not the problem here. For example, if I reduce the extension to merely: var buttons = require('sdk/ui/button/action'); var data = require("sdk/self").data; var self = require("sdk/self"); var button = buttons.ActionButton({ id: "library-link", label: "External Resource Locator", icon: self.data.url("icon-16.png"), }); The button will still appear when I run the extension through the SDK,

How to share code between content script and addon?

↘锁芯ラ 提交于 2019-12-23 08:54:04
问题 I'm writing an extension for Firefox 4+. I have some code in a file named utils.js which I'd like to call from both the addon's main.js and from the page-mod 's content script. Is it possible to refer from both to the same utils.js ? If so, how? Edit: Even better would be a solution allowing me to use the same code in a Google Chrome extension, too. 回答1: I've run into this same problem. You'd think there'd be an obvious solution. Here's what I've been doing for firefox (haven't worked with

Override web page's javascript function using firefox addon sdk

余生长醉 提交于 2019-12-23 02:04:18
问题 I'm trying to override a JS function named replaceMe in the web page from my add-on's content script, but I see that the original function implementation always gets executed. Original HTML contains the following function definition: function replaceMe() { alert('original'); } I'm trying to override it my add-on like ( main.js ): tabs.activeTab.attach({ contentScriptFile: self.data.url("replacerContent.js") }); Here's what my replacerContent.js looks like: this.replaceMe = function() { alert(

how to show a preference page using mozilla Add-on SDK?

前提是你 提交于 2019-12-22 12:19:34
问题 I am developing an extension using the Addon-SDK. I want to show a preference page in order to get some users' configuration. simple-prefs is too simple to use as its supported data type is so limited. In a XUL app, I can use the following <em:optionsType>3</em:optionsType> <em:optionsURL>chrome://myaddon/content/options.html</em:optionsURL> to set my preference page. I found the XUL migration guide which says: This is provided only as a migration aid, and it's still a good idea to port XUL

List all drives using Firefox Addon SDK

吃可爱长大的小学妹 提交于 2019-12-22 11:16:33
问题 Is there a cross-OS way to list the paths of all mounted drives (harddisks, usb-drives, etc.) using the firefox addon sdk? I found this code for Windows but i couldn't find a cross-OS solution: Components.utils.import("resource://gre/modules/FileUtils.jsm"); var root = new FileUtils.File("\\\\."); var drivesEnum = root.directoryEntries, drives = []; while (drivesEnum.hasMoreElements()) { drives.push(drivesEnum.getNext(). QueryInterface(Components.interfaces.nsILocalFile).path); } Source:

Locale string comparison does not work properly in Firefox extension web worker

回眸只為那壹抹淺笑 提交于 2019-12-22 07:58:35
问题 The localeCompare() function does not behave the same in a Firefox extension main code and in a web worker (or chrome worker). For instance, in the main code, I have this code: var array = ["École", "Frère", "frère", "école"]; array.sort(function(a, b) { return a.localeCompare(b); }); console.log('Main: ' + array); it shows: Main: �cole,�cole,Fr�re,fr�re Which is the right sorting (the encoding is not my problem). In the worker, I have this code: var array = ["École", "Frère", "frère", "école

Changing Firefox addon install icon

喜欢而已 提交于 2019-12-22 04:55:15
问题 I'm working on developing a Firefox add-on using the Add-on SDK. I changed my package.json file to include entries for a 32x32 icon and a 64x64 icon. { ... "icon": "icons/icon-32.png", "icon64": "icons/icon-64.png", ... } Furthermore, I placed icon-32.png and icon-64.png in the directory icons inside my package directory before running cfx xpi inside the package directory. The icons correctly display in the addon manager from Tools > Add-ons , but the installation dialog still uses a puzzle

Get outerWindowID from inner-window-destroyed

血红的双手。 提交于 2019-12-21 23:25:16
问题 Part of the Firefox extension I'm building gets the ID of 'inner windows' being destroyed, like this - observer.add('inner-window-destroyed', function (subject, data) { var innerWindowID = subject.QueryInterface(Ci.nsISupportsPRUint64).data; console.log('destroyed: '+innerWindowID); }) This works OK, but I'd like to know if that observer can also get the ID of that inner window's outer window. I can get an outerWindowID from another channel observer in my code, but I'm not sure how to get it

Error Installing Firefox Addon SDK Python

穿精又带淫゛_ 提交于 2019-12-21 19:23:33
问题 Hello im trying to figure out how to properly install Firefox Addon SDK, I've followed all the installation details such as: Installing Python 2.7, setting my PATH Variables correctly, and running the addon from my cmd.exe .. Everytime I run the command line to start developing an addon I get this error: C:\mozilla-build\addon-sdk\bin>activate.bat Warning: Failed to find Python installation directory IFrom my understanding I have everything properly configured, Can anyone help with this error