From f6f0263fa5fddf9b320a765c2adb35b5deca9ba7 Mon Sep 17 00:00:00 2001 From: "michaelp%netscape.com" Date: Wed, 5 Aug 1998 04:23:21 +0000 Subject: [PATCH] changes for plugins. git-svn-id: svn://10.0.0.236/trunk@7328 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsWebShell.cpp | 10 +++++++--- mozilla/uriloader/base/nsDocLoader.cpp | 2 +- mozilla/webshell/public/nsIBrowserWindow.h | 3 ++- mozilla/webshell/public/nsIWebShell.h | 3 ++- mozilla/webshell/src/nsDocLoader.cpp | 2 +- mozilla/webshell/src/nsWebShell.cpp | 10 +++++++--- mozilla/webshell/tests/viewer/nsBrowserWindow.cpp | 6 ++++-- mozilla/webshell/tests/viewer/nsBrowserWindow.h | 3 ++- mozilla/webshell/tests/viewer/nsViewerApp.cpp | 9 +++++++-- mozilla/webshell/tests/viewer/nsViewerApp.h | 1 + 10 files changed, 34 insertions(+), 15 deletions(-) diff --git a/mozilla/docshell/base/nsWebShell.cpp b/mozilla/docshell/base/nsWebShell.cpp index 6cc5ba9c542..65a28c34b9a 100644 --- a/mozilla/docshell/base/nsWebShell.cpp +++ b/mozilla/docshell/base/nsWebShell.cpp @@ -95,7 +95,8 @@ public: // nsIWebShell NS_IMETHOD Init(nsNativeWidget aNativeParent, const nsRect& aBounds, - nsScrollPreference aScrolling = nsScrollPreference_kAuto); + nsScrollPreference aScrolling = nsScrollPreference_kAuto, + PRBool aAllowPlugins = PR_TRUE); NS_IMETHOD Destroy(void); NS_IMETHOD GetBounds(nsRect& aResult); NS_IMETHOD SetBounds(const nsRect& aBounds); @@ -399,12 +400,15 @@ nsWebShell::Embed(nsIContentViewer* aContentViewer, NS_IMETHODIMP nsWebShell::Init(nsNativeWidget aNativeParent, const nsRect& aBounds, - nsScrollPreference aScrolling) + nsScrollPreference aScrolling, + PRBool aAllowPlugins) { //XXX make sure plugins have started up. this really needs to //be associated with the nsIContentViewerContainer interfaces, //not the nsIWebShell interfaces. this is a hack. MMP - CreatePluginHost(); + + if (PR_TRUE == aAllowPlugins) + CreatePluginHost(); mScrollPref = aScrolling; diff --git a/mozilla/uriloader/base/nsDocLoader.cpp b/mozilla/uriloader/base/nsDocLoader.cpp index 9fc21151f16..25b8d8de283 100644 --- a/mozilla/uriloader/base/nsDocLoader.cpp +++ b/mozilla/uriloader/base/nsDocLoader.cpp @@ -311,7 +311,7 @@ nsresult nsDocFactoryImpl::InitUAStyleSheet() if (nsnull == gUAStyleSheet) { // snarf one nsIURL* uaURL; - rv = NS_NewURL(&uaURL, nsnull, UA_CSS_URL); // XXX this bites, fix it + rv = NS_NewURL(&uaURL, nsnull, nsString(UA_CSS_URL)); // XXX this bites, fix it if (NS_OK == rv) { // Get an input stream from the url PRInt32 ec; diff --git a/mozilla/webshell/public/nsIBrowserWindow.h b/mozilla/webshell/public/nsIBrowserWindow.h index ab5aa82f135..fac699a8c59 100644 --- a/mozilla/webshell/public/nsIBrowserWindow.h +++ b/mozilla/webshell/public/nsIBrowserWindow.h @@ -52,7 +52,8 @@ public: NS_IMETHOD Init(nsIAppShell* aAppShell, nsIPref* aPrefs, const nsRect& aBounds, - PRUint32 aChromeMask) = 0; + PRUint32 aChromeMask, + PRBool aAllowPlugins = PR_TRUE) = 0; NS_IMETHOD MoveTo(PRInt32 aX, PRInt32 aY) = 0; diff --git a/mozilla/webshell/public/nsIWebShell.h b/mozilla/webshell/public/nsIWebShell.h index d6b3613e050..465bc0de3e4 100644 --- a/mozilla/webshell/public/nsIWebShell.h +++ b/mozilla/webshell/public/nsIWebShell.h @@ -85,7 +85,8 @@ class nsIWebShell : public nsIContentViewerContainer { public: NS_IMETHOD Init(nsNativeWidget aNativeParent, const nsRect& aBounds, - nsScrollPreference aScrolling = nsScrollPreference_kAuto)=0; + nsScrollPreference aScrolling = nsScrollPreference_kAuto, + PRBool aAllowPlugins = PR_TRUE) = 0; NS_IMETHOD Destroy() = 0; diff --git a/mozilla/webshell/src/nsDocLoader.cpp b/mozilla/webshell/src/nsDocLoader.cpp index 9fc21151f16..25b8d8de283 100644 --- a/mozilla/webshell/src/nsDocLoader.cpp +++ b/mozilla/webshell/src/nsDocLoader.cpp @@ -311,7 +311,7 @@ nsresult nsDocFactoryImpl::InitUAStyleSheet() if (nsnull == gUAStyleSheet) { // snarf one nsIURL* uaURL; - rv = NS_NewURL(&uaURL, nsnull, UA_CSS_URL); // XXX this bites, fix it + rv = NS_NewURL(&uaURL, nsnull, nsString(UA_CSS_URL)); // XXX this bites, fix it if (NS_OK == rv) { // Get an input stream from the url PRInt32 ec; diff --git a/mozilla/webshell/src/nsWebShell.cpp b/mozilla/webshell/src/nsWebShell.cpp index 6cc5ba9c542..65a28c34b9a 100644 --- a/mozilla/webshell/src/nsWebShell.cpp +++ b/mozilla/webshell/src/nsWebShell.cpp @@ -95,7 +95,8 @@ public: // nsIWebShell NS_IMETHOD Init(nsNativeWidget aNativeParent, const nsRect& aBounds, - nsScrollPreference aScrolling = nsScrollPreference_kAuto); + nsScrollPreference aScrolling = nsScrollPreference_kAuto, + PRBool aAllowPlugins = PR_TRUE); NS_IMETHOD Destroy(void); NS_IMETHOD GetBounds(nsRect& aResult); NS_IMETHOD SetBounds(const nsRect& aBounds); @@ -399,12 +400,15 @@ nsWebShell::Embed(nsIContentViewer* aContentViewer, NS_IMETHODIMP nsWebShell::Init(nsNativeWidget aNativeParent, const nsRect& aBounds, - nsScrollPreference aScrolling) + nsScrollPreference aScrolling, + PRBool aAllowPlugins) { //XXX make sure plugins have started up. this really needs to //be associated with the nsIContentViewerContainer interfaces, //not the nsIWebShell interfaces. this is a hack. MMP - CreatePluginHost(); + + if (PR_TRUE == aAllowPlugins) + CreatePluginHost(); mScrollPref = aScrolling; diff --git a/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp b/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp index 3a1fa21f490..dc5b2c228e8 100644 --- a/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp +++ b/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp @@ -504,7 +504,8 @@ nsresult nsBrowserWindow::Init(nsIAppShell* aAppShell, nsIPref* aPrefs, const nsRect& aBounds, - PRUint32 aChromeMask) + PRUint32 aChromeMask, + PRBool aAllowPlugins) { mChromeMask = aChromeMask; @@ -527,7 +528,8 @@ nsBrowserWindow::Init(nsIAppShell* aAppShell, return rv; } r.x = r.y = 0; - rv = mWebShell->Init(mWindow->GetNativeData(NS_NATIVE_WIDGET), r); + rv = mWebShell->Init(mWindow->GetNativeData(NS_NATIVE_WIDGET), r, + nsScrollPreference_kAuto, aAllowPlugins); mWebShell->SetContainer((nsIWebShellContainer*) this); mWebShell->SetObserver((nsIStreamObserver*)this); mWebShell->SetPrefs(aPrefs); diff --git a/mozilla/webshell/tests/viewer/nsBrowserWindow.h b/mozilla/webshell/tests/viewer/nsBrowserWindow.h index 7c3c2db3eb9..a45a456debe 100644 --- a/mozilla/webshell/tests/viewer/nsBrowserWindow.h +++ b/mozilla/webshell/tests/viewer/nsBrowserWindow.h @@ -60,7 +60,8 @@ public: NS_IMETHOD Init(nsIAppShell* aAppShell, nsIPref* aPrefs, const nsRect& aBounds, - PRUint32 aChromeMask); + PRUint32 aChromeMask, + PRBool aAllowPlugins = PR_TRUE); NS_IMETHOD MoveTo(PRInt32 aX, PRInt32 aY); NS_IMETHOD SizeTo(PRInt32 aWidth, PRInt32 aHeight); NS_IMETHOD GetBounds(nsRect& aBounds); diff --git a/mozilla/webshell/tests/viewer/nsViewerApp.cpp b/mozilla/webshell/tests/viewer/nsViewerApp.cpp index df895d3c68e..2989f90afd4 100644 --- a/mozilla/webshell/tests/viewer/nsViewerApp.cpp +++ b/mozilla/webshell/tests/viewer/nsViewerApp.cpp @@ -53,6 +53,7 @@ nsViewerApp::nsViewerApp() mDelay = 1; mRepeatCount = 1; mNumSamples = 10; + mAllowPlugins = PR_TRUE; } nsViewerApp::~nsViewerApp() @@ -164,7 +165,7 @@ nsViewerApp::Exit() static void PrintHelpInfo(char **argv) { - fprintf(stderr, "Usage: %s [-p][-q][-md #][-f filename][-d #] [starting url]\n", argv[0]); + fprintf(stderr, "Usage: %s [-p][-q][-md #][-f filename][-d #][-np] [starting url]\n", argv[0]); fprintf(stderr, "\t-p[#] -- run purify, optionally with a # that says which sample to stop at. For example, -p2 says to run samples 0, 1, and 2.\n"); fprintf(stderr, "\t-q -- run quantify\n"); fprintf(stderr, "\t-md # -- set the crt debug flags to #\n"); @@ -176,6 +177,7 @@ PrintHelpInfo(char **argv) fprintf(stderr, "\t-S domain -- add a domain/host that is safe to crawl (e.g. www.netscape.com)\n"); fprintf(stderr, "\t-A domain -- add a domain/host that should be avoided (e.g. microsoft.com)\n"); fprintf(stderr, "\t-N pages -- set the max # of pages to crawl\n"); + fprintf(stderr, "\t-np -- no plugins\n"); } static void @@ -324,6 +326,9 @@ nsViewerApp::ProcessArguments(int argc, char** argv) } mCrawler->SetMaxPages(pages); } + else if (PL_strcmp(argv[i], "-np") == 0) { + mAllowPlugins = PR_FALSE; + } else { PrintHelpInfo(argv); exit(-1); @@ -347,7 +352,7 @@ nsViewerApp::OpenWindow() kIBrowserWindowIID, (void**) &bw); bw->SetApp(this); - bw->Init(mAppShell, mPrefs, nsRect(0, 0, 620, 400), PRUint32(~0)); + bw->Init(mAppShell, mPrefs, nsRect(0, 0, 620, 400), PRUint32(~0), mAllowPlugins); bw->Show(); mCrawler->SetBrowserWindow(bw); diff --git a/mozilla/webshell/tests/viewer/nsViewerApp.h b/mozilla/webshell/tests/viewer/nsViewerApp.h index 7c302e05314..526b21c4fb3 100644 --- a/mozilla/webshell/tests/viewer/nsViewerApp.h +++ b/mozilla/webshell/tests/viewer/nsViewerApp.h @@ -82,6 +82,7 @@ protected: PRInt32 mDelay; PRInt32 mRepeatCount; nsWebCrawler* mCrawler; + PRBool mAllowPlugins; }; class nsNativeViewerApp : public nsViewerApp {