Bug 556644 - 4. Fix tests, r=bsmedberg a=blocking2.0
--- a/caps/tests/mochitest/Makefile.in
+++ b/caps/tests/mochitest/Makefile.in
@@ -46,10 +46,14 @@ include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TEST_FILES = test_bug423375.html \
test_bug246699.html \
test_bug292789.html \
test_bug470804.html \
$(NULL)
+test_bug292789.html : % : %.in
+ $(PYTHON) $(topsrcdir)/config/Preprocessor.py \
+ $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $< > $@
+
libs:: $(_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
rename from caps/tests/mochitest/test_bug292789.html
rename to caps/tests/mochitest/test_bug292789.html.in
--- a/caps/tests/mochitest/test_bug292789.html
+++ b/caps/tests/mochitest/test_bug292789.html.in
@@ -33,34 +33,42 @@ function testScriptSrc(aCallback) {
"content can still load <script> from chrome://global");
is(typeof XPInstallConfirm, "undefined",
"content should not be able to load <script> from chrome://mozapps");
/** make sure the last one didn't pass because someone
** moved the resource
**/
var resjs = document.createElement("script");
+#ifdef MOZ_CHROME_FILE_FORMAT_JAR
resjs.src = "jar:resource://gre/chrome/toolkit.jar!/content/mozapps/xpinstall/xpinstallConfirm.js";
+#else
+ resjs.src = "resource://gre/chrome/toolkit/content/mozapps/xpinstall/xpinstallConfirm.js";
+#endif
resjs.onload = scriptOnload;
document.getElementById("content").appendChild(resjs);
function scriptOnload() {
is(typeof XPInstallConfirm, "object",
"xpinstallConfirm.js has not moved unexpectedly");
// trigger the callback
if (aCallback)
aCallback();
}
}
/** <img src=""> tests **/
var img_global = "chrome://global/skin/icons/Error.png";
var img_mozapps = "chrome://mozapps/skin/passwordmgr/key.png";
+#ifdef MOZ_CHROME_FILE_FORMAT_JAR
var res_mozapps = "jar:resource://gre/chrome/toolkit.jar!/skin/classic/mozapps/passwordmgr/key.png";
+#else
+var res_mozapps = "resource://gre/chrome/toolkit/skin/classic/mozapps/passwordmgr/key.png";
+#endif
var imgTests = [[img_global, "success"],
[img_mozapps, "fail"],
[res_mozapps, "success"]];
var curImgTest = 0;
function runImgTest() {
--- a/js/src/xpconnect/tests/unit/test_import.js
+++ b/js/src/xpconnect/tests/unit/test_import.js
@@ -62,23 +62,22 @@ function run_test() {
// try on a new object
var scope2 = {};
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm", scope2);
do_check_eq(typeof(scope2.XPCOMUtils), "object");
do_check_eq(typeof(scope2.XPCOMUtils.generateNSGetFactory), "function");
do_check_true(scope2.XPCOMUtils == scope.XPCOMUtils);
- // try on a new object using a file URL
+ // try on a new object using the resolved URL
var res = Components.classes["@mozilla.org/network/protocol;1?name=resource"]
.getService(Components.interfaces.nsIResProtocolHandler);
var resURI = res.newURI("resource://gre/modules/XPCOMUtils.jsm", null, null);
dump("resURI: " + resURI + "\n");
var filePath = res.resolveURI(resURI);
- do_check_eq(filePath.indexOf("file://"), 0);
var scope3 = {};
Components.utils.import(filePath, scope3);
do_check_eq(typeof(scope3.XPCOMUtils), "object");
do_check_eq(typeof(scope3.XPCOMUtils.generateNSGetFactory), "function");
do_check_true(scope3.XPCOMUtils == scope.XPCOMUtils);
// make sure we throw when the second arg is bogus
--- a/xpcom/components/nsComponentManager.cpp
+++ b/xpcom/components/nsComponentManager.cpp
@@ -521,16 +521,19 @@ GetExtension(nsILocalFile* file)
CutExtension(extension);
return extension;
}
#ifdef MOZ_OMNIJAR
void
nsComponentManagerImpl::RegisterOmnijar(const char* aPath, bool aChromeOnly)
{
+ if (!mozilla::OmnijarPath())
+ return;
+
nsCOMPtr<nsIInputStream> is = mManifestLoader->LoadEntry(aPath);
PRUint32 flen;
is->Available(&flen);
nsAutoArrayPtr<char> whole(new char[flen + 1]);
if (!whole)
return;