summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Stransky <stransky@redhat.com>2011-08-16 17:20:15 +0200
committerMartin Stransky <stransky@redhat.com>2011-08-16 17:20:15 +0200
commit360a07539e6957cd65d3e01a64313dcd7d0f08b2 (patch)
tree07c638fc0f5eeddc04ee554878fa57608242cb74
parentFix an issue with a stray glyph in the window title bar. (diff)
downloadlibrewolf-fedora-ff-360a07539e6957cd65d3e01a64313dcd7d0f08b2.tar.gz
librewolf-fedora-ff-360a07539e6957cd65d3e01a64313dcd7d0f08b2.tar.bz2
librewolf-fedora-ff-360a07539e6957cd65d3e01a64313dcd7d0f08b2.zip
Update to 6.0
-rw-r--r--.gitignore2
-rw-r--r--firefox-4.0-gnome3.patch1299
-rw-r--r--firefox-4.0-moz-app-launcher.patch137
-rw-r--r--firefox-5.0-xulstub.patch1843
-rw-r--r--firefox-stub.patch38
-rw-r--r--firefox-version.patch7
-rw-r--r--firefox.spec43
-rw-r--r--sources4
8 files changed, 23 insertions, 3350 deletions
diff --git a/.gitignore b/.gitignore
index 1e3ac70..aac5a83 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,3 +26,5 @@ firefox-3.6.4.source.tar.bz2
/firefox-langpacks-4.0.1-20110428.tar.xz
/firefox-5.0.source.tar.bz2
/firefox-langpacks-5.0-20110621.tar.xz
+/firefox-6.0.source.tar.bz2
+/firefox-langpacks-6.0-20110816.tar.xz
diff --git a/firefox-4.0-gnome3.patch b/firefox-4.0-gnome3.patch
deleted file mode 100644
index c1f229a..0000000
--- a/firefox-4.0-gnome3.patch
+++ /dev/null
@@ -1,1299 +0,0 @@
-diff --git a/toolkit/system/gnome/nsGIOService.cpp b/toolkit/system/gnome/nsGIOService.cpp
---- a/toolkit/system/gnome/nsGIOService.cpp
-+++ b/toolkit/system/gnome/nsGIOService.cpp
-@@ -101,25 +101,25 @@ nsGIOMimeApp::GetName(nsACString& aName)
- return NS_OK;
- }
-
- NS_IMETHODIMP
- nsGIOMimeApp::GetCommand(nsACString& aCommand)
- {
- get_commandline_t g_app_info_get_commandline_ptr;
-
-- void *libHandle = dlopen("libgio-2.0.so", RTLD_LAZY);
-+ void *libHandle = dlopen("libgio-2.0.so.0", RTLD_LAZY);
- if (!libHandle) {
- return NS_ERROR_FAILURE;
- }
- dlerror(); /* clear any existing error */
- g_app_info_get_commandline_ptr =
- (get_commandline_t) dlsym(libHandle, "g_app_info_get_commandline");
-- if (dlerror() != NULL) {
-- const char cmd = *g_app_info_get_commandline_ptr(mApp);
-+ if (dlerror() == NULL) {
-+ const char *cmd = g_app_info_get_commandline_ptr(mApp);
- if (!cmd) {
- dlclose(libHandle);
- return NS_ERROR_FAILURE;
- }
- aCommand.Assign(cmd);
- }
- dlclose(libHandle);
- return NS_OK;
-@@ -414,75 +414,46 @@ nsGIOService::CreateAppFromCommand(nsACS
- nsIGIOMimeApp** appInfo)
- {
- GError *error = NULL;
- *appInfo = nsnull;
-
- GAppInfo *app_info = NULL, *app_info_from_list = NULL;
- GList *apps = g_app_info_get_all();
- GList *apps_p = apps;
-- get_commandline_t g_app_info_get_commandline_ptr;
--
-- void *libHandle = dlopen("libgio-2.0.so", RTLD_LAZY);
-- if (!libHandle) {
-- return NS_ERROR_FAILURE;
-- }
-- dlerror(); /* clear any existing error */
-- g_app_info_get_commandline_ptr =
-- (get_commandline_t) dlsym(libHandle, "g_app_info_get_commandline");
-- if (dlerror() != NULL) {
-- g_app_info_get_commandline_ptr = NULL;
-- }
-
- // Try to find relevant and existing GAppInfo in all installed application
-+ // We do this by comparing each GAppInfo's executable with out own
- while (apps_p) {
- app_info_from_list = (GAppInfo*) apps_p->data;
-- /* This is a silly test. It just compares app names but not
-- * commands. This is due to old version of Glib/Gio. The required
-- * function which allows to do a regular check of existence of desktop file
-- * is possible by using function g_app_info_get_commandline. This function
-- * has been introduced in Glib 2.20. */
-- if (app_info_from_list && strcmp(g_app_info_get_name(app_info_from_list),
-- PromiseFlatCString(appName).get()) == 0 )
-- {
-- if (g_app_info_get_commandline_ptr)
-- {
-- /* Following test is only possible with Glib >= 2.20.
-- * Compare path only by using strncmp */
-- if (strncmp(g_app_info_get_commandline_ptr(app_info_from_list),
-- PromiseFlatCString(cmd).get(),
-- strlen(PromiseFlatCString(cmd).get())) == 0)
-- {
-- app_info = app_info_from_list;
-- break;
-- } else {
-- g_object_unref(app_info_from_list);
-- }
-- } else {
-+ if (!app_info) {
-+ // If the executable is not absolute, get it's full path
-+ char *executable = g_find_program_in_path(g_app_info_get_executable(app_info_from_list));
-+
-+ if (executable && strcmp(executable, PromiseFlatCString(cmd).get()) == 0) {
-+ g_object_ref (app_info_from_list);
- app_info = app_info_from_list;
-- break;
- }
-- } else {
-- g_object_unref(app_info_from_list);
-+ g_free(executable);
- }
-+
-+ g_object_unref(app_info_from_list);
- apps_p = apps_p->next;
- }
- g_list_free(apps);
-
- if (!app_info) {
- app_info = g_app_info_create_from_commandline(PromiseFlatCString(cmd).get(),
- PromiseFlatCString(appName).get(),
- G_APP_INFO_CREATE_SUPPORTS_URIS,
- &error);
- }
-
- if (!app_info) {
- g_warning("Cannot create application info from command: %s", error->message);
- g_error_free(error);
-- dlclose(libHandle);
- return NS_ERROR_FAILURE;
- }
- nsGIOMimeApp *mozApp = new nsGIOMimeApp(app_info);
- NS_ENSURE_TRUE(mozApp, NS_ERROR_OUT_OF_MEMORY);
- NS_ADDREF(*appInfo = mozApp);
-- dlclose(libHandle);
- return NS_OK;
- }
-
-diff --git a/browser/components/shell/src/nsGNOMEShellService.cpp b/browser/components/shell/src/nsGNOMEShellService.cpp
---- a/browser/components/shell/src/nsGNOMEShellService.cpp
-+++ b/browser/components/shell/src/nsGNOMEShellService.cpp
-@@ -101,24 +101,24 @@ static const char kDesktopOptionsKey[] =
- static const char kDesktopDrawBGKey[] = DG_BACKGROUND "/draw_background";
- static const char kDesktopColorKey[] = DG_BACKGROUND "/primary_color";
-
- nsresult
- nsGNOMEShellService::Init()
- {
- nsresult rv;
-
-- // GConf _must_ be available, or we do not allow
-+ // GConf or GIO _must_ be available, or we do not allow
- // CreateInstance to succeed.
-
- nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
- nsCOMPtr<nsIGIOService> giovfs =
- do_GetService(NS_GIOSERVICE_CONTRACTID);
-
-- if (!gconf)
-+ if (!gconf && !giovfs)
- return NS_ERROR_NOT_AVAILABLE;
-
- // Check G_BROKEN_FILENAMES. If it's set, then filenames in glib use
- // the locale encoding. If it's not set, they use UTF-8.
- mUseLocaleFilenames = PR_GetEnv("G_BROKEN_FILENAMES") != nsnull;
-
- if (GetAppPathFromLauncher())
- return NS_OK;
-@@ -189,50 +189,77 @@ nsGNOMEShellService::KeyMatchesAppName(c
- if (!commandPath)
- return PR_FALSE;
-
- PRBool matches = mAppPath.Equals(commandPath);
- g_free(commandPath);
- return matches;
- }
-
-+PRBool
-+nsGNOMEShellService::CheckHandlerMatchesAppName(const nsACString &handler) const
-+{
-+ gint argc;
-+ gchar **argv;
-+ nsCAutoString command(handler);
-+
-+ // The string will be something of the form: [/path/to/]browser "%s"
-+ // We want to remove all of the parameters and get just the binary name.
-+
-+ if (g_shell_parse_argv(command.get(), &argc, &argv, NULL) && argc > 0) {
-+ command.Assign(argv[0]);
-+ g_strfreev(argv);
-+ }
-+
-+ if (!KeyMatchesAppName(command.get()))
-+ return PR_FALSE; // the handler is set to another app
-+
-+ return PR_TRUE;
-+}
-+
- NS_IMETHODIMP
- nsGNOMEShellService::IsDefaultBrowser(PRBool aStartupCheck,
- PRBool* aIsDefaultBrowser)
- {
- *aIsDefaultBrowser = PR_FALSE;
- if (aStartupCheck)
- mCheckedThisSession = PR_TRUE;
-
- nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
-+ nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
-
- PRBool enabled;
- nsCAutoString handler;
-+ nsCOMPtr<nsIGIOMimeApp> gioApp;
-
- for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) {
- if (!appProtocols[i].essential)
- continue;
-
-- handler.Truncate();
-- gconf->GetAppForProtocol(nsDependentCString(appProtocols[i].name),
-- &enabled, handler);
-+ if (gconf) {
-+ handler.Truncate();
-+ gconf->GetAppForProtocol(nsDependentCString(appProtocols[i].name),
-+ &enabled, handler);
-
-- // The string will be something of the form: [/path/to/]browser "%s"
-- // We want to remove all of the parameters and get just the binary name.
--
-- gint argc;
-- gchar **argv;
--
-- if (g_shell_parse_argv(handler.get(), &argc, &argv, NULL) && argc > 0) {
-- handler.Assign(argv[0]);
-- g_strfreev(argv);
-+ if (!CheckHandlerMatchesAppName(handler) || !enabled)
-+ return NS_OK; // the handler is disabled or set to another app
- }
-
-- if (!KeyMatchesAppName(handler.get()) || !enabled)
-- return NS_OK; // the handler is disabled or set to another app
-+ if (giovfs) {
-+ handler.Truncate();
-+ giovfs->GetAppForURIScheme(nsDependentCString(appProtocols[i].name),
-+ getter_AddRefs(gioApp));
-+ if (!gioApp)
-+ return NS_OK;
-+
-+ gioApp->GetCommand(handler);
-+
-+ if (!CheckHandlerMatchesAppName(handler))
-+ return NS_OK; // the handler is set to another app
-+ }
- }
-
- *aIsDefaultBrowser = PR_TRUE;
-
- return NS_OK;
- }
-
- NS_IMETHODIMP
-@@ -240,19 +267,20 @@ nsGNOMEShellService::SetDefaultBrowser(P
- PRBool aForAllUsers)
- {
- #ifdef DEBUG
- if (aForAllUsers)
- NS_WARNING("Setting the default browser for all users is not yet supported");
- #endif
-
- nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
-+ nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
- if (gconf) {
- nsCAutoString appKeyValue;
-- if(mAppIsInPath) {
-+ if (mAppIsInPath) {
- // mAppPath is in the users path, so use only the basename as the launcher
- gchar *tmp = g_path_get_basename(mAppPath.get());
- appKeyValue = tmp;
- g_free(tmp);
- } else {
- appKeyValue = mAppPath;
- }
-
-@@ -261,23 +289,18 @@ nsGNOMEShellService::SetDefaultBrowser(P
- for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) {
- if (appProtocols[i].essential || aClaimAllTypes) {
- gconf->SetAppForProtocol(nsDependentCString(appProtocols[i].name),
- appKeyValue);
- }
- }
- }
-
-- // set handler for .html and xhtml files and MIME types:
-- if (aClaimAllTypes) {
-+ if (giovfs) {
- nsresult rv;
-- nsCOMPtr<nsIGIOService> giovfs =
-- do_GetService(NS_GIOSERVICE_CONTRACTID, &rv);
-- NS_ENSURE_SUCCESS(rv, NS_OK);
--
- nsCOMPtr<nsIStringBundleService> bundleService =
- do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCOMPtr<nsIStringBundle> brandBundle;
- rv = bundleService->CreateBundle(BRAND_PROPERTIES, getter_AddRefs(brandBundle));
- NS_ENSURE_SUCCESS(rv, rv);
-
-@@ -290,20 +313,30 @@ nsGNOMEShellService::SetDefaultBrowser(P
- // use brandShortName as the application id.
- NS_ConvertUTF16toUTF8 id(brandShortName);
- nsCOMPtr<nsIGIOMimeApp> appInfo;
- rv = giovfs->CreateAppFromCommand(mAppPath,
- id,
- getter_AddRefs(appInfo));
- NS_ENSURE_SUCCESS(rv, rv);
-
-- // Add mime types for html, xhtml extension and set app to just created appinfo.
-- for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appTypes); ++i) {
-- appInfo->SetAsDefaultForMimeType(nsDependentCString(appTypes[i].mimeType));
-- appInfo->SetAsDefaultForFileExtensions(nsDependentCString(appTypes[i].extensions));
-+ // set handler for the protocols
-+ for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) {
-+ if (appProtocols[i].essential || aClaimAllTypes) {
-+ appInfo->SetAsDefaultForURIScheme(nsDependentCString(appProtocols[i].name));
-+ }
-+ }
-+
-+ // set handler for .html and xhtml files and MIME types:
-+ if (aClaimAllTypes) {
-+ // Add mime types for html, xhtml extension and set app to just created appinfo.
-+ for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appTypes); ++i) {
-+ appInfo->SetAsDefaultForMimeType(nsDependentCString(appTypes[i].mimeType));
-+ appInfo->SetAsDefaultForFileExtensions(nsDependentCString(appTypes[i].extensions));
-+ }
- }
- }
-
- return NS_OK;
- }
-
- NS_IMETHODIMP
- nsGNOMEShellService::GetShouldCheckDefaultBrowser(PRBool* aResult)
-@@ -403,48 +436,52 @@ nsGNOMEShellService::SetDesktopBackgroun
- filePath.Append("_wallpaper.png");
-
- // write the image to a file in the home dir
- rv = WriteImage(filePath, container);
-
- // if the file was written successfully, set it as the system wallpaper
- nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
-
-- nsCAutoString options;
-- if (aPosition == BACKGROUND_TILE)
-- options.Assign("wallpaper");
-- else if (aPosition == BACKGROUND_STRETCH)
-- options.Assign("stretched");
-- else
-- options.Assign("centered");
-+ if (gconf) {
-+ nsCAutoString options;
-+ if (aPosition == BACKGROUND_TILE)
-+ options.Assign("wallpaper");
-+ else if (aPosition == BACKGROUND_STRETCH)
-+ options.Assign("stretched");
-+ else
-+ options.Assign("centered");
-
-- gconf->SetString(NS_LITERAL_CSTRING(kDesktopOptionsKey), options);
-+ gconf->SetString(NS_LITERAL_CSTRING(kDesktopOptionsKey), options);
-
-- // Set the image to an empty string first to force a refresh
-- // (since we could be writing a new image on top of an existing
-- // Firefox_wallpaper.png and nautilus doesn't monitor the file for changes)
-- gconf->SetString(NS_LITERAL_CSTRING(kDesktopImageKey),
-- EmptyCString());
-+ // Set the image to an empty string first to force a refresh
-+ // (since we could be writing a new image on top of an existing
-+ // Firefox_wallpaper.png and nautilus doesn't monitor the file for changes)
-+ gconf->SetString(NS_LITERAL_CSTRING(kDesktopImageKey),
-+ EmptyCString());
-
-- gconf->SetString(NS_LITERAL_CSTRING(kDesktopImageKey), filePath);
-- gconf->SetBool(NS_LITERAL_CSTRING(kDesktopDrawBGKey), PR_TRUE);
-+ gconf->SetString(NS_LITERAL_CSTRING(kDesktopImageKey), filePath);
-+ gconf->SetBool(NS_LITERAL_CSTRING(kDesktopDrawBGKey), PR_TRUE);
-+ }
-
- return rv;
- }
-
- #define COLOR_16_TO_8_BIT(_c) ((_c) >> 8)
- #define COLOR_8_TO_16_BIT(_c) ((_c) << 8 | (_c))
-
- NS_IMETHODIMP
- nsGNOMEShellService::GetDesktopBackgroundColor(PRUint32 *aColor)
- {
- nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
-
- nsCAutoString background;
-- gconf->GetString(NS_LITERAL_CSTRING(kDesktopColorKey), background);
-+ if (gconf) {
-+ gconf->GetString(NS_LITERAL_CSTRING(kDesktopColorKey), background);
-+ }
-
- if (background.IsEmpty()) {
- *aColor = 0;
- return NS_OK;
- }
-
- GdkColor color;
- gboolean success = gdk_color_parse(background.get(), &color);
-@@ -473,36 +510,48 @@ ColorToCString(PRUint32 aColor, nsCStrin
- }
-
- NS_IMETHODIMP
- nsGNOMEShellService::SetDesktopBackgroundColor(PRUint32 aColor)
- {
- NS_ASSERTION(aColor <= 0xffffff, "aColor has extra bits");
- nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
-
-- nsCAutoString colorString;
-- ColorToCString(aColor, colorString);
-+ if (gconf) {
-+ nsCAutoString colorString;
-+ ColorToCString(aColor, colorString);
-
-- gconf->SetString(NS_LITERAL_CSTRING(kDesktopColorKey), colorString);
-+ gconf->SetString(NS_LITERAL_CSTRING(kDesktopColorKey), colorString);
-+ }
-
- return NS_OK;
- }
-
- NS_IMETHODIMP
- nsGNOMEShellService::OpenApplication(PRInt32 aApplication)
- {
- nsCAutoString scheme;
- if (aApplication == APPLICATION_MAIL)
- scheme.Assign("mailto");
- else if (aApplication == APPLICATION_NEWS)
- scheme.Assign("news");
- else
- return NS_ERROR_NOT_AVAILABLE;
-
-+ nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
-+ if (giovfs) {
-+ nsCOMPtr<nsIGIOMimeApp> gioApp;
-+ giovfs->GetAppForURIScheme(scheme, getter_AddRefs(gioApp));
-+ if (gioApp)
-+ return gioApp->Launch(EmptyCString());
-+ }
-+
- nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
-+ if (!gconf)
-+ return NS_ERROR_FAILURE;
-
- PRBool enabled;
- nsCAutoString appCommand;
- gconf->GetAppForProtocol(scheme, &enabled, appCommand);
-
- if (!enabled)
- return NS_ERROR_FAILURE;
-
-diff --git a/browser/components/shell/src/nsGNOMEShellService.h b/browser/components/shell/src/nsGNOMEShellService.h
---- a/browser/components/shell/src/nsGNOMEShellService.h
-+++ b/browser/components/shell/src/nsGNOMEShellService.h
-@@ -49,16 +49,17 @@ public:
- NS_DECL_NSISHELLSERVICE
-
- nsresult Init() NS_HIDDEN;
-
- private:
- ~nsGNOMEShellService() {}
-
- NS_HIDDEN_(PRBool) KeyMatchesAppName(const char *aKeyValue) const;
-+ NS_HIDDEN_(PRBool) CheckHandlerMatchesAppName(const nsACString& handler) const;
-
- NS_HIDDEN_(PRBool) GetAppPathFromLauncher();
- PRPackedBool mCheckedThisSession;
- PRPackedBool mUseLocaleFilenames;
- nsCString mAppPath;
- PRPackedBool mAppIsInPath;
- };
-
-diff --git a/toolkit/system/gnome/nsGIOService.cpp b/toolkit/system/gnome/nsGIOService.cpp
---- a/toolkit/system/gnome/nsGIOService.cpp
-+++ b/toolkit/system/gnome/nsGIOService.cpp
-@@ -277,16 +277,43 @@ nsGIOMimeApp::SetAsDefaultForFileExtensi
- } else {
- *ext_pos = '\0';
- }
- }
- g_free(extensions);
- return NS_OK;
- }
-
-+/**
-+ * Set default application for URI's of a particular scheme
-+ * @param aURIScheme string containing the URI scheme
-+ * @return NS_OK when application was set as default for URI scheme,
-+ * NS_ERROR_FAILURE otherwise
-+ */
-+NS_IMETHODIMP
-+nsGIOMimeApp::SetAsDefaultForURIScheme(nsACString const& aURIScheme)
-+{
-+ GError *error = NULL;
-+ nsCAutoString contentType("x-scheme-handler/");
-+ contentType.Append(aURIScheme);
-+
-+ g_app_info_set_as_default_for_type(mApp,
-+ contentType.get(),
-+ &error);
-+ if (error) {
-+ g_warning("Cannot set application as default for URI scheme (%s): %s",
-+ PromiseFlatCString(aURIScheme).get(),
-+ error->message);
-+ g_error_free(error);
-+ return NS_ERROR_FAILURE;
-+ }
-+
-+ return NS_OK;
-+}
-+
- nsresult
- nsGIOService::Init()
- {
- // do nothing, gvfs/gio does not init.
- return NS_OK;
- }
-
- NS_IMPL_ISUPPORTS1(nsGIOService, nsIGIOService)
-@@ -317,16 +344,33 @@ nsGIOService::GetMimeTypeFromExtension(c
- g_free(mime_type);
- g_free(content_type);
-
- return NS_OK;
- }
- // used in nsGNOMERegistry
- // -----------------------------------------------------------------------------
- NS_IMETHODIMP
-+nsGIOService::GetAppForURIScheme(const nsACString& aURIScheme,
-+ nsIGIOMimeApp** aApp)
-+{
-+ *aApp = nsnull;
-+
-+ GAppInfo *app_info = g_app_info_get_default_for_uri_scheme(
-+ PromiseFlatCString(aURIScheme).get());
-+ if (app_info) {
-+ nsGIOMimeApp *mozApp = new nsGIOMimeApp(app_info);
-+ NS_ADDREF(*aApp = mozApp);
-+ } else {
-+ return NS_ERROR_FAILURE;
-+ }
-+ return NS_OK;
-+}
-+
-+NS_IMETHODIMP
- nsGIOService::GetAppForMimeType(const nsACString& aMimeType,
- nsIGIOMimeApp** aApp)
- {
- *aApp = nsnull;
- char *content_type =
- get_content_type_from_mime_type(PromiseFlatCString(aMimeType).get());
- if (!content_type)
- return NS_ERROR_FAILURE;
-diff --git a/xpcom/system/nsIGIOService.idl b/xpcom/system/nsIGIOService.idl
---- a/xpcom/system/nsIGIOService.idl
-+++ b/xpcom/system/nsIGIOService.idl
-@@ -41,57 +41,61 @@
-
- interface nsIUTF8StringEnumerator;
- interface nsIURI;
-
- /* nsIGIOMimeApp holds information about an application that is looked up
- with nsIGIOService::GetAppForMimeType. */
- // 66009894-9877-405b-9321-bf30420e34e6 prev uuid
-
--[scriptable, uuid(e77021b4-4012-407d-b686-7a1f18050109)]
-+[scriptable, uuid(ca6bad0c-8a48-48ac-82c7-27bb8f510fbe)]
- interface nsIGIOMimeApp : nsISupports
- {
- const long EXPECTS_URIS = 0;
- const long EXPECTS_PATHS = 1;
- const long EXPECTS_URIS_FOR_NON_FILES = 2;
-
- readonly attribute AUTF8String id;
- readonly attribute AUTF8String name;
- readonly attribute AUTF8String command;
- readonly attribute long expectsURIs; // see constants above
- readonly attribute nsIUTF8StringEnumerator supportedURISchemes;
-
- void launch(in AUTF8String uri);
- void setAsDefaultForMimeType(in AUTF8String mimeType);
- void setAsDefaultForFileExtensions(in AUTF8String extensions);
-+ void setAsDefaultForURIScheme(in AUTF8String uriScheme);
- };
-
- /*
- * The VFS service makes use of two distinct registries.
- *
- * The application registry holds information about applications (uniquely
- * identified by id), such as which MIME types and URI schemes they are
- * capable of handling, whether they run in a terminal, etc.
- *
- * The MIME registry holds information about MIME types, such as which
- * extensions map to a given MIME type. The MIME registry also stores the
- * id of the application selected to handle each MIME type.
- */
-
- // prev id dea20bf0-4e4d-48c5-b932-dc3e116dc64b
--[scriptable, uuid(47e372c2-78bb-4899-8114-56aa7d9cdac5)]
-+[scriptable, uuid(eda22a30-84e1-4e16-9ca0-cd1553c2b34a)]
- interface nsIGIOService : nsISupports
- {
-
- /*** MIME registry methods ***/
-
- /* Obtain the MIME type registered for an extension. The extension
- should not include a leading dot. */
- AUTF8String getMimeTypeFromExtension(in AUTF8String extension);
-
-+ /* Obtain the preferred application for opening a given URI scheme */
-+ nsIGIOMimeApp getAppForURIScheme(in AUTF8String aURIScheme);
-+
- /* Obtain the preferred application for opening a given MIME type */
- nsIGIOMimeApp getAppForMimeType(in AUTF8String mimeType);
-
- /* Obtain the preferred application for opening a given MIME type */
- nsIGIOMimeApp createAppFromCommand(in AUTF8String cmd,
- in AUTF8String appName);
-
- /* Obtain a description for the given MIME type */
-
-diff --git a/toolkit/system/gnome/Makefile.in b/toolkit/system/gnome/Makefile.in
---- a/toolkit/system/gnome/Makefile.in
-+++ b/toolkit/system/gnome/Makefile.in
-@@ -60,16 +60,17 @@ ifdef MOZ_ENABLE_GNOMEVFS
- CPPSRCS += \
- nsGnomeVFSService.cpp \
- $(NULL)
- endif
-
- ifdef MOZ_ENABLE_GIO
- CPPSRCS += \
- nsGIOService.cpp \
-+ nsGSettingsService.cpp \
- $(NULL)
- endif
-
- ifdef MOZ_ENABLE_LIBNOTIFY
- CPPSRCS += \
- nsAlertsService.cpp \
- nsAlertsIconListener.cpp \
- $(NULL)
-diff --git a/toolkit/system/gnome/nsGSettingsService.cpp b/toolkit/system/gnome/nsGSettingsService.cpp
-new file mode 100644
---- /dev/null
-+++ b/toolkit/system/gnome/nsGSettingsService.cpp
-@@ -0,0 +1,238 @@
-+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-+/* ***** BEGIN LICENSE BLOCK *****
-+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
-+ *
-+ * The contents of this file are subject to the Mozilla Public License Version
-+ * 1.1 (the "License"); you may not use this file except in compliance with
-+ * the License. You may obtain a copy of the License at
-+ * http://www.mozilla.org/MPL/
-+ *
-+ * Software distributed under the License is distributed on an "AS IS" basis,
-+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-+ * for the specific language governing rights and limitations under the
-+ * License.
-+ *
-+ * The Original Code is the Mozilla GNOME integration code.
-+ *
-+ * The Initial Developer of the Original Code is
-+ * Canonical Ltd.
-+ * Portions created by the Initial Developer are Copyright (C) 2010
-+ * the Initial Developer. All Rights Reserved.
-+ *
-+ * Contributor(s):
-+ * Chris Coulson <chris.coulson@canonical.com>
-+ *
-+ * Alternatively, the contents of this file may be used under the terms of
-+ * either the GNU General Public License Version 2 or later (the "GPL"), or
-+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-+ * in which case the provisions of the GPL or the LGPL are applicable instead
-+ * of those above. If you wish to allow use of your version of this file only
-+ * under the terms of either the GPL or the LGPL, and not to allow others to
-+ * use your version of this file under the terms of the MPL, indicate your
-+ * decision by deleting the provisions above and replace them with the notice
-+ * and other provisions required by the GPL or the LGPL. If you do not delete
-+ * the provisions above, a recipient may use your version of this file under
-+ * the terms of any one of the MPL, the GPL or the LGPL.
-+ *
-+ * ***** END LICENSE BLOCK ***** */
-+
-+#include "nsGSettingsService.h"
-+#include "nsStringAPI.h"
-+#include "nsCOMPtr.h"
-+#include "prlink.h"
-+#include "nsComponentManagerUtils.h"
-+
-+#include <glib.h>
-+#include <glib-object.h>
-+
-+typedef struct _GSettings GSettings;
-+
-+typedef GSettings * (*_g_settings_new_fn) (const char* schema);
-+typedef const char * const* (*_g_settings_list_schemas_fn) (void);
-+typedef gboolean (*_g_settings_set_string_fn) (GSettings* settings,
-+ const char* key,
-+ const char* value);
-+typedef gboolean (*_g_settings_set_boolean_fn) (GSettings* settings,
-+ const char* key,
-+ gboolean value);
-+typedef gboolean (*_g_settings_set_int_fn) (GSettings* settings,
-+ const char* key,
-+ int value);
-+typedef char * (*_g_settings_get_string_fn) (GSettings* settings,
-+ const char* key);
-+typedef gboolean (*_g_settings_get_boolean_fn) (GSettings* settings,
-+ const char* key);
-+typedef int (*_g_settings_get_int_fn) (GSettings* settings,
-+ const char* key);
-+
-+static _g_settings_new_fn _g_settings_new;
-+static _g_settings_list_schemas_fn _g_settings_list_schemas;
-+static PRLibrary *gioLib = nsnull;
-+
-+class nsGSettingsCollection : public nsIGSettingsCollection
-+{
-+public:
-+ NS_DECL_ISUPPORTS
-+ NS_DECL_NSIGSETTINGSCOLLECTION
-+
-+ nsGSettingsCollection(GSettings* aSettings) : mSettings(aSettings) {}
-+ ~nsGSettingsCollection() { g_object_unref(mSettings); }
-+
-+private:
-+ GSettings *mSettings;
-+};
-+
-+NS_IMPL_ISUPPORTS1(nsGSettingsCollection, nsIGSettingsCollection)
-+
-+NS_IMETHODIMP
-+nsGSettingsCollection::SetString(const nsACString& aKey,
-+ const nsACString& aValue)
-+{
-+ _g_settings_set_string_fn _g_settings_set_string =
-+ (_g_settings_set_string_fn) PR_FindFunctionSymbol(gioLib,
-+ "g_settings_set_string");
-+ if (!_g_settings_set_string)
-+ return NS_ERROR_FAILURE;
-+
-+ gboolean res = _g_settings_set_string(mSettings,
-+ PromiseFlatCString(aKey).get(),
-+ PromiseFlatCString(aValue).get());
-+
-+ return res ? NS_OK : NS_ERROR_FAILURE;
-+}
-+
-+NS_IMETHODIMP
-+nsGSettingsCollection::SetBoolean(const nsACString& aKey,
-+ PRBool aValue)
-+{
-+ _g_settings_set_boolean_fn _g_settings_set_boolean =
-+ (_g_settings_set_boolean_fn) PR_FindFunctionSymbol(gioLib,
-+ "g_settings_set_boolean");
-+ if (!_g_settings_set_boolean)
-+ return NS_ERROR_FAILURE;
-+
-+ gboolean res = _g_settings_set_boolean(mSettings,
-+ PromiseFlatCString(aKey).get(),
-+ aValue);
-+
-+ return res ? NS_OK : NS_ERROR_FAILURE;
-+}
-+
-+NS_IMETHODIMP
-+nsGSettingsCollection::SetInt(const nsACString& aKey,
-+ PRInt32 aValue)
-+{
-+ _g_settings_set_int_fn _g_settings_set_int =
-+ (_g_settings_set_int_fn) PR_FindFunctionSymbol(gioLib,
-+ "g_settings_set_int");
-+ if (!_g_settings_set_int)
-+ return NS_ERROR_FAILURE;
-+
-+ gboolean res = _g_settings_set_int(mSettings,
-+ PromiseFlatCString(aKey).get(),
-+ aValue);
-+
-+ return res ? NS_OK : NS_ERROR_FAILURE;
-+}
-+
-+NS_IMETHODIMP
-+nsGSettingsCollection::GetString(const nsACString& aKey,
-+ nsACString& aResult)
-+{
-+ _g_settings_get_string_fn _g_settings_get_string =
-+ (_g_settings_get_string_fn) PR_FindFunctionSymbol(gioLib,
-+ "g_settings_get_string");
-+ if (!_g_settings_get_string)
-+ return NS_ERROR_FAILURE;
-+
-+ char *result = _g_settings_get_string(mSettings,
-+ PromiseFlatCString(aKey).get());
-+ if (!result)
-+ return NS_ERROR_FAILURE;
-+
-+ aResult.Assign(result);
-+ g_free(result);
-+ return NS_OK;
-+}
-+
-+NS_IMETHODIMP
-+nsGSettingsCollection::GetBoolean(const nsACString& aKey,
-+ PRBool* aResult)
-+{
-+ _g_settings_get_boolean_fn _g_settings_get_boolean =
-+ (_g_settings_get_boolean_fn) PR_FindFunctionSymbol(gioLib,
-+ "g_settings_get_boolean");
-+ if (!_g_settings_get_boolean)
-+ return NS_ERROR_FAILURE;
-+
-+ gboolean res = _g_settings_get_boolean(mSettings,
-+ PromiseFlatCString(aKey).get());
-+ *aResult = res ? PR_TRUE : PR_FALSE;
-+
-+ return NS_OK;
-+}
-+
-+NS_IMETHODIMP
-+nsGSettingsCollection::GetInt(const nsACString& aKey,
-+ PRInt32* aResult)
-+{
-+ _g_settings_get_int_fn _g_settings_get_int =
-+ (_g_settings_get_int_fn) PR_FindFunctionSymbol(gioLib,
-+ "g_settings_get_int");
-+ if (!_g_settings_get_int)
-+ return NS_ERROR_FAILURE;
-+
-+ *aResult = _g_settings_get_int(mSettings,
-+ PromiseFlatCString(aKey).get());
-+
-+ return NS_OK;
-+}
-+
-+nsresult
-+nsGSettingsService::Init()
-+{
-+ if (!gioLib) {
-+ gioLib = PR_LoadLibrary("libgio-2.0.so.0");
-+ }
-+
-+ _g_settings_new = (_g_settings_new_fn)
-+ PR_FindFunctionSymbol(gioLib, "g_settings_new");
-+ _g_settings_list_schemas = (_g_settings_list_schemas_fn)
-+ PR_FindFunctionSymbol(gioLib, "g_settings_list_schemas");
-+
-+ if (!_g_settings_new || !_g_settings_list_schemas) {
-+ PR_UnloadLibrary(gioLib);
-+ return NS_ERROR_FAILURE;
-+ }
-+
-+ return NS_OK;
-+}
-+
-+NS_IMPL_ISUPPORTS1(nsGSettingsService, nsIGSettingsService)
-+
-+nsGSettingsService::~nsGSettingsService()
-+{
-+ if (gioLib) {
-+ PR_UnloadLibrary(gioLib);
-+ gioLib = nsnull;
-+ }
-+}
-+
-+NS_IMETHODIMP
-+nsGSettingsService::GetCollectionForSchema(const nsACString& schema,
-+ nsIGSettingsCollection** collection)
-+{
-+ const char * const *schemas = _g_settings_list_schemas();
-+ unsigned int i = 0;
-+
-+ for (i = 0; schemas[i] != NULL; i++) {
-+ if (strcmp(schemas[i], PromiseFlatCString(schema).get()) == 0) {
-+ GSettings *settings = _g_settings_new(PromiseFlatCString(schema).get());
-+ nsGSettingsCollection *mozGSettings = new nsGSettingsCollection(settings);
-+ NS_ADDREF(*collection = mozGSettings);
-+ return NS_OK;
-+ }
-+ }
-+
-+ return NS_ERROR_FAILURE;
-+}
-diff --git a/toolkit/system/gnome/nsGSettingsService.h b/toolkit/system/gnome/nsGSettingsService.h
-new file mode 100644
---- /dev/null
-+++ b/toolkit/system/gnome/nsGSettingsService.h
-@@ -0,0 +1,60 @@
-+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-+/* ***** BEGIN LICENSE BLOCK *****
-+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
-+ *
-+ * The contents of this file are subject to the Mozilla Public License Version
-+ * 1.1 (the "License"); you may not use this file except in compliance with
-+ * the License. You may obtain a copy of the License at
-+ * http://www.mozilla.org/MPL/
-+ *
-+ * Software distributed under the License is distributed on an "AS IS" basis,
-+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-+ * for the specific language governing rights and limitations under the
-+ * License.
-+ *
-+ * The Original Code is the Mozilla GNOME integration code.
-+ *
-+ * The Initial Developer of the Original Code is
-+ * Canonical Ltd.
-+ * Portions created by the Initial Developer are Copyright (C) 2010
-+ * the Initial Developer. All Rights Reserved.
-+ *
-+ * Contributor(s):
-+ * Chris Coulson <chris.coulson@canonical.com>
-+ *
-+ * Alternatively, the contents of this file may be used under the terms of
-+ * either the GNU General Public License Version 2 or later (the "GPL"), or
-+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-+ * in which case the provisions of the GPL or the LGPL are applicable instead
-+ * of those above. If you wish to allow use of your version of this file only
-+ * under the terms of either the GPL or the LGPL, and not to allow others to
-+ * use your version of this file under the terms of the MPL, indicate your
-+ * decision by deleting the provisions above and replace them with the notice
-+ * and other provisions required by the GPL or the LGPL. If you do not delete
-+ * the provisions above, a recipient may use your version of this file under
-+ * the terms of any one of the MPL, the GPL or the LGPL.
-+ *
-+ * ***** END LICENSE BLOCK ***** */
-+
-+#ifndef nsGSettingsService_h_
-+#define nsGSettingsService_h_
-+
-+#include "nsIGSettingsService.h"
-+
-+#define NS_GSETTINGSSERVICE_CID \
-+{0xbfd4a9d8, 0xd886, 0x4161, {0x81, 0xef, 0x88, 0x68, 0xda, 0x11, 0x41, 0x70}}
-+
-+class nsGSettingsService : public nsIGSettingsService
-+{
-+public:
-+ NS_DECL_ISUPPORTS
-+ NS_DECL_NSIGSETTINGSSERVICE
-+
-+ NS_HIDDEN_(nsresult) Init();
-+
-+private:
-+ ~nsGSettingsService();
-+};
-+
-+#endif
-+
-diff --git a/toolkit/system/gnome/nsGnomeModule.cpp b/toolkit/system/gnome/nsGnomeModule.cpp
---- a/toolkit/system/gnome/nsGnomeModule.cpp
-+++ b/toolkit/system/gnome/nsGnomeModule.cpp
-@@ -44,62 +44,67 @@
- NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGConfService, Init)
- #endif
- #ifdef MOZ_ENABLE_GNOMEVFS
- #include "nsGnomeVFSService.h"
- NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGnomeVFSService, Init)
- #endif
- #ifdef MOZ_ENABLE_GIO
- #include "nsGIOService.h"
-+#include "nsGSettingsService.h"
- NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGIOService, Init)
-+NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGSettingsService, Init)
- #endif
- #ifdef MOZ_ENABLE_LIBNOTIFY
- #include "nsAlertsService.h"
- NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsAlertsService, Init)
- #endif
-
- #ifdef MOZ_ENABLE_GCONF
- NS_DEFINE_NAMED_CID(NS_GCONFSERVICE_CID);
- #endif
- #ifdef MOZ_ENABLE_GNOMEVFS
- NS_DEFINE_NAMED_CID(NS_GNOMEVFSSERVICE_CID);
- #endif
- #ifdef MOZ_ENABLE_GIO
- NS_DEFINE_NAMED_CID(NS_GIOSERVICE_CID);
-+NS_DEFINE_NAMED_CID(NS_GSETTINGSSERVICE_CID);
- #endif
- #ifdef MOZ_ENABLE_LIBNOTIFY
- NS_DEFINE_NAMED_CID(NS_SYSTEMALERTSSERVICE_CID);
- #endif
-
-
- static const mozilla::Module::CIDEntry kGnomeCIDs[] = {
- #ifdef MOZ_ENABLE_GCONF
- { &kNS_GCONFSERVICE_CID, false, NULL, nsGConfServiceConstructor },
- #endif
- #ifdef MOZ_ENABLE_GNOMEVFS
- { &kNS_GNOMEVFSSERVICE_CID, false, NULL, nsGnomeVFSServiceConstructor },
- #endif
- #ifdef MOZ_ENABLE_GIO
- { &kNS_GIOSERVICE_CID, false, NULL, nsGIOServiceConstructor },
-+ { &kNS_GSETTINGSSERVICE_CID, false, NULL, nsGSettingsServiceConstructor },
- #endif
- #ifdef MOZ_ENABLE_LIBNOTIFY
- { &kNS_SYSTEMALERTSSERVICE_CID, false, NULL, nsAlertsServiceConstructor },
- #endif
- { NULL }
- };
-
- static const mozilla::Module::ContractIDEntry kGnomeContracts[] = {
- #ifdef MOZ_ENABLE_GCONF
- { NS_GCONFSERVICE_CONTRACTID, &kNS_GCONFSERVICE_CID },
- #endif
- #ifdef MOZ_ENABLE_GNOMEVFS
- { NS_GNOMEVFSSERVICE_CONTRACTID, &kNS_GNOMEVFSSERVICE_CID },
- #endif
- #ifdef MOZ_ENABLE_GIO
- { NS_GIOSERVICE_CONTRACTID, &kNS_GIOSERVICE_CID },
-+ { NS_GSETTINGSSERVICE_CONTRACTID, &kNS_GSETTINGSSERVICE_CID },
- #endif
- #ifdef MOZ_ENABLE_LIBNOTIFY
- { NS_SYSTEMALERTSERVICE_CONTRACTID, &kNS_SYSTEMALERTSSERVICE_CID },
- #endif
- { NULL }
- };
-
- static const mozilla::Module kGnomeModule = {
-diff --git a/xpcom/system/Makefile.in b/xpcom/system/Makefile.in
---- a/xpcom/system/Makefile.in
-+++ b/xpcom/system/Makefile.in
-@@ -47,16 +47,17 @@ XPIDL_MODULE = xpcom_system
-
- XPIDLSRCS = \
- nsIXULAppInfo.idl \
- nsIXULRuntime.idl \
- nsIGConfService.idl \
- nsIGnomeVFSService.idl \
- nsIBlocklistService.idl \
- nsIGIOService.idl \
-+ nsIGSettingsService.idl \
- nsIAccelerometer.idl \
- nsIGeolocationProvider.idl \
- nsIHapticFeedback.idl \
- $(NULL)
-
- ifdef MOZ_CRASHREPORTER
- XPIDLSRCS += nsICrashReporter.idl
- endif
-diff --git a/xpcom/system/nsIGSettingsService.idl b/xpcom/system/nsIGSettingsService.idl
-new file mode 100644
---- /dev/null
-+++ b/xpcom/system/nsIGSettingsService.idl
-@@ -0,0 +1,61 @@
-+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-+/* ***** BEGIN LICENSE BLOCK *****
-+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
-+ *
-+ * The contents of this file are subject to the Mozilla Public License Version
-+ * 1.1 (the "License"); you may not use this file except in compliance with
-+ * the License. You may obtain a copy of the License at
-+ * http://www.mozilla.org/MPL/
-+ *
-+ * Software distributed under the License is distributed on an "AS IS" basis,
-+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-+ * for the specific language governing rights and limitations under the
-+ * License.
-+ *
-+ * The Original Code is the Mozilla GNOME integration code.
-+ *
-+ * The Initial Developer of the Original Code is
-+ * Canonical Ltd.
-+ * Portions created by the Initial Developer are Copyright (C) 2010
-+ * the Initial Developer. All Rights Reserved.
-+ *
-+ * Contributor(s):
-+ * Chris Coulson <chris.coulson@canonical.com>
-+ *
-+ * Alternatively, the contents of this file may be used under the terms of
-+ * either the GNU General Public License Version 2 or later (the "GPL"), or
-+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-+ * in which case the provisions of the GPL or the LGPL are applicable instead
-+ * of those above. If you wish to allow use of your version of this file only
-+ * under the terms of either the GPL or the LGPL, and not to allow others to
-+ * use your version of this file under the terms of the MPL, indicate your
-+ * decision by deleting the provisions above and replace them with the notice
-+ * and other provisions required by the GPL or the LGPL. If you do not delete
-+ * the provisions above, a recipient may use your version of this file under
-+ * the terms of any one of the MPL, the GPL or the LGPL.
-+ *
-+ * ***** END LICENSE BLOCK ***** */
-+
-+#include "nsISupports.idl"
-+#include "nsIArray.idl"
-+
-+[scriptable, uuid(09637d3c-3c07-40b4-aff9-1d2a0f046f3c)]
-+interface nsIGSettingsCollection : nsISupports
-+{
-+ void setString(in AUTF8String key, in AUTF8String value);
-+ void setBoolean(in AUTF8String key, in boolean value);
-+ void setInt(in AUTF8String key, in long value);
-+ AUTF8String getString(in AUTF8String key);
-+ boolean getBoolean(in AUTF8String key);
-+ long getInt(in AUTF8String key);
-+};
-+
-+[scriptable, uuid(849c088b-57d1-4f24-b7b2-3dc4acb04c0a)]
-+interface nsIGSettingsService : nsISupports
-+{
-+ nsIGSettingsCollection getCollectionForSchema(in AUTF8String schema);
-+};
-+
-+%{C++
-+#define NS_GSETTINGSSERVICE_CONTRACTID "@mozilla.org/gsettings-service;1"
-+%}
-
-diff --git a/browser/components/shell/src/nsGNOMEShellService.cpp b/browser/components/shell/src/nsGNOMEShellService.cpp
---- a/browser/components/shell/src/nsGNOMEShellService.cpp
-+++ b/browser/components/shell/src/nsGNOMEShellService.cpp
-@@ -41,16 +41,17 @@
- #include "nsILocalFile.h"
- #include "nsIProperties.h"
- #include "nsDirectoryServiceDefs.h"
- #include "nsIPrefService.h"
- #include "prenv.h"
- #include "nsStringAPI.h"
- #include "nsIGConfService.h"
- #include "nsIGIOService.h"
-+#include "nsIGSettingsService.h"
- #include "nsIStringBundle.h"
- #include "nsIOutputStream.h"
- #include "nsIProcess.h"
- #include "nsNetUtil.h"
- #include "nsIDOMHTMLImageElement.h"
- #include "nsIImageLoadingContent.h"
- #include "imgIRequest.h"
- #include "imgIContainer.h"
-@@ -96,29 +97,37 @@ static const char kDocumentIconPath[] =
- // GConf registry key constants
- #define DG_BACKGROUND "/desktop/gnome/background"
-
- static const char kDesktopImageKey[] = DG_BACKGROUND "/picture_filename";
- static const char kDesktopOptionsKey[] = DG_BACKGROUND "/picture_options";
- static const char kDesktopDrawBGKey[] = DG_BACKGROUND "/draw_background";
- static const char kDesktopColorKey[] = DG_BACKGROUND "/primary_color";
-
-+static const char kDesktopBGSchema[] = "org.gnome.desktop.background";
-+static const char kDesktopImageGSKey[] = "picture-uri";
-+static const char kDesktopOptionGSKey[] = "picture-options";
-+static const char kDesktopDrawBGGSKey[] = "draw-background";
-+static const char kDesktopColorGSKey[] = "primary-color";
-+
- nsresult
- nsGNOMEShellService::Init()
- {
- nsresult rv;
-
-- // GConf or GIO _must_ be available, or we do not allow
-+ // GConf, GSettings or GIO _must_ be available, or we do not allow
- // CreateInstance to succeed.
-
- nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
- nsCOMPtr<nsIGIOService> giovfs =
- do_GetService(NS_GIOSERVICE_CONTRACTID);
-+ nsCOMPtr<nsIGSettingsService> gsettings =
-+ do_GetService(NS_GSETTINGSSERVICE_CONTRACTID);
-
-- if (!gconf && !giovfs)
-+ if (!gconf && !giovfs && !gsettings)
- return NS_ERROR_NOT_AVAILABLE;
-
- // Check G_BROKEN_FILENAMES. If it's set, then filenames in glib use
- // the locale encoding. If it's not set, they use UTF-8.
- mUseLocaleFilenames = PR_GetEnv("G_BROKEN_FILENAMES") != nsnull;
-
- if (GetAppPathFromLauncher())
- return NS_OK;
-@@ -434,27 +443,47 @@ nsGNOMEShellService::SetDesktopBackgroun
- filePath.Append('/');
- filePath.Append(NS_ConvertUTF16toUTF8(brandName));
- filePath.Append("_wallpaper.png");
-
- // write the image to a file in the home dir
- rv = WriteImage(filePath, container);
-
- // if the file was written successfully, set it as the system wallpaper
-+ nsCAutoString options;
-+ if (aPosition == BACKGROUND_TILE)
-+ options.Assign("wallpaper");
-+ else if (aPosition == BACKGROUND_STRETCH)
-+ options.Assign("stretched");
-+ else
-+ options.Assign("centered");
-+
-+ // Try GSettings first. If we don't have GSettings or the right schema, fall back
-+ // to using GConf instead. Note that if GSettings works ok, the changes get
-+ // mirrored to GConf by the gsettings->gconf bridge in gnome-settings-daemon
-+ nsCOMPtr<nsIGSettingsService> gsettings =
-+ do_GetService(NS_GSETTINGSSERVICE_CONTRACTID);
-+ if (gsettings) {
-+ nsCOMPtr<nsIGSettingsCollection> background_settings;
-+ gsettings->GetCollectionForSchema(
-+ NS_LITERAL_CSTRING(kDesktopBGSchema), getter_AddRefs(background_settings));
-+ if (background_settings) {
-+ filePath.Insert("file://", 0);
-+ background_settings->SetString(NS_LITERAL_CSTRING(kDesktopOptionGSKey),
-+ options);
-+ background_settings->SetString(NS_LITERAL_CSTRING(kDesktopImageGSKey),
-+ filePath);
-+ background_settings->SetBoolean(NS_LITERAL_CSTRING(kDesktopDrawBGGSKey),
-+ PR_TRUE);
-+ return rv;
-+ }
-+ }
-+
- nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
--
- if (gconf) {
-- nsCAutoString options;
-- if (aPosition == BACKGROUND_TILE)
-- options.Assign("wallpaper");
-- else if (aPosition == BACKGROUND_STRETCH)
-- options.Assign("stretched");
-- else
-- options.Assign("centered");
--
- gconf->SetString(NS_LITERAL_CSTRING(kDesktopOptionsKey), options);
-
- // Set the image to an empty string first to force a refresh
- // (since we could be writing a new image on top of an existing
- // Firefox_wallpaper.png and nautilus doesn't monitor the file for changes)
- gconf->SetString(NS_LITERAL_CSTRING(kDesktopImageKey),
- EmptyCString());
-
-@@ -466,21 +495,33 @@ nsGNOMEShellService::SetDesktopBackgroun
- }
-
- #define COLOR_16_TO_8_BIT(_c) ((_c) >> 8)
- #define COLOR_8_TO_16_BIT(_c) ((_c) << 8 | (_c))
-
- NS_IMETHODIMP
- nsGNOMEShellService::GetDesktopBackgroundColor(PRUint32 *aColor)
- {
-- nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
-+ nsCOMPtr<nsIGSettingsService> gsettings =
-+ do_GetService(NS_GSETTINGSSERVICE_CONTRACTID);
-+ nsCOMPtr<nsIGSettingsCollection> background_settings;
-+ nsCAutoString background;
-+ if (gsettings) {
-+ gsettings->GetCollectionForSchema(
-+ NS_LITERAL_CSTRING(kDesktopBGSchema), getter_AddRefs(background_settings));
-+ if (background_settings) {
-+ background_settings->GetString(NS_LITERAL_CSTRING(kDesktopColorGSKey),
-+ background);
-+ }
-+ }
-
-- nsCAutoString background;
-- if (gconf) {
-- gconf->GetString(NS_LITERAL_CSTRING(kDesktopColorKey), background);
-+ if (!background_settings) {
-+ nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
-+ if (gconf)
-+ gconf->GetString(NS_LITERAL_CSTRING(kDesktopColorKey), background);
- }
-
- if (background.IsEmpty()) {
- *aColor = 0;
- return NS_OK;
- }
-
- GdkColor color;
-@@ -508,22 +548,35 @@ ColorToCString(PRUint32 aColor, nsCStrin
-
- PR_snprintf(buf, 14, "#%04x%04x%04x", red, green, blue);
- }
-
- NS_IMETHODIMP
- nsGNOMEShellService::SetDesktopBackgroundColor(PRUint32 aColor)
- {
- NS_ASSERTION(aColor <= 0xffffff, "aColor has extra bits");
-+
-+ nsCAutoString colorString;
-+ ColorToCString(aColor, colorString);
-+
-+ nsCOMPtr<nsIGSettingsService> gsettings =
-+ do_GetService(NS_GSETTINGSSERVICE_CONTRACTID);
-+ if (gsettings) {
-+ nsCOMPtr<nsIGSettingsCollection> background_settings;
-+ gsettings->GetCollectionForSchema(
-+ NS_LITERAL_CSTRING(kDesktopBGSchema), getter_AddRefs(background_settings));
-+ if (background_settings) {
-+ background_settings->SetString(NS_LITERAL_CSTRING(kDesktopColorGSKey),
-+ colorString);
-+ return NS_OK;
-+ }
-+ }
-+
- nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
--
- if (gconf) {
-- nsCAutoString colorString;
-- ColorToCString(aColor, colorString);
--
- gconf->SetString(NS_LITERAL_CSTRING(kDesktopColorKey), colorString);
- }
-
- return NS_OK;
- }
-
- NS_IMETHODIMP
- nsGNOMEShellService::OpenApplication(PRInt32 aApplication)
-
diff --git a/firefox-4.0-moz-app-launcher.patch b/firefox-4.0-moz-app-launcher.patch
deleted file mode 100644
index d87b64a..0000000
--- a/firefox-4.0-moz-app-launcher.patch
+++ /dev/null
@@ -1,137 +0,0 @@
-From https://bugzilla.mozilla.org/show_bug.cgi?id=611953
-Patch 1 - Use MOZ_APP_LAUNCHER for default browser executable (v3, un-bitrotted)
-
-
-diff --git a/browser/components/shell/src/nsGNOMEShellService.cpp b/browser/components/shell/src/nsGNOMEShellService.cpp
---- a/browser/components/shell/src/nsGNOMEShellService.cpp
-+++ b/browser/components/shell/src/nsGNOMEShellService.cpp
-@@ -115,16 +115,19 @@ nsGNOMEShellService::Init()
-
- if (!gconf)
- return NS_ERROR_NOT_AVAILABLE;
-
- // Check G_BROKEN_FILENAMES. If it's set, then filenames in glib use
- // the locale encoding. If it's not set, they use UTF-8.
- mUseLocaleFilenames = PR_GetEnv("G_BROKEN_FILENAMES") != nsnull;
-
-+ if (GetAppPathFromLauncher())
-+ return NS_OK;
-+
- nsCOMPtr<nsIProperties> dirSvc
- (do_GetService("@mozilla.org/file/directory_service;1"));
- NS_ENSURE_TRUE(dirSvc, NS_ERROR_NOT_AVAILABLE);
-
- nsCOMPtr<nsILocalFile> appPath;
- rv = dirSvc->Get(NS_XPCOM_CURRENT_PROCESS_DIR, NS_GET_IID(nsILocalFile),
- getter_AddRefs(appPath));
- NS_ENSURE_SUCCESS(rv, rv);
-@@ -133,16 +136,44 @@ nsGNOMEShellService::Init()
- NS_ENSURE_SUCCESS(rv, rv);
-
- return appPath->GetNativePath(mAppPath);
- }
-
- NS_IMPL_ISUPPORTS1(nsGNOMEShellService, nsIShellService)
-
- PRBool
-+nsGNOMEShellService::GetAppPathFromLauncher()
-+{
-+ gchar *tmp;
-+
-+ const char *launcher = PR_GetEnv("MOZ_APP_LAUNCHER");
-+ if (!launcher)
-+ return PR_FALSE;
-+
-+ if (g_path_is_absolute(launcher)) {
-+ mAppPath = launcher;
-+ tmp = g_path_get_basename(launcher);
-+ gchar *fullpath = g_find_program_in_path(tmp);
-+ if (fullpath && mAppPath.Equals(fullpath))
-+ mAppIsInPath = PR_TRUE;
-+ g_free(fullpath);
-+ } else {
-+ tmp = g_find_program_in_path(launcher);
-+ if (!tmp)
-+ return PR_FALSE;
-+ mAppPath = tmp;
-+ mAppIsInPath = PR_TRUE;
-+ }
-+
-+ g_free(tmp);
-+ return PR_TRUE;
-+}
-+
-+PRBool
- nsGNOMEShellService::KeyMatchesAppName(const char *aKeyValue) const
- {
-
- gchar *commandPath;
- if (mUseLocaleFilenames) {
- gchar *nativePath = g_filename_from_utf8(aKeyValue, -1, NULL, NULL, NULL);
- if (!nativePath) {
- NS_ERROR("Error converting path to filesystem encoding");
-@@ -210,18 +241,28 @@ nsGNOMEShellService::SetDefaultBrowser(P
- {
- #ifdef DEBUG
- if (aForAllUsers)
- NS_WARNING("Setting the default browser for all users is not yet supported");
- #endif
-
- nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
- if (gconf) {
-- nsCAutoString appKeyValue(mAppPath);
-- appKeyValue.Append(" \"%s\"");
-+ nsCAutoString appKeyValue;
-+ if(mAppIsInPath) {
-+ // mAppPath is in the users path, so use only the basename as the launcher
-+ gchar *tmp = g_path_get_basename(mAppPath.get());
-+ appKeyValue = tmp;
-+ g_free(tmp);
-+ } else {
-+ appKeyValue = mAppPath;
-+ }
-+
-+ appKeyValue.AppendLiteral(" %s");
-+
- for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) {
- if (appProtocols[i].essential || aClaimAllTypes) {
- gconf->SetAppForProtocol(nsDependentCString(appProtocols[i].name),
- appKeyValue);
- }
- }
- }
-
-diff --git a/browser/components/shell/src/nsGNOMEShellService.h b/browser/components/shell/src/nsGNOMEShellService.h
---- a/browser/components/shell/src/nsGNOMEShellService.h
-+++ b/browser/components/shell/src/nsGNOMEShellService.h
-@@ -38,26 +38,28 @@
- #define nsgnomeshellservice_h____
-
- #include "nsIShellService.h"
- #include "nsStringAPI.h"
-
- class nsGNOMEShellService : public nsIShellService
- {
- public:
-- nsGNOMEShellService() : mCheckedThisSession(PR_FALSE) { }
-+ nsGNOMEShellService() : mCheckedThisSession(PR_FALSE), mAppIsInPath(PR_FALSE) { }
-
- NS_DECL_ISUPPORTS
- NS_DECL_NSISHELLSERVICE
-
- nsresult Init() NS_HIDDEN;
-
- private:
- ~nsGNOMEShellService() {}
-
- NS_HIDDEN_(PRBool) KeyMatchesAppName(const char *aKeyValue) const;
-
-+ NS_HIDDEN_(PRBool) GetAppPathFromLauncher();
- PRPackedBool mCheckedThisSession;
- PRPackedBool mUseLocaleFilenames;
- nsCString mAppPath;
-+ PRPackedBool mAppIsInPath;
- };
-
- #endif // nsgnomeshellservice_h____
-
diff --git a/firefox-5.0-xulstub.patch b/firefox-5.0-xulstub.patch
deleted file mode 100644
index c905475..0000000
--- a/firefox-5.0-xulstub.patch
+++ /dev/null
@@ -1,1843 +0,0 @@
-
-# HG changeset patch
-# User Benjamin Smedberg <benjamin@smedbergs.us>
-# Date 1301678913 14400
-# Node ID d7fc46501527a4aeecdf3f69f908b250a305ef00
-# Parent e61659c0f0d4505edcb6c018a38f21c830da2e26
-Bug 642795 - Remove support for registering and finding "system XULRunner" via config files or the registry. r=glandium
-
-
-diff --git a/xpcom/build/dlldeps.cpp b/xpcom/build/dlldeps.cpp
---- a/xpcom/build/dlldeps.cpp
-+++ b/xpcom/build/dlldeps.cpp
-@@ -108,17 +108,16 @@
-
- using namespace mozilla;
-
- class nsCStringContainer : private nsStringContainer_base { };
- class nsStringContainer : private nsStringContainer_base { };
-
- void XXXNeverCalled()
- {
-- GRE_GetGREPathWithProperties(nsnull, 0, nsnull, 0, nsnull, 0);
- nsTextFormatter::snprintf(nsnull,0,nsnull);
- nsTextFormatter::smprintf(nsnull, nsnull);
- nsTextFormatter::smprintf_free(nsnull);
- nsVoidArray();
- nsSmallVoidArray();
- {
- nsTArray<PRBool> array1(1), array2(1);
- PRBool a, b, c;
-diff --git a/xpcom/glue/nsGREGlue.cpp b/xpcom/glue/nsGREGlue.cpp
-deleted file mode 100644
---- a/xpcom/glue/nsGREGlue.cpp
-+++ /dev/null
-@@ -1,760 +0,0 @@
--/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
--/* ***** BEGIN LICENSE BLOCK *****
-- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
-- *
-- * The contents of this file are subject to the Mozilla Public License Version
-- * 1.1 (the "License"); you may not use this file except in compliance with
-- * the License. You may obtain a copy of the License at
-- * http://www.mozilla.org/MPL/
-- *
-- * Software distributed under the License is distributed on an "AS IS" basis,
-- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-- * for the specific language governing rights and limitations under the
-- * License.
-- *
-- * The Original Code is Mozilla Communicator.
-- *
-- * The Initial Developer of the Original Code is
-- * Netscape Communications Corp.
-- * Portions created by the Initial Developer are Copyright (C) 2003
-- * the Initial Developer. All Rights Reserved.
-- *
-- * Contributor(s):
-- * Sean Su <ssu@netscape.com>
-- * Benjamin Smedberg <benjamin@smedbergs.us>
-- *
-- * Alternatively, the contents of this file may be used under the terms of
-- * either the GNU General Public License Version 2 or later (the "GPL"), or
-- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-- * in which case the provisions of the GPL or the LGPL are applicable instead
-- * of those above. If you wish to allow use of your version of this file only
-- * under the terms of either the GPL or the LGPL, and not to allow others to
-- * use your version of this file under the terms of the MPL, indicate your
-- * decision by deleting the provisions above and replace them with the notice
-- * and other provisions required by the GPL or the LGPL. If you do not delete
-- * the provisions above, a recipient may use your version of this file under
-- * the terms of any one of the MPL, the GPL or the LGPL.
-- *
-- * ***** END LICENSE BLOCK ***** */
--
--#include "nsXPCOMGlue.h"
--
--#include "nsAutoPtr.h"
--#include "nsINIParser.h"
--#include "nsVersionComparator.h"
--#include "nsXPCOMPrivate.h"
--
--#include <stdio.h>
--#include <stdlib.h>
--#include <string.h>
--#include <wchar.h>
--
--#ifdef XP_WIN32
--# include <windows.h>
--# include <mbstring.h>
--# include <io.h>
--# define snprintf _snprintf
--# define R_OK 04
--#elif defined(XP_OS2)
--# define INCL_DOS
--# include <os2.h>
--#elif defined(XP_MACOSX)
--# include <CoreFoundation/CoreFoundation.h>
--# include <unistd.h>
--# include <dirent.h>
--#elif defined(XP_UNIX)
--# include <unistd.h>
--# include <sys/param.h>
--# include <dirent.h>
--#endif
--
--#include <sys/stat.h>
--
--/**
-- * Like strncat, appends a buffer to another buffer. This is where the
-- * similarity ends. Firstly, the "count" here is the total size of the buffer
-- * (not the number of chars to append. Secondly, the function returns PR_FALSE
-- * if the buffer is not long enough to hold the concatenated string.
-- */
--static PRBool safe_strncat(char *dest, const char *append, PRUint32 count)
--{
-- char *end = dest + count - 1;
--
-- // skip to the end of dest
-- while (*dest)
-- ++dest;
--
-- while (*append && dest < end) {
-- *dest = *append;
-- ++dest, ++append;
-- }
--
-- *dest = '\0';
--
-- return *append == '\0';
--}
--
--#ifdef XP_WIN
--static PRBool
--CheckVersion(const PRUnichar* toCheck,
-- const GREVersionRange *versions,
-- PRUint32 versionsLength);
--#endif
--static PRBool
--CheckVersion(const char* toCheck,
-- const GREVersionRange *versions,
-- PRUint32 versionsLength);
--
--
--#if defined(XP_MACOSX)
--
--static PRBool
--GRE_FindGREFramework(const char* rootPath,
-- const GREVersionRange *versions,
-- PRUint32 versionsLength,
-- const GREProperty *properties,
-- PRUint32 propertiesLength,
-- char* buffer, PRUint32 buflen);
--
--#elif defined(XP_UNIX)
--
--static PRBool
--GRE_GetPathFromConfigDir(const char* dirname,
-- const GREVersionRange *versions,
-- PRUint32 versionsLength,
-- const GREProperty *properties,
-- PRUint32 propertiesLength,
-- char* buffer, PRUint32 buflen);
--
--static PRBool
--GRE_GetPathFromConfigFile(const char* filename,
-- const GREVersionRange *versions,
-- PRUint32 versionsLength,
-- const GREProperty *properties,
-- PRUint32 propertiesLength,
-- char* buffer, PRUint32 buflen);
--
--#elif defined(XP_WIN)
--
--static PRBool
--GRE_GetPathFromRegKey(HKEY aRegKey,
-- const GREVersionRange *versions,
-- PRUint32 versionsLength,
-- const GREProperty *properties,
-- PRUint32 propertiesLength,
-- char* buffer, PRUint32 buflen);
--
--#endif
--
--nsresult
--GRE_GetGREPathWithProperties(const GREVersionRange *versions,
-- PRUint32 versionsLength,
-- const GREProperty *properties,
-- PRUint32 propertiesLength,
-- char *aBuffer, PRUint32 aBufLen)
--{
--#ifdef TARGET_XPCOM_ABI
-- // append the ABI to the properties to match only binary
-- // compatible GREs
-- static const GREProperty kExtraProperty =
-- { "abi", TARGET_XPCOM_ABI };
--
-- nsAutoArrayPtr<GREProperty> allProperties(new GREProperty[propertiesLength + 1]);
-- if (!allProperties)
-- return NS_ERROR_OUT_OF_MEMORY;
--
-- for (PRUint32 i=0; i<propertiesLength; i++) {
-- allProperties[i].property = properties[i].property;
-- allProperties[i].value = properties[i].value;
-- }
-- allProperties[propertiesLength].property = kExtraProperty.property;
-- allProperties[propertiesLength].value = kExtraProperty.value;
-- PRUint32 allPropertiesLength = propertiesLength + 1;
--#else
-- const GREProperty *allProperties = properties;
-- PRUint32 allPropertiesLength = propertiesLength;
--#endif
--
-- // if GRE_HOME is in the environment, use that GRE
-- const char* env = getenv("GRE_HOME");
-- if (env && *env) {
-- char p[MAXPATHLEN];
-- snprintf(p, sizeof(p), "%s" XPCOM_FILE_PATH_SEPARATOR XPCOM_DLL, env);
-- p[sizeof(p) - 1] = '\0';
--
--#if XP_UNIX
-- if (realpath(p, aBuffer))
-- return NS_OK;
--#elif WINCE
-- if (p[0] != '\\')
-- {
-- WCHAR dir[MAX_PATH];
-- WCHAR path[MAX_PATH];
-- MultiByteToWideChar(CP_ACP, 0, p, -1, path, MAX_PATH);
-- _wfullpath(dir,path,MAX_PATH);
-- WideCharToMultiByte(CP_ACP, 0, dir, -1, aBuffer, MAX_PATH, NULL, NULL);
-- }
-- else {
-- strcpy(aBuffer, p);
-- }
-- return NS_OK;
--#elif XP_WIN
-- if (_fullpath(aBuffer, p, aBufLen))
-- return NS_OK;
--#elif XP_OS2
-- // realpath on OS/2 returns a unix-ized path, so re-native-ize
-- if (realpath(p, aBuffer)) {
-- for (char* ptr = strchr(aBuffer, '/'); ptr; ptr = strchr(ptr, '/'))
-- *ptr = '\\';
-- return NS_OK;
-- }
--#else
-- // hope for the best
-- // xxxbsmedberg: other platforms should have a "make absolute" function
--#endif
--
-- if (strlen(p) >= aBufLen)
-- return NS_ERROR_FILE_NAME_TOO_LONG;
--
-- strcpy(aBuffer, p);
--
-- return NS_OK;
-- }
--
-- // the Gecko bits that sit next to the application or in the LD_LIBRARY_PATH
-- env = getenv("USE_LOCAL_GRE");
-- if (env && *env) {
-- *aBuffer = nsnull;
-- return NS_OK;
-- }
--
--#ifdef XP_MACOSX
-- aBuffer[0] = '\0';
--
-- // Check the bundle first, for <bundle>/Contents/Frameworks/XUL.framework/libxpcom.dylib
-- CFBundleRef appBundle = CFBundleGetMainBundle();
-- if (appBundle) {
-- CFURLRef fwurl = CFBundleCopyPrivateFrameworksURL(appBundle);
-- CFURLRef absfwurl = nsnull;
-- if (fwurl) {
-- absfwurl = CFURLCopyAbsoluteURL(fwurl);
-- CFRelease(fwurl);
-- }
--
-- if (absfwurl) {
-- CFURLRef xulurl =
-- CFURLCreateCopyAppendingPathComponent(NULL, absfwurl,
-- CFSTR(GRE_FRAMEWORK_NAME),
-- PR_TRUE);
--
-- if (xulurl) {
-- CFURLRef xpcomurl =
-- CFURLCreateCopyAppendingPathComponent(NULL, xulurl,
-- CFSTR("libxpcom.dylib"),
-- PR_FALSE);
--
-- if (xpcomurl) {
-- char tbuffer[MAXPATHLEN];
--
-- if (CFURLGetFileSystemRepresentation(xpcomurl, PR_TRUE,
-- (UInt8*) tbuffer,
-- sizeof(tbuffer)) &&
-- access(tbuffer, R_OK | X_OK) == 0) {
-- if (!realpath(tbuffer, aBuffer)) {
-- aBuffer[0] = '\0';
-- }
-- }
--
-- CFRelease(xpcomurl);
-- }
--
-- CFRelease(xulurl);
-- }
--
-- CFRelease(absfwurl);
-- }
-- }
--
-- if (aBuffer[0])
-- return NS_OK;
--
-- // Check ~/Library/Frameworks/XUL.framework/Versions/<version>/libxpcom.dylib
-- const char *home = getenv("HOME");
-- if (home && *home && GRE_FindGREFramework(home,
-- versions, versionsLength,
-- allProperties, allPropertiesLength,
-- aBuffer, aBufLen)) {
-- return NS_OK;
-- }
--
-- // Check /Library/Frameworks/XUL.framework/Versions/<version>/libxpcom.dylib
-- if (GRE_FindGREFramework("",
-- versions, versionsLength,
-- allProperties, allPropertiesLength,
-- aBuffer, aBufLen)) {
-- return NS_OK;
-- }
--
--#elif defined(XP_UNIX)
-- env = getenv("MOZ_GRE_CONF");
-- if (env && GRE_GetPathFromConfigFile(env,
-- versions, versionsLength,
-- allProperties, allPropertiesLength,
-- aBuffer, aBufLen)) {
-- return NS_OK;
-- }
--
-- env = getenv("HOME");
-- if (env && *env) {
-- char buffer[MAXPATHLEN];
--
-- // Look in ~/.gre.config
--
-- snprintf(buffer, sizeof(buffer),
-- "%s" XPCOM_FILE_PATH_SEPARATOR GRE_CONF_NAME, env);
--
-- if (GRE_GetPathFromConfigFile(buffer,
-- versions, versionsLength,
-- allProperties, allPropertiesLength,
-- aBuffer, aBufLen)) {
-- return NS_OK;
-- }
--
-- // Look in ~/.gre.d/*.conf
--
-- snprintf(buffer, sizeof(buffer),
-- "%s" XPCOM_FILE_PATH_SEPARATOR GRE_USER_CONF_DIR, env);
--
-- if (GRE_GetPathFromConfigDir(buffer,
-- versions, versionsLength,
-- allProperties, allPropertiesLength,
-- aBuffer, aBufLen)) {
-- return NS_OK;
-- }
-- }
--
-- // Look for a global /etc/gre.conf file
-- if (GRE_GetPathFromConfigFile(GRE_CONF_PATH,
-- versions, versionsLength,
-- allProperties, allPropertiesLength,
-- aBuffer, aBufLen)) {
-- return NS_OK;
-- }
--
-- // Look for a group of config files in /etc/gre.d/
-- if (GRE_GetPathFromConfigDir(GRE_CONF_DIR,
-- versions, versionsLength,
-- allProperties, allPropertiesLength,
-- aBuffer, aBufLen)) {
-- return NS_OK;
-- }
--
--#elif defined(XP_WIN)
-- HKEY hRegKey = NULL;
--
-- // A couple of key points here:
-- // 1. Note the usage of the "Software\\mozilla.org\\GRE" subkey - this allows
-- // us to have multiple versions of GREs on the same machine by having
-- // subkeys such as 1.0, 1.1, 2.0 etc. under it.
-- // 2. In this sample below we're looking for the location of GRE version 1.2
-- // i.e. we're compatible with GRE 1.2 and we're trying to find it's install
-- // location.
-- //
-- // Please see http://www.mozilla.org/projects/embedding/GRE.html for
-- // more info.
-- //
-- if (::RegOpenKeyExW(HKEY_CURRENT_USER, GRE_WIN_REG_LOC, 0,
-- KEY_READ, &hRegKey) == ERROR_SUCCESS) {
-- PRBool ok = GRE_GetPathFromRegKey(hRegKey,
-- versions, versionsLength,
-- allProperties, allPropertiesLength,
-- aBuffer, aBufLen);
-- ::RegCloseKey(hRegKey);
--
-- if (ok)
-- return NS_OK;
-- }
--
-- if (::RegOpenKeyExW(HKEY_LOCAL_MACHINE, GRE_WIN_REG_LOC, 0,
-- KEY_ENUMERATE_SUB_KEYS, &hRegKey) == ERROR_SUCCESS) {
-- PRBool ok = GRE_GetPathFromRegKey(hRegKey,
-- versions, versionsLength,
-- allProperties, allPropertiesLength,
-- aBuffer, aBufLen);
-- ::RegCloseKey(hRegKey);
--
-- if (ok)
-- return NS_OK;
-- }
--#endif
--
-- return NS_ERROR_FAILURE;
--}
--
--static PRBool
--CheckVersion(const char* toCheck,
-- const GREVersionRange *versions,
-- PRUint32 versionsLength)
--{
--
-- for (const GREVersionRange *versionsEnd = versions + versionsLength;
-- versions < versionsEnd;
-- ++versions) {
-- PRInt32 c = NS_CompareVersions(toCheck, versions->lower);
-- if (c < 0)
-- continue;
--
-- if (!c && !versions->lowerInclusive)
-- continue;
--
-- c = NS_CompareVersions(toCheck, versions->upper);
-- if (c > 0)
-- continue;
--
-- if (!c && !versions->upperInclusive)
-- continue;
--
-- return PR_TRUE;
-- }
--
-- return PR_FALSE;
--}
--
--#ifdef XP_WIN
--
--// Allocate an array of characters using new[], converting from UTF8 to UTF-16.
--// @note Use nsAutoArrayPtr for this result.
--
--static PRUnichar*
--ConvertUTF8toNewUTF16(const char *cstr)
--{
-- int len = MultiByteToWideChar(CP_UTF8, 0, cstr, -1, NULL, 0);
-- WCHAR *wstr = new WCHAR[len];
-- MultiByteToWideChar(CP_UTF8, 0, cstr, -1, wstr, len);
-- return wstr;
--}
--
--typedef nsAutoArrayPtr<PRUnichar> AutoWString;
--
--static PRBool
--CheckVersion(const PRUnichar* toCheck,
-- const GREVersionRange *versions,
-- PRUint32 versionsLength)
--{
-- for (const GREVersionRange *versionsEnd = versions + versionsLength;
-- versions < versionsEnd;
-- ++versions) {
-- AutoWString wlower(ConvertUTF8toNewUTF16(versions->lower));
-- PRInt32 c = NS_CompareVersions(toCheck, wlower);
-- if (c < 0)
-- continue;
--
-- if (!c && !versions->lowerInclusive)
-- continue;
--
-- AutoWString wupper(ConvertUTF8toNewUTF16(versions->upper));
-- c = NS_CompareVersions(toCheck, wupper);
-- if (c > 0)
-- continue;
--
-- if (!c && !versions->upperInclusive)
-- continue;
--
-- return PR_TRUE;
-- }
--
-- return PR_FALSE;
--}
--#endif
--
--
--#ifdef XP_MACOSX
--PRBool
--GRE_FindGREFramework(const char* rootPath,
-- const GREVersionRange *versions,
-- PRUint32 versionsLength,
-- const GREProperty *properties,
-- PRUint32 propertiesLength,
-- char* buffer, PRUint32 buflen)
--{
-- PRBool found = PR_FALSE;
--
-- snprintf(buffer, buflen,
-- "%s/Library/Frameworks/" GRE_FRAMEWORK_NAME "/Versions", rootPath);
-- DIR *dir = opendir(buffer);
-- if (dir) {
-- struct dirent *entry;
-- while (!found && (entry = readdir(dir))) {
-- if (CheckVersion(entry->d_name, versions, versionsLength)) {
-- snprintf(buffer, buflen,
-- "%s/Library/Frameworks/" GRE_FRAMEWORK_NAME
-- "/Versions/%s/" XPCOM_DLL, rootPath, entry->d_name);
-- if (access(buffer, R_OK | X_OK) == 0)
-- found = PR_TRUE;
-- }
-- }
--
-- closedir(dir);
-- }
--
-- if (found)
-- return PR_TRUE;
--
-- buffer[0] = '\0';
-- return PR_FALSE;
--}
--
--#elif defined(XP_UNIX)
--
--static PRBool IsConfFile(const char *filename)
--{
-- const char *dot = strrchr(filename, '.');
--
-- return (dot && strcmp(dot, ".conf") == 0);
--}
--
--PRBool
--GRE_GetPathFromConfigDir(const char* dirname,
-- const GREVersionRange *versions,
-- PRUint32 versionsLength,
-- const GREProperty *properties,
-- PRUint32 propertiesLength,
-- char* buffer, PRUint32 buflen)
--{
-- // Open the directory provided and try to read any files in that
-- // directory that end with .conf. We look for an entry that might
-- // point to the GRE that we're interested in.
-- DIR *dir = opendir(dirname);
-- if (!dir)
-- return nsnull;
--
-- PRBool found = PR_FALSE;
-- struct dirent *entry;
--
-- while (!found && (entry = readdir(dir))) {
--
-- // Only look for files that end in .conf
-- // IsConfFile will skip "." and ".."
-- if (!IsConfFile(entry->d_name))
-- continue;
--
-- char fullPath[MAXPATHLEN];
-- snprintf(fullPath, sizeof(fullPath), "%s" XPCOM_FILE_PATH_SEPARATOR "%s",
-- dirname, entry->d_name);
--
-- found = GRE_GetPathFromConfigFile(fullPath,
-- versions, versionsLength,
-- properties, propertiesLength,
-- buffer, buflen);
-- }
--
-- closedir(dir);
--
-- return found;
--}
--
--#define READ_BUFFER_SIZE 1024
--
--struct INIClosure
--{
-- nsINIParser *parser;
-- const GREVersionRange *versions;
-- PRUint32 versionsLength;
-- const GREProperty *properties;
-- PRUint32 propertiesLength;
-- char *pathBuffer;
-- PRUint32 buflen;
-- PRBool found;
--};
--
--static PRBool
--CheckINIHeader(const char *aHeader, void *aClosure)
--{
-- nsresult rv;
--
-- INIClosure *c = reinterpret_cast<INIClosure *>(aClosure);
--
-- if (!CheckVersion(aHeader, c->versions, c->versionsLength))
-- return PR_TRUE;
--
-- const GREProperty *properties = c->properties;
-- const GREProperty *endProperties = properties + c->propertiesLength;
-- for (; properties < endProperties; ++properties) {
-- char buffer[MAXPATHLEN];
-- rv = c->parser->GetString(aHeader, properties->property,
-- buffer, sizeof(buffer));
-- if (NS_FAILED(rv))
-- return PR_TRUE;
--
-- if (strcmp(buffer, properties->value))
-- return PR_TRUE;
-- }
--
-- rv = c->parser->GetString(aHeader, "GRE_PATH", c->pathBuffer, c->buflen);
-- if (NS_FAILED(rv))
-- return PR_TRUE;
--
-- if (!safe_strncat(c->pathBuffer, "/" XPCOM_DLL, c->buflen) ||
-- access(c->pathBuffer, R_OK))
-- return PR_TRUE;
--
-- // We found a good GRE! Stop looking.
-- c->found = PR_TRUE;
-- return PR_FALSE;
--}
--
--PRBool
--GRE_GetPathFromConfigFile(const char* filename,
-- const GREVersionRange *versions,
-- PRUint32 versionsLength,
-- const GREProperty *properties,
-- PRUint32 propertiesLength,
-- char* pathBuffer, PRUint32 buflen)
--{
-- nsINIParser parser;
-- nsresult rv = parser.Init(filename);
-- if (NS_FAILED(rv))
-- return PR_FALSE;
--
-- INIClosure c = {
-- &parser,
-- versions, versionsLength,
-- properties, propertiesLength,
-- pathBuffer, buflen,
-- PR_FALSE
-- };
--
-- parser.GetSections(CheckINIHeader, &c);
-- return c.found;
--}
--
--#elif defined(XP_WIN)
--
--static PRBool
--CopyWithEnvExpansion(PRUnichar* aDest, const PRUnichar* aSource, PRUint32 aBufLen,
-- DWORD aType)
--{
-- switch (aType) {
-- case REG_SZ:
-- if (wcslen(aSource) >= aBufLen)
-- return PR_FALSE;
--
-- wcscpy(aDest, aSource);
-- return PR_TRUE;
--
-- case REG_EXPAND_SZ:
-- if (ExpandEnvironmentStringsW(aSource, aDest, aBufLen) > aBufLen)
-- return PR_FALSE;
--
-- return PR_TRUE;
-- };
--
-- // Whoops! We expected REG_SZ or REG_EXPAND_SZ, what happened here?
--
-- return PR_FALSE;
--}
--
--PRBool
--GRE_GetPathFromRegKey(HKEY aRegKey,
-- const GREVersionRange *versions,
-- PRUint32 versionsLength,
-- const GREProperty *properties,
-- PRUint32 propertiesLength,
-- char* aBuffer, PRUint32 aBufLen)
--{
-- // Formerly, GREs were registered at the registry key
-- // HKLM/Software/mozilla.org/GRE/<version> valuepair GreHome=Path.
-- // Nowadays, they are registered in any subkey of
-- // Software/mozilla.org/GRE, with the following valuepairs:
-- // Version=<version> (REG_SZ)
-- // GreHome=<path> (REG_SZ or REG_EXPAND_SZ)
-- // <Property>=<value> (REG_SZ)
-- //
-- // Additional meta-info may be available in the future, including
-- // localization info and other information which might be pertinent
-- // to selecting one GRE over another.
-- //
-- // When a GRE is being registered, it should try to register itself at
-- // HKLM/Software/mozilla.org/GRE/<Version> first, to preserve compatibility
-- // with older glue. If this key is already taken (i.e. there is more than
-- // one GRE of that version installed), it should append a unique number to
-- // the version, for example:
-- // 1.1 (already in use), 1.1_1, 1.1_2, etc...
--
-- DWORD i = 0;
-- PRUnichar buffer[MAXPATHLEN + 1];
--
-- while (PR_TRUE) {
-- PRUnichar name[MAXPATHLEN + 1];
-- DWORD nameLen = MAXPATHLEN;
-- if (::RegEnumKeyExW(aRegKey, i, name, &nameLen, NULL, NULL, NULL, NULL) !=
-- ERROR_SUCCESS) {
-- break;
-- }
--
-- HKEY subKey = NULL;
-- if (::RegOpenKeyExW(aRegKey, name, 0, KEY_QUERY_VALUE, &subKey) !=
-- ERROR_SUCCESS) {
-- continue;
-- }
--
-- PRUnichar version[40];
-- DWORD versionlen = 40;
-- PRUnichar pathbuf[MAXPATHLEN + 1];
-- DWORD pathlen;
-- DWORD pathtype;
--
-- PRBool ok = PR_FALSE;
--
-- if (::RegQueryValueExW(subKey, L"Version", NULL, NULL,
-- (BYTE*) version, &versionlen) == ERROR_SUCCESS &&
-- CheckVersion(version, versions, versionsLength)) {
--
-- ok = PR_TRUE;
-- const GREProperty *props = properties;
-- const GREProperty *propsEnd = properties + propertiesLength;
-- for (; ok && props < propsEnd; ++props) {
-- pathlen = MAXPATHLEN + 1;
--
-- AutoWString wproperty(ConvertUTF8toNewUTF16(props->property));
-- AutoWString wvalue(ConvertUTF8toNewUTF16(props->value));
-- if (::RegQueryValueExW(subKey, wproperty, NULL, &pathtype,
-- (BYTE*) pathbuf, &pathlen) != ERROR_SUCCESS ||
-- wcscmp(pathbuf, wvalue))
-- ok = PR_FALSE;
-- }
--
-- pathlen = sizeof(pathbuf);
-- if (ok &&
-- (!::RegQueryValueExW(subKey, L"GreHome", NULL, &pathtype,
-- (BYTE*) pathbuf, &pathlen) == ERROR_SUCCESS ||
-- !*pathbuf ||
-- !CopyWithEnvExpansion(buffer, pathbuf, MAXPATHLEN, pathtype))) {
-- ok = PR_FALSE;
-- }
-- else if (!wcsncat(buffer, L"\\" LXPCOM_DLL, aBufLen)
--#ifdef WINCE
-- || (GetFileAttributesW(buffer) == INVALID_FILE_ATTRIBUTES)
--#else
-- || _waccess(buffer, R_OK)
--#endif
-- ) {
-- ok = PR_FALSE;
-- }
-- }
--
-- RegCloseKey(subKey);
--
-- if (ok) {
-- WideCharToMultiByte(CP_UTF8, 0, buffer, -1, aBuffer, aBufLen, NULL, NULL);
-- return PR_TRUE;
-- }
--
-- ++i;
-- }
--
-- aBuffer[0] = '\0';
--
-- return PR_FALSE;
--}
--#endif // XP_WIN
-diff --git a/xpcom/glue/objs.mk b/xpcom/glue/objs.mk
---- a/xpcom/glue/objs.mk
-+++ b/xpcom/glue/objs.mk
-@@ -51,17 +51,16 @@ XPCOM_GLUE_SRC_LCPPSRCS = \
- nsComponentManagerUtils.cpp \
- nsEnumeratorUtils.cpp \
- nsID.cpp \
- nsIInterfaceRequestorUtils.cpp \
- nsINIParser.cpp \
- nsISupportsImpl.cpp \
- nsMemory.cpp \
- nsWeakReference.cpp \
-- nsGREGlue.cpp \
- nsVersionComparator.cpp \
- nsTHashtable.cpp \
- nsQuickSort.cpp \
- nsVoidArray.cpp \
- nsTArray.cpp \
- nsThreadUtils.cpp \
- nsTObserverArray.cpp \
- nsCycleCollectionParticipant.cpp \
-diff --git a/xpcom/glue/standalone/nsXPCOMGlue.h b/xpcom/glue/standalone/nsXPCOMGlue.h
---- a/xpcom/glue/standalone/nsXPCOMGlue.h
-+++ b/xpcom/glue/standalone/nsXPCOMGlue.h
-@@ -36,64 +36,16 @@
- *
- * ***** END LICENSE BLOCK ***** */
-
- #ifndef nsXPCOMGlue_h__
- #define nsXPCOMGlue_h__
-
- #include "nscore.h"
-
--class nsILocalFile;
--
--/**
-- * The following function is available in both the standalone and
-- * dynamically linked versions of the glue.
-- */
--
--struct GREVersionRange {
-- const char *lower;
-- PRBool lowerInclusive;
-- const char *upper;
-- PRBool upperInclusive;
--};
--
--struct GREProperty {
-- const char *property;
-- const char *value;
--};
--
--/**
-- * Locate the path of the xpcom shared library from a GRE with specified
-- * properties.
-- *
-- * @param versions An array of version ranges: if any version range
-- * matches, the GRE is considered acceptable.
-- * @param versionsLength The length of the versions array.
-- * @param properties A null-terminated list of GRE property/value pairs
-- * which must all be satisfied.
-- * @param propertiesLength Length of the properties array.
-- * @param buffer A buffer to be filled with the appropriate path. If
-- * the "local" GRE is specified (via the USE_LOCAL_GRE
-- * environment variable, for example), this buffer
-- * will be set to the empty string.
-- * @param buflen The length of buffer. This must be at least
-- * PATH_MAX/MAXPATHLEN.
-- * @throws NS_ERROR_FAILURE if an appropriate GRE could not be found.
-- * @note The properties parameter is ignored on macintosh, because of the
-- * manner in which the XUL frameworks are installed by version.
-- * @note Currently this uses a "first-fit" algorithm, it does not select
-- * the newest available GRE.
-- */
--extern "C" NS_COM_GLUE nsresult
--GRE_GetGREPathWithProperties(const GREVersionRange *versions,
-- PRUint32 versionsLength,
-- const GREProperty *properties,
-- PRUint32 propertiesLength,
-- char *buffer, PRUint32 buflen);
--
- #ifdef XPCOM_GLUE
-
- /**
- * The following functions are only available in the standalone glue.
- */
-
- /**
- * Initialize the XPCOM glue by dynamically linking against the XPCOM
-diff --git a/xulrunner/app/Makefile.in b/xulrunner/app/Makefile.in
---- a/xulrunner/app/Makefile.in
-+++ b/xulrunner/app/Makefile.in
-@@ -68,30 +68,16 @@ endif
-
- ifdef TARGET_XPCOM_ABI
- DEFINES += -DTARGET_XPCOM_ABI=\"$(TARGET_XPCOM_ABI)\"
- endif
-
-
- CPPSRCS = nsXULRunnerApp.cpp
-
--ifneq (,$(filter WINNT WINCE,$(OS_ARCH)))
--CPPSRCS += nsRegisterGREWin.cpp
--else
--ifeq (OS2,$(OS_ARCH))
--CPPSRCS += nsRegisterGREVoid.cpp
--else
--ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
--CPPSRCS += nsRegisterGREVoid.cpp
--else
--CPPSRCS += nsRegisterGREUnix.cpp
--endif
--endif
--endif
--
- LOCAL_INCLUDES += \
- -I$(topsrcdir)/toolkit/xre \
- -I$(topsrcdir)/toolkit/profile \
- -I$(topsrcdir)/xpcom/base \
- $(NULL)
-
- ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
- TK_LIBS := -framework Cocoa $(TK_LIBS)
-diff --git a/xulrunner/app/nsRegisterGRE.h b/xulrunner/app/nsRegisterGRE.h
-deleted file mode 100644
---- a/xulrunner/app/nsRegisterGRE.h
-+++ /dev/null
-@@ -1,58 +0,0 @@
--/* ***** BEGIN LICENSE BLOCK *****
-- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
-- *
-- * The contents of this file are subject to the Mozilla Public License Version
-- * 1.1 (the "License"); you may not use this file except in compliance with
-- * the License. You may obtain a copy of the License at
-- * http://www.mozilla.org/MPL/
-- *
-- * Software distributed under the License is distributed on an "AS IS" basis,
-- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-- * for the specific language governing rights and limitations under the
-- * License.
-- *
-- * The Original Code is Mozilla XULRunner.
-- *
-- * The Initial Developer of the Original Code is
-- * Benjamin Smedberg <benjamin@smedbergs.us>.
-- *
-- * Portions created by the Initial Developer are Copyright (C) 2005
-- * the Initial Developer. All Rights Reserved.
-- *
-- * Contributor(s):
-- *
-- * Alternatively, the contents of this file may be used under the terms of
-- * either the GNU General Public License Version 2 or later (the "GPL"), or
-- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-- * in which case the provisions of the GPL or the LGPL are applicable instead
-- * of those above. If you wish to allow use of your version of this file only
-- * under the terms of either the GPL or the LGPL, and not to allow others to
-- * use your version of this file under the terms of the MPL, indicate your
-- * decision by deleting the provisions above and replace them with the notice
-- * and other provisions required by the GPL or the LGPL. If you do not delete
-- * the provisions above, a recipient may use your version of this file under
-- * the terms of any one of the MPL, the GPL or the LGPL.
-- *
-- * ***** END LICENSE BLOCK ***** */
--
--#ifndef nsRegisterGRE_h__
--#define nsRegisterGRE_h__
--
--#include "nscore.h"
--#include "nsStringAPI.h"
--class nsIFile;
--struct GREProperty;
--
--/**
-- * @return PR_TRUE on success
-- */
--NS_HIDDEN_(PRBool)
--RegisterXULRunner(PRBool aRegisterGlobally, nsIFile* aLocation,
-- const GREProperty *aProperties, PRUint32 aPropertiesLen,
-- const char *aGREMilestone);
--
--NS_HIDDEN_(void)
--UnregisterXULRunner(PRBool aUnregisterGlobally, nsIFile* aLocation,
-- const char *aGREMilestone);
--
--#endif // nsRegisterGRE_h__
-diff --git a/xulrunner/app/nsRegisterGREUnix.cpp b/xulrunner/app/nsRegisterGREUnix.cpp
-deleted file mode 100644
---- a/xulrunner/app/nsRegisterGREUnix.cpp
-+++ /dev/null
-@@ -1,272 +0,0 @@
--/* ***** BEGIN LICENSE BLOCK *****
-- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
-- *
-- * The contents of this file are subject to the Mozilla Public License Version
-- * 1.1 (the "License"); you may not use this file except in compliance with
-- * the License. You may obtain a copy of the License at
-- * http://www.mozilla.org/MPL/
-- *
-- * Software distributed under the License is distributed on an "AS IS" basis,
-- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-- * for the specific language governing rights and limitations under the
-- * License.
-- *
-- * The Original Code is Mozilla XULRunner.
-- *
-- * The Initial Developer of the Original Code is
-- * Benjamin Smedberg <benjamin@smedbergs.us>.
-- *
-- * Portions created by the Initial Developer are Copyright (C) 2005
-- * the Initial Developer. All Rights Reserved.
-- *
-- * Contributor(s):
-- *
-- * Alternatively, the contents of this file may be used under the terms of
-- * either the GNU General Public License Version 2 or later (the "GPL"), or
-- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-- * in which case the provisions of the GPL or the LGPL are applicable instead
-- * of those above. If you wish to allow use of your version of this file only
-- * under the terms of either the GPL or the LGPL, and not to allow others to
-- * use your version of this file under the terms of the MPL, indicate your
-- * decision by deleting the provisions above and replace them with the notice
-- * and other provisions required by the GPL or the LGPL. If you do not delete
-- * the provisions above, a recipient may use your version of this file under
-- * the terms of any one of the MPL, the GPL or the LGPL.
-- *
-- * ***** END LICENSE BLOCK ***** */
--
--#include "nsRegisterGRE.h"
--#include "nsXPCOMGlue.h"
--
--#include "nsXPCOM.h"
--#include "nsIFile.h"
--#include "nsILocalFile.h"
--#include "mozilla/FileUtils.h"
--
--#include "nsAppRunner.h" // for MAXPATHLEN
--#include "nsStringAPI.h"
--#include "nsINIParser.h"
--#include "nsCOMPtr.h"
--
--#include "prio.h"
--#include "prprf.h"
--#include "prenv.h"
--
--#include <unistd.h>
--#include <sys/stat.h>
--
--// If we can't register <buildid>.conf, we try to create a unique filename
--// by looping through <buildid>_<int>.conf, but if something is seriously wrong
--// we stop at 1000
--#define UNIQ_LOOP_LIMIT 1000
--
--using namespace mozilla;
--
--static const char kRegFileGlobal[] = "global.reginfo";
--static const char kRegFileUser[] = "user.reginfo";
--
--static PRBool
--MakeConfFile(const char *regfile, const nsCString &greHome,
-- const GREProperty *aProperties, PRUint32 aPropertiesLen,
-- const char *aGREMilestone)
--{
-- // If the file exists, don't create it again!
-- if (access(regfile, R_OK) == 0)
-- return PR_FALSE;
--
-- PRBool ok = PR_TRUE;
--
-- { // scope "fd" so that we can delete the file if something goes wrong
-- AutoFDClose fd = PR_Open(regfile, PR_CREATE_FILE | PR_WRONLY | PR_TRUNCATE,
-- 0664);
-- if (!fd)
-- return PR_FALSE;
--
-- static const char kHeader[] =
-- "# Registration file generated by xulrunner. Do not edit.\n\n"
-- "[%s]\n"
-- "GRE_PATH=%s\n";
--
-- if (PR_fprintf(fd, kHeader, aGREMilestone, greHome.get()) <= 0)
-- ok = PR_FALSE;
--
-- for (PRUint32 i = 0; i < aPropertiesLen; ++i) {
-- if (PR_fprintf(fd, "%s=%s\n",
-- aProperties[i].property, aProperties[i].value) <= 0)
-- ok = PR_FALSE;
-- }
-- }
--
-- if (!ok)
-- PR_Delete(regfile);
--
-- return ok;
--}
--
--
--PRBool
--RegisterXULRunner(PRBool aRegisterGlobally, nsIFile* aLocation,
-- const GREProperty *aProperties, PRUint32 aPropertiesLen,
-- const char *aGREMilestone)
--{
-- // Register ourself in /etc/gre.d or ~/.gre.d/ and record what key we created
-- // for future unregistration.
--
-- nsresult rv;
--
-- char root[MAXPATHLEN] = "/etc/gre.d";
--
-- if (!aRegisterGlobally) {
-- char *home = PR_GetEnv("HOME");
-- if (!home || !*home)
-- return PR_FALSE;
--
-- PR_snprintf(root, MAXPATHLEN, "%s/.gre.d", home);
-- }
--
-- nsCString greHome;
-- rv = aLocation->GetNativePath(greHome);
-- if (NS_FAILED(rv))
-- return rv;
--
-- nsCOMPtr<nsIFile> savedInfoFile;
-- aLocation->Clone(getter_AddRefs(savedInfoFile));
-- nsCOMPtr<nsILocalFile> localSaved(do_QueryInterface(savedInfoFile));
-- if (!localSaved)
-- return PR_FALSE;
--
-- const char *infoname = aRegisterGlobally ? kRegFileGlobal : kRegFileUser;
-- localSaved->AppendNative(nsDependentCString(infoname));
--
-- AutoFDClose fd;
-- rv = localSaved->OpenNSPRFileDesc(PR_CREATE_FILE | PR_RDWR, 0664, &fd);
-- // XXX report error?
-- if (NS_FAILED(rv))
-- return PR_FALSE;
--
-- char keyName[MAXPATHLEN];
--
-- PRInt32 r = PR_Read(fd, keyName, MAXPATHLEN);
-- if (r < 0)
-- return PR_FALSE;
--
-- char regfile[MAXPATHLEN];
--
-- if (r > 0) {
-- keyName[r] = '\0';
--
-- PR_snprintf(regfile, MAXPATHLEN, "%s/%s.conf", root, keyName);
--
-- // There was already a .reginfo file, let's see if we are already
-- // registered.
-- if (access(regfile, R_OK) == 0) {
-- fprintf(stderr, "Warning: Configuration file '%s' already exists.\n"
-- "No action was performed.\n", regfile);
-- return PR_FALSE;
-- }
--
-- rv = localSaved->OpenNSPRFileDesc(PR_CREATE_FILE | PR_WRONLY | PR_TRUNCATE, 0664, &fd);
-- if (NS_FAILED(rv))
-- return PR_FALSE;
-- }
--
-- if (access(root, R_OK | X_OK) &&
-- mkdir(root, 0775)) {
-- fprintf(stderr, "Error: could not create '%s'.\n",
-- root);
-- return PR_FALSE;
-- }
--
-- PR_snprintf(regfile, MAXPATHLEN, "%s/%s.conf", root, aGREMilestone);
-- if (MakeConfFile(regfile, greHome, aProperties, aPropertiesLen,
-- aGREMilestone)) {
-- PR_fprintf(fd, "%s", aGREMilestone);
-- return PR_TRUE;
-- }
--
-- for (int i = 0; i < UNIQ_LOOP_LIMIT; ++i) {
-- static char buildID[30];
-- sprintf(buildID, "%s_%i", aGREMilestone, i);
--
-- PR_snprintf(regfile, MAXPATHLEN, "%s/%s.conf", root, buildID);
--
-- if (MakeConfFile(regfile, greHome, aProperties, aPropertiesLen,
-- aGREMilestone)) {
-- PR_Write(fd, buildID, strlen(buildID));
-- return PR_TRUE;
-- }
-- }
--
-- return PR_FALSE;
--}
--
--void
--UnregisterXULRunner(PRBool aRegisterGlobally, nsIFile* aLocation,
-- const char *aGREMilestone)
--{
-- nsresult rv;
--
-- char root[MAXPATHLEN] = "/etc/gre.d";
--
-- if (!aRegisterGlobally) {
-- char *home = PR_GetEnv("HOME");
-- if (!home || !*home)
-- return;
--
-- PR_snprintf(root, MAXPATHLEN, "%s/.gre.d", home);
-- }
--
-- nsCOMPtr<nsIFile> savedInfoFile;
-- aLocation->Clone(getter_AddRefs(savedInfoFile));
-- nsCOMPtr<nsILocalFile> localSaved (do_QueryInterface(savedInfoFile));
-- if (!localSaved)
-- return;
--
-- const char *infoname = aRegisterGlobally ? kRegFileGlobal : kRegFileUser;
-- localSaved->AppendNative(nsDependentCString(infoname));
--
-- PRFileDesc* fd = nsnull;
-- rv = localSaved->OpenNSPRFileDesc(PR_RDONLY, 0, &fd);
-- if (NS_FAILED(rv)) {
-- // XXX report error?
-- return;
-- }
--
-- char keyName[MAXPATHLEN];
-- PRInt32 r = PR_Read(fd, keyName, MAXPATHLEN);
-- PR_Close(fd);
--
-- localSaved->Remove(PR_FALSE);
--
-- if (r <= 0)
-- return;
--
-- keyName[r] = '\0';
--
-- char regFile[MAXPATHLEN];
-- PR_snprintf(regFile, MAXPATHLEN, "%s/%s.conf", root, keyName);
--
-- nsCOMPtr<nsILocalFile> lf;
-- rv = NS_NewNativeLocalFile(nsDependentCString(regFile), PR_FALSE,
-- getter_AddRefs(lf));
-- if (NS_FAILED(rv))
-- return;
--
-- nsINIParser p;
-- rv = p.Init(lf);
-- if (NS_FAILED(rv))
-- return;
--
-- rv = p.GetString(aGREMilestone, "GRE_PATH", root, MAXPATHLEN);
-- if (NS_FAILED(rv))
-- return;
--
-- rv = NS_NewNativeLocalFile(nsDependentCString(root), PR_TRUE,
-- getter_AddRefs(lf));
-- if (NS_FAILED(rv))
-- return;
--
-- PRBool eq;
-- if (NS_SUCCEEDED(aLocation->Equals(lf, &eq)) && eq)
-- PR_Delete(regFile);
--}
-diff --git a/xulrunner/app/nsRegisterGREVoid.cpp b/xulrunner/app/nsRegisterGREVoid.cpp
-deleted file mode 100644
---- a/xulrunner/app/nsRegisterGREVoid.cpp
-+++ /dev/null
-@@ -1,57 +0,0 @@
--/* ***** BEGIN LICENSE BLOCK *****
-- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
-- *
-- * The contents of this file are subject to the Mozilla Public License Version
-- * 1.1 (the "License"); you may not use this file except in compliance with
-- * the License. You may obtain a copy of the License at
-- * http://www.mozilla.org/MPL/
-- *
-- * Software distributed under the License is distributed on an "AS IS" basis,
-- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-- * for the specific language governing rights and limitations under the
-- * License.
-- *
-- * The Original Code is Mozilla XULRunner.
-- *
-- * The Initial Developer of the Original Code is
-- * Benjamin Smedberg <benjamin@smedbergs.us>.
-- *
-- * Portions created by the Initial Developer are Copyright (C) 2005
-- * the Initial Developer. All Rights Reserved.
-- *
-- * Contributor(s):
-- *
-- * Alternatively, the contents of this file may be used under the terms of
-- * either the GNU General Public License Version 2 or later (the "GPL"), or
-- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-- * in which case the provisions of the GPL or the LGPL are applicable instead
-- * of those above. If you wish to allow use of your version of this file only
-- * under the terms of either the GPL or the LGPL, and not to allow others to
-- * use your version of this file under the terms of the MPL, indicate your
-- * decision by deleting the provisions above and replace them with the notice
-- * and other provisions required by the GPL or the LGPL. If you do not delete
-- * the provisions above, a recipient may use your version of this file under
-- * the terms of any one of the MPL, the GPL or the LGPL.
-- *
-- * ***** END LICENSE BLOCK ***** */
--
--#include "nsRegisterGRE.h"
--
--#include <stdlib.h>
--#include <stdio.h>
--
--int
--RegisterXULRunner(PRBool aRegisterGlobally, nsIFile* aLocation,
-- const GREProperty *aProperties, PRUint32 aPropertiesLen,
-- const char *aGREMilestone)
--{
-- fprintf(stderr, "Registration not implemented on this platform!\n");
-- return 1;
--}
--
--void
--UnregisterXULRunner(PRBool aUnregisterGlobally, nsIFile* aLocation,
-- const char *aGREMilestone)
--{
-- fprintf(stderr, "Registration not implemented on this platform!\n");
--}
-diff --git a/xulrunner/app/nsRegisterGREWin.cpp b/xulrunner/app/nsRegisterGREWin.cpp
-deleted file mode 100644
---- a/xulrunner/app/nsRegisterGREWin.cpp
-+++ /dev/null
-@@ -1,288 +0,0 @@
--/* ***** BEGIN LICENSE BLOCK *****
-- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
-- *
-- * The contents of this file are subject to the Mozilla Public License Version
-- * 1.1 (the "License"); you may not use this file except in compliance with
-- * the License. You may obtain a copy of the License at
-- * http://www.mozilla.org/MPL/
-- *
-- * Software distributed under the License is distributed on an "AS IS" basis,
-- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-- * for the specific language governing rights and limitations under the
-- * License.
-- *
-- * The Original Code is Mozilla XULRunner.
-- *
-- * The Initial Developer of the Original Code is
-- * Benjamin Smedberg <benjamin@smedbergs.us>.
-- *
-- * Portions created by the Initial Developer are Copyright (C) 2005
-- * the Initial Developer. All Rights Reserved.
-- *
-- * Contributor(s):
-- *
-- * Alternatively, the contents of this file may be used under the terms of
-- * either the GNU General Public License Version 2 or later (the "GPL"), or
-- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-- * in which case the provisions of the GPL or the LGPL are applicable instead
-- * of those above. If you wish to allow use of your version of this file only
-- * under the terms of either the GPL or the LGPL, and not to allow others to
-- * use your version of this file under the terms of the MPL, indicate your
-- * decision by deleting the provisions above and replace them with the notice
-- * and other provisions required by the GPL or the LGPL. If you do not delete
-- * the provisions above, a recipient may use your version of this file under
-- * the terms of any one of the MPL, the GPL or the LGPL.
-- *
-- * ***** END LICENSE BLOCK ***** */
--
--#include "nsRegisterGRE.h"
--
--#include "nsXPCOM.h"
--#include "nsIFile.h"
--#include "nsILocalFile.h"
--
--#include "nsAppRunner.h" // for MAXPATHLEN
--#include "nsStringAPI.h"
--#include "nsXPCOMGlue.h"
--#include "nsCOMPtr.h"
--
--#include "prio.h"
--
--#include <windows.h>
--#include "malloc.h"
--
--static const wchar_t kRegKeyRoot[] = L"Software\\mozilla.org\\GRE";
--static const wchar_t kRegFileGlobal[] = L"global.reginfo";
--static const wchar_t kRegFileUser[] = L"user.reginfo";
--
--static nsresult
--MakeVersionKey(HKEY root, const wchar_t* keyname, const nsString &grehome,
-- const GREProperty *aProperties, PRUint32 aPropertiesLen,
-- const wchar_t *aGREMilestone)
--{
-- HKEY subkey;
-- DWORD disp;
--
-- if (::RegCreateKeyExW(root, keyname, NULL, NULL, 0, KEY_WRITE, NULL,
-- &subkey, &disp) != ERROR_SUCCESS)
-- return NS_ERROR_FAILURE;
--
-- if (disp != REG_CREATED_NEW_KEY) {
-- ::RegCloseKey(subkey);
-- return NS_ERROR_FAILURE;
-- }
--
-- PRBool failed = PR_FALSE;
-- failed |= ::RegSetValueExW(subkey, L"Version", NULL, REG_SZ,
-- (BYTE*) aGREMilestone,
-- sizeof(PRUnichar) * (wcslen(aGREMilestone) + 1))
-- != ERROR_SUCCESS;
-- failed |= ::RegSetValueExW(subkey, L"GreHome", NULL, REG_SZ,
-- (BYTE*) grehome.get(),
-- sizeof(PRUnichar) * (grehome.Length() + 1))
-- != ERROR_SUCCESS;
--
-- for (PRUint32 i = 0; i < aPropertiesLen; ++i) {
-- // Properties should be ascii only
-- NS_ConvertASCIItoUTF16 prop(aProperties[i].property);
-- NS_ConvertASCIItoUTF16 val(aProperties[i].value);
-- failed |= ::RegSetValueExW(subkey, prop.get(), NULL, REG_SZ,
-- (BYTE*) val.get(),
-- sizeof(wchar_t)*(val.Length()+1)
-- ) != ERROR_SUCCESS;
-- }
--
-- ::RegCloseKey(subkey);
--
-- if (failed) {
-- // we created a key but couldn't fill it properly: delete it
-- ::RegDeleteKeyW(root, keyname);
-- return NS_ERROR_FAILURE;
-- }
--
-- return NS_OK;
--}
--
--int
--RegisterXULRunner(PRBool aRegisterGlobally, nsIFile* aLocation,
-- const GREProperty *aProperties, PRUint32 aPropertiesLen,
-- const char *aGREMilestoneAscii)
--{
-- // Register ourself in the windows registry, and record what key we created
-- // for future unregistration.
--
-- nsresult rv;
-- PRBool irv;
-- int i;
-- NS_ConvertASCIItoUTF16 aGREMilestone(aGREMilestoneAscii);
-- nsString greHome;
-- rv = aLocation->GetPath(greHome);
-- if (NS_FAILED(rv))
-- return rv;
--
-- nsCOMPtr<nsIFile> savedInfoFile;
-- aLocation->Clone(getter_AddRefs(savedInfoFile));
-- nsCOMPtr<nsILocalFile> localSaved(do_QueryInterface(savedInfoFile));
-- if (!localSaved)
-- return PR_FALSE;
--
-- const wchar_t *infoname = aRegisterGlobally ? kRegFileGlobal : kRegFileUser;
-- localSaved->Append(nsDependentString(infoname));
--
-- PRFileDesc* fd = nsnull;
-- rv = localSaved->OpenNSPRFileDesc(PR_CREATE_FILE | PR_RDWR, 0664, &fd);
-- if (NS_FAILED(rv)) {
-- // XXX report error?
-- return PR_FALSE;
-- }
--
-- HKEY rootKey = NULL;
-- wchar_t keyName[MAXPATHLEN];
-- PRInt32 r;
--
-- if (::RegCreateKeyExW(aRegisterGlobally ? HKEY_LOCAL_MACHINE :
-- HKEY_CURRENT_USER,
-- kRegKeyRoot, NULL, NULL, 0, KEY_WRITE,
-- NULL, &rootKey, NULL) != ERROR_SUCCESS) {
-- irv = PR_FALSE;
-- goto reg_end;
-- }
--
-- r = PR_Read(fd, keyName, MAXPATHLEN);
-- if (r < 0) {
-- irv = PR_FALSE;
-- goto reg_end;
-- }
--
-- if (r > 0) {
-- keyName[r] = '\0';
--
-- // There was already a .reginfo file, let's see if we are already
-- // registered.
-- HKEY existing = NULL;
-- if (::RegOpenKeyExW(rootKey, keyName, NULL, KEY_QUERY_VALUE, &existing) ==
-- ERROR_SUCCESS) {
-- fprintf(stderr, "Warning: Registry key Software\\mozilla.org\\GRE\\%s already exists.\n"
-- "No action was performed.\n",
-- keyName);
-- irv = PR_FALSE;
-- goto reg_end;
-- }
--
-- PR_Close(fd);
-- fd = nsnull;
--
-- rv = localSaved->OpenNSPRFileDesc(PR_CREATE_FILE | PR_WRONLY | PR_TRUNCATE, 0664, &fd);
-- if (NS_FAILED(rv)) {
-- // XXX report error?
-- irv = PR_FALSE;
-- goto reg_end;
-- }
-- }
--
-- wcscpy(keyName, aGREMilestone.get());
-- rv = MakeVersionKey(rootKey, keyName, greHome, aProperties, aPropertiesLen,
-- aGREMilestone.get());
-- if (NS_SUCCEEDED(rv)) {
-- NS_ConvertUTF16toUTF8 keyNameAscii(keyName);
-- PR_Write(fd, keyNameAscii.get(), sizeof(char)*keyNameAscii.Length());
-- irv = PR_TRUE;
-- goto reg_end;
-- }
--
-- for (i = 0; i < 1000; ++i) {
-- swprintf(keyName, L"%s_%i", aGREMilestone.get(), i);
-- rv = MakeVersionKey(rootKey, keyName, greHome,
-- aProperties, aPropertiesLen,
-- aGREMilestone.get());
-- if (NS_SUCCEEDED(rv)) {
-- NS_ConvertUTF16toUTF8 keyNameAscii(keyName);
-- PR_Write(fd, keyNameAscii.get(), sizeof(char)*keyNameAscii.Length());
-- irv = PR_TRUE;
-- goto reg_end;
-- }
-- }
--
-- irv = PR_FALSE;
--
--reg_end:
-- if (fd)
-- PR_Close(fd);
--
-- if (rootKey)
-- ::RegCloseKey(rootKey);
--
-- return irv;
--}
--
--void
--UnregisterXULRunner(PRBool aGlobal, nsIFile* aLocation,
-- const char *aGREMilestone)
--{
-- nsCOMPtr<nsIFile> savedInfoFile;
-- aLocation->Clone(getter_AddRefs(savedInfoFile));
-- nsCOMPtr<nsILocalFile> localSaved (do_QueryInterface(savedInfoFile));
-- if (!localSaved)
-- return;
--
-- const wchar_t *infoname = aGlobal ? kRegFileGlobal : kRegFileUser;
-- localSaved->Append(nsDependentString(infoname));
--
-- PRFileDesc* fd = nsnull;
-- nsresult rv = localSaved->OpenNSPRFileDesc(PR_RDONLY, 0, &fd);
-- if (NS_FAILED(rv)) {
-- // XXX report error?
-- return;
-- }
--
-- wchar_t keyName[MAXPATHLEN];
-- PRInt32 r = PR_Read(fd, keyName, MAXPATHLEN);
-- PR_Close(fd);
--
-- localSaved->Remove(PR_FALSE);
--
-- if (r <= 0)
-- return;
--
-- keyName[r] = '\0';
--
-- HKEY rootKey = NULL;
-- if (::RegOpenKeyExW(aGlobal ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,
-- kRegKeyRoot, 0, KEY_READ, &rootKey) != ERROR_SUCCESS)
-- return;
--
-- HKEY subKey = NULL;
-- if (::RegOpenKeyExW(rootKey, keyName, 0, KEY_READ, &subKey) == ERROR_SUCCESS) {
--
-- char regpath[MAXPATHLEN];
-- DWORD reglen = MAXPATHLEN;
--
-- if (::RegQueryValueExW(subKey, L"GreHome", NULL, NULL,
-- (BYTE*) regpath, &reglen) == ERROR_SUCCESS) {
--
-- nsCOMPtr<nsILocalFile> regpathfile;
-- rv = NS_NewNativeLocalFile(nsDependentCString(regpath), PR_FALSE,
-- getter_AddRefs(regpathfile));
--
-- PRBool eq;
-- if (NS_SUCCEEDED(rv) &&
-- NS_SUCCEEDED(aLocation->Equals(regpathfile, &eq)) && !eq) {
-- // We think we registered for this key, but it doesn't point to
-- // us any more!
-- fprintf(stderr, "Warning: Registry key Software\\mozilla.org\\GRE\\%s points to\n"
-- "alternate path '%s'; unregistration was not successful.\n",
-- keyName, regpath);
--
-- ::RegCloseKey(subKey);
-- ::RegCloseKey(rootKey);
--
-- return;
-- }
-- }
--
-- ::RegCloseKey(subKey);
-- }
--
-- ::RegDeleteKeyW(rootKey, keyName);
-- ::RegCloseKey(rootKey);
--}
-diff --git a/xulrunner/app/nsXULRunnerApp.cpp b/xulrunner/app/nsXULRunnerApp.cpp
---- a/xulrunner/app/nsXULRunnerApp.cpp
-+++ b/xulrunner/app/nsXULRunnerApp.cpp
-@@ -38,17 +38,16 @@
- #include <stdio.h>
- #include <stdlib.h>
- #ifdef XP_WIN
- #include <windows.h>
- #endif
-
- #include "nsXULAppAPI.h"
- #include "nsXPCOMGlue.h"
--#include "nsRegisterGRE.h"
- #include "nsAppRunner.h"
- #include "nsILocalFile.h"
- #include "nsIXULAppInstall.h"
- #include "nsCOMPtr.h"
- #include "nsMemory.h"
- #include "nsCRTGlue.h"
- #include "nsStringAPI.h"
- #include "nsServiceManagerUtils.h"
-@@ -256,26 +255,16 @@ InstallXULApp(nsIFile* aXULRunnerDir,
- NS_ShutdownXPCOM(nsnull);
-
- if (NS_FAILED(rv))
- return 3;
-
- return 0;
- }
-
--static const GREProperty kGREProperties[] = {
-- { "xulrunner", "true" }
--#ifdef TARGET_XPCOM_ABI
-- , { "abi", TARGET_XPCOM_ABI }
--#endif
--#ifdef MOZ_JAVAXPCOM
-- , { "javaxpcom", "1" }
--#endif
--};
--
- class AutoAppData
- {
- public:
- AutoAppData(nsILocalFile* aINIFile) : mAppData(nsnull) {
- nsresult rv = XRE_CreateAppData(aINIFile, &mAppData);
- if (NS_FAILED(rv))
- mAppData = nsnull;
- }
-@@ -312,77 +301,16 @@ int main(int argc, char* argv[])
- }
-
- if (argc > 1) {
- nsCAutoString milestone;
- nsresult rv = GetGREVersion(argv[0], &milestone, nsnull);
- if (NS_FAILED(rv))
- return 2;
-
-- PRBool registerGlobal = IsArg(argv[1], "register-global");
-- PRBool registerUser = IsArg(argv[1], "register-user");
-- if (registerGlobal || registerUser) {
-- if (argc != 2) {
-- Usage(argv[0]);
-- return 1;
-- }
--
-- nsCOMPtr<nsIFile> regDir;
-- rv = GetXULRunnerDir(argv[0], getter_AddRefs(regDir));
-- if (NS_FAILED(rv))
-- return 2;
--
-- return RegisterXULRunner(registerGlobal, regDir,
-- kGREProperties,
-- NS_ARRAY_LENGTH(kGREProperties),
-- milestone.get()) ? 0 : 2;
-- }
--
-- registerGlobal = IsArg(argv[1], "unregister-global");
-- registerUser = IsArg(argv[1], "unregister-user");
-- if (registerGlobal || registerUser) {
-- if (argc != 2) {
-- Usage(argv[0]);
-- return 1;
-- }
--
-- nsCOMPtr<nsIFile> regDir;
-- rv = GetXULRunnerDir(argv[0], getter_AddRefs(regDir));
-- if (NS_FAILED(rv))
-- return 2;
--
-- UnregisterXULRunner(registerGlobal, regDir, milestone.get());
-- return 0;
-- }
--
-- if (IsArg(argv[1], "find-gre")) {
-- if (argc != 3) {
-- Usage(argv[0]);
-- return 1;
-- }
--
-- char path[MAXPATHLEN];
-- static const GREVersionRange vr = {
-- argv[2], PR_TRUE,
-- argv[2], PR_TRUE
-- };
-- static const GREProperty kProperties[] = {
-- { "xulrunner", "true" }
-- };
--
-- rv = GRE_GetGREPathWithProperties(&vr, 1, kProperties,
-- NS_ARRAY_LENGTH(kProperties),
-- path, sizeof(path));
-- if (NS_FAILED(rv))
-- return 1;
--
-- printf("%s\n", path);
-- return 0;
-- }
--
- if (IsArg(argv[1], "gre-version")) {
- if (argc != 2) {
- Usage(argv[0]);
- return 1;
- }
-
- printf("%s\n", milestone.get());
- return 0;
-diff --git a/xulrunner/installer/Makefile.in b/xulrunner/installer/Makefile.in
---- a/xulrunner/installer/Makefile.in
-+++ b/xulrunner/installer/Makefile.in
-@@ -62,29 +62,16 @@ PKG_DMG_SOURCE = $(STAGEPATH)xulrunner-p
- endif
-
- include $(topsrcdir)/config/rules.mk
-
- INSTALL_SDK = 1
-
- include $(topsrcdir)/toolkit/mozapps/installer/packager.mk
-
--$(MOZILLA_VERSION).system.conf: $(topsrcdir)/config/milestone.txt Makefile
-- printf "[%s]\nGRE_PATH=%s\nxulrunner=true\nabi=%s" \
-- $(MOZILLA_VERSION) $(installdir) $(TARGET_XPCOM_ABI)> $@
--
--ifndef SKIP_GRE_REGISTRATION
--# to register xulrunner per-user, override this with $HOME/.gre.d
--regdir = /etc/gre.d
--
--install:: $(MOZILLA_VERSION).system.conf
-- $(NSINSTALL) -D $(DESTDIR)$(regdir)
-- $(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(regdir)
--endif
--
- # Add pkg-config files to the install:: target
-
- pkg_config_files = \
- libxul.pc \
- libxul-embedding.pc \
- mozilla-js.pc \
- mozilla-plugin.pc \
- mozilla-gtkmozembed.pc \
-diff --git a/xulrunner/stub/nsXULStub.cpp b/xulrunner/stub/nsXULStub.cpp
---- a/xulrunner/stub/nsXULStub.cpp
-+++ b/xulrunner/stub/nsXULStub.cpp
-@@ -430,64 +430,19 @@ main(int argc, char **argv)
- // Forward the command-line and bail out
- ForwardToWindow(wnd);
- return 0;
- }
- }
- #endif
-
- if (!greFound) {
-- char minVersion[VERSION_MAXLEN];
--
-- // If a gecko maxVersion is not specified, we assume that the app uses only
-- // frozen APIs, and is therefore compatible with any xulrunner 1.x.
-- char maxVersion[VERSION_MAXLEN] = "1.*";
--
-- GREVersionRange range = {
-- minVersion,
-- PR_TRUE,
-- maxVersion,
-- PR_TRUE
-- };
--
-- rv = parser.GetString("Gecko", "MinVersion", minVersion, sizeof(minVersion));
-- if (NS_FAILED(rv)) {
-- fprintf(stderr,
-- "The application.ini does not specify a [Gecko] MinVersion\n");
-+ Output(PR_FALSE,
-+ "Could not find the Mozilla runtime.\n");
- return 1;
-- }
--
-- rv = parser.GetString("Gecko", "MaxVersion", maxVersion, sizeof(maxVersion));
-- if (NS_SUCCEEDED(rv))
-- range.upperInclusive = PR_TRUE;
--
-- static const GREProperty kProperties[] = {
-- { "xulrunner", "true" }
-- };
--
-- rv = GRE_GetGREPathWithProperties(&range, 1,
-- kProperties, NS_ARRAY_LENGTH(kProperties),
-- greDir, sizeof(greDir));
-- if (NS_FAILED(rv)) {
-- // XXXbsmedberg: Do something much smarter here: notify the
-- // user/offer to download/?
--
-- Output(PR_FALSE,
-- "Could not find compatible GRE between version %s and %s.\n",
-- range.lower, range.upper);
-- return 1;
-- }
--#ifdef XP_UNIX
-- // Using a symlinked greDir will fail during startup. Not sure why, but if
-- // we resolve the symlink, everything works as expected.
-- char resolved_greDir[MAXPATHLEN] = "";
-- if (realpath(greDir, resolved_greDir) && *resolved_greDir) {
-- strncpy(greDir, resolved_greDir, MAXPATHLEN);
-- }
--#endif
- }
-
- #ifdef XP_OS2
- // On OS/2 we need to set BEGINLIBPATH to be able to find XULRunner DLLs
- strcpy(tmpPath, greDir);
- lastSlash = strrchr(tmpPath, PATH_SEPARATOR_CHAR);
- if (lastSlash) {
- *lastSlash = '\0';
-
diff --git a/firefox-stub.patch b/firefox-stub.patch
deleted file mode 100644
index 73fdf08..0000000
--- a/firefox-stub.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-diff -up firefox-4.0.1/mozilla-2.0/browser/build.mk.stub firefox-4.0.1/mozilla-2.0/browser/build.mk
---- firefox-4.0.1/mozilla-2.0/browser/build.mk.stub 2011-04-14 07:28:21.000000000 +0200
-+++ firefox-4.0.1/mozilla-2.0/browser/build.mk 2011-05-10 11:33:21.343196025 +0200
-@@ -53,7 +53,7 @@ ifdef MOZ_SERVICES_SYNC
- tier_app_dirs += services
- endif
-
--tier_app_dirs += browser
-+tier_app_dirs += browser xulrunner
- # Never add other tier_app_dirs after browser. They won't get packaged
- # properly on mac.
-
-diff -up firefox-4.0.1/mozilla-2.0/xulrunner/Makefile.in.stub firefox-4.0.1/mozilla-2.0/xulrunner/Makefile.in
---- firefox-4.0.1/mozilla-2.0/xulrunner/Makefile.in.stub 2011-04-14 07:28:50.000000000 +0200
-+++ firefox-4.0.1/mozilla-2.0/xulrunner/Makefile.in 2011-05-10 11:33:21.343196025 +0200
-@@ -44,10 +44,7 @@ VPATH = @srcdir@
- include $(DEPTH)/config/autoconf.mk
-
- PARALLEL_DIRS = \
-- app \
-- setup \
- stub \
-- examples \
- $(NULL)
-
- ifeq ($(OS_ARCH),WINNT)
-diff -up firefox-4.0.1/mozilla-2.0/xulrunner/stub/Makefile.in.stub firefox-4.0.1/mozilla-2.0/xulrunner/stub/Makefile.in
---- firefox-4.0.1/mozilla-2.0/xulrunner/stub/Makefile.in.stub 2011-05-10 11:38:26.000000000 +0200
-+++ firefox-4.0.1/mozilla-2.0/xulrunner/stub/Makefile.in 2011-05-10 11:38:35.054399530 +0200
-@@ -101,7 +101,7 @@ WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStar
- endif
- endif
-
--LIBS += $(JEMALLOC_LIBS)
-+#LIBS += $(JEMALLOC_LIBS)
-
- include $(topsrcdir)/config/rules.mk
-
diff --git a/firefox-version.patch b/firefox-version.patch
index 8e494d8..c44465f 100644
--- a/firefox-version.patch
+++ b/firefox-version.patch
@@ -1,6 +1,5 @@
-diff -up mozilla-central/browser/installer/Makefile.in.version mozilla-central/browser/installer/Makefile.in
---- mozilla-central/browser/installer/Makefile.in.version 2010-08-06 03:08:59.000000000 +0200
-+++ mozilla-central/browser/installer/Makefile.in 2010-08-30 15:27:40.000000000 +0200
+--- mozilla-release/browser/installer/Makefile.in.version 2011-08-11 23:40:51.000000000 +0200
++++ mozilla-release/browser/installer/Makefile.in 2011-08-16 15:29:42.132101348 +0200
@@ -45,6 +45,8 @@ include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
@@ -9,4 +8,4 @@ diff -up mozilla-central/browser/installer/Makefile.in.version mozilla-central/b
+
MOZ_PKG_REMOVALS = $(srcdir)/removed-files.in
- ifdef MOZ_ENABLE_LIBXUL
+ MOZ_PKG_MANIFEST_P = $(srcdir)/package-manifest.in
diff --git a/firefox.spec b/firefox.spec
index e941864..2541818 100644
--- a/firefox.spec
+++ b/firefox.spec
@@ -9,8 +9,8 @@
%define default_bookmarks_file %{_datadir}/bookmarks/default-bookmarks.html
%define firefox_app_id \{ec8030f7-c20a-464f-9b0e-13a3a9e97384\}
-%global firefox_dir_ver 5
-%global gecko_version 5.0
+%global firefox_dir_ver 6
+%global gecko_version 6.0
%global alpha_version 0
%global beta_version 0
%global rc_version 0
@@ -44,14 +44,14 @@
Summary: Mozilla Firefox Web browser
Name: firefox
-Version: 5.0
-Release: 2%{?pre_tag}%{?dist}
+Version: 6.0
+Release: 1%{?pre_tag}%{?dist}
URL: http://www.mozilla.org/projects/firefox/
License: MPLv1.1 or GPLv2+ or LGPLv2+
Group: Applications/Internet
Source0: ftp://ftp.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.bz2
%if %{build_langpacks}
-Source1: firefox-langpacks-%{version}%{?pre_version}-20110621.tar.xz
+Source1: firefox-langpacks-%{version}%{?pre_version}-20110816.tar.xz
%endif
Source10: firefox-mozconfig
Source11: firefox-mozconfig-branded
@@ -63,16 +63,12 @@ Source23: firefox.1
#Build patches
Patch0: firefox-version.patch
-Patch1: firefox-5.0-cache-build.patch
+Patch1: firefox-6.0-cache-build.patch
# Fedora patches
-Patch12: firefox-stub.patch
-Patch13: firefox-5.0-xulstub.patch
Patch14: firefox-5.0-asciidel.patch
# Upstream patches
-Patch30: firefox-4.0-moz-app-launcher.patch
-Patch31: firefox-4.0-gnome3.patch
%if %{official_branding}
# Required by Mozilla Corporation
@@ -97,11 +93,8 @@ Requires: system-bookmarks
Obsoletes: mozilla <= 37:1.7.13
Provides: webclient
-# For GNOME 3 support, we need 2.0-2
-# The specific BR/Require pair can go away when we bump to >= 2.0.1
-# since it will be brought in by the gecko requirements
-BuildRequires: xulrunner-devel >= 2.0-2
-Requires: xulrunner >= 2.0-2
+BuildRequires: xulrunner-devel >= 6.0-1
+Requires: xulrunner >= 6.0-1
%description
Mozilla Firefox is an open-source web browser, designed for standards
@@ -124,13 +117,9 @@ sed -e 's/__RPM_VERSION_INTERNAL__/%{firefox_dir_ver}/' %{P:%%PATCH0} \
# For branding specific patches.
# Fedora patches
-%patch12 -p2 -b .stub
-%patch13 -p1 -R -b .xulstub
%patch14 -p1 -b .asciidel
# Upstream patches
-%patch30 -p1 -b .moz-app-launcher
-%patch31 -p1 -b .gnome3
%if %{official_branding}
# Required by Mozilla Corporation
@@ -237,9 +226,8 @@ XULRUNNER_DIR=`pkg-config --variable=libdir libxul | %{__sed} -e "s,%{_libdir},,
$RPM_BUILD_ROOT%{_bindir}/firefox
%{__chmod} 755 $RPM_BUILD_ROOT%{_bindir}/firefox
-# Remove binary stub from xulrunner
-%{__rm} -rf $RPM_BUILD_ROOT/%{mozappdir}/firefox
-
+# Link with xulrunner
+ln -s `pkg-config --variable=libdir libxul` $RPM_BUILD_ROOT/%{mozappdir}/xulrunner
%{__install} -p -D -m 644 %{SOURCE23} $RPM_BUILD_ROOT%{_mandir}/man1/firefox.1
@@ -247,7 +235,7 @@ XULRUNNER_DIR=`pkg-config --variable=libdir libxul | %{__sed} -e "s,%{_libdir},,
for s in 16 22 24 32 48 256; do
%{__mkdir_p} $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/${s}x${s}/apps
- %{__cp} -p other-licenses/branding/%{name}/default${s}.png \
+ %{__cp} -p browser/branding/official/default${s}.png \
$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/${s}x${s}/apps/firefox.png
done
@@ -289,10 +277,6 @@ done
sed -i -e "s/\[Crash Reporter\]/[Crash Reporter]\nEnabled=1/" $RPM_BUILD_ROOT/%{mozappdir}/application.ini
%endif
-# Install our xulrunner stub
-%{__rm} -f $RPM_BUILD_ROOT/%{mozappdir}/firefox
-%{__cp} xulrunner/stub/xulrunner-stub $RPM_BUILD_ROOT/%{mozappdir}/firefox
-
#---------------------------------------------------------------------
%preun
@@ -334,6 +318,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%dir %{mozappdir}/components
%{mozappdir}/components/*.so
%{mozappdir}/components/binary.manifest
+%{mozappdir}/defaults/preferences/channel-prefs.js
%attr(644, root, root) %{mozappdir}/blocklist.xml
%dir %{mozappdir}/extensions
%{mozappdir}/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}
@@ -352,6 +337,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%{_datadir}/icons/hicolor/256x256/apps/firefox.png
%{_datadir}/icons/hicolor/32x32/apps/firefox.png
%{_datadir}/icons/hicolor/48x48/apps/firefox.png
+%{mozappdir}/xulrunner
%if %{include_debuginfo}
#%{mozappdir}/crashreporter
@@ -363,6 +349,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
#---------------------------------------------------------------------
%changelog
+* Tue Aug 16 2011 Martin Stransky <stransky@redhat.com> - 6.0-1
+- Update to 6.0
+
* Fri Jun 24 2011 Bill Nottingham <notting@redhat.com> - 5.0-2
- Fix an issue with a stray glyph in the window title
diff --git a/sources b/sources
index fce6a2d..2765272 100644
--- a/sources
+++ b/sources
@@ -1,2 +1,2 @@
-9f64a01e86a5d424e12a8e3305c5debe firefox-5.0.source.tar.bz2
-15f3c8273fb50a1f8b150d7bf19726ec firefox-langpacks-5.0-20110621.tar.xz
+1840185865a1a8975df4a3db59080ddc firefox-6.0.source.tar.bz2
+0fc03055b2fcd426b62eed9a8f9c0376 firefox-langpacks-6.0-20110816.tar.xz
bgstack15