For the `performance.navigation` props, I store them in the timing that's already linked from the window, to prevent adding more code around that just for 2 props, so it keeps it simple.
-- v2: include/mshtml: Add IHTMLXDomainRequest and factory interfaces and classes. mshtml: Don't check for doc_node from the doc obj when it can't be NULL. mshtml: Return proper error for invalid selectors in IE8 mode. mshtml: Treat edit mode as a reload. mshtml: Implement performance.navigation.type. mshtml: Implement performance.navigation.redirectCount. mshtml: Set `reload` load type to Gecko for document reloads. mshtml: Implement `onload` prop for input elements. mshtml: Send load event synchronously for image elements if set to same src. mshtml: Implement location.reload(). mshtml: Implement print events.
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53927 Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmlevent.c | 4 ++++ dlls/mshtml/htmlevent.h | 2 ++ dlls/mshtml/htmlwindow.c | 16 ++++++++-------- 3 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index fec280d9a70..af591a37979 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -120,12 +120,16 @@ static const event_info_t event_info[] = { EVENT_BUBBLES | EVENT_CANCELABLE}, {L"abort", EVENT_TYPE_EVENT, DISPID_EVMETH_ONABORT, EVENT_BIND_TO_TARGET}, + {L"afterprint", EVENT_TYPE_EVENT, DISPID_EVMETH_ONAFTERPRINT, + EVENT_DEFAULTLISTENER}, {L"animationend", EVENT_TYPE_EVENT, DISPID_EVPROP_ONANIMATIONEND, EVENT_DEFAULTLISTENER | EVENT_BUBBLES}, {L"animationstart", EVENT_TYPE_EVENT, DISPID_EVPROP_ONANIMATIONSTART, EVENT_DEFAULTLISTENER | EVENT_BUBBLES}, {L"beforeactivate", EVENT_TYPE_EVENT, DISPID_EVMETH_ONBEFOREACTIVATE, EVENT_FIXME | EVENT_BUBBLES | EVENT_CANCELABLE}, + {L"beforeprint", EVENT_TYPE_EVENT, DISPID_EVMETH_ONBEFOREPRINT, + EVENT_DEFAULTLISTENER}, {L"beforeunload", EVENT_TYPE_EVENT, DISPID_EVMETH_ONBEFOREUNLOAD, EVENT_DEFAULTLISTENER | EVENT_CANCELABLE }, {L"blur", EVENT_TYPE_FOCUS, DISPID_EVMETH_ONBLUR, diff --git a/dlls/mshtml/htmlevent.h b/dlls/mshtml/htmlevent.h index a6d1f734a40..104cb8554d2 100644 --- a/dlls/mshtml/htmlevent.h +++ b/dlls/mshtml/htmlevent.h @@ -19,9 +19,11 @@ typedef enum { EVENTID_DOMCONTENTLOADED, EVENTID_ABORT, + EVENTID_AFTERPRINT, EVENTID_ANIMATIONEND, EVENTID_ANIMATIONSTART, EVENTID_BEFOREACTIVATE, + EVENTID_BEFOREPRINT, EVENTID_BEFOREUNLOAD, EVENTID_BLUR, EVENTID_CHANGE, diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index ec7fc0d43f2..76a414f6b39 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -1806,29 +1806,29 @@ static HRESULT WINAPI HTMLWindow3_print(IHTMLWindow3 *iface) static HRESULT WINAPI HTMLWindow3_put_onbeforeprint(IHTMLWindow3 *iface, VARIANT v) { HTMLWindow *This = impl_from_IHTMLWindow3(iface); - FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); - return E_NOTIMPL; + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + return set_window_event(This, EVENTID_BEFOREPRINT, &v); }
static HRESULT WINAPI HTMLWindow3_get_onbeforeprint(IHTMLWindow3 *iface, VARIANT *p) { HTMLWindow *This = impl_from_IHTMLWindow3(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_window_event(This, EVENTID_BEFOREPRINT, p); }
static HRESULT WINAPI HTMLWindow3_put_onafterprint(IHTMLWindow3 *iface, VARIANT v) { HTMLWindow *This = impl_from_IHTMLWindow3(iface); - FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); - return E_NOTIMPL; + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + return set_window_event(This, EVENTID_AFTERPRINT, &v); }
static HRESULT WINAPI HTMLWindow3_get_onafterprint(IHTMLWindow3 *iface, VARIANT *p) { HTMLWindow *This = impl_from_IHTMLWindow3(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_window_event(This, EVENTID_AFTERPRINT, p); }
static HRESULT WINAPI HTMLWindow3_get_clipboardData(IHTMLWindow3 *iface, IHTMLDataTransfer **p)
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53927 Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmllocation.c | 17 +++++++++++++-- dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/olecmd.c | 24 ++++++++++++++-------- dlls/mshtml/tests/htmldoc.c | 20 ++++++++++++++++++ dlls/mshtml/tests/reload.js | 40 ++++++++++++++++++++++++++++++++++++ dlls/mshtml/tests/rsrc.rc | 3 +++ dlls/mshtml/tests/script.c | 1 + 7 files changed, 95 insertions(+), 11 deletions(-) create mode 100644 dlls/mshtml/tests/reload.js
diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c index 26365a7a5d0..970d8a74fc9 100644 --- a/dlls/mshtml/htmllocation.c +++ b/dlls/mshtml/htmllocation.c @@ -582,8 +582,21 @@ static HRESULT WINAPI HTMLLocation_get_hash(IHTMLLocation *iface, BSTR *p) static HRESULT WINAPI HTMLLocation_reload(IHTMLLocation *iface, VARIANT_BOOL flag) { HTMLLocation *This = impl_from_IHTMLLocation(iface); - FIXME("(%p)->(%x)\n", This, flag); - return E_NOTIMPL; + + TRACE("(%p)->(%x)\n", This, flag); + + if(!This->window || !This->window->doc) { + FIXME("No window available\n"); + return E_FAIL; + } + + /* reload is supposed to fail if called from a script with different origin, but IE doesn't care */ + if(This->window->doc != This->window->doc->browser->doc->doc_node) { + FIXME("Unsupported on frame documents\n"); + return E_NOTIMPL; + } + + return reload_page(This->window->base.outer_window); }
static HRESULT WINAPI HTMLLocation_replace(IHTMLLocation *iface, BSTR bstr) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index c5c3549ce71..7c5e6ef038c 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -1095,6 +1095,7 @@ HRESULT async_start_doc_binding(HTMLOuterWindow*,HTMLInnerWindow*) DECLSPEC_HIDD void abort_window_bindings(HTMLInnerWindow*) DECLSPEC_HIDDEN; void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN; void call_docview_84(HTMLDocumentObj*) DECLSPEC_HIDDEN; +HRESULT reload_page(HTMLOuterWindow*) DECLSPEC_HIDDEN;
void set_ready_state(HTMLOuterWindow*,READYSTATE) DECLSPEC_HIDDEN; HRESULT get_readystate_string(READYSTATE,BSTR*) DECLSPEC_HIDDEN; diff --git a/dlls/mshtml/olecmd.c b/dlls/mshtml/olecmd.c index 68cb4491f06..a77019fd401 100644 --- a/dlls/mshtml/olecmd.c +++ b/dlls/mshtml/olecmd.c @@ -449,10 +449,23 @@ static void refresh_destr(task_t *_task) heap_free(task); }
+HRESULT reload_page(HTMLOuterWindow *window) +{ + refresh_task_t *task; + + task = heap_alloc(sizeof(*task)); + if(!task) + return E_OUTOFMEMORY; + + IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); + task->window = window; + + return push_task(&task->header, refresh_proc, refresh_destr, window->task_magic); +} + static HRESULT exec_refresh(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) { HTMLDocumentObj *doc_obj; - refresh_task_t *task; HRESULT hres;
TRACE("(%p)->(%ld %s %p)\n", doc, nCmdexecopt, debugstr_variant(pvaIn), pvaOut); @@ -478,14 +491,7 @@ static HRESULT exec_refresh(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *p if(!doc->outer_window) return E_UNEXPECTED;
- task = heap_alloc(sizeof(*task)); - if(!task) - return E_OUTOFMEMORY; - - IHTMLWindow2_AddRef(&doc->outer_window->base.IHTMLWindow2_iface); - task->window = doc->outer_window; - - return push_task(&task->header, refresh_proc, refresh_destr, doc->outer_window->task_magic); + return reload_page(doc->outer_window); }
static HRESULT exec_stop(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c index b496d562fb1..a4a2207d4d2 100644 --- a/dlls/mshtml/tests/htmldoc.c +++ b/dlls/mshtml/tests/htmldoc.c @@ -1142,6 +1142,7 @@ static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, D case 3000030: case 3000031: case 3000032: + case 3000033: /* TODO */ return S_OK; } @@ -6399,6 +6400,24 @@ static void test_refresh(IHTMLDocument2 *doc) test_download(DWL_VERBDONE|DWL_HTTP|DWL_ONREADY_LOADING|DWL_REFRESH|DWL_EX_GETHOSTINFO); }
+static void test_reload(IHTMLDocument2 *doc) +{ + IHTMLLocation *location; + HRESULT hres; + + trace("Reload...\n"); + + location = NULL; + hres = IHTMLDocument2_get_location(doc, &location); + ok(hres == S_OK, "get_location failed: %08lx\n", hres); + ok(location != NULL, "location == NULL\n"); + + hres = IHTMLLocation_reload(location, VARIANT_FALSE); + IHTMLLocation_Release(location); + + test_download(DWL_VERBDONE|DWL_HTTP|DWL_ONREADY_LOADING|DWL_REFRESH|DWL_EX_GETHOSTINFO); +} + static void test_open_window(IHTMLDocument2 *doc, BOOL do_block) { IHTMLWindow2 *window, *new_window; @@ -8216,6 +8235,7 @@ static void test_HTMLDocument_http(BOOL with_wbapp) test_put_href(doc, FALSE, L"#test", L"http://test.winehq.org/tests/winehq_snapshot/#test", FALSE, TRUE, 0); test_travellog(doc); test_refresh(doc); + test_reload(doc); } test_put_href(doc, FALSE, NULL, L"javascript:external%20&&undefined", TRUE, FALSE, 0); test_put_href(doc, FALSE, NULL, L"about:blank", FALSE, FALSE, support_wbapp ? DWL_EXPECT_HISTUPDATE : 0); diff --git a/dlls/mshtml/tests/reload.js b/dlls/mshtml/tests/reload.js new file mode 100644 index 00000000000..04bdf9fcb90 --- /dev/null +++ b/dlls/mshtml/tests/reload.js @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Gabriel Ivăncescu for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +var tests = []; + +async_test("reload", function() { + if(sessionStorage.getItem("skip reload test")) { + next_test(); + return; + } + + var script = document.createElement("script"); + script.src ="http://winetest.different.org/jsstream.php?reload"; + document.getElementsByTagName("head")[0].appendChild(script); + + external.writeStream("reload", + ' try {' + + ' window.location.reload();' + + ' sessionStorage.setItem("skip reload test", true);' + + ' }catch(e) {' + + ' ok(false, "reload with different origin threw " + e.number);' + + ' }' + + ' next_test()' + ); +}); diff --git a/dlls/mshtml/tests/rsrc.rc b/dlls/mshtml/tests/rsrc.rc index e60e37198de..10b92ab78cb 100644 --- a/dlls/mshtml/tests/rsrc.rc +++ b/dlls/mshtml/tests/rsrc.rc @@ -64,6 +64,9 @@ events.js HTML "events.js" /* @makedep: documentmode.js */ documentmode.js HTML "documentmode.js"
+/* @makedep: reload.js */ +reload.js HTML "reload.js" + /* @makedep: blank.html */ blank.html HTML "blank.html"
diff --git a/dlls/mshtml/tests/script.c b/dlls/mshtml/tests/script.c index d7d7e7361c3..b27b68b5bd1 100644 --- a/dlls/mshtml/tests/script.c +++ b/dlls/mshtml/tests/script.c @@ -4088,6 +4088,7 @@ static void run_js_tests(void) run_script_as_http_with_mode("documentmode.js", "11", "edge;123");
run_script_as_http_with_mode("asyncscriptload.js", NULL, "9"); + run_script_as_http_with_mode("reload.js", NULL, "11"); }
static BOOL init_registry(BOOL init)
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Otherwise, script56.chm's javascript will keep reloading the image and triggering onload events non-stop. It protects against this using a variable "noReentry", which is only set temporarily while setting the source, so it expects it to be triggered synchronously.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53927 Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmlimg.c | 25 +++++++++++++++++++++++++ dlls/mshtml/tests/events.c | 15 ++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c index e779dd2dec7..e4898e081e9 100644 --- a/dlls/mshtml/htmlimg.c +++ b/dlls/mshtml/htmlimg.c @@ -283,9 +283,34 @@ static HRESULT WINAPI HTMLImgElement_put_src(IHTMLImgElement *iface, BSTR v) HTMLImg *This = impl_from_IHTMLImgElement(iface); nsAString src_str; nsresult nsres; + HRESULT hres;
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
+ nsAString_Init(&src_str, NULL); + nsres = nsIDOMHTMLImageElement_GetSrc(This->nsimg, &src_str); + if(NS_SUCCEEDED(nsres)) { + const PRUnichar *src; + DOMEvent *event; + VARIANT_BOOL b; + BOOL same; + + nsAString_GetData(&src_str, &src); + same = !wcscmp(v, src); + nsAString_Finish(&src_str); + if(same) { + hres = IHTMLImgElement_get_complete(&This->IHTMLImgElement_iface, &b); + if(SUCCEEDED(hres) && b) { + hres = create_document_event(This->element.node.doc, EVENTID_LOAD, &event); + if(SUCCEEDED(hres)) { + dispatch_event(&This->element.node.event_target, event); + IDOMEvent_Release(&event->IDOMEvent_iface); + } + return hres; + } + } + } + nsAString_InitDepend(&src_str, v); nsres = nsIDOMHTMLImageElement_SetSrc(This->nsimg, &src_str); nsAString_Finish(&src_str); diff --git a/dlls/mshtml/tests/events.c b/dlls/mshtml/tests/events.c index 643993bc475..c3223eca1d2 100644 --- a/dlls/mshtml/tests/events.c +++ b/dlls/mshtml/tests/events.c @@ -2251,6 +2251,7 @@ static void test_imgload(IHTMLDocument2 *doc) { IHTMLImgElement *img; IHTMLElement *elem; + VARIANT_BOOL b; VARIANT v; BSTR str; HRESULT hres; @@ -2292,12 +2293,24 @@ static void test_imgload(IHTMLDocument2 *doc) str = SysAllocString(L"http://test.winehq.org/tests/winehq_snapshot/index_files/winehq_logo_text.pn..."); hres = IHTMLImgElement_put_src(img, str); ok(hres == S_OK, "put_src failed: %08lx\n", hres); - SysFreeString(str);
SET_EXPECT(img_onload); pump_msgs(&called_img_onload); CHECK_CALLED(img_onload);
+ hres = IHTMLImgElement_get_complete(img, &b); + ok(hres == S_OK, "get_complete failed: %08lx\n", hres); + ok(b == VARIANT_TRUE, "complete = %x\n", b); + + /* same src sends synchronous load event */ + SET_EXPECT(img_onload); + hres = IHTMLImgElement_put_src(img, str); + ok(hres == S_OK, "put_src failed: %08lx\n", hres); + CHECK_CALLED(img_onload); + SysFreeString(str); + + pump_msgs(NULL); + SET_EXPECT(img_onerror);
str = SysAllocString(L"about:blank");
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmlinput.c | 12 +++++--- dlls/mshtml/tests/events.c | 58 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 4 deletions(-)
diff --git a/dlls/mshtml/htmlinput.c b/dlls/mshtml/htmlinput.c index bd71cea88bd..bcf5d4c9762 100644 --- a/dlls/mshtml/htmlinput.c +++ b/dlls/mshtml/htmlinput.c @@ -719,15 +719,19 @@ static HRESULT WINAPI HTMLInputElement_get_align(IHTMLInputElement *iface, BSTR static HRESULT WINAPI HTMLInputElement_put_onload(IHTMLInputElement *iface, VARIANT v) { HTMLInputElement *This = impl_from_IHTMLInputElement(iface); - FIXME("(%p)->()\n", This); - return E_NOTIMPL; + + TRACE("(%p)->()\n", This); + + return set_node_event(&This->element.node, EVENTID_LOAD, &v); }
static HRESULT WINAPI HTMLInputElement_get_onload(IHTMLInputElement *iface, VARIANT *p) { HTMLInputElement *This = impl_from_IHTMLInputElement(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + return get_node_event(&This->element.node, EVENTID_LOAD, p); }
static HRESULT WINAPI HTMLInputElement_put_onerror(IHTMLInputElement *iface, VARIANT v) diff --git a/dlls/mshtml/tests/events.c b/dlls/mshtml/tests/events.c index c3223eca1d2..7b8dc907243 100644 --- a/dlls/mshtml/tests/events.c +++ b/dlls/mshtml/tests/events.c @@ -83,6 +83,7 @@ DEFINE_EXPECT(iframe_onreadystatechange_complete); DEFINE_EXPECT(iframedoc_onreadystatechange); DEFINE_EXPECT(img_onload); DEFINE_EXPECT(img_onerror); +DEFINE_EXPECT(input_onload); DEFINE_EXPECT(link_onload); DEFINE_EXPECT(input_onfocus); DEFINE_EXPECT(input_onblur); @@ -146,6 +147,9 @@ static const char readystate_doc_ie9_str[] = static const char img_doc_str[] = "<html><body><img id="imgid"></img></body></html>";
+static const char input_image_doc_str[] = + "<html><body><input type="image" id="inputid"></input></body></html>"; + static const char link_doc_str[] = "<html><body><link id="linkid" rel="stylesheet" type="text/css"></link></body></html>";
@@ -1086,6 +1090,17 @@ static HRESULT WINAPI img_onload(IDispatchEx *iface, DISPID id, LCID lcid, WORD
EVENT_HANDLER_FUNC_OBJ(img_onload);
+static HRESULT WINAPI input_onload(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, + VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) +{ + CHECK_EXPECT(input_onload); + test_event_args(&DIID_DispHTMLInputElement, id, wFlags, pdp, pvarRes, pei, pspCaller); + test_event_src(L"INPUT"); + return S_OK; +} + +EVENT_HANDLER_FUNC_OBJ(input_onload); + static HRESULT WINAPI link_onload(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) { @@ -2362,6 +2377,48 @@ static void test_imgload(IHTMLDocument2 *doc) IHTMLImgElement_Release(img); }
+static void test_inputload(IHTMLDocument2 *doc) +{ + IHTMLInputElement *input; + IHTMLElement *elem; + VARIANT v; + BSTR str; + HRESULT hres; + + elem = get_elem_id(doc, L"inputid"); + hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLInputElement, (void**)&input); + IHTMLElement_Release(elem); + ok(hres == S_OK, "Could not get IHTMLInputElement iface: %08lx\n", hres); + + V_VT(&v) = VT_EMPTY; + hres = IHTMLInputElement_get_onload(input, &v); + ok(hres == S_OK, "get_onload failed: %08lx\n", hres); + ok(V_VT(&v) == VT_NULL, "V_VT(onload) = %d\n", V_VT(&v)); + + V_VT(&v) = VT_DISPATCH; + V_DISPATCH(&v) = (IDispatch*)&input_onload_obj; + hres = IHTMLInputElement_put_onload(input, v); + ok(hres == S_OK, "put_onload failed: %08lx\n", hres); + + V_VT(&v) = VT_EMPTY; + hres = IHTMLInputElement_get_onload(input, &v); + ok(hres == S_OK, "get_onload failed: %08lx\n", hres); + ok(V_VT(&v) == VT_DISPATCH, "V_VT(onload) = %d\n", V_VT(&v)); + ok(V_DISPATCH(&v) == (IDispatch*)&input_onload_obj, "V_DISPATCH(onload) != input_onload_obj\n"); + VariantClear(&v); + + str = SysAllocString(L"http://test.winehq.org/tests/winehq_snapshot/index_files/winehq_logo_text.pn..."); + hres = IHTMLInputElement_put_src(input, str); + ok(hres == S_OK, "put_src failed: %08lx\n", hres); + SysFreeString(str); + + SET_EXPECT(input_onload); + pump_msgs(&called_input_onload); + CHECK_CALLED(input_onload); + + IHTMLInputElement_Release(input); +} + static void test_link_load(IHTMLDocument2 *doc) { IHTMLLinkElement *link; @@ -5789,6 +5846,7 @@ START_TEST(events) run_test(readystate_doc_str, test_onreadystatechange); run_test(readystate_doc_ie9_str, test_onreadystatechange); run_test(img_doc_str, test_imgload); + run_test(input_image_doc_str, test_inputload); run_test(link_doc_str, test_link_load); run_test(input_doc_str, test_focus); run_test(empty_doc_str, test_submit);
From: Gabriel Ivăncescu gabrielopcode@gmail.com
So it can async open with proper binding flags.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com ---
Needed to set the navigation type properly. --- dlls/mshtml/mshtml_private.h | 2 +- dlls/mshtml/navigate.c | 9 ++++++--- dlls/mshtml/nsiface.idl | 15 +++++++++++++++ dlls/mshtml/nsio.c | 22 +++++++++++++++------- 4 files changed, 37 insertions(+), 11 deletions(-)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 7c5e6ef038c..3a75fadebf1 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -1091,7 +1091,7 @@ char *get_nscategory_entry(const char*,const char*) DECLSPEC_HIDDEN;
HRESULT create_pending_window(HTMLOuterWindow*,nsChannelBSC*) DECLSPEC_HIDDEN; HRESULT start_binding(HTMLInnerWindow*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN; -HRESULT async_start_doc_binding(HTMLOuterWindow*,HTMLInnerWindow*) DECLSPEC_HIDDEN; +HRESULT async_start_doc_binding(HTMLOuterWindow*,HTMLInnerWindow*,DWORD) DECLSPEC_HIDDEN; void abort_window_bindings(HTMLInnerWindow*) DECLSPEC_HIDDEN; void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN; void call_docview_84(HTMLDocumentObj*) DECLSPEC_HIDDEN; diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index 469bd0d1e07..d86b5c5f7e0 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -1926,6 +1926,7 @@ HRESULT create_channelbsc(IMoniker *mon, const WCHAR *headers, BYTE *post_data,
typedef struct { task_t header; + DWORD flags; HTMLOuterWindow *window; HTMLInnerWindow *pending_window; } start_doc_binding_task_t; @@ -1934,7 +1935,7 @@ static void start_doc_binding_proc(task_t *_task) { start_doc_binding_task_t *task = (start_doc_binding_task_t*)_task;
- set_current_mon(task->window, task->pending_window->bscallback->bsc.mon, BINDING_NAVIGATED); + set_current_mon(task->window, task->pending_window->bscallback->bsc.mon, task->flags); start_binding(task->pending_window, &task->pending_window->bscallback->bsc, NULL); }
@@ -1946,7 +1947,7 @@ static void start_doc_binding_task_destr(task_t *_task) heap_free(task); }
-HRESULT async_start_doc_binding(HTMLOuterWindow *window, HTMLInnerWindow *pending_window) +HRESULT async_start_doc_binding(HTMLOuterWindow *window, HTMLInnerWindow *pending_window, DWORD flags) { start_doc_binding_task_t *task;
@@ -1956,6 +1957,7 @@ HRESULT async_start_doc_binding(HTMLOuterWindow *window, HTMLInnerWindow *pendin if(!task) return E_OUTOFMEMORY;
+ task->flags = flags; task->window = window; task->pending_window = pending_window; IHTMLWindow2_AddRef(&pending_window->base.IHTMLWindow2_iface); @@ -2531,7 +2533,8 @@ static HRESULT navigate_uri(HTMLOuterWindow *window, IUri *uri, const WCHAR *dis if(FAILED(hres)) return hres;
- hres = load_nsuri(window, nsuri, request_data ? request_data->post_stream : NULL, NULL, LOAD_FLAGS_NONE); + hres = load_nsuri(window, nsuri, request_data ? request_data->post_stream : NULL, NULL, + (flags & BINDING_REFRESH) ? LOAD_FLAGS_IS_REFRESH : LOAD_FLAGS_NONE); nsISupports_Release((nsISupports*)nsuri); return hres; } diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl index b28cce0ca09..1e97f1fc63b 100644 --- a/dlls/mshtml/nsiface.idl +++ b/dlls/mshtml/nsiface.idl @@ -496,6 +496,16 @@ interface nsIStandardURL : nsIMutable ] interface nsIRequest : nsISupports { + const UINT LOAD_NORMAL = 0; + const UINT LOAD_BACKGROUND = 1 << 1; + const UINT INHIBIT_CACHING = 1 << 7; + const UINT INHIBIT_PERSISTENT_CACHING = 1 << 8; + const UINT LOAD_BYPASS_CACHE = 1 << 9; + const UINT LOAD_FROM_CACHE = 1 << 10; + const UINT VALIDATE_ALWAYS = 1 << 11; + const UINT VALIDATE_NEVER = 1 << 12; + const UINT VALIDATE_ONCE_PER_SESSION = 1 << 13; + nsresult GetName(nsACString *aName); nsresult IsPending(bool *_retval); nsresult GetStatus(nsresult *aStatus); @@ -3936,6 +3946,11 @@ interface nsIDocShellLoadInfo : nsISupports ] interface nsIDocShell : nsIDocShellTreeItem { + const UINT LOAD_CMD_NORMAL = 1; + const UINT LOAD_CMD_RELOAD = 2; + const UINT LOAD_CMD_HISTORY = 4; + const UINT LOAD_CMD_PUSHSTATE = 8; + nsresult LoadURI(nsIURI *uri, nsIDocShellLoadInfo *loadInfo, uint32_t aLoadFlags, bool firstParty); nsresult LoadStream(nsIInputStream *aStream, nsIURI *aURI, const nsACString *aContentType, const nsACString *aContentCharset, nsIDocShellLoadInfo *aLoadInfo); diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c index 6654018f8e6..e2fc064eb2d 100644 --- a/dlls/mshtml/nsio.c +++ b/dlls/mshtml/nsio.c @@ -284,6 +284,7 @@ HRESULT load_nsuri(HTMLOuterWindow *window, nsWineURI *uri, nsIInputStream *post nsChannelBSC *channelbsc, DWORD flags) { nsIWebNavigation *web_navigation; + nsDocShellInfoLoadType load_type; nsIDocShellLoadInfo *load_info; nsIDocShell *doc_shell; HTMLDocumentNode *doc; @@ -308,7 +309,11 @@ HRESULT load_nsuri(HTMLOuterWindow *window, nsWineURI *uri, nsIInputStream *post return E_FAIL; }
- nsres = nsIDocShellLoadInfo_SetLoadType(load_info, (flags & LOAD_FLAGS_BYPASS_CACHE) ? loadNormalBypassCache : loadNormal); + if(flags & LOAD_FLAGS_IS_REFRESH) + load_type = (flags & LOAD_FLAGS_BYPASS_CACHE) ? loadReloadBypassCache : loadReloadNormal; + else + load_type = (flags & LOAD_FLAGS_BYPASS_CACHE) ? loadNormalBypassCache : loadNormal; + nsres = nsIDocShellLoadInfo_SetLoadType(load_info, load_type); assert(nsres == NS_OK);
if(post_stream) { @@ -905,7 +910,7 @@ static nsresult NSAPI nsChannel_Open2(nsIHttpChannel *iface, nsIInputStream **_r return NS_ERROR_NOT_IMPLEMENTED; }
-static HTMLOuterWindow *get_channel_window(nsChannel *This) +static HTMLOuterWindow *get_channel_window(nsChannel *This, UINT32 *load_type) { nsIWebProgress *web_progress = NULL; mozIDOMWindowProxy *mozwindow; @@ -944,6 +949,8 @@ static HTMLOuterWindow *get_channel_window(nsChannel *This) return NULL; }
+ nsIWebProgress_GetLoadType(web_progress, load_type); + nsres = nsIWebProgress_GetDOMWindow(web_progress, &mozwindow); nsIWebProgress_Release(web_progress); if(NS_FAILED(nsres) || !mozwindow) { @@ -982,8 +989,8 @@ static void start_binding_task_destr(task_t *_task) heap_free(task); }
-static nsresult async_open(nsChannel *This, HTMLOuterWindow *window, BOOL is_doc_channel, nsIStreamListener *listener, - nsISupports *context) +static nsresult async_open(nsChannel *This, HTMLOuterWindow *window, BOOL is_doc_channel, UINT32 load_type, + nsIStreamListener *listener, nsISupports *context) { nsChannelBSC *bscallback; IMoniker *mon = NULL; @@ -1008,7 +1015,7 @@ static nsresult async_open(nsChannel *This, HTMLOuterWindow *window, BOOL is_doc if(is_doc_channel) { hres = create_pending_window(window, bscallback); if(SUCCEEDED(hres)) - async_start_doc_binding(window, window->pending_window); + async_start_doc_binding(window, window->pending_window, (load_type & LOAD_CMD_RELOAD) ? BINDING_REFRESH : BINDING_NAVIGATED); IBindStatusCallback_Release(&bscallback->bsc.IBindStatusCallback_iface); if(FAILED(hres)) return NS_ERROR_UNEXPECTED; @@ -1035,6 +1042,7 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen nsISupports *aContext) { nsChannel *This = impl_from_nsIHttpChannel(iface); + UINT32 load_type = LOAD_CMD_NORMAL; HTMLOuterWindow *window = NULL; BOOL is_document_channel; BOOL cancel = FALSE; @@ -1058,7 +1066,7 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen } }
- window = get_channel_window(This); + window = get_channel_window(This, &load_type); if(!window) { ERR("window = NULL\n"); return NS_ERROR_UNEXPECTED; @@ -1088,7 +1096,7 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen }
if(!cancel) - nsres = async_open(This, window, is_document_channel, aListener, aContext); + nsres = async_open(This, window, is_document_channel, load_type, aListener, aContext);
if(NS_SUCCEEDED(nsres) && This->load_group) { nsres = nsILoadGroup_AddRequest(This->load_group, (nsIRequest*)&This->nsIHttpChannel_iface,
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/mshtml_private.h | 2 ++ dlls/mshtml/navigate.c | 7 +++++-- dlls/mshtml/omnavigator.c | 24 ++++++++++++++++-------- dlls/mshtml/tests/documentmode.js | 1 + 4 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 3a75fadebf1..3c1febc560b 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -509,6 +509,8 @@ typedef struct {
LONG ref;
+ ULONG redirect_count; + ULONGLONG navigation_start_time; ULONGLONG unload_event_start_time; ULONGLONG unload_event_end_time; diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index d86b5c5f7e0..d85d77bd5ae 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -1723,8 +1723,11 @@ static HRESULT nsChannelBSC_on_progress(BSCallback *bsc, ULONG progress, ULONG t This->nschannel->content_type = heap_strdupWtoA(status_text); break; case BINDSTATUS_REDIRECTING: - if(This->is_doc_channel && !This->bsc.window->performance_timing->redirect_time) - This->bsc.window->performance_timing->redirect_time = get_time_stamp(); + if(This->is_doc_channel) { + This->bsc.window->performance_timing->redirect_count++; + if(!This->bsc.window->performance_timing->redirect_time) + This->bsc.window->performance_timing->redirect_time = get_time_stamp(); + } return handle_redirect(This, status_text); case BINDSTATUS_FINDINGRESOURCE: if(This->is_doc_channel && !This->bsc.window->performance_timing->dns_lookup_time) diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index 5ae20f59ce8..98350be3b2b 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -1901,6 +1901,7 @@ typedef struct { IHTMLPerformanceNavigation IHTMLPerformanceNavigation_iface;
LONG ref; + HTMLPerformanceTiming *timing; } HTMLPerformanceNavigation;
static inline HTMLPerformanceNavigation *impl_from_IHTMLPerformanceNavigation(IHTMLPerformanceNavigation *iface) @@ -1948,6 +1949,7 @@ static ULONG WINAPI HTMLPerformanceNavigation_Release(IHTMLPerformanceNavigation TRACE("(%p) ref=%ld\n", This, ref);
if(!ref) { + IHTMLPerformanceTiming_Release(&This->timing->IHTMLPerformanceTiming_iface); release_dispex(&This->dispex); heap_free(This); } @@ -2003,8 +2005,11 @@ static HRESULT WINAPI HTMLPerformanceNavigation_get_type(IHTMLPerformanceNavigat static HRESULT WINAPI HTMLPerformanceNavigation_get_redirectCount(IHTMLPerformanceNavigation *iface, ULONG *p) { HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + *p = This->timing->redirect_count; + return S_OK; }
static HRESULT WINAPI HTMLPerformanceNavigation_toString(IHTMLPerformanceNavigation *iface, BSTR *string) @@ -2055,7 +2060,7 @@ typedef struct { LONG ref;
IHTMLPerformanceNavigation *navigation; - IHTMLPerformanceTiming *timing; + HTMLPerformanceTiming *timing; } HTMLPerformance;
static inline HTMLPerformance *impl_from_IHTMLPerformance(IHTMLPerformance *iface) @@ -2103,7 +2108,7 @@ static ULONG WINAPI HTMLPerformance_Release(IHTMLPerformance *iface) TRACE("(%p) ref=%ld\n", This, ref);
if(!ref) { - IHTMLPerformanceTiming_Release(This->timing); + IHTMLPerformanceTiming_Release(&This->timing->IHTMLPerformanceTiming_iface); if(This->navigation) IHTMLPerformanceNavigation_Release(This->navigation); release_dispex(&This->dispex); @@ -2164,6 +2169,9 @@ static HRESULT WINAPI HTMLPerformance_get_navigation(IHTMLPerformance *iface,
navigation->IHTMLPerformanceNavigation_iface.lpVtbl = &HTMLPerformanceNavigationVtbl; navigation->ref = 1; + navigation->timing = This->timing; + IHTMLPerformanceTiming_AddRef(&This->timing->IHTMLPerformanceTiming_iface); + init_dispatch(&navigation->dispex, (IUnknown*)&navigation->IHTMLPerformanceNavigation_iface, &HTMLPerformanceNavigation_dispex, dispex_compat_mode(&This->dispex));
@@ -2180,7 +2188,7 @@ static HRESULT WINAPI HTMLPerformance_get_timing(IHTMLPerformance *iface, IHTMLP
TRACE("(%p)->(%p)\n", This, p);
- IHTMLPerformanceTiming_AddRef(*p = This->timing); + IHTMLPerformanceTiming_AddRef(*p = &This->timing->IHTMLPerformanceTiming_iface); return S_OK; }
@@ -2240,10 +2248,10 @@ HRESULT create_performance(HTMLInnerWindow *window, IHTMLPerformance **ret) init_dispatch(&performance->dispex, (IUnknown*)&performance->IHTMLPerformance_iface, &HTMLPerformance_dispex, compat_mode);
- performance->timing = &window->performance_timing->IHTMLPerformanceTiming_iface; - IHTMLPerformanceTiming_AddRef(performance->timing); + performance->timing = window->performance_timing; + IHTMLPerformanceTiming_AddRef(&performance->timing->IHTMLPerformanceTiming_iface);
- init_dispatch(&window->performance_timing->dispex, (IUnknown*)&window->performance_timing->IHTMLPerformanceTiming_iface, + init_dispatch(&performance->timing->dispex, (IUnknown*)&performance->timing->IHTMLPerformanceTiming_iface, &HTMLPerformanceTiming_dispex, compat_mode);
*ret = &performance->IHTMLPerformance_iface; diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 3965c8ec41b..a1f0a6bd6a6 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -90,6 +90,7 @@ sync_test("performance timing", function() { ok(performance.timing.domComplete >= performance.timing.domContentLoadedEventEnd, "domComplete < domContentLoadedEventEnd"); ok(performance.timing.loadEventStart >= performance.timing.domComplete, "loadEventStart < domComplete"); ok(performance.timing.loadEventEnd >= performance.timing.loadEventStart, "loadEventEnd < loadEventStart"); + ok(performance.navigation.redirectCount === 0, "redirectCount = " + performance.navigation.redirectCount); });
sync_test("page transition events", function() {
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/navigate.c | 7 ++++ dlls/mshtml/omnavigator.c | 4 +- dlls/mshtml/tests/documentmode.js | 1 + dlls/mshtml/tests/htmldoc.c | 66 ++++++++++++++++++++++++++++++- dlls/mshtml/tests/reload.js | 1 + 6 files changed, 77 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 3c1febc560b..750bb7e2470 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -509,6 +509,7 @@ typedef struct {
LONG ref;
+ ULONG navigation_type; ULONG redirect_count;
ULONGLONG navigation_start_time; diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index d85d77bd5ae..138d8033108 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -1361,6 +1361,13 @@ static HRESULT nsChannelBSC_start_binding(BSCallback *bsc) nsChannelBSC *This = nsChannelBSC_from_BSCallback(bsc);
if(This->is_doc_channel) { + DWORD flags = This->bsc.window->base.outer_window->load_flags; + + if(flags & BINDING_FROMHIST) + This->bsc.window->performance_timing->navigation_type = 2; /* TYPE_BACK_FORWARD */ + if(flags & BINDING_REFRESH) + This->bsc.window->performance_timing->navigation_type = 1; /* TYPE_RELOAD */ + This->bsc.window->base.outer_window->base.inner_window->doc->skip_mutation_notif = FALSE; This->bsc.window->performance_timing->navigation_start_time = get_time_stamp(); } diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index 98350be3b2b..14f01bbcd4d 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -1996,9 +1996,9 @@ static HRESULT WINAPI HTMLPerformanceNavigation_get_type(IHTMLPerformanceNavigat { HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
- FIXME("(%p)->(%p) returning TYPE_NAVIGATE\n", This, p); + TRACE("(%p)->(%p)\n", This, p);
- *p = 0; /* TYPE_NAVIGATE */ + *p = This->timing->navigation_type; return S_OK; }
diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index a1f0a6bd6a6..8fd97d11cd6 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -90,6 +90,7 @@ sync_test("performance timing", function() { ok(performance.timing.domComplete >= performance.timing.domContentLoadedEventEnd, "domComplete < domContentLoadedEventEnd"); ok(performance.timing.loadEventStart >= performance.timing.domComplete, "loadEventStart < domComplete"); ok(performance.timing.loadEventEnd >= performance.timing.loadEventStart, "loadEventEnd < loadEventStart"); + ok(performance.navigation.type === 0, "navigation type = " + performance.navigation.type); ok(performance.navigation.redirectCount === 0, "redirectCount = " + performance.navigation.redirectCount); });
diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c index a4a2207d4d2..b4971e5784d 100644 --- a/dlls/mshtml/tests/htmldoc.c +++ b/dlls/mshtml/tests/htmldoc.c @@ -219,7 +219,7 @@ static BOOL set_clientsite, container_locked; static BOOL readystate_set_loading = FALSE, readystate_set_interactive = FALSE, load_from_stream; static BOOL editmode = FALSE, ignore_external_qi; static BOOL inplace_deactivated, open_call; -static BOOL complete, loading_js, loading_hash, is_refresh; +static BOOL complete, loading_js, loading_hash, is_refresh, is_from_hist; static DWORD status_code = HTTP_STATUS_OK; static BOOL asynchronous_binding = FALSE; static BOOL support_wbapp, allow_new_window, no_travellog; @@ -529,6 +529,63 @@ static void _test_performance_timing(unsigned line, IUnknown *unk, const WCHAR * ok_(__FILE__,line)(V_UI8(&var) == 0, "%s is not 0\n", wine_dbgstr_w(prop)); }
+#define test_navigation_type(a) _test_navigation_type(__LINE__,a) +static void _test_navigation_type(unsigned line, IUnknown *unk) +{ + IHTMLPerformanceNavigation *nav; + IHTMLPerformance *perf; + DISPPARAMS dp = { 0 }; + ULONG type, expected; + IHTMLWindow2 *window; + IHTMLDocument2 *doc; + IDispatchEx *dispex; + DISPID dispid; + HRESULT hres; + VARIANT var; + BSTR bstr; + + hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc); + ok_(__FILE__,line)(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08lx\n", hres); + + hres = IHTMLDocument2_get_parentWindow(doc, &window); + ok_(__FILE__,line)(hres == S_OK, "get_parentWindow failed: %08lx\n", hres); + IHTMLDocument2_Release(doc); + + hres = IHTMLWindow2_QueryInterface(window, &IID_IDispatchEx, (void**)&dispex); + ok_(__FILE__,line)(hres == S_OK, "QueryInterface(IID_IDispatchEx) failed: %08lx\n", hres); + IHTMLWindow2_Release(window); + + bstr = SysAllocString(L"performance"); + hres = IDispatchEx_GetDispID(dispex, bstr, fdexNameCaseSensitive, &dispid); + ok_(__FILE__,line)(hres == S_OK, "GetDispID(performance) failed: %08lx\n", hres); + SysFreeString(bstr); + + V_VT(&var) = VT_EMPTY; + hres = IDispatchEx_InvokeEx(dispex, dispid, 0, DISPATCH_PROPERTYGET, &dp, &var, NULL, NULL); + ok_(__FILE__,line)(hres == S_OK, "InvokeEx(performance) failed: %08lx\n", hres); + ok_(__FILE__,line)(V_VT(&var) == VT_DISPATCH, "V_VT(performance) = %d\n", V_VT(&var)); + ok_(__FILE__,line)(V_DISPATCH(&var) != NULL, "V_DISPATCH(performance) = NULL\n"); + IDispatchEx_Release(dispex); + + hres = IDispatch_QueryInterface(V_DISPATCH(&var), &IID_IHTMLPerformance, (void**)&perf); + ok_(__FILE__,line)(hres == S_OK, "QueryInterface(IID_IHTMLPerformance) failed: %08lx\n", hres); + ok_(__FILE__,line)(perf != NULL, "performance is NULL\n"); + VariantClear(&var); + + hres = IHTMLPerformance_get_navigation(perf, &nav); + ok_(__FILE__,line)(hres == S_OK, "get_navigation failed: %08lx\n", hres); + ok_(__FILE__,line)(nav != NULL, "performance.navigation is NULL\n"); + IHTMLPerformance_Release(perf); + + hres = IHTMLPerformanceNavigation_get_type(nav, &type); + ok_(__FILE__,line)(hres == S_OK, "get_type failed: %08lx\n", hres); + IHTMLPerformanceNavigation_Release(nav); + + expected = is_refresh || editmode ? 1 : is_from_hist ? 2 : 0; + todo_wine_if(editmode) + ok_(__FILE__,line)(type == expected, "type = %lu, expected %lu\n", type, expected); +} + static BSTR get_mime_type_display_name(const WCHAR *content_type) { WCHAR buffer[128], ext[128], *str, *progid; @@ -1119,6 +1176,9 @@ static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, D test_readyState(NULL); readystate_set_interactive = (load_state != LD_INTERACTIVE);
+ if((!is_refresh && !editmode) || called_Exec_ShellDocView_37) + test_navigation_type(doc_unk); + /* w10pro64_ja has it set to zero despite readyState being interactive, for whatever reason */ if(!is_mhtml) test_performance_timing(doc_unk, L"domInteractive"); @@ -2987,6 +3047,7 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID ok(nCmdexecopt == 0, "nCmdexecopts=%08lx\n", nCmdexecopt); ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut); ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn); + test_navigation_type(doc_unk); test_performance_timing(doc_unk, L"domComplete"); readystate_set_loading = FALSE; readystate_set_interactive = FALSE; @@ -3661,6 +3722,7 @@ static HRESULT WINAPI DocObjectService_FireNavigateComplete2( { CHECK_EXPECT(FireNavigateComplete2); test_readyState(NULL); + test_navigation_type(doc_unk); test_performance_timing(doc_unk, L"domInteractive");
if(loading_hash) @@ -4508,6 +4570,7 @@ static HRESULT WINAPI WebBrowserPriv_NavigateWithBindCtx(IWebBrowserPriv *iface, trace("NavigateWithBindCtx\n");
CHECK_EXPECT(NavigateWithBindCtx); + test_navigation_type(doc_unk);
ok(V_VT(uri) == VT_BSTR, "V_VT(uri) = %d\n", V_VT(uri)); test_NavigateWithBindCtx(V_BSTR(uri), flags, target_frame, post_data, headers, bind_ctx, url_fragment); @@ -5890,6 +5953,7 @@ static void test_download(DWORD flags) else b = &called_Exec_HTTPEQUIV_DONE; is_refresh = (flags & DWL_REFRESH) != 0; + is_from_hist = (flags & DWL_FROM_HISTORY) != 0;
hwnd = FindWindowA("Internet Explorer_Hidden", NULL); ok(hwnd != NULL, "Could not find hidden window\n"); diff --git a/dlls/mshtml/tests/reload.js b/dlls/mshtml/tests/reload.js index 04bdf9fcb90..ebd207c14a5 100644 --- a/dlls/mshtml/tests/reload.js +++ b/dlls/mshtml/tests/reload.js @@ -20,6 +20,7 @@ var tests = [];
async_test("reload", function() { if(sessionStorage.getItem("skip reload test")) { + ok(performance.navigation.type === 1, "navigation type = " + performance.navigation.type); next_test(); return; }
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/mutation.c | 2 +- dlls/mshtml/nsevents.c | 3 +-- dlls/mshtml/persist.c | 3 +++ dlls/mshtml/tests/htmldoc.c | 1 - 4 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c index a311c2a0ba8..1557c9b9ea8 100644 --- a/dlls/mshtml/mutation.c +++ b/dlls/mshtml/mutation.c @@ -283,7 +283,7 @@ static void parse_complete(HTMLDocumentObj *doc) call_property_onchanged(&doc->cp_container, 1005); call_explorer_69(doc);
- if(doc->webbrowser && doc->nscontainer->usermode != EDITMODE && !(doc->window->load_flags & BINDING_REFRESH)) + if(doc->webbrowser && !(doc->window->load_flags & BINDING_REFRESH)) IDocObjectService_FireNavigateComplete2(doc->doc_object_service, &doc->window->base.IHTMLWindow2_iface, 0);
/* FIXME: IE7 calls EnableModelless(TRUE), EnableModelless(FALSE) and sets interactive state here */ diff --git a/dlls/mshtml/nsevents.c b/dlls/mshtml/nsevents.c index b0f55dfe35f..f5231a4eaa8 100644 --- a/dlls/mshtml/nsevents.c +++ b/dlls/mshtml/nsevents.c @@ -358,8 +358,7 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event update_title(doc_obj); }
- if(doc_obj && doc_obj->nscontainer->usermode != EDITMODE && doc_obj->doc_object_service - && !(doc->outer_window->load_flags & BINDING_REFRESH)) + if(doc_obj && doc_obj->doc_object_service && !(doc->outer_window->load_flags & BINDING_REFRESH)) IDocObjectService_FireDocumentComplete(doc_obj->doc_object_service, &doc->outer_window->base.IHTMLWindow2_iface, 0);
diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c index 262633deb9f..8d8f0a36bc2 100644 --- a/dlls/mshtml/persist.c +++ b/dlls/mshtml/persist.c @@ -413,6 +413,9 @@ HRESULT set_moniker(HTMLOuterWindow *window, IMoniker *mon, IUri *nav_uri, IBind } }
+ if(doc_obj->nscontainer->usermode == EDITMODE) + window->load_flags = BINDING_REFRESH; + download_task = heap_alloc(sizeof(download_proc_task_t)); download_task->doc = doc_obj; download_task->set_download = set_download; diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c index b4971e5784d..bbfac5aa8fa 100644 --- a/dlls/mshtml/tests/htmldoc.c +++ b/dlls/mshtml/tests/htmldoc.c @@ -582,7 +582,6 @@ static void _test_navigation_type(unsigned line, IUnknown *unk) IHTMLPerformanceNavigation_Release(nav);
expected = is_refresh || editmode ? 1 : is_from_hist ? 2 : 0; - todo_wine_if(editmode) ok_(__FILE__,line)(type == expected, "type = %lu, expected %lu\n", type, expected); }
From: Gabriel Ivăncescu gabrielopcode@gmail.com
More importantly it gets rid of the ERR since such failures are normal.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmldoc.c | 13 +++---- dlls/mshtml/htmlelem.c | 13 +++---- dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/nsembed.c | 2 ++ dlls/mshtml/tests/documentmode.js | 58 +++++++++++++++++++++++++++++++ 5 files changed, 75 insertions(+), 12 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 85f2e0eaace..3703bcd1204 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -4742,8 +4742,8 @@ static HRESULT WINAPI DocumentSelector_querySelector(IDocumentSelector *iface, B nsres = nsIDOMDocument_QuerySelector(This->dom_document, &nsstr, &nselem); nsAString_Finish(&nsstr); if(NS_FAILED(nsres)) { - ERR("QuerySelector failed: %08lx\n", nsres); - return E_FAIL; + WARN("QuerySelector failed: %08lx\n", nsres); + return map_nsresult(nsres); }
if(!nselem) { @@ -4765,16 +4765,17 @@ static HRESULT WINAPI DocumentSelector_querySelectorAll(IDocumentSelector *iface HTMLDocumentNode *This = impl_from_IDocumentSelector(iface); nsIDOMNodeList *node_list; nsAString nsstr; + nsresult nsres; HRESULT hres;
TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
nsAString_InitDepend(&nsstr, v); - hres = map_nsresult(nsIDOMDocument_QuerySelectorAll(This->dom_document, &nsstr, &node_list)); + nsres = nsIDOMDocument_QuerySelectorAll(This->dom_document, &nsstr, &node_list); nsAString_Finish(&nsstr); - if(FAILED(hres)) { - ERR("QuerySelectorAll failed: %08lx\n", hres); - return hres; + if(NS_FAILED(nsres)) { + WARN("QuerySelectorAll failed: %08lx\n", nsres); + return map_nsresult(nsres); }
hres = create_child_collection(node_list, dispex_compat_mode(&This->node.event_target.dispex), pel); diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 541806fa8b2..ea83e7e3588 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -6344,8 +6344,8 @@ static HRESULT WINAPI ElementSelector_querySelector(IElementSelector *iface, BST nsres = nsIDOMElement_QuerySelector(This->dom_element, &nsstr, &nselem); nsAString_Finish(&nsstr); if(NS_FAILED(nsres)) { - ERR("QuerySelector failed: %08lx\n", nsres); - return E_FAIL; + WARN("QuerySelector failed: %08lx\n", nsres); + return map_nsresult(nsres); }
if(!nselem) { @@ -6367,6 +6367,7 @@ static HRESULT WINAPI ElementSelector_querySelectorAll(IElementSelector *iface, HTMLElement *This = impl_from_IElementSelector(iface); nsIDOMNodeList *node_list; nsAString nsstr; + nsresult nsres; HRESULT hres;
TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel); @@ -6377,11 +6378,11 @@ static HRESULT WINAPI ElementSelector_querySelectorAll(IElementSelector *iface, }
nsAString_InitDepend(&nsstr, v); - hres = map_nsresult(nsIDOMElement_QuerySelectorAll(This->dom_element, &nsstr, &node_list)); + nsres = nsIDOMElement_QuerySelectorAll(This->dom_element, &nsstr, &node_list); nsAString_Finish(&nsstr); - if(FAILED(hres)) { - ERR("QuerySelectorAll failed: %08lx\n", hres); - return hres; + if(NS_FAILED(nsres)) { + WARN("QuerySelectorAll failed: %08lx\n", nsres); + return map_nsresult(nsres); }
hres = create_child_collection(node_list, dispex_compat_mode(&This->node.event_target.dispex), pel); diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 750bb7e2470..c15c403b7dc 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -60,6 +60,7 @@ #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L) #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL) #define NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR ((nsresult)0x80530007) +#define NS_ERROR_DOM_SYNTAX_ERR ((nsresult)0x8053000c)
#define NS_ERROR_MODULE_NETWORK 6
diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c index e720884bcc6..9a6513625b6 100644 --- a/dlls/mshtml/nsembed.c +++ b/dlls/mshtml/nsembed.c @@ -911,6 +911,8 @@ HRESULT map_nsresult(nsresult nsres) return E_UNEXPECTED; case NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR: return 0x80700007; /* according to tests */ + case NS_ERROR_DOM_SYNTAX_ERR: + return E_INVALIDARG; /* FIXME: Throw SyntaxError for IE9+ modes */ case NS_BINDING_ABORTED: return E_ABORT; } diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 8fd97d11cd6..760d8db5e38 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -2200,6 +2200,64 @@ sync_test("nullDisp", function() { } });
+sync_test("invalid selectors", function() { + var v = document.documentMode, body = document.body, i; + if(v < 8) + return; + + var selectors = [ + "[s!='']", + "*,:x", + "*,##", + ":x", + "##", + "*,", + "," + ]; + + for(i = 0; i < selectors.length; i++) { + try { + body.querySelector(selectors[i]); + ok(false, "body.querySelector("" + selectors[i] + "" did not throw exception"); + }catch(e) { + if(v < 9) + ok(e.number === 0x70057 - 0x80000000, "body.querySelector("" + selectors[i] + "" threw " + e.number); + else { + todo_wine. + ok(e.name === (v < 10 ? undefined : "SyntaxError"), "body.querySelector("" + selectors[i] + "" threw " + e.name); + } + } + try { + body.querySelectorAll(selectors[i]); + ok(false, "body.querySelectorAll("" + selectors[i] + "" did not throw exception"); + }catch(e) { + if(v < 9) + ok(e.number === 0x70057 - 0x80000000, "body.querySelectorAll("" + selectors[i] + "" threw " + e.number); + else { + todo_wine. + ok(e.name === (v < 10 ? undefined : "SyntaxError"), "body.querySelectorAll("" + selectors[i] + "" threw " + e.name); + } + } + } + + if(!body.msMatchesSelector) + return; + + for(i = 0; i < selectors.length; i++) { + try { + body.msMatchesSelector(selectors[i]); + ok(false, "body.msMatchesSelector("" + selectors[i] + "" did not throw exception"); + }catch(e) { + if(v < 9) + ok(e.number === 0x70057 - 0x80000000, "body.msMatchesSelector("" + selectors[i] + "" threw " + e.number); + else { + todo_wine. + ok(e.name === (v < 10 ? undefined : "SyntaxError"), "body.msMatchesSelector("" + selectors[i] + "" threw " + e.name); + } + } + } +}); + sync_test("__proto__", function() { var v = document.documentMode; var r, x = 42;
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/olecmd.c | 4 ---- dlls/mshtml/oleobj.c | 16 ++++++++-------- dlls/mshtml/persist.c | 8 -------- dlls/mshtml/view.c | 2 +- 4 files changed, 9 insertions(+), 21 deletions(-)
diff --git a/dlls/mshtml/olecmd.c b/dlls/mshtml/olecmd.c index a77019fd401..abce6923567 100644 --- a/dlls/mshtml/olecmd.c +++ b/dlls/mshtml/olecmd.c @@ -991,8 +991,6 @@ static HRESULT WINAPI DocObjOleCommandTarget_QueryStatus(IOleCommandTarget *ifac { HTMLDocumentObj *This = HTMLDocumentObj_from_IOleCommandTarget(iface);
- if(!This->doc_node) - return E_UNEXPECTED; return IOleCommandTarget_QueryStatus(&This->doc_node->IOleCommandTarget_iface, pguidCmdGroup, cCmds, prgCmds, pCmdText); } @@ -1002,8 +1000,6 @@ static HRESULT WINAPI DocObjOleCommandTarget_Exec(IOleCommandTarget *iface, cons { HTMLDocumentObj *This = HTMLDocumentObj_from_IOleCommandTarget(iface);
- if(!This->doc_node) - return E_UNEXPECTED; return IOleCommandTarget_Exec(&This->doc_node->IOleCommandTarget_iface, pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); } diff --git a/dlls/mshtml/oleobj.c b/dlls/mshtml/oleobj.c index a8bd5751b49..c6bf8381781 100644 --- a/dlls/mshtml/oleobj.c +++ b/dlls/mshtml/oleobj.c @@ -2169,37 +2169,37 @@ static HRESULT WINAPI DocObj##iface##_Invoke(I##iface *_0, DISPID dispIdMember, #define HTMLDOCUMENTOBJ_FWD_TO_NODE_0(iface, method) static HRESULT WINAPI DocObj##iface##_##method(I##iface *_0) \ { \ HTMLDocumentObj *This = CONTAINING_RECORD(_0, HTMLDocumentObj, I##iface##_iface); \ - return This->doc_node ? This->doc_node->I##iface##_iface.lpVtbl->method(&This->doc_node->I##iface##_iface) : E_UNEXPECTED; \ + return This->doc_node->I##iface##_iface.lpVtbl->method(&This->doc_node->I##iface##_iface); \ }
#define HTMLDOCUMENTOBJ_FWD_TO_NODE_1(iface, method, a) static HRESULT WINAPI DocObj##iface##_##method(I##iface *_0, a _1) \ { \ HTMLDocumentObj *This = CONTAINING_RECORD(_0, HTMLDocumentObj, I##iface##_iface); \ - return This->doc_node ? This->doc_node->I##iface##_iface.lpVtbl->method(&This->doc_node->I##iface##_iface, _1) : E_UNEXPECTED; \ + return This->doc_node->I##iface##_iface.lpVtbl->method(&This->doc_node->I##iface##_iface, _1); \ }
#define HTMLDOCUMENTOBJ_FWD_TO_NODE_2(iface, method, a,b) static HRESULT WINAPI DocObj##iface##_##method(I##iface *_0, a _1, b _2) \ { \ HTMLDocumentObj *This = CONTAINING_RECORD(_0, HTMLDocumentObj, I##iface##_iface); \ - return This->doc_node ? This->doc_node->I##iface##_iface.lpVtbl->method(&This->doc_node->I##iface##_iface, _1, _2) : E_UNEXPECTED; \ + return This->doc_node->I##iface##_iface.lpVtbl->method(&This->doc_node->I##iface##_iface, _1, _2); \ }
#define HTMLDOCUMENTOBJ_FWD_TO_NODE_3(iface, method, a,b,c) static HRESULT WINAPI DocObj##iface##_##method(I##iface *_0, a _1, b _2, c _3) \ { \ HTMLDocumentObj *This = CONTAINING_RECORD(_0, HTMLDocumentObj, I##iface##_iface); \ - return This->doc_node ? This->doc_node->I##iface##_iface.lpVtbl->method(&This->doc_node->I##iface##_iface, _1, _2, _3) : E_UNEXPECTED; \ + return This->doc_node->I##iface##_iface.lpVtbl->method(&This->doc_node->I##iface##_iface, _1, _2, _3); \ }
#define HTMLDOCUMENTOBJ_FWD_TO_NODE_4(iface, method, a,b,c,d) static HRESULT WINAPI DocObj##iface##_##method(I##iface *_0, a _1, b _2, c _3, d _4) \ { \ HTMLDocumentObj *This = CONTAINING_RECORD(_0, HTMLDocumentObj, I##iface##_iface); \ - return This->doc_node ? This->doc_node->I##iface##_iface.lpVtbl->method(&This->doc_node->I##iface##_iface, _1, _2, _3, _4) : E_UNEXPECTED; \ + return This->doc_node->I##iface##_iface.lpVtbl->method(&This->doc_node->I##iface##_iface, _1, _2, _3, _4); \ }
#define HTMLDOCUMENTOBJ_FWD_TO_NODE_5(iface, method, a,b,c,d,e) static HRESULT WINAPI DocObj##iface##_##method(I##iface *_0, a _1, b _2, c _3, d _4, e _5) \ { \ HTMLDocumentObj *This = CONTAINING_RECORD(_0, HTMLDocumentObj, I##iface##_iface); \ - return This->doc_node ? This->doc_node->I##iface##_iface.lpVtbl->method(&This->doc_node->I##iface##_iface, _1, _2, _3, _4, _5) : E_UNEXPECTED; \ + return This->doc_node->I##iface##_iface.lpVtbl->method(&This->doc_node->I##iface##_iface, _1, _2, _3, _4, _5); \ }
/********************************************************** @@ -3618,7 +3618,7 @@ static void HTMLDocumentObj_on_advise(IUnknown *iface, cp_static_data_t *cp) { HTMLDocumentObj *This = impl_from_IUnknown(iface);
- if(This->window && This->doc_node) + if(This->window) update_doc_cp_events(This->doc_node, cp); }
@@ -3704,7 +3704,7 @@ static HRESULT create_document_object(BOOL is_mhtml, IUnknown *outer, REFIID rii doc->window = doc->nscontainer->content_window; IHTMLWindow2_AddRef(&doc->window->base.IHTMLWindow2_iface);
- if(!doc->doc_node && doc->window->base.inner_window->doc) { + if(!doc->doc_node) { doc->doc_node = doc->window->base.inner_window->doc; IHTMLDOMNode_AddRef(&doc->doc_node->node.IHTMLDOMNode_iface); } diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c index 8d8f0a36bc2..81e5ff8cb04 100644 --- a/dlls/mshtml/persist.c +++ b/dlls/mshtml/persist.c @@ -1008,10 +1008,6 @@ static HRESULT WINAPI DocObjPersistFile_Save(IPersistFile *iface, LPCOLESTR pszF { HTMLDocumentObj *This = HTMLDocumentObj_from_IPersistFile(iface);
- if(!This->doc_node) { - FIXME("No doc_node\n"); - return E_UNEXPECTED; - } return IPersistFile_Save(&This->doc_node->IPersistFile_iface, pszFileName, fRemember); }
@@ -1202,10 +1198,6 @@ static HRESULT WINAPI DocObjPersistStreamInit_Save(IPersistStreamInit *iface, IS { HTMLDocumentObj *This = HTMLDocumentObj_from_IPersistStreamInit(iface);
- if(!This->doc_node) { - FIXME("No doc_node\n"); - return E_UNEXPECTED; - } return IPersistStreamInit_Save(&This->doc_node->IPersistStreamInit_iface, pStm, fClearDirty); }
diff --git a/dlls/mshtml/view.c b/dlls/mshtml/view.c index eaf3a822c2b..6867c7abcff 100644 --- a/dlls/mshtml/view.c +++ b/dlls/mshtml/view.c @@ -446,7 +446,7 @@ static void send_unload_events_impl(HTMLInnerWindow *window)
static void send_unload_events(HTMLDocumentObj *doc) { - if(!doc->doc_node || !doc->window || !doc->doc_node->content_ready) + if(!doc->window || !doc->doc_node->content_ready) return;
send_unload_events_impl(doc->window->base.inner_window);
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- include/mshtmdid.h | 16 +++++++ include/mshtml.idl | 111 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+)
diff --git a/include/mshtmdid.h b/include/mshtmdid.h index 6260083aaf4..0e95a7d7165 100644 --- a/include/mshtmdid.h +++ b/include/mshtmdid.h @@ -105,6 +105,7 @@ #define DISPID_NAMESPACE DISPID_NORMAL_FIRST #define DISPID_TAGNAMES_COLLECTION DISPID_NORMAL_FIRST #define DISPID_XMLHTTPREQUEST DISPID_NORMAL_FIRST +#define DISPID_XDOMAINREQUEST DISPID_NORMAL_FIRST #define DISPID_DOMPARSER DISPID_NORMAL_FIRST #define DISPID_DOCUMENTCOMPATIBLEINFO_COLLECTION DISPID_NORMAL_FIRST #define DISPID_DOCUMENTCOMPATIBLEINFO DISPID_NORMAL_FIRST @@ -3085,6 +3086,18 @@ #define DISPID_IHTMLXMLHTTPREQUEST2_TIMEOUT DISPID_XMLHTTPREQUEST+15 #define DISPID_IHTMLXMLHTTPREQUEST2_ONTIMEOUT DISPID_EVPROP_TIMEOUT
+/* IHTMLXDomainRequest */ +#define DISPID_IHTMLXDOMAINREQUEST_RESPONSETEXT DISPID_XDOMAINREQUEST+3 +#define DISPID_IHTMLXDOMAINREQUEST_TIMEOUT DISPID_XDOMAINREQUEST+4 +#define DISPID_IHTMLXDOMAINREQUEST_CONTENTTYPE DISPID_XDOMAINREQUEST+5 +#define DISPID_IHTMLXDOMAINREQUEST_ONPROGRESS DISPID_XDOMAINREQUEST+6 +#define DISPID_IHTMLXDOMAINREQUEST_ONERROR DISPID_EVPROP_ONERROR +#define DISPID_IHTMLXDOMAINREQUEST_ONTIMEOUT DISPID_EVPROP_TIMEOUT +#define DISPID_IHTMLXDOMAINREQUEST_ONLOAD DISPID_EVPROP_ONLOAD +#define DISPID_IHTMLXDOMAINREQUEST_ABORT DISPID_XDOMAINREQUEST+10 +#define DISPID_IHTMLXDOMAINREQUEST_OPEN DISPID_XDOMAINREQUEST+11 +#define DISPID_IHTMLXDOMAINREQUEST_SEND DISPID_XDOMAINREQUEST+12 + /* ISVGAnimatedEnumeration */ #define DISPID_ISVGANIMATEDENUMERATION_BASEVAL DISPID_SVGANIMATEDENUMERATION #define DISPID_ISVGANIMATEDENUMERATION_ANIMVAL DISPID_SVGANIMATEDENUMERATION+1 @@ -3344,6 +3357,9 @@ #define DISPID_HTMLXMLHTTPREQUESTEVENTS_ONTIMEOUT DISPID_XMLHTTPREQUEST+16 #define DISPID_HTMLXMLHTTPREQUESTEVENTS_ONREADYSTATECHANGE DISPID_XMLHTTPREQUEST+8
+/* IHTMLXDomainRequestFactory */ +#define DISPID_IHTMLXDOMAINREQUESTFACTORY_CREATE DISPID_VALUE + /* IOmHistory */ #define DISPID_IOMHISTORY_LENGTH DISPID_HISTORY #define DISPID_IOMHISTORY_BACK (DISPID_HISTORY+1) diff --git a/include/mshtml.idl b/include/mshtml.idl index 8c5fa25f75b..eff87a4593e 100644 --- a/include/mshtml.idl +++ b/include/mshtml.idl @@ -14092,6 +14092,117 @@ coclass HTMLXMLHttpRequest interface IEventTarget; }
+/***************************************************************************** + * IHTMLXDomainRequest interface + */ +[ + odl, + oleautomation, + dual, + uuid(30510454-98b5-11cf-bb82-00aa00bdce0b) +] +interface IHTMLXDomainRequest : IDispatch +{ + [propget, id(DISPID_IHTMLXDOMAINREQUEST_RESPONSETEXT)] + HRESULT responseText([out, retval] BSTR *p); + + [propput, id(DISPID_IHTMLXDOMAINREQUEST_TIMEOUT)] + HRESULT timeout([in] LONG v); + + [propget, id(DISPID_IHTMLXDOMAINREQUEST_TIMEOUT)] + HRESULT timeout([out, retval] LONG *p); + + [propget, id(DISPID_IHTMLXDOMAINREQUEST_CONTENTTYPE)] + HRESULT contentType([out, retval] BSTR *p); + + [propput, id(DISPID_IHTMLXDOMAINREQUEST_ONPROGRESS)] + HRESULT onprogress([in] VARIANT v); + + [propget, id(DISPID_IHTMLXDOMAINREQUEST_ONPROGRESS)] + HRESULT onprogress([out, retval] VARIANT *p); + + [propput, id(DISPID_IHTMLXDOMAINREQUEST_ONERROR)] + HRESULT onerror([in] VARIANT v); + + [propget, id(DISPID_IHTMLXDOMAINREQUEST_ONERROR)] + HRESULT onerror([out, retval] VARIANT *p); + + [propput, id(DISPID_IHTMLXDOMAINREQUEST_ONTIMEOUT)] + HRESULT ontimeout([in] VARIANT v); + + [propget, id(DISPID_IHTMLXDOMAINREQUEST_ONTIMEOUT)] + HRESULT ontimeout([out, retval] VARIANT *p); + + [propput, id(DISPID_IHTMLXDOMAINREQUEST_ONLOAD)] + HRESULT onload([in] VARIANT v); + + [propget, id(DISPID_IHTMLXDOMAINREQUEST_ONLOAD)] + HRESULT onload([out, retval] VARIANT *p); + + [id(DISPID_IHTMLXDOMAINREQUEST_ABORT)] + HRESULT abort(); + + [id(DISPID_IHTMLXDOMAINREQUEST_OPEN)] + HRESULT open([in] BSTR bstrMethod, [in] BSTR bstrUrl); + + [id(DISPID_IHTMLXDOMAINREQUEST_SEND)] + HRESULT send([in, optional] VARIANT varBody); +}; + +/***************************************************************************** + * IHTMLXDomainRequestFactory interface + */ +[ + odl, + oleautomation, + dual, + uuid(30510456-98b5-11cf-bb82-00aa00bdce0b) +] +interface IHTMLXDomainRequestFactory : IDispatch +{ + [id(DISPID_IHTMLXDOMAINREQUESTFACTORY_CREATE)] + HRESULT create([out, retval] IHTMLXDomainRequest **p); +}; + +/***************************************************************************** + * DispXDomainRequest dispinterface + */ +[ + hidden, + uuid(3050f599-98b5-11cf-bb82-00aa00bdce0b) +] +dispinterface DispXDomainRequest +{ +properties: +methods: + WINE_IHTMLDOMCONSTRUCTOR_DISPINTERFACE_DECL; +}; + +/***************************************************************************** + * XDomainRequest + */ +[ + noncreatable, + uuid(30510455-98b5-11cf-bb82-00aa00bdce0b) +] +coclass XDomainRequest +{ + [default] dispinterface DispXDomainRequest; + interface IHTMLDOMConstructor; +}; + +/***************************************************************************** + * XDomainRequestFactory + */ +[ + noncreatable, + uuid(30510457-98b5-11cf-bb82-00aa00bdce0b) +] +coclass XDomainRequestFactory +{ + [default] interface IHTMLXDomainRequestFactory; +}; + /***************************************************************************** * IHTMLControlElement interface */
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=126755
Your paranoid android.
=== w7u_el (testbot log) ===
WineRunTask.pl:error: The previous 1 run(s) terminated abnormally
On Thu Nov 24 16:44:04 2022 +0000, Gabriel Ivăncescu wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/1526/diffs?diff_id=20861&start_sha=fc100120dee69f35ad7587770040a7c6c1b5d2fa#9d819eff9f6a881e42fda045a8922ae92db95251_62_62)
As far as I can see, the `load_nsuri` from `navigate_uri` (which is the one we need) has NULL bsc, so that can't work, since there's nowhere to set it before we hand it off to Gecko to callback into.
That said I found a way to pass it the correct "reload" load type and retrieve it later so we can use that (note that loadTypeRefresh didn't work, not sure what it does). Not 100% sure if it's correct but… I think it's the cleanest way, so I hope it is.
I also split up the editmode change into separate patch and cleaned up some checks since it's actually treated as a reload anyway.
Jacek Caban (@jacek) commented about dlls/mshtml/htmlimg.c:
HRESULT hres;
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
nsAString_Init(&src_str, NULL);
nsres = nsIDOMHTMLImageElement_GetSrc(This->nsimg, &src_str);
if(NS_SUCCEEDED(nsres)) {
const PRUnichar *src;
DOMEvent *event;
VARIANT_BOOL b;
BOOL same;
nsAString_GetData(&src_str, &src);
same = !wcscmp(v, src);
nsAString_Finish(&src_str);
if(same) {
This looks suspicious, the image could have changed on the server and the test is not really convincing. One way to explain what you see in tests would be that we should start loading immediately and finish immediately if the image from http protocol is cached. One hint that it's the case is in onerror tests: `pump_msgs(&called_img_onerror); /* FIXME: should not be needed */`.
Jacek Caban (@jacek) commented about dlls/mshtml/htmllocation.c:
static HRESULT WINAPI HTMLLocation_reload(IHTMLLocation *iface, VARIANT_BOOL flag) { HTMLLocation *This = impl_from_IHTMLLocation(iface);
- FIXME("(%p)->(%x)\n", This, flag);
- return E_NOTIMPL;
- TRACE("(%p)->(%x)\n", This, flag);
- if(!This->window || !This->window->doc) {
FIXME("No window available\n");
return E_FAIL;
- }
- /* reload is supposed to fail if called from a script with different origin, but IE doesn't care */
- if(This->window->doc != This->window->doc->browser->doc->doc_node) {
This could use `is_main_content_window()`.
On Fri Nov 25 10:53:39 2022 +0000, Jacek Caban wrote:
This looks suspicious, the image could have changed on the server and the test is not really convincing. One way to explain what you see in tests would be that we should start loading immediately and finish immediately if the image from http protocol is cached. One hint that it's the case is in onerror tests: `pump_msgs(&called_img_onerror); /* FIXME: should not be needed */`.
Yes, I think that's the case, but I'm not sure how to check if it's cached.
On Fri Nov 25 14:35:40 2022 +0000, Gabriel Ivăncescu wrote:
Yes, I think that's the case, but I'm not sure how to check if it's cached.
My guess that you shouldn't explicitly check it here, but rather try to load it as usual and urlmon+wininet should simply return data immediately if it's cached. For this to work properly with http protocol, we'd need support for that in wininet first. Note that in case for the referenced bug, it's a local file, so http protocol and caching itself is not relevant.
On Fri Nov 25 15:05:35 2022 +0000, Jacek Caban wrote:
My guess that you shouldn't explicitly check it here, but rather try to load it as usual and urlmon+wininet should simply return data immediately if it's cached. For this to work properly with http protocol, we'd need support for that in wininet first. Note that in case for the referenced bug, it's a local file, so http protocol and caching itself is not relevant.
Even with the test itself having the image in http url (and thus http protocol should be used, right?), I see no HttpProtocol_* methods traced from urlmon, and it's just a bunch of URI stuff that's called, but that's it. I don't see where I can tell it to load it immediately.
Not sure how I'm supposed to intercept that to even begin to see what I can change. I do see that wine-gecko has some checks for "same URI" in LoadImage, but they're not used because image element always passes "force" to load it even if it's the same.
But the rest of gecko's code I followed seems to use its own cache, so idk how to go about overriding that…
But since this is kinda of complicated and I'll need more time to analyze and think about it, I'll remove this patch from the MR for now, so the others can get in, at least.