mshtml: Use IUri as base URL in navigate_url.
[wine.git] / dlls / mshtml / htmlframebase.c
blob55a56db5d804f0741158bee3472d59afbb0e3e49
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 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
152 return E_NOTIMPL;
155 static HRESULT WINAPI HTMLFrameBase_get_name(IHTMLFrameBase *iface, BSTR *p)
157 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
158 nsAString nsstr;
159 nsresult nsres;
161 TRACE("(%p)->(%p)\n", This, p);
163 if(!This->nsframe && !This->nsiframe) {
164 ERR("No attached ns frame object\n");
165 return E_UNEXPECTED;
168 nsAString_Init(&nsstr, NULL);
169 if(This->nsframe)
170 nsres = nsIDOMHTMLFrameElement_GetName(This->nsframe, &nsstr);
171 else
172 nsres = nsIDOMHTMLIFrameElement_GetName(This->nsiframe, &nsstr);
173 return return_nsstr(nsres, &nsstr, p);
176 static HRESULT WINAPI HTMLFrameBase_put_border(IHTMLFrameBase *iface, VARIANT v)
178 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
179 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
180 return E_NOTIMPL;
183 static HRESULT WINAPI HTMLFrameBase_get_border(IHTMLFrameBase *iface, VARIANT *p)
185 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
186 FIXME("(%p)->(%p)\n", This, p);
187 return E_NOTIMPL;
190 static HRESULT WINAPI HTMLFrameBase_put_frameBorder(IHTMLFrameBase *iface, BSTR v)
192 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
193 nsAString nsstr;
194 nsresult nsres;
196 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
198 if(!This->nsframe && !This->nsiframe) {
199 ERR("No attached ns frame object\n");
200 return E_UNEXPECTED;
203 nsAString_InitDepend(&nsstr, v);
204 if(This->nsframe)
205 nsres = nsIDOMHTMLFrameElement_SetFrameBorder(This->nsframe, &nsstr);
206 else
207 nsres = nsIDOMHTMLIFrameElement_SetFrameBorder(This->nsiframe, &nsstr);
208 nsAString_Finish(&nsstr);
209 if(NS_FAILED(nsres)) {
210 ERR("SetFrameBorder failed: %08x\n", nsres);
211 return E_FAIL;
214 return S_OK;
217 static HRESULT WINAPI HTMLFrameBase_get_frameBorder(IHTMLFrameBase *iface, BSTR *p)
219 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
220 nsAString nsstr;
221 nsresult nsres;
223 TRACE("(%p)->(%p)\n", This, p);
225 if(!This->nsframe && !This->nsiframe) {
226 ERR("No attached ns frame object\n");
227 return E_UNEXPECTED;
230 nsAString_Init(&nsstr, NULL);
231 if(This->nsframe)
232 nsres = nsIDOMHTMLFrameElement_GetFrameBorder(This->nsframe, &nsstr);
233 else
234 nsres = nsIDOMHTMLIFrameElement_GetFrameBorder(This->nsiframe, &nsstr);
235 return return_nsstr(nsres, &nsstr, p);
238 static HRESULT WINAPI HTMLFrameBase_put_frameSpacing(IHTMLFrameBase *iface, VARIANT v)
240 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
241 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
242 return E_NOTIMPL;
245 static HRESULT WINAPI HTMLFrameBase_get_frameSpacing(IHTMLFrameBase *iface, VARIANT *p)
247 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
248 FIXME("(%p)->(%p)\n", This, p);
249 return E_NOTIMPL;
252 static HRESULT WINAPI HTMLFrameBase_put_marginWidth(IHTMLFrameBase *iface, VARIANT v)
254 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
255 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
256 return E_NOTIMPL;
259 static HRESULT WINAPI HTMLFrameBase_get_marginWidth(IHTMLFrameBase *iface, VARIANT *p)
261 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
262 FIXME("(%p)->(%p)\n", This, p);
263 return E_NOTIMPL;
266 static HRESULT WINAPI HTMLFrameBase_put_marginHeight(IHTMLFrameBase *iface, VARIANT v)
268 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
269 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
270 return E_NOTIMPL;
273 static HRESULT WINAPI HTMLFrameBase_get_marginHeight(IHTMLFrameBase *iface, VARIANT *p)
275 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
276 FIXME("(%p)->(%p)\n", This, p);
277 return E_NOTIMPL;
280 static HRESULT WINAPI HTMLFrameBase_put_noResize(IHTMLFrameBase *iface, VARIANT_BOOL v)
282 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
283 FIXME("(%p)->(%x)\n", This, v);
284 return E_NOTIMPL;
287 static HRESULT WINAPI HTMLFrameBase_get_noResize(IHTMLFrameBase *iface, VARIANT_BOOL *p)
289 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
290 FIXME("(%p)->(%p)\n", This, p);
291 return E_NOTIMPL;
294 static HRESULT WINAPI HTMLFrameBase_put_scrolling(IHTMLFrameBase *iface, BSTR v)
296 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
297 nsAString nsstr;
298 nsresult nsres;
300 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
302 if(!(!strcmpiW(v, yesW) || !strcmpiW(v, noW) || !strcmpiW(v, autoW)))
303 return E_INVALIDARG;
305 if(This->nsframe) {
306 nsAString_InitDepend(&nsstr, v);
307 nsres = nsIDOMHTMLFrameElement_SetScrolling(This->nsframe, &nsstr);
308 }else if(This->nsiframe) {
309 nsAString_InitDepend(&nsstr, v);
310 nsres = nsIDOMHTMLIFrameElement_SetScrolling(This->nsiframe, &nsstr);
311 }else {
312 ERR("No attached ns frame object\n");
313 return E_UNEXPECTED;
315 nsAString_Finish(&nsstr);
317 if(NS_FAILED(nsres)) {
318 ERR("SetScrolling failed: 0x%08x\n", nsres);
319 return E_FAIL;
322 return S_OK;
325 static HRESULT WINAPI HTMLFrameBase_get_scrolling(IHTMLFrameBase *iface, BSTR *p)
327 HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface);
328 nsAString nsstr;
329 const PRUnichar *strdata;
330 nsresult nsres;
332 TRACE("(%p)->(%p)\n", This, p);
334 if(This->nsframe) {
335 nsAString_Init(&nsstr, NULL);
336 nsres = nsIDOMHTMLFrameElement_GetScrolling(This->nsframe, &nsstr);
337 }else if(This->nsiframe) {
338 nsAString_Init(&nsstr, NULL);
339 nsres = nsIDOMHTMLIFrameElement_GetScrolling(This->nsiframe, &nsstr);
340 }else {
341 ERR("No attached ns frame object\n");
342 return E_UNEXPECTED;
345 if(NS_FAILED(nsres)) {
346 ERR("GetScrolling failed: 0x%08x\n", nsres);
347 nsAString_Finish(&nsstr);
348 return E_FAIL;
351 nsAString_GetData(&nsstr, &strdata);
353 if(*strdata)
354 *p = SysAllocString(strdata);
355 else
356 *p = SysAllocString(autoW);
358 nsAString_Finish(&nsstr);
360 return *p ? S_OK : E_OUTOFMEMORY;
363 static const IHTMLFrameBaseVtbl HTMLFrameBaseVtbl = {
364 HTMLFrameBase_QueryInterface,
365 HTMLFrameBase_AddRef,
366 HTMLFrameBase_Release,
367 HTMLFrameBase_GetTypeInfoCount,
368 HTMLFrameBase_GetTypeInfo,
369 HTMLFrameBase_GetIDsOfNames,
370 HTMLFrameBase_Invoke,
371 HTMLFrameBase_put_src,
372 HTMLFrameBase_get_src,
373 HTMLFrameBase_put_name,
374 HTMLFrameBase_get_name,
375 HTMLFrameBase_put_border,
376 HTMLFrameBase_get_border,
377 HTMLFrameBase_put_frameBorder,
378 HTMLFrameBase_get_frameBorder,
379 HTMLFrameBase_put_frameSpacing,
380 HTMLFrameBase_get_frameSpacing,
381 HTMLFrameBase_put_marginWidth,
382 HTMLFrameBase_get_marginWidth,
383 HTMLFrameBase_put_marginHeight,
384 HTMLFrameBase_get_marginHeight,
385 HTMLFrameBase_put_noResize,
386 HTMLFrameBase_get_noResize,
387 HTMLFrameBase_put_scrolling,
388 HTMLFrameBase_get_scrolling
391 static inline HTMLFrameBase *impl_from_IHTMLFrameBase2(IHTMLFrameBase2 *iface)
393 return CONTAINING_RECORD(iface, HTMLFrameBase, IHTMLFrameBase2_iface);
396 static HRESULT WINAPI HTMLFrameBase2_QueryInterface(IHTMLFrameBase2 *iface, REFIID riid, void **ppv)
398 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
400 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
403 static ULONG WINAPI HTMLFrameBase2_AddRef(IHTMLFrameBase2 *iface)
405 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
407 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
410 static ULONG WINAPI HTMLFrameBase2_Release(IHTMLFrameBase2 *iface)
412 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
414 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
417 static HRESULT WINAPI HTMLFrameBase2_GetTypeInfoCount(IHTMLFrameBase2 *iface, UINT *pctinfo)
419 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
420 FIXME("(%p)\n", This);
421 return E_NOTIMPL;
424 static HRESULT WINAPI HTMLFrameBase2_GetTypeInfo(IHTMLFrameBase2 *iface, UINT iTInfo,
425 LCID lcid, ITypeInfo **ppTInfo)
427 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
428 FIXME("(%p)\n", This);
429 return E_NOTIMPL;
432 static HRESULT WINAPI HTMLFrameBase2_GetIDsOfNames(IHTMLFrameBase2 *iface, REFIID riid,
433 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
435 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
436 FIXME("(%p)\n", This);
437 return E_NOTIMPL;
440 static HRESULT WINAPI HTMLFrameBase2_Invoke(IHTMLFrameBase2 *iface, DISPID dispIdMember,
441 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
442 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
444 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
445 FIXME("(%p)\n", This);
446 return E_NOTIMPL;
449 static HRESULT WINAPI HTMLFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface, IHTMLWindow2 **p)
451 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
453 TRACE("(%p)->(%p)\n", This, p);
455 if(This->content_window) {
456 IHTMLWindow2_AddRef(&This->content_window->base.IHTMLWindow2_iface);
457 *p = &This->content_window->base.IHTMLWindow2_iface;
458 }else {
459 WARN("NULL content window\n");
460 *p = NULL;
462 return S_OK;
465 static HRESULT WINAPI HTMLFrameBase2_put_onload(IHTMLFrameBase2 *iface, VARIANT v)
467 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
468 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
469 return E_NOTIMPL;
472 static HRESULT WINAPI HTMLFrameBase2_get_onload(IHTMLFrameBase2 *iface, VARIANT *p)
474 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
475 FIXME("(%p)->(%p)\n", This, p);
476 return E_NOTIMPL;
479 static HRESULT WINAPI HTMLFrameBase2_put_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT v)
481 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
482 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
483 return E_NOTIMPL;
486 static HRESULT WINAPI HTMLFrameBase2_get_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT *p)
488 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
489 FIXME("(%p)->(%p)\n", This, p);
490 return E_NOTIMPL;
493 static HRESULT WINAPI HTMLFrameBase2_get_readyState(IHTMLFrameBase2 *iface, BSTR *p)
495 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
497 TRACE("(%p)->(%p)\n", This, p);
499 if(!This->content_window || !This->content_window->base.inner_window->doc) {
500 FIXME("no document associated\n");
501 return E_FAIL;
504 return IHTMLDocument2_get_readyState(&This->content_window->base.inner_window->doc->basedoc.IHTMLDocument2_iface, p);
507 static HRESULT WINAPI HTMLFrameBase2_put_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL v)
509 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
510 FIXME("(%p)->(%x)\n", This, v);
511 return E_NOTIMPL;
514 static HRESULT WINAPI HTMLFrameBase2_get_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL *p)
516 HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
517 FIXME("(%p)->(%p)\n", This, p);
518 return E_NOTIMPL;
521 static const IHTMLFrameBase2Vtbl HTMLFrameBase2Vtbl = {
522 HTMLFrameBase2_QueryInterface,
523 HTMLFrameBase2_AddRef,
524 HTMLFrameBase2_Release,
525 HTMLFrameBase2_GetTypeInfoCount,
526 HTMLFrameBase2_GetTypeInfo,
527 HTMLFrameBase2_GetIDsOfNames,
528 HTMLFrameBase2_Invoke,
529 HTMLFrameBase2_get_contentWindow,
530 HTMLFrameBase2_put_onload,
531 HTMLFrameBase2_get_onload,
532 HTMLFrameBase2_put_onreadystatechange,
533 HTMLFrameBase2_get_onreadystatechange,
534 HTMLFrameBase2_get_readyState,
535 HTMLFrameBase2_put_allowTransparency,
536 HTMLFrameBase2_get_allowTransparency
539 HRESULT HTMLFrameBase_QI(HTMLFrameBase *This, REFIID riid, void **ppv)
541 if(IsEqualGUID(&IID_IHTMLFrameBase, riid)) {
542 TRACE("(%p)->(IID_IHTMLFrameBase %p)\n", This, ppv);
543 *ppv = &This->IHTMLFrameBase_iface;
544 }else if(IsEqualGUID(&IID_IHTMLFrameBase2, riid)) {
545 TRACE("(%p)->(IID_IHTMLFrameBase2 %p)\n", This, ppv);
546 *ppv = &This->IHTMLFrameBase2_iface;
547 }else {
548 return HTMLElement_QI(&This->element.node, riid, ppv);
551 IUnknown_AddRef((IUnknown*)*ppv);
552 return S_OK;
555 void HTMLFrameBase_destructor(HTMLFrameBase *This)
557 if(This->content_window)
558 This->content_window->frame_element = NULL;
560 HTMLElement_destructor(&This->element.node);
563 void HTMLFrameBase_Init(HTMLFrameBase *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem,
564 dispex_static_data_t *dispex_data)
566 nsresult nsres;
568 This->IHTMLFrameBase_iface.lpVtbl = &HTMLFrameBaseVtbl;
569 This->IHTMLFrameBase2_iface.lpVtbl = &HTMLFrameBase2Vtbl;
571 HTMLElement_Init(&This->element, doc, nselem, dispex_data);
573 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLFrameElement, (void**)&This->nsframe);
574 if(NS_FAILED(nsres)) {
575 This->nsframe = NULL;
576 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLIFrameElement, (void**)&This->nsiframe);
577 assert(nsres == NS_OK && (nsIDOMNode*)This->nsiframe == This->element.node.nsnode);
578 }else {
579 assert((nsIDOMNode*)This->nsframe == This->element.node.nsnode);
580 This->nsiframe = NULL;
583 /* Share the reference with nsnode */
584 nsIDOMNode_Release(This->element.node.nsnode);