appium/appium — pull request #3346 by 0x1mason (2014-08-08 20:20:57+00:00)
Title: Fixed issue #1708: delete cookie inconsitency in Safari

Fixed the issue preventing Appium from deleting some cookies on Safari. The problem was that Appium was not setting the "Path" field which caused Safari to act as though it could not locate cookies created in previous sessions. Changes include:

*) Updated ios-controller::setCookie to preserve the invoker's expiry value even when cookie.value is empty. I made this change because backdating the expiry field is the correct way to delete a cookie. We shouldn't force invocations with empty values to delete cookies if the invoker has specified an expiry date. This change shouldn't affect any existing code.
*) ios-controller::setCookie now allows invokers to set the path field and defaults the field to "/" if path is undefined.
*) replaced deprecated toGMTString calls with toUTCString in ios-controller::setCookie. Afaik, the output strings are the same.
*) Refactored ios-controller::deleteCookies. Replaced the recursive logic and nested conditions with a simple for loop. This makes it much easier to understand, debug, and maintain. It also makes it more performant. I made the change because it was difficult for me to debug.
*) The "deleteAllCookies" test in cookies-base.js will now fail if all cookies are not deleted.