Gabriel Ivăncescu : mshtml: Don't include fragment in storage event's url prop.
Module: wine Branch: master Commit: 176f5409b173d727520485530d512f832a4577c8 URL: https://gitlab.winehq.org/wine/wine/-/commit/176f5409b173d727520485530d512f8... Author: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> Date: Mon Nov 7 17:35:12 2022 +0200 mshtml: Don't include fragment in storage event's url prop. Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> --- dlls/mshtml/htmlstorage.c | 14 ++++++++++---- dlls/mshtml/tests/documentmode.js | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/dlls/mshtml/htmlstorage.c b/dlls/mshtml/htmlstorage.c index bf93e28fdf6..d8ecf573b2b 100644 --- a/dlls/mshtml/htmlstorage.c +++ b/dlls/mshtml/htmlstorage.c @@ -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) diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index a0f170c73b4..92f30f8b7e9 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -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); }
participants (1)
-
Alexandre Julliard