2 * Copyright 2008 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
29 #include "mshtml_private.h"
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
36 static const WCHAR autoW[] = {'a','u','t','o',0};
37 static const WCHAR yesW[] = {'y','e','s',0};
38 static const WCHAR noW[] = {'n','o',0};
39 static const WCHAR pxW[] = {'p','x',0};
41 HRESULT set_frame_doc(HTMLFrameBase *frame, nsIDOMDocument *nsdoc)
43 nsIDOMWindow *nswindow;
44 HTMLOuterWindow *window;
48 if(frame->content_window)
51 nsres = nsIDOMDocument_GetDefaultView(nsdoc, &nswindow);
52 if(NS_FAILED(nsres) || !nswindow)
55 window = nswindow_to_window(nswindow);
57 hres = HTMLOuterWindow_Create(frame->element.node.doc->basedoc.doc_obj, nswindow,
58 frame->element.node.doc->basedoc.window, &window);
59 nsIDOMWindow_Release(nswindow);
63 frame->content_window = window;
64 window->frame_element = frame;
68 static inline HTMLFrameBase *impl_from_IHTMLFrameBase(IHTMLFrameBase *iface)
70 return CONTAINING_RECORD(iface, HTMLFrameBase, IHTMLFrameBase_iface);
73 static HRESULT WINAPI HTMLFrameBase_QueryInterface(IHTMLFrameBase *iface, REFIID riid, void **ppv)
75 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
77 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
80 static ULONG WINAPI HTMLFrameBase_AddRef(IHTMLFrameBase *iface)
82 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
84 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
87 static ULONG WINAPI HTMLFrameBase_Release(IHTMLFrameBase *iface)
89 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
91 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
94 static HRESULT WINAPI HTMLFrameBase_GetTypeInfoCount(IHTMLFrameBase *iface, UINT *pctinfo)
96 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
98 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
101 static HRESULT WINAPI HTMLFrameBase_GetTypeInfo(IHTMLFrameBase *iface, UINT iTInfo,
102 LCID lcid, ITypeInfo **ppTInfo)
104 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
106 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
110 static HRESULT WINAPI HTMLFrameBase_GetIDsOfNames(IHTMLFrameBase *iface, REFIID riid,
111 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
113 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
115 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
116 cNames, lcid, rgDispId);
119 static HRESULT WINAPI HTMLFrameBase_Invoke(IHTMLFrameBase *iface, DISPID dispIdMember,
120 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
121 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
123 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
125 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
126 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
129 static HRESULT WINAPI HTMLFrameBase_put_src(IHTMLFrameBase *iface, BSTR v)
131 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
133 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
135 if(!This->content_window || !This->element.node.doc || !This->element.node.doc->basedoc.window) {
136 FIXME("detached element\n");
140 return navigate_url(This->content_window, v, This->element.node.doc->basedoc.window->uri, BINDING_NAVIGATED);
143 static HRESULT WINAPI HTMLFrameBase_get_src(IHTMLFrameBase *iface, BSTR *p)
145 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
146 FIXME("(%p)->(%p)\n", This, p);
150 static HRESULT WINAPI HTMLFrameBase_put_name(IHTMLFrameBase *iface, BSTR v)
152 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
156 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
158 if(!This->nsframe && !This->nsiframe) {
159 ERR("No attached ns frame object\n");
163 nsAString_InitDepend(&name_str, v);
165 nsres = nsIDOMHTMLFrameElement_SetName(This->nsframe, &name_str);
167 nsres = nsIDOMHTMLIFrameElement_SetName(This->nsiframe, &name_str);
168 nsAString_Finish(&name_str);
169 if(NS_FAILED(nsres)) {
170 ERR("SetName failed: %08x\n", nsres);
177 static HRESULT WINAPI HTMLFrameBase_get_name(IHTMLFrameBase *iface, BSTR *p)
179 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
183 TRACE("(%p)->(%p)\n", This, p);
185 if(!This->nsframe && !This->nsiframe) {
186 ERR("No attached ns frame object\n");
190 nsAString_Init(&nsstr, NULL);
192 nsres = nsIDOMHTMLFrameElement_GetName(This->nsframe, &nsstr);
194 nsres = nsIDOMHTMLIFrameElement_GetName(This->nsiframe, &nsstr);
195 return return_nsstr(nsres, &nsstr, p);
198 static HRESULT WINAPI HTMLFrameBase_put_border(IHTMLFrameBase *iface, VARIANT v)
200 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
201 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
205 static HRESULT WINAPI HTMLFrameBase_get_border(IHTMLFrameBase *iface, VARIANT *p)
207 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
208 FIXME("(%p)->(%p)\n", This, p);
212 static HRESULT WINAPI HTMLFrameBase_put_frameBorder(IHTMLFrameBase *iface, BSTR v)
214 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
218 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
220 if(!This->nsframe && !This->nsiframe) {
221 ERR("No attached ns frame object\n");
225 nsAString_InitDepend(&nsstr, v);
227 nsres = nsIDOMHTMLFrameElement_SetFrameBorder(This->nsframe, &nsstr);
229 nsres = nsIDOMHTMLIFrameElement_SetFrameBorder(This->nsiframe, &nsstr);
230 nsAString_Finish(&nsstr);
231 if(NS_FAILED(nsres)) {
232 ERR("SetFrameBorder failed: %08x\n", nsres);
239 static HRESULT WINAPI HTMLFrameBase_get_frameBorder(IHTMLFrameBase *iface, BSTR *p)
241 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
245 TRACE("(%p)->(%p)\n", This, p);
247 if(!This->nsframe && !This->nsiframe) {
248 ERR("No attached ns frame object\n");
252 nsAString_Init(&nsstr, NULL);
254 nsres = nsIDOMHTMLFrameElement_GetFrameBorder(This->nsframe, &nsstr);
256 nsres = nsIDOMHTMLIFrameElement_GetFrameBorder(This->nsiframe, &nsstr);
257 return return_nsstr(nsres, &nsstr, p);
260 static HRESULT WINAPI HTMLFrameBase_put_frameSpacing(IHTMLFrameBase *iface, VARIANT v)
262 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
263 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
267 static HRESULT WINAPI HTMLFrameBase_get_frameSpacing(IHTMLFrameBase *iface, VARIANT *p)
269 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
270 FIXME("(%p)->(%p)\n", This, p);
274 static HRESULT WINAPI HTMLFrameBase_put_marginWidth(IHTMLFrameBase *iface, VARIANT v)
276 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
280 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
282 if(V_VT(&v) != VT_BSTR) {
283 FIXME("unsupported %s\n", debugstr_variant(&v));
287 nsAString_InitDepend(&nsstr, V_BSTR(&v));
289 nsres = nsIDOMHTMLFrameElement_SetMarginWidth(This->nsframe, &nsstr);
291 nsres = nsIDOMHTMLIFrameElement_SetMarginWidth(This->nsiframe, &nsstr);
292 nsAString_Finish(&nsstr);
293 return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
296 static HRESULT WINAPI HTMLFrameBase_get_marginWidth(IHTMLFrameBase *iface, VARIANT *p)
298 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
303 TRACE("(%p)->(%p)\n", This, p);
305 nsAString_Init(&nsstr, NULL);
307 nsres = nsIDOMHTMLFrameElement_GetMarginWidth(This->nsframe, &nsstr);
309 nsres = nsIDOMHTMLIFrameElement_GetMarginWidth(This->nsiframe, &nsstr);
310 if(NS_SUCCEEDED(nsres)) {
311 const PRUnichar *str, *end;
313 nsAString_GetData(&nsstr, &str);
318 end = strstrW(str, pxW);
320 end = str+strlenW(str);
321 ret = SysAllocStringLen(str, end-str);
326 hres = E_OUTOFMEMORY;
333 ERR("GetMarginWidth failed: %08x\n", nsres);
337 nsAString_Finish(&nsstr);
341 static HRESULT WINAPI HTMLFrameBase_put_marginHeight(IHTMLFrameBase *iface, VARIANT v)
343 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
347 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
349 if(V_VT(&v) != VT_BSTR) {
350 FIXME("unsupported %s\n", debugstr_variant(&v));
354 nsAString_InitDepend(&nsstr, V_BSTR(&v));
356 nsres = nsIDOMHTMLFrameElement_SetMarginHeight(This->nsframe, &nsstr);
358 nsres = nsIDOMHTMLIFrameElement_SetMarginHeight(This->nsiframe, &nsstr);
359 nsAString_Finish(&nsstr);
360 return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
363 static HRESULT WINAPI HTMLFrameBase_get_marginHeight(IHTMLFrameBase *iface, VARIANT *p)
365 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
370 TRACE("(%p)->(%p)\n", This, p);
372 nsAString_Init(&nsstr, NULL);
374 nsres = nsIDOMHTMLFrameElement_GetMarginHeight(This->nsframe, &nsstr);
376 nsres = nsIDOMHTMLIFrameElement_GetMarginHeight(This->nsiframe, &nsstr);
377 if(NS_SUCCEEDED(nsres)) {
378 const PRUnichar *str, *end;
380 nsAString_GetData(&nsstr, &str);
385 end = strstrW(str, pxW);
387 end = str+strlenW(str);
388 ret = SysAllocStringLen(str, end-str);
393 hres = E_OUTOFMEMORY;
400 ERR("SetMarginHeight failed: %08x\n", nsres);
404 nsAString_Finish(&nsstr);
408 static HRESULT WINAPI HTMLFrameBase_put_noResize(IHTMLFrameBase *iface, VARIANT_BOOL v)
410 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
411 FIXME("(%p)->(%x)\n", This, v);
415 static HRESULT WINAPI HTMLFrameBase_get_noResize(IHTMLFrameBase *iface, VARIANT_BOOL *p)
417 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
418 FIXME("(%p)->(%p)\n", This, p);
422 static HRESULT WINAPI HTMLFrameBase_put_scrolling(IHTMLFrameBase *iface, BSTR v)
424 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
428 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
430 if(!(!strcmpiW(v, yesW) || !strcmpiW(v, noW) || !strcmpiW(v, autoW)))
434 nsAString_InitDepend(&nsstr, v);
435 nsres = nsIDOMHTMLFrameElement_SetScrolling(This->nsframe, &nsstr);
436 }else if(This->nsiframe) {
437 nsAString_InitDepend(&nsstr, v);
438 nsres = nsIDOMHTMLIFrameElement_SetScrolling(This->nsiframe, &nsstr);
440 ERR("No attached ns frame object\n");
443 nsAString_Finish(&nsstr);
445 if(NS_FAILED(nsres)) {
446 ERR("SetScrolling failed: 0x%08x\n", nsres);
453 static HRESULT WINAPI HTMLFrameBase_get_scrolling(IHTMLFrameBase *iface, BSTR *p)
455 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
457 const PRUnichar *strdata;
460 TRACE("(%p)->(%p)\n", This, p);
463 nsAString_Init(&nsstr, NULL);
464 nsres = nsIDOMHTMLFrameElement_GetScrolling(This->nsframe, &nsstr);
465 }else if(This->nsiframe) {
466 nsAString_Init(&nsstr, NULL);
467 nsres = nsIDOMHTMLIFrameElement_GetScrolling(This->nsiframe, &nsstr);
469 ERR("No attached ns frame object\n");
473 if(NS_FAILED(nsres)) {
474 ERR("GetScrolling failed: 0x%08x\n", nsres);
475 nsAString_Finish(&nsstr);
479 nsAString_GetData(&nsstr, &strdata);
482 *p = SysAllocString(strdata);
484 *p = SysAllocString(autoW);
486 nsAString_Finish(&nsstr);
488 return *p ? S_OK : E_OUTOFMEMORY;
491 static const IHTMLFrameBaseVtbl HTMLFrameBaseVtbl = {
492 HTMLFrameBase_QueryInterface,
493 HTMLFrameBase_AddRef,
494 HTMLFrameBase_Release,
495 HTMLFrameBase_GetTypeInfoCount,
496 HTMLFrameBase_GetTypeInfo,
497 HTMLFrameBase_GetIDsOfNames,
498 HTMLFrameBase_Invoke,
499 HTMLFrameBase_put_src,
500 HTMLFrameBase_get_src,
501 HTMLFrameBase_put_name,
502 HTMLFrameBase_get_name,
503 HTMLFrameBase_put_border,
504 HTMLFrameBase_get_border,
505 HTMLFrameBase_put_frameBorder,
506 HTMLFrameBase_get_frameBorder,
507 HTMLFrameBase_put_frameSpacing,
508 HTMLFrameBase_get_frameSpacing,
509 HTMLFrameBase_put_marginWidth,
510 HTMLFrameBase_get_marginWidth,
511 HTMLFrameBase_put_marginHeight,
512 HTMLFrameBase_get_marginHeight,
513 HTMLFrameBase_put_noResize,
514 HTMLFrameBase_get_noResize,
515 HTMLFrameBase_put_scrolling,
516 HTMLFrameBase_get_scrolling
519 static inline HTMLFrameBase *impl_from_IHTMLFrameBase2(IHTMLFrameBase2 *iface)
521 return CONTAINING_RECORD(iface, HTMLFrameBase, IHTMLFrameBase2_iface);
524 static HRESULT WINAPI HTMLFrameBase2_QueryInterface(IHTMLFrameBase2 *iface, REFIID riid, void **ppv)
526 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
528 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
531 static ULONG WINAPI HTMLFrameBase2_AddRef(IHTMLFrameBase2 *iface)
533 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
535 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
538 static ULONG WINAPI HTMLFrameBase2_Release(IHTMLFrameBase2 *iface)
540 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
542 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
545 static HRESULT WINAPI HTMLFrameBase2_GetTypeInfoCount(IHTMLFrameBase2 *iface, UINT *pctinfo)
547 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
548 FIXME("(%p)\n", This);
552 static HRESULT WINAPI HTMLFrameBase2_GetTypeInfo(IHTMLFrameBase2 *iface, UINT iTInfo,
553 LCID lcid, ITypeInfo **ppTInfo)
555 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
556 FIXME("(%p)\n", This);
560 static HRESULT WINAPI HTMLFrameBase2_GetIDsOfNames(IHTMLFrameBase2 *iface, REFIID riid,
561 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
563 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
564 FIXME("(%p)\n", This);
568 static HRESULT WINAPI HTMLFrameBase2_Invoke(IHTMLFrameBase2 *iface, DISPID dispIdMember,
569 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
570 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
572 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
573 FIXME("(%p)\n", This);
577 static HRESULT WINAPI HTMLFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface, IHTMLWindow2 **p)
579 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
581 TRACE("(%p)->(%p)\n", This, p);
583 if(This->content_window) {
584 IHTMLWindow2_AddRef(&This->content_window->base.IHTMLWindow2_iface);
585 *p = &This->content_window->base.IHTMLWindow2_iface;
587 WARN("NULL content window\n");
593 static HRESULT WINAPI HTMLFrameBase2_put_onload(IHTMLFrameBase2 *iface, VARIANT v)
595 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
596 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
600 static HRESULT WINAPI HTMLFrameBase2_get_onload(IHTMLFrameBase2 *iface, VARIANT *p)
602 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
603 FIXME("(%p)->(%p)\n", This, p);
607 static HRESULT WINAPI HTMLFrameBase2_put_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT v)
609 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
610 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
614 static HRESULT WINAPI HTMLFrameBase2_get_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT *p)
616 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
617 FIXME("(%p)->(%p)\n", This, p);
621 static HRESULT WINAPI HTMLFrameBase2_get_readyState(IHTMLFrameBase2 *iface, BSTR *p)
623 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
625 TRACE("(%p)->(%p)\n", This, p);
627 if(!This->content_window || !This->content_window->base.inner_window->doc) {
628 FIXME("no document associated\n");
632 return IHTMLDocument2_get_readyState(&This->content_window->base.inner_window->doc->basedoc.IHTMLDocument2_iface, p);
635 static HRESULT WINAPI HTMLFrameBase2_put_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL v)
637 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
638 FIXME("(%p)->(%x)\n", This, v);
642 static HRESULT WINAPI HTMLFrameBase2_get_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL *p)
644 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
645 FIXME("(%p)->(%p)\n", This, p);
649 static const IHTMLFrameBase2Vtbl HTMLFrameBase2Vtbl = {
650 HTMLFrameBase2_QueryInterface,
651 HTMLFrameBase2_AddRef,
652 HTMLFrameBase2_Release,
653 HTMLFrameBase2_GetTypeInfoCount,
654 HTMLFrameBase2_GetTypeInfo,
655 HTMLFrameBase2_GetIDsOfNames,
656 HTMLFrameBase2_Invoke,
657 HTMLFrameBase2_get_contentWindow,
658 HTMLFrameBase2_put_onload,
659 HTMLFrameBase2_get_onload,
660 HTMLFrameBase2_put_onreadystatechange,
661 HTMLFrameBase2_get_onreadystatechange,
662 HTMLFrameBase2_get_readyState,
663 HTMLFrameBase2_put_allowTransparency,
664 HTMLFrameBase2_get_allowTransparency
667 HRESULT HTMLFrameBase_QI(HTMLFrameBase *This, REFIID riid, void **ppv)
669 if(IsEqualGUID(&IID_IHTMLFrameBase, riid)) {
670 TRACE("(%p)->(IID_IHTMLFrameBase %p)\n", This, ppv);
671 *ppv = &This->IHTMLFrameBase_iface;
672 }else if(IsEqualGUID(&IID_IHTMLFrameBase2, riid)) {
673 TRACE("(%p)->(IID_IHTMLFrameBase2 %p)\n", This, ppv);
674 *ppv = &This->IHTMLFrameBase2_iface;
676 return HTMLElement_QI(&This->element.node, riid, ppv);
679 IUnknown_AddRef((IUnknown*)*ppv);
683 void HTMLFrameBase_destructor(HTMLFrameBase *This)
685 if(This->content_window)
686 This->content_window->frame_element = NULL;
688 HTMLElement_destructor(&This->element.node);
691 void HTMLFrameBase_Init(HTMLFrameBase *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem,
692 dispex_static_data_t *dispex_data)
696 This->IHTMLFrameBase_iface.lpVtbl = &HTMLFrameBaseVtbl;
697 This->IHTMLFrameBase2_iface.lpVtbl = &HTMLFrameBase2Vtbl;
699 HTMLElement_Init(&This->element, doc, nselem, dispex_data);
701 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLFrameElement, (void**)&This->nsframe);
702 if(NS_FAILED(nsres)) {
703 This->nsframe = NULL;
704 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLIFrameElement, (void**)&This->nsiframe);
705 assert(nsres == NS_OK && (nsIDOMNode*)This->nsiframe == This->element.node.nsnode);
707 assert((nsIDOMNode*)This->nsframe == This->element.node.nsnode);
708 This->nsiframe = NULL;
711 /* Share the reference with nsnode */
712 nsIDOMNode_Release(This->element.node.nsnode);