4 * ***** BEGIN LICENSE BLOCK *****
5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
7 * The contents of this file are subject to the Mozilla Public License Version
8 * 1.1 (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
10 * http://www.mozilla.org/MPL/
12 * Software distributed under the License is distributed on an "AS IS" basis,
13 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14 * for the specific language governing rights and limitations under the
17 * The Original Code is mozilla.org code.
19 * The Initial Developer of the Original Code is
20 * Christopher Blizzard.
21 * Portions created by the Initial Developer are Copyright (C) 2001
22 * the Initial Developer. All Rights Reserved.
25 * Christopher Blizzard <blizzard@mozilla.org>
26 * Brian Edmond <briane@qnx.com>
28 * Alternatively, the contents of this file may be used under the terms of
29 * either the GNU General Public License Version 2 or later (the "GPL"), or
30 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
31 * in which case the provisions of the GPL or the LGPL are applicable instead
32 * of those above. If you wish to allow use of your version of this file only
33 * under the terms of either the GPL or the LGPL, and not to allow others to
34 * use your version of this file under the terms of the MPL, indicate your
35 * decision by deleting the provisions above and replace them with the notice
36 * and other provisions required by the GPL or the LGPL. If you do not delete
37 * the provisions above, a recipient may use your version of this file under
38 * the terms of any one of the MPL, the GPL or the LGPL.
40 * ***** END LICENSE BLOCK ***** */
41 #include <nsIDocShell.h>
42 #include <nsIWebProgress.h>
44 #include "nsIWidget.h"
46 // for do_GetInterface
47 #include <nsIInterfaceRequestor.h>
48 #include <nsIInterfaceRequestorUtils.h>
49 #include <nsIWebBrowserPersist.h>
50 // for do_CreateInstance
51 #include <nsIComponentManager.h>
52 #include "nsIWebProgressListener.h"
53 #include "nsIDOMHTMLImageElement.h"
55 #include <nsCWebBrowser.h>
56 #include <nsIComponentManager.h>
57 #include <nsIDocShellTreeItem.h>
58 #include <nsILocalFile.h>
60 #include "nsReadableUtils.h"
62 #include "EmbedWindow.h"
63 #include "EmbedPrivate.h"
65 #include "PtMozilla.h"
67 PtWidget_t
*EmbedWindow::sTipWindow
= nsnull
;
69 EmbedWindow::EmbedWindow(void)
73 mVisibility
= PR_FALSE
;
77 EmbedWindow::~EmbedWindow(void)
79 ExitModalEventLoop(PR_FALSE
);
83 EmbedWindow::Init(EmbedPrivate
*aOwner
)
85 // save our owner for later
88 // create our nsIWebBrowser object and set up some basic defaults.
89 mWebBrowser
= do_CreateInstance(NS_WEBBROWSER_CONTRACTID
);
91 return NS_ERROR_FAILURE
;
93 mWebBrowser
->SetContainerWindow(static_cast<nsIWebBrowserChrome
*>(this));
95 // get the doc shel for cut/copy/paste
96 //mRootDocShell = do_GetInterface(mWebBrowser);
98 nsCOMPtr
<nsIDocShellTreeItem
> item
= do_QueryInterface(mWebBrowser
);
99 item
->SetItemType(nsIDocShellTreeItem::typeContentWrapper
);
105 EmbedWindow::CreateWindow(void)
108 PtWidget_t
*ownerAsWidget
= (PtWidget_t
*)(mOwner
->mOwningWidget
);
110 // Get the base window interface for the web browser object and
111 // create the window.
112 mBaseWindow
= do_QueryInterface(mWebBrowser
);
113 rv
= mBaseWindow
->InitWindow(ownerAsWidget
,
116 ownerAsWidget
->area
.size
.w
,
117 ownerAsWidget
->area
.size
.h
);
121 rv
= mBaseWindow
->Create();
129 EmbedWindow::ReleaseChildren(void)
131 ExitModalEventLoop(PR_FALSE
);
133 mBaseWindow
->Destroy();
140 NS_IMPL_ADDREF(EmbedWindow
)
141 NS_IMPL_RELEASE(EmbedWindow
)
143 NS_INTERFACE_MAP_BEGIN(EmbedWindow
)
144 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports
, nsIWebBrowserChrome
)
145 NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome
)
146 NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChromeFocus
)
147 NS_INTERFACE_MAP_ENTRY(nsIEmbeddingSiteWindow
)
148 NS_INTERFACE_MAP_ENTRY(nsITooltipListener
)
149 NS_INTERFACE_MAP_ENTRY(nsIContextMenuListener
)
150 NS_INTERFACE_MAP_ENTRY(nsIDNSListener
)
151 NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor
)
154 // nsIWebBrowserChrome
157 EmbedWindow::SetStatus(PRUint32 aStatusType
, const PRUnichar
*aStatus
)
159 PtMozillaWidget_t
*moz
= (PtMozillaWidget_t
*) mOwner
->mOwningWidget
;
160 PtCallbackList_t
*cb
;
161 PtCallbackInfo_t cbinfo
;
162 PtMozillaInfoCb_t info
;
163 nsAutoString
Text ( aStatus
);
169 type
= Pt_MOZ_INFO_JSSTATUS
;
171 case STATUS_SCRIPT_DEFAULT
:
175 type
= Pt_MOZ_INFO_LINK
;
185 memset(&cbinfo
, 0, sizeof(cbinfo
));
186 cbinfo
.cbdata
= &info
;
187 cbinfo
.reason
= Pt_CB_MOZ_INFO
;
192 const char* status
= ToNewCString(Text
);
193 info
.data
= (char *)status
;
194 PtInvokeCallbackList(cb
, (PtWidget_t
*) moz
, &cbinfo
);
196 nsMemory::Free( (void*)status
);
202 EmbedWindow::SaveAs(char *fname
, char *dirname
)
206 nsCOMPtr
<nsIWebBrowserPersist
> persist(do_GetInterface(mWebBrowser
, &rv
));
207 if (NS_FAILED(rv
)) return rv
;
209 nsCOMPtr
<nsILocalFile
> file
;
210 NS_NewNativeLocalFile(nsDependentCString(fname
), PR_TRUE
, getter_AddRefs(file
));
212 /* the nsIWebBrowserPersist wants a parent directory where to download images and other items related to the document */
213 /* we have to provide a directory, otherwise the current SaveDocument is marked as not finished and the next one is aborted */
214 nsCOMPtr
<nsILocalFile
> parentDirAsLocal
;
215 rv
= NS_NewNativeLocalFile(nsDependentCString( dirname
), PR_TRUE
, getter_AddRefs(parentDirAsLocal
));
216 if (NS_FAILED(rv
)) return rv
;
219 persist
->GetPersistFlags( &flags
);
220 if( !(flags
& nsIWebBrowserPersist::PERSIST_FLAGS_REPLACE_EXISTING_FILES
) ) persist
->SetPersistFlags( nsIWebBrowserPersist::PERSIST_FLAGS_REPLACE_EXISTING_FILES
);
222 persist
->SaveDocument(nsnull
, file
, parentDirAsLocal
, nsnull
, 0, 0);
227 EmbedWindow::GetWebBrowser(nsIWebBrowser
**aWebBrowser
)
229 *aWebBrowser
= mWebBrowser
;
230 NS_IF_ADDREF(*aWebBrowser
);
235 EmbedWindow::SetWebBrowser(nsIWebBrowser
*aWebBrowser
)
237 mWebBrowser
= aWebBrowser
;
242 EmbedWindow::GetChromeFlags(PRUint32
*aChromeFlags
)
244 *aChromeFlags
= mOwner
->mChromeMask
;
249 EmbedWindow::SetChromeFlags(PRUint32 aChromeFlags
)
251 mOwner
->mChromeMask
= aChromeFlags
;
256 EmbedWindow::DestroyBrowserWindow(void)
258 PtMozillaWidget_t
*moz
= (PtMozillaWidget_t
*) mOwner
->mOwningWidget
;
259 PtCallbackList_t
*cb
;
260 PtCallbackInfo_t cbinfo
;
262 if (!moz
->destroy_cb
)
265 cb
= moz
->destroy_cb
;
266 memset(&cbinfo
, 0, sizeof(cbinfo
));
267 cbinfo
.reason
= Pt_CB_MOZ_DESTROY
;
268 PtInvokeCallbackList(cb
, (PtWidget_t
*)moz
, &cbinfo
);
274 EmbedWindow::SizeBrowserTo(PRInt32 aCX
, PRInt32 aCY
)
276 PtMozillaWidget_t
*moz
= (PtMozillaWidget_t
*) mOwner
->mOwningWidget
;
277 PtCallbackList_t
*cb
;
278 PtCallbackInfo_t cbinfo
;
279 PtMozillaNewAreaCb_t resize
;
285 memset(&cbinfo
, 0, sizeof(cbinfo
));
286 cbinfo
.reason
= Pt_CB_MOZ_NEW_AREA
;
287 resize
.flags
= Pt_MOZ_NEW_AREA_SET_SIZE
;
288 resize
.area
.size
.w
= aCX
;
289 resize
.area
.size
.h
= aCY
;
290 cbinfo
.cbdata
= &resize
;
291 PtInvokeCallbackList(cb
, (PtWidget_t
*)moz
, &cbinfo
);
296 EmbedWindow::ShowAsModal(void)
298 return NS_ERROR_FAILURE
;
302 EmbedWindow::IsWindowModal(PRBool
*_retval
)
309 EmbedWindow::ExitModalEventLoop(nsresult aStatus
)
314 // nsIWebBrowserChromeFocus
317 EmbedWindow::FocusNextElement()
319 PtContainerFocusNext(mOwner
->mOwningWidget
, NULL
);
324 EmbedWindow::FocusPrevElement()
326 PtContainerFocusPrev(mOwner
->mOwningWidget
, NULL
);
330 // nsIEmbeddingSiteWindow
333 EmbedWindow::SetDimensions(PRUint32 aFlags
, PRInt32 aX
, PRInt32 aY
,
334 PRInt32 aCX
, PRInt32 aCY
)
336 PtMozillaWidget_t
*moz
= (PtMozillaWidget_t
*) mOwner
->mOwningWidget
;
337 PtCallbackList_t
*cb
;
338 PtCallbackInfo_t cbinfo
;
339 PtMozillaNewAreaCb_t resize
;
341 nsresult rv
= NS_ERROR_INVALID_ARG
;
342 if (aFlags
& nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION
&&
343 (aFlags
& (nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER
|
344 nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER
))) {
345 rv
= mBaseWindow
->SetPositionAndSize(aX
, aY
, aCX
, aCY
, PR_TRUE
);
347 else if (aFlags
& nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION
) {
348 rv
= mBaseWindow
->SetPosition(aX
, aY
);
350 else if (aFlags
& (nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER
|
351 nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER
)) {
352 rv
= mBaseWindow
->SetSize(aCX
, aCY
, PR_TRUE
);
360 memset(&cbinfo
, 0, sizeof(cbinfo
));
361 cbinfo
.reason
= Pt_CB_MOZ_NEW_AREA
;
362 cbinfo
.cbdata
= &resize
;
364 memset(&resize
, 0, sizeof(PtMozillaNewAreaCb_t
));
366 if( aCX
==0 && aCY
==0 )
367 resize
.flags
= Pt_MOZ_NEW_AREA_SET_POSITION
;
369 resize
.flags
= Pt_MOZ_NEW_AREA_SET_AREA
;
371 resize
.area
.pos
.x
= aX
;
372 resize
.area
.pos
.y
= aY
;
373 resize
.area
.size
.w
= aCX
;
374 resize
.area
.size
.h
= aCY
;
376 PtInvokeCallbackList(cb
, (PtWidget_t
*)moz
, &cbinfo
);
382 EmbedWindow::GetDimensions(PRUint32 aFlags
, PRInt32
*aX
,
383 PRInt32
*aY
, PRInt32
*aCX
, PRInt32
*aCY
)
385 if (aFlags
& nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION
&&
386 (aFlags
& (nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER
|
387 nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER
))) {
388 return mBaseWindow
->GetPositionAndSize(aX
, aY
, aCX
, aCY
);
390 else if (aFlags
& nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION
) {
391 return mBaseWindow
->GetPosition(aX
, aY
);
393 else if (aFlags
& (nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER
|
394 nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER
)) {
395 return mBaseWindow
->GetSize(aCX
, aCY
);
397 return NS_ERROR_INVALID_ARG
;
401 EmbedWindow::SetFocus(void)
403 // XXX might have to do more here.
404 return mBaseWindow
->SetFocus();
408 EmbedWindow::GetTitle(PRUnichar
**aTitle
)
410 *aTitle
= ToNewUnicode(mTitle
);
415 EmbedWindow::SetTitle(const PRUnichar
*aTitle
)
417 PtMozillaWidget_t
*moz
= (PtMozillaWidget_t
*)mOwner
->mOwningWidget
;
418 PtCallbackList_t
*cb
;
419 PtCallbackInfo_t cbinfo
;
420 PtMozillaInfoCb_t info
;
421 nsString
mTitleString(aTitle
);
430 memset(&cbinfo
, 0, sizeof(cbinfo
));
431 cbinfo
.cbdata
= &info
;
432 cbinfo
.reason
= Pt_CB_MOZ_INFO
;
435 info
.type
= Pt_MOZ_INFO_TITLE
;
438 /* see if the title is empty */
439 if( mTitleString
.Length() == 0 ) {
440 if( moz
->EmbedRef
->mURI
.Length() > 0 ) {
441 str
= ToNewCString( moz
->EmbedRef
->mURI
);
449 NS_ConvertUTF16toUTF8
theUnicodeString( mTitleString
);
450 str
= theUnicodeString
.get( );
453 info
.data
= (char*) str
;
454 PtInvokeCallbackList(cb
, (PtWidget_t
*) moz
, &cbinfo
);
456 if( to_free
) nsMemory::Free( (void*)str
);
462 EmbedWindow::GetSiteWindow(void **aSiteWindow
)
464 PtWidget_t
*ownerAsWidget
= (PtWidget_t
*)(mOwner
->mOwningWidget
);
465 *aSiteWindow
= static_cast<void *>(ownerAsWidget
);
470 EmbedWindow::GetVisibility(PRBool
*aVisibility
)
472 *aVisibility
= mVisibility
;
477 EmbedWindow::SetVisibility(PRBool aVisibility
)
479 mVisibility
= aVisibility
;
483 // nsITooltipListener
486 EmbedWindow::OnShowTooltip(PRInt32 aXCoords
, PRInt32 aYCoords
,
487 const PRUnichar
*aTipText
)
489 nsAutoString
tipText ( aTipText
);
490 const char* tipString
= ToNewCString(tipText
), *font
= "TextFont08";
494 PhPoint_t pos
= {0, 0};
498 PtDestroyWidget(sTipWindow
);
500 // get the root origin for this content window
501 nsCOMPtr
<nsIWidget
> mainWidget
;
502 mBaseWindow
->GetMainWidget(getter_AddRefs(mainWidget
));
504 window
= static_cast<PtWidget_t
*>(mainWidget
->GetNativeData(NS_NATIVE_WINDOW
));
506 PgExtentText(&extent
, &pos
, font
, tipString
, 0);
507 w
= extent
.lr
.x
- extent
.ul
.x
+ 1;
508 h
= extent
.lr
.y
- extent
.ul
.y
+ 1;
512 pos
.y
= aYCoords
+ 10; /* we add 10 so that we don't position it right under the mouse */
513 dim
.w
= w
+ 6; dim
.h
= h
+ 6;
514 PtSetArg(&args
[n
++], Pt_ARG_POS
, &pos
, 0);
515 PtSetArg(&args
[n
++], Pt_ARG_DIM
, &dim
, 0);
516 PtSetArg( &args
[n
++], Pt_ARG_REGION_OPAQUE
, Ph_EV_EXPOSE
, Ph_EV_EXPOSE
);
517 sTipWindow
= PtCreateWidget(PtRegion
, Pt_NO_PARENT
, n
, args
);
521 dim
.w
= w
; dim
.h
= h
;
522 PtSetArg(&args
[n
++], Pt_ARG_POS
, &pos
, 0);
523 PtSetArg(&args
[n
++], Pt_ARG_DIM
, &dim
, 0);
524 PtSetArg(&args
[n
++], Pt_ARG_FLAGS
, Pt_HIGHLIGHTED
, -1 );
525 PtSetArg(&args
[n
++], Pt_ARG_FILL_COLOR
, 0xfeffb1, 0);
526 PtSetArg(&args
[n
++], Pt_ARG_TEXT_FONT
, font
, 0);
527 PtSetArg(&args
[n
++], Pt_ARG_TEXT_STRING
, tipString
, 0);
528 PtSetArg(&args
[n
++], Pt_ARG_BASIC_FLAGS
, Pt_STATIC_GRADIENT
| Pt_TOP_OUTLINE
| Pt_LEFT_OUTLINE
|
529 Pt_RIGHT_OUTLINE
| Pt_BOTTOM_OUTLINE
, -1 );
530 PtCreateWidget(PtLabel
, sTipWindow
, n
, args
);
532 // realize the widget
533 PtRealizeWidget(sTipWindow
);
535 nsMemory::Free( (void*)tipString
);
541 EmbedWindow::OnHideTooltip(void)
544 PtDestroyWidget(sTipWindow
);
554 /* void OnStartLookup (in nsISupports ctxt, in string hostname); */
555 NS_IMETHODIMP
EmbedWindow::OnStartLookup(nsISupports
*ctxt
, const char *hostname
)
557 PtMozillaWidget_t
*moz
= (PtMozillaWidget_t
*) mOwner
->mOwningWidget
;
558 PtCallbackList_t
*cb
= NULL
;
559 PtCallbackInfo_t cbinfo
;
560 PtMozillaNetStateCb_t state
;
561 cbinfo
.reason
= Pt_CB_MOZ_NET_STATE
;
562 cbinfo
.cbdata
= &state
;
565 state
.url
= (char *)hostname
;
566 char *statusMessage
= "Resolving host name:";
567 state
.message
= statusMessage
;
568 if( ( cb
= moz
->net_state_cb
) )
569 PtInvokeCallbackList(cb
, (PtWidget_t
*) moz
, &cbinfo
);
574 /* [noscript] void OnFound (in nsISupports ctxt, in string hostname, in nsHostEntStar entry); */
575 NS_IMETHODIMP
EmbedWindow::OnFound(nsISupports
*ctxt
, const char *hostname
, nsHostEnt
* entry
)
577 PtMozillaWidget_t
*moz
= (PtMozillaWidget_t
*) mOwner
->mOwningWidget
;
578 PtCallbackList_t
*cb
= NULL
;
579 PtCallbackInfo_t cbinfo
;
580 PtMozillaNetStateCb_t state
;
582 cbinfo
.reason
= Pt_CB_MOZ_NET_STATE
;
583 cbinfo
.cbdata
= &state
;
586 state
.url
= (char *)hostname
;
587 char *statusMessage
= "Opening connection:";
588 state
.message
= statusMessage
;
589 if( ( cb
= moz
->net_state_cb
) )
590 PtInvokeCallbackList(cb
, (PtWidget_t
*) moz
, &cbinfo
);
596 /* void OnStopLookup (in nsISupports ctxt, in string hostname, in nsresult status); */
597 NS_IMETHODIMP
EmbedWindow::OnLookupComplete(nsICancelable
*aRequest
, nsIDNSRecord
*aRecord
, nsresult aStatus
)
599 return NS_ERROR_NOT_IMPLEMENTED
;
602 // nsIContextMenuListener
604 NS_IMETHODIMP
EmbedWindow::OnShowContextMenu(PRUint32 aContextFlags
, nsIDOMEvent
*aEvent
, nsIDOMNode
*aNode
)
606 PtMozillaWidget_t
*moz
= (PtMozillaWidget_t
*) mOwner
->mOwningWidget
;
607 PtCallbackList_t
*cb
;
608 PtCallbackInfo_t cbinfo
;
609 PtMozillaContextCb_t cmenu
;
611 if (!moz
->context_cb
)
614 cb
= moz
->context_cb
;
615 memset(&cbinfo
, 0, sizeof(cbinfo
));
616 cbinfo
.reason
= Pt_CB_MOZ_CONTEXT
;
617 cbinfo
.cbdata
= &cmenu
;
619 memset(&cmenu
, 0, sizeof(PtMozillaContextCb_t
));
620 if (aContextFlags
& CONTEXT_NONE
)
621 cmenu
.flags
|= Pt_MOZ_CONTEXT_NONE
;
622 else if (aContextFlags
& CONTEXT_LINK
)
623 cmenu
.flags
|= Pt_MOZ_CONTEXT_LINK
;
624 else if (aContextFlags
& CONTEXT_IMAGE
)
625 cmenu
.flags
|= Pt_MOZ_CONTEXT_IMAGE
;
626 else if (aContextFlags
& CONTEXT_DOCUMENT
)
627 cmenu
.flags
|= Pt_MOZ_CONTEXT_DOCUMENT
;
628 else if (aContextFlags
& CONTEXT_TEXT
)
629 cmenu
.flags
|= Pt_MOZ_CONTEXT_TEXT
;
630 else if (aContextFlags
& CONTEXT_INPUT
)
631 cmenu
.flags
|= Pt_MOZ_CONTEXT_INPUT
;
633 nsCOMPtr
<nsIDOMMouseEvent
> mouseEvent (do_QueryInterface( aEvent
));
634 if(!mouseEvent
) return NS_OK
;
635 mouseEvent
->GetScreenX( &cmenu
.x
);
636 mouseEvent
->GetScreenY( &cmenu
.y
);
638 PtInvokeCallbackList(cb
, (PtWidget_t
*)moz
, &cbinfo
);
640 if( aContextFlags
& CONTEXT_IMAGE
)
642 /* store the url we clicked on */
643 nsAutoString rightClickUrl
;
647 nsCOMPtr
<nsIDOMHTMLImageElement
> imgElement(do_QueryInterface(aNode
, &rv
));
648 if(NS_FAILED(rv
)) return NS_OK
;
650 rv
= imgElement
->GetSrc(rightClickUrl
);
652 if( moz
->rightClickUrl_image
) free( moz
->rightClickUrl_image
);
654 if(NS_FAILED(rv
)) moz
->rightClickUrl_image
= NULL
;
655 else moz
->rightClickUrl_image
= ToNewCString(rightClickUrl
);
658 if( aContextFlags
& CONTEXT_LINK
)
660 /* CONTEXT_IMAGE|CONTEXT_LINK is set for an <IMG> with an <A> as an ancestor */
661 if( aContextFlags
& CONTEXT_IMAGE
) {
663 aNode
->GetParentNode( &parent
);
664 if( parent
) aNode
= parent
;
667 /* store the url we clicked on */
668 nsAutoString rightClickUrl
;
671 nsCOMPtr
<nsIDOMHTMLAnchorElement
> linkElement(do_QueryInterface(aNode
, &rv
));
673 if(NS_FAILED(rv
)) return NS_OK
;
675 // Note that this string is in UCS2 format
676 rv
= linkElement
->GetHref( rightClickUrl
);
678 if( moz
->rightClickUrl_link
) free( moz
->rightClickUrl_link
);
680 if(NS_FAILED(rv
)) moz
->rightClickUrl_link
= NULL
;
681 else moz
->rightClickUrl_link
= ToNewCString(rightClickUrl
);
688 // nsIInterfaceRequestor
691 EmbedWindow::GetInterface(const nsIID
&aIID
, void** aInstancePtr
)
695 rv
= QueryInterface(aIID
, aInstancePtr
);
697 // pass it up to the web browser object
698 if (NS_FAILED(rv
) || !*aInstancePtr
) {
699 nsCOMPtr
<nsIInterfaceRequestor
> ir
= do_QueryInterface(mWebBrowser
);
700 return ir
->GetInterface(aIID
, aInstancePtr
);