Commit f60127f0 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Implement url prop for StorageEvent.

parent 79703048
...@@ -2616,6 +2616,7 @@ typedef struct { ...@@ -2616,6 +2616,7 @@ typedef struct {
BSTR key; BSTR key;
BSTR old_value; BSTR old_value;
BSTR new_value; BSTR new_value;
BSTR url;
} DOMStorageEvent; } DOMStorageEvent;
static inline DOMStorageEvent *impl_from_IDOMStorageEvent(IDOMStorageEvent *iface) static inline DOMStorageEvent *impl_from_IDOMStorageEvent(IDOMStorageEvent *iface)
...@@ -2710,8 +2711,13 @@ static HRESULT WINAPI DOMStorageEvent_get_newValue(IDOMStorageEvent *iface, BSTR ...@@ -2710,8 +2711,13 @@ static HRESULT WINAPI DOMStorageEvent_get_newValue(IDOMStorageEvent *iface, BSTR
static HRESULT WINAPI DOMStorageEvent_get_url(IDOMStorageEvent *iface, BSTR *p) static HRESULT WINAPI DOMStorageEvent_get_url(IDOMStorageEvent *iface, BSTR *p)
{ {
DOMStorageEvent *This = impl_from_IDOMStorageEvent(iface); DOMStorageEvent *This = impl_from_IDOMStorageEvent(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL; TRACE("(%p)->(%p)\n", This, p);
if(This->url)
return (*p = SysAllocStringLen(This->url, SysStringLen(This->url))) ? S_OK : E_OUTOFMEMORY;
*p = NULL;
return S_OK;
} }
static HRESULT WINAPI DOMStorageEvent_get_storageArea(IDOMStorageEvent *iface, IHTMLStorage **p) static HRESULT WINAPI DOMStorageEvent_get_storageArea(IDOMStorageEvent *iface, IHTMLStorage **p)
...@@ -2766,6 +2772,7 @@ static void DOMStorageEvent_destroy(DOMEvent *event) ...@@ -2766,6 +2772,7 @@ static void DOMStorageEvent_destroy(DOMEvent *event)
SysFreeString(storage_event->key); SysFreeString(storage_event->key);
SysFreeString(storage_event->old_value); SysFreeString(storage_event->old_value);
SysFreeString(storage_event->new_value); SysFreeString(storage_event->new_value);
SysFreeString(storage_event->url);
} }
static const tid_t DOMEvent_iface_tids[] = { static const tid_t DOMEvent_iface_tids[] = {
...@@ -3120,7 +3127,7 @@ HRESULT create_message_event(HTMLDocumentNode *doc, VARIANT *data, DOMEvent **re ...@@ -3120,7 +3127,7 @@ HRESULT create_message_event(HTMLDocumentNode *doc, VARIANT *data, DOMEvent **re
} }
HRESULT create_storage_event(HTMLDocumentNode *doc, BSTR key, BSTR old_value, BSTR new_value, HRESULT create_storage_event(HTMLDocumentNode *doc, BSTR key, BSTR old_value, BSTR new_value,
BOOL commit, DOMEvent **ret) const WCHAR *url, BOOL commit, DOMEvent **ret)
{ {
DOMStorageEvent *storage_event; DOMStorageEvent *storage_event;
DOMEvent *event; DOMEvent *event;
...@@ -3140,6 +3147,11 @@ HRESULT create_storage_event(HTMLDocumentNode *doc, BSTR key, BSTR old_value, BS ...@@ -3140,6 +3147,11 @@ HRESULT create_storage_event(HTMLDocumentNode *doc, BSTR key, BSTR old_value, BS
} }
} }
if(url && !(storage_event->url = SysAllocString(url))) {
IDOMEvent_Release(&event->IDOMEvent_iface);
return E_OUTOFMEMORY;
}
*ret = event; *ret = event;
return S_OK; return S_OK;
} }
......
...@@ -114,7 +114,7 @@ HRESULT create_document_event(HTMLDocumentNode*,eventid_t,DOMEvent**) DECLSPEC_H ...@@ -114,7 +114,7 @@ HRESULT create_document_event(HTMLDocumentNode*,eventid_t,DOMEvent**) DECLSPEC_H
HRESULT create_document_event_str(HTMLDocumentNode*,const WCHAR*,IDOMEvent**) DECLSPEC_HIDDEN; HRESULT create_document_event_str(HTMLDocumentNode*,const WCHAR*,IDOMEvent**) DECLSPEC_HIDDEN;
HRESULT create_event_from_nsevent(nsIDOMEvent*,compat_mode_t,DOMEvent**) DECLSPEC_HIDDEN; HRESULT create_event_from_nsevent(nsIDOMEvent*,compat_mode_t,DOMEvent**) DECLSPEC_HIDDEN;
HRESULT create_message_event(HTMLDocumentNode*,VARIANT*,DOMEvent**) DECLSPEC_HIDDEN; HRESULT create_message_event(HTMLDocumentNode*,VARIANT*,DOMEvent**) DECLSPEC_HIDDEN;
HRESULT create_storage_event(HTMLDocumentNode*,BSTR,BSTR,BSTR,BOOL,DOMEvent**) DECLSPEC_HIDDEN; HRESULT create_storage_event(HTMLDocumentNode*,BSTR,BSTR,BSTR,const WCHAR*,BOOL,DOMEvent**) DECLSPEC_HIDDEN;
void init_nsevents(HTMLDocumentNode*) DECLSPEC_HIDDEN; void init_nsevents(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void release_nsevents(HTMLDocumentNode*) DECLSPEC_HIDDEN; void release_nsevents(HTMLDocumentNode*) DECLSPEC_HIDDEN;
......
...@@ -235,6 +235,7 @@ struct send_storage_event_ctx { ...@@ -235,6 +235,7 @@ struct send_storage_event_ctx {
BSTR key; BSTR key;
BSTR old_value; BSTR old_value;
BSTR new_value; BSTR new_value;
const WCHAR *url;
}; };
static HRESULT push_storage_event_task(struct send_storage_event_ctx *ctx, HTMLInnerWindow *window, BOOL commit) static HRESULT push_storage_event_task(struct send_storage_event_ctx *ctx, HTMLInnerWindow *window, BOOL commit)
...@@ -243,7 +244,7 @@ static HRESULT push_storage_event_task(struct send_storage_event_ctx *ctx, HTMLI ...@@ -243,7 +244,7 @@ static HRESULT push_storage_event_task(struct send_storage_event_ctx *ctx, HTMLI
DOMEvent *event; DOMEvent *event;
HRESULT hres; HRESULT hres;
hres = create_storage_event(window->doc, ctx->key, ctx->old_value, ctx->new_value, commit, &event); hres = create_storage_event(window->doc, ctx->key, ctx->old_value, ctx->new_value, ctx->url, commit, &event);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -327,6 +328,7 @@ static HRESULT send_storage_event(HTMLStorage *storage, BSTR key, BSTR old_value ...@@ -327,6 +328,7 @@ static HRESULT send_storage_event(HTMLStorage *storage, BSTR key, BSTR old_value
goto done; goto done;
get_top_window(window->base.outer_window, &top_window); get_top_window(window->base.outer_window, &top_window);
ctx.url = window->base.outer_window->url;
ctx.key = key; ctx.key = key;
ctx.old_value = old_value; ctx.old_value = old_value;
ctx.new_value = new_value; ctx.new_value = new_value;
......
...@@ -1322,7 +1322,7 @@ async_test("storage events", function() { ...@@ -1322,7 +1322,7 @@ async_test("storage events", function() {
} }
} }
function test_event(e, key, oldValue, newValue) { function test_event(e, idx, key, oldValue, newValue) {
if(v < 9) { if(v < 9) {
ok(e === undefined, "event not undefined in legacy mode: " + e); ok(e === undefined, "event not undefined in legacy mode: " + e);
return; return;
...@@ -1333,6 +1333,8 @@ async_test("storage events", function() { ...@@ -1333,6 +1333,8 @@ async_test("storage events", function() {
ok(e.key === key, "key = " + e.key + ", expected " + key); ok(e.key === key, "key = " + e.key + ", expected " + key);
ok(e.oldValue === oldValue, "oldValue = " + e.oldValue + ", expected " + oldValue); ok(e.oldValue === oldValue, "oldValue = " + e.oldValue + ", expected " + oldValue);
ok(e.newValue === newValue, "newValue = " + e.newValue + ", expected " + newValue); ok(e.newValue === newValue, "newValue = " + e.newValue + ", expected " + newValue);
s = (idx ? iframe.contentWindow : window)["location"]["href"];
ok(e.url === s, "url = " + e.url + ", expected " + s);
} }
function expect(idx, key, oldValue, newValue, quirk) { function expect(idx, key, oldValue, newValue, quirk) {
...@@ -1352,10 +1354,10 @@ async_test("storage events", function() { ...@@ -1352,10 +1354,10 @@ async_test("storage events", function() {
(v < 9 ? document2 : window2)["onstorage"] = function(e) { (v < 9 ? document2 : window2)["onstorage"] = function(e) {
(local && idx ? document2 : (local || v < 9 ? document : window))[local ? "onstoragecommit" : "onstorage"] = function(e) { (local && idx ? document2 : (local || v < 9 ? document : window))[local ? "onstoragecommit" : "onstorage"] = function(e) {
test_event(e, local ? "" : key, local ? "" : oldValue, local ? "" : newValue); test_event(e, idx, local ? "" : key, local ? "" : oldValue, local ? "" : newValue);
next(); next();
} }
test_event(e, key, oldValue, newValue); test_event(e, idx, key, oldValue, newValue);
} }
} }
} }
......
...@@ -2925,6 +2925,11 @@ static void test_storage_event(DISPPARAMS *params, BOOL doc_onstorage) ...@@ -2925,6 +2925,11 @@ static void test_storage_event(DISPPARAMS *params, BOOL doc_onstorage)
"newValue = %s\n", wine_dbgstr_w(bstr)); "newValue = %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr); SysFreeString(bstr);
hres = IDOMStorageEvent_get_url(event, &bstr);
ok_(__FILE__,line)(hres == S_OK, "get_url failed: %08lx\n", hres);
ok_(__FILE__,line)(!wcscmp(bstr, L"http://winetest.example.org/"), "url = %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr);
IDOMStorageEvent_Release(event); IDOMStorageEvent_Release(event);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment