mshtml: Properly expose frame and iframe element's windows to scripts.
This commit is contained in:
parent
99d1c9ba82
commit
4ff0a82416
|
@ -2358,7 +2358,25 @@ static HRESULT WINAPI WindowDispEx_GetDispID(IDispatchEx *iface, BSTR bstrName,
|
|||
if(hres != DISP_E_UNKNOWNNAME)
|
||||
return hres;
|
||||
|
||||
if(window->base.inner_window->doc) {
|
||||
if(This->outer_window) {
|
||||
HTMLOuterWindow *frame;
|
||||
|
||||
hres = get_frame_by_name(This->outer_window, bstrName, FALSE, &frame);
|
||||
if(SUCCEEDED(hres) && frame) {
|
||||
global_prop_t *prop;
|
||||
|
||||
IHTMLWindow2_Release(&frame->base.IHTMLWindow2_iface);
|
||||
|
||||
prop = alloc_global_prop(window, GLOBAL_FRAMEVAR, bstrName);
|
||||
if(!prop)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
*pid = prop_to_dispid(window, prop);
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if(window->doc) {
|
||||
global_prop_t *prop;
|
||||
IHTMLElement *elem;
|
||||
|
||||
|
@ -2603,6 +2621,30 @@ static HRESULT HTMLWindow_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD
|
|||
FIXME("Not supported flags: %x\n", flags);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
case GLOBAL_FRAMEVAR:
|
||||
if(!This->base.outer_window)
|
||||
return E_UNEXPECTED;
|
||||
|
||||
switch(flags) {
|
||||
case DISPATCH_PROPERTYGET: {
|
||||
HTMLOuterWindow *frame;
|
||||
|
||||
hres = get_frame_by_name(This->base.outer_window, prop->name, FALSE, &frame);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(!frame)
|
||||
return DISP_E_MEMBERNOTFOUND;
|
||||
|
||||
V_VT(res) = VT_DISPATCH;
|
||||
V_DISPATCH(res) = (IDispatch*)&frame->base.inner_window->base.IHTMLWindow2_iface;
|
||||
IDispatch_AddRef(V_DISPATCH(res));
|
||||
return S_OK;
|
||||
}
|
||||
default:
|
||||
FIXME("Not supported 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:
|
||||
|
|
|
@ -294,7 +294,8 @@ typedef struct ScriptHost ScriptHost;
|
|||
typedef enum {
|
||||
GLOBAL_SCRIPTVAR,
|
||||
GLOBAL_ELEMENTVAR,
|
||||
GLOBAL_DISPEXVAR
|
||||
GLOBAL_DISPEXVAR,
|
||||
GLOBAL_FRAMEVAR
|
||||
} global_prop_type_t;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -68,6 +68,13 @@ function test_document_name_as_index() {
|
|||
ok(window.formname === 1, "window.formname = " + window.formname);
|
||||
formname = 2;
|
||||
ok(window.formname === 2, "window.formname = " + window.formname);
|
||||
|
||||
document.body.innerHTML = '<iframe id="iframeid"></iframe>';
|
||||
ok("iframeid" in window, "iframeid is not in window");
|
||||
e = document.getElementById("iframeid");
|
||||
ok(!!e, "e is null");
|
||||
ok(iframeid != e, "iframeid == e");
|
||||
ok(iframeid.frameElement === e, "frameid != e.contentWindow");
|
||||
}
|
||||
|
||||
function test_remove_style_attribute() {
|
||||
|
|
Loading…
Reference in New Issue