mshtml: Override document.URL's name when adding it from the mshtml typelib.

Because the typelib should contain the lowercase `url` symbol instead.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
This commit is contained in:
Gabriel Ivăncescu 2022-09-29 16:25:51 +03:00 committed by Alexandre Julliard
parent 5663146890
commit 8a2883d3e9
4 changed files with 19 additions and 7 deletions

View file

@ -270,16 +270,20 @@ static BOOL is_arg_type_supported(VARTYPE vt)
}
static void add_func_info(dispex_data_t *data, tid_t tid, const FUNCDESC *desc, ITypeInfo *dti,
dispex_hook_invoke_t hook)
dispex_hook_invoke_t hook, const WCHAR *name_override)
{
func_info_t *info;
BSTR name;
HRESULT hres;
hres = ITypeInfo_GetDocumentation(dti, desc->memid, &name, NULL, NULL, NULL);
if(FAILED(hres)) {
WARN("GetDocumentation failed: %08lx\n", hres);
return;
if(name_override)
name = SysAllocString(name_override);
else {
hres = ITypeInfo_GetDocumentation(dti, desc->memid, &name, NULL, NULL, NULL);
if(FAILED(hres)) {
WARN("GetDocumentation failed: %08lx\n", hres);
return;
}
}
for(info = data->funcs; info < data->funcs+data->func_cnt; info++) {
@ -441,9 +445,9 @@ static HRESULT process_interface(dispex_data_t *data, tid_t tid, ITypeInfo *disp
hook = NULL;
}
if(!hook || hook->invoke) {
if(!hook || hook->invoke || hook->name) {
add_func_info(data, tid, funcdesc, disp_typeinfo ? disp_typeinfo : typeinfo,
hook ? hook->invoke : NULL);
hook ? hook->invoke : NULL, hook ? hook->name : NULL);
}
ITypeInfo_ReleaseFuncDesc(typeinfo, funcdesc);

View file

@ -5975,6 +5975,7 @@ static const tid_t HTMLDocumentNode_iface_tids[] = {
static void HTMLDocumentNode_init_dispex_info(dispex_data_t *info, compat_mode_t mode)
{
static const dispex_hook_t document2_hooks[] = {
{DISPID_IHTMLDOCUMENT2_URL, NULL, L"URL"},
{DISPID_IHTMLDOCUMENT2_LOCATION, HTMLDocumentNode_location_hook},
{DISPID_UNKNOWN}
};
@ -6307,6 +6308,7 @@ static const tid_t HTMLDocumentObj_iface_tids[] = {
static void HTMLDocumentObj_init_dispex_info(dispex_data_t *info, compat_mode_t mode)
{
static const dispex_hook_t document2_hooks[] = {
{DISPID_IHTMLDOCUMENT2_URL, NULL, L"URL"},
{DISPID_IHTMLDOCUMENT2_LOCATION, HTMLDocumentObj_location_hook},
{DISPID_UNKNOWN}
};

View file

@ -359,6 +359,7 @@ typedef HRESULT (*dispex_hook_invoke_t)(DispatchEx*,WORD,DISPPARAMS*,VARIANT*,
typedef struct {
DISPID dispid;
dispex_hook_invoke_t invoke;
const WCHAR *name;
} dispex_hook_t;
struct DispatchEx {

View file

@ -18,6 +18,11 @@
var tests = [];
sync_test("url", function() {
ok(document.URL === "http://winetest.example.org/index.html?dom.js", "document.URL = " + document.URL);
ok(!("documentURI" in document), "documentURI in document");
});
sync_test("input_selection", function() {
var input = document.createElement("input");
input.type = "text";