2 // Based on Extension Developer's install.js
3 // More info: http://www.xulplanet.com/tutorials/xultu/xpiscript.html
5 const APP_DISPLAY_NAME
= "Greasemonkey";
6 const APP_PACKAGE
= "/greasemonkey.mozdev.org/greasemonkey";
7 const APP_NAME
= "/greasemonkey";
8 // TODO: figure out how to extract this from install.rdf
9 // or generate install.rdf ...
10 const APP_VERSION
= "0.6.5.20060726";
12 var instFlags
= DELAYED_CHROME
;
14 // So, some wierd thing causes extension manager in FF to sometimes fail when
15 // trying to delete the temporary xpi file in the last step of installing gm.
16 // Unfortunately, the error handling sucks so it interprets any failure
17 // whatsoever as a missing install.rdf and falls back on this file.
18 // If this file were to run on FF it would create strange really incorrect
19 // behavior and just generally be bad since it is the Seamonkey installer.
21 // So... this is a lame attempt at detecting whether we are on Firefox. If so,
22 // we do nothing. If not, we assume we're in Seamonkey and continue.
23 var ffExtFolder
= getFolder("Profile", "extensions");
24 if (!File
.exists(ffExtFolder
)) {
26 var chromef
= getFolder("Profile", "chrome/greasemonkey/");
28 initInstall(APP_NAME
, APP_PACKAGE
, APP_VERSION
);
30 var err
= addDirectory(APP_PACKAGE
, APP_VERSION
, "chrome/greasemonkey", chromef
, null);
33 registerChrome(CONTENT
| instFlags
, getFolder( "Profile", "chrome/greasemonkey/content/" ));
34 //registerChrome(LOCALE | instFlags, ...);
35 //registerChrome(SKIN | instFlags, ...);
36 err
= performInstall();
38 alert(APP_DISPLAY_NAME
+ " " + APP_VERSION
+ " has been succesfully installed.\n"
39 +"Please restart your browser before continuing.");
41 alert("Install failed. Error code:" + err
);
45 alert("Failed to create chrome directory\n"
46 +"You probably don't have appropriate permissions \n"
47 +"(write access to Profile/chrome directory). \n"
48 +"_____________________________\nError code:" + err
);