User:Torisugari

From MozillaWiki
Revision as of 11:18, 23 March 2007 by Torisugari (talk | contribs)
Jump to navigation Jump to search

Application Name Paranoia

Situation

Mozilla builds have 2 values to set application name, MOZ_APP_NAME and MOZ_APP_DISPLAYNAME.

  • MOZ_APP_NAME is a internal name. typically lower-cased string e.g. "firefox".
  • MOZ_APP_DISPLAYNAME is a user-visible name. tipically title-cased string e.g. "Firefox".
Use Cases
Firefox 2.0 Firefox 3.0 Nightly (1.9) Debian Iceweasel 2.0
MOZ_APP_NAME firefox firefox firefox firefox
MOZ_APP_DISPLAYNAME Firefox Firefox Minefield Iceweasel
-
nsXREAppData::name Firefox (hardcoded) Firefox (hardcoded) Firefox (hardcoded) Firefox (hardcoded)
nsXREAppData::vendor Mozilla (hardcoded) Mozilla (hardcoded) Mozilla (hardcoded) Mozilla (hardcoded)
Executable Name (unix) firefox-bin (hardcoded) firefox-bin (MOZ_APP_NAME) firefox-bin (MOZ_APP_NAME) firefox-bin (hardcoded)
UA String MOZ_APP_DISPLAYNAME MOZ_APP_DISPLAYNAME MOZ_APP_DISPLAYNAME MOZ_APP_DISPLAYNAME
Archive Package Name MOZ_APP_NAME MOZ_APP_NAME MOZ_APP_NAME iceweasel (hardcoded)
Installer Package Name MOZ_APP_NAME MOZ_APP_NAME MOZ_APP_NAME (iceweasel (hardcoded))
MacOSX (.app) Name MOZ_APP_DISPLAYNAME MOZ_APP_DISPLAYNAME MOZ_APP_DISPLAYNAME (MOZ_APP_DISPLAYNAME)
Windows DDE (installer) Firefox (hardcoded) Firefox (hardcoded) Firefox (hardcoded) (Firefox (hardcoded))
XRemote (-a APPNAME) firefox (nsXREAppData::name + ToLowerCases) firefox (nsXREAppData::name + ToLowerCases) firefox (nsXREAppData::name + ToLowerCases) firefox (nsXREAppData::name + ToLowerCases)
-
Default Profile (script) ~/.mozilla/firefox (hardcoded) ~/.mozilla/firefox (hardcoded) ~/.mozilla/firefox (hardcoded) ~/.mozilla/firefox (hardcoded)
Default Profile (Directory Service) ~/.mozilla/firefox (nsXREAppData::vender, nsXREAppData::name) ~/.mozilla/firefox (nsXREAppData::vender, nsXREAppData::name) ~/.mozilla/firefox (nsXREAppData::vender, nsXREAppData::name) ~/.mozilla/firefox (nsXREAppData::vender, nsXREAppData::name)

Proposal

Actually, the browser needs 3 names, that is, "firefox", "Minefield" and "Firefox" (See "Nightly" in the above table), respecitively MOZ_APP_NAME, MOZ_APP_DISPLAYNAME and nsXREAppData::name.

MOZ_APP_BRANDNAME

So I'd like to suggest to add a new flag MOZ_APP_BRANDNAME as below.

Proposed Build Configs (Pink is what's new)
Nightly (proposal)
MOZ_APP_NAME firefox
MOZ_APP_DISPLAYNAME Firefox
MOZ_APP_BRANDNAME Minefield
-
nsXREAppData::name MOZ_APP_DISPLAYNAME
Executable Name MOZ_APP_NAME
UA String MOZ_APP_BRANDNAME
Archive Package Name MOZ_APP_NAME
Installer Package Name MOZ_APP_NAME
MacOSX (.app) Name MOZ_APP_DISPLAYNAME (Minefield -> Firefox)
Windows DDE (installer) MOZ_APP_DISPLAYNAME
XRemote (-a APPNAME) nsXREAppData::name + ToLowerCases
More Backwards Compatible

Or, MOZ_APP_TITLENAME, to minimize the changes.

Proposal2, more backwards compatible (Pink is what's new)
Nightly (proposal2)
MOZ_APP_NAME firefox
MOZ_APP_DISPLAYNAME Minefield
MOZ_APP_TITLENAME Firefox
-
nsXREAppData::name MOZ_APP_TITLENAME
Executable Name MOZ_APP_NAME
UA String MOZ_APP_DISPLAYNAME
Archive Package Name MOZ_APP_NAME
Installer Package Name MOZ_APP_NAME
MacOSX (.app) Name MOZ_APP_TITLENAME (Minefield -> Firefox)
Windows DDE (installer) MOZ_APP_TITLENAME
XRemote (-a APPNAME) nsXREAppData::name + ToLowerCases
ToLowerCases Everywhere

Anyway, we need "Firefox" rather than "firefox", because it's easy to create "firefox" from "Firefox", on the other hand, it's difficult to create "Firefox" from "firefox".

Proposal3, ToLowerCases Everywhere (Pink is what's new)
Nightly (proposal3)
MOZ_APP_NAME Firefox
MOZ_APP_DISPLAYNAME Minefield
-
nsXREAppData::name MOZ_APP_NAME
Executable Name MOZ_APP_NAME + ToLowerCases
UA String MOZ_APP_DISPLAYNAME
Archive Package Name MOZ_APP_NAME + ToLowerCases
Installer Package Name MOZ_APP_NAME + ToLowerCases
MacOSX (.app) Name MOZ_APP_NAME (Minefield -> Firefox)
Windows DDE (installer) MOZ_APP_NAME
XRemote (-a APPNAME) nsXREAppData::name + ToLowerCases

readonly (or readOnly) property for <xul:browser/> element

The basic idea is replacing the content area with <html:canvas>, to prevent from users clicking links etc.

Misc Code Fragments

Get system locale for bug 265400[1]

nsCOMPtr<nsILocaleService>
  localeService(do_GetService(NS_LOCALESERVICE_CONTRACTID, &rv));

nsCOMPtr<nsILocale> locale;
 rv = localeService->GetSystemLocale(getter_AddRefs(locale));
NS_ENSURE_SUCCESS(rv, rv);

nsAutoString localeName;
rv = locale->GetCategory(NS_LITERAL_STRING(NSILOCALE_MESSAGE),
                         localeName);
NS_ENSURE_SUCCESS(rv, rv);

printf("System Language is %s\n",
       NS_ConvertUTF16toUTF8(localeName).get());


var localeService =
  Components.classes["@mozilla.org/intl/nslocaleservice;1"]
            .getService(Components.interfaces.nsILocaleService);
var locale = localeService.getSystemLocale();

var localeName = locale.getCategory("NSILOCALE_MESSAGES");
Components.utils.reportError(localeName);