Fixing bug 256235. Can't download files (no filepicker displayed), apparently XP-SP2 only. r+sr=shaver@mozilla.org
git-svn-id: svn://10.0.0.236/trunk@161056 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
7449ce7931
commit
eb1bbfb234
@ -42,9 +42,9 @@
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsIView.h"
|
||||
#include "nsIWidget.h"
|
||||
@ -75,26 +75,21 @@ nsBaseFilePicker::~nsBaseFilePicker()
|
||||
|
||||
nsIWidget *nsBaseFilePicker::DOMWindowToWidget(nsIDOMWindow *dw)
|
||||
{
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(dw);
|
||||
if (sgo) {
|
||||
nsIDocShell *docShell = sgo->GetDocShell();
|
||||
|
||||
if (docShell) {
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
nsresult rv = docShell->GetPresShell(getter_AddRefs(presShell));
|
||||
nsCOMPtr<nsIBaseWindow> baseWin(do_QueryInterface(sgo->GetDocShell()));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && presShell) {
|
||||
nsIView *view;
|
||||
rv = presShell->GetViewManager()->GetRootView(view);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
return view->GetWidget();
|
||||
}
|
||||
}
|
||||
if (baseWin) {
|
||||
baseWin->GetParentWidget(getter_AddRefs(widget));
|
||||
}
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
// This will return a pointer that we're about to release, but
|
||||
// that's ok since the docshell (nsIBaseWindow) holds the widget
|
||||
// alive.
|
||||
return widget.get();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user