Bug 287707 - After page had designmode on, there are still several issues, r=neil, sr=jst

This commit is contained in:
martijn.martijn%gmail.com 2006-10-25 01:11:55 +00:00
parent 54ee0e98cc
commit 83b80aa8a3
4 changed files with 78 additions and 82 deletions

View File

@ -119,8 +119,8 @@ nsEditingSession::~nsEditingSession()
mLoadBlankDocTimer->Cancel();
}
NS_IMPL_ISUPPORTS4(nsEditingSession, nsIEditingSession, nsIWebProgressListener,
nsIURIContentListener, nsISupportsWeakReference)
NS_IMPL_ISUPPORTS3(nsEditingSession, nsIEditingSession, nsIWebProgressListener,
nsISupportsWeakReference)
/*---------------------------------------------------------------------------
@ -145,15 +145,7 @@ nsEditingSession::MakeWindowEditable(nsIDOMWindow *aWindow,
nsIDocShell *docShell = GetDocShellFromWindow(aWindow);
if (!docShell) return NS_ERROR_FAILURE;
// register as a content listener, so that we can fend off URL
// loads from sidebar
nsresult rv;
nsCOMPtr<nsIURIContentListener> listener = do_GetInterface(docShell, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = listener->SetParentContentListener(this);
NS_ENSURE_SUCCESS(rv, rv);
// Disable JavaScript in this document:
PRBool tmp;
rv = docShell->GetAllowJavascript(&tmp);
@ -916,70 +908,6 @@ nsEditingSession::OnSecurityChange(nsIWebProgress *aWebProgress,
}
#ifdef XP_MAC
#pragma mark -
#endif
/* boolean onStartURIOpen (in nsIURI aURI); */
NS_IMETHODIMP nsEditingSession::OnStartURIOpen(nsIURI *aURI, PRBool *aAbortOpen)
{
return NS_OK;
}
/* boolean doContent (in string aContentType, in boolean aIsContentPreferred, in nsIRequest aRequest, out nsIStreamListener aContentHandler); */
NS_IMETHODIMP nsEditingSession::DoContent(const char *aContentType, PRBool aIsContentPreferred, nsIRequest *aRequest, nsIStreamListener **aContentHandler, PRBool *aAbortProcess)
{
NS_ENSURE_ARG_POINTER(aContentHandler);
NS_ENSURE_ARG_POINTER(aAbortProcess);
*aContentHandler = nsnull;
*aAbortProcess = PR_FALSE;
return NS_OK;
}
/* boolean isPreferred (in string aContentType, out string aDesiredContentType); */
NS_IMETHODIMP nsEditingSession::IsPreferred(const char *aContentType, char **aDesiredContentType, PRBool *_retval)
{
NS_ENSURE_ARG_POINTER(aDesiredContentType);
NS_ENSURE_ARG_POINTER(_retval);
*aDesiredContentType = nsnull;
*_retval = PR_FALSE;
return NS_OK;
}
/* boolean canHandleContent (in string aContentType, in boolean aIsContentPreferred, out string aDesiredContentType); */
NS_IMETHODIMP nsEditingSession::CanHandleContent(const char *aContentType, PRBool aIsContentPreferred, char **aDesiredContentType, PRBool *_retval)
{
NS_ENSURE_ARG_POINTER(aDesiredContentType);
NS_ENSURE_ARG_POINTER(_retval);
*aDesiredContentType = nsnull;
*_retval = PR_FALSE;
return NS_OK;
}
/* attribute nsISupports loadCookie; */
NS_IMETHODIMP nsEditingSession::GetLoadCookie(nsISupports * *aLoadCookie)
{
NS_ENSURE_ARG_POINTER(aLoadCookie);
*aLoadCookie = nsnull;
return NS_OK;
}
NS_IMETHODIMP nsEditingSession::SetLoadCookie(nsISupports * aLoadCookie)
{
return NS_OK;
}
/* attribute nsIURIContentListener parentContentListener; */
NS_IMETHODIMP nsEditingSession::GetParentContentListener(nsIURIContentListener * *aParentContentListener)
{
NS_ENSURE_ARG_POINTER(aParentContentListener);
*aParentContentListener = nsnull;
return NS_OK;
}
NS_IMETHODIMP nsEditingSession::SetParentContentListener(nsIURIContentListener * aParentContentListener)
{
return NS_OK;
}
#ifdef XP_MAC
#pragma mark -
#endif

View File

@ -46,10 +46,6 @@
#include "nsITimer.h"
#ifndef __gen_nsIURIContentListener_h__
#include "nsIURIContentListener.h"
#endif
#ifndef __gen_nsIWebProgressListener_h__
#include "nsIWebProgressListener.h"
#endif
@ -75,7 +71,6 @@ class nsComposerCommandsUpdater;
class nsEditingSession : public nsIEditingSession,
public nsIWebProgressListener,
public nsIURIContentListener,
public nsSupportsWeakReference
{
public:
@ -86,9 +81,6 @@ public:
// nsISupports
NS_DECL_ISUPPORTS
// nsIURIContentListener
NS_DECL_NSIURICONTENTLISTENER
// nsIWebProgressListener
NS_DECL_NSIWEBPROGRESSLISTENER

View File

@ -27,6 +27,40 @@
</getter>
</property>
<field name="_editorContentListener">
<![CDATA[
({
QueryInterface: function(iid)
{
if (iid.equals(Components.interfaces.nsIURIContentListener) ||
iid.equals(Components.interfaces.nsISupportsWeakReference) ||
iid.equals(Components.interfaces.nsISupports))
return this;
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
return null;
},
onStartURIOpen: function(uri)
{
return false;
},
doContent: function(contentType, isContentPreferred, request, contentHandler)
{
return false;
},
isPreferred: function(contentType, desiredContentType)
{
return false;
},
canHandleContent: function(contentType, isContentPreferred, desiredContentType)
{
return false;
},
loadCookie: null,
parentContentListener: null
})
]]>
</field>
<method name="makeEditable">
<parameter name="editortype"/>
<parameter name="waitForUrlLoad"/>
@ -34,6 +68,10 @@
<![CDATA[
this.editingSession.makeWindowEditable(this.contentWindow, editortype, waitForUrlLoad);
this.setAttribute("editortype", editortype);
this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIURIContentListener)
.parentContentListener = this._editorContentListener;
]]>
</body>
</method>

View File

@ -27,6 +27,40 @@
</getter>
</property>
<field name="_editorContentListener">
<![CDATA[
({
QueryInterface: function(iid)
{
if (iid.equals(Components.interfaces.nsIURIContentListener) ||
iid.equals(Components.interfaces.nsISupportsWeakReference) ||
iid.equals(Components.interfaces.nsISupports))
return this;
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
return null;
},
onStartURIOpen: function(uri)
{
return false;
},
doContent: function(contentType, isContentPreferred, request, contentHandler)
{
return false;
},
isPreferred: function(contentType, desiredContentType)
{
return false;
},
canHandleContent: function(contentType, isContentPreferred, desiredContentType)
{
return false;
},
loadCookie: null,
parentContentListener: null
})
]]>
</field>
<method name="makeEditable">
<parameter name="editortype"/>
<parameter name="waitForUrlLoad"/>
@ -34,6 +68,10 @@
<![CDATA[
this.editingSession.makeWindowEditable(this.contentWindow, editortype, waitForUrlLoad);
this.setAttribute("editortype", editortype);
this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIURIContentListener)
.parentContentListener = this._editorContentListener;
]]>
</body>
</method>