From 83af7e5de42b5fca2659b20b1eaa0846c237850e Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Thu, 17 Oct 2013 16:22:41 -0400 Subject: [PATCH] Backed out changeset 62732da6ae3d (bug 926332) for suspicion of causing mochitest-bc timeouts. --- testing/mochitest/chrome-harness.js | 39 +------------ testing/mochitest/chrome/Makefile.in | 2 - testing/mochitest/chrome/test-dir/test-file | 1 - .../chrome/test_chromeGetTestFile.xul | 55 ------------------- testing/mochitest/tests/browser/browser.ini | 7 +-- .../tests/browser/browser_getTestFile.js | 44 --------------- .../tests/browser/test-dir/test-file | 1 - 7 files changed, 2 insertions(+), 147 deletions(-) delete mode 100644 testing/mochitest/chrome/test-dir/test-file delete mode 100644 testing/mochitest/chrome/test_chromeGetTestFile.xul delete mode 100644 testing/mochitest/tests/browser/browser_getTestFile.js delete mode 100644 testing/mochitest/tests/browser/test-dir/test-file diff --git a/testing/mochitest/chrome-harness.js b/testing/mochitest/chrome-harness.js index 7bcc497cec25..d6bbe26456dc 100644 --- a/testing/mochitest/chrome-harness.js +++ b/testing/mochitest/chrome-harness.js @@ -287,9 +287,7 @@ function extractJarToTmp(jar) { var targetDir = buildRelativePath(dirs.getNext(), tmpdir, filepath); // parseInt is used because octal escape sequences cause deprecation warnings // 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 @@ -304,41 +302,6 @@ function extractJarToTmp(jar) { 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 * translate that to a path of a nsILocalFile. diff --git a/testing/mochitest/chrome/Makefile.in b/testing/mochitest/chrome/Makefile.in index 57288a97e4b7..64162c0fdd37 100644 --- a/testing/mochitest/chrome/Makefile.in +++ b/testing/mochitest/chrome/Makefile.in @@ -10,8 +10,6 @@ _STATIC_FILES = test_sample.xul \ test_sanityPluginUtils.html \ test_sanityException.xul \ test_sanityException2.xul \ - test_chromeGetTestFile.xul \ - test-dir/ \ $(NULL) libs:: $(_STATIC_FILES) diff --git a/testing/mochitest/chrome/test-dir/test-file b/testing/mochitest/chrome/test-dir/test-file deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/testing/mochitest/chrome/test-dir/test-file +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/testing/mochitest/chrome/test_chromeGetTestFile.xul b/testing/mochitest/chrome/test_chromeGetTestFile.xul deleted file mode 100644 index 2f4fef7d54c2..000000000000 --- a/testing/mochitest/chrome/test_chromeGetTestFile.xul +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - diff --git a/testing/mochitest/tests/browser/browser.ini b/testing/mochitest/tests/browser/browser.ini index 67b299195877..1e2073331507 100644 --- a/testing/mochitest/tests/browser/browser.ini +++ b/testing/mochitest/tests/browser/browser.ini @@ -1,6 +1,5 @@ [DEFAULT] -support-files = - head.js +support-files = head.js [browser_add_task.js] [browser_async.js] @@ -11,10 +10,6 @@ support-files = [browser_privileges.js] [browser_sanityException.js] [browser_sanityException2.js] -[browser_getTestFile.js] -support-files = - test-dir/* - # Disabled, these are only good for testing the harness' failure reporting # browser_zz_fail_openwindow.js # browser_fail.js diff --git a/testing/mochitest/tests/browser/browser_getTestFile.js b/testing/mochitest/tests/browser/browser_getTestFile.js deleted file mode 100644 index d89b13f28409..000000000000 --- a/testing/mochitest/tests/browser/browser_getTestFile.js +++ /dev/null @@ -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(); - }); -} diff --git a/testing/mochitest/tests/browser/test-dir/test-file b/testing/mochitest/tests/browser/test-dir/test-file deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/testing/mochitest/tests/browser/test-dir/test-file +++ /dev/null @@ -1 +0,0 @@ -foo