summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-23 12:39:35 +0100
committerSteve Block <steveblock@google.com>2011-05-24 18:52:47 +0100
commit7a4fb00a8a53cbb836c3b7730ec1836a38f3c9be (patch)
treecc1bb064978ebc11c752757ca3d3ab43e6ea91f7 /Tools
parent10b539940b83c9b7ea6a6ebcf8707d9841b4284f (diff)
downloadexternal_webkit-7a4fb00a8a53cbb836c3b7730ec1836a38f3c9be.zip
external_webkit-7a4fb00a8a53cbb836c3b7730ec1836a38f3c9be.tar.gz
external_webkit-7a4fb00a8a53cbb836c3b7730ec1836a38f3c9be.tar.bz2
In DRT2, correctly handle a non-existent path
Currently, if the path is not found, the script proceeds as if the root had been specified. Bug: 3291382 Change-Id: I1aea78eb66392c2f883148a895ec5ecca20d3ad9
Diffstat (limited to 'Tools')
-rw-r--r--Tools/DumpRenderTree/android/get_layout_tests_dir_contents.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/Tools/DumpRenderTree/android/get_layout_tests_dir_contents.php b/Tools/DumpRenderTree/android/get_layout_tests_dir_contents.php
index 28a1a8a..87e3e84 100644
--- a/Tools/DumpRenderTree/android/get_layout_tests_dir_contents.php
+++ b/Tools/DumpRenderTree/android/get_layout_tests_dir_contents.php
@@ -74,8 +74,6 @@
function main() {
global $rootDir;
- $path = getAbsolutePath($_GET['path']);
-
if (!isset($_GET['separator'])) {
$separator = "\n";
} else {
@@ -91,14 +89,18 @@
}
# Very primitive check if path tries to go above DOCUMENT_ROOT or is absolute
- if (strpos($_GET['path'], "..") !== False ||
- substr($_GET['path'], 0, 1) == DIRECTORY_SEPARATOR) {
+ $path = $_GET['path'];
+ if (strpos($path, "..") !== False ||
+ substr($path, 0, 1) == DIRECTORY_SEPARATOR) {
return;
}
# If we don't want realpath to append any prefixes we need to pass it an absolute path
- $path = realpath(getAbsolutePath($_GET['path']));
- $relPath = substr($path, strlen($rootDir) + 1);
+ $relPath = substr(realpath(getAbsolutePath($path)), strlen($rootDir) + 1);
+
+ # If the path is not found, return nothing.
+ if ($path !== "" && $relPath == "")
+ return;
# If there is an error of some sort it will be output as a part of the answer!
foreach (getAllFilesUnderAsArray($relPath, $recurse, $mode) as $i => $value) {