firefox-addon,xul,mozilla,thunderbird,seamonkey , Should I specify the application when using the same XUL overlay?

Should I specify the application when using the same XUL overlay?


Tag: firefox-addon,xul,mozilla,thunderbird,seamonkey

Let's say I want to use a single overlay in three applications at the same time. Should I specify which line in the manifest file applies to which application? Here's an example of what I currently have:

overlay chrome://browser/content/browser.xul chrome://myaddon/content/commonOverlay.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
overlay chrome://messenger/content/mailWindowOverlay.xul chrome://myaddon/content/commonOverlay.xul application={3550f703-e582-4d05-9a08-453d09bdfdc6}
overlay chrome://navigator/content/navigator.xul chrome://myaddon/content/commonOverlay.xul application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}

Is it safe to omit the application flags, or is the best practice to be as explicit as in my example?


This depends on what your add-on is actually supporting via em:targetApplication.

Usually having an application= is not required, because there simply is no ambiguity.

The only case I can imagine where it actually would make sense, would be if your add-on supported two different applications, which both have e.g. a chrome://browser/content/browser.xul but you only want to overlay Firefox but not the other application. There you'd need to be explicit.


firefox extension: intercepting url it is requesting and blocking conditionally

in firefox extension I want to intercept the url browser is making request to and block the request entirely if some condition matches how can I intercept URL being requested...

Incorrect scope for eval

I have this code eval(script); where script is: var script = console.log('xwin:', xwin); however it keeps telling me that xwin is undefined, anyone know why eval is not taking the functions scope? Anyone know how to make it?...

HTML transient modal window

We have a legacy web application. At various places it opens a window with the help of Privilege Manager on Firefox to get the needed result. Some of these windows open a Java applet or a PDF document. The client machines are updating Firefox and Privilege Manager is gone. What...

Is there an API to control downloads in Firefox add-on SDK?

In Firefox, is there an API equivalent to Google Chrome's chrome.downloads API? I need to control downloads with functions such as pause, resume, and cancel. In addition, I want to be able to remove the downloaded file. If there is no API in Firefox add-on SDK, is it possible to...

File types change into .xml while downloading in Firefox

In my asp .net application we can upload doc files and after uploading files we can view it in browser. It is working in all browser, but there is one issue while view through Firefox, while clicking hyperlink view the file is being download, but file type changes into .xml...

Using the Web Crypto API from Firefox AddOn

I can't figure out how to access the Web Crypto API from an AddOn script itself (no documentation). Trying to do it from a content-script gives a permission error accessing then: JavaScript error: resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/loader/sandbox.js -> resource://..../data/content-script.js, line 36: Error: Permission denied to access property "then" The relevant code...

How to use modules in Firefox addon development

Trying to create a firefox addon that accesses the browser cookies. Following googled tutorials I've written the following function but looks like the Services.jsm is not accessible? Components.utils.import("resource://gre/modules/Services.jsm"); var myExtension = { myListener: function(evt) { //I get here alert("Received from web page: " +"attribute1") + "/" +"attribute2")); //I...

Can I put a button on the tab header using Firefox Add-on?

In a Firefox browser window, I would like to put a button on the tab header next to the web page title. Is this possible with a Firefox add-on? So far I am still unsure what to call this part of a tab. Sorry for duplicates! Edit: I didn't have...

XUL iframe firefox addon, how to change the src within the iframe?

I am developing a firefox addon, in my settings page dialog.xul i have an iframe where i load different settings pages page1.xul page2.xul page3.xul Iframe : <vbox flex="1"> <iframe id="iframe" src="chrome://xxx/content/page1.xul" flex="1"></iframe> </vbox> Within the iframe i need to navigate from page2.xul to page3.xul with the code in page2.xul My...

firefox addon - how to open this kind of window?

In firefox addon, I'm trying to create a popup like this for use in my addon - is it possible? If so, how's it done? Thanks in advance. ...

How to test google analytics in firefox browser?

As a part of Google analytics testing, i am testing the events fired, page view hits, conversions, label etc.. in firefox browser. I couldn't find great add-on's as i found in Google Chrome browser to test the attributes mentioned above . Can you let me know if there is any...

Manual adding firefox for android addon

I've got an firefox add-on, but I want to test before I upload it to the firefox add-on center.. Does anybody know if I can install the add-on (XPI file) on firefox for android? Thanks for help....

Mozilla Javascript Performance NEW OS.File vs OLD nsIFile over 3000 files

i have a directory that contains small XML files (every file is 170~200 bytes), and i want to read all content of every file and merge them in a single XML file, displayed in a tree. OLD FileUtils.File + NetUtil.asyncFetch + NetUtil.readInputStreamToString Time to read 3000 XML files 1112.3642930000005 msec...

Firefox Add-Ons: Variable Is Not Defined In Console

I'm developing a Firefox extension. When I run it, I open up the browser console and it says, [name] is not defined. It's in "browser.xul." <?xml version="1.0"?> <?xml-stylesheet href="chrome://Uedit/skin/skin.css" type="text/css"?> <!DOCTYPE Uedit SYSTEM "chrome://Uedit/locale/translations.dtd"> <overlay id="Uedit-overlay" xmlns=""> <script src="Uedit.js" /> <toolbarpalette id="BrowserToolbarPalette"> <toolbarbutton id="Uedit"...

evalInSandbox fails to find function in Firefox 38

I use Components.utils.evalInSandbox to execute js function in my firefox extension. But this api fails after I upgrade firefox to version 38. it always throws error "*** js function not defined", which seems that there is no such js function on web page. However, the reality is the js function...

Firefox addon uploading canvas contents to imgur

I am writing an addon in firefox that automatically sends the contents of a canvas to imgur. I have already built a similar extension in chrome, where it works as expected, so I know that the usage of imgurs API is correct. When I use the same approach in the...

How to check whether the html has changed?

Apologies if that's the wrong place, but have no clue where to ask. We are building Firefox addon that works on selected websites. Now, because those websites tend to change once in a while, I want to run once a day a javascript script that will check whether the specific...

How to put BGRA array into canvas without re-ordering

I have a BGRA array and need to draw it to a canvas. Currently i was doing it like this: var aVal = returnedFromChromeWorker; var can = doc.createElementNS(NS_HTML, 'canvas'); can.width = aVal.width; can.height = aVal.height; var ctx = can.getContext('2d'); ctx.putImageData(aVal, 0, 0); doc.documentElement.appendChild(can); Is there some way to get a...

Firefox addon - how to use XMLHttpRequest in Chromeworker?

I am using ChromeWorker to download some data from a API. I am trying to import XHR in myWorker.js. importScripts("resource://gre/modules/workers/require.js"); var { XMLHttpRequest } = require("sdk/net/xhr"); I am getting the following error while running cfx run Error: TypeError: The argument to require() must be a string uri, got sdk/net/xhr I...

Can an extension similar to Simple Notes (Opera) be developed in Firefox?

I have a very limited knowledge on the manipulation of overlays and XUL elements in Firefox extensions but I am interested to know if it's possible to do something like this "Simple Notes" Opera add-on in Firefox browser interface.

how to append iframe to hosted page using Firefox SDK addon?

Assume frame.html inside data folder in Firefox SDK addon, how to append an iframe and define frame.html as its source? Additional info: Because of CPS, its not possible to use inline source, so I can't use data.load('frame.html'), I need to use URL of the file: lib/main.js tabs.activeTab.attach({ contentScriptFile: ["js/appender.js") ],...

FireFox Extenstion - Using Components - Hex Decoding

I am working on a FireFox Extension and want to know what are these codes and what do they do : const {classes: Cc, interfaces: Ci, utils: Cu} = Components; Cu.import("resource://gre/modules/Services.jsm"); var wm = Components.classes[";1"]. getService(Ci.nsIWindowMediator); var windows = wm.getEnumerator("navigator:browser"); global_win = windows.getNext().QueryInterface(Ci.nsIDOMWindow); var my_integer = check_me_1() + check_me_2(); alert(my_integer);...

Using Mozmill for testing Firefox addon

I have a Mozilla Firefox addon and wanna test it. I've found Mozmill and wrote the small Python script, which is just taking each Firefox version and run the command like this: mozmill --binary=C:\browsers\firefox\38.0.1\firefox.exe --addon=C:\my_ext\ext --test=C:\my_ext\tests\mozmill\ Here is the script #!/usr/bin/env python # -*- coding: utf-8 -*- from subprocess...

Firefox addon: TypeError: getBrowserForTab(…) is undefined

While attaching an object to window of the active tab in main.js, I get following error: Message: TypeError: getBrowserForTab(...) is undefined Here is the code that I've used to attach the object: var { getTabs, getTabContentWindow } = require('sdk/tabs/utils'); tabs.on('load', function(tab) { var window = getTabContentWindow(tab); window.myObject = { data:...

How can open Firefox developer tools in my extension's sidebar?

I have developed a Firefox extension which includes a sidebar using the SDK. However, if I right-click inside the sidebar and choose "Inspect Element", I get this error in my terminal: JavaScript error: chrome://browser/content/nsContextMenu.js, line 570: TypeError: gBrowser is null Needless to say, nothing happens and the developer tools do...

access custom dom function from firefox add-on

I am working on a Firefox Add, using the newest SDK. The problem I am having, is that when ever I try to run a custom dom function it doesn't work. Scenario: The firefox add-on must be able to loop through all tabs, and if the correct one is open...

setInterval not called in tab content-script

Simple use case: main.js var tabs = require('sdk/tabs');{ url: '', onOpen: function (tab) { tab.attach({ contentScriptFile: './content.js' }); } }); content.js console.log("foo"); setInterval(function() { console.log("bar"); }, 1000); output foo I get the same problem with event handlers, which is more problematic…...

Badged Buttons from Non-SDK

Does anyone have any tricks on how to use the badged buttons feature of addon-sdk from non-sdk addons? If no tricks my thinking was to use maybe override xbl and/or override display='xul:button' from techniques listed here: To anonymous element add pseudo element and cursor style and event listeners...

Firefox extension : gMultiprocessBrowser is not defined

I am porting a Firefox v22 extention Firefox v31, my plugin works fine on FFv22 but its not working on FFv31. In my plugin I have changed the overall browser look, so I have made changes in browser.xul. The problem which i am facing is that I cannot open any...

JavaScript: XMLHttpRequest() from Firefox addon to get zip

I am trying to build a Firefox addon to request a zip file from a webpage and store it locally/decompress. I receive a 200 response code when I request the zip as a Blob type, but I am unsure how to store it since the Firefox file I/O documentation is...

Addon to modify http headers specified via regex of content

I need a Firefox addon that would enable me to modify outbound http request headers thusly: "[pseudocode] if any request header contains x in its content then replace x with y" where x is a regular expression and y preferably can contain substitution patterns referencing x. I've looked at the...

Overriding `onClick` on a Firefox-Addon ActionButton

When creating a plain old ActionButton in a Firefox Add-on, it seems that one cannot override the onClick property after creation. Anyhow, this var handleClick = function() {''); }; var button = new ActionButton({ id: 'my-link', label: 'label me', icon: { '16': './icon-16.png', '32': './icon-32.png', '64': './icon-64.png' }, onClick:...

Receive message from main.js in Firefox add-on content script

I'm trying to communicate between main.js and a content script. Here is my main.js: var pageMod = require('sdk/page-mod'); var self = require('sdk/self'); var ss = require('sdk/simple-storage'); pageMod.PageMod({ include: '', contentScriptFile:'content-script.js'), onAttach: function(worker) { worker.port.on('getSetting', function(request) { // var settingValue =[request] var settingValue = 'test value'; // for testing,...

Request object response always empty

Here's my main.js require('sdk/request').Request({ url:'' ,onComplete:function(response){ console.log('response',response) } }).get() which gives me console.log: extension: response constructor {} At first I thought it was a permissions thing, but I whitelisted google and still no response "permissions": { "private-browsing": true ,"cross-domain-content":[""] } I'm using FF31...

xul overlay for new menu in TB/Firefox main menubar

I'd like to add a new menu at the end of the main menu bar (file, edit, ...) after the Help menu via an extension i wrote. I already know how to add a new item to one of the menus by something like: <menupopup id="menu_HelpPopup"> <menuitem id="example-item" oncommand="alert('Hello!');" label="TEST"...

XUL event listener for page load (in current tab only) or tab switch

Is there a simple script which will allow me to be notified if the a page is loaded in the current tab or if a new tab is now in focus?

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

---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",...

Dumping SQLite database in time interval

I have XUL desktop app which stores data in SQLite database. To prevent too much data store in DB i want to create some kind of auto dumping system for my DB. My idea is to store timestamp of last DB dump so on every app boot to check for...

Firefox extension app hosted on server

I managed to create a Chrome extension pretty easy and the main application is hosted on my server allowing me to provide updates to the app itself without having to update the whole extension. I like the idea and I just want to know if it's possible to create a...

nsICacheService doesn't work in Firefox 38

I use Components.classes[";1"].getService(Components.interfaces.nsICacheService); to manipulate http cache when developing Firefox extension. But after I upgrade to Firefox 38 esr, this interface throws error when calling its function [Exception... "Component returned failure code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED) [nsICacheService.visitEntries]" nsresult: "0x80004001 (NS_ERROR_NOT_IMPLEMENTED)" And I didn't find it obsolete in MDN, so anyone knows why?...

Closing tabs with a specific meta TAG in firefox-addon using javascript

I have this addon which inserts the following "meta" TAG on the pages it opens.Towards the end, I want to close all the tabs with that TAG on the page header. <meta id="CLOSE_LATER"> I have written a simple for-loop: var TAG = "CLOSE_LATER"; var tabs = require("sdk/tabs"); for(var i=0; i<tabs.length;...

Can't get xpi to work in TorBrowser

I created a small little HelloWorld extension and was able to get it to work in Firefox 31 (which TorBrowser is based on). However I'm unable to get it to work in TorBrowser. Any idea why that might be and how I can fix? This is my main.js var contextMenu...

How to open firefox “open menu” using keyboard shortcut?

How to open firefox "open menu" using keyboard shortcut? I am unable to find the keyboard shortcut on google. I want to automate the process using selenium as I want to open an installed add on. ...

Copy to clipboard from Firefox add-on content script

I want to write a content script in a Firefox add-on that will copy a string to the user's clipboard in response to an event. I know that I can do this with the Firefox clipboard API like this: var clipboard = require("sdk/clipboard"); var val = "Lorem ipsum dolor sit...

Detect tab url change inside firefox add-on

I have an extension that works on chrome that monitors the active Tab for url changes. Specifically i needed to detect when the url changed but there was no new page load or navigation, (some sites do this, like youtube when you click to view another video) On chrome i...

What would be the best way to create a firefox plugin for taking desktop screenshots?

I need to create a firefox plugin that allows a user to take screenshots of any part of their desktop and have them uploaded to a server. There seems to be lots of plugins for screen capturing a webpage, but nothing for capturing anything outside of firefox. So after a...

Components.classes ERROR - FireFox Add-On(Extension) in VS 2013

I want to check javascript codes of a firefox add-on(extension) in visual studio 2013. I am c# web developer and so i created an empty web application project with c# language and created a new webform(Default.aspx) in that project and put those javascript codes in there. Here is the example...