Commit d9876902 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

Added support for shadowing of element pseudo-variables.

parent 34b41084
...@@ -480,6 +480,19 @@ HRESULT dispex_get_dprop_ref(DispatchEx *This, const WCHAR *name, BOOL alloc, VA ...@@ -480,6 +480,19 @@ HRESULT dispex_get_dprop_ref(DispatchEx *This, const WCHAR *name, BOOL alloc, VA
return S_OK; return S_OK;
} }
HRESULT dispex_get_dynid(DispatchEx *This, const WCHAR *name, DISPID *id)
{
dynamic_prop_t *prop;
HRESULT hres;
hres = get_dynamic_prop(This, name, fdexNameEnsure, &prop);
if(FAILED(hres))
return hres;
*id = DISPID_DYNPROP_0 + (prop - This->dynamic_data->props);
return S_OK;
}
static HRESULT dispex_value(DispatchEx *This, LCID lcid, WORD flags, DISPPARAMS *params, static HRESULT dispex_value(DispatchEx *This, LCID lcid, WORD flags, DISPPARAMS *params,
VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
{ {
......
...@@ -2461,21 +2461,40 @@ static HRESULT HTMLWindow_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD ...@@ -2461,21 +2461,40 @@ static HRESULT HTMLWindow_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD
IDispatch_Release(disp); IDispatch_Release(disp);
break; break;
} }
case GLOBAL_ELEMENTVAR: { case GLOBAL_ELEMENTVAR:
IHTMLElement *elem; switch(flags) {
case DISPATCH_PROPERTYGET: {
IHTMLElement *elem;
hres = IHTMLDocument3_getElementById(&This->doc->basedoc.IHTMLDocument3_iface, hres = IHTMLDocument3_getElementById(&This->doc->basedoc.IHTMLDocument3_iface,
prop->name, &elem); prop->name, &elem);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
if(!elem) if(!elem)
return DISP_E_MEMBERNOTFOUND; return DISP_E_MEMBERNOTFOUND;
V_VT(res) = VT_DISPATCH; V_VT(res) = VT_DISPATCH;
V_DISPATCH(res) = (IDispatch*)elem; V_DISPATCH(res) = (IDispatch*)elem;
break; return S_OK;
} }
case DISPATCH_PROPERTYPUT: {
DISPID dispex_id;
hres = dispex_get_dynid(&This->dispex, prop->name, &dispex_id);
if(FAILED(hres))
return hres;
prop->type = GLOBAL_DISPEXVAR;
prop->id = dispex_id;
return IDispatchEx_InvokeEx(&This->dispex.IDispatchEx_iface, dispex_id, 0, flags, params, res, ei, caller);
}
default:
FIXME("Not suppoted flags: %x\n", flags);
return E_NOTIMPL;
}
case GLOBAL_DISPEXVAR:
return IDispatchEx_InvokeEx(&This->dispex.IDispatchEx_iface, prop->id, 0, flags, params, res, ei, caller);
default: default:
ERR("invalid type %d\n", prop->type); ERR("invalid type %d\n", prop->type);
hres = DISP_E_MEMBERNOTFOUND; hres = DISP_E_MEMBERNOTFOUND;
......
...@@ -229,6 +229,7 @@ BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN; ...@@ -229,6 +229,7 @@ BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN;
HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) DECLSPEC_HIDDEN; HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) DECLSPEC_HIDDEN;
HRESULT get_dispids(tid_t,DWORD*,DISPID**) DECLSPEC_HIDDEN; HRESULT get_dispids(tid_t,DWORD*,DISPID**) DECLSPEC_HIDDEN;
HRESULT remove_prop(DispatchEx*,BSTR,VARIANT_BOOL*) DECLSPEC_HIDDEN; HRESULT remove_prop(DispatchEx*,BSTR,VARIANT_BOOL*) DECLSPEC_HIDDEN;
HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN;
void release_typelib(void) DECLSPEC_HIDDEN; void release_typelib(void) DECLSPEC_HIDDEN;
HRESULT get_htmldoc_classinfo(ITypeInfo **typeinfo) DECLSPEC_HIDDEN; HRESULT get_htmldoc_classinfo(ITypeInfo **typeinfo) DECLSPEC_HIDDEN;
...@@ -248,7 +249,8 @@ typedef struct ScriptHost ScriptHost; ...@@ -248,7 +249,8 @@ typedef struct ScriptHost ScriptHost;
typedef enum { typedef enum {
GLOBAL_SCRIPTVAR, GLOBAL_SCRIPTVAR,
GLOBAL_ELEMENTVAR GLOBAL_ELEMENTVAR,
GLOBAL_DISPEXVAR
} global_prop_type_t; } global_prop_type_t;
typedef struct { typedef struct {
......
...@@ -60,6 +60,14 @@ function test_document_name_as_index() { ...@@ -60,6 +60,14 @@ function test_document_name_as_index() {
var e = document.getElementById("formid"); var e = document.getElementById("formid");
ok(!!e, "e is null"); ok(!!e, "e is null");
ok(!("formid" in document), "formid is in document"); ok(!("formid" in document), "formid is in document");
document.body.innerHTML = '<form name="formname"></form>';
ok("formname" in window, "formname' is not in window");
ok(typeof(window.formname) === "object", "typeof(window.formname) = " + typeof(window.formname));
window.formname = 1;
ok(window.formname === 1, "window.formname = " + window.formname);
formname = 2;
ok(window.formname === 2, "window.formname = " + window.formname);
} }
function test_remove_style_attribute() { function test_remove_style_attribute() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment