Packaging Mozilla (FireBreath) plugins into .xpi for FireFox? - linux

Possibly this is related to Using a plugin generated with Firebreath in a Firefox Extension?; however, my question is possibly more specific, so here goes...
I'm working on Linux (Ubuntu 11.04), and I have built a Mozilla/Firefox (Firefox 7) plugin using FireBreath. The resulting plugin on this platform is an "npXXX.so" file, which I got symlinked in ~/.mozilla/plugins. Then, I have coded an extension that uses this plugin - and apart from the symlink, nothing else seems required - all seems to work just smashing :)
So, knowing that "firefox supports installing your plugin via XPI. This is not recommended by the FireBreath team", now I'd still like to package the extension AND the plugin into an XPI file. So, I'm reading a bit on Structure of an installable bundle - MDN, and I can see these two possibilities:
/components/* XPCOM components (*.js, *.dll), and interface files from *.xpt (>=1.7)
...
/plugins/* NPAPI Plugins (>=1.8)
...
binary-component components/linux/mycomponent.so ABI=Linux_x86-gcc3
Now, it says: "The older XPCOM- and LiveConnect-based APIs for plugins should not be used.", so I guess the "/components" directory should not be used (even if it is given as an example in the above page). And I can not find this stated explicitly anywhere, but I'm guessing FireBreath builds NPAPI plugins - so presumably "/plugins" is the way to go. (There is also mention of "/platform", but it clearly says it's been deprecated for Firefox > 3.6).
Ok, so far so good... So I try to copy the plugin file to plugins/linux inside the extension directory:
cp -L ~/.mozilla/plugins/npXXX.so plugins/linux/
... and then insert the following in chrome.manifest:
binary-component plugins/linux/npXXX.so ABI=Linux_x86-gcc4
... then I zip the whole extension directory (the plugin included) as an .xpi, try to install it on a different computer. There, the .xpi succesfully installs, the .so file is indeed unpacked under the profile's extensions/XXX/plugins/linux/ directory - and every cross-platform (javascript) code of the extension works fine; except that the plugin cannot be found.
Now, of course, the user could themselves symlink the extension .so to ~/.mozilla/plugins/; however, I would like to spare the user of that :)
How would I go about this kind of packaging thing - is there a recommended way to do it?
Many thanks in advance for any answers,
Cheers!
Edit: found Shipping a plugin as a Toolkit bundle - MDN which claims only install.rdf , and a plugins/obj.so is needed; then I found Running Quake Live in Firefox 4, 5 and 6 on Linux [fixes inside], referring to a QuakeLivePlugin_433-modded_ff10.xpi, and that one does indeed follow such a simple structure.. If I install that, I get both a Quake extension and a Quake plugin (and that even with Error Console complaining "Could not read chrome manifest file '/path/to/extensions/quakeliveplugin#idsoftware.com/chrome.manifest'.") .... but if I try the same with my FireBreath plugin (e.g. just an install.rdf and plugin in /plugins), only extension gets shown - no plugin (and no reasonable error messages).. Could this be a problem with FireBreath?

Well, I'll post this as an answer - I have just confirmed that FireBreath plugin does in fact work being packaged in the simple "toolkit bundle" way as an .xpi extension.
Basically, I just cleared up my development PC's Firefox profile, and tried to install the .xpi carrying the plugin there - and on the dev PC, the plugin shows in about:plugins and runs just fine (even if it's just unpacked in profile/extensions/EXT/plugins/obj.so, and not in ~/.mozilla/plugins)... In fact, I packaged both the extension and the plugin in separate .xpi's, which were then merged in a single one as recommended in Multiple Item Package - MDN - and that works fine too (upon loading the merged xpi, one gets prompted about installing two extensions - one for the plugin carrying one, and the other for the "plain" extension)...
So the problem was on the other test computer only - and the problem seems to be that I'm using Gnome libraries in the plugin, and while my dev PC is Ubuntu 11.04 - I think this test PC was Ubuntu 10.04 ... So, quite likely, the problem is incompatible Gnome libraries in the plugin build; unfortunately, I don't get many errors back from firefox, even if I do:
NSPR_LOG_MODULES=IPCPlugins:5 NSPR_LOG_FILE=/tmp/plugins.log /path/to/firefox -P myprofile
(... as recommended in Logging Multi-Process Plugins - MDN - however, the /tmp/plugins.log remains empty). The only thing Firefox on the problem machine spits is something like this to stdout:
WARNING: Application calling GLX 1.3 function "glXCreatePixmap" when GLX 1.3 is not supported! This is an application bug!
WARNING: Application calling GLX 1.3 function "glXDestroyPixmap" when GLX 1.3 is not supported! This is an application bug!
(firefox:6548): GLib-GObject-WARNING **: /build/buildd/glib2.0-2.24.1/gobject/gsignal.c:1149: unable to lookup signal "text-insert" for non instantiatable type `AtkText'
... and I cannot tell if this has something to do with the plugin or not... But I guess at least the packaging part got confirmed as working now :) Cheers!
EDIT: After a while, the Firefox on the test PC did spit out the following (although I would have expected this message to pop up instantly):
LoadPlugin: failed to initialize shared library /path/to/profile/extensions/extXXX/plugins/npXXX.so [/usr/lib/libstdc++.so.6: version ``GLIBCXX_3.4.14' not found (required by /path/to/profile/extensions/extXXX/plugins/npXXX.so)]
... which finally confirms it was a build problem I have had.

Related

Resources to start building my own mozilla

I am trying to learn and build my own version of mozilla with customizations. But I have no idea where to start and how to proceed. Can someone enlighten me in the following aspects:
1.Where to clone the latest open source code for mozilla
2.Where to learn the browser architecture and file structure(For linux/Ubuntu) So that I can customize the codes and add my own custom
addons.
3.How to debug and build the browser for Linux.
I heard its purely HTML,CSS and javascript. I have a low level expertise in all of this but no idea where to put together all of these. Please enlighten me with any resources. Basically I need a kickstart. Googling didn't gives me any such basic tutorials. I hope someone here would have tried these things before :) Any help is much appreciated.
There's a very handy guide on how to build Mozilla Firefox on MDN. Here's an outline of the steps:
Install the build prerequisite for Linux as described here - wget -q https://hg.mozilla.org/mozilla-central/raw-file/default/python/mozboot/bin/bootstrap.py -O bootstrap.py && python bootstrap.py
Clone the repository locally using mercurial - hg clone https://hg.mozilla.org/mozilla-central
Change the current working directory to mozilla-central and then issue the ./mach build command. This will produce a vanilla version of Firefox, unbranded (aka developer build).
Once building is complete, you can run your copy using ./mach build or package it using ./mach package.
In order to customize your build, you need to both change the code and the building options. The latter can be done by creating a .mozconfig file in the mozilla-central directory and adding the desired build options there.
Where to learn the browser architecture and file structure(For
linux/Ubuntu) So that I can customize the codes and add my own custom
addons.
To understand a bit more about the structure of the Firefox source code, you can have a look at this nice overview. Basically, each top directory represents a component of the browser (e.g. dom, browser, toolkit, ...). Depending on what you need, you have to change the code in the related directory. When you're lost and trying to find what to change, DXR can come to the rescue: it's the official Mozilla code search engine.
You mentioned addons: I'm not sure what's your objective, but if you just need to develop an addon, then you don't really need to build Firefox from scratch. There's a lot of documentation about how to create addons, if needed.
How to debug and build the browser for Linux.
The first part of this answers explains how to build. In order to debug, once you've built Firefox, simply run it with the command ./mach run --debugger. This will allow you to debug the C++ core of Firefox. However, for most of the front end code (which lives in browser/*), that's not needed: you can simply run Firefox and use the Browser Toolbox.

webgrind not showing function names or file source

I'm trying to profile a web application with xDebug and Webgrind since I'm doing it in a remote Linux server. For some weird reason it doesn't show call names or file source. I was suspecting that there might be some kind problem with readying the script files (not sure if it's doing it) but giving target folders 777 didn't make any difference. Does anybody have a clue where I'm failing?
Thanx!
The webgrind version found on google code does not work for xDebug 2.3.
Here is a fork that works: webgrind
Ok, 24h later:
Seems that webcache grind doesn't support cachegrind file function compression feature that was introduced in xDebug 2.3 (released 2015). The latest webgrind was released ~2008-2009 so makes sens that it doesn't work. The same applies to WinCacheGrind client. Currently seems that only Windows cachegrind analyzer is qCacheGrind and linux client kCacheGrind
When I maange to find some free time I'll fork the project and make it compatible with compression.

Why does it give warning when I run GStreamer application?

I can compile the first gstreamer tutorial found here.
However, when try to run it, I get a warning like this:
(basic-tutorial-1:27661): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-0.10/libgstffmpeg.so': /usr/lib/x86_64-linux-gnu/libavcodec.so.53: undefined symbol: lame_set_VBR_quality
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
jack server is not running or cannot be started
How can I solve the lame_set_VBR_quality problem?
there are two unrelated problems reported in output:
gstffmpeg
on startup, gstreamer scans for available plugins and tries to load them.
among these plugins is the file /usr/lib/gstreamer-0.10/libgstffmpeg.so.
it seems that you have installed incompatible libraries (e.g. your gstreamer "ffmpeg" plugin depends on a different version of libavcodec.so), so the ffmpeg-plugin set cannot be loaded.
the problem is not really related to gstreamer itself, but rather to the way how you installed those libraries.
since linux-distributions usually are all about resolving inter-package dependencies (so that you can never install a package "foo-2.0" that depends on "bar-0.4" if you only have "bar-0.1" installed), i guess that you have added some non-official unsupported 3rd-party repositories (e.g. on debian, a common source of headaches is the deb-multimedia repository; other distros will have others).
if all libraries installed are from the official repository of your distro, chances are that you hit a bug in the packaging and you should report the bug to the maintainers of the package(s) providing the faulty libraries.
jack
the other "error" about jack not being able to start, is because the pipeline you are using uses the generic playbin2 element, which probes for available playback backends. while doing so, it also tries to connect to a running jack-server, fails to do so and (hopefully) falls back to another available audio framework.
One additional comment on the audio side. Check whether something simple as gst-launch audiotestsrc ! autoaudiosink works. Try again with pulsesink or alsasink instead of autoaudiosink. These 2 would be tried before considering jack.

installing openscenegraph with plugins

I'm having trouble installing openscenegraph with vrml plugins Can anyone provide some suggestions?
I'm working on Snow Leopard, and I downloaded the latest OpenVRML 0.18, and OpenSceneGraph 3.0.1
I can get OpenSceneGraph to work, however, I need to load VRML files, and when I use osg to read the file, it says that it can't find any plugin.
I tried installing OpenVRML by compiling from source, but it fails configuring, since it seems to be unable to fine libboost_thread-mt library file, even though I have it installed, and linking to it works.
OSG picks plugins by extension of the file it's trying to load - if your file ends in .vrml, try changing to .wrl and see if it loads - maybe your installation download had the VRML plugin, but it wasn't finding it.
If you just have a few files, the it'll be easier to use something like:
http://www.cs.princeton.edu/~min/meshconv/
to convert them to stl or obj files, rather than building the plugin. Otherwise, you'll want to consult the OSG mailing list/forum. Join the forum now, anyways, new users' messages don't often get posted right away.

any new firefox 3.5.X security improvements that'd prevent access "chrome://" uri paths in markup?

A little context:
I'm trying to build and run the unit tests for the source of the Selenium IDE plugin. Everything builds correctly (through maven commands, et al) and the unit tests fire up an instance of Firefox. However, the jsUnit testRunner.html page freezes whenever a chrome://-accessed uri path is encountered.
I realize there are a LOT of moving parts in this situation, but I'm fairly certain/convinced that it's centered on an inability to access chrome:// paths within the markup of testRunner.html.
I am working with:
Firefox 3.5.7
Selenium IDE 1.0.3 source
Maven 2.2.1
Windows XP box
I've already taken into account various known required tweaks for such execution in a Firefox 3.X environment (setting security.fileuri.strict_origin_policy = false in the profile preferences and adding contentaccessible=yes to the chrome.manifest file of selenium-ide), but to no avail.
Does anyone have any insight into such an issue? I know my specific situation includes building Selenium IDE, but my gut is telling me it's a simple browser security situation.
Any and all insight is much appreciated!

Resources