Back out babac1cc0741:ad287f78608a (bug 939049) for OS X build bustage

CLOSED TREE
This commit is contained in:
Phil Ringnalda 2013-11-19 07:35:17 -08:00
parent bc27c1246d
commit 555ce2f4e3
42 changed files with 240 additions and 211 deletions

View File

@ -99,19 +99,22 @@ LogDocShellState(nsIDocument* aDocumentNode)
printf("docshell busy: ");
nsAutoCString docShellBusy;
nsCOMPtr<nsIDocShell> docShell = aDocumentNode->GetDocShell();
uint32_t busyFlags = nsIDocShell::BUSY_FLAGS_NONE;
docShell->GetBusyFlags(&busyFlags);
if (busyFlags == nsIDocShell::BUSY_FLAGS_NONE)
printf("'none'");
if (busyFlags & nsIDocShell::BUSY_FLAGS_BUSY)
printf("'busy'");
if (busyFlags & nsIDocShell::BUSY_FLAGS_BEFORE_PAGE_LOAD)
printf(", 'before page load'");
if (busyFlags & nsIDocShell::BUSY_FLAGS_PAGE_LOADING)
printf(", 'page loading'");
nsCOMPtr<nsISupports> container = aDocumentNode->GetContainer();
if (container) {
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(container);
uint32_t busyFlags = nsIDocShell::BUSY_FLAGS_NONE;
docShell->GetBusyFlags(&busyFlags);
if (busyFlags == nsIDocShell::BUSY_FLAGS_NONE)
printf("'none'");
if (busyFlags & nsIDocShell::BUSY_FLAGS_BUSY)
printf("'busy'");
if (busyFlags & nsIDocShell::BUSY_FLAGS_BEFORE_PAGE_LOAD)
printf(", 'before page load'");
if (busyFlags & nsIDocShell::BUSY_FLAGS_PAGE_LOADING)
printf(", 'page loading'");
} else {
printf("[failed]");
}
}
static void
@ -129,7 +132,8 @@ static void
LogDocShellTree(nsIDocument* aDocumentNode)
{
if (aDocumentNode->IsActive()) {
nsCOMPtr<nsIDocShellTreeItem> treeItem(aDocumentNode->GetDocShell());
nsCOMPtr<nsISupports> container = aDocumentNode->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(container));
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;
treeItem->GetParent(getter_AddRefs(parentTreeItem));
nsCOMPtr<nsIDocShellTreeItem> rootTreeItem;

View File

@ -200,7 +200,8 @@ nsAccessibilityService::GetRootDocumentAccessible(nsIPresShell* aPresShell,
nsIPresShell* ps = aPresShell;
nsIDocument* documentNode = aPresShell->GetDocument();
if (documentNode) {
nsCOMPtr<nsIDocShellTreeItem> treeItem(documentNode->GetDocShell());
nsCOMPtr<nsISupports> container = documentNode->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(container));
if (treeItem) {
nsCOMPtr<nsIDocShellTreeItem> rootTreeItem;
treeItem->GetRootTreeItem(getter_AddRefs(rootTreeItem));

View File

@ -394,14 +394,17 @@ nsCoreUtils::GetDocShellFor(nsINode *aNode)
if (!aNode)
return nullptr;
nsCOMPtr<nsIDocShell> docShell = aNode->OwnerDoc()->GetDocShell();
nsCOMPtr<nsISupports> container = aNode->OwnerDoc()->GetContainer();
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(container);
return docShell.forget();
}
bool
nsCoreUtils::IsRootDocument(nsIDocument *aDocument)
{
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = aDocument->GetDocShell();
nsCOMPtr<nsISupports> container = aDocument->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
do_QueryInterface(container);
NS_ASSERTION(docShellTreeItem, "No document shell for document!");
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;
@ -413,7 +416,9 @@ nsCoreUtils::IsRootDocument(nsIDocument *aDocument)
bool
nsCoreUtils::IsContentDocument(nsIDocument *aDocument)
{
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = aDocument->GetDocShell();
nsCOMPtr<nsISupports> container = aDocument->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
do_QueryInterface(container);
NS_ASSERTION(docShellTreeItem, "No document shell tree item for document!");
int32_t contentType;
@ -424,7 +429,8 @@ nsCoreUtils::IsContentDocument(nsIDocument *aDocument)
bool
nsCoreUtils::IsTabDocument(nsIDocument* aDocumentNode)
{
nsCOMPtr<nsIDocShellTreeItem> treeItem(aDocumentNode->GetDocShell());
nsCOMPtr<nsISupports> container = aDocumentNode->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(container));
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;
treeItem->GetParent(getter_AddRefs(parentTreeItem));

View File

@ -376,8 +376,10 @@ Accessible::AccessKey() const
nsIDocument* document = mContent->GetCurrentDoc();
if (!document)
return KeyBinding();
nsCOMPtr<nsIDocShellTreeItem> treeItem(document->GetDocShell());
nsCOMPtr<nsISupports> container = document->GetContainer();
if (!container)
return KeyBinding();
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(container));
if (!treeItem)
return KeyBinding();
@ -1291,7 +1293,9 @@ Accessible::NativeAttributes()
nsCoreUtils::GetRoleContent(doc));
// Allow ARIA live region markup from outer documents to override
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = doc->GetDocShell();
nsCOMPtr<nsISupports> container = doc->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
do_QueryInterface(container);
if (!docShellTreeItem)
break;

View File

@ -688,7 +688,8 @@ DocAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aRelativeFrame)
nsresult
DocAccessible::AddEventListeners()
{
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem(mDocumentNode->GetDocShell());
nsCOMPtr<nsISupports> container = mDocumentNode->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem(do_QueryInterface(container));
// We want to add a command observer only if the document is content and has
// an editor.
@ -720,7 +721,8 @@ DocAccessible::RemoveEventListeners()
if (mDocumentNode) {
mDocumentNode->RemoveObserver(this);
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem(mDocumentNode->GetDocShell());
nsCOMPtr<nsISupports> container = mDocumentNode->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem(do_QueryInterface(container));
NS_ASSERTION(docShellTreeItem, "doc should support nsIDocShellTreeItem.");
if (docShellTreeItem) {
@ -1985,7 +1987,8 @@ DocAccessible::ShutdownChildrenInSubtree(Accessible* aAccessible)
bool
DocAccessible::IsLoadEventTarget() const
{
nsCOMPtr<nsIDocShellTreeItem> treeItem = mDocumentNode->GetDocShell();
nsCOMPtr<nsISupports> container = mDocumentNode->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> treeItem = do_QueryInterface(container);
NS_ASSERTION(treeItem, "No document shell for document!");
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;

View File

@ -20,7 +20,6 @@
#include "nsPropertyTable.h" // for member
#include "nsTHashtable.h" // for member
#include "mozilla/dom/DocumentBinding.h"
#include "mozilla/WeakPtr.h"
#include "Units.h"
#include "nsExpirationTracker.h"
#include "nsClassHashtable.h"
@ -29,8 +28,6 @@ class imgIRequest;
class nsAString;
class nsBindingManager;
class nsCSSStyleSheet;
class nsIDocShell;
class nsDocShell;
class nsDOMNavigationTiming;
class nsDOMTouchList;
class nsEventStates;
@ -1153,23 +1150,22 @@ public:
* Set the container (docshell) for this document. Virtual so that
* docshell can call it.
*/
virtual void SetContainer(nsDocShell* aContainer);
virtual void SetContainer(nsISupports *aContainer);
/**
* Get the container (docshell) for this document.
*/
nsISupports* GetContainer() const;
already_AddRefed<nsISupports> GetContainer() const
{
nsCOMPtr<nsISupports> container = do_QueryReferent(mDocumentContainer);
return container.forget();
}
/**
* Get the container's load context for this document.
*/
nsILoadContext* GetLoadContext() const;
/**
* Get docshell the for this document.
*/
nsIDocShell* GetDocShell() const;
/**
* Set and get XML declaration. If aVersion is null there is no declaration.
* aStandalone takes values -1, 0 and 1 indicating respectively that there
@ -1530,7 +1526,7 @@ public:
void SetDisplayDocument(nsIDocument* aDisplayDocument)
{
NS_PRECONDITION(!GetShell() &&
!GetContainer() &&
!nsCOMPtr<nsISupports>(GetContainer()) &&
!GetWindow(),
"Shouldn't set mDisplayDocument on documents that already "
"have a presentation or a docshell or a window");
@ -1700,7 +1696,7 @@ public:
* @param aCloneContainer The container for the clone document.
*/
virtual already_AddRefed<nsIDocument>
CreateStaticClone(nsIDocShell* aCloneContainer);
CreateStaticClone(nsISupports* aCloneContainer);
/**
* If this document is a static clone, this returns the original
@ -2231,7 +2227,7 @@ protected:
nsWeakPtr mDocumentLoadGroup;
mozilla::WeakPtr<nsDocShell> mDocumentContainer;
nsWeakPtr mDocumentContainer;
nsCString mCharacterSet;
int32_t mCharacterSetSource;

View File

@ -193,7 +193,6 @@ LOCAL_INCLUDES += [
'/content/xslt/src/xpath',
'/content/xul/content/src',
'/content/xul/document/src',
'/docshell/base',
'/dom/base',
'/dom/ipc',
'/dom/workers',

View File

@ -2622,7 +2622,10 @@ nsContentUtils::CanLoadImage(nsIURI* aURI, nsISupports* aContext,
uint32_t appType = nsIDocShell::APP_TYPE_UNKNOWN;
{
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = aLoadingDocument->GetDocShell();
nsCOMPtr<nsISupports> container = aLoadingDocument->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
do_QueryInterface(container);
if (docShellTreeItem) {
nsCOMPtr<nsIDocShellTreeItem> root;
docShellTreeItem->GetRootTreeItem(getter_AddRefs(root));
@ -3150,7 +3153,8 @@ nsContentUtils::IsChromeDoc(nsIDocument *aDocument)
bool
nsContentUtils::IsChildOfSameType(nsIDocument* aDoc)
{
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(aDoc->GetDocShell());
nsCOMPtr<nsISupports> container = aDoc->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(container));
nsCOMPtr<nsIDocShellTreeItem> sameTypeParent;
if (docShellAsItem) {
docShellAsItem->GetSameTypeParent(getter_AddRefs(sameTypeParent));
@ -3231,7 +3235,8 @@ nsContentUtils::IsInChromeDocshell(nsIDocument *aDocument)
return IsInChromeDocshell(aDocument->GetDisplayDocument());
}
nsCOMPtr<nsIDocShellTreeItem> docShell(aDocument->GetDocShell());
nsCOMPtr<nsISupports> docContainer = aDocument->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> docShell(do_QueryInterface(docContainer));
int32_t itemType = nsIDocShellTreeItem::typeContent;
if (docShell) {
docShell->GetItemType(&itemType);
@ -4971,7 +4976,8 @@ nsContentUtils::HidePopupsInDocument(nsIDocument* aDocument)
#ifdef MOZ_XUL
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
if (pm && aDocument) {
nsCOMPtr<nsIDocShellTreeItem> docShellToHide = aDocument->GetDocShell();
nsCOMPtr<nsISupports> container = aDocument->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> docShellToHide = do_QueryInterface(container);
if (docShellToHide)
pm->HidePopupsInDocShell(docShellToHide);
}
@ -5871,7 +5877,8 @@ nsContentUtils::IsSubDocumentTabbable(nsIContent* aContent)
return false;
}
nsCOMPtr<nsIDocShell> docShell = subDoc->GetDocShell();
nsCOMPtr<nsISupports> container = subDoc->GetContainer();
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(container);
if (!docShell) {
return false;
}
@ -5981,7 +5988,8 @@ nsContentUtils::FindPresShellForDocument(const nsIDocument* aDoc)
return shell;
}
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = doc->GetDocShell();
nsCOMPtr<nsISupports> container = doc->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = do_QueryInterface(container);
while (docShellTreeItem) {
// We may be in a display:none subdocument, or we may not have a presshell
// created yet.

View File

@ -33,7 +33,7 @@
#include "nsIBaseWindow.h"
#include "mozilla/css/Loader.h"
#include "mozilla/css/ImageLoader.h"
#include "nsDocShell.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsCOMArray.h"
#include "nsDOMClassInfo.h"
@ -2203,7 +2203,7 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup,
nsIScriptSecurityManager *securityManager =
nsContentUtils::GetSecurityManager();
if (securityManager) {
nsCOMPtr<nsIDocShell> docShell(mDocumentContainer);
nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(mDocumentContainer);
if (!docShell && aLoadGroup) {
nsCOMPtr<nsIInterfaceRequestor> cbs;
@ -2699,7 +2699,7 @@ nsDocument::InitCSP(nsIChannel* aChannel)
}
// ----- Enforce frame-ancestor policy on any applied policies
nsCOMPtr<nsIDocShell> docShell(mDocumentContainer);
nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(mDocumentContainer);
if (docShell) {
bool safeAncestry = false;
@ -2930,7 +2930,7 @@ nsresult
nsDocument::GetAllowPlugins(bool * aAllowPlugins)
{
// First, we ask our docshell if it allows plugins.
nsCOMPtr<nsIDocShell> docShell(mDocumentContainer);
nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(mDocumentContainer);
if (docShell) {
docShell->GetAllowPlugins(aAllowPlugins);
@ -3398,7 +3398,7 @@ nsDocument::SetHeaderData(nsIAtom* aHeaderField, const nsAString& aData)
if (aHeaderField == nsGkAtoms::refresh) {
// We get into this code before we have a script global yet, so get to
// our container via mDocumentContainer.
nsCOMPtr<nsIRefreshURI> refresher(mDocumentContainer);
nsCOMPtr<nsIRefreshURI> refresher = do_QueryReferent(mDocumentContainer);
if (refresher) {
// Note: using mDocumentURI instead of mBaseURI here, for consistency
// (used to just use the current URI of our webnavigation, but that
@ -3479,7 +3479,7 @@ nsDocument::doCreateShell(nsPresContext* aContext,
mPresShell = shell;
// Make sure to never paint if we belong to an invisible DocShell.
nsCOMPtr<nsIDocShell> docShell(mDocumentContainer);
nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(mDocumentContainer);
if (docShell && docShell->IsInvisible())
shell->SetNeverPainting(true);
@ -4192,41 +4192,29 @@ NotifyActivityChanged(nsIContent *aContent, void *aUnused)
}
void
nsIDocument::SetContainer(nsDocShell* aContainer)
nsIDocument::SetContainer(nsISupports* aContainer)
{
if (aContainer) {
mDocumentContainer = aContainer->asWeakPtr();
} else {
mDocumentContainer = WeakPtr<nsDocShell>();
}
mDocumentContainer = do_GetWeakReference(aContainer);
EnumerateFreezableElements(NotifyActivityChanged, nullptr);
if (!aContainer) {
return;
}
// Get the Docshell
int32_t itemType;
aContainer->GetItemType(&itemType);
// check itemtype
if (itemType == nsIDocShellTreeItem::typeContent) {
// check if same type root
nsCOMPtr<nsIDocShellTreeItem> sameTypeRoot;
aContainer->GetSameTypeRootTreeItem(getter_AddRefs(sameTypeRoot));
NS_ASSERTION(sameTypeRoot, "No document shell root tree item from document shell tree item!");
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(aContainer);
if (docShell) {
int32_t itemType;
docShell->GetItemType(&itemType);
// check itemtype
if (itemType == nsIDocShellTreeItem::typeContent) {
// check if same type root
nsCOMPtr<nsIDocShellTreeItem> sameTypeRoot;
docShell->GetSameTypeRootTreeItem(getter_AddRefs(sameTypeRoot));
NS_ASSERTION(sameTypeRoot, "No document shell root tree item from document shell tree item!");
if (sameTypeRoot == aContainer) {
static_cast<nsDocument*>(this)->SetIsTopLevelContentDocument(true);
if (sameTypeRoot == docShell) {
static_cast<nsDocument*>(this)->SetIsTopLevelContentDocument(true);
}
}
}
}
nsISupports*
nsIDocument::GetContainer() const
{
return static_cast<nsIDocShell*>(mDocumentContainer);
}
void
nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
{
@ -4284,7 +4272,7 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
#endif
if (mAllowDNSPrefetch) {
nsCOMPtr<nsIDocShell> docShell(mDocumentContainer);
nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(mDocumentContainer);
if (docShell) {
#ifdef DEBUG
nsCOMPtr<nsIWebNavigation> webNav =
@ -4383,7 +4371,8 @@ nsDocument::GetWindowInternal() const
// the docshell, the outer window might be still obtainable from the it.
nsCOMPtr<nsPIDOMWindow> win;
if (mRemovedFromDocShell) {
nsCOMPtr<nsIInterfaceRequestor> requestor(mDocumentContainer);
nsCOMPtr<nsIInterfaceRequestor> requestor =
do_QueryReferent(mDocumentContainer);
if (requestor) {
// The docshell returns the outer window we are done.
win = do_GetInterface(requestor);
@ -7810,7 +7799,7 @@ nsDocument::GetLayoutHistoryState() const
if (!mScriptGlobalObject) {
state = mLayoutHistoryState;
} else {
nsCOMPtr<nsIDocShell> docShell(mDocumentContainer);
nsCOMPtr<nsIDocShell> docShell(do_QueryReferent(mDocumentContainer));
if (docShell) {
docShell->GetLayoutHistoryState(getter_AddRefs(state));
}
@ -8331,7 +8320,7 @@ nsDocument::CloneDocHelper(nsDocument* clone) const
// |mDocumentContainer| is the container of the document that is being
// created and not the original container. See CreateStaticClone function().
nsCOMPtr<nsIDocumentLoader> docLoader(mDocumentContainer);
nsCOMPtr<nsIDocumentLoader> docLoader = do_QueryReferent(mDocumentContainer);
if (docLoader) {
docLoader->GetLoadGroup(getter_AddRefs(loadGroup));
}
@ -8344,7 +8333,8 @@ nsDocument::CloneDocHelper(nsDocument* clone) const
clone->ResetToURI(uri, loadGroup, NodePrincipal());
}
}
clone->SetContainer(mDocumentContainer);
nsCOMPtr<nsISupports> container = GetContainer();
clone->SetContainer(container);
}
// Set scripting object
@ -8855,18 +8845,18 @@ nsIDocument::FlushPendingLinkUpdates()
}
already_AddRefed<nsIDocument>
nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer)
nsIDocument::CreateStaticClone(nsISupports* aCloneContainer)
{
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(this);
NS_ENSURE_TRUE(domDoc, nullptr);
mCreatingStaticClone = true;
// Make document use different container during cloning.
nsRefPtr<nsDocShell> originalShell = mDocumentContainer.get();
SetContainer(static_cast<nsDocShell*>(aCloneContainer));
nsCOMPtr<nsISupports> originalContainer = GetContainer();
SetContainer(aCloneContainer);
nsCOMPtr<nsIDOMNode> clonedNode;
nsresult rv = domDoc->CloneNode(true, 1, getter_AddRefs(clonedNode));
SetContainer(originalShell);
SetContainer(originalContainer);
nsCOMPtr<nsIDocument> clonedDoc;
if (NS_SUCCEEDED(rv)) {
@ -10172,7 +10162,8 @@ nsDocument::FullScreenStackTop()
static bool
IsInActiveTab(nsIDocument* aDoc)
{
nsCOMPtr<nsIDocShell> docshell = aDoc->GetDocShell();
nsCOMPtr<nsISupports> container = aDoc->GetContainer();
nsCOMPtr<nsIDocShell> docshell = do_QueryInterface(container);
if (!docshell) {
return false;
}
@ -10183,8 +10174,12 @@ IsInActiveTab(nsIDocument* aDoc)
return false;
}
nsCOMPtr<nsIDocShellTreeItem> dsti = do_QueryInterface(container);
if (!dsti) {
return false;
}
nsCOMPtr<nsIDocShellTreeItem> rootItem;
docshell->GetRootTreeItem(getter_AddRefs(rootItem));
dsti->GetRootTreeItem(getter_AddRefs(rootItem));
if (!rootItem) {
return false;
}
@ -10529,7 +10524,7 @@ nsDocument::IsFullScreenEnabled(bool aCallerIsChrome, bool aLogFailure)
// Ensure that all ancestor <iframe> elements have the allowfullscreen
// boolean attribute set.
nsCOMPtr<nsIDocShell> docShell(mDocumentContainer);
nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(mDocumentContainer);
bool allowed = false;
if (docShell) {
docShell->GetFullscreenAllowed(&allowed);
@ -10843,7 +10838,7 @@ nsDocument::ShouldLockPointer(Element* aElement, Element* aCurrentLock,
// Check if the element is in a document with a docshell.
nsCOMPtr<nsIDocument> ownerDoc = aElement->OwnerDoc();
if (!ownerDoc->GetContainer()) {
if (!nsCOMPtr<nsISupports>(ownerDoc->GetContainer())) {
return false;
}
nsCOMPtr<nsPIDOMWindow> ownerWindow = ownerDoc->GetWindow();
@ -11414,13 +11409,12 @@ nsIDocument::SetContentTypeInternal(const nsACString& aType)
nsILoadContext*
nsIDocument::GetLoadContext() const
{
return mDocumentContainer;
}
nsIDocShell*
nsIDocument::GetDocShell() const
{
return mDocumentContainer;
nsCOMPtr<nsISupports> container = GetContainer();
if (container) {
nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(container);
return loadContext;
}
return nullptr;
}
void

View File

@ -1359,7 +1359,8 @@ nsTreeSanitizer::Sanitize(nsIDocument* aDocument)
// here that notifies / does not notify or that fires mutation events if
// in tree.
#ifdef DEBUG
NS_PRECONDITION(!aDocument->GetContainer(), "The document is in a shell.");
nsCOMPtr<nsISupports> container = aDocument->GetContainer();
NS_PRECONDITION(!container, "The document is in a shell.");
nsRefPtr<mozilla::dom::Element> root = aDocument->GetRootElement();
NS_PRECONDITION(root->IsHTML(nsGkAtoms::html), "Not HTML root.");
#endif

View File

@ -993,7 +993,9 @@ UploadLastDir::FetchDirectoryAndDisplayPicker(nsIDocument* aDoc,
nsIURI* docURI = aDoc->GetDocumentURI();
NS_PRECONDITION(docURI, "docURI is null");
nsCOMPtr<nsILoadContext> loadContext = aDoc->GetLoadContext();
nsCOMPtr<nsISupports> container = aDoc->GetContainer();
nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(container);
nsCOMPtr<nsIContentPrefCallback2> prefCallback =
new UploadLastDir::ContentPrefCallback(aFilePicker, aFpCallback);
@ -1044,7 +1046,8 @@ UploadLastDir::StoreLastUsedDirectory(nsIDocument* aDoc, nsIFile* aDir)
return NS_ERROR_OUT_OF_MEMORY;
prefValue->SetAsAString(unicodePath);
nsCOMPtr<nsILoadContext> loadContext = aDoc->GetLoadContext();
nsCOMPtr<nsISupports> container = aDoc->GetContainer();
nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(container);
return contentPrefService->Set(spec, CPS_PREF_NAME, prefValue, loadContext, nullptr);
}

View File

@ -1083,9 +1083,12 @@ nsresult HTMLMediaElement::LoadResource()
}
// Check if media is allowed for the docshell.
nsCOMPtr<nsIDocShell> docShell = OwnerDoc()->GetDocShell();
if (docShell && !docShell->GetAllowMedia()) {
return NS_ERROR_FAILURE;
nsCOMPtr<nsISupports> container = OwnerDoc()->GetContainer();
if (container) {
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(container);
if (docShell && !docShell->GetAllowMedia()) {
return NS_ERROR_FAILURE;
}
}
int16_t shouldLoad = nsIContentPolicy::ACCEPT;

View File

@ -8,7 +8,6 @@
#include "nsRect.h"
#include "nsIImageLoadingContent.h"
#include "nsGenericHTMLElement.h"
#include "nsDocShell.h"
#include "nsIDocumentInlines.h"
#include "nsDOMTokenList.h"
#include "nsIDOMHTMLImageElement.h"
@ -725,7 +724,7 @@ ImageDocument::UpdateTitleAndCharset()
void
ImageDocument::ResetZoomLevel()
{
nsCOMPtr<nsIDocShell> docShell(mDocumentContainer);
nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(mDocumentContainer);
if (docShell) {
if (nsContentUtils::IsChildOfSameType(this)) {
return;
@ -744,7 +743,7 @@ float
ImageDocument::GetZoomLevel()
{
float zoomLevel = mOriginalZoomLevel;
nsCOMPtr<nsIDocShell> docShell(mDocumentContainer);
nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(mDocumentContainer);
if (docShell) {
nsCOMPtr<nsIContentViewer> cv;
docShell->GetContentViewer(getter_AddRefs(cv));

View File

@ -32,7 +32,6 @@ LOCAL_INCLUDES += [
'/caps/include',
'/content/base/src',
'/content/events/src',
'/docshell/base',
'/dom/base',
'/layout/style',
'/xpcom/ds',

View File

@ -32,7 +32,7 @@
#include "nsIContentViewerContainer.h"
#include "nsIContentViewer.h"
#include "nsIMarkupDocumentViewer.h"
#include "nsDocShell.h"
#include "nsIDocShell.h"
#include "nsDocShellLoadTypes.h"
#include "nsIWebNavigation.h"
#include "nsIBaseWindow.h"
@ -1362,7 +1362,7 @@ nsHTMLDocument::Open(JSContext* cx,
}
// check whether we're in the middle of unload. If so, ignore this call.
nsCOMPtr<nsIDocShell> shell(mDocumentContainer);
nsCOMPtr<nsIDocShell> shell = do_QueryReferent(mDocumentContainer);
if (!shell) {
// We won't be able to create a parser anyway.
nsCOMPtr<nsIDocument> ret = this;

View File

@ -38,7 +38,7 @@
#include "nsIRDFService.h"
#include "nsIStreamListener.h"
#include "nsITimer.h"
#include "nsDocShell.h"
#include "nsIDocShell.h"
#include "nsGkAtoms.h"
#include "nsXMLContentSink.h"
#include "nsXULContentSink.h"
@ -3187,7 +3187,8 @@ XULDocument::DoneWalking()
// Before starting layout, check whether we're a toplevel chrome
// window. If we are, set our chrome flags now, so that we don't have
// to restyle the whole frame tree after StartLayout.
nsCOMPtr<nsIDocShellTreeItem> item = GetDocShell();
nsCOMPtr<nsISupports> container = GetContainer();
nsCOMPtr<nsIDocShellTreeItem> item = do_QueryInterface(container);
if (item) {
nsCOMPtr<nsIDocShellTreeOwner> owner;
item->GetTreeOwner(getter_AddRefs(owner));
@ -3195,7 +3196,7 @@ XULDocument::DoneWalking()
if (xulWin) {
nsCOMPtr<nsIDocShell> xulWinShell;
xulWin->GetDocShell(getter_AddRefs(xulWinShell));
if (SameCOMIdentity(xulWinShell, item)) {
if (SameCOMIdentity(xulWinShell, container)) {
// We're the chrome document! Apply our chrome flags now.
xulWin->ApplyChromeFlags();
}
@ -4666,7 +4667,7 @@ XULDocument::ParserObserver::OnStopRequest(nsIRequest *request,
already_AddRefed<nsPIWindowRoot>
XULDocument::GetWindowRoot()
{
nsCOMPtr<nsIInterfaceRequestor> ir(mDocumentContainer);
nsCOMPtr<nsIInterfaceRequestor> ir = do_QueryReferent(mDocumentContainer);
nsCOMPtr<nsIDOMWindow> window(do_GetInterface(ir));
nsCOMPtr<nsPIDOMWindow> piWin(do_QueryInterface(window));
return piWin ? piWin->GetTopWindowRoot() : nullptr;

View File

@ -28,7 +28,6 @@ LOCAL_INCLUDES += [
'/content/xml/document/src',
'/content/xul/content/src',
'/content/xul/templates/src',
'/docshell/base',
'/dom/base',
'/layout/base',
'/layout/generic',

View File

@ -7259,7 +7259,7 @@ nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
// got Reset() with a channel.
blankDoc->SetBaseURI(aBaseURI);
blankDoc->SetContainer(this);
blankDoc->SetContainer(static_cast<nsIDocShell *>(this));
// Copy our sandbox flags to the document. These are immutable
// after being set here.
@ -7271,7 +7271,7 @@ nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
// hook 'em up
if (viewer) {
viewer->SetContainer(this);
viewer->SetContainer(static_cast<nsIContentViewerContainer *>(this));
Embed(viewer, "", 0);
SetCurrentURI(blankDoc->GetDocumentURI(), nullptr, true, 0);
@ -7607,7 +7607,7 @@ nsDocShell::RestorePresentation(nsISHEntry *aSHEntry, bool *aRestoring)
// different one. We don't currently support restoring the presentation
// in that case.
nsCOMPtr<nsIDocShell> container;
nsCOMPtr<nsISupports> container;
viewer->GetContainer(getter_AddRefs(container));
if (!::SameCOMIdentity(container, GetAsSupports(this))) {
#ifdef DEBUG_PAGE_CACHE
@ -8333,13 +8333,13 @@ nsDocShell::NewContentViewerObj(const char *aContentType,
nsresult rv = docLoaderFactory->CreateInstance("view",
aOpenedChannel,
aLoadGroup, aContentType,
this,
static_cast<nsIContentViewerContainer*>(this),
nullptr,
aContentHandler,
aViewer);
NS_ENSURE_SUCCESS(rv, rv);
(*aViewer)->SetContainer(this);
(*aViewer)->SetContainer(static_cast<nsIContentViewerContainer *>(this));
return NS_OK;
}

View File

@ -18,7 +18,6 @@
#include "nsIContentViewerContainer.h"
#include "nsIDOMStorageManager.h"
#include "nsDocLoader.h"
#include "mozilla/WeakPtr.h"
// Helper Classes
#include "nsCOMPtr.h"
@ -138,8 +137,7 @@ class nsDocShell : public nsDocLoader,
public nsIWebShellServices,
public nsILinkHandler,
public nsIClipboardCommands,
public nsIDOMStorageManager,
public mozilla::SupportsWeakPtr<nsDocShell>
public nsIDOMStorageManager
{
friend class nsDSURIContentListener;

View File

@ -4,7 +4,6 @@
#include "nsISupports.idl"
interface nsIDocShell;
interface nsIDOMDocument;
interface nsISHEntry;
interface nsIPrintSettings;
@ -35,7 +34,7 @@ interface nsIContentViewer : nsISupports
[noscript] void init(in nsIWidgetPtr aParentWidget,
[const] in nsIntRectRef aBounds);
attribute nsIDocShell container;
attribute nsISupports container;
void loadStart(in nsISupports aDoc);
void loadComplete(in nsresult aStatus);

View File

@ -9,7 +9,6 @@
interface nsIChannel;
interface nsIContentViewer;
interface nsIStreamListener;
interface nsIDocShell;
interface nsIDocument;
interface nsILoadGroup;
interface nsIPrincipal;
@ -22,13 +21,13 @@ interface nsIPrincipal;
* The component is a service, so use GetService, not CreateInstance to get it.
*/
[scriptable, uuid(70905274-8494-4e39-b011-d559adde3733)]
[scriptable, uuid(5e7d2967-5a07-444f-95d5-25b533252d38)]
interface nsIDocumentLoaderFactory : nsISupports {
nsIContentViewer createInstance(in string aCommand,
in nsIChannel aChannel,
in nsILoadGroup aLoadGroup,
in string aContentType,
in nsIDocShell aContainer,
in nsISupports aContainer,
in nsISupports aExtraInfo,
out nsIStreamListener aDocListenerResult);

View File

@ -10,7 +10,6 @@
#include "nsIDocument.h"
#include "nsIWebNavigation.h"
#include "nsIContentViewer.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsDocShellEditorData.h"
#include "nsThreadUtils.h"
@ -168,7 +167,7 @@ nsSHEntryShared::Expire()
if (!mContentViewer) {
return;
}
nsCOMPtr<nsIDocShell> container;
nsCOMPtr<nsISupports> container;
mContentViewer->GetContainer(getter_AddRefs(container));
nsCOMPtr<nsIDocShellTreeItem> treeItem = do_QueryInterface(container);
if (!treeItem) {

View File

@ -2483,7 +2483,8 @@ TabChild::GetFrom(nsIPresShell* aPresShell)
if (!doc) {
return nullptr;
}
nsCOMPtr<nsIDocShell> docShell(doc->GetDocShell());
nsCOMPtr<nsISupports> container = doc->GetContainer();
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container));
return GetFrom(docShell);
}

View File

@ -842,7 +842,10 @@ TabParent::RecvSetStatus(const uint32_t& aType, const nsString& aStatus)
{
nsCOMPtr<nsIContent> frame = do_QueryInterface(mFrameElement);
if (frame) {
nsCOMPtr<nsIDocShell> docShell = frame->OwnerDoc()->GetDocShell();
nsCOMPtr<nsISupports> container = frame->OwnerDoc()->GetContainer();
if (!container)
return true;
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(container);
if (!docShell)
return true;
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;

View File

@ -97,7 +97,8 @@ GetLoadContext(nsIEditor* aEditor)
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
NS_ENSURE_TRUE(doc, nullptr);
nsCOMPtr<nsILoadContext> loadContext = doc->GetLoadContext();
nsCOMPtr<nsISupports> container = doc->GetContainer();
nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(container);
return loadContext.forget();
}

View File

@ -189,7 +189,8 @@ nsEditorHookUtils::GetHookEnumeratorFromDocument(nsIDOMDocument *aDoc,
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDoc);
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocShell> docShell = doc->GetDocShell();
nsCOMPtr<nsISupports> container = doc->GetContainer();
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(container);
nsCOMPtr<nsIClipboardDragDropHookList> hookObj = do_GetInterface(docShell);
NS_ENSURE_TRUE(hookObj, NS_ERROR_FAILURE);

View File

@ -432,7 +432,8 @@ bool nsPlaintextEditor::IsSafeToInsertData(nsIDOMDocument* aSourceDoc)
nsCOMPtr<nsIDocument> destdoc = GetDocument();
NS_ASSERTION(destdoc, "Where is our destination doc?");
nsCOMPtr<nsIDocShellTreeItem> dsti = destdoc->GetDocShell();
nsCOMPtr<nsISupports> container = destdoc->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> dsti = do_QueryInterface(container);
nsCOMPtr<nsIDocShellTreeItem> root;
if (dsti)
dsti->GetRootTreeItem(getter_AddRefs(root));

View File

@ -111,7 +111,4 @@ MSVC_ENABLE_PGO = True
include('/ipc/chromium/chromium-config.mozbuild')
LOCAL_INCLUDES += [
'/docshell/base',
]
FINAL_LIBRARY = 'gklayout'

View File

@ -36,7 +36,6 @@
#include "mozilla/BasicEvents.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/EncodingUtils.h"
#include "mozilla/WeakPtr.h"
#include "nsViewManager.h"
#include "nsView.h"
@ -49,7 +48,7 @@
#include "nsIMarkupDocumentViewer.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsDocShell.h"
#include "nsIDocShell.h"
#include "nsIBaseWindow.h"
#include "nsILayoutHistoryState.h"
#include "nsCharsetSource.h"
@ -349,7 +348,7 @@ protected:
// (ie, non owning) references. If you add any members to this
// class, please make the ownership explicit (pinkerton, scc).
WeakPtr<nsDocShell> mContainer; // it owns me!
nsWeakPtr mContainer; // it owns me!
nsWeakPtr mTopContainerWhilePrinting;
nsRefPtr<nsDeviceContext> mDeviceContext; // We create and own this baby
@ -577,7 +576,7 @@ nsDocumentViewer::LoadStart(nsISupports *aDoc)
nsresult
nsDocumentViewer::SyncParentSubDocMap()
{
nsCOMPtr<nsIDocShellTreeItem> item(mContainer);
nsCOMPtr<nsIDocShellTreeItem> item(do_QueryReferent(mContainer));
nsCOMPtr<nsPIDOMWindow> pwin(do_GetInterface(item));
nsCOMPtr<nsIContent> content;
@ -611,9 +610,9 @@ nsDocumentViewer::SyncParentSubDocMap()
}
NS_IMETHODIMP
nsDocumentViewer::SetContainer(nsIDocShell* aContainer)
nsDocumentViewer::SetContainer(nsISupports* aContainer)
{
mContainer = static_cast<nsDocShell*>(aContainer)->asWeakPtr();
mContainer = do_GetWeakReference(aContainer);
if (mPresContext) {
mPresContext->SetContainer(aContainer);
}
@ -626,11 +625,12 @@ nsDocumentViewer::SetContainer(nsIDocShell* aContainer)
}
NS_IMETHODIMP
nsDocumentViewer::GetContainer(nsIDocShell** aResult)
nsDocumentViewer::GetContainer(nsISupports** aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
nsCOMPtr<nsIDocShell> container(mContainer);
*aResult = nullptr;
nsCOMPtr<nsISupports> container = do_QueryReferent(mContainer);
container.swap(*aResult);
return NS_OK;
}
@ -873,7 +873,7 @@ nsDocumentViewer::InitInternal(nsIWidget* aParentWidget,
}
}
nsCOMPtr<nsIInterfaceRequestor> requestor(mContainer);
nsCOMPtr<nsIInterfaceRequestor> requestor(do_QueryReferent(mContainer));
if (requestor) {
if (mPresContext) {
nsCOMPtr<nsILinkHandler> linkHandler;
@ -1107,7 +1107,7 @@ nsDocumentViewer::PermitUnload(bool aCallerClosesWindow, bool *aPermitUnload)
}
}
nsCOMPtr<nsIDocShellTreeNode> docShellNode(mContainer);
nsCOMPtr<nsIDocShellTreeNode> docShellNode(do_QueryReferent(mContainer));
nsAutoString text;
beforeUnload->GetReturnValue(text);
if (event->GetInternalNSEvent()->mFlags.mDefaultPrevented ||
@ -1198,7 +1198,7 @@ nsDocumentViewer::ResetCloseWindow()
{
mCallerIsClosingWindow = false;
nsCOMPtr<nsIDocShellTreeNode> docShellNode(mContainer);
nsCOMPtr<nsIDocShellTreeNode> docShellNode(do_QueryReferent(mContainer));
if (docShellNode) {
int32_t childCount;
docShellNode->GetChildCount(&childCount);
@ -1286,7 +1286,7 @@ AttachContainerRecurse(nsIDocShell* aShell)
if (viewer) {
nsIDocument* doc = viewer->GetDocument();
if (doc) {
doc->SetContainer(static_cast<nsDocShell*>(aShell));
doc->SetContainer(aShell);
}
nsRefPtr<nsPresContext> pc;
viewer->GetPresContext(getter_AddRefs(pc));
@ -1317,7 +1317,7 @@ nsDocumentViewer::Open(nsISupports *aState, nsISHEntry *aSHEntry)
NS_ENSURE_TRUE(mPresShell, NS_ERROR_NOT_INITIALIZED);
if (mDocument)
mDocument->SetContainer(mContainer);
mDocument->SetContainer(nsCOMPtr<nsISupports>(do_QueryReferent(mContainer)));
nsresult rv = InitInternal(mParentWidget, aState, mBounds, false);
NS_ENSURE_SUCCESS(rv, rv);
@ -1561,11 +1561,8 @@ nsDocumentViewer::Destroy()
mPresContext->SetLinkHandler(nullptr);
mPresContext->SetContainer(nullptr);
}
if (mPresShell) {
nsWeakPtr container =
do_GetWeakReference(static_cast<nsIDocShell*>(mContainer));
mPresShell->SetForwardingContainer(container);
}
if (mPresShell)
mPresShell->SetForwardingContainer(mContainer);
// Do the same for our children. Note that we need to get the child
// docshells from the SHEntry now; the docshell will have cleared them.
@ -1623,7 +1620,7 @@ nsDocumentViewer::Destroy()
mWindow = nullptr;
mViewManager = nullptr;
mContainer = WeakPtr<nsDocShell>();
mContainer = nullptr;
return NS_OK;
}
@ -1694,7 +1691,8 @@ nsDocumentViewer::SetDocumentInternal(nsIDocument* aDocument,
MOZ_ASSERT(aDocument);
// Set new container
aDocument->SetContainer(mContainer);
nsCOMPtr<nsISupports> container = do_QueryReferent(mContainer);
aDocument->SetContainer(container);
if (mDocument != aDocument) {
if (mDocument->IsStaticDocument()) {
@ -1706,8 +1704,7 @@ nsDocumentViewer::SetDocumentInternal(nsIDocument* aDocument,
mDocument = aDocument;
// Set the script global object on the new document
nsCOMPtr<nsPIDOMWindow> window =
do_GetInterface(static_cast<nsIDocShell*>(mContainer.get()));
nsCOMPtr<nsPIDOMWindow> window = do_GetInterface(container);
if (window) {
window->SetNewDocument(aDocument, nullptr, aForceReuseInnerWindow);
}
@ -1715,7 +1712,7 @@ nsDocumentViewer::SetDocumentInternal(nsIDocument* aDocument,
// Clear the list of old child docshells. Child docshells for the new
// document will be constructed as frames are created.
if (!aDocument->IsStaticDocument()) {
nsCOMPtr<nsIDocShellTreeNode> node(mContainer);
nsCOMPtr<nsIDocShellTreeNode> node = do_QueryInterface(container);
if (node) {
int32_t count;
node->GetChildCount(&count);
@ -1891,7 +1888,7 @@ nsDocumentViewer::Show(void)
prevViewer->Destroy();
// Make sure we don't have too many cached ContentViewers
nsCOMPtr<nsIDocShellTreeItem> treeItem(mContainer);
nsCOMPtr<nsIDocShellTreeItem> treeItem = do_QueryReferent(mContainer);
if (treeItem) {
// We need to find the root DocShell since only that object has an
// SHistory and we need the SHistory to evict content viewers
@ -1927,7 +1924,7 @@ nsDocumentViewer::Show(void)
if (mDocument && !mPresShell) {
NS_ASSERTION(!mWindow, "Window already created but no presshell?");
nsCOMPtr<nsIBaseWindow> base_win(mContainer);
nsCOMPtr<nsIBaseWindow> base_win(do_QueryReferent(mContainer));
if (base_win) {
base_win->GetParentWidget(&mParentWidget);
if (mParentWidget) {
@ -2017,7 +2014,7 @@ nsDocumentViewer::Hide(void)
return NS_OK;
}
nsCOMPtr<nsIDocShell> docShell(mContainer);
nsCOMPtr<nsIDocShell> docShell(do_QueryReferent(mContainer));
if (docShell) {
nsCOMPtr<nsILayoutHistoryState> layoutState;
mPresShell->CaptureHistoryState(getter_AddRefs(layoutState));
@ -2032,7 +2029,7 @@ nsDocumentViewer::Hide(void)
mDeviceContext = nullptr;
mParentWidget = nullptr;
nsCOMPtr<nsIBaseWindow> base_win(mContainer);
nsCOMPtr<nsIBaseWindow> base_win(do_QueryReferent(mContainer));
if (base_win && !mAttachedToParent) {
base_win->SetParentWidget(nullptr);
@ -2117,7 +2114,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument,
bool shouldOverride = false;
// We don't want a docshell here for external resource docs, so just
// look at mContainer.
nsCOMPtr<nsIDocShell> ds(mContainer);
nsCOMPtr<nsIDocShell> ds(do_QueryReferent(mContainer));
nsCOMPtr<nsIDOMEventTarget> chromeHandler;
nsCOMPtr<nsIURI> uri;
nsRefPtr<nsCSSStyleSheet> csssheet;
@ -2306,7 +2303,7 @@ nsDocumentViewer::FindContainerView()
nsView* containerView = nullptr;
if (mContainer) {
nsCOMPtr<nsIDocShellTreeItem> docShellItem(mContainer);
nsCOMPtr<nsIDocShellTreeItem> docShellItem = do_QueryReferent(mContainer);
nsCOMPtr<nsPIDOMWindow> pwin(do_GetInterface(docShellItem));
if (pwin) {
nsCOMPtr<nsIContent> containerElement = do_QueryInterface(pwin->GetFrameElementInternal());
@ -2503,7 +2500,7 @@ NS_IMETHODIMP nsDocumentViewer::CopyImage(int32_t aCopyFlags)
// make noise if we're not in an image
NS_ENSURE_TRUE(node, NS_ERROR_FAILURE);
nsCOMPtr<nsILoadContext> loadContext(mContainer);
nsCOMPtr<nsILoadContext> loadContext(do_QueryReferent(mContainer));
return nsCopySupport::ImageCopy(node, loadContext, aCopyFlags);
}
@ -2635,7 +2632,7 @@ NS_IMETHODIMP nsDocumentViewer::ScrollToNode(nsIDOMNode* aNode)
void
nsDocumentViewer::CallChildren(CallChildFunc aFunc, void* aClosure)
{
nsCOMPtr<nsIDocShellTreeNode> docShellNode(mContainer);
nsCOMPtr<nsIDocShellTreeNode> docShellNode(do_QueryReferent(mContainer));
if (docShellNode)
{
int32_t i;
@ -3229,7 +3226,7 @@ nsDocumentViewer::GetContentSize(int32_t* aWidth, int32_t* aHeight)
NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);
// Skip doing this on docshell-less documents for now
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(mContainer);
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryReferent(mContainer));
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_NOT_AVAILABLE);
nsCOMPtr<nsIDocShellTreeItem> docShellParent;
@ -3557,7 +3554,7 @@ nsDocumentViewer::Print(nsIPrintSettings* aPrintSettings,
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIDocShell> docShell(mContainer);
nsCOMPtr<nsIDocShell> docShell(do_QueryReferent(mContainer));
NS_ENSURE_STATE(docShell);
// Check to see if this document is still busy
@ -3667,7 +3664,7 @@ nsDocumentViewer::PrintPreview(nsIPrintSettings* aPrintSettings,
}
#endif
nsCOMPtr<nsIDocShell> docShell(mContainer);
nsCOMPtr<nsIDocShell> docShell(do_QueryReferent(mContainer));
if (!docShell || !mDeviceContext) {
PR_PL(("Can't Print Preview without device context and docshell"));
return NS_ERROR_FAILURE;
@ -4033,7 +4030,7 @@ nsDocumentViewer::ShouldAttachToTopLevel()
if (!mParentWidget)
return false;
nsCOMPtr<nsIDocShellTreeItem> containerItem(mContainer);
nsCOMPtr<nsIDocShellTreeItem> containerItem = do_QueryReferent(mContainer);
if (!containerItem)
return false;
@ -4101,7 +4098,7 @@ nsDocumentViewer::SetIsPrinting(bool aIsPrinting)
#ifdef NS_PRINTING
// Set all the docShells in the docshell tree to be printing.
// that way if anyone of them tries to "navigate" it can't
nsCOMPtr<nsIDocShellTreeNode> docShellTreeNode(mContainer);
nsCOMPtr<nsIDocShellTreeNode> docShellTreeNode(do_QueryReferent(mContainer));
if (docShellTreeNode || !aIsPrinting) {
SetIsPrintingInDocShellTree(docShellTreeNode, aIsPrinting, true);
} else {
@ -4137,7 +4134,7 @@ nsDocumentViewer::SetIsPrintPreview(bool aIsPrintPreview)
#ifdef NS_PRINTING
// Set all the docShells in the docshell tree to be printing.
// that way if anyone of them tries to "navigate" it can't
nsCOMPtr<nsIDocShellTreeNode> docShellTreeNode(mContainer);
nsCOMPtr<nsIDocShellTreeNode> docShellTreeNode(do_QueryReferent(mContainer));
if (docShellTreeNode || !aIsPrintPreview) {
SetIsPrintingInDocShellTree(docShellTreeNode, aIsPrintPreview, true);
}
@ -4211,7 +4208,7 @@ nsDocumentViewer::ReturnToGalleyPresentation()
mPrintEngine->Destroy();
mPrintEngine = nullptr;
nsCOMPtr<nsIDocShell> docShell(mContainer);
nsCOMPtr<nsIDocShell> docShell(do_QueryReferent(mContainer));
ResetFocusState(docShell);
SetTextZoom(mTextZoom);
@ -4250,8 +4247,8 @@ nsDocumentViewer::OnDonePrinting()
// We are done printing, now cleanup
if (mDeferredWindowClose) {
mDeferredWindowClose = false;
nsCOMPtr<nsIDOMWindow> win =
do_GetInterface(static_cast<nsIDocShell*>(mContainer));
nsCOMPtr<nsISupports> container = do_QueryReferent(mContainer);
nsCOMPtr<nsIDOMWindow> win = do_GetInterface(container);
if (win)
win->Close();
} else if (mClosingWhilePrinting) {

View File

@ -958,7 +958,9 @@ nsPresContext::Init(nsDeviceContext* aDeviceContext)
"How did we get a presshell?");
// We don't have our container set yet at this point
nsCOMPtr<nsIDocShellTreeItem> ourItem = mDocument->GetDocShell();
nsCOMPtr<nsISupports> ourContainer = mDocument->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> ourItem = do_QueryInterface(ourContainer);
if (ourItem) {
nsCOMPtr<nsIDocShellTreeItem> parentItem;
ourItem->GetSameTypeParent(getter_AddRefs(parentItem));

View File

@ -29,7 +29,4 @@ LIBRARY_NAME = 'gklayout'
include('/ipc/chromium/chromium-config.mozbuild')
LOCAL_INCLUDES += [
'/docshell/base',
]
FINAL_LIBRARY = 'xul'

View File

@ -5,7 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsCOMPtr.h"
#include "nsContentDLF.h"
#include "nsDocShell.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsIComponentManager.h"
@ -136,7 +135,7 @@ nsContentDLF::CreateInstance(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
const char* aContentType,
nsIDocShell* aContainer,
nsISupports* aContainer,
nsISupports* aExtraInfo,
nsIStreamListener** aDocListener,
nsIContentViewer** aDocViewer)
@ -371,7 +370,7 @@ nsresult
nsContentDLF::CreateDocument(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsIDocShell* aContainer,
nsISupports* aContainer,
const nsCID& aDocumentCID,
nsIStreamListener** aDocListener,
nsIContentViewer** aContentViewer)
@ -400,7 +399,7 @@ nsContentDLF::CreateDocument(const char* aCommand,
rv = NS_NewContentViewer(getter_AddRefs(contentViewer));
NS_ENSURE_SUCCESS(rv, rv);
doc->SetContainer(static_cast<nsDocShell*>(aContainer));
doc->SetContainer(aContainer);
// Initialize the document to begin loading the data. An
// nsIStreamListener connected to the parser is returned in
@ -419,7 +418,7 @@ nsContentDLF::CreateXULDocument(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
const char* aContentType,
nsIDocShell* aContainer,
nsISupports* aContainer,
nsISupports* aExtraInfo,
nsIStreamListener** aDocListener,
nsIContentViewer** aContentViewer)
@ -443,7 +442,7 @@ nsContentDLF::CreateXULDocument(const char* aCommand,
* aDocListener.
*/
doc->SetContainer(static_cast<nsDocShell*>(aContainer));
doc->SetContainer(aContainer);
rv = doc->StartDocumentLoad(aCommand, aChannel, aLoadGroup, aContainer, aDocListener, true);
if (NS_FAILED(rv)) return rv;

View File

@ -33,7 +33,7 @@ public:
nsresult CreateDocument(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsIDocShell* aContainer,
nsISupports* aContainer,
const nsCID& aDocumentCID,
nsIStreamListener** aDocListener,
nsIContentViewer** aContentViewer);
@ -42,7 +42,7 @@ public:
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
const char* aContentType,
nsIDocShell* aContainer,
nsISupports* aContainer,
nsISupports* aExtraInfo,
nsIStreamListener** aDocListener,
nsIContentViewer** aContentViewer);

View File

@ -981,7 +981,8 @@ EndSwapDocShellsForDocument(nsIDocument* aDocument, void*)
// Our docshell and view trees have been updated for the new hierarchy.
// Now also update all nsDeviceContext::mWidget to that of the
// container view in the new hierarchy.
nsCOMPtr<nsIDocShell> ds = aDocument->GetDocShell();
nsCOMPtr<nsISupports> container = aDocument->GetContainer();
nsCOMPtr<nsIDocShell> ds = do_QueryInterface(container);
if (ds) {
nsCOMPtr<nsIContentViewer> cv;
ds->GetContentViewer(getter_AddRefs(cv));

View File

@ -293,7 +293,7 @@ void nsPrintEngine::DestroyPrintingData()
//--------------------------------------------------------
nsresult nsPrintEngine::Initialize(nsIDocumentViewerPrint* aDocViewerPrint,
nsIDocShell* aContainer,
nsIWeakReference* aContainer,
nsIDocument* aDocument,
float aScreenDPI,
FILE* aDebugFile)
@ -303,7 +303,7 @@ nsresult nsPrintEngine::Initialize(nsIDocumentViewerPrint* aDocViewerPrint,
NS_ENSURE_ARG_POINTER(aDocument);
mDocViewerPrint = aDocViewerPrint;
mContainer = do_GetWeakReference(aContainer);
mContainer = aContainer;
mDocument = aDocument;
mScreenDPI = aScreenDPI;
@ -1335,7 +1335,8 @@ nsPrintEngine::MapContentForPO(nsPrintObject* aPO,
nsIDocument* subDoc = doc->GetSubDocumentFor(aContent);
if (subDoc) {
nsCOMPtr<nsIDocShell> docShell(subDoc->GetDocShell());
nsCOMPtr<nsISupports> container = subDoc->GetContainer();
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container));
if (docShell) {
nsPrintObject * po = nullptr;

View File

@ -82,7 +82,7 @@ public:
void DestroyPrintingData();
nsresult Initialize(nsIDocumentViewerPrint* aDocViewerPrint,
nsIDocShell* aContainer,
nsIWeakReference* aContainer,
nsIDocument* aDocument,
float aScreenDPI,
FILE* aDebugFile);

View File

@ -876,13 +876,15 @@ nsUserFontSet::CheckFontLoad(const gfxFontFaceSrc* aFontFaceSrc,
}
*aBypassCache = false;
nsCOMPtr<nsIDocShell> docShell = ps->GetDocument()->GetDocShell();
if (docShell) {
uint32_t loadType;
if (NS_SUCCEEDED(docShell->GetLoadType(&loadType))) {
if ((loadType >> 16) & nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE) {
*aBypassCache = true;
nsCOMPtr<nsISupports> container = ps->GetDocument()->GetContainer();
if (container) {
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(container);
if (docShell) {
uint32_t loadType;
if (NS_SUCCEEDED(docShell->GetLoadType(&loadType))) {
if ((loadType >> 16) & nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE) {
*aBypassCache = true;
}
}
}
}
@ -980,6 +982,11 @@ nsUserFontSet::GetPrivateBrowsing()
return false;
}
nsCOMPtr<nsILoadContext> loadContext = ps->GetDocument()->GetLoadContext();
nsCOMPtr<nsISupports> container = ps->GetDocument()->GetContainer();
if (!container) {
return false;
}
nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(container);
return loadContext && loadContext->UsePrivateBrowsing();
}

View File

@ -80,8 +80,13 @@ NS_IMETHODIMP nsContainerBoxObject::GetDocShell(nsIDocShell** aResult)
return NS_OK;
}
NS_IF_ADDREF(*aResult = sub_doc->GetDocShell());
return NS_OK;
nsCOMPtr<nsISupports> container = sub_doc->GetContainer();
if (!container) {
return NS_OK;
}
return CallQueryInterface(container, aResult);
}
nsresult

View File

@ -1061,7 +1061,8 @@ nsXULPopupManager::HidePopupsInList(const nsTArray<nsMenuPopupFrame *> &aFrames,
bool
nsXULPopupManager::IsChildOfDocShell(nsIDocument* aDoc, nsIDocShellTreeItem* aExpected)
{
nsCOMPtr<nsIDocShellTreeItem> docShellItem(aDoc->GetDocShell());
nsCOMPtr<nsISupports> doc = aDoc->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> docShellItem(do_QueryInterface(doc));
while(docShellItem) {
if (docShellItem == aExpected)
return true;

View File

@ -584,8 +584,9 @@ nsFormFillController::GetInPrivateContext(bool *aInPrivateContext)
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mFocusedInput);
element->GetOwnerDocument(getter_AddRefs(inputDoc));
nsCOMPtr<nsIDocument> doc = do_QueryInterface(inputDoc);
nsCOMPtr<nsIDocShell> docShell = doc->GetDocShell();
nsCOMPtr<nsILoadContext> loadContext = doc->GetLoadContext();
nsCOMPtr<nsISupports> container = doc->GetContainer();
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(container);
nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(docShell);
*aInPrivateContext = loadContext && loadContext->UsePrivateBrowsing();
return NS_OK;
}

View File

@ -23,7 +23,6 @@
#include "nsICacheSession.h"
#include "nsICachingChannel.h"
#include "nsIContent.h"
#include "nsIDocShell.h"
#include "nsIDocumentLoader.h"
#include "nsIDOMElement.h"
#include "nsIDOMWindow.h"
@ -379,7 +378,8 @@ nsOfflineCacheUpdateService::ScheduleOnDocumentStop(nsIURI *aManifestURI,
this, aManifestURI, aDocumentURI, aDocument));
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDocument);
nsCOMPtr<nsIWebProgress> progress = do_QueryInterface(doc->GetContainer());
nsCOMPtr<nsISupports> container = doc->GetContainer();
nsCOMPtr<nsIWebProgress> progress = do_QueryInterface(container);
NS_ENSURE_TRUE(progress, NS_ERROR_INVALID_ARG);
// Proceed with cache update

View File

@ -17,7 +17,6 @@
#include "nsDirectoryViewer.h"
#include "nsIDirIndex.h"
#include "nsIDocShell.h"
#include "jsapi.h"
#include "nsCOMPtr.h"
#include "nsCRT.h"
@ -1266,7 +1265,7 @@ nsDirectoryViewerFactory::CreateInstance(const char *aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
const char* aContentType,
nsIDocShell* aContainer,
nsISupports* aContainer,
nsISupports* aExtraInfo,
nsIStreamListener** aDocListenerResult,
nsIContentViewer** aDocViewerResult)