I noticed while implementing download API that looking at the current progress before starting a WebKitDownload crashes WebKit. So I think we should really be unit testing add, to avoid such silly bugs.
Created attachment 28974 [details] Initial download unit test This is only a start but it already catches two bugs: webkit_download_get_progress(download) crashes webkit_download_get_elapsed_time(download) complains about an invalid timer
Comment on attachment 28974 [details] Initial download unit test Thanks.
Created attachment 29163 [details] Fixes for the crash and critical message detected by the unit tests accessor functions are called before the download is started. --- WebKit/gtk/ChangeLog | 15 +++++++++++++++ WebKit/gtk/webkit/webkitdownload.cpp | 6 ++++++ 2 files changed, 21 insertions(+), 0 deletions(-)
Comment on attachment 28974 [details] Initial download unit test Committed in revision 42153.
Comment on attachment 29163 [details] Fixes for the crash and critical message detected by the unit tests > + Extra checks to avoid crashing and a critical message when > + property accessor functions are called before the download is > + started. Tabs instead of spaces here. > + if (!priv->timer) > + return 0.0; I'd just write "return 0". r=me
Landed fix as r42169, with ap's comments addressed.