From 188cbf9d0b1659cd786432ba749f7704ddba7d85 Mon Sep 17 00:00:00 2001 From: "tbogard%aol.net" Date: Mon, 1 Nov 1999 07:53:24 +0000 Subject: [PATCH] Added some checks to verify calling of the nsIDocShellFile and nsIDocShellEdit functions. git-svn-id: svn://10.0.0.236/trunk@52379 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsDocShellBase.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/mozilla/docshell/base/nsDocShellBase.cpp b/mozilla/docshell/base/nsDocShellBase.cpp index ef921adbe8e..d715e1933eb 100644 --- a/mozilla/docshell/base/nsDocShellBase.cpp +++ b/mozilla/docshell/base/nsDocShellBase.cpp @@ -286,6 +286,10 @@ NS_IMETHODIMP nsDocShellBase::SelectAll() NS_IMETHODIMP nsDocShellBase::CopySelection() { NS_ENSURE_STATE(mContentViewer); + PRBool copyable; + NS_ENSURE_SUCCESS(GetCopyable(©able), NS_ERROR_FAILURE); + NS_ENSURE_TRUE(copyable, NS_ERROR_UNEXPECTED); + nsCOMPtr presShell; NS_ENSURE_SUCCESS(GetPresShell(getter_AddRefs(presShell)), NS_ERROR_FAILURE); @@ -300,8 +304,8 @@ NS_IMETHODIMP nsDocShellBase::CopySelection() NS_IMETHODIMP nsDocShellBase::GetCopyable(PRBool *aCopyable) { NS_ENSURE_ARG_POINTER(aCopyable); - NS_ENSURE_STATE(mContentViewer); + nsCOMPtr presShell; NS_ENSURE_SUCCESS(GetPresShell(getter_AddRefs(presShell)), NS_ERROR_FAILURE); @@ -324,6 +328,7 @@ NS_IMETHODIMP nsDocShellBase::GetCopyable(PRBool *aCopyable) NS_IMETHODIMP nsDocShellBase::CutSelection() { + NS_ENSURE_STATE(mContentViewer); PRBool cutable; NS_ENSURE_SUCCESS(GetCutable(&cutable), NS_ERROR_FAILURE); NS_ENSURE_TRUE(cutable, NS_ERROR_UNEXPECTED); @@ -348,6 +353,11 @@ NS_IMETHODIMP nsDocShellBase::GetCutable(PRBool* aCutable) NS_IMETHODIMP nsDocShellBase::Paste() { + NS_ENSURE_STATE(mContentViewer); + PRBool pasteable; + NS_ENSURE_SUCCESS(GetPasteable(&pasteable), NS_ERROR_FAILURE); + NS_ENSURE_TRUE(pasteable, NS_ERROR_UNEXPECTED); + //XXX Implement return NS_ERROR_FAILURE; } @@ -370,6 +380,11 @@ NS_IMETHODIMP nsDocShellBase::GetPasteable(PRBool* aPasteable) NS_IMETHODIMP nsDocShellBase::Save() { + NS_ENSURE_STATE(mContentViewer); + PRBool saveable; + NS_ENSURE_SUCCESS(GetSaveable(&saveable), NS_ERROR_FAILURE); + NS_ENSURE_TRUE(saveable, NS_ERROR_UNEXPECTED); + //XXX First Check return NS_ERROR_FAILURE; } @@ -389,6 +404,11 @@ NS_IMETHODIMP nsDocShellBase::GetSaveable(PRBool* saveable) NS_IMETHODIMP nsDocShellBase::Print() { + NS_ENSURE_STATE(mContentViewer); + PRBool printable; + NS_ENSURE_SUCCESS(GetPrintable(&printable), NS_ERROR_FAILURE); + NS_ENSURE_TRUE(printable, NS_ERROR_UNEXPECTED); + //XXX First Check return NS_ERROR_FAILURE; }