зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1273850 - Add lots of documentation to explain the scenarios that cause nsFrameLoader::Create to return null. r=smaug
MozReview-Commit-ID: 6UZyql1qHg0 --HG-- extra : rebase_source : 353bffea8919d02d3ba5f2f93c84a95fd0784caa
This commit is contained in:
Родитель
1e36d8a8f3
Коммит
6be4402448
|
@ -182,9 +182,30 @@ nsFrameLoader::Create(Element* aOwner, bool aNetworkCreated)
|
|||
{
|
||||
NS_ENSURE_TRUE(aOwner, nullptr);
|
||||
nsIDocument* doc = aOwner->OwnerDoc();
|
||||
|
||||
// We never create nsFrameLoaders for elements in resource documents.
|
||||
//
|
||||
// We never create nsFrameLoaders for elements in data documents, unless the
|
||||
// document is a static document.
|
||||
// Static documents are an exception because any sub-documents need an
|
||||
// nsFrameLoader to keep the relevant docShell alive, even though the
|
||||
// nsFrameLoader isn't used to load anything (the sub-document is created by
|
||||
// the static clone process).
|
||||
//
|
||||
// We never create nsFrameLoaders for elements that are not
|
||||
// in-composed-document, unless the element belongs to a static document.
|
||||
// Static documents are an exception because this method is called at a point
|
||||
// in the static clone process before aOwner has been inserted into its
|
||||
// document. For other types of documents this wouldn't be a problem since
|
||||
// we'd create the nsFrameLoader as necessary after aOwner is inserted into a
|
||||
// document, but the mechanisms that take care of that don't apply for static
|
||||
// documents so we need to create the nsFrameLoader now. (This isn't wasteful
|
||||
// since for a static document we know aOwner will end up in a document and
|
||||
// the nsFrameLoader will be used for its docShell.)
|
||||
//
|
||||
NS_ENSURE_TRUE(!doc->IsResourceDoc() &&
|
||||
((!doc->IsLoadedAsData() && aOwner->GetComposedDoc()) ||
|
||||
doc->IsStaticDocument()),
|
||||
((!doc->IsLoadedAsData() && aOwner->IsInComposedDoc()) ||
|
||||
doc->IsStaticDocument()),
|
||||
nullptr);
|
||||
|
||||
return new nsFrameLoader(aOwner, aNetworkCreated);
|
||||
|
|
|
@ -2063,13 +2063,25 @@ public:
|
|||
virtual nsIDocument* GetTemplateContentsOwner() = 0;
|
||||
|
||||
/**
|
||||
* true when this document is a static clone of a normal document.
|
||||
* For example print preview and printing use static documents.
|
||||
* Returns true if this document is a static clone of a normal document.
|
||||
*
|
||||
* We create static clones for print preview and printing (possibly other
|
||||
* things in future).
|
||||
*
|
||||
* Note that static documents are also "loaded as data" (if this method
|
||||
* returns true, IsLoadedAsData() will also return true).
|
||||
*/
|
||||
bool IsStaticDocument() { return mIsStaticDocument; }
|
||||
|
||||
/**
|
||||
* Clones the document and subdocuments and stylesheet etc.
|
||||
* Clones the document along with any subdocuments, stylesheet, etc.
|
||||
*
|
||||
* The resulting document and everything it contains (including any
|
||||
* sub-documents) are created purely via cloning. The returned documents and
|
||||
* any sub-documents are "loaded as data" documents to preserve the state as
|
||||
* it was during the clone process (we don't want external resources to load
|
||||
* and replace the cloned resources).
|
||||
*
|
||||
* @param aCloneContainer The container for the clone document.
|
||||
*/
|
||||
virtual already_AddRefed<nsIDocument>
|
||||
|
|
Загрузка…
Ссылка в новой задаче