Backed out changeset 62732da6ae3d (bug 926332) for suspicion of causing mochitest-bc timeouts.

This commit is contained in:
Ryan VanderMeulen 2013-10-17 16:22:41 -04:00
parent 7d5e16f4e3
commit 2616551afa
7 changed files with 2 additions and 147 deletions

View File

@ -287,10 +287,8 @@ function extractJarToTmp(jar) {
var targetDir = buildRelativePath(dirs.getNext(), tmpdir, filepath); var targetDir = buildRelativePath(dirs.getNext(), tmpdir, filepath);
// parseInt is used because octal escape sequences cause deprecation warnings // parseInt is used because octal escape sequences cause deprecation warnings
// in strict mode (which is turned on in debug builds) // in strict mode (which is turned on in debug builds)
if (!targetDir.exists()) {
targetDir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, parseInt("0777", 8)); targetDir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, parseInt("0777", 8));
} }
}
//now do the files //now do the files
var files = zReader.findEntries(filepath + "*"); var files = zReader.findEntries(filepath + "*");
@ -304,41 +302,6 @@ function extractJarToTmp(jar) {
return tmpdir; return tmpdir;
} }
/*
* Take a relative path from the current mochitest file
* and returns the absolute path for the given test data file.
*/
function getTestFilePath(path) {
if (path[0] == "/") {
throw new Error("getTestFilePath only accepts relative path");
}
// Get the chrome/jar uri for the current mochitest file
// gTestPath being defined by the test harness in browser-chrome tests
// or window is being used for mochitest-browser
var baseURI = typeof(gTestPath) == "string" ? gTestPath : window.location.href;
var parentURI = getResolvedURI(getRootDirectory(baseURI));
var file;
if (parentURI.JARFile) {
// If it's a jar/zip, we have to extract it first
file = extractJarToTmp(parentURI);
} else {
// Otherwise, we can directly cast it to a file URI
var fileHandler = Components.classes["@mozilla.org/network/protocol;1?name=file"].
getService(Components.interfaces.nsIFileProtocolHandler);
file = fileHandler.getFileFromURLSpec(parentURI.spec);
}
// Then walk by the given relative path
path.split("/")
.forEach(function (p) {
if (p == "..") {
file = file.parent;
} else if (p != ".") {
file.append(p);
}
});
return file.path;
}
/* /*
* Simple utility function to take the directory structure in jarentryname and * Simple utility function to take the directory structure in jarentryname and
* translate that to a path of a nsILocalFile. * translate that to a path of a nsILocalFile.

View File

@ -10,8 +10,6 @@ _STATIC_FILES = test_sample.xul \
test_sanityPluginUtils.html \ test_sanityPluginUtils.html \
test_sanityException.xul \ test_sanityException.xul \
test_sanityException2.xul \ test_sanityException2.xul \
test_chromeGetTestFile.xul \
test-dir/ \
$(NULL) $(NULL)
libs:: $(_STATIC_FILES) libs:: $(_STATIC_FILES)

View File

@ -1 +0,0 @@
foo

View File

@ -1,55 +0,0 @@
<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<window title="Test chrome harness functions"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript" src="chrome://mochikit/content/chrome-harness.js"></script>
<script type="application/javascript">
<![CDATA[
let {Promise} = Components.utils.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Components.utils.import("resource://gre/modules/osfile.jsm");
let decoder = new TextDecoder();
SimpleTest.waitForExplicitFinish();
SimpleTest.doesThrow(function () {
getTestFilePath("/test_chromeGetTestFile.xul")
}, "getTestFilePath rejects absolute paths");
Promise.all([
OS.File.exists(getTestFilePath("test_chromeGetTestFile.xul"))
.then(function (exists) {
ok(exists, "getTestFilePath consider the path as being relative");
}),
OS.File.exists(getTestFilePath("./test_chromeGetTestFile.xul"))
.then(function (exists) {
ok(exists, "getTestFilePath also accepts explicit relative path");
}),
OS.File.exists(getTestFilePath("./test_chromeGetTestFileTypo.xul"))
.then(function (exists) {
ok(!exists, "getTestFilePath do not throw if the file doesn't exists");
}),
OS.File.read(getTestFilePath("test-dir/test-file"))
.then(function (array) {
is(decoder.decode(array), "foo\n", "getTestFilePath can reach sub-folder files 1/2");
}),
OS.File.read(getTestFilePath("./test-dir/test-file"))
.then(function (array) {
is(decoder.decode(array), "foo\n", "getTestFilePath can reach sub-folder files 2/2");
})
]).then(function () {
SimpleTest.finish();
}, console.error);
]]>
</script>
</window>

View File

@ -1,6 +1,5 @@
[DEFAULT] [DEFAULT]
support-files = support-files = head.js
head.js
[browser_add_task.js] [browser_add_task.js]
[browser_async.js] [browser_async.js]
@ -11,10 +10,6 @@ support-files =
[browser_privileges.js] [browser_privileges.js]
[browser_sanityException.js] [browser_sanityException.js]
[browser_sanityException2.js] [browser_sanityException2.js]
[browser_getTestFile.js]
support-files =
test-dir/*
# Disabled, these are only good for testing the harness' failure reporting # Disabled, these are only good for testing the harness' failure reporting
# browser_zz_fail_openwindow.js # browser_zz_fail_openwindow.js
# browser_fail.js # browser_fail.js

View File

@ -1,44 +0,0 @@
function test() {
let {Promise} = Components.utils.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Components.utils.import("resource://gre/modules/osfile.jsm");
let decoder = new TextDecoder();
waitForExplicitFinish();
SimpleTest.doesThrow(function () {
getTestFilePath("/browser_getTestFile.js")
}, "getTestFilePath rejects absolute paths");
Promise.all([
OS.File.exists(getTestFilePath("browser_getTestFile.js"))
.then(function (exists) {
ok(exists, "getTestFilePath consider the path as being relative");
}),
OS.File.exists(getTestFilePath("./browser_getTestFile.js"))
.then(function (exists) {
ok(exists, "getTestFilePath also accepts explicit relative path");
}),
OS.File.exists(getTestFilePath("./browser_getTestFileTypo.xul"))
.then(function (exists) {
ok(!exists, "getTestFilePath do not throw if the file doesn't exists");
}),
OS.File.read(getTestFilePath("test-dir/test-file"))
.then(function (array) {
is(decoder.decode(array), "foo\n", "getTestFilePath can reach sub-folder files 1/2");
}),
OS.File.read(getTestFilePath("./test-dir/test-file"))
.then(function (array) {
is(decoder.decode(array), "foo\n", "getTestFilePath can reach sub-folder files 2/2");
})
]).then(function () {
finish();
}, function (error) {
ok(false, error);
finish();
});
}