mshtml: Don't include fragment in storage event's url prop.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
This commit is contained in:
Gabriel Ivăncescu 2022-11-07 17:35:12 +02:00 committed by Alexandre Julliard
parent c2d55cd24e
commit 176f5409b1
2 changed files with 11 additions and 5 deletions

View file

@ -235,7 +235,7 @@ struct send_storage_event_ctx {
BSTR key;
BSTR old_value;
BSTR new_value;
const WCHAR *url;
BSTR url;
};
static HRESULT push_storage_event_task(struct send_storage_event_ctx *ctx, HTMLInnerWindow *window, BOOL commit)
@ -324,11 +324,16 @@ static HRESULT send_storage_event(HTMLStorage *storage, BSTR key, BSTR old_value
BSTR hostname = NULL;
HRESULT hres = S_OK;
ctx.url = NULL;
if(!window)
goto done;
get_top_window(window->base.outer_window, &top_window);
if(window->base.outer_window->uri_nofrag) {
hres = IUri_GetDisplayUri(window->base.outer_window->uri_nofrag, &ctx.url);
if(hres != S_OK)
goto done;
}
ctx.url = window->base.outer_window->url;
get_top_window(window->base.outer_window, &top_window);
ctx.key = key;
ctx.old_value = old_value;
ctx.new_value = new_value;
@ -351,9 +356,10 @@ static HRESULT send_storage_event(HTMLStorage *storage, BSTR key, BSTR old_value
hres = push_storage_event_task(&ctx, window, TRUE);
done:
SysFreeString(ctx.url);
SysFreeString(hostname);
SysFreeString(old_value);
return hres;
return FAILED(hres) ? hres : S_OK;
}
static HRESULT WINAPI HTMLStorage_QueryInterface(IHTMLStorage *iface, REFIID riid, void **ppv)

View file

@ -1468,7 +1468,7 @@ async_test("storage events", function() {
ok(e.key === key, "key = " + e.key + ", expected " + key);
ok(e.oldValue === oldValue, "oldValue = " + e.oldValue + ", expected " + oldValue);
ok(e.newValue === newValue, "newValue = " + e.newValue + ", expected " + newValue);
s = (idx ? iframe.contentWindow : window)["location"]["href"];
s = (idx ? iframe.contentWindow : window)["location"]["href"].split('#', 1)[0];
ok(e.url === s, "url = " + e.url + ", expected " + s);
}