Updating Firefox addon jsm module code without browser restart - firefox

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

Related

Flask cached files, no new changes applied (still loads old .css and .js files)

I have simple flask application running on flask development server on Debian9. Everything worked fine until today. Now, when I change any of the files in static directory, the browser loads the old file and no change is displayed. 2 browsers tried: Chrome and IE.
I've tried this:
Clear all browser cache, refresh page = no effect
Install 2 brand new browsers (Vivaldi and Opera) = On the first time the URL was entered, old .css files were loaded
When I rename the .css file and accordingly modify the html, the changes are applied and everything looks fine until I make another change, then I have to rename it again.
I run flask app with flask run --host='0.0.0.0' --port='80'
I found many similar posts, everytime they were solved by clearing browser cache, or adding #app.after_request decorator, but it did'nt help in this case. I don't think this is browser cache related. Thank you for any advices.
After many desperate hours of trying, I find out, that this behaviour is caused by multiple ssh sessions opened to the server. I had 2 connections via putty, one for starting and stopping server, second for files modifications. I've tested it with opening and closing the second putty connection and it's definitely the cause of the problem. I don't know if this is related only to flask (I'm no linux expert), but maybe it'll help someone.

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

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

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.

CSS reload on IE7

It looks like IE7 doesn't reload the latest version of my stylesheet each time I upload a new version on the server.
This is annoying as I am debugging my .css file to make it work on IE...
Tried to empty the browser cache but still not working.
Thanks for your help.
Ctrl-F5 - forcible way to reload in IE
Include your version number in the file name. myfile_v1234.css
When testing, every time you do an update you can just wite "stylesheet.css?r=98123"
As long as the query string is different, it'll be downloaded again.
If you need, you can use javascript to append Math.random(), to get the random number. Not required on production though, when updates would be stable.
2 Questions:
Does IE eventually load with the newer stylesheet?
How are you saving the changes to the server (SSH, Web Interface, etc.)?
I ask because I ran into an issue with a web-based file management system a while back where one browser would show the CSS just fine, the other wouldn't, and we noticed the issue of which browser played nicely depended on which browser we used to upload the CSS.
The reason turned out to be that IE gave the CSS file a different MIME type than Firefox. If you continue to notice the issue even when you've cleared the cache, check the MIME type of the file using Firefox by going to Tools > Page Info.
Also, if it is simply a caching issue, consider turning caching off in IE. I believe this should be an Advanced Option under Internet Options.
Also, you may want to try creating a special developer environment for IE (if it comes down to it.) Perhaps have another machine with IE7 and no caching and any other features turned off (A kiosk mode, perhaps), and then previewing the page on that machine.
Thanks to you all!
I did manage to solve my problem with the "stupid" Ctrl+F5, and by changing the Internet Parameters of Windows to reload content every new visit.

Browser add-on to find a download's origin

Back in the earlier days of the internet I remember that in certain browsers, every time you downloaded an image or a file, the URL of where that file was downloaded from would be written into that file's properties (I guess the summary tab?). I think Netscape v2 did this if I remember correctly.
I really miss that kind of functionality as every once in a while I'll run into a neat little program stored somewhere in the depths of my hard drive and wonder where I got it from originally.
I googled around but I'm not quite sure what terms to use to describe what I'm looking for. So I'm wondering if anyone knows of a Firefox plug-in or something similar that would do this?
If you use the DownThemAll! extension for Firefox, you can tell it to prepend the URL of the site to the downloaded file name...
thus you end up with files like:
download.com_utils_compression_ABCD32.exe
It also works really well when you want to download/queue a bunch of files.
You download http://example.com/foo to ~/Desktop/foo, and you want to see the originating URL in the properties of the local file foo?
Back when I used OS X, I remember Safari used to record the original URL in the resource fork of the downloaded file. Can't remember what the named fork is, well, named, but it'll show up in the properties panel from Finder. Since it's there, Spotlight will probably index it, too, but I haven't used OS X since 10.3.
If you use Opera, and haven't cleared the file out from your download manager, select the download and it'll show the original URL that the file is from in the properties pane.
Is this what you want? If so... well, I don't know of a similar Firefox extension, but it'll clarify the question.
For the IE Browser I use the hell out of Fidler to look at all traffic going across the wire.
For FireFox, you can use the FireBug plugin. There is a "Net" tab that will show you request information that is going across the wire.
Most of the time you can use one of these tools to see what URL was requested in order to start a download. You can also view all the get and post information that might need to be sent in order to have your request succeed.
Fidler is here: http://www.fiddlertool.com/fiddler/
FireBug is here: https://addons.mozilla.org/en-US/firefox/addon/1843
Best of Luck!

Resources