~abreu-alexandre/oxide/add-ua-to-downloadrequested

Viewing all changes in revision 707.

  • Committer: Chris Coulson
  • Date: 2014-09-01 22:28:32 UTC
  • Revision ID: chris.coulson@canonical.com-20140901222832-7en92vage1bizmfs
Fix various issues with the CookieManager code:
- getNextRequestId() always returns zero
- getNextRequestId() depends on undefined beahviour (signed integer overflow)
- CookieMonster calls the callbacks synchronously if nothing needs to be loaded from permanent storage. This means that the behaviour of setting one cookie and waiting for the callback to run before setting the next causes the stack to grow depending on the amount of cookies being set (and also means lots of reentry). Rework it to prevent this behaviour.
- Ensure that the responses at the API level always do happen asynchronously.
- Setting a session cookie always fails because the undefined expiry date gets interpreted as a date far in the past, so Chromium considers the cookie expired.
- Ensure that session cookies returned from the API don't have an expiry date way in the past.

There are a few minor changes to the API too:
- CookieManager.gotCookies does not return a status code now. The only possible errors when reading cookies occur synchronously (ie, the CookieStore is unavailable), so the API just returns an invalid request ID now.
- The addition of CookieManager.getCookies(), which allows you to retrieve all cookies for a URL.
- The expirationdate attribute now works with the built-in Date type rather than having to give it the expiry in milliseconds since the epoch.

The tests have been improved as well to actually test the various cases rather than just calling in to the API and making sure we get a response back

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: