firefox-addon

firefox toolbar event

Hi All, Does anyone know who to find an event occurrence on a toolbar in firefox. I want to do event logging on toolbar in firefox. Thanks ...

saving data in chrome:// document

Hello, Im making firefox extension and I have a problem with variables. Extension works with file (chrome://myextension/content/document.html) opened in few tabs. I want it to store a value in each tab, so I decided to store it in one of the html objects, that have got "Object" id: data="foobar" node=gBrowser.contentDocument.getElementB...

An observer for page loads in a custom xul:browser

In my firefox extension I'm creating a xul:browser element. I want to have an observer that intercepts any url changes within the embedded browser and opens the url in a new browser tab (in the main browser). I'd also like new windows spawned by the xul:browser window to open in a tab instead of a new browser window. I've created an obs...

Correct way to restore Firefox preferences when Add-On uninstalled by external application

I have written an application suite on Windows which amongst other things installs a Firefox add-on which once run modifies the Firefox network preferences by interfacing with nsIPrefService. The extension itself resides in a folder under Program Files along with other parts of the application which work together with each other. Since...

Firefox Extensions - best practices

Hi there I've been writing a Firefox extension, but have recently read a few articles explaining that it's bad practice to avoid variable name clashes by simple appending the application name to the front of the variable. Unfortunately I have been doing this. What is the best practice instead? I assume it's to somehow namespace the var...

How do I add protocol handler to firefox from extension

I want to trap request for a my protocol from Firefox extension. For example if we type <my-protocol name>://... in address bar It should call a JavaScript function in an extension. I want to achieve it if possible without explicit settings. ...

Firefox extension to find out which Javascript event is bound to an inspected element?

One can bind Javascript events to html elements without using inline declarations. Is there a way when inspecting an html element to know which events are bound to the element? I want to know about the events defined by the developer and not the internal ones that come with the browser. So if I hover over an element and a menu shows up...

How to add event 'TabOpen' to all windows in a Firefox extension?

I'm writing a Firefox extension. I'd like to have my code executed whenever a new tab opens. I've tried this: for (var i=0; i<Application.windows.length; i++) { var w = Application.windows[i]; w.events.addListener("TabOpen", function(event){ alert( 'tab #'+w.activeTab.index +' opened'); }); } It doesn't work right if window...

firefox extension don't have write permission on MAC OS X

I have a Firefox extension need to write to one files inside the extension's chrome folder, it works fine on windows and linux, but it give me 0x800520015 NS_ERROR_FILE_ACCESS_DENIED error. it is very strange, I manually set the file to have write permission, it works fine then. My question is where should I set something to tell MAC O...

firefox extension run on each page

I am new to firefox extension development. I am building an extension which needs to run for each page the user browses. At the moment the extension runs when firefox window starts. I have pasted code below. XUL Code: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="mainWin" title="my ex...

XUL attaching events to anchors added with javascript

I'm writing a firefox extension that adds event listeners to all the anchor tags on a page. Essentially I have: window.addEventListener("load", function() { myExtension.init(); }, false); var myExtension = { init: function() { var appcontent = document.getElementById("appcontent"); if(appcontent) appcontent.addEv...

Possible to disable javascript within a xul:browser element (firefox extension)?

I need to render user submitted html within an xul:panel. I'm inserting the html into an xul:browser element within the panel so that invalid xhtml is not an issue (it's sandboxed within the browser frame). Is there anyway to disable javascript within the xul:browser? My original plan was to write some regex that strips out all JS from ...

Firefox addon code for every tab open

I'm attaching some functionality to javascript by doing a firefox addon. However when coding in chrome and listening to the load event in the chrome overlay triggers for every loaded tab, but the "content" variable only points to the tab currently in the foreground. How can I get the content of every tab upon document load from a firefo...

Insert into SQLite with variables using javascript

Hi, I am developing an extension for firefox and i have created a SQLite DB. When inserting values into the table i get an error message: Error: Permission denied for http://en.wikipedia.org to call method UnnamedClass.toString on <>. The string values to be inserted are stored in a variable. var book = "Harry Potter"; var myInsertQuer...

Creating unsafe browser XUL element from Firefox extension gives (NS_ERROR_FAILURE) [nsIWebNavigation.sessionHistory]

I'm trying to add hidden browser element dynamically from Firefox extension but, although it adds successfully, it gives me Error: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIWebNavigation.sessionHistory]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://global/content/bind...

Annotate a webpage on the client side

Hi I am trying to develop a firefox add-on which would allow me to highlight a text on the web page (any webpage client side) and then allwo me to write a note and save it. So when i visit the web page next time, if an annotation exists for a webpage it shows up a small Anchor/link next to the text, which on clciking should display the ...

Temporary Storage in FireFox Extension

I've developed an extension that creates alot* of data during a browsing session. Think, 2 to 3 times the total HTTP traffic (images, HTML, etc.). Currently I'm just stashing all of this in a Javascript variable, but this obviously isn't tenable if the extension is going to get any serious usage. So, the question is, where should I st...

open a window from a existing page in firefox gives me security error

Hi, i am developing a firefox extension, On a client side of a web page i add a link and on clicking the link i intend to open a window where it will allow the user to type in text. when i click the link, it opens the window but it won't allow me to write to it. e.g. ww.document.write('<div id = "textDiv">') ; here it gives me an erro...

Firefox extension for file drag+drop

I'm creating a Firefox add-on that does the following: Drag+drop a file into Firefox If the file has a certain extension and if FF is running on a certain OS, parse the file with regex Extract a url Go to that page The JavaScript for all of this is pretty straight-forward except for the drag+drop into FF part. How can that be done? ...

Creating a document from a string in Gecko

I have a string such as <html><body><div id="message">Hello World!</div></body></html> and I would like to get the content of the #message element without parsing the HTML myself. I thought maybe I could create a document object from a string in Gecko (this is for a Firefox add on) but I don't see any simple way. I noticed that ther...