Bug 116347: Remove dead skin switching support code from nsFrameFrame and navigator.js. r=bryner, sr=hewitt

This commit is contained in:
jaggernaut%netscape.com 2001-12-21 05:36:28 +00:00
parent 0fc2bb23f2
commit def49c7eb7
3 changed files with 164 additions and 379 deletions

View File

@ -96,18 +96,6 @@
#endif
#include "nsIServiceManager.h"
#ifdef INCLUDE_XUL
#include "nsIDOMXULElement.h"
#include "nsIBoxObject.h"
#include "nsIBrowserBoxObject.h"
#include "nsISHistory.h"
#include "nsIWebProgress.h"
#include "nsIWebProgressListener.h"
#include "nsISecureBrowserUI.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDOMDocument.h"
#endif
class nsHTMLFrame;
static NS_DEFINE_IID(kIFramesetFrameIID, NS_IFRAMESETFRAME_IID);
@ -658,29 +646,6 @@ nsHTMLFrameInnerFrame::~nsHTMLFrameInnerFrame()
{
//printf("nsHTMLFrameInnerFrame destructor %X \n", this);
#ifdef INCLUDE_XUL
nsCOMPtr<nsIDOMXULElement> xulElt(do_QueryInterface(mContent));
if (xulElt && mSubShell) {
// We might be a XUL browser and may need to store the current URL in our box object.
nsCOMPtr<nsIBoxObject> boxObject;
xulElt->GetBoxObject(getter_AddRefs(boxObject));
if (boxObject) {
nsCOMPtr<nsIBrowserBoxObject> browser(do_QueryInterface(boxObject));
if (browser) {
nsCOMPtr<nsIWebNavigation> webShell(do_QueryInterface(mSubShell));
nsCOMPtr<nsISHistory> hist;
webShell->GetSessionHistory(getter_AddRefs(hist));
if (hist)
boxObject->SetPropertyAsSupports(NS_LITERAL_STRING("history").get(), hist);
nsCOMPtr<nsISupports> supports;
boxObject->GetPropertyAsSupports(NS_LITERAL_STRING("listenerkungfu").get(), getter_AddRefs(supports));
if (supports)
boxObject->SetPropertyAsSupports(NS_LITERAL_STRING("listener").get(), supports);
}
}
}
#endif
nsCOMPtr<nsIDOMWindow> win(do_GetInterface(mSubShell));
nsCOMPtr<nsIDOMEventTarget> eventTarget(do_QueryInterface(win));
nsCOMPtr<nsIDOMEventListener> eventListener(do_QueryInterface(mContent));
@ -1152,71 +1117,6 @@ nsHTMLFrameInnerFrame::CreateDocShell(nsIPresContext* aPresContext)
return NS_OK;
}
static PRBool CheckForBrowser(nsIContent* aContent, nsIBaseWindow* aShell)
{
PRBool didReload = PR_FALSE;
#ifdef INCLUDE_XUL
// XXXjag see bug 68662
nsCOMPtr<nsIDOMXULElement> xulElt(do_QueryInterface(aContent));
if (xulElt) {
// We might be a XUL browser and may have stored state in our box object.
nsCOMPtr<nsIBoxObject> boxObject;
xulElt->GetBoxObject(getter_AddRefs(boxObject));
if (boxObject) {
nsCOMPtr<nsIBrowserBoxObject> browser(do_QueryInterface(boxObject));
if (browser) {
nsCOMPtr<nsISupports> supp;
/* reregister the progress listener */
boxObject->GetPropertyAsSupports(NS_LITERAL_STRING("listener").get(), getter_AddRefs(supp));
if (supp) {
nsCOMPtr<nsIWebProgressListener> listener(do_QueryInterface(supp));
if (listener) {
nsCOMPtr<nsIDocShell> docShell;
browser->GetDocShell(getter_AddRefs(docShell));
nsCOMPtr<nsIWebProgress> webProgress(do_GetInterface(docShell));
webProgress->AddProgressListener(listener);
boxObject->RemoveProperty(NS_LITERAL_STRING("listener").get());
}
}
/* reinitialize the security module */
boxObject->GetPropertyAsSupports(NS_LITERAL_STRING("xulwindow").get(), getter_AddRefs(supp));
nsCOMPtr<nsIDOMWindowInternal> domWindow(do_QueryInterface(supp));
boxObject->GetPropertyAsSupports(NS_LITERAL_STRING("secureBrowserUI").get(), getter_AddRefs(supp));
nsCOMPtr<nsISecureBrowserUI> secureBrowserUI(do_QueryInterface(supp));
if (domWindow && secureBrowserUI) {
nsCOMPtr<nsIDOMWindow> contentWindow;
domWindow->GetContent(getter_AddRefs(contentWindow));
nsCOMPtr<nsIDOMDocument> doc;
domWindow->GetDocument(getter_AddRefs(doc));
if (contentWindow && doc) {
nsCOMPtr<nsIDOMElement> button;
doc->GetElementById(NS_LITERAL_STRING("security-button"), getter_AddRefs(button));
if (button)
secureBrowserUI->Init(contentWindow, button);
}
}
/* set session history on the new docshell */
boxObject->GetPropertyAsSupports(NS_LITERAL_STRING("history").get(), getter_AddRefs(supp));
if (supp) {
nsCOMPtr<nsISHistory> hist(do_QueryInterface(supp));
if (hist) {
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(aShell));
webNav->SetSessionHistory(hist);
nsCOMPtr<nsIWebNavigation> histNav(do_QueryInterface(hist));
histNav->Reload(0);
didReload = PR_TRUE;
boxObject->RemoveProperty(NS_LITERAL_STRING("history").get());
}
}
}
}
}
#endif
return didReload;
}
nsresult
nsHTMLFrameInnerFrame::DoLoadURL(nsIPresContext* aPresContext)
{
@ -1232,9 +1132,6 @@ nsHTMLFrameInnerFrame::DoLoadURL(nsIPresContext* aPresContext)
nsresult rv = GetParentContent(*getter_AddRefs(parentContent));
NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && parentContent, rv);
PRBool load = !CheckForBrowser(parentContent, mSubShell);
if (load) {
nsAutoString url;
GetURL(parentContent, url);
url.Trim(" \t\n\r");
@ -1319,7 +1216,6 @@ nsHTMLFrameInnerFrame::DoLoadURL(nsIPresContext* aPresContext)
rv = docShell->LoadURI(uri, loadInfo, nsIWebNavigation::LOAD_FLAGS_NONE);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to load URL");
}
return rv;
}

View File

@ -96,18 +96,6 @@
#endif
#include "nsIServiceManager.h"
#ifdef INCLUDE_XUL
#include "nsIDOMXULElement.h"
#include "nsIBoxObject.h"
#include "nsIBrowserBoxObject.h"
#include "nsISHistory.h"
#include "nsIWebProgress.h"
#include "nsIWebProgressListener.h"
#include "nsISecureBrowserUI.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDOMDocument.h"
#endif
class nsHTMLFrame;
static NS_DEFINE_IID(kIFramesetFrameIID, NS_IFRAMESETFRAME_IID);
@ -658,29 +646,6 @@ nsHTMLFrameInnerFrame::~nsHTMLFrameInnerFrame()
{
//printf("nsHTMLFrameInnerFrame destructor %X \n", this);
#ifdef INCLUDE_XUL
nsCOMPtr<nsIDOMXULElement> xulElt(do_QueryInterface(mContent));
if (xulElt && mSubShell) {
// We might be a XUL browser and may need to store the current URL in our box object.
nsCOMPtr<nsIBoxObject> boxObject;
xulElt->GetBoxObject(getter_AddRefs(boxObject));
if (boxObject) {
nsCOMPtr<nsIBrowserBoxObject> browser(do_QueryInterface(boxObject));
if (browser) {
nsCOMPtr<nsIWebNavigation> webShell(do_QueryInterface(mSubShell));
nsCOMPtr<nsISHistory> hist;
webShell->GetSessionHistory(getter_AddRefs(hist));
if (hist)
boxObject->SetPropertyAsSupports(NS_LITERAL_STRING("history").get(), hist);
nsCOMPtr<nsISupports> supports;
boxObject->GetPropertyAsSupports(NS_LITERAL_STRING("listenerkungfu").get(), getter_AddRefs(supports));
if (supports)
boxObject->SetPropertyAsSupports(NS_LITERAL_STRING("listener").get(), supports);
}
}
}
#endif
nsCOMPtr<nsIDOMWindow> win(do_GetInterface(mSubShell));
nsCOMPtr<nsIDOMEventTarget> eventTarget(do_QueryInterface(win));
nsCOMPtr<nsIDOMEventListener> eventListener(do_QueryInterface(mContent));
@ -1152,71 +1117,6 @@ nsHTMLFrameInnerFrame::CreateDocShell(nsIPresContext* aPresContext)
return NS_OK;
}
static PRBool CheckForBrowser(nsIContent* aContent, nsIBaseWindow* aShell)
{
PRBool didReload = PR_FALSE;
#ifdef INCLUDE_XUL
// XXXjag see bug 68662
nsCOMPtr<nsIDOMXULElement> xulElt(do_QueryInterface(aContent));
if (xulElt) {
// We might be a XUL browser and may have stored state in our box object.
nsCOMPtr<nsIBoxObject> boxObject;
xulElt->GetBoxObject(getter_AddRefs(boxObject));
if (boxObject) {
nsCOMPtr<nsIBrowserBoxObject> browser(do_QueryInterface(boxObject));
if (browser) {
nsCOMPtr<nsISupports> supp;
/* reregister the progress listener */
boxObject->GetPropertyAsSupports(NS_LITERAL_STRING("listener").get(), getter_AddRefs(supp));
if (supp) {
nsCOMPtr<nsIWebProgressListener> listener(do_QueryInterface(supp));
if (listener) {
nsCOMPtr<nsIDocShell> docShell;
browser->GetDocShell(getter_AddRefs(docShell));
nsCOMPtr<nsIWebProgress> webProgress(do_GetInterface(docShell));
webProgress->AddProgressListener(listener);
boxObject->RemoveProperty(NS_LITERAL_STRING("listener").get());
}
}
/* reinitialize the security module */
boxObject->GetPropertyAsSupports(NS_LITERAL_STRING("xulwindow").get(), getter_AddRefs(supp));
nsCOMPtr<nsIDOMWindowInternal> domWindow(do_QueryInterface(supp));
boxObject->GetPropertyAsSupports(NS_LITERAL_STRING("secureBrowserUI").get(), getter_AddRefs(supp));
nsCOMPtr<nsISecureBrowserUI> secureBrowserUI(do_QueryInterface(supp));
if (domWindow && secureBrowserUI) {
nsCOMPtr<nsIDOMWindow> contentWindow;
domWindow->GetContent(getter_AddRefs(contentWindow));
nsCOMPtr<nsIDOMDocument> doc;
domWindow->GetDocument(getter_AddRefs(doc));
if (contentWindow && doc) {
nsCOMPtr<nsIDOMElement> button;
doc->GetElementById(NS_LITERAL_STRING("security-button"), getter_AddRefs(button));
if (button)
secureBrowserUI->Init(contentWindow, button);
}
}
/* set session history on the new docshell */
boxObject->GetPropertyAsSupports(NS_LITERAL_STRING("history").get(), getter_AddRefs(supp));
if (supp) {
nsCOMPtr<nsISHistory> hist(do_QueryInterface(supp));
if (hist) {
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(aShell));
webNav->SetSessionHistory(hist);
nsCOMPtr<nsIWebNavigation> histNav(do_QueryInterface(hist));
histNav->Reload(0);
didReload = PR_TRUE;
boxObject->RemoveProperty(NS_LITERAL_STRING("history").get());
}
}
}
}
}
#endif
return didReload;
}
nsresult
nsHTMLFrameInnerFrame::DoLoadURL(nsIPresContext* aPresContext)
{
@ -1232,9 +1132,6 @@ nsHTMLFrameInnerFrame::DoLoadURL(nsIPresContext* aPresContext)
nsresult rv = GetParentContent(*getter_AddRefs(parentContent));
NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && parentContent, rv);
PRBool load = !CheckForBrowser(parentContent, mSubShell);
if (load) {
nsAutoString url;
GetURL(parentContent, url);
url.Trim(" \t\n\r");
@ -1319,7 +1216,6 @@ nsHTMLFrameInnerFrame::DoLoadURL(nsIPresContext* aPresContext)
rv = docShell->LoadURI(uri, loadInfo, nsIWebNavigation::LOAD_FLAGS_NONE);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to load URL");
}
return rv;
}

View File

@ -368,9 +368,6 @@ function Startup()
// hook up UI through progress listener
getBrowser().addProgressListener(window.XULBrowserWindow);
// XXXjag see bug 68662 (needed to hook up web progress listener)
getBrowser().boxObject.setPropertyAsSupports("listenerkungfu", window.XULBrowserWindow);
// load appropriate initial page from commandline
var isPageCycling = false;
@ -482,10 +479,6 @@ function Shutdown()
remoteService.removeBrowserInstance(window);
}
var browser = getBrowser();
browser.boxObject.removeProperty("listenerkungfu");
try {
getBrowser().removeProgressListener(window.XULBrowserWindow);
} catch (ex) {