Fixing bug 263388. Patch by trev@gtchat.de. Make opening filepickers possible from frames that are not displayed, i.e. have no widget. r=jst@mozilla.org, sr=bzbarsky@mit.edu
git-svn-id: svn://10.0.0.236/trunk@163828 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -42,6 +42,8 @@
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
@@ -81,8 +83,24 @@ nsIWidget *nsBaseFilePicker::DOMWindowToWidget(nsIDOMWindow *dw)
|
||||
if (sgo) {
|
||||
nsCOMPtr<nsIBaseWindow> baseWin(do_QueryInterface(sgo->GetDocShell()));
|
||||
|
||||
if (baseWin) {
|
||||
while (!widget && baseWin) {
|
||||
baseWin->GetParentWidget(getter_AddRefs(widget));
|
||||
if (!widget) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(baseWin));
|
||||
if (!docShellAsItem)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> parent;
|
||||
docShellAsItem->GetSameTypeParent(getter_AddRefs(parent));
|
||||
if (!parent)
|
||||
return nsnull;
|
||||
|
||||
sgo = do_GetInterface(parent);
|
||||
if (!sgo)
|
||||
return nsnull;
|
||||
|
||||
baseWin = do_QueryInterface(sgo->GetDocShell());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user