Checking in the fix for bug 52334 for the third time. This time it should stick! Making iframe's load their document even if they're not displayed. r=jkeiser@netscape.com, sr=rpotts@netscape.com.
This commit is contained in:
@@ -1166,6 +1166,14 @@ nsDocShell::SetChromeEventHandler(nsIChromeEventHandler * aChromeEventHandler)
|
||||
{
|
||||
// Weak reference. Don't addref.
|
||||
mChromeEventHandler = aChromeEventHandler;
|
||||
|
||||
NS_ASSERTION(!mScriptGlobal,
|
||||
"SetChromeEventHandler() called after the script global "
|
||||
"object was created! This means that the script global "
|
||||
"object in this docshell won't get the right chrome event "
|
||||
"handler. You really don't want to see this assert, FIX "
|
||||
"YOUR CODE!");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -2449,7 +2457,6 @@ nsDocShell::Stop(PRUint32 aStopFlags)
|
||||
if (nsIWebNavigation::STOP_CONTENT & aStopFlags) {
|
||||
if (mContentViewer)
|
||||
mContentViewer->Stop();
|
||||
|
||||
}
|
||||
|
||||
if (nsIWebNavigation::STOP_NETWORK & aStopFlags) {
|
||||
@@ -2658,7 +2665,6 @@ nsDocShell::InitWindow(nativeWindow parentNativeWindow,
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::Create()
|
||||
{
|
||||
NS_ENSURE_STATE(!mContentViewer);
|
||||
mPrefs = do_GetService(NS_PREF_CONTRACTID);
|
||||
//GlobalHistory is now set in SetGlobalHistory
|
||||
// mGlobalHistory = do_GetService(NS_GLOBALHISTORY_CONTRACTID);
|
||||
@@ -2843,10 +2849,17 @@ nsDocShell::GetParentWidget(nsIWidget ** parentWidget)
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::SetParentWidget(nsIWidget * aParentWidget)
|
||||
{
|
||||
NS_ENSURE_STATE(!mContentViewer);
|
||||
|
||||
mParentWidget = aParentWidget;
|
||||
|
||||
if (!mParentWidget) {
|
||||
// If the parent widget is set to null we don't want to hold
|
||||
// on to the current device context any more since it is
|
||||
// associated with the parent widget we no longer own. We'll
|
||||
// need to create a new device context if one is needed again.
|
||||
|
||||
mDeviceContext = nsnull;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -2914,12 +2927,22 @@ nsDocShell::GetVisibility(PRBool * aVisibility)
|
||||
nsCOMPtr<nsIDocShellTreeItem> parentItem;
|
||||
treeItem->GetParent(getter_AddRefs(parentItem));
|
||||
while (parentItem) {
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(treeItem));
|
||||
docShell->GetPresShell(getter_AddRefs(presShell));
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
presShell->GetDocument(getter_AddRefs(doc));
|
||||
|
||||
nsCOMPtr<nsIDocShell> parentDS = do_QueryInterface(parentItem);
|
||||
nsCOMPtr<nsIPresShell> pPresShell;
|
||||
parentDS->GetPresShell(getter_AddRefs(pPresShell));
|
||||
|
||||
nsCOMPtr<nsIDocument> pDoc;
|
||||
pPresShell->GetDocument(getter_AddRefs(pDoc));
|
||||
|
||||
nsCOMPtr<nsIContent> shellContent;
|
||||
nsCOMPtr<nsISupports> shellISupports = do_QueryInterface(treeItem);
|
||||
pPresShell->FindContentForShell(shellISupports, getter_AddRefs(shellContent));
|
||||
pDoc->FindContentForSubDocument(doc, getter_AddRefs(shellContent));
|
||||
NS_ASSERTION(shellContent, "subshell not in the map");
|
||||
|
||||
nsIFrame* frame;
|
||||
@@ -4016,6 +4039,7 @@ nsDocShell::CreateAboutBlankContentViewer()
|
||||
// generate (about:blank) document to load
|
||||
docFactory->CreateBlankDocument(loadGroup, getter_AddRefs(blankDoc));
|
||||
if (blankDoc) {
|
||||
blankDoc->SetContainer(NS_STATIC_CAST(nsIDocShell *, this));
|
||||
|
||||
// create a content viewer for us and the new document
|
||||
docFactory->CreateInstanceForDocument(NS_ISUPPORTS_CAST(nsIDocShell *, this),
|
||||
@@ -4357,13 +4381,13 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer)
|
||||
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
NS_ENSURE_SUCCESS(GetMainWidget(getter_AddRefs(widget)), NS_ERROR_FAILURE);
|
||||
if (!widget) {
|
||||
NS_ERROR("GetMainWidget coughed up a null widget");
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (widget) {
|
||||
NS_ENSURE_SUCCESS(EnsureDeviceContext(), NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
nsRect bounds(x, y, cx, cy);
|
||||
NS_ENSURE_SUCCESS(EnsureDeviceContext(), NS_ERROR_FAILURE);
|
||||
|
||||
if (NS_FAILED(mContentViewer->Init(widget, mDeviceContext, bounds))) {
|
||||
mContentViewer = nsnull;
|
||||
NS_ERROR("ContentViewer Initialization failed");
|
||||
@@ -4386,7 +4410,7 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer)
|
||||
focusController->SetSuppressFocus(PR_FALSE,
|
||||
"Win32-Only Link Traversal Issue");
|
||||
|
||||
if (bgSet) {
|
||||
if (bgSet && widget) {
|
||||
// Stuff the bgcolor from the last view manager into the new
|
||||
// view manager. This improves page load continuity.
|
||||
nsCOMPtr<nsIDocumentViewer> docviewer =
|
||||
|
||||
Reference in New Issue
Block a user