anchor.diff:      });
     }
   
  +  Future<bool> deleteIfExists(Iterator<String> paths) {
  +    if (!paths.moveNext()) return new Future.immediate(true);
  +    Directory directory = new Directory(paths.current);
  +    return directory.exists().then((exists) {
  +      if (exists) {
  +        _logEvent("Deleting ${paths.current}");
  +        return directory.delete(recursive: true)
  +	    .then((_) => deleteIfExists(paths))
  +	    .catchError((error) {
  +	      _logEvent("Failure trying to delete ${paths.current}: $error");
  +	      return false;
  +	    });
  +      } else {
  +        _logEvent("${paths.current} is not present");
  +        return deleteIfExists(paths);
  +      }
  +    });
  +  }
  +
     // Clears the cache if the static deleteCache flag is set.
     // Returns false if the command to actually clear the cache did not complete.
     Future<bool> clearCache() {
       if (!deleteCache) return new Future.immediate(true);
       var home = Platform.environment['HOME'];
  -    var cache = "$home/Library/Caches/com.apple.Safari";
  -    _logEvent("Clearing safari cache: $cache}");
  -    return new Directory(cache).delete(recursive: true)
  -        .then((_) => true)
  -	// This normally means that the directory was not there.
  -	.catchError((error) => true);
  +    Iterator iterator = CACHE_DIRECTORIES.map((s) => "$home/$s").iterator;
  +    return deleteIfExists(iterator);
     }
   
     Future<String> getVersion() {
  
positive.code:    */
    const String versionFile = "/Applications/Safari.app/Contents/version.plist";
  
    Future<bool> allowPopUps() {
      var command = "defaults";
      var args = ["write", "com.apple.safari",
  
negative.code:     _logEvent("Starting Safari browser on: $url");
      return allowPopUps().then((success) {
        if (!success) {
          return false;
        }
        return clearCache().then((cleared) {
          if (!cleared) {
            _logEvent("Could not clear cache");
            return false;
          }
          // Get the version and log that.
          return getVersion().then((version) {
            _logEvent("Got version: $version");
  