Bug 508421 - move res/ stuff into toolkit.jar (r=bsmedberg)

* * *
* * *
This commit is contained in:
tglek@mozilla.com 2009-08-27 08:35:48 -07:00
parent 1b47014fb1
commit a0ee6410f1
9 changed files with 64 additions and 19 deletions

View File

@ -325,8 +325,6 @@ bin/res/fonts/*
bin/res/dtd/*
bin/res/html/*
bin/res/unixcharset.properties
bin/res/charsetalias.properties
bin/res/charsetData.properties
bin/res/langGroups.properties
bin/res/language.properties
bin/res/entityTables/*

View File

@ -331,8 +331,6 @@ bin\res\fonts\*
bin\res\dtd\*
bin\res\html\*
bin\res\wincharset.properties
bin\res\charsetalias.properties
bin\res\charsetData.properties
bin\res\langGroups.properties
bin\res\language.properties
bin\res\entityTables\*

View File

@ -7037,6 +7037,9 @@ if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
fi
if test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
fi
dnl ========================================================
dnl = Define default location for MOZILLA_FIVE_HOME
dnl ========================================================

View File

@ -83,11 +83,6 @@ CPPSRCS += \
endif
EXPORT_RESOURCE = \
charsetalias.properties \
charsetData.properties \
$(NULL)
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
CPPSRCS += nsOS2Charset.cpp
EXPORT_RESOURCE += os2charset.properties

3
intl/uconv/src/jar.mn Normal file
View File

@ -0,0 +1,3 @@
toolkit.jar:
res/charsetalias.properties (charsetalias.properties)
res/charsetData.properties (charsetData.properties)

View File

@ -104,7 +104,7 @@ nsresult nsCharsetConverterManager::RegisterConverterManagerData()
RegisterConverterCategory(catman, NS_TITLE_BUNDLE_CATEGORY,
"chrome://global/locale/charsetTitles.properties");
RegisterConverterCategory(catman, NS_DATA_BUNDLE_CATEGORY,
"resource://gre/res/charsetData.properties");
"resource://gre-resources/charsetData.properties");
return NS_OK;
}

View File

@ -43,19 +43,25 @@
nsGREResProperties::nsGREResProperties(const nsACString& aFile)
{
nsCOMPtr<nsIFile> file;
nsresult rv = NS_GetSpecialDirectory(NS_GRE_DIR, getter_AddRefs(file));
nsresult rv;
nsCOMPtr<nsIIOService> ioservice(do_GetIOService(&rv));
nsCOMPtr<nsIInputStream> inStr;
nsCOMPtr<nsIURI> uri;
nsCOMPtr<nsIChannel> channel;
printf("nsGREResProperties %s\n", aFile.BeginReading());
if (NS_FAILED(rv))
return;
file->AppendNative(NS_LITERAL_CSTRING("res"));
file->AppendNative(aFile);
rv = ioservice->NewURI(NS_LITERAL_CSTRING("resource://gre-resources/") + aFile,
nsnull, nsnull, getter_AddRefs(uri));
if (NS_FAILED(rv))
return;
nsCOMPtr<nsILocalFile> lf(do_QueryInterface(file));
NS_ENSURE_TRUE(lf, /**/);
rv = NS_NewChannel(getter_AddRefs(channel), uri, ioservice);
if (NS_FAILED(rv))
return;
nsCOMPtr<nsIInputStream> inStr;
rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), lf);
rv = channel->Open(getter_AddRefs(inStr));
if (NS_FAILED(rv))
return;

View File

@ -171,9 +171,22 @@ nsResProtocolHandler::Init()
//
// make resource://gre/ point to the GRE directory
//
rv = AddSpecialDir(NS_GRE_DIR, NS_LITERAL_CSTRING("gre"));
NS_NAMED_LITERAL_CSTRING(strGRE_DIR, "gre");
rv = AddSpecialDir(NS_GRE_DIR, strGRE_DIR);
NS_ENSURE_SUCCESS(rv, rv);
// make resource://gre-resources/ point to gre toolkit[.jar]/res
nsCOMPtr<nsIURI> greURI;
nsCOMPtr<nsIURI> greResURI;
GetSubstitution(strGRE_DIR, getter_AddRefs(greURI));
#ifdef MOZ_CHROME_FILE_FORMAT_JAR
NS_NAMED_LITERAL_CSTRING(strGRE_RES_URL, "jar:chrome/toolkit.jar!/res/");
#else
NS_NAMED_LITERAL_CSTRING(strGRE_RES_URL, "chrome/toolkit/res/");
#endif
rv = mIOService->NewURI(strGRE_RES_URL, nsnull, greURI,
getter_AddRefs(greResURI));
SetSubstitution(NS_LITERAL_CSTRING("gre-resources"), greResURI);
//XXXbsmedberg Neil wants a resource://pchrome/ for the profile chrome dir...
// but once I finish multiple chrome registration I'm not sure that it is needed

View File

@ -0,0 +1,29 @@
// test that things that are expected to be in gre-resources are still there
const Cc = Components.classes;
const Ci = Components.interfaces;
var ios = Cc["@mozilla.org/network/io-service;1"]. getService(Ci.nsIIOService);
function wrapInputStream(input)
{
var nsIScriptableInputStream = Components.interfaces.nsIScriptableInputStream;
var factory = Components.classes["@mozilla.org/scriptableinputstream;1"];
var wrapper = factory.createInstance(nsIScriptableInputStream);
wrapper.init(input);
return wrapper;
}
function check_file(file) {
var channel = ios.newChannel("resource://gre-resources/"+file, null, null);
try {
let instr = wrapInputStream(channel.open());
do_check_true(instr.read(1024).length > 0)
} catch (e) {
do_throw("Failed to read " + file + " from gre-resources:"+e)
}
}
function run_test() {
for each(let file in ["charsetalias.properties", "charsetData.properties"])
check_file(file)
}