WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
Bug 20135
onbeforeunload doesn't work when set with addEventListener
https://bugs.webkit.org/show_bug.cgi?id=20135
Summary
onbeforeunload doesn't work when set with addEventListener
Ojan Vafai
Reported
2008-07-22 14:33:21 PDT
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.
Attachments
testcase that works in IE/FF but fails in WebKit
(439 bytes, text/html)
2008-07-22 14:34 PDT
,
Ojan Vafai
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Ojan Vafai
Comment 1
2008-07-22 14:34:40 PDT
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.
Alexey Proskuryakov
Comment 2
2008-11-10 22:56:27 PST
Confirmed with
r38249
on Mac OS X.
Dmitry Titov
Comment 3
2009-11-10 15:51:57 PST
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.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug