diff --git a/content/base/src/nsFrameLoader.cpp b/content/base/src/nsFrameLoader.cpp index 8c3ddded2606..97adec4b5109 100644 --- a/content/base/src/nsFrameLoader.cpp +++ b/content/base/src/nsFrameLoader.cpp @@ -450,17 +450,8 @@ nsFrameLoader::EnsureDocShell() } } - if (isContent) { - // The web shell's type is content. - - docShellAsItem->SetItemType(nsIDocShellTreeItem::typeContent); - } else { - // Inherit our type from our parent webshell. If it is - // chrome, we'll be chrome. If it is content, we'll be - // content. - - docShellAsItem->SetItemType(parentType); - } + PRInt32 shellType = isContent ? nsIDocShellTreeItem::typeContent : parentType; + docShellAsItem->SetItemType(shellType); parentAsNode->AddChild(docShellAsItem); @@ -469,7 +460,8 @@ nsFrameLoader::EnsureDocShell() parentAsItem->GetTreeOwner(getter_AddRefs(parentTreeOwner)); if(parentTreeOwner) { - PRBool is_primary = value.Equals(NS_LITERAL_STRING("content-primary")); + PRBool is_primary = shellType == nsIDocShellTreeItem::typeChrome && + value.Equals(NS_LITERAL_STRING("content-primary")); parentTreeOwner->ContentShellAdded(docShellAsItem, is_primary, value.get()); diff --git a/layout/generic/nsFrameFrame.cpp b/layout/generic/nsFrameFrame.cpp index 8bfcb5ee9b54..3a7f6ddcbd70 100644 --- a/layout/generic/nsFrameFrame.cpp +++ b/layout/generic/nsFrameFrame.cpp @@ -683,7 +683,10 @@ nsHTMLFrameOuterFrame::AttributeChanged(nsIPresContext* aPresContext, nsCOMPtr parentTreeOwner; parentAsItem->GetTreeOwner(getter_AddRefs(parentTreeOwner)); if (parentTreeOwner) { + PRInt32 shellType; + parentAsItem->GetItemType(&shellType); PRBool is_primary_content = + shellType == nsIDocShellTreeItem::typeChrome && value.EqualsIgnoreCase("content-primary"); parentTreeOwner->ContentShellAdded(docShellAsItem, is_primary_content, diff --git a/layout/html/document/src/nsFrameFrame.cpp b/layout/html/document/src/nsFrameFrame.cpp index 8bfcb5ee9b54..3a7f6ddcbd70 100644 --- a/layout/html/document/src/nsFrameFrame.cpp +++ b/layout/html/document/src/nsFrameFrame.cpp @@ -683,7 +683,10 @@ nsHTMLFrameOuterFrame::AttributeChanged(nsIPresContext* aPresContext, nsCOMPtr parentTreeOwner; parentAsItem->GetTreeOwner(getter_AddRefs(parentTreeOwner)); if (parentTreeOwner) { + PRInt32 shellType; + parentAsItem->GetItemType(&shellType); PRBool is_primary_content = + shellType == nsIDocShellTreeItem::typeChrome && value.EqualsIgnoreCase("content-primary"); parentTreeOwner->ContentShellAdded(docShellAsItem, is_primary_content,