diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c
index 5804615e1e8..22043ed03cb 100644
--- a/dlls/mshtml/htmlevent.c
+++ b/dlls/mshtml/htmlevent.c
@@ -42,6 +42,9 @@ struct event_target_t {
handler_vector_t *event_table[EVENTID_LAST];
};
+static const WCHAR beforeunloadW[] = {'b','e','f','o','r','e','u','n','l','o','a','d',0};
+static const WCHAR onbeforeunloadW[] = {'o','n','b','e','f','o','r','e','u','n','l','o','a','d',0};
+
static const WCHAR blurW[] = {'b','l','u','r',0};
static const WCHAR onblurW[] = {'o','n','b','l','u','r',0};
@@ -97,6 +100,7 @@ typedef struct {
#define EVENT_BUBBLE 0x0002
static const event_info_t event_info[] = {
+ {beforeunloadW, onbeforeunloadW, EVENT_DEFAULTLISTENER},
{blurW, onblurW, EVENT_DEFAULTLISTENER},
{changeW, onchangeW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
{clickW, onclickW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
diff --git a/dlls/mshtml/htmlevent.h b/dlls/mshtml/htmlevent.h
index f1d208ca7f6..89d9526f5e1 100644
--- a/dlls/mshtml/htmlevent.h
+++ b/dlls/mshtml/htmlevent.h
@@ -17,6 +17,7 @@
*/
typedef enum {
+ EVENTID_BEFOREUNLOAD,
EVENTID_BLUR,
EVENTID_CHANGE,
EVENTID_CLICK,
@@ -67,3 +68,13 @@ static inline HRESULT get_doc_event(HTMLDocument *doc, eventid_t eid, VARIANT *v
{
return get_event_handler(&doc->event_target, eid, var);
}
+
+static inline HRESULT set_window_event(HTMLWindow *window, eventid_t eid, VARIANT *var)
+{
+ return set_event_handler(&window->event_target, window->doc, eid, var);
+}
+
+static inline HRESULT get_window_event(HTMLWindow *window, eventid_t eid, VARIANT *var)
+{
+ return get_event_handler(&window->event_target, eid, var);
+}
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index 3a52db6607f..7827d51ccbd 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -512,15 +512,19 @@ static HRESULT WINAPI HTMLWindow2_get_onload(IHTMLWindow2 *iface, VARIANT *p)
static HRESULT WINAPI HTMLWindow2_put_onbeforeunload(IHTMLWindow2 *iface, VARIANT v)
{
HTMLWindow *This = HTMLWINDOW2_THIS(iface);
- FIXME("(%p)->(v(%d))\n", This, V_VT(&v));
- return E_NOTIMPL;
+
+ TRACE("(%p)->(v(%d))\n", This, V_VT(&v));
+
+ return set_window_event(This, EVENTID_BEFOREUNLOAD, &v);
}
static HRESULT WINAPI HTMLWindow2_get_onbeforeunload(IHTMLWindow2 *iface, VARIANT *p)
{
HTMLWindow *This = HTMLWINDOW2_THIS(iface);
- FIXME("(%p)->(%p)\n", This, p);
- return E_NOTIMPL;
+
+ TRACE("(%p)->(%p)\n", This, p);
+
+ return get_window_event(This, EVENTID_BEFOREUNLOAD, p);
}
static HRESULT WINAPI HTMLWindow2_put_onunload(IHTMLWindow2 *iface, VARIANT v)