Fix oncancel not being called if the user closes the dialog

fixes #3701
Add an oncancel Selenium test
Merge pull request #3702 from mozilla/issue_3701-no_oncancel

Issue 3701 no oncancel