| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 Vector<String> canonicalized; | 84 Vector<String> canonicalized; |
| 85 path.split(DOMFilePath::separator, components); | 85 path.split(DOMFilePath::separator, components); |
| 86 for (size_t i = 0; i < components.size(); ++i) { | 86 for (size_t i = 0; i < components.size(); ++i) { |
| 87 if (components[i] == ".") | 87 if (components[i] == ".") |
| 88 continue; | 88 continue; |
| 89 if (components[i] == "..") { | 89 if (components[i] == "..") { |
| 90 if (canonicalized.size() > 0) | 90 if (canonicalized.size() > 0) |
| 91 canonicalized.pop_back(); | 91 canonicalized.pop_back(); |
| 92 continue; | 92 continue; |
| 93 } | 93 } |
| 94 canonicalized.append(components[i]); | 94 canonicalized.push_back(components[i]); |
| 95 } | 95 } |
| 96 if (canonicalized.isEmpty()) | 96 if (canonicalized.isEmpty()) |
| 97 return DOMFilePath::root; | 97 return DOMFilePath::root; |
| 98 StringBuilder result; | 98 StringBuilder result; |
| 99 for (size_t i = 0; i < canonicalized.size(); ++i) { | 99 for (size_t i = 0; i < canonicalized.size(); ++i) { |
| 100 result.append(DOMFilePath::separator); | 100 result.append(DOMFilePath::separator); |
| 101 result.append(canonicalized[i]); | 101 result.append(canonicalized[i]); |
| 102 } | 102 } |
| 103 return result.toString(); | 103 return result.toString(); |
| 104 } | 104 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 132 bool DOMFilePath::isValidName(const String& name) { | 132 bool DOMFilePath::isValidName(const String& name) { |
| 133 if (name.isEmpty()) | 133 if (name.isEmpty()) |
| 134 return true; | 134 return true; |
| 135 // '/' is not allowed in name. | 135 // '/' is not allowed in name. |
| 136 if (name.contains('/')) | 136 if (name.contains('/')) |
| 137 return false; | 137 return false; |
| 138 return isValidPath(name); | 138 return isValidPath(name); |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace blink | 141 } // namespace blink |
| OLD | NEW |