-- v7: mshtml/tests: Accept rare return value from ReportResult on native. mshtml: Implement EmulateIE* modes for X-UA-Compatible. mshtml: Don't return default ports from location.host in IE10+ modes. mshtml: Avoid calling remove_target_tasks needlessly.
From: Gabriel Ivăncescu gabrielopcode@gmail.com
It's already called by abort_window_bindings.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmlwindow.c | 1 - dlls/mshtml/oleobj.c | 2 -- dlls/mshtml/persist.c | 2 -- 3 files changed, 5 deletions(-)
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 30ad3e0fd0d..ccb593724d4 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -135,7 +135,6 @@ static void detach_inner_window(HTMLInnerWindow *window) dispex_props_unlink(&outer_window->location->dispex);
abort_window_bindings(window); - remove_target_tasks(window->task_magic); release_script_hosts(window); unlink_ref(&window->jscript); window->base.outer_window = NULL; diff --git a/dlls/mshtml/oleobj.c b/dlls/mshtml/oleobj.c index 2374ce0ea81..7dffdbeeec2 100644 --- a/dlls/mshtml/oleobj.c +++ b/dlls/mshtml/oleobj.c @@ -3441,8 +3441,6 @@ static void set_window_uninitialized(HTMLOuterWindow *window) if(SUCCEEDED(hres)) { channelbsc->bsc.bindf = 0; /* synchronous binding */
- if(window->base.inner_window->doc) - remove_target_tasks(window->base.inner_window->task_magic); abort_window_bindings(window->base.inner_window); window->base.inner_window->doc->unload_sent = TRUE;
diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c index bea2ab65750..5d55dac6826 100644 --- a/dlls/mshtml/persist.c +++ b/dlls/mshtml/persist.c @@ -381,8 +381,6 @@ HRESULT set_moniker(HTMLOuterWindow *window, IMoniker *mon, IUri *nav_uri, IBind hres = create_channelbsc(mon, NULL, NULL, 0, TRUE, &bscallback);
if(SUCCEEDED(hres)) { - if(window->base.inner_window->doc) - remove_target_tasks(window->base.inner_window->task_magic); abort_window_bindings(window->base.inner_window);
hres = load_nsuri(window, nsuri, NULL, bscallback, LOAD_FLAGS_BYPASS_CACHE);
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmllocation.c | 16 ++++++++++++++++ dlls/mshtml/tests/documentmode.js | 3 +++ 2 files changed, 19 insertions(+)
diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c index 5c7e66c40df..b176b56280c 100644 --- a/dlls/mshtml/htmllocation.c +++ b/dlls/mshtml/htmllocation.c @@ -225,12 +225,28 @@ static HRESULT WINAPI HTMLLocation_get_host(IHTMLLocation *iface, BSTR *p) HTMLLocation *This = impl_from_IHTMLLocation(iface); URL_COMPONENTSW url = {sizeof(URL_COMPONENTSW)}; HRESULT hres; + IUri *uri;
TRACE("(%p)->(%p)\n", This, p);
if(!p) return E_POINTER;
+ if(dispex_compat_mode(&This->window->base.inner_window->event_target.dispex) >= COMPAT_MODE_IE10) { + if(!(uri = get_uri(This))) { + *p = NULL; + return S_OK; + } + + hres = IUri_GetAuthority(uri, p); + if(hres == S_OK || FAILED(hres)) + return hres; + + SysFreeString(*p); + *p = NULL; + return S_OK; + } + url.dwHostNameLength = 1; hres = get_url_components(This, &url); if(FAILED(hres)) diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 97941bb81c2..7fdf510ddd7 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -1184,8 +1184,11 @@ async_test("script_load", function() { });
sync_test("location", function() { + var v = document.documentMode; document.body.innerHTML = '<a name="testanchor">test</a>';
+ ok(location.host === "winetest.example.org" + (v < 10 ? ":80" : ""), "location.host = " + location.host); + ok(location.hash === "", "initial location.hash = " + location.hash); location.hash = "TestAnchor"; ok(location.hash === "#TestAnchor", "location.hash after set to TestAnchor = " + location.hash);
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Despite what MSDN says it appears that EmulateIE10 and EmulateIE11 don't care about DOCTYPE validity at all (same as IE=10 and IE=11).
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/mutation.c | 63 +++++++++++++++++++++++++----------- dlls/mshtml/tests/dom.c | 22 +++++++++++++ 3 files changed, 68 insertions(+), 18 deletions(-)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index e63a05f4314..d97a206b215 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -1128,6 +1128,7 @@ struct HTMLDocumentNode {
nsIDOMDocument *dom_document; nsIDOMHTMLDocument *html_document; + unsigned int emulate_mode : 1; unsigned int content_ready : 1; unsigned int unload_sent : 1;
diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c index 3c1a25646db..d8c0cb50b10 100644 --- a/dlls/mshtml/mutation.c +++ b/dlls/mshtml/mutation.c @@ -414,19 +414,28 @@ DWORD get_compat_mode_version(compat_mode_t compat_mode) */ compat_mode_t lock_document_mode(HTMLDocumentNode *doc) { - TRACE("%p: %d\n", doc, doc->document_mode); - if(!doc->document_mode_locked) { doc->document_mode_locked = TRUE;
+ if(doc->emulate_mode && doc->document_mode < COMPAT_MODE_IE10) { + nsIDOMDocumentType *nsdoctype; + + if(NS_SUCCEEDED(nsIDOMDocument_GetDoctype(doc->dom_document, &nsdoctype)) && nsdoctype) + nsIDOMDocumentType_Release(nsdoctype); + else + doc->document_mode = COMPAT_MODE_QUIRKS; + } + if(doc->html_document) nsIDOMHTMLDocument_SetIECompatMode(doc->html_document, get_compat_mode_version(doc->document_mode)); }
+ TRACE("%p: %d\n", doc, doc->document_mode); + return doc->document_mode; }
-static void set_document_mode(HTMLDocumentNode *doc, compat_mode_t document_mode, BOOL lock) +static void set_document_mode(HTMLDocumentNode *doc, compat_mode_t document_mode, BOOL emulate_mode, BOOL lock) { compat_mode_t max_compat_mode;
@@ -447,6 +456,7 @@ static void set_document_mode(HTMLDocumentNode *doc, compat_mode_t document_mode }
doc->document_mode = document_mode; + doc->emulate_mode = emulate_mode; if(lock) lock_document_mode(doc); } @@ -489,34 +499,44 @@ const WCHAR *parse_compat_version(const WCHAR *version_string, compat_mode_t *r) return p; }
-static BOOL parse_ua_compatible(const WCHAR *p, compat_mode_t *r) +static compat_mode_t parse_ua_compatible(const WCHAR *p, BOOL *emulate_mode) { + static const WCHAR emulateIEW[] = {'E','m','u','l','a','t','e','I','E'}; static const WCHAR ie_eqW[] = {'I','E','='}; static const WCHAR edgeW[] = {'e','d','g','e'}; - compat_mode_t mode = COMPAT_MODE_INVALID; + compat_mode_t parsed_mode, mode = COMPAT_MODE_INVALID; + *emulate_mode = FALSE;
TRACE("%s\n", debugstr_w(p));
if(wcsnicmp(ie_eqW, p, ARRAY_SIZE(ie_eqW))) - return FALSE; + return mode; p += 3;
do { + BOOL is_emulate = FALSE; + while(iswspace(*p)) p++; if(!wcsnicmp(p, edgeW, ARRAY_SIZE(edgeW))) { p += ARRAY_SIZE(edgeW); if(is_ua_compatible_delimiter(*p)) mode = COMPAT_MODE_IE11; break; - }else if(!(p = parse_compat_version(p, r))) + } + if(!wcsnicmp(p, emulateIEW, ARRAY_SIZE(emulateIEW))) { + p += ARRAY_SIZE(emulateIEW); + is_emulate = TRUE; + } + if(!(p = parse_compat_version(p, &parsed_mode))) break; - if(mode < *r) - mode = *r; + if(mode < parsed_mode) { + mode = parsed_mode; + *emulate_mode = is_emulate; + } while(iswspace(*p)) p++; } while(*p++ == ',');
- *r = mode; - return mode != COMPAT_MODE_INVALID; + return mode; }
void process_document_response_headers(HTMLDocumentNode *doc, IBinding *binding) @@ -537,14 +557,19 @@ void process_document_response_headers(HTMLDocumentNode *doc, IBinding *binding) hres = IWinInetHttpInfo_QueryInfo(http_info, HTTP_QUERY_CUSTOM, buf, &size, NULL, NULL); if(hres == S_OK && size) { compat_mode_t document_mode; + BOOL emulate_mode; WCHAR *header;
TRACE("size %lu\n", size);
header = strdupAtoW(buf); - if(header && parse_ua_compatible(header, &document_mode)) { - TRACE("setting document mode %d\n", document_mode); - set_document_mode(doc, document_mode, FALSE); + if(header) { + document_mode = parse_ua_compatible(header, &emulate_mode); + + if(document_mode != COMPAT_MODE_INVALID) { + TRACE("setting document mode %d\n", document_mode); + set_document_mode(doc, document_mode, emulate_mode, FALSE); + } } free(header); } @@ -572,9 +597,11 @@ static void process_meta_element(HTMLDocumentNode *doc, nsIDOMHTMLMetaElement *m TRACE("%s: %s\n", debugstr_w(http_equiv), debugstr_w(content));
if(!wcsicmp(http_equiv, L"x-ua-compatible")) { - compat_mode_t document_mode; - if(parse_ua_compatible(content, &document_mode)) - set_document_mode(doc, document_mode, TRUE); + BOOL emulate_mode; + compat_mode_t document_mode = parse_ua_compatible(content, &emulate_mode); + + if(document_mode != COMPAT_MODE_INVALID) + set_document_mode(doc, document_mode, emulate_mode, TRUE); else FIXME("Unsupported document mode %s\n", debugstr_w(content)); } @@ -907,7 +934,7 @@ static void NSAPI nsDocumentObserver_BindToDocument(nsIDocumentObserver *iface, mode = COMPAT_MODE_IE11; }
- set_document_mode(This, mode, FALSE); + set_document_mode(This, mode, FALSE, FALSE); nsIDOMDocumentType_Release(nsdoctype); } } diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 8383f167cdd..0ff11a74d01 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -11836,6 +11836,10 @@ static void test_quirks_mode(void) " <meta http-equiv="x-ua-compatible" content="IE=%s" />" "</head><body></body></html>", tests[i].str); run_domtest(buf, test_document_mode); + sprintf(buf, "<html><head>" + " <meta http-equiv="x-ua-compatible" content="IE=%s" />" + "</head><body></body></html>", tests[i].str); + run_domtest(buf, test_document_mode); }
expected_document_mode = 8; @@ -11848,6 +11852,24 @@ static void test_quirks_mode(void) " <body>" " </body>" "</html>", test_document_mode); + + for(i = 7; i <= 11; i++) { + char buf[128]; + expected_document_mode = i; + sprintf(buf, "<!DOCTYPE html>\n<html><head>" + " <meta http-equiv="x-ua-compatible" content="IE=EmulateIE%u" />" + "</head><body></body></html>", i); + run_domtest(buf, test_document_mode); + expected_document_mode = i < 10 ? 5 : i; + sprintf(buf, "<html><head>" + " <meta http-equiv="x-ua-compatible" content="IE=EmulateIE%u" />" + "</head><body></body></html>", i); + run_domtest(buf, test_document_mode); + sprintf(buf, "<html><head>" + " <meta http-equiv="x-ua-compatible" content="IE=eMulaTeie%u" />" + "</head><body></body></html>", i); + run_domtest(buf, test_document_mode); + } }
static void test_document_mode_lock(void)
From: Gabriel Ivăncescu gabrielopcode@gmail.com
events.c already has it.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/tests/script.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/mshtml/tests/script.c b/dlls/mshtml/tests/script.c index e6acf5ae5b1..88831bc66c1 100644 --- a/dlls/mshtml/tests/script.c +++ b/dlls/mshtml/tests/script.c @@ -4289,7 +4289,7 @@ static void report_data(ProtocolHandler *This) ok(hres == S_OK, "ReportData failed: %08lx\n", hres);
hres = IInternetProtocolSink_ReportResult(This->sink, S_OK, 0, NULL); - ok(hres == S_OK, "ReportResult failed: %08lx\n", hres); + ok(hres == S_OK || broken(hres == 0x80ef0001), "ReportResult failed: %08lx\n", hres); }
typedef struct js_stream_t {
Ok I removed that patch from this MR, since it will be split anyway and will send a new MR.
This merge request was approved by Jacek Caban.
On Fri Aug 16 16:49:19 2024 +0000, Gabriel Ivăncescu wrote:
Why do you need to store an info if a timer was blocked? All you need
to know is if there are any timers that need to be processed, for which comparing time stamps would be enough. Well without that we'd get spurious SetTimer calls even if the timer wasn't actually killed, which will happen a lot (on every task almost in common case). Is that fine? I didn't want to mess with the original timer. I wasn't sure if it loses resolution or something. e.g. timer in 50ms, we process a task that takes 2ms (probably more than usual already), then we SetTimer again on it because list isn't empty, possibly back to 50ms? (depends on tick count granularity). With the patch the timer was never killed so it won't SetTimer on it.
I don't think it has to be done in this MR and I'm sure it doesn't
need to be a massive single commit. It looks questionable in its current form, but I didn't look deeper into that. I could split it but it is necessary unfortunately. Note that for the tests to pass we already need to do it at least in `run_end_load` since it's one of the tests (the 1005 OnChanged notification). The reason is that it's called by gecko callback (via AddScriptRunner) and not from our msg loop.
We probably want to treat script runner like the other task processing, which would mean blocking task processing from `IRunnable::Run` or something like that.