Bug 1192467 - Formalize precondition that SetDisplayDocument must not be called with null. - r=peterv

This commit is contained in:
Jeff Gilbert 2015-08-31 14:26:19 -07:00
parent b42864cc61
commit 0831967c9b

View File

@ -1736,14 +1736,15 @@ public:
*/
void SetDisplayDocument(nsIDocument* aDisplayDocument)
{
NS_PRECONDITION(!GetShell() &&
!GetContainer() &&
!GetWindow(),
"Shouldn't set mDisplayDocument on documents that already "
"have a presentation or a docshell or a window");
NS_PRECONDITION(aDisplayDocument != this, "Should be different document");
NS_PRECONDITION(!aDisplayDocument->GetDisplayDocument(),
"Display documents should not nest");
MOZ_ASSERT(!GetShell() &&
!GetContainer() &&
!GetWindow(),
"Shouldn't set mDisplayDocument on documents that already "
"have a presentation or a docshell or a window");
MOZ_ASSERT(aDisplayDocument, "Must not be null");
MOZ_ASSERT(aDisplayDocument != this, "Should be different document");
MOZ_ASSERT(!aDisplayDocument->GetDisplayDocument(),
"Display documents should not nest");
mDisplayDocument = aDisplayDocument;
mHasDisplayDocument = !!aDisplayDocument;
}
@ -1764,7 +1765,7 @@ public:
virtual ~ExternalResourceLoad() {}
void AddObserver(nsIObserver* aObserver) {
NS_PRECONDITION(aObserver, "Must have observer");
MOZ_ASSERT(aObserver, "Must have observer");
mObservers.AppendElement(aObserver);
}