start firefox extension without restart - javascript

i've created a firefox addon and working well. Now the question is how can i start
this addon without restart. i don't want restart disable/enable or install/uninstall process.
can any one help me in this? Thanks!

http://adblockplus.org/blog/how-many-hacks-does-it-take-to-make-your-extension-install-without-a-restart
https://developer.mozilla.org/en/Extensions/Bootstrapped_extensions

Yes, but you either have to make it a JetPack rather than an Add-On or you can read this guy's article:
http://downloadsquad.switched.com/2010/09/15/adblock-dev-no-restart-firefox-extensions-possible/

If you use this https://wiki.mozilla.org/Labs/Jetpack you don't must to restart

You can't, alas. I guess this is an ancient Mozilla design issue. Google Chrome can install extensions without restart.
Edit: As of 2012, Firefox can install some (but not all) extensions without restart. These extensions are badged 'no restart' in Mozilla's add-on store. Adblock Plus is one such extension https://addons.mozilla.org/en-US/firefox/addon/adblock-plus/. I don't know the developers made that possible.

From https://addons.mozilla.org/en-US/faq
How do I install add-ons without restarting Firefox?
In Firefox, add-ons marked with "No restart required" can be installed without
restarting. These add-ons have been created using the Add-on SDK or bootstrapping. Other
add-ons will still require a restart before you can use them.

Related

How do I enable copy to clipboard in Firefox on Linux?

I released a new version of a firefox webextension, Copy
All Tabs last night. The code is open source and available on github.
The new version fixes many bugs and is overall more stable. It works as expected on Windows and Mac (Firefox 61).
However, when I was testing on Linux (both Firefox 60 and 61), the "Copy Tabs" function fails.
https://www.google.com/search?q=Component+returned+failure+code&ie=utf-8&oe=utf-8&client=firefox-b-1-ab
Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE)
The function that fails on Linux is located in this file:
https://github.com/charlesbrandt/copy_all_tabs/blob/master/ff-web_extension/background.js
The major shift was moving the copy and paste functions from a content script that was injected into the active tab's page to the background.js file. The content script approach was failing for Firefox specific pages (e.g. about:debugging) for security reasons.
Given the discrepancy, I'm inclined to think it has something to do with Firefox, but if it's a problem in the webextension I'd be happy to fix it.
If this is a bug in firefox, what is the best way to report it?
Alternatively, does anyone have a suggestion for how modify the extension so that it works effectively on all platforms?
Update:
I followed #Dexter's advice and filed a bug in Bugzilla:
https://bugzilla.mozilla.org/show_bug.cgi?id=1473780
Since that time, the plugin eventually started working in newer versions of the browser.
I do NOT know if this might be your issue, but here goes.
Recently switched from Windows to Pop! OS (derived from Ubuntu/GNOME). Had problems with certain Firefox Browser Extensions, specifically those enabling the copying of links from webpages and subsequent pasting them into, say, GVim.
UNTIL I followed the instructions here:
How to Customize the GNOME Shell in Ubuntu Using Extensions
https://www.makeuseof.com/tag/customize-gnome-shell-extensions/
WRT installing GNOME Tweak, GNOME Shell Extensions, and Shell Extensions for Firefox.
I would suggest you try this and see if it helps. I hope it does.

Call GnuPG from Firefox add-on

I'm writing an add-on for Firefox. I want to know what is the best way to use GnuPG from the add-on.
I have tried several Node.js modules and does not work either within the add-on because it can not find its dependencies
I solved the issue developing a webextension.
Webstaensions can access to the Window object, i was talkig with a developer of the Mailvelope add-on and he suggest the switch to a webextension, they are planning that switch for they add-on

Chrome Extension packing while developing - any better way?

I do some chrome extension (web music play/stop) as a hobby project.
At the moment my process is like this:
Disable chrome store version
Make changes
Pack extension
Remove previous version of extension
Drag'n'drop new dev version
When I think I'm done, I upload the final zip to the dashboard, remove dev version and turn back on the chrome store version.
So this looks quite hard and not rational. Guess there is another way to do it.
Maybe I've just missed a good part of the manual, please point me to.
Answer by #devnull69
You even don't need to disable the chrome store version because the
local / unpacked version will have a different extension id and can
easily be run in parallel to the webstore version
https://developer.chrome.com/extensions/getstarted#unpacked

What is the easiest way to develop Firefox extension?

I'm planning to develop a simple Firefox extension that will shorten URL of a currently active tab, display a popup with the shortened URL, and place it into the clipboard.
In Google Chrome, this would be pretty easy (according to http://developer.chrome.com/extensions/getstarted.html) -- pure JavaScript plus a few calls to JavaScript API-s of interacting with the browser's UI.
However, after searching around for a good Firefox extensions tutorial, the most officially-looking links I found are:
https://developer.mozilla.org/en-US/docs/Extensions
https://developer.mozilla.org/en-US/docs/Building_an_Extension
How do I write a Firefox Addon?
According to them, it looks like I will have to learn the XUL language for even the simplest interactions with the browser's UI. On top of that, I will have to set up custom Firefox profile so as not to hose my default profile during development, create complicated directory structure, write manifest in obscure XML, figure out how to package and test whatever I implement, etc.
It's 2013, isn't there an easier way of building Firefox extensions?
It's 2013, isn't there an easier way of building Firefox extensions?
Yes there is!
The links you provided in the question are unbelievably outdated. There is a new, much better way of developing Firefox extensions -- Firefox Add-on SDK.
However it's pretty hard to stumble upon it by just googling along the lines of 'firefox addon tutorial'. I'm amazed Mozilla doesn't advertise it more aggressively, or at least mention it on those pages you found.
Steps to get started (Mac/Linux, but should be pretty similar for PC):
Download the SDK from https://addons.mozilla.org/en-US/developers/builder, unpack it.
Quickly glance over the README file (always useful).
Execute source bin/activate from the SDK dir (the same dir the README file is in).
Execute cfx docs -- this bootstraps local copy of SDK docs and opens it in your browser.
Leave the SDK dir, create an empty dir for your extension.
Execute cfx init inside the extensions dir -- this generates all the necessary files/directories.
Follow the rest of getting-started-with-cfx page:
Update lib/main.js with just a few lines of JS to place a custom widget onto add-on bar.
Execute cfx run -- this opens fresh Firefox instance with your new shiny extension in it.
All in all, it took me just a few hours to read the documentation, get familiar with the SDK API-s, find SDK module to place a widget onto a navigation bar instead of add-on bar, and develop fully-functional extension in just about 50 lines of JavaScript.
HTH!
Update
There is a new standard, called WebExtensions
From MDN
There are currently several toolsets for developing Firefox add-ons, but WebExtensions will become the standard by the end of 2017.
If you are writing a new add-on, we recommend that you write a WebExtension.
As of https://blog.mozilla.org/addons/2016/11/23/add-ons-in-2017/, the only way going forward will be to use WebExtensions. The last SDK extensions will be accepted for Firefox 52, while Firefox 57 will end all other extension support, supporting only WebExtensions.
Firefox copied Google Chrome's extension API. So you could just use your Chrome extension and see if all the APIs are already supported in Firefox (they should be as of now).
Programmers such as NoScript's Giorgio Maone actively support the change to WebExtensions.
To develop a WebExtension, you need
either the web-ext-tool that can be installed via
npm install --global web-ext
or simply use Firefox's about:debugging or Chromium's chrome:extensions to temporarily load the webextension.
Either way, you need a manifest.json file in a directory created by you, which glues all functionality together. See https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Your_first_WebExtension for a first example. Or the Google docs at https://developer.chrome.com/getstarted.
Yes there are three different techniques you can use to build extensions:
Add-on SDK-based extensions
manually bootstrapped restartless extensions
overlay extensions
You can read comparison between here
If you can, it's advisable to use the Add-on SDK, which uses the
restartless extension mechanism but simplifies certain tasks and
cleans up after itself. If the Add-on SDK isn't sufficient for your
needs, implement a manual restartless extension instead.
Steps to get started with Add-on SDK-based extensions
Installation
Installation on OS X, FreeBSD, Linux
Installation on OS X using Homebrew
Installation on Windows
Create user interfaces
Interact with the browser
There are two official ways for developing add-ons, each of them has pros and cons:
1- WebExtensions (newer method):
WebExtensions are the future of Firefox add-ons. If you can use the WebExtensions API, it's the best choice. You can develop and publish WebExtensions right now, but they're still in an early state.
2- Add-on SDK (older method):
The Add-on SDK provides APIs for developing Firefox add-ons, and a tool for developing, testing, and packaging them.
I made a tutorial on developing extensions using the Firefox addon SDK:
How to develop a Firefox extension with the addon SDK

Browser extensions cause errors on website

Extensions installed on Chrome and IE sometimes cause errors on my website. I want that extensions do not affect my website, can I block them with JavaScript? And I know it sounds a little bit stupid :) Anyway any suggestions are welcome
You cannot block extensions using javascript but you may check if the user has a certain extension installed and displaying a warning or error regarding the extension like "uploads won't work when XY is enabled"
How to do this has already been discussed on SO
Check whether user has a Chrome extension installed
How to detect if an Internet Explorer plugin is already installed using JavaScript
No, there isn't any way to block extensions from a webpage.

Categories

Resources