<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.mozilla.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Greylurk</id>
	<title>MozillaWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.mozilla.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Greylurk"/>
	<link rel="alternate" type="text/html" href="https://wiki.mozilla.org/Special:Contributions/Greylurk"/>
	<updated>2026-05-03T02:35:02Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.10</generator>
	<entry>
		<id>https://wiki.mozilla.org/index.php?title=Prism/Scripting&amp;diff=78976</id>
		<title>Prism/Scripting</title>
		<link rel="alternate" type="text/html" href="https://wiki.mozilla.org/index.php?title=Prism/Scripting&amp;diff=78976"/>
		<updated>2008-01-02T14:58:01Z</updated>

		<summary type="html">&lt;p&gt;Greylurk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Prism allows for some client-side web application customization. The web application [[Prism/Bundle|bundle]] is allowed to hold a JavaScript file named &#039;&#039;&#039;webapp.js&#039;&#039;&#039; (called the webapp script). This file will be loaded into the Prism chrome window very much like a Firefox extension is loaded into the browser chrome window.&lt;br /&gt;
&lt;br /&gt;
Prism exposes a simple HostUI object to the webapp script. The HostUI object exposes some utility functions that may be useful to the webapp script. The interface is shown below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Simple host API exposed to the web application script files.&lt;br /&gt;
 */&lt;br /&gt;
var HostUI = {&lt;br /&gt;
  // log a message to the error console&lt;br /&gt;
  void log(aMsg);&lt;br /&gt;
&lt;br /&gt;
  // get a reference to the main content web browser&lt;br /&gt;
  browser getBrowser();&lt;br /&gt;
&lt;br /&gt;
  // show a popup alert message&lt;br /&gt;
  void showAlert(aImage, aTitle, aMsg);&lt;br /&gt;
&lt;br /&gt;
  // access the Sidebar object&lt;br /&gt;
  object sidebar;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
var Sidebar = {&lt;br /&gt;
  // collapse or expand the sidebar&lt;br /&gt;
  boolean visible;&lt;br /&gt;
&lt;br /&gt;
  // sets the web content of the sidebar&lt;br /&gt;
  void add(aTitle, aURI);&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==HostUI methods==&lt;br /&gt;
The methods exposed by the HostUI object allow interaction with the Prism runtime environment.  &lt;br /&gt;
&lt;br /&gt;
; void log(aMsg);&lt;br /&gt;
: Logs a message to the Prism error console.  &lt;br /&gt;
; browser getBrowser();&lt;br /&gt;
: Returns a reference to the XUL [http://developer.mozilla.org/en/docs/XUL:browser Browser] object which displays the Prism documents&lt;br /&gt;
; showAlert(aImage, aTitle, aMsg);&lt;br /&gt;
: showAlert provides a thin wrapper around the [http://developer.mozilla.org/en/docs/nsIAlertsService nsIAlertsService.showAlertNotification] XPCOM method.&lt;br /&gt;
:; aImage&lt;br /&gt;
:: A URL to the image which should be displayed in the notification&lt;br /&gt;
:; aTitle&lt;br /&gt;
:: The string to be used as the title for the alert&lt;br /&gt;
:; aMsg&lt;br /&gt;
:: The text of the message to be displayed in the alert&lt;br /&gt;
&lt;br /&gt;
There are also hooks that are called when Prism has loaded and when it is about to exit. You can declare these functions in the webapp script:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function startup() {&lt;br /&gt;
  // called during startup&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function shutdown() {&lt;br /&gt;
  // called during shutdown&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Currently, the webapp script also has access to full XPCOM functionality, just like a Firefox extension. This level of functionality is commonly called &#039;&#039;chrome-level&#039;&#039; privileges. It means that the script has a higher level of privilege than scripts in the web content and has access to the file system, clipboard and other parts of the native OS.&lt;br /&gt;
&amp;lt;div class=&amp;quot;note&amp;quot;&amp;gt;In the future, the webapp script may have lower privileges. We are looking into the security aspects of the higher privilege level.&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>Greylurk</name></author>
	</entry>
	<entry>
		<id>https://wiki.mozilla.org/index.php?title=Prism/Bundle&amp;diff=78974</id>
		<title>Prism/Bundle</title>
		<link rel="alternate" type="text/html" href="https://wiki.mozilla.org/index.php?title=Prism/Bundle&amp;diff=78974"/>
		<updated>2008-01-02T14:35:10Z</updated>

		<summary type="html">&lt;p&gt;Greylurk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==WebApp Bundle==&lt;br /&gt;
In addition to passing simple command line parameters, [http://wiki.mozilla.org/Prism Prism] can use a zipped bundle package to install a webapp. The bundle can hold additional resources currently limited to:&lt;br /&gt;
* Application INI settings&lt;br /&gt;
* Application icon&lt;br /&gt;
* Script for the application chrome, not the web content&lt;br /&gt;
&lt;br /&gt;
==Installing a Bundle==&lt;br /&gt;
When Prism opens a webapp bundle it will unpack it into the &#039;&#039;&#039;webapps/{webapp-id}&#039;&#039;&#039; folder in your Prism profile. The web application may save other data into this folder. Prism will not overwrite or delete any extra data added to the folder. In fact, Prism saves some extra data itself - a file that holds some persistent UI data called &#039;&#039;localstore.json&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;note&amp;quot;&amp;gt;The webapp must have an ID in order to be installed.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When Prism is launched with a &amp;quot;-webapp [bundle]&amp;quot; command line, the bundle must first be unpacked before the web application is launched. This can slow the overall launch time and the unpacking is redundant if the bundle has been launched previously. This is why the preferred method of launching is to use the &amp;quot;-webapp [webapp-id]&amp;quot; command line, which looks for the previously installed (unpacked) web application in the Prism &#039;&#039;&#039;webapps/{webapp-id}&#039;&#039;&#039; folder. The web application is then launched without the unpacking overhead.&lt;br /&gt;
&lt;br /&gt;
==HowTo==&lt;br /&gt;
&lt;br /&gt;
Here is a simple way to build a basic web application bundle:&lt;br /&gt;
&lt;br /&gt;
* Create file called webapp.ini that contains something like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Parameters]&lt;br /&gt;
id=unique-app-id@unique-author-id.whatever&lt;br /&gt;
uri=http://[the-url-what-you-want-to-connect-to]/&lt;br /&gt;
status=yes&lt;br /&gt;
location=no&lt;br /&gt;
sidebar=no&lt;br /&gt;
navigation=no&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Zip the file to [whatever].webapp&lt;br /&gt;
* Double-click the webapp bundle or use &amp;lt;code&amp;gt;prism -webapp [path-to-webapp]&lt;br /&gt;
&lt;br /&gt;
==Structure==&lt;br /&gt;
A bundle can contain the following files.  Any other files in the .webapp file will be ignored.  After the .webapp file is executed the first time, these files will be unzipped and &amp;quot;cached&amp;quot; to a local directory structure.&lt;br /&gt;
&lt;br /&gt;
; /&lt;br /&gt;
: webapp.ini&lt;br /&gt;
: webapp.js&lt;br /&gt;
: webapp.css&lt;br /&gt;
:; winnt&lt;br /&gt;
:: webapp.css&lt;br /&gt;
:; darwin&lt;br /&gt;
:: webapp.css&lt;br /&gt;
:; linux&lt;br /&gt;
:: webapp.css&lt;br /&gt;
: [icon].ico&lt;br /&gt;
: [icon].xpm&lt;br /&gt;
: [icon].icns&lt;/div&gt;</summary>
		<author><name>Greylurk</name></author>
	</entry>
</feed>