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"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
35 static const WCHAR autoW[] = {'a','u','t','o',0};
36 static const WCHAR yesW[] = {'y','e','s',0};
37 static const WCHAR noW[] = {'n','o',0};
38 static const WCHAR pxW[] = {'p','x',0};
40 HRESULT set_frame_doc(HTMLFrameBase *frame, nsIDOMDocument *nsdoc)
42 nsIDOMWindow *nswindow;
43 HTMLOuterWindow *window;
47 if(frame->content_window)
50 nsres = nsIDOMDocument_GetDefaultView(nsdoc, &nswindow);
51 if(NS_FAILED(nsres) || !nswindow)
54 window = nswindow_to_window(nswindow);
56 hres = HTMLOuterWindow_Create(frame->element.node.doc->basedoc.doc_obj, nswindow,
57 frame->element.node.doc->basedoc.window, &window);
58 nsIDOMWindow_Release(nswindow);
62 frame->content_window = window;
63 window->frame_element = frame;
67 static inline HTMLFrameBase *impl_from_IHTMLFrameBase(IHTMLFrameBase *iface)
69 return CONTAINING_RECORD(iface, HTMLFrameBase, IHTMLFrameBase_iface);
72 static HRESULT WINAPI HTMLFrameBase_QueryInterface(IHTMLFrameBase *iface, REFIID riid, void **ppv)
74 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
76 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
79 static ULONG WINAPI HTMLFrameBase_AddRef(IHTMLFrameBase *iface)
81 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
83 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
86 static ULONG WINAPI HTMLFrameBase_Release(IHTMLFrameBase *iface)
88 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
90 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
93 static HRESULT WINAPI HTMLFrameBase_GetTypeInfoCount(IHTMLFrameBase *iface, UINT *pctinfo)
95 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
97 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
100 static HRESULT WINAPI HTMLFrameBase_GetTypeInfo(IHTMLFrameBase *iface, UINT iTInfo,
101 LCID lcid, ITypeInfo **ppTInfo)
103 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
105 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
109 static HRESULT WINAPI HTMLFrameBase_GetIDsOfNames(IHTMLFrameBase *iface, REFIID riid,
110 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
112 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
114 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
115 cNames, lcid, rgDispId);
118 static HRESULT WINAPI HTMLFrameBase_Invoke(IHTMLFrameBase *iface, DISPID dispIdMember,
119 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
120 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
122 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
124 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
125 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
128 static HRESULT WINAPI HTMLFrameBase_put_src(IHTMLFrameBase *iface, BSTR v)
130 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
132 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
134 if(!This->content_window || !This->element.node.doc || !This->element.node.doc->basedoc.window) {
135 FIXME("detached element\n");
139 return navigate_url(This->content_window, v, This->element.node.doc->basedoc.window->uri);
142 static HRESULT WINAPI HTMLFrameBase_get_src(IHTMLFrameBase *iface, BSTR *p)
144 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
145 FIXME("(%p)->(%p)\n", This, p);
149 static HRESULT WINAPI HTMLFrameBase_put_name(IHTMLFrameBase *iface, BSTR v)
151 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
155 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
157 if(!This->nsframe && !This->nsiframe) {
158 ERR("No attached ns frame object\n");
162 nsAString_InitDepend(&name_str, v);
164 nsres = nsIDOMHTMLFrameElement_SetName(This->nsframe, &name_str);
166 nsres = nsIDOMHTMLIFrameElement_SetName(This->nsiframe, &name_str);
167 nsAString_Finish(&name_str);
168 if(NS_FAILED(nsres)) {
169 ERR("SetName failed: %08x\n", nsres);
176 static HRESULT WINAPI HTMLFrameBase_get_name(IHTMLFrameBase *iface, BSTR *p)
178 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
182 TRACE("(%p)->(%p)\n", This, p);
184 if(!This->nsframe && !This->nsiframe) {
185 ERR("No attached ns frame object\n");
189 nsAString_Init(&nsstr, NULL);
191 nsres = nsIDOMHTMLFrameElement_GetName(This->nsframe, &nsstr);
193 nsres = nsIDOMHTMLIFrameElement_GetName(This->nsiframe, &nsstr);
194 return return_nsstr(nsres, &nsstr, p);
197 static HRESULT WINAPI HTMLFrameBase_put_border(IHTMLFrameBase *iface, VARIANT v)
199 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
200 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
204 static HRESULT WINAPI HTMLFrameBase_get_border(IHTMLFrameBase *iface, VARIANT *p)
206 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
207 FIXME("(%p)->(%p)\n", This, p);
211 static HRESULT WINAPI HTMLFrameBase_put_frameBorder(IHTMLFrameBase *iface, BSTR v)
213 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
217 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
219 if(!This->nsframe && !This->nsiframe) {
220 ERR("No attached ns frame object\n");
224 nsAString_InitDepend(&nsstr, v);
226 nsres = nsIDOMHTMLFrameElement_SetFrameBorder(This->nsframe, &nsstr);
228 nsres = nsIDOMHTMLIFrameElement_SetFrameBorder(This->nsiframe, &nsstr);
229 nsAString_Finish(&nsstr);
230 if(NS_FAILED(nsres)) {
231 ERR("SetFrameBorder failed: %08x\n", nsres);
238 static HRESULT WINAPI HTMLFrameBase_get_frameBorder(IHTMLFrameBase *iface, BSTR *p)
240 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
244 TRACE("(%p)->(%p)\n", This, p);
246 if(!This->nsframe && !This->nsiframe) {
247 ERR("No attached ns frame object\n");
251 nsAString_Init(&nsstr, NULL);
253 nsres = nsIDOMHTMLFrameElement_GetFrameBorder(This->nsframe, &nsstr);
255 nsres = nsIDOMHTMLIFrameElement_GetFrameBorder(This->nsiframe, &nsstr);
256 return return_nsstr(nsres, &nsstr, p);
259 static HRESULT WINAPI HTMLFrameBase_put_frameSpacing(IHTMLFrameBase *iface, VARIANT v)
261 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
262 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
266 static HRESULT WINAPI HTMLFrameBase_get_frameSpacing(IHTMLFrameBase *iface, VARIANT *p)
268 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
269 FIXME("(%p)->(%p)\n", This, p);
273 static HRESULT WINAPI HTMLFrameBase_put_marginWidth(IHTMLFrameBase *iface, VARIANT v)
275 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
279 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
281 if(V_VT(&v) != VT_BSTR) {
282 FIXME("unsupported %s\n", debugstr_variant(&v));
286 nsAString_InitDepend(&nsstr, V_BSTR(&v));
288 nsres = nsIDOMHTMLFrameElement_SetMarginWidth(This->nsframe, &nsstr);
290 nsres = nsIDOMHTMLIFrameElement_SetMarginWidth(This->nsiframe, &nsstr);
291 nsAString_Finish(&nsstr);
292 return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
295 static HRESULT WINAPI HTMLFrameBase_get_marginWidth(IHTMLFrameBase *iface, VARIANT *p)
297 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
302 TRACE("(%p)->(%p)\n", This, p);
304 nsAString_Init(&nsstr, NULL);
306 nsres = nsIDOMHTMLFrameElement_GetMarginWidth(This->nsframe, &nsstr);
308 nsres = nsIDOMHTMLIFrameElement_GetMarginWidth(This->nsiframe, &nsstr);
309 if(NS_SUCCEEDED(nsres)) {
310 const PRUnichar *str, *end;
312 nsAString_GetData(&nsstr, &str);
317 end = strstrW(str, pxW);
319 end = str+strlenW(str);
320 ret = SysAllocStringLen(str, end-str);
325 hres = E_OUTOFMEMORY;
332 ERR("GetMarginWidth failed: %08x\n", nsres);
336 nsAString_Finish(&nsstr);
340 static HRESULT WINAPI HTMLFrameBase_put_marginHeight(IHTMLFrameBase *iface, VARIANT v)
342 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
346 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
348 if(V_VT(&v) != VT_BSTR) {
349 FIXME("unsupported %s\n", debugstr_variant(&v));
353 nsAString_InitDepend(&nsstr, V_BSTR(&v));
355 nsres = nsIDOMHTMLFrameElement_SetMarginHeight(This->nsframe, &nsstr);
357 nsres = nsIDOMHTMLIFrameElement_SetMarginHeight(This->nsiframe, &nsstr);
358 nsAString_Finish(&nsstr);
359 return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
362 static HRESULT WINAPI HTMLFrameBase_get_marginHeight(IHTMLFrameBase *iface, VARIANT *p)
364 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
369 TRACE("(%p)->(%p)\n", This, p);
371 nsAString_Init(&nsstr, NULL);
373 nsres = nsIDOMHTMLFrameElement_GetMarginHeight(This->nsframe, &nsstr);
375 nsres = nsIDOMHTMLIFrameElement_GetMarginHeight(This->nsiframe, &nsstr);
376 if(NS_SUCCEEDED(nsres)) {
377 const PRUnichar *str, *end;
379 nsAString_GetData(&nsstr, &str);
384 end = strstrW(str, pxW);
386 end = str+strlenW(str);
387 ret = SysAllocStringLen(str, end-str);
392 hres = E_OUTOFMEMORY;
399 ERR("SetMarginHeight failed: %08x\n", nsres);
403 nsAString_Finish(&nsstr);
407 static HRESULT WINAPI HTMLFrameBase_put_noResize(IHTMLFrameBase *iface, VARIANT_BOOL v)
409 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
410 FIXME("(%p)->(%x)\n", This, v);
414 static HRESULT WINAPI HTMLFrameBase_get_noResize(IHTMLFrameBase *iface, VARIANT_BOOL *p)
416 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
417 FIXME("(%p)->(%p)\n", This, p);
421 static HRESULT WINAPI HTMLFrameBase_put_scrolling(IHTMLFrameBase *iface, BSTR v)
423 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
427 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
429 if(!(!strcmpiW(v, yesW) || !strcmpiW(v, noW) || !strcmpiW(v, autoW)))
433 nsAString_InitDepend(&nsstr, v);
434 nsres = nsIDOMHTMLFrameElement_SetScrolling(This->nsframe, &nsstr);
435 }else if(This->nsiframe) {
436 nsAString_InitDepend(&nsstr, v);
437 nsres = nsIDOMHTMLIFrameElement_SetScrolling(This->nsiframe, &nsstr);
439 ERR("No attached ns frame object\n");
442 nsAString_Finish(&nsstr);
444 if(NS_FAILED(nsres)) {
445 ERR("SetScrolling failed: 0x%08x\n", nsres);
452 static HRESULT WINAPI HTMLFrameBase_get_scrolling(IHTMLFrameBase *iface, BSTR *p)
454 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
456 const PRUnichar *strdata;
459 TRACE("(%p)->(%p)\n", This, p);
462 nsAString_Init(&nsstr, NULL);
463 nsres = nsIDOMHTMLFrameElement_GetScrolling(This->nsframe, &nsstr);
464 }else if(This->nsiframe) {
465 nsAString_Init(&nsstr, NULL);
466 nsres = nsIDOMHTMLIFrameElement_GetScrolling(This->nsiframe, &nsstr);
468 ERR("No attached ns frame object\n");
472 if(NS_FAILED(nsres)) {
473 ERR("GetScrolling failed: 0x%08x\n", nsres);
474 nsAString_Finish(&nsstr);
478 nsAString_GetData(&nsstr, &strdata);
481 *p = SysAllocString(strdata);
483 *p = SysAllocString(autoW);
485 nsAString_Finish(&nsstr);
487 return *p ? S_OK : E_OUTOFMEMORY;
490 static const IHTMLFrameBaseVtbl HTMLFrameBaseVtbl = {
491 HTMLFrameBase_QueryInterface,
492 HTMLFrameBase_AddRef,
493 HTMLFrameBase_Release,
494 HTMLFrameBase_GetTypeInfoCount,
495 HTMLFrameBase_GetTypeInfo,
496 HTMLFrameBase_GetIDsOfNames,
497 HTMLFrameBase_Invoke,
498 HTMLFrameBase_put_src,
499 HTMLFrameBase_get_src,
500 HTMLFrameBase_put_name,
501 HTMLFrameBase_get_name,
502 HTMLFrameBase_put_border,
503 HTMLFrameBase_get_border,
504 HTMLFrameBase_put_frameBorder,
505 HTMLFrameBase_get_frameBorder,
506 HTMLFrameBase_put_frameSpacing,
507 HTMLFrameBase_get_frameSpacing,
508 HTMLFrameBase_put_marginWidth,
509 HTMLFrameBase_get_marginWidth,
510 HTMLFrameBase_put_marginHeight,
511 HTMLFrameBase_get_marginHeight,
512 HTMLFrameBase_put_noResize,
513 HTMLFrameBase_get_noResize,
514 HTMLFrameBase_put_scrolling,
515 HTMLFrameBase_get_scrolling
518 static inline HTMLFrameBase *impl_from_IHTMLFrameBase2(IHTMLFrameBase2 *iface)
520 return CONTAINING_RECORD(iface, HTMLFrameBase, IHTMLFrameBase2_iface);
523 static HRESULT WINAPI HTMLFrameBase2_QueryInterface(IHTMLFrameBase2 *iface, REFIID riid, void **ppv)
525 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
527 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
530 static ULONG WINAPI HTMLFrameBase2_AddRef(IHTMLFrameBase2 *iface)
532 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
534 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
537 static ULONG WINAPI HTMLFrameBase2_Release(IHTMLFrameBase2 *iface)
539 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
541 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
544 static HRESULT WINAPI HTMLFrameBase2_GetTypeInfoCount(IHTMLFrameBase2 *iface, UINT *pctinfo)
546 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
547 FIXME("(%p)\n", This);
551 static HRESULT WINAPI HTMLFrameBase2_GetTypeInfo(IHTMLFrameBase2 *iface, UINT iTInfo,
552 LCID lcid, ITypeInfo **ppTInfo)
554 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
555 FIXME("(%p)\n", This);
559 static HRESULT WINAPI HTMLFrameBase2_GetIDsOfNames(IHTMLFrameBase2 *iface, REFIID riid,
560 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
562 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
563 FIXME("(%p)\n", This);
567 static HRESULT WINAPI HTMLFrameBase2_Invoke(IHTMLFrameBase2 *iface, DISPID dispIdMember,
568 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
569 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
571 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
572 FIXME("(%p)\n", This);
576 static HRESULT WINAPI HTMLFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface, IHTMLWindow2 **p)
578 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
580 TRACE("(%p)->(%p)\n", This, p);
582 if(This->content_window) {
583 IHTMLWindow2_AddRef(&This->content_window->base.IHTMLWindow2_iface);
584 *p = &This->content_window->base.IHTMLWindow2_iface;
586 WARN("NULL content window\n");
592 static HRESULT WINAPI HTMLFrameBase2_put_onload(IHTMLFrameBase2 *iface, VARIANT v)
594 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
595 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
599 static HRESULT WINAPI HTMLFrameBase2_get_onload(IHTMLFrameBase2 *iface, VARIANT *p)
601 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
602 FIXME("(%p)->(%p)\n", This, p);
606 static HRESULT WINAPI HTMLFrameBase2_put_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT v)
608 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
609 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
613 static HRESULT WINAPI HTMLFrameBase2_get_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT *p)
615 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
616 FIXME("(%p)->(%p)\n", This, p);
620 static HRESULT WINAPI HTMLFrameBase2_get_readyState(IHTMLFrameBase2 *iface, BSTR *p)
622 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
624 TRACE("(%p)->(%p)\n", This, p);
626 if(!This->content_window || !This->content_window->base.inner_window->doc) {
627 FIXME("no document associated\n");
631 return IHTMLDocument2_get_readyState(&This->content_window->base.inner_window->doc->basedoc.IHTMLDocument2_iface, p);
634 static HRESULT WINAPI HTMLFrameBase2_put_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL v)
636 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
637 FIXME("(%p)->(%x)\n", This, v);
641 static HRESULT WINAPI HTMLFrameBase2_get_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL *p)
643 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
644 FIXME("(%p)->(%p)\n", This, p);
648 static const IHTMLFrameBase2Vtbl HTMLFrameBase2Vtbl = {
649 HTMLFrameBase2_QueryInterface,
650 HTMLFrameBase2_AddRef,
651 HTMLFrameBase2_Release,
652 HTMLFrameBase2_GetTypeInfoCount,
653 HTMLFrameBase2_GetTypeInfo,
654 HTMLFrameBase2_GetIDsOfNames,
655 HTMLFrameBase2_Invoke,
656 HTMLFrameBase2_get_contentWindow,
657 HTMLFrameBase2_put_onload,
658 HTMLFrameBase2_get_onload,
659 HTMLFrameBase2_put_onreadystatechange,
660 HTMLFrameBase2_get_onreadystatechange,
661 HTMLFrameBase2_get_readyState,
662 HTMLFrameBase2_put_allowTransparency,
663 HTMLFrameBase2_get_allowTransparency
666 HRESULT HTMLFrameBase_QI(HTMLFrameBase *This, REFIID riid, void **ppv)
668 if(IsEqualGUID(&IID_IHTMLFrameBase, riid)) {
669 TRACE("(%p)->(IID_IHTMLFrameBase %p)\n", This, ppv);
670 *ppv = &This->IHTMLFrameBase_iface;
671 }else if(IsEqualGUID(&IID_IHTMLFrameBase2, riid)) {
672 TRACE("(%p)->(IID_IHTMLFrameBase2 %p)\n", This, ppv);
673 *ppv = &This->IHTMLFrameBase2_iface;
675 return HTMLElement_QI(&This->element.node, riid, ppv);
678 IUnknown_AddRef((IUnknown*)*ppv);
682 void HTMLFrameBase_destructor(HTMLFrameBase *This)
684 if(This->content_window)
685 This->content_window->frame_element = NULL;
687 HTMLElement_destructor(&This->element.node);
690 void HTMLFrameBase_Init(HTMLFrameBase *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem,
691 dispex_static_data_t *dispex_data)
695 This->IHTMLFrameBase_iface.lpVtbl = &HTMLFrameBaseVtbl;
696 This->IHTMLFrameBase2_iface.lpVtbl = &HTMLFrameBase2Vtbl;
698 HTMLElement_Init(&This->element, doc, nselem, dispex_data);
700 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLFrameElement, (void**)&This->nsframe);
701 if(NS_FAILED(nsres)) {
702 This->nsframe = NULL;
703 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLIFrameElement, (void**)&This->nsiframe);
704 assert(nsres == NS_OK && (nsIDOMNode*)This->nsiframe == This->element.node.nsnode);
706 assert((nsIDOMNode*)This->nsframe == This->element.node.nsnode);
707 This->nsiframe = NULL;
710 /* Share the reference with nsnode */
711 nsIDOMNode_Release(This->element.node.nsnode);