A narrative on the future of web browsers and web browsing

Prism and Extensions

October 22, 2009 – 5:21 pm

One of the most frequent questions I get about Prism is how to make it work with such-and-such beloved Firefox extension. One thing is certain, to make an extension work with Prism you have to add Prism’s application ID to the extension’s install.rdf file, as described here. The ID for Prism is prism@developer.mozilla.org. The easiest way to install the modified extension is to enable the status bar by setting status=true in your app’s webapp.ini file. You can then select Tools/Add-ons… in the “gear” menu in the status bar and click the Install… button in the dialog. Open the XPI file of your extension to install it.

However, that probably isn’t all there is to it. Many (most?) extensions include some kind of overlay that modifies the main browser chrome window. This file is called browser.xul in Firefox, but webrunner.xul in Prism. So you’ll also need to go into the chrome.manifest file in the extension XPI and change the overlay line. Say it reads:

overlay chrome://browser/content/browser.xul  chrome://extension/content/overlay.xul

You’ll want to change that to:

overlay chrome://browser/content/webrunner.xul  chrome://extension/content/overlay.xul

I sound like a ginsu knife salesman, I know, but that’s still not all. If the overlay modifies, say, the browser’s popup menu, in Firefox it would want to modify a <popup> with the ID “contentAreaPopupMenu” whereas in Prism it’s a <menupopup> with the ID “popup_content”. I don’t have a good explanation for why the IDs differ. I can only say that this decision predates my involvement in the Prism project. You can compare and contrast the IDs used for various browser chrome elements by looking at the code for browser.xul and webrunner.xul.

This should be enough for the brave of heart to hack a lot of Firefox extensions to work in Prism. But it’s hardly ideal. There are a few ways I can imagine to improve the situation:

  • Harmonize the IDs of chrome elements shared by Prism and Firefox. At least this would make a lot of existing overlays work in Prism without modification.
  • Rename webbrowser.xul to browser.xul. This would remove the need to modify the extension’s chrome.manifest in most cases.
  • Implement an intermediate browser layer that can be used by Firefox, Prism and other XULRunner-based browsers. Right now, a lot of browser code in the Mozilla tree is under the toolkit/ directory and can be used by any XULRunner app (e.g. the download manager, extension manager, etc.). But some code is in the browser/ directory, which is part of Firefox, not XULRunner. It might make sense to factor out the code in browser/ that would be useful for other web browsers. Among other things, this would probably mean splitting browser.xul into two files, one used by Firefox and the other in the shared layer. Firefox extensions would mainly hook into the shared layer so they would work without modification in other XULRunner-based browser apps.
  • Base Prism on Firefox. This is an idea that we discussed ages ago but somehow fell by the wayside. In a nutshell, Prism would be Firefox, but with most of the chrome hidden (e.g. toolbars). This would mean that pretty much any Firefox extension would work out-of-the-box in Prism. It would also solve many other Prism issues (e.g. people are always complaining that Prism lacks some feature — like Quick Find — that then has to be added to webrunner.xul by hand). The biggest challenge would be to hide the requisite browser chrome. I’ve yet to determine to what extent this might pose problems, but Daniel Glazman’s FullerScreen might provide some useful hints.

The idea of an intermediate layer is appealing from a software engineering standpoint, but doesn’t strike me as particularly realistic because of the changes it would require in Firefox code. I’m leaning towards basing Prism on Firefox (as we originally planned to do months ago).

  1. 14 Responses to “Prism and Extensions”

  2. Oh please do this. I have been waiting for two years for Prism to be easily extension-able. So many of the sites I use Prism for are the ones that I want to have site-specific extensions working for in the first place.

    By Gil on Oct 22, 2009

  3. I looked at prism months ago and didn’t really get it. Can you, Matt, explain to me, Ben, as a layman, what would be one or two good uses for prism? I use stand-alone apps for certain things, like Tweetie and Shifd, so I see how a customizable application could be helpful, but I’m not sure when I would benefit from Prism instead of downloading a specialized application.

    By Ben on Oct 22, 2009

  4. Hey Ben,

    I would say the advantages are quite close to those of standalone apps, but it’s much easier to develop a Prism app that duplicates the functionality of the web site. Twitter has a lot of standalone apps but most sites don’t, so Prism provides a strong alternative.

    You might have missed my earlier post on this topic.

    By Matthew Gertner on Oct 23, 2009

  5. I really like the idea that Prism could be just Firefox scaled down.

    Like you mentioned with extensions, something like browser plugins would be beneficial too.

    It is pretty much just rethinking the purpose of the browser. No need for bookmarks or back/forward buttons. Tabs could only be of use for a specific app like Google Docs. Each iteration it’s own process(es), and maybe its own local storage.

    Whoops… I just realized this sounds alot like Google Chrome.

    Maybe the new proposed design changes for the future versions of firefox would benefit Prism?

    By Dan on Oct 23, 2009

  6. You think in the right direction but not entirely consistently.

    It is essentially correct that Prism should be just Firefox scaled down, but who sould decide what should be stripped from Firefox and what retained?

    Currently Prism’s creators decide this, but I think that this should be entirely up to developers of Prism apps – they should be able to strip or retain just any of Firefox GUI element; and if developer wishes (however it might seem strange) he must be able to recreate even entire browser.

    And of course to be able to install any Firefox extension is essential.

    Prism having ability to strip or include any Firefox GUI element and install any Firefox extension will become a strong platform for a new kind of browser-centric applications.

    By Laisvunas on Oct 24, 2009

  7. There is certainly scope for discussing some sort of unification of Firefox and Prism. I do believe that the use case for running a web app is different from that of a web browser, and that the UI should be adapted accordingly. But some degree of customization for Prism apps should certainly be an option; for example, whether to have a menu bar or not could be up to the web app itself.

    By Matthew Gertner on Oct 27, 2009

  8. Thanks for the tips matt. Just to double-check, the “” and ID should be in the same “chrome.manifest” file, right? I wasn’t sure.

    I’m a big fan of prism but yeah lack of extensions is definitely keeping me from using it more…

    By Uriel on Dec 4, 2009

  9. Hi! i try to install EpubReader addon in Prism 1.0b4. But appears:

    “EPUBReader 1.2.8.2 could not be installed because it is not compatible with Prism 1.0b4.”

    I have added that code in Install.rdf:



    prism@developer.mozilla.org
    0.9
    1.0b4

    And I have added that code in chrome.manifest:

    override chrome://webrunner/content/overlays/inspector.xul
    data:text/xml, application=prism@developer.mozilla.org appversion=1.0b4

    overlay chrome://webrunner/content/webrunner.xul chrome://epubreader/content/overlay.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={a23983c0-fd0e-11dc-95ff-0800200c9a66}

    But it doesn´t work. Is there something more that i have to do? or is not possible?

    THANX! i´m sorry, my english is not so good…

    By Javier Nalda on May 31, 2010

  10. Hello again!

    i have disabled compatibility checking in Prism. In file “nsExtensionManager.js”.

    Now Epubreader is installed, but doesnt work like in firefox. Prism doesnt read epub…

    any idea?

    thanx!!
    Javier

    By Javier Nalda on May 31, 2010

  11. Why not just strip the toolbars from firefox, and put a desktop shortcut to the url. Duh. Prism is unstunning. Very.

    By Baldemar Huerta on Jun 18, 2010

  12. I’d really like to vote for this, the one current thing blocking me from moving my web app over to Prism is the lack of support for sidebars and tabs. Without this, I’m going to have to build my own XUL to ’simulate’ these features, but it won’t look as nice as Firefox.

    By joe on Aug 28, 2010

    Trackback URL for this post


    http://browsing.justdiscourse.com/2009/10/22/prism-and-extensions/trackback/
  1. 3 Trackback(s)

  2. Oct 22, 2009: Tweets that mention Just Browsing » Prism and Extensions -- Topsy.com
  3. Nov 12, 2009: firefox 3.6 beta 1 | hocteto.com
  4. Feb 22, 2010: Mozilla Labs » prism » Blog Archive » Prism Updated, Planning Next Steps

Post a Comment