EzDevInfo.com

firefox-addon interview questions

Top firefox-addon frequently asked interview questions

Is it possible to see the data of a post request in Firefox or Chrome?

How can I intercept the post data a page is sending in FF or Chrome via configuration, extension or code? (Code part makes this programming related. ;)

I currently use Wireshark/Ethereal for this, but it's a bit difficult to use.


Source: (StackOverflow)

How to view/delete local storage in Firefox? [closed]

In Google Chrome there is an easy way to see what's in local storage as well as modify or delete it after inspecting it.

Is there a tool or something to do the same in Firefox?


Source: (StackOverflow)

Advertisements

How do I write a Firefox Addon? [closed]

What are some resources for getting started writing a Firefox Addon? Is there an API guide somewhere? Is there a getting started tutorial somewhere? Is there a developer discussion board somewhere?


Source: (StackOverflow)

Firefox addon to view/edit/create localStorage data?

Is there an addon that allows you to view, edit, localStorage information? If there is and it works as an extension of Firebug I will be extremely happy.

Something like Google Chrome's

Google Chrome

similar to Firecookie but for the localStorage

Firecookie Firecookie

Is there something like it?


Source: (StackOverflow)

Parsing JSON from XmlHttpRequest.responseJSON

I'm trying to parse a bit.ly JSON response in javscript.

I get the JSON via XmlHttpRequest.

var req = new XMLHttpRequest;  
req.overrideMimeType("application/json");  
req.open('GET', BITLY_CREATE_API + encodeURIComponent(url)
          + BITLY_API_LOGIN, true);  
var target = this;  
req.onload  = function() {target.parseJSON(req, url)};  
req.send(null);

parseJSON: function(req, url) {  
if (req.status == 200) {  
    var jsonResponse = req.responseJSON;  
    var bitlyUrl = jsonResponse.results[url].shortUrl;  
}

I do this in a firefox addon. When I run I get the error "jsonResponse is undefined" for the line var bitlyUrl = jsonResponse.results[url].shortUrl;. Am I doing anything wrong in parsing JSON here? Or what is wrong with this code?


Source: (StackOverflow)

How to reload/refresh a web page without leaving my web development IDE?

Building Websites

When I build websites I use 2 monitors. I have my development IDE on the main monitor and the web page open on the secondary screen.

I get annoyed that everytime I need to refresh the web page I have to go to my mouse, move over to the other screen and click refresh.

I would like to have a shortcut key mapped to reloading the web page whenever I need. In a similar way to how Winamp maps keys to common functions like play/pause etc.

My current research:

Firefox via Command Line

I have discovered that an existing FireFox process can be controled from the command line, however the best it can do is create a new window with a specific URL.

firefox -remote "openURL(www.mozilla.org, new-tab)"

The documentation is here: https://developer.mozilla.org/en/Command_Line_Options

Reload Every

There is also a firefox extension that will refresh the web page periodically. However this results in a constant flickering of the page and will also be wasteful with resources.

https://addons.mozilla.org/en-US/firefox/addon/115/

However, what I really need is either....

  • A customisable global hotkey for Firefox/Chrome to reload current selected tab
  • A browser extension that could be fired from a Global Hotkey
  • A command to reload the current selected tab from the Command Line that I could then map to a hotkey (is it possible to add extra remote command with an extentsion?)

Does anyone know how I could do this? Thanks!


Source: (StackOverflow)

python for firefox extensions?

Can I use python in firefox extensions? Does it work?


Source: (StackOverflow)

firefox add-on vs. extensions vs. plugins

I want to write scripts for firefox. It seems that firefox has different terms, like add-on, extensions, plugins. and I have a feeling they're not all the same. Can you sum up the difference between in a few words?


Source: (StackOverflow)

Get Windows username with JavaScript?

I am working a Firefox addon (which is written in JavaScript) and need to determine the Windows user currently logged on. Is there a way to do this?


Source: (StackOverflow)

Firefox Add-on RESTclient - How to input POST parameters?

I've installed Firefox RESTclient add-on but , I'm having hard time figuring out how to pass POST parameters. Is there a specific format to do this? Or is there any other tool which can be used to debug an REST API on Mac OS X ?


Source: (StackOverflow)

What is a MIME type?

I have been reading about how to build plug-ins and this "MIME type" keeps getting discussed in it, I have tried to look into and know that its Multipurpose Internet Mail Extensions (MIME) but no suitable explanation of how it relates to browser plug-ins as in what i need to know about it for building plug-ins is provided, please explain in clear and simple words. What it is? Why do plug-ins have a MIME type?


Source: (StackOverflow)

Fastest way to debug Firefox addons during development

Debugging a Firefox addon is a slow process: (1) edit source code in a JS editor (2) package into XPI using a build script (3) drag into Firefox to install (4) restart Firefox (5) open the JavaScript Debugger

Can we speeden up the process? Like install it into Firefox without a restart, or configure the build script to install it into Firefox as well?


Source: (StackOverflow)

On Text Highlight Event?

I'm curious if anyone knows how I would trigger a function to run if/once the user finishes selecting text on the web page? I would like the user to be able to select text, and after a short delay(or immediately, at this point it doesn't matter much) an overlay button appears near the text that the user can then click and I go back and run more of my code that is based on the selection. This is for a Firefox extension.

A similar example that I can think of would be like in IE where you can select text and then it brings up the "web accelerators". I'm 99% sure I know how I would actually overlay the button, and get the position of the selected text, but I have no idea how to check to see if there is anything selected, without doing some sort of infinite loop, which just seems like a terrible idea.

Thanks in advance!

EDIT:

//In my overlay.js with the rest of my sidebar code
isTextSelected: function () {   
        var myText = cqsearch.getSelectedText();
        var sidebar = document.getElementById("sidebar");
        var sidebarDoc = sidebar.contentDocument || document;

        var curHighlightedDiv = sidebarDoc.getElementById("testDiv");
        curHighlightedDiv.innerHTML = "Current text selection:" + myText;
    }
};

//In my on firefox load function I added this
document.onmouseup = cqsearch.isTextSelected;

So this is what I have come up with using Robert's suggestion, and it took me some time getting everything in the right spot, but it works great! Now on to position my button. Thanks a ton!


Source: (StackOverflow)

What do {curly braces} around javascript variable name mean [duplicate]

This question already has an answer here:

EDIT After looking at JSHint I found this 'destructuring expression' is available in ES6 (use esnext option) or Mozilla JS extensions (use moz) and this however after reading it I still don't understand why it is used

I have come across the following code on MDN

var ui = require("sdk/ui");
var { ActionButton } = require("sdk/ui/button/action");

What do the braces on the second line do and why are they used? Why are there no braces on the first line?


Source: (StackOverflow)

Output jasmine test results to the console


I am using Jasmine (BDD Testing Framework for JavaScript) in my firefox add-on to test the functionality of my code.

The problem is that jasmine is outputing the test results to an HTML file,what I need is to Firebug Console or other solution to output the results.


Source: (StackOverflow)