[PATCH v2 0/8] MR6039: jscript: Add support for host functions.
And use new bindings for more MSHTML objects. -- v2: mshtml: Use host object script bindings for Performance class. mshtml: Use host object script bindings for PerformanceTiming class. mshtml: Use host object script bindings for PerformanceNavigation class. mshtml: Use host object script bindings for History class. mshtml: Use host object script bindings for DOMImplementation class. mshtml/tests: Make todo_wine explicit in builtin_toString tests. jscript: Add support for host functions. https://gitlab.winehq.org/wine/wine/-/merge_requests/6039
From: Jacek Caban <jacek(a)codeweavers.com> Based on patch by Gabriel Ivăncescu. --- dlls/jscript/function.c | 45 +++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index 27678fc167c..23b1308cbc0 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -312,6 +312,30 @@ static HRESULT Function_get_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t return S_OK; } +static HRESULT native_function_string(const WCHAR *name, jsstr_t **ret) +{ + DWORD name_len; + jsstr_t *str; + WCHAR *ptr; + + static const WCHAR native_prefixW[] = L"\nfunction "; + static const WCHAR native_suffixW[] = L"() {\n [native code]\n}\n"; + + name_len = name ? lstrlenW(name) : 0; + str = jsstr_alloc_buf(ARRAY_SIZE(native_prefixW) + ARRAY_SIZE(native_suffixW) + name_len - 2, &ptr); + if(!str) + return E_OUTOFMEMORY; + + memcpy(ptr, native_prefixW, sizeof(native_prefixW)); + ptr += ARRAY_SIZE(native_prefixW) - 1; + memcpy(ptr, name, name_len * sizeof(WCHAR)); + ptr += name_len; + memcpy(ptr, native_suffixW, sizeof(native_suffixW)); + + *ret = str; + return S_OK; +} + static HRESULT Function_toString(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) { @@ -669,26 +693,7 @@ static HRESULT NativeFunction_call(script_ctx_t *ctx, FunctionInstance *func, js static HRESULT NativeFunction_toString(FunctionInstance *func, jsstr_t **ret) { NativeFunction *function = (NativeFunction*)func; - DWORD name_len; - jsstr_t *str; - WCHAR *ptr; - - static const WCHAR native_prefixW[] = L"\nfunction "; - static const WCHAR native_suffixW[] = L"() {\n [native code]\n}\n"; - - name_len = function->name ? lstrlenW(function->name) : 0; - str = jsstr_alloc_buf(ARRAY_SIZE(native_prefixW) + ARRAY_SIZE(native_suffixW) + name_len - 2, &ptr); - if(!str) - return E_OUTOFMEMORY; - - memcpy(ptr, native_prefixW, sizeof(native_prefixW)); - ptr += ARRAY_SIZE(native_prefixW) - 1; - memcpy(ptr, function->name, name_len*sizeof(WCHAR)); - ptr += name_len; - memcpy(ptr, native_suffixW, sizeof(native_suffixW)); - - *ret = str; - return S_OK; + return native_function_string(function->name, ret); } static function_code_t *NativeFunction_get_code(FunctionInstance *function) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/6039
From: Jacek Caban <jacek(a)codeweavers.com> Based on patch by Gabriel Ivăncescu. --- dlls/jscript/dispex.c | 36 ++++++++++-- dlls/jscript/function.c | 121 ++++++++++++++++++++++++++++++++++++++++ dlls/jscript/jscript.h | 1 + dlls/jscript/jsdisp.idl | 1 + dlls/mshtml/dispex.c | 7 ++- 5 files changed, 160 insertions(+), 6 deletions(-) diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index 26d89ab2b5e..dbdc64659a8 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -268,6 +268,28 @@ static dispex_prop_t *lookup_dispex_prop(jsdisp_t *obj, unsigned hash, const WCH return NULL; } +static HRESULT update_external_prop(jsdisp_t *obj, dispex_prop_t *prop, const struct property_info *desc) +{ + if(desc->func_iid) { + jsdisp_t *func; + HRESULT hres; + + hres = create_host_function(obj->ctx, desc, &func); + if(FAILED(hres)) + return hres; + + prop->type = PROP_JSVAL; + prop->flags = desc->flags; + prop->u.val = jsval_obj(func); + return S_OK; + } + + prop->type = PROP_EXTERN; + prop->flags = desc->flags; + prop->u.id = desc->id; + return S_OK; +} + static HRESULT find_external_prop(jsdisp_t *This, const WCHAR *name, BOOL case_insens, dispex_prop_t **ret) { dispex_prop_t *prop; @@ -282,13 +304,13 @@ static HRESULT find_external_prop(jsdisp_t *This, const WCHAR *name, BOOL case_i if(FAILED(hres)) return hres; - prop = alloc_prop(This, desc.name ? desc.name : name, PROP_EXTERN, desc.flags); + prop = alloc_prop(This, desc.name ? desc.name : name, PROP_DELETED, 0); if(!prop) return E_OUTOFMEMORY; - prop->u.id = desc.id; + hres = update_external_prop(This, prop, &desc); *ret = prop; - return S_OK; + return hres; } } @@ -427,6 +449,7 @@ HRESULT jsdisp_index_lookup(jsdisp_t *obj, const WCHAR *name, unsigned length, s desc->flags |= PROPF_WRITABLE; desc->name = NULL; desc->index = idx; + desc->func_iid = 0; return S_OK; } @@ -440,6 +463,7 @@ HRESULT jsdisp_next_index(jsdisp_t *obj, unsigned length, unsigned id, struct pr desc->flags |= PROPF_WRITABLE; desc->name = NULL; desc->index = desc->id; + desc->func_iid = 0; return S_OK; } @@ -685,10 +709,12 @@ static HRESULT fill_props(jsdisp_t *obj) prop = lookup_dispex_prop(obj, string_hash(desc.name), desc.name, FALSE); if(!prop) { - prop = alloc_prop(obj, desc.name, PROP_EXTERN, desc.flags); + prop = alloc_prop(obj, desc.name, PROP_DELETED, 0); if(!prop) return E_OUTOFMEMORY; - prop->u.id = desc.id; + hres = update_external_prop(obj, prop, &desc); + if(FAILED(hres)) + return hres; } id = desc.id; } diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index 23b1308cbc0..40ff015121b 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -63,6 +63,13 @@ typedef struct { jsval_t args[1]; } BindFunction; +typedef struct { + FunctionInstance function; + const WCHAR *name; + UINT32 id; + UINT32 iid; +} HostFunction; + typedef struct { jsdisp_t jsdisp; jsval_t *buf; @@ -918,6 +925,120 @@ HRESULT create_source_function(script_ctx_t *ctx, bytecode_t *code, function_cod return S_OK; } +static const builtin_info_t HostFunction_info = { + .class = JSCLASS_FUNCTION, + .call = Function_value, + .destructor = Function_destructor, + .gc_traverse = Function_gc_traverse +}; + +static HRESULT HostFunction_call(script_ctx_t *ctx, FunctionInstance *func, jsval_t vthis, unsigned flags, + unsigned argc, jsval_t *argv, jsval_t *r) +{ + HostFunction *function = (HostFunction*)func; + VARIANT buf[6], retv; + DISPPARAMS dp = { .cArgs = argc, .rgvarg = buf }; + IWineJSDispatchHost *obj; + EXCEPINFO ei = { 0 }; + IDispatch *this_obj; + HRESULT hres = S_OK; + unsigned i; + + if(flags & DISPATCH_CONSTRUCT) + return E_UNEXPECTED; + + if(is_object_instance(vthis)) + this_obj = get_object(vthis); + else if(is_undefined(vthis) || is_null(vthis)) + this_obj = lookup_global_host(ctx); + else + return E_UNEXPECTED; + + obj = get_host_dispatch(this_obj); + if(!obj) { + TRACE("no host dispatch\n"); + return E_UNEXPECTED; + } + + if(argc > ARRAYSIZE(buf) && !(dp.rgvarg = malloc(argc * sizeof(*dp.rgvarg)))) { + IWineJSDispatchHost_Release(obj); + return E_OUTOFMEMORY; + } + + for(i = 0; i < argc; i++) { + hres = jsval_to_variant(argv[i], &dp.rgvarg[dp.cArgs - i - 1]); + if(FAILED(hres)) + break; + } + + if(SUCCEEDED(hres)) { + V_VT(&retv) = VT_EMPTY; + hres = IWineJSDispatchHost_CallFunction(obj, function->id, function->iid, &dp, r ? &retv : NULL, &ei, + &ctx->jscaller->IServiceProvider_iface); + if(hres == DISP_E_EXCEPTION) + handle_dispatch_exception(ctx, &ei); + if(SUCCEEDED(hres) && r) { + hres = variant_to_jsval(ctx, &retv, r); + VariantClear(&retv); + } + } + + while(i--) + VariantClear(&dp.rgvarg[dp.cArgs - i - 1]); + if(dp.rgvarg != buf) + free(dp.rgvarg); + IWineJSDispatchHost_Release(obj); + return hres; +} + +static HRESULT HostFunction_toString(FunctionInstance *func, jsstr_t **ret) +{ + HostFunction *function = (HostFunction*)func; + return native_function_string(function->name, ret); +} + +static function_code_t *HostFunction_get_code(FunctionInstance *function) +{ + return NULL; +} + +static void HostFunction_destructor(FunctionInstance *func) +{ +} + +static HRESULT HostFunction_gc_traverse(struct gc_ctx *gc_ctx, enum gc_traverse_op op, FunctionInstance *func) +{ + return S_OK; +} + +static const function_vtbl_t HostFunctionVtbl = { + HostFunction_call, + HostFunction_toString, + HostFunction_get_code, + HostFunction_destructor, + HostFunction_gc_traverse +}; + +HRESULT create_host_function(script_ctx_t *ctx, const struct property_info *desc, jsdisp_t **ret) +{ + HostFunction *function; + HRESULT hres; + + if(!ctx->function_constr) + return E_UNEXPECTED; + + hres = create_function(ctx, &HostFunction_info, &HostFunctionVtbl, sizeof(HostFunction), PROPF_METHOD, + FALSE, NULL, (void**)&function); + if(FAILED(hres)) + return hres; + + function->name = desc->name; + function->id = desc->id; + function->iid = desc->func_iid; + *ret = &function->function.dispex; + return S_OK; +} + static HRESULT BindFunction_get_arguments(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) { return JS_E_INVALID_ACTION; diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index fdcead4a064..1cb423cff31 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -276,6 +276,7 @@ HRESULT create_builtin_function(script_ctx_t*,builtin_invoke_t,const WCHAR*,cons jsdisp_t*,jsdisp_t**); HRESULT create_builtin_constructor(script_ctx_t*,builtin_invoke_t,const WCHAR*,const builtin_info_t*,DWORD, jsdisp_t*,jsdisp_t**); +HRESULT create_host_function(script_ctx_t*,const struct property_info*,jsdisp_t**); HRESULT Function_invoke(jsdisp_t*,jsval_t,WORD,unsigned,jsval_t*,jsval_t*); HRESULT Function_value(script_ctx_t*,jsval_t,WORD,unsigned,jsval_t*,jsval_t*); diff --git a/dlls/jscript/jsdisp.idl b/dlls/jscript/jsdisp.idl index 533677f6cad..8ea53396f09 100644 --- a/dlls/jscript/jsdisp.idl +++ b/dlls/jscript/jsdisp.idl @@ -27,6 +27,7 @@ struct property_info UINT32 flags; const WCHAR *name; UINT32 index; + UINT32 func_iid; }; const unsigned int PROPF_ENUMERABLE = 0x0400; diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 61e7dae650e..7b334ac3001 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -2310,8 +2310,12 @@ static HRESULT WINAPI JSDispatchHost_LookupProperty(IWineJSDispatchHost *iface, return hres; desc->id = id; desc->flags = PROPF_WRITABLE | PROPF_CONFIGURABLE; - if(func->func_disp_idx < 0) + if(func->func_disp_idx < 0) { desc->flags |= PROPF_ENUMERABLE; + desc->func_iid = 0; + }else { + desc->func_iid = func->tid; + } desc->name = func->name; return S_OK; } @@ -2338,6 +2342,7 @@ static HRESULT WINAPI JSDispatchHost_NextProperty(IWineJSDispatchHost *iface, DI desc->id = func->id; desc->name = func->name; desc->flags = PROPF_WRITABLE | PROPF_CONFIGURABLE | PROPF_ENUMERABLE; + desc->func_iid = 0; return S_OK; } func++; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/6039
From: Jacek Caban <jacek(a)codeweavers.com> --- dlls/mshtml/tests/documentmode.js | 94 +++++++++++++++---------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 2cffff79479..151ff0f1683 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -234,7 +234,7 @@ sync_test("builtin_toString", function() { ]; var v = document.documentMode, e; - function test(msg, obj, name, tostr) { + function test(msg, obj, name, tostr, is_todo) { var s; if(obj.toString) { s = obj.toString(); @@ -242,23 +242,23 @@ sync_test("builtin_toString", function() { ok(s === (tostr ? tostr : (v < 9 ? "[object]" : "[object " + name + "]")), msg + " toString returned " + s); } s = Object.prototype.toString.call(obj); - todo_wine_if(v >= 9 && name != "Object" && name != "Screen"). + todo_wine_if(v >= 9 && is_todo). ok(s === (v < 9 ? "[object Object]" : "[object " + name + "]"), msg + " Object.toString returned " + s); } for(var i = 0; i < tags.length; i++) if(tags[i].length < 3 || v >= tags[i][2]) - test("tag '" + tags[i][0] + "'", document.createElement(tags[i][0]), "HTML" + tags[i][1] + "Element"); + test("tag '" + tags[i][0] + "'", document.createElement(tags[i][0]), "HTML" + tags[i][1] + "Element", null, true); e = document.createElement("a"); ok(e.toString() === "", "tag 'a' (without href) toString returned " + e.toString()); e.href = "https://www.winehq.org/"; - test("tag 'a'", e, "HTMLAnchorElement", "https://www.winehq.org/"); + test("tag 'a'", e, "HTMLAnchorElement", "https://www.winehq.org/", true); e = document.createElement("area"); ok(e.toString() === "", "tag 'area' (without href) toString returned " + e.toString()); e.href = "https://www.winehq.org/"; - test("tag 'area'", e, "HTMLAreaElement", "https://www.winehq.org/"); + test("tag 'area'", e, "HTMLAreaElement", "https://www.winehq.org/", true); e = document.createElement("style"); document.body.appendChild(e); @@ -292,63 +292,63 @@ sync_test("builtin_toString", function() { } if(!localStorage) win_skip("localStorage is buggy and not available, skipping"); - test("attribute", document.createAttribute("class"), "Attr"); + test("attribute", document.createAttribute("class"), "Attr", null, true); if(false /* todo_wine */) test("attributes", e.attributes, "NamedNodeMap"); - test("childNodes", document.body.childNodes, "NodeList"); - if(clientRects) test("clientRect", clientRects[0], "ClientRect"); - if(clientRects) test("clientRects", clientRects, "ClientRectList"); - if(currentStyle) test("currentStyle", currentStyle, "MSCurrentStyleCSSProperties"); - if(v >= 11 /* todo_wine */) test("document", document, v < 11 ? "Document" : "HTMLDocument"); - test("elements", document.getElementsByTagName("body"), "HTMLCollection"); - test("history", window.history, "History"); - test("implementation", document.implementation, "DOMImplementation"); - if(localStorage) test("localStorage", localStorage, "Storage"); - test("location", window.location, "Object", window.location.href); - if(v >= 11 /* todo_wine */) test("mimeTypes", window.navigator.mimeTypes, v < 11 ? "MSMimeTypesCollection" : "MimeTypeArray"); - test("navigator", window.navigator, "Navigator"); - test("performance", window.performance, "Performance"); - test("performanceNavigation", window.performance.navigation, "PerformanceNavigation"); - test("performanceTiming", window.performance.timing, "PerformanceTiming"); - if(v >= 11 /* todo_wine */) test("plugins", window.navigator.plugins, v < 11 ? "MSPluginsCollection" : "PluginArray"); + test("childNodes", document.body.childNodes, "NodeList", null, true); + if(clientRects) test("clientRect", clientRects[0], "ClientRect", null, true); + if(clientRects) test("clientRects", clientRects, "ClientRectList", null, true); + if(currentStyle) test("currentStyle", currentStyle, "MSCurrentStyleCSSProperties", null, true); + if(v >= 11 /* todo_wine */) test("document", document, v < 11 ? "Document" : "HTMLDocument", null, true); + test("elements", document.getElementsByTagName("body"), "HTMLCollection", null, true); + test("history", window.history, "History", null, true); + test("implementation", document.implementation, "DOMImplementation", null, true); + if(localStorage) test("localStorage", localStorage, "Storage", null, true); + test("location", window.location, "Object", window.location.href, null, true); + if(v >= 11 /* todo_wine */) test("mimeTypes", window.navigator.mimeTypes, v < 11 ? "MSMimeTypesCollection" : "MimeTypeArray", null, true); + test("navigator", window.navigator, "Navigator", null, true); + test("performance", window.performance, "Performance", null, true); + test("performanceNavigation", window.performance.navigation, "PerformanceNavigation", null, true); + test("performanceTiming", window.performance.timing, "PerformanceTiming", null, true); + if(v >= 11 /* todo_wine */) test("plugins", window.navigator.plugins, v < 11 ? "MSPluginsCollection" : "PluginArray", null, true); test("screen", window.screen, "Screen"); - test("sessionStorage", window.sessionStorage, "Storage"); - test("style", document.body.style, "MSStyleCSSProperties"); - test("styleSheet", sheet, "CSSStyleSheet"); - test("styleSheetRule", sheet.rules[0], "CSSStyleRule"); - test("styleSheetRules", sheet.rules, "MSCSSRuleList"); - test("styleSheets", document.styleSheets, "StyleSheetList"); - test("textNode", document.createTextNode("testNode"), "Text", v < 9 ? "testNode" : null); - test("textRange", txtRange, "TextRange"); - test("window", window, "Window", "[object Window]"); - test("xmlHttpRequest", new XMLHttpRequest(), "XMLHttpRequest"); + test("sessionStorage", window.sessionStorage, "Storage", null, true); + test("style", document.body.style, "MSStyleCSSProperties", null, true); + test("styleSheet", sheet, "CSSStyleSheet", null, true); + test("styleSheetRule", sheet.rules[0], "CSSStyleRule", null, true); + test("styleSheetRules", sheet.rules, "MSCSSRuleList", null, true); + test("styleSheets", document.styleSheets, "StyleSheetList", null, true); + test("textNode", document.createTextNode("testNode"), "Text", v < 9 ? "testNode" : null, true); + test("textRange", txtRange, "TextRange", null, true); + test("window", window, "Window", "[object Window]", true); + test("xmlHttpRequest", new XMLHttpRequest(), "XMLHttpRequest", null, true); if(v < 10) { - test("namespaces", document.namespaces, "MSNamespaceInfoCollection"); + test("namespaces", document.namespaces, "MSNamespaceInfoCollection", null, true); } if(v < 11) { - test("eventObject", document.createEventObject(), "MSEventObj"); - test("selection", document.selection, "MSSelection"); + test("eventObject", document.createEventObject(), "MSEventObj", null, true); + test("selection", document.selection, "MSSelection", null, true); } if(v >= 9) { - test("computedStyle", window.getComputedStyle(e), "CSSStyleDeclaration"); - test("doctype", document.doctype, "DocumentType"); + test("computedStyle", window.getComputedStyle(e), "CSSStyleDeclaration", null, true); + test("doctype", document.doctype, "DocumentType", null, true); - test("Event", document.createEvent("Event"), "Event"); - test("CustomEvent", document.createEvent("CustomEvent"), "CustomEvent"); - test("KeyboardEvent", document.createEvent("KeyboardEvent"), "KeyboardEvent"); - test("MouseEvent", document.createEvent("MouseEvent"), "MouseEvent"); - test("UIEvent", document.createEvent("UIEvent"), "UIEvent"); + test("Event", document.createEvent("Event"), "Event", null, true); + test("CustomEvent", document.createEvent("CustomEvent"), "CustomEvent", null, true); + test("KeyboardEvent", document.createEvent("KeyboardEvent"), "KeyboardEvent", null, true); + test("MouseEvent", document.createEvent("MouseEvent"), "MouseEvent", null, true); + test("UIEvent", document.createEvent("UIEvent"), "UIEvent", null, true); } if(v >= 10) { - test("classList", e.classList, "DOMTokenList", "testclass another "); - test("console", window.console, "Console"); - test("mediaQueryList", window.matchMedia("(hover:hover)"), "MediaQueryList"); + test("classList", e.classList, "DOMTokenList", "testclass another ", true); + test("console", window.console, "Console", null, true); + test("mediaQueryList", window.matchMedia("(hover:hover)"), "MediaQueryList", null, true); } if(v >= 11) { - test("MutationObserver", new window.MutationObserver(function() {}), "MutationObserver"); + test("MutationObserver", new window.MutationObserver(function() {}), "MutationObserver", null, true); } if(v >= 9) { document.body.innerHTML = "<!--...-->"; - test("comment", document.body.firstChild, "Comment"); + test("comment", document.body.firstChild, "Comment", null, true); } }); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/6039
From: Jacek Caban <jacek(a)codeweavers.com> --- dlls/mshtml/omnavigator.c | 2 +- dlls/mshtml/tests/documentmode.js | 2 +- dlls/mshtml/tests/es5.js | 12 ++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index 88dfa1b5bf9..acb4e995425 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -242,7 +242,7 @@ HRESULT create_dom_implementation(HTMLDocumentNode *doc_node, IHTMLDOMImplementa dom_implementation->IHTMLDOMImplementation2_iface.lpVtbl = &HTMLDOMImplementation2Vtbl; dom_implementation->browser = doc_node->browser; - init_dispatch(&dom_implementation->dispex, &HTMLDOMImplementation_dispex, NULL, doc_node->document_mode); + init_dispatch(&dom_implementation->dispex, &HTMLDOMImplementation_dispex, doc_node->window, doc_node->document_mode); nsres = nsIDOMDocument_GetImplementation(doc_node->dom_document, &dom_implementation->implementation); if(NS_FAILED(nsres)) { diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 151ff0f1683..4368e4e45bd 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -301,7 +301,7 @@ sync_test("builtin_toString", function() { if(v >= 11 /* todo_wine */) test("document", document, v < 11 ? "Document" : "HTMLDocument", null, true); test("elements", document.getElementsByTagName("body"), "HTMLCollection", null, true); test("history", window.history, "History", null, true); - test("implementation", document.implementation, "DOMImplementation", null, true); + test("implementation", document.implementation, "DOMImplementation"); if(localStorage) test("localStorage", localStorage, "Storage", null, true); test("location", window.location, "Object", window.location.href, null, true); if(v >= 11 /* todo_wine */) test("mimeTypes", window.navigator.mimeTypes, v < 11 ? "MSMimeTypesCollection" : "MimeTypeArray", null, true); diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index b1340918fad..b04c13de984 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -2646,3 +2646,15 @@ sync_test("screen", function() { ok(!check_enum(o, "defprop"), "defprop enumerated"); ok(!check_enum(o, "prop2"), "prop2 enumerated"); }); + +sync_test("builtin_func", function() { + var o = document.implementation; + var f = o.hasFeature; + + ok(f instanceof Function, "f is not an instance of Function"); + ok(Object.getPrototypeOf(f) === Function.prototype, "Object.getPrototypeOf(f) = " + Object.getPrototypeOf(f)); + ok(!f.hasOwnProperty("length"), "f has own length property"); + ok(f.length === 0, "f.length = " + f.length); + ok(f.call(o, "test", 1) === false, 'f.call(o, "test", 1) = ' + f.call(o, "test", 1)); + ok("" + f === "\nfunction hasFeature() {\n [native code]\n}\n", "f = " + f); +}); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/6039
From: Jacek Caban <jacek(a)codeweavers.com> --- dlls/mshtml/omnavigator.c | 2 +- dlls/mshtml/tests/documentmode.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index acb4e995425..a1b23572640 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -567,7 +567,7 @@ HRESULT create_history(HTMLInnerWindow *window, OmHistory **ret) if(!history) return E_OUTOFMEMORY; - init_dispatch(&history->dispex, &OmHistory_dispex, NULL, + init_dispatch(&history->dispex, &OmHistory_dispex, window, dispex_compat_mode(&window->event_target.dispex)); history->IOmHistory_iface.lpVtbl = &OmHistoryVtbl; diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 4368e4e45bd..11b4278e4c6 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -300,7 +300,7 @@ sync_test("builtin_toString", function() { if(currentStyle) test("currentStyle", currentStyle, "MSCurrentStyleCSSProperties", null, true); if(v >= 11 /* todo_wine */) test("document", document, v < 11 ? "Document" : "HTMLDocument", null, true); test("elements", document.getElementsByTagName("body"), "HTMLCollection", null, true); - test("history", window.history, "History", null, true); + test("history", window.history, "History"); test("implementation", document.implementation, "DOMImplementation"); if(localStorage) test("localStorage", localStorage, "Storage", null, true); test("location", window.location, "Object", window.location.href, null, true); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/6039
From: Jacek Caban <jacek(a)codeweavers.com> --- dlls/mshtml/omnavigator.c | 2 +- dlls/mshtml/tests/documentmode.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index a1b23572640..76c14ec08a7 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -1686,7 +1686,7 @@ static HRESULT WINAPI HTMLPerformance_get_navigation(IHTMLPerformance *iface, navigation->window = This->window; IHTMLWindow2_AddRef(&This->window->base.IHTMLWindow2_iface); - init_dispatch(&navigation->dispex, &HTMLPerformanceNavigation_dispex, NULL, + init_dispatch(&navigation->dispex, &HTMLPerformanceNavigation_dispex, This->window, dispex_compat_mode(&This->dispex)); This->navigation = &navigation->IHTMLPerformanceNavigation_iface; diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 11b4278e4c6..d85bdc74ed7 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -307,7 +307,7 @@ sync_test("builtin_toString", function() { if(v >= 11 /* todo_wine */) test("mimeTypes", window.navigator.mimeTypes, v < 11 ? "MSMimeTypesCollection" : "MimeTypeArray", null, true); test("navigator", window.navigator, "Navigator", null, true); test("performance", window.performance, "Performance", null, true); - test("performanceNavigation", window.performance.navigation, "PerformanceNavigation", null, true); + test("performanceNavigation", window.performance.navigation, "PerformanceNavigation"); test("performanceTiming", window.performance.timing, "PerformanceTiming", null, true); if(v >= 11 /* todo_wine */) test("plugins", window.navigator.plugins, v < 11 ? "MSPluginsCollection" : "PluginArray", null, true); test("screen", window.screen, "Screen"); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/6039
From: Jacek Caban <jacek(a)codeweavers.com> --- dlls/mshtml/omnavigator.c | 2 +- dlls/mshtml/tests/documentmode.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index 76c14ec08a7..93a80303fa0 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -1713,7 +1713,7 @@ static HRESULT WINAPI HTMLPerformance_get_timing(IHTMLPerformance *iface, IHTMLP timing->window = This->window; IHTMLWindow2_AddRef(&This->window->base.IHTMLWindow2_iface); - init_dispatch(&timing->dispex, &HTMLPerformanceTiming_dispex, NULL, + init_dispatch(&timing->dispex, &HTMLPerformanceTiming_dispex, This->window, dispex_compat_mode(&This->dispex)); This->timing = &timing->IHTMLPerformanceTiming_iface; diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index d85bdc74ed7..795701017c9 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -308,7 +308,7 @@ sync_test("builtin_toString", function() { test("navigator", window.navigator, "Navigator", null, true); test("performance", window.performance, "Performance", null, true); test("performanceNavigation", window.performance.navigation, "PerformanceNavigation"); - test("performanceTiming", window.performance.timing, "PerformanceTiming", null, true); + test("performanceTiming", window.performance.timing, "PerformanceTiming"); if(v >= 11 /* todo_wine */) test("plugins", window.navigator.plugins, v < 11 ? "MSPluginsCollection" : "PluginArray", null, true); test("screen", window.screen, "Screen"); test("sessionStorage", window.sessionStorage, "Storage", null, true); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/6039
From: Jacek Caban <jacek(a)codeweavers.com> --- dlls/mshtml/omnavigator.c | 2 +- dlls/mshtml/tests/documentmode.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index 93a80303fa0..7ba92cca10e 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -1828,7 +1828,7 @@ HRESULT create_performance(HTMLInnerWindow *window, IHTMLPerformance **ret) performance->window = window; IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); - init_dispatch(&performance->dispex, &HTMLPerformance_dispex, NULL, compat_mode); + init_dispatch(&performance->dispex, &HTMLPerformance_dispex, window, compat_mode); *ret = &performance->IHTMLPerformance_iface; return S_OK; diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 795701017c9..7362e0d16bf 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -306,7 +306,7 @@ sync_test("builtin_toString", function() { test("location", window.location, "Object", window.location.href, null, true); if(v >= 11 /* todo_wine */) test("mimeTypes", window.navigator.mimeTypes, v < 11 ? "MSMimeTypesCollection" : "MimeTypeArray", null, true); test("navigator", window.navigator, "Navigator", null, true); - test("performance", window.performance, "Performance", null, true); + test("performance", window.performance, "Performance"); test("performanceNavigation", window.performance.navigation, "PerformanceNavigation"); test("performanceTiming", window.performance.timing, "PerformanceTiming"); if(v >= 11 /* todo_wine */) test("plugins", window.navigator.plugins, v < 11 ? "MSPluginsCollection" : "PluginArray", null, true); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/6039
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 full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=146967 Your paranoid android. === build (build log) === error: patch failed: dlls/jscript/function.c:312 error: patch failed: dlls/jscript/dispex.c:268 error: patch failed: dlls/jscript/function.c:63 error: patch failed: dlls/jscript/jscript.h:276 error: patch failed: dlls/jscript/jsdisp.idl:27 error: patch failed: dlls/mshtml/dispex.c:2310 Task: Patch failed to apply === debian11 (build log) === error: patch failed: dlls/jscript/function.c:312 error: patch failed: dlls/jscript/dispex.c:268 error: patch failed: dlls/jscript/function.c:63 error: patch failed: dlls/jscript/jscript.h:276 error: patch failed: dlls/jscript/jsdisp.idl:27 error: patch failed: dlls/mshtml/dispex.c:2310 Task: Patch failed to apply === debian11b (build log) === error: patch failed: dlls/jscript/function.c:312 error: patch failed: dlls/jscript/dispex.c:268 error: patch failed: dlls/jscript/function.c:63 error: patch failed: dlls/jscript/jscript.h:276 error: patch failed: dlls/jscript/jsdisp.idl:27 error: patch failed: dlls/mshtml/dispex.c:2310 Task: Patch failed to apply
participants (3)
-
Jacek Caban -
Jacek Caban (@jacek) -
Marvin