diff --git a/mozilla/content/base/src/nsLayoutStylesheetCache.cpp b/mozilla/content/base/src/nsLayoutStylesheetCache.cpp index 4614551f6cc..9d3525aeeb5 100644 --- a/mozilla/content/base/src/nsLayoutStylesheetCache.cpp +++ b/mozilla/content/base/src/nsLayoutStylesheetCache.cpp @@ -44,7 +44,6 @@ #include "nsNetUtil.h" #include "nsIObserverService.h" #include "nsIServiceManagerUtils.h" -#include "nsIProfileChangeStatus.h" NS_IMPL_ISUPPORTS1(nsLayoutStylesheetCache, nsIObserver) diff --git a/mozilla/content/html/style/src/nsCSSLoader.cpp b/mozilla/content/html/style/src/nsCSSLoader.cpp index c72d3d75deb..626b6631e3d 100644 --- a/mozilla/content/html/style/src/nsCSSLoader.cpp +++ b/mozilla/content/html/style/src/nsCSSLoader.cpp @@ -251,6 +251,7 @@ void CSSLoaderImpl::Shutdown() { delete gParsers; + gParsers = nsnull; } NS_IMETHODIMP diff --git a/mozilla/dom/src/base/nsDOMClassInfo.cpp b/mozilla/dom/src/base/nsDOMClassInfo.cpp index 5599bdfe591..7dc6bfe033c 100644 --- a/mozilla/dom/src/base/nsDOMClassInfo.cpp +++ b/mozilla/dom/src/base/nsDOMClassInfo.cpp @@ -1280,10 +1280,6 @@ nsDOMClassInfo::RegisterExternalClasses() #define _DOM_CLASSINFO_MAP_BEGIN(_class, _ifptr, _has_class_if) \ { \ nsDOMClassInfoData &d = sClassInfoData[eDOMClassInfo_##_class##_id]; \ - NS_ASSERTION(!d.mProtoChainInterface, "Redeclaration of DOM classinfo " \ - "proto chain interface!"); \ - NS_ASSERTION(!d.mInterfaces, "Redeclaration of DOM classinfo " \ - "interface list!"); \ d.mProtoChainInterface = _ifptr; \ d.mHasClassInterface = _has_class_if; \ static const nsIID *interface_list[] = { @@ -2963,6 +2959,7 @@ nsDOMClassInfo::ShutDown() NS_IF_RELEASE(sXPConnect); NS_IF_RELEASE(sSecMan); + sIsInitialized = PR_FALSE; } diff --git a/mozilla/dom/src/base/nsJSEnvironment.cpp b/mozilla/dom/src/base/nsJSEnvironment.cpp index f2651f708d7..5cb7953a6c6 100644 --- a/mozilla/dom/src/base/nsJSEnvironment.cpp +++ b/mozilla/dom/src/base/nsJSEnvironment.cpp @@ -111,6 +111,8 @@ static PRLogModuleInfo* gJSDiagnostics; #define NS_GC_DELAY 2000 // ms #define NS_FIRST_GC_DELAY 10000 // ms +// if you add statics here, add them to the list in nsJSEnvironment::Startup + static nsITimer *sGCTimer; static PRBool sReadyForGC; @@ -126,6 +128,7 @@ static PRThread *gDOMThread; static JSGCCallback gOldJSGCCallback; +static PRBool sIsInitialized; static PRBool sDidShutdown; static PRInt32 sContextCount; @@ -1915,13 +1918,30 @@ DOMGCCallback(JSContext *cx, JSGCStatus status) return gOldJSGCCallback ? gOldJSGCCallback(cx, status) : JS_TRUE; } +//static +void +nsJSEnvironment::Startup() +{ + // initialize all our statics, so that we can restart XPCOM + sGCTimer = nsnull; + sReadyForGC = PR_FALSE; + gNameSpaceManager = nsnull; + sRuntimeService = nsnull; + sRuntime = nsnull; + gDOMThread = nsnull; + gOldJSGCCallback = nsnull; + sIsInitialized = PR_FALSE; + sDidShutdown = PR_FALSE; + sContextCount = 0; + sSecurityManager = nsnull; + gCollation = nsnull; +} + // static nsresult nsJSEnvironment::Init() { - static PRBool isInitialized; - - if (isInitialized) { + if (sIsInitialized) { return NS_OK; } @@ -1991,7 +2011,7 @@ nsJSEnvironment::Init() rv = CallGetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &sSecurityManager); - isInitialized = NS_SUCCEEDED(rv); + sIsInitialized = NS_SUCCEEDED(rv); return rv; } diff --git a/mozilla/dom/src/base/nsJSEnvironment.h b/mozilla/dom/src/base/nsJSEnvironment.h index d8675bf248b..4b33bcfefb9 100644 --- a/mozilla/dom/src/base/nsJSEnvironment.h +++ b/mozilla/dom/src/base/nsJSEnvironment.h @@ -179,6 +179,9 @@ private: static JSRuntime *sRuntime; public: + // called from the module Ctor to initialize statics + static void Startup(); + static nsresult Init(); static nsJSEnvironment *GetScriptingEnvironment(); diff --git a/mozilla/layout/build/nsLayoutModule.cpp b/mozilla/layout/build/nsLayoutModule.cpp index ce5e0e1a8ae..82a1bdab247 100644 --- a/mozilla/layout/build/nsLayoutModule.cpp +++ b/mozilla/layout/build/nsLayoutModule.cpp @@ -100,6 +100,7 @@ #include "nsIXBLService.h" #include "nsIFrameLoader.h" #include "nsICaret.h" +#include "nsJSEnvironment.h" #include "nsLayoutAtoms.h" #include "nsPlainTextSerializer.h" #include "mozSanitizingSerializer.h" @@ -255,7 +256,8 @@ Initialize(nsIModule* aSelf) } gInitialized = PR_TRUE; - + + nsJSEnvironment::Startup(); nsresult rv = nsContentUtils::Init(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsContentUtils"); diff --git a/mozilla/layout/style/nsCSSLoader.cpp b/mozilla/layout/style/nsCSSLoader.cpp index c72d3d75deb..626b6631e3d 100644 --- a/mozilla/layout/style/nsCSSLoader.cpp +++ b/mozilla/layout/style/nsCSSLoader.cpp @@ -251,6 +251,7 @@ void CSSLoaderImpl::Shutdown() { delete gParsers; + gParsers = nsnull; } NS_IMETHODIMP diff --git a/mozilla/layout/style/nsLayoutStylesheetCache.cpp b/mozilla/layout/style/nsLayoutStylesheetCache.cpp index 4614551f6cc..9d3525aeeb5 100644 --- a/mozilla/layout/style/nsLayoutStylesheetCache.cpp +++ b/mozilla/layout/style/nsLayoutStylesheetCache.cpp @@ -44,7 +44,6 @@ #include "nsNetUtil.h" #include "nsIObserverService.h" #include "nsIServiceManagerUtils.h" -#include "nsIProfileChangeStatus.h" NS_IMPL_ISUPPORTS1(nsLayoutStylesheetCache, nsIObserver) diff --git a/mozilla/modules/libpr0n/decoders/gif/GIF2.cpp b/mozilla/modules/libpr0n/decoders/gif/GIF2.cpp index 05af75ded25..a5ac07ceb2e 100644 --- a/mozilla/modules/libpr0n/decoders/gif/GIF2.cpp +++ b/mozilla/modules/libpr0n/decoders/gif/GIF2.cpp @@ -100,6 +100,7 @@ void nsGifShutdown() { // Release cached buffers from zlib allocator delete gGifAllocator; + gGifAllocator = nsnull; } #define MAX_HOLD 768 /* for now must be big enough for a cmap */ diff --git a/mozilla/widget/src/gtk/nsWindow.cpp b/mozilla/widget/src/gtk/nsWindow.cpp index e469d9de524..a56b1d8e61f 100644 --- a/mozilla/widget/src/gtk/nsWindow.cpp +++ b/mozilla/widget/src/gtk/nsWindow.cpp @@ -393,6 +393,7 @@ nsWindow::ReleaseGlobals() gsGtkCursorCache[i] = nsnull; } } + gGlobalsInitialized = PR_FALSE; } NS_IMETHODIMP nsWindow::Destroy(void)