Adding add-on bar to a custom XULRunner application - firefox-addon

On MDN, the phrase "Add-on Manager-enabled XUL application" is introduced.
By dragging a XPI file containing an add-on and dropping it onto a FireFox window, the addon's widgets will be installed in FireFox's add-on bar.
I can also use Firefox to run a XUL application by specifying the commandline option "-app application.ini".
Since MDN makes me think that the two are not mutually exclusive, I'm looking for a simple 4 step process where steps 1 and 2 are create a XUL application and XPI independently, step 3 describes how to change either the XUL application or the XPI in preparation for step 4, and step 4 is final integration.
I'll start you off with steps 1 and 2, and then suggest some things that need to be done in steps 3 or 4.
Step 1: Build the XPI by following the tutorial at https://addons.mozilla.org/en-US/developers/docs/sdk/1.3/dev-guide/addon-development/implementing-simple-addon.html
Step 2: Build the XUL application by following the tutorial at https://developer.mozilla.org/en/Getting_started_with_XULRunner
Now for Steps 3 and 4. They should include modifying the application.ini built in step 2 by adding the code:
[XRE]
EnableExtensionManager=1
They should also include adding lines to prefs.js to support the extension manager. And they may require adding addon bar window element to XUL by adding code similar to:
<toolbarpalette id="BrowserToolbarPalette">
<toolbarbutton
id="xfox-statusbarpanel" class="toolbarbutton-1 chromeclass-toolbar-additional"
label="&name;"
tooltiptext="&name;"
oncommand="toggleSidebar('xfox-sidebar');"
context="xfox-contextmenu">
</toolbarbutton>
</toolbarpalette>
I've succeeded in making the "Add-on Manager-enabled XUL application" (aka <TestApp>) accept the XPI (aka <wikipanel>) and attempt to install it, but it fails with the error message: "<wikipanel> could not be installed because it is not compatible with <TestApp version 1.0>"
[edit] I editted INSTALL.RDF (for my XPI) and added the following:
<em:targetApplication>
<Description>
<em:id>testapp#sample.xul</em:id>
<em:minVers‌​ion>0.0</em:minVersion>
<em:maxVersion>9.*</em:maxVersion>
</Description>
</em:targe‌​tApplication>.
The extension now installs, but I am getting the following error in jsconsole:
Error: The widget module currently supports only Firefox. In the future it will support other applications. Please see https://bugzilla.mozilla.org/show_bug.cgi?id=560716 for more information.

You are mixing things up here. The -app command line flag is there to run XULRunner applications, not browser extensions. As to Add-on SDK, it doesn't have XUL support, only HTML. There is a fork of the Add-on SDK with XUL support but it looks somewhat outdated and I'm not sure whether it is capable of creating standalone windows (is that what you are asking about?).
There are of course classic extensions. They allow you to do anything including creating new XUL windows or using the add-on bar. But they are quite a bit more complicated to write.

I've found the answer but it is a bit of a hack and requires removing the following lines of code from the addon-kit javascript source:
if (!require("api-utils/xul-app").is("Firefox")) {
throw new Error([
"The widget module currently supports only Firefox. In the future ",
"it will support other applications. Please see ",
"https://bugzilla.mozilla.org/show_bug.cgi?id=560716 for more information."
].join(""));
}
Since the above code is specifically designed to prevent using the addon kit in anything other than bonafide Firefox, this avenue is not worth pursuing further. However, if there is a way to build a xul-app in such a way that it conforms to Firefox, then I will revisit the issue.
Firefox is chrome://browser/content/browser.xul after all.

Related

How to extend Firebug's inspector feature?

I have found out that Firebug for Firefox is an open source project and we can extend it.
By searching for documentaion about Firebug extension development I found the following website:
http://www.softwareishard.com/blog/extending-firebug/
Unfortunately its petty old and doesn't have information for current versions (i.e. 2.0.x) of Firebug.
My goal is to extend Firebug's inspector feature.
So can anyone please tell where I can find an up-to-date guide for Firebug extension development?
The existing Firebug 2 is broken once e10s is enabled by default in Firefox. That's why Firebug 3 (aka Firebug.next) was recreated from scratch based on the built-in devtools.
Therefore it is recommended to base new developer extensions on the built-in devtools instead of the old Firebug 2 source.
A guide describing how to do that is available at the Mozilla Developer Network (MDN). And there are also example extensions in the Firebug repository on GitHub as well as a template extension created by one of the devtools developers.

What would be the best way to create a firefox plugin for taking desktop screenshots?

I need to create a firefox plugin that allows a user to take screenshots of any part of their desktop and have them uploaded to a server. There seems to be lots of plugins for screen capturing a webpage, but nothing for capturing anything outside of firefox. So after a little research I have not found much information on how this might be possible. I don't want to resort to a using a java applet but I will if that is my only option.
Does anyone have advice on how I might create such a feature?
Thanks
I don't think a Firefox addon is the most appropriate approach here. Maybe split the task into a Firefox addon to offer the "upload to a server" component and a native app to do the desktop screenshot (or just integrate with existing screenshot tools).
If you're worried about complicating the installation process for end users, you could look into bundling the addon component and native app into a single installer (e.g. MSI on Windows, RPM on Linux, etc.). You'll have to come up with different apps for each platform you want to support (and maybe even each version - e.g. Windows XP vs Windows 10).
Whatever you decide, you'll probably need to create a more specific question to get further help here (there's no simple Firefox.Addons.API.TakeScreenShot() answer I'm afraid).
Also make sure you're using the right terminology - a plugin is the deprecated NPAPI approach whereas addons are still supported.
I'm actually working on taking native desktop screenshots just in the last coupel of days. I'm using js-ctypes. My work goal is the same exact thing to, upload to server. If you would like to collaborate I am very open to it! We can chat about it on #jsctypes irc channel :) irc://moznet/jsctypes (Mibbit IRC WebApp) If you don't know js-ctypes thats ok i can handle that while you can handle uploading techniques, and an editor on canvas :) The editor is a huge part of it, you can see my ideas/plans here: https://github.com/Noitidart/NativeShot/wiki/NativeShot
I'm really really interested in a collab on this!
I'm still working on windows right now, the color is messed up: https://github.com/Noitidart/NativeShot/tree/digitanks-method
I was just about to start OSX work following this example here: https://developer.apple.com/library/mac/samplecode/SonOfGrab/Introduction/Intro.html and here: Take ScreenShot without Window
You can install the addon from that branch and click the icon that gets added to the toolbar, it will take a screenshot with 3sec delay and then append it to the body of the selected tab. (Windows only right now)
Doneskis baby check it out: https://addons.mozilla.org/en-US/firefox/addon/nativeshot/
Got some quirks. Released it as v1.0 though. I'm working on Android support, pretty close. I need to flesh out the editor tools. Please let me know if you're willing to collaborate.

Run firefox extensions in xulrunner

I am just wondering if is it possible to run extension like colorzilla / firebug in xulrunner.
In fact I am creating my own extension now and I was trying addon_sdk but this is very problematic to put extension icon/button next to location bar.
So I decided to work with xul, and I know that problem doesn't exist here. And Of course the best way to learn is analyze other code, a changing it. But I can't run any extension in xulrunner. Any hint / help ?
xulrunner is just a runtime or platform. You'd need an actual app on top of that. In that regard, Firefox, Thunderbird, Seamonkey, InstantBird, etc. can be considered (complex) xulrunner apps.
Existing extensions may run, with or without modifications in such a xulrunner app. Well, likely with modifications, as most extensions use APIs specific to Firefox or Thunderbird or ...
The add-on SDK is not generally isn't a good fit for generic xulrunner apps: It is too much tailered against Firefox specifically.

not enough space for environment appears when executing ".exe" file

I am trying to use an application called CLUT.exe which is an old application for MS-DOS that can be used to reindex NTX files for DBF databases.
(This is not the main topic, but I am just writing this if someone wants to test the app and don't trust at all about the content).
The problem starts when trying to run the command line version through console (cmd.exe) and this error appears:
C:\>CLUT.exe [arg1] [arg2] [arg3]
run-time error R6009
- not enough space for environment
So, according to what I've searched, this could be a possible solution:
http://support.microsoft.com/default.aspx?scid=kb;en-us;230205
but it doesn't work and every alternative that I found to solve this over the internet is the same.
Another alternative could be to make right-click in the .exe file, go to Properties then Memory tab and increase the Initial environment memory from Auto to the max value but it doesn't work too.
Well, I am stuck and no "possible" solution is working for me. If someone is interested, knows more about this issue and want to test, you can download the application from here (click "Free Download" green button):
http://www.filebasket.com/free/Development-Clipper-programming-language/clut-exe/13996.html
or directly from my DropBox:
https://dl.dropbox.com/u/15208254/stackoverflow/clut_214.rar
Just to know, I am using Windows 7 and the CLUT.exe application is a Clipper based app (old programming language) that may run under windows console (cmd.exe).
Wikipedia does mention other dos emulators but, oddly, doesn't mention BOCHS.
Reindexing NTX files is not a difficult thing to do, and can be done with tools other than CLUT. For example, many of the utilities listed on this part of Download32 could be used. Otherwise, you could write your own using Harbour Project or xHarbour. Or contact me off list and I'll cook up something in Clipper 5.3.
LATER
If I read the README correctly for CLUT, it's a replacement for the DBU utility that comes with Clipper 5.x. I can supply you with a build of that if you're unsuccessful with other approaches.

Can i use XULRunner to create executable that acts like a phonegap app (WebView and fullscreen?) on the desktop (Windows/Linux/OSX)?

Story:
I have written a HTML Merge Compiler that can merge resource's/assets into one single HTML file (minify it to the max) and compiles Javascript with the google enclosure compiler. I have written this compiler to speed up loading and interpreting the code and to obfuscate the code to protect a little bit (script kiddie protection). Major reason was/is speed and to make it compact.
This is working OK with reliable results and i use this in PhoneGap applications/games. I have also written a javascript library that encapsulate all platforms that works with standard HTML/CSS without the need to change the code, it works also in the browser, with a touchscreen or without or on any device or operating system. Write once, publish many ;-). The idea around it is that is working always, always operate the same but can use device specific things when available but does never fail (when something is not there, for example a vibrate functionality).
Anyway, most frameworks (like PhoneGap) concentrate on Mobile Platforms but i want to port it also to desktop platforms like Windows, OSX and maybe Linux. For Windows I have wrote an Delphi Application that loads the HTML in a TEmbeddedWB object (is Internet Explorer actually) but the 'problem' is that it is only suitable to Windows and IE is not the fastest browser around, especially when it is embedded (do not why it is slower than the browser itself). For example, when i load the compiled code in Firefox and/or Google Chrome it is blazing fast (you do not notice it is javascript ;-)).
EDIT:
Pre release of IE10 for Windows 7 is just launched, installed it and lag is gone!
You can download it from here:
http://www.microsoft.com/en-us/download/details.aspx?id=35709
Introduction to my question:
I have tried XULRunner of Mozilla a long time ago but the first time was not a pleasure to me and also i tried it today again but can't get it to work. Get a parse error in the main xul file of the project, window is an undefined entity. ??? I create a sample project like: http://mdn.beonex.com/en/Getting_started_with_XULRunner.html
I do not know what to do about this error. Also i think documentation is not up-to-date? Most documentation is from around 2006.
The question, what i want to know:
Before i am going to waste my time (see also introduction), is it
possible to create frameless (full-screen) desktop executables with
use of XULRunner like with PhoneGap?
Is it possible to create cross-platform applications with XULRunner, i mean, does it really work seamless. Where can i find a ready-to-publish example of a XULRunner project and is it possible to load local HTML file(s) like in PhoneGap?
It is possible and allowed to access external resources?
Long story, but maybe there is somebody that have tried this before and can lead me to choose the right direction.
is it possible to create frameless (full-screen) desktop executables with use of XULRunner like with PhoneGap?
Yes. You use disablechrome attribute to remove the window frame and sizemode="maximized" to have it open full-screen. Alternatively you can use the full-screen API if you want your application to run in a normal window and only switch to full-screen mode on request.
Is it possible to create cross-platform applications with XULRunner
Yes. There are things like menus that work very differently on OS X but most of the time you don't need to care what operating system your application runs on (Windows, Linux and Mac OS X supported).
Where can i find a ready-to-publish example of a XULRunner project
See documentation for a XULRunner application example. For "ready-to-publish" you would need an installer which doesn't come with the platform.
is it possible to load local HTML file(s) like in PhoneGap?
Yes. The top-level window has to be XUL but you can use some very minimal code here - essentially a single <iframe flex="1"/> tag. You can load HTML pages into that frame then.
It is possible and allowed to access external resources?
Yes, XULRunner applications have full privileges and can access files on disk as well as web resources without any restrictions.

Resources