window.addEventListener('beforeunload', function(e) { (e || window.event).returnValue = "wot?"; return "wot?"; }, true); This should popup a dialog asking if I want to leave the page when I try to navigate away. In WebKit, it only seems to do so if I set the handler using window.onbeforeunload.
Created attachment 22434 [details] testcase that works in IE/FF but fails in WebKit You should see an onbeforeunload dialog, followed by an alert in the onunload handler. In WebKit, you only see the alert from the onunload handler.
Confirmed with r38249 on Mac OS X.
This is fixed by the recent changes to EventTarget that unified addEventListeners and event attributes. Works with r 50777 on Mac OS X. It'd be good to have a test though.