FireFox Add-on document.querySelectorAll(); not defined - firefox

I am working on a add-on project for FireFox using SDK (JPM) and when I run the code in JPM I get "document is not defined"
My index.js file has the following which this error refers to:
var insecure = document.querySelectorAll('[src^="http://"],[href^="http: //"],[img^="http://"]');
Any help would be great as I have tried so many things
Thanks

Add-on SDK uses a CommonJS module system, it means that the index.js is a sandboxed module, and therefore there is no specific document or DOM associated with it.
If you want access to a content document, you probably want to use content scripts. Take a look here: https://developer.mozilla.org/en/Add-ons/SDK/Guides/Two_Types_of_Scripts and here: https://developer.mozilla.org/en-US/Add-ons/SDK/Guides/Content_Scripts
Hope it helps.

This issue has now been resolved. I have used content scripts and the "port.emit" port.on" options. Sorry I was late responding.

Related

Creating custom builds of Mozilla Firefox

I am trying to build my own version of Firefox with slight UI changes and by adding some addons(extensions) to the build.
I have downloaded the source code from repo. Where would I start to achieve this?
Which all codes hold the UI structuring? Where do I put my addon xpi files?
PS: I tried to read the Mozilla documentation. Its either kinda outdated or I am not really getting it? A detailed insight would be much appreciated.
Addons
To do this, simply place the extensions in the distribution/extensions
directory in the application's distribution directory.
Here are the extension
https://dxr.mozilla.org/aviary101branch/source/browser/extensions
Flags In firefox
https://dxr.mozilla.org/aviary101branch/source/browser/config/mozconfig
Do more with themes
https://dxr.mozilla.org/aviary101branch/source/themes/modern
https://dxr.mozilla.org/aviary101branch/source/browser/themes
For Editing you may need XUL
https://www.xul.fr/tutorial/
Components
Go here and customize every component you need
https://dxr.mozilla.org/aviary101branch/source/browser/components

API KIT Console in Mule not showing any Output

I tried to look through all the tutorials for RAML and I was pretty excited.
I found most of the online resources available but I could not understand why, when i set up everything and the flows are generated, then i run it locally as a mule application, when i point to localhost:8081/api/console/ i get a huuuuuuuge json response, but not the UI described for example here.
Yes i also faced the same issue with Any Point Studio. It is not at all displaying in the API KIT Console present in Any Point Studio. But to feel good and to see the output i have just tried it with Google Chrome Browser and i got the expected User Interface as i was expecting from API KIT Console. Hope this issue will be fixed from next release onwards.
Here is the URL i used to see it on Browser : http://localhost:8081/remote-vending/api/console/
Here is my output from Google Chrome browser for the API KIT Tutorial
My GUI didn't show in the Anytime studio tab: APIkit Consoles, one way to fix this:
make sure you have started your application
right click for the context menu
select encoding
click auto-select
I have had the same problem and resolved it by removing invalid whitespace. One of the example files I was including had an invalid trailing space.
The way I found out;
Open the Network panel in the Developer Toolbar in your browser
Go to http://localhost:8081/api/console/
Find the response for a request to '/api' with the request header 'Accept:application/raml+yaml'.
This response should contain the fully compiled RAML, where all include files have been included.
Copy this entire content into a new RAML-file in Anypoint Platform API Designer or some other YAML editor with error reporting.
It highlighted the invalid whitespace immediately for me.
It should work Out of the box.
It could be a bug of an earlier version.
Could you check the behaviour in more recent releases?
Changing my default browser from Firefox to Chrome resolved the issue for me.

Simple D3 tutorial not appearing

Used code from this tutorial:
http://bl.ocks.org/mbostock/3883245#index.html
Saved index.html
Saved data.tsv into the same directory
First, I tried opening the html by itself. That showed a blank web page (viewing the page source showed the code was indeed there).
Then, I ran python -m SimpleHTTPServer 8888 & in the directory (although I should not have needed this step). It showed a blank web page as well.
https://github.com/mbostock/d3/wiki
How do I get d3 working? Thanks
Just forgot that I renamed a file.
Incidentally, if you cannot get it to work you need to check your browser. The above tutorial did not work for me in Safari or Chrome on a mac but worked in Firefox. I got this information from here:
Very simple tutorial example of D3.js not working
and here:
https://github.com/mbostock/d3/wiki

Updating Firefox addon jsm module code without browser restart

I am developing a Firefox addon that is loaded from a directory instead of an xpi, Firefox extension proxy file. The extension is based on jsm modules.
Is there a way to update those modules to reflect the code changes. The only way to do it now is to close and restart the browser but that its not a sane way to develop anything.
Tried to:
Components.utils.unload('resource://myextension/mymodule.jsm');
Components.utils.import('resource://myextension/mymodule.jsm');
but changes are not made.
Got the answer from Victor Porof. In order to make this work you need to clear first the cache:
var obs = Cc["#mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
obs.notifyObservers(null, "startupcache-invalidate", null);
Hope this helps anyone

Location of Firefox throbber/spinner image

I'm trying to locate the "throbber" (or "spinner") image used in the Firefox 3.6x chrome to show that a request is being processed:
Firefox throbber http://i49.tinypic.com/kd7bth.png
I'm not familiar with the source code structure for Firefox, and a simple search hasn't yielded the answer.
Does anyone know which file I'm looking for? (E.g. can you provide a link to the file in the Mercurial repository, or tell me how to find it?).
Inside of your Firefox installation it's inside chrome/classic.jar, the path is: skin/classic/global/media/throbber.png
I'm not sure where it is in the Mozilla repository though.
Here's some info on how to customize it: http://kb.mozillazine.org/Throbber_URL

Resources