oledb32/tests: Make test_database() static.
[wine.git] / dlls / mshtml / htmlframebase.c
blobacb493a7fa11065011033f6304a0380771407d86
1 /*
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
19 #include <stdarg.h>
20 #include <assert.h>
22 #define COBJMACROS
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "ole2.h"
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};
39 HRESULT set_frame_doc(HTMLFrameBase *frame, nsIDOMDocument *nsdoc)
41 nsIDOMWindow *nswindow;
42 HTMLOuterWindow *window;
43 nsresult nsres;
44 HRESULT hres = S_OK;
46 if(frame->content_window)
47 return S_OK;
49 nsres = nsIDOMDocument_GetDefaultView(nsdoc, &nswindow);
50 if(NS_FAILED(nsres) || !nswindow)
51 return E_FAIL;
53 window = nswindow_to_window(nswindow);
54 if(!window)
55 hres = HTMLOuterWindow_Create(frame->element.node.doc->basedoc.doc_obj, nswindow,
56 frame->element.node.doc->basedoc.window, &window);
57 nsIDOMWindow_Release(nswindow);
58 if(FAILED(hres))
59 return hres;
61 frame->content_window = window;
62 window->frame_element = frame;
63 return S_OK;
66 static inline HTMLFrameBase *impl_from_IHTMLFrameBase(IHTMLFrameBase *iface)
68 return CONTAINING_RECORD(iface, HTMLFrameBase, IHTMLFrameBase_iface);
71 static HRESULT WINAPI HTMLFrameBase_QueryInterface(IHTMLFrameBase *iface, REFIID riid, void **ppv)
73 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
75 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
78 static ULONG WINAPI HTMLFrameBase_AddRef(IHTMLFrameBase *iface)
80 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
82 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
85 static ULONG WINAPI HTMLFrameBase_Release(IHTMLFrameBase *iface)
87 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
89 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
92 static HRESULT WINAPI HTMLFrameBase_GetTypeInfoCount(IHTMLFrameBase *iface, UINT *pctinfo)
94 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
96 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
99 static HRESULT WINAPI HTMLFrameBase_GetTypeInfo(IHTMLFrameBase *iface, UINT iTInfo,
100 LCID lcid, ITypeInfo **ppTInfo)
102 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
104 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
105 ppTInfo);
108 static HRESULT WINAPI HTMLFrameBase_GetIDsOfNames(IHTMLFrameBase *iface, REFIID riid,
109 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
111 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
113 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
114 cNames, lcid, rgDispId);
117 static HRESULT WINAPI HTMLFrameBase_Invoke(IHTMLFrameBase *iface, DISPID dispIdMember,
118 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
119 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
121 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
123 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
124 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
127 static HRESULT WINAPI HTMLFrameBase_put_src(IHTMLFrameBase *iface, BSTR v)
129 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
131 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
133 if(!This->content_window || !This->element.node.doc || !This->element.node.doc->basedoc.window) {
134 FIXME("detached element\n");
135 return E_FAIL;
138 return navigate_url(This->content_window, v, This->element.node.doc->basedoc.window->uri);
141 static HRESULT WINAPI HTMLFrameBase_get_src(IHTMLFrameBase *iface, BSTR *p)
143 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
144 FIXME("(%p)->(%p)\n", This, p);
145 return E_NOTIMPL;
148 static HRESULT WINAPI HTMLFrameBase_put_name(IHTMLFrameBase *iface, BSTR v)
150 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
151 nsAString name_str;
152 nsresult nsres;
154 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
156 if(!This->nsframe && !This->nsiframe) {
157 ERR("No attached ns frame object\n");
158 return E_UNEXPECTED;
161 nsAString_InitDepend(&name_str, v);
162 if(This->nsframe)
163 nsres = nsIDOMHTMLFrameElement_SetName(This->nsframe, &name_str);
164 else
165 nsres = nsIDOMHTMLIFrameElement_SetName(This->nsiframe, &name_str);
166 nsAString_Finish(&name_str);
167 if(NS_FAILED(nsres)) {
168 ERR("SetName failed: %08x\n", nsres);
169 return E_FAIL;
172 return S_OK;
175 static HRESULT WINAPI HTMLFrameBase_get_name(IHTMLFrameBase *iface, BSTR *p)
177 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
178 nsAString nsstr;
179 nsresult nsres;
181 TRACE("(%p)->(%p)\n", This, p);
183 if(!This->nsframe && !This->nsiframe) {
184 ERR("No attached ns frame object\n");
185 return E_UNEXPECTED;
188 nsAString_Init(&nsstr, NULL);
189 if(This->nsframe)
190 nsres = nsIDOMHTMLFrameElement_GetName(This->nsframe, &nsstr);
191 else
192 nsres = nsIDOMHTMLIFrameElement_GetName(This->nsiframe, &nsstr);
193 return return_nsstr(nsres, &nsstr, p);
196 static HRESULT WINAPI HTMLFrameBase_put_border(IHTMLFrameBase *iface, VARIANT v)
198 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
199 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
200 return E_NOTIMPL;
203 static HRESULT WINAPI HTMLFrameBase_get_border(IHTMLFrameBase *iface, VARIANT *p)
205 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
206 FIXME("(%p)->(%p)\n", This, p);
207 return E_NOTIMPL;
210 static HRESULT WINAPI HTMLFrameBase_put_frameBorder(IHTMLFrameBase *iface, BSTR v)
212 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
213 nsAString nsstr;
214 nsresult nsres;
216 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
218 if(!This->nsframe && !This->nsiframe) {
219 ERR("No attached ns frame object\n");
220 return E_UNEXPECTED;
223 nsAString_InitDepend(&nsstr, v);
224 if(This->nsframe)
225 nsres = nsIDOMHTMLFrameElement_SetFrameBorder(This->nsframe, &nsstr);
226 else
227 nsres = nsIDOMHTMLIFrameElement_SetFrameBorder(This->nsiframe, &nsstr);
228 nsAString_Finish(&nsstr);
229 if(NS_FAILED(nsres)) {
230 ERR("SetFrameBorder failed: %08x\n", nsres);
231 return E_FAIL;
234 return S_OK;
237 static HRESULT WINAPI HTMLFrameBase_get_frameBorder(IHTMLFrameBase *iface, BSTR *p)
239 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
240 nsAString nsstr;
241 nsresult nsres;
243 TRACE("(%p)->(%p)\n", This, p);
245 if(!This->nsframe && !This->nsiframe) {
246 ERR("No attached ns frame object\n");
247 return E_UNEXPECTED;
250 nsAString_Init(&nsstr, NULL);
251 if(This->nsframe)
252 nsres = nsIDOMHTMLFrameElement_GetFrameBorder(This->nsframe, &nsstr);
253 else
254 nsres = nsIDOMHTMLIFrameElement_GetFrameBorder(This->nsiframe, &nsstr);
255 return return_nsstr(nsres, &nsstr, p);
258 static HRESULT WINAPI HTMLFrameBase_put_frameSpacing(IHTMLFrameBase *iface, VARIANT v)
260 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
261 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
262 return E_NOTIMPL;
265 static HRESULT WINAPI HTMLFrameBase_get_frameSpacing(IHTMLFrameBase *iface, VARIANT *p)
267 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
268 FIXME("(%p)->(%p)\n", This, p);
269 return E_NOTIMPL;
272 static HRESULT WINAPI HTMLFrameBase_put_marginWidth(IHTMLFrameBase *iface, VARIANT v)
274 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
275 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
276 return E_NOTIMPL;
279 static HRESULT WINAPI HTMLFrameBase_get_marginWidth(IHTMLFrameBase *iface, VARIANT *p)
281 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
282 FIXME("(%p)->(%p)\n", This, p);
283 return E_NOTIMPL;
286 static HRESULT WINAPI HTMLFrameBase_put_marginHeight(IHTMLFrameBase *iface, VARIANT v)
288 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
289 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
290 return E_NOTIMPL;
293 static HRESULT WINAPI HTMLFrameBase_get_marginHeight(IHTMLFrameBase *iface, VARIANT *p)
295 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
296 FIXME("(%p)->(%p)\n", This, p);
297 return E_NOTIMPL;
300 static HRESULT WINAPI HTMLFrameBase_put_noResize(IHTMLFrameBase *iface, VARIANT_BOOL v)
302 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
303 FIXME("(%p)->(%x)\n", This, v);
304 return E_NOTIMPL;
307 static HRESULT WINAPI HTMLFrameBase_get_noResize(IHTMLFrameBase *iface, VARIANT_BOOL *p)
309 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
310 FIXME("(%p)->(%p)\n", This, p);
311 return E_NOTIMPL;
314 static HRESULT WINAPI HTMLFrameBase_put_scrolling(IHTMLFrameBase *iface, BSTR v)
316 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
317 nsAString nsstr;
318 nsresult nsres;
320 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
322 if(!(!strcmpiW(v, yesW) || !strcmpiW(v, noW) || !strcmpiW(v, autoW)))
323 return E_INVALIDARG;
325 if(This->nsframe) {
326 nsAString_InitDepend(&nsstr, v);
327 nsres = nsIDOMHTMLFrameElement_SetScrolling(This->nsframe, &nsstr);
328 }else if(This->nsiframe) {
329 nsAString_InitDepend(&nsstr, v);
330 nsres = nsIDOMHTMLIFrameElement_SetScrolling(This->nsiframe, &nsstr);
331 }else {
332 ERR("No attached ns frame object\n");
333 return E_UNEXPECTED;
335 nsAString_Finish(&nsstr);
337 if(NS_FAILED(nsres)) {
338 ERR("SetScrolling failed: 0x%08x\n", nsres);
339 return E_FAIL;
342 return S_OK;
345 static HRESULT WINAPI HTMLFrameBase_get_scrolling(IHTMLFrameBase *iface, BSTR *p)
347 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
348 nsAString nsstr;
349 const PRUnichar *strdata;
350 nsresult nsres;
352 TRACE("(%p)->(%p)\n", This, p);
354 if(This->nsframe) {
355 nsAString_Init(&nsstr, NULL);
356 nsres = nsIDOMHTMLFrameElement_GetScrolling(This->nsframe, &nsstr);
357 }else if(This->nsiframe) {
358 nsAString_Init(&nsstr, NULL);
359 nsres = nsIDOMHTMLIFrameElement_GetScrolling(This->nsiframe, &nsstr);
360 }else {
361 ERR("No attached ns frame object\n");
362 return E_UNEXPECTED;
365 if(NS_FAILED(nsres)) {
366 ERR("GetScrolling failed: 0x%08x\n", nsres);
367 nsAString_Finish(&nsstr);
368 return E_FAIL;
371 nsAString_GetData(&nsstr, &strdata);
373 if(*strdata)
374 *p = SysAllocString(strdata);
375 else
376 *p = SysAllocString(autoW);
378 nsAString_Finish(&nsstr);
380 return *p ? S_OK : E_OUTOFMEMORY;
383 static const IHTMLFrameBaseVtbl HTMLFrameBaseVtbl = {
384 HTMLFrameBase_QueryInterface,
385 HTMLFrameBase_AddRef,
386 HTMLFrameBase_Release,
387 HTMLFrameBase_GetTypeInfoCount,
388 HTMLFrameBase_GetTypeInfo,
389 HTMLFrameBase_GetIDsOfNames,
390 HTMLFrameBase_Invoke,
391 HTMLFrameBase_put_src,
392 HTMLFrameBase_get_src,
393 HTMLFrameBase_put_name,
394 HTMLFrameBase_get_name,
395 HTMLFrameBase_put_border,
396 HTMLFrameBase_get_border,
397 HTMLFrameBase_put_frameBorder,
398 HTMLFrameBase_get_frameBorder,
399 HTMLFrameBase_put_frameSpacing,
400 HTMLFrameBase_get_frameSpacing,
401 HTMLFrameBase_put_marginWidth,
402 HTMLFrameBase_get_marginWidth,
403 HTMLFrameBase_put_marginHeight,
404 HTMLFrameBase_get_marginHeight,
405 HTMLFrameBase_put_noResize,
406 HTMLFrameBase_get_noResize,
407 HTMLFrameBase_put_scrolling,
408 HTMLFrameBase_get_scrolling
411 static inline HTMLFrameBase *impl_from_IHTMLFrameBase2(IHTMLFrameBase2 *iface)
413 return CONTAINING_RECORD(iface, HTMLFrameBase, IHTMLFrameBase2_iface);
416 static HRESULT WINAPI HTMLFrameBase2_QueryInterface(IHTMLFrameBase2 *iface, REFIID riid, void **ppv)
418 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
420 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
423 static ULONG WINAPI HTMLFrameBase2_AddRef(IHTMLFrameBase2 *iface)
425 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
427 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
430 static ULONG WINAPI HTMLFrameBase2_Release(IHTMLFrameBase2 *iface)
432 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
434 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
437 static HRESULT WINAPI HTMLFrameBase2_GetTypeInfoCount(IHTMLFrameBase2 *iface, UINT *pctinfo)
439 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
440 FIXME("(%p)\n", This);
441 return E_NOTIMPL;
444 static HRESULT WINAPI HTMLFrameBase2_GetTypeInfo(IHTMLFrameBase2 *iface, UINT iTInfo,
445 LCID lcid, ITypeInfo **ppTInfo)
447 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
448 FIXME("(%p)\n", This);
449 return E_NOTIMPL;
452 static HRESULT WINAPI HTMLFrameBase2_GetIDsOfNames(IHTMLFrameBase2 *iface, REFIID riid,
453 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
455 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
456 FIXME("(%p)\n", This);
457 return E_NOTIMPL;
460 static HRESULT WINAPI HTMLFrameBase2_Invoke(IHTMLFrameBase2 *iface, DISPID dispIdMember,
461 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
462 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
464 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
465 FIXME("(%p)\n", This);
466 return E_NOTIMPL;
469 static HRESULT WINAPI HTMLFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface, IHTMLWindow2 **p)
471 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
473 TRACE("(%p)->(%p)\n", This, p);
475 if(This->content_window) {
476 IHTMLWindow2_AddRef(&This->content_window->base.IHTMLWindow2_iface);
477 *p = &This->content_window->base.IHTMLWindow2_iface;
478 }else {
479 WARN("NULL content window\n");
480 *p = NULL;
482 return S_OK;
485 static HRESULT WINAPI HTMLFrameBase2_put_onload(IHTMLFrameBase2 *iface, VARIANT v)
487 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
488 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
489 return E_NOTIMPL;
492 static HRESULT WINAPI HTMLFrameBase2_get_onload(IHTMLFrameBase2 *iface, VARIANT *p)
494 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
495 FIXME("(%p)->(%p)\n", This, p);
496 return E_NOTIMPL;
499 static HRESULT WINAPI HTMLFrameBase2_put_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT v)
501 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
502 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
503 return E_NOTIMPL;
506 static HRESULT WINAPI HTMLFrameBase2_get_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT *p)
508 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
509 FIXME("(%p)->(%p)\n", This, p);
510 return E_NOTIMPL;
513 static HRESULT WINAPI HTMLFrameBase2_get_readyState(IHTMLFrameBase2 *iface, BSTR *p)
515 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
517 TRACE("(%p)->(%p)\n", This, p);
519 if(!This->content_window || !This->content_window->base.inner_window->doc) {
520 FIXME("no document associated\n");
521 return E_FAIL;
524 return IHTMLDocument2_get_readyState(&This->content_window->base.inner_window->doc->basedoc.IHTMLDocument2_iface, p);
527 static HRESULT WINAPI HTMLFrameBase2_put_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL v)
529 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
530 FIXME("(%p)->(%x)\n", This, v);
531 return E_NOTIMPL;
534 static HRESULT WINAPI HTMLFrameBase2_get_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL *p)
536 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
537 FIXME("(%p)->(%p)\n", This, p);
538 return E_NOTIMPL;
541 static const IHTMLFrameBase2Vtbl HTMLFrameBase2Vtbl = {
542 HTMLFrameBase2_QueryInterface,
543 HTMLFrameBase2_AddRef,
544 HTMLFrameBase2_Release,
545 HTMLFrameBase2_GetTypeInfoCount,
546 HTMLFrameBase2_GetTypeInfo,
547 HTMLFrameBase2_GetIDsOfNames,
548 HTMLFrameBase2_Invoke,
549 HTMLFrameBase2_get_contentWindow,
550 HTMLFrameBase2_put_onload,
551 HTMLFrameBase2_get_onload,
552 HTMLFrameBase2_put_onreadystatechange,
553 HTMLFrameBase2_get_onreadystatechange,
554 HTMLFrameBase2_get_readyState,
555 HTMLFrameBase2_put_allowTransparency,
556 HTMLFrameBase2_get_allowTransparency
559 HRESULT HTMLFrameBase_QI(HTMLFrameBase *This, REFIID riid, void **ppv)
561 if(IsEqualGUID(&IID_IHTMLFrameBase, riid)) {
562 TRACE("(%p)->(IID_IHTMLFrameBase %p)\n", This, ppv);
563 *ppv = &This->IHTMLFrameBase_iface;
564 }else if(IsEqualGUID(&IID_IHTMLFrameBase2, riid)) {
565 TRACE("(%p)->(IID_IHTMLFrameBase2 %p)\n", This, ppv);
566 *ppv = &This->IHTMLFrameBase2_iface;
567 }else {
568 return HTMLElement_QI(&This->element.node, riid, ppv);
571 IUnknown_AddRef((IUnknown*)*ppv);
572 return S_OK;
575 void HTMLFrameBase_destructor(HTMLFrameBase *This)
577 if(This->content_window)
578 This->content_window->frame_element = NULL;
580 HTMLElement_destructor(&This->element.node);
583 void HTMLFrameBase_Init(HTMLFrameBase *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem,
584 dispex_static_data_t *dispex_data)
586 nsresult nsres;
588 This->IHTMLFrameBase_iface.lpVtbl = &HTMLFrameBaseVtbl;
589 This->IHTMLFrameBase2_iface.lpVtbl = &HTMLFrameBase2Vtbl;
591 HTMLElement_Init(&This->element, doc, nselem, dispex_data);
593 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLFrameElement, (void**)&This->nsframe);
594 if(NS_FAILED(nsres)) {
595 This->nsframe = NULL;
596 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLIFrameElement, (void**)&This->nsiframe);
597 assert(nsres == NS_OK && (nsIDOMNode*)This->nsiframe == This->element.node.nsnode);
598 }else {
599 assert((nsIDOMNode*)This->nsframe == This->element.node.nsnode);
600 This->nsiframe = NULL;
603 /* Share the reference with nsnode */
604 nsIDOMNode_Release(This->element.node.nsnode);