Remove the parentURIContentListener attribute on docshell; people not using

nsIWebBrowser can getInterface the docshells nsIURIContentListener and set its
parent.  Bug 283108, r=biesi, sr=darin
This commit is contained in:
bzbarsky%mit.edu 2005-02-22 19:56:11 +00:00
parent 43a1e1eb0a
commit d029903af6
7 changed files with 36 additions and 32 deletions

View File

@ -3442,9 +3442,14 @@ nsBrowserContentListener.prototype =
// hook up the whole parent chain thing
var windowDocShell = this.convertWindowToDocShell(toplevelWindow);
if (windowDocShell)
windowDocshell.parentURIContentListener = this;
if (windowDocShell) {
// XXXbz this listener is never unregistered. Did someone neglect
// to read the interface they're using?
windowDocshell
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIURIContentListener)
.parentContentListener = this;
}
var registerWindow = false;
try {
var treeItem = contentWindow.docShell.QueryInterface(Components.interfaces.nsIDocShellTreeItem);

View File

@ -1315,20 +1315,6 @@ nsDocShell::GetChromeEventHandler(nsIChromeEventHandler ** aChromeEventHandler)
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetParentURIContentListener(nsIURIContentListener ** aParent)
{
NS_PRECONDITION(aParent, "Null out param?");
return mContentListener->GetParentContentListener(aParent);
}
NS_IMETHODIMP
nsDocShell::SetParentURIContentListener(nsIURIContentListener * aParent)
{
return mContentListener->SetParentContentListener(aParent);
}
/* [noscript] void setCurrentURI (in nsIURI uri); */
NS_IMETHODIMP
nsDocShell::SetCurrentURI(nsIURI *aURI)
@ -1792,7 +1778,7 @@ nsDocShell::SetDocLoaderParent(nsDocLoader * aParent)
nsCOMPtr<nsIURIContentListener> parentURIListener(do_GetInterface(parent));
if (parentURIListener)
SetParentURIContentListener(parentURIListener);
mContentListener->SetParentContentListener(parentURIListener);
return NS_OK;
}

View File

@ -65,7 +65,7 @@ interface nsIRequest;
interface nsISHEntry;
interface nsILayoutHistoryState;
[scriptable, uuid(69E5DE00-7B8B-11d3-AF61-00A024FFC08C)]
[scriptable, uuid(BBFDF99E-D675-42FD-B3EA-EA341C2331A6)]
interface nsIDocShell : nsISupports
{
/**
@ -206,12 +206,6 @@ interface nsIDocShell : nsISupports
*/
attribute nsIChromeEventHandler chromeEventHandler;
/**
* URI content listener parent. This is not refcounted and is assumed to be
* nulled out by the parent when the parent is going away.
*/
attribute nsIURIContentListener parentURIContentListener;
/**
* The document charset info. This is used by a load to determine priorities
* for charset detection etc.

View File

@ -162,7 +162,10 @@ nsEditingSession::MakeWindowEditable(nsIDOMWindow *aWindow,
// register as a content listener, so that we can fend off URL
// loads from sidebar
rv = docShell->SetParentURIContentListener(this);
nsCOMPtr<nsIURIContentListener> listener = do_GetInterface(docShell, &rv);
if (NS_FAILED(rv)) return rv;
rv = listener->SetParentContentListener(this);
if (NS_FAILED(rv)) return rv;
// Disable JavaScript in this document:

View File

@ -140,7 +140,12 @@ function init() {
helpGlossaryPanel = document.getElementById("help-glossary-panel");
helpBrowser = document.getElementById("help-content");
helpExternal = document.getElementById("help-external");
helpExternal.docShell.parentURIContentListener = helpContentListener;
// XXXbz this is never unset. That should be fixed. See the IDL.
helpExternal
.docShell
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIURIContentListener)
.parentContentListener = helpContentListener;
// Get the help content pack, base URL, and help topic
var helpTopic = defaultTopic;

View File

@ -167,10 +167,12 @@ NS_IMETHODIMP nsMsgWindow::CloseWindow()
StopUrls();
nsCOMPtr<nsIDocShell> rootShell(do_QueryReferent(mRootDocShellWeak));
if(rootShell)
{
rootShell->SetParentURIContentListener(nsnull);
nsCOMPtr<nsIURIContentListener> listener(do_GetInterface(rootShell));
if (listener) {
listener->SetParentContentListener(nsnull);
}
mRootDocShellWeak = nsnull;
mMessageWindowDocShellWeak = nsnull;
}
@ -284,7 +286,10 @@ NS_IMETHODIMP nsMsgWindow::SetRootDocShell(nsIDocShell * aDocShell)
if (aDocShell)
{
mRootDocShellWeak = do_GetWeakReference(aDocShell);
aDocShell->SetParentURIContentListener(this);
nsCOMPtr<nsIURIContentListener> listener(do_GetInterface(aDocShell));
if (listener) {
listener->SetParentContentListener(this);
}
// be sure to set the application flag on the root docshell
// so it knows we are a mail application.
aDocShell->SetAppType(nsIDocShell::APP_TYPE_MAIL);

View File

@ -59,8 +59,14 @@ nsBrowserContentListener.prototype =
// hook up the whole parent chain thing
var windowDocShell = this.convertWindowToDocShell(toplevelWindow);
if (windowDocShell)
windowDocshell.parentURIContentListener = this;
if (windowDocShell) {
// XXXbz this listener is never unregistered. Did someone neglect
// to read the interface they're using?
windowDocshell
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIURIContentListener)
.parentContentListener = this;
}
var registerWindow = false;
try {