Bug 901106 - Stop implementing nsIScriptGlobalObjectOwner in nsXULPrototypeDocument. r=smaug

This commit is contained in:
Bobby Holley 2013-08-19 16:24:27 -07:00
Родитель 2aa5ae896c
Коммит 79d09d7777
3 изменённых файлов: 9 добавлений и 29 удалений

Просмотреть файл

@ -65,7 +65,6 @@
#include "nsIObjectOutputStream.h" #include "nsIObjectOutputStream.h"
#include "nsContentList.h" #include "nsContentList.h"
#include "nsIScriptGlobalObject.h" #include "nsIScriptGlobalObject.h"
#include "nsIScriptGlobalObjectOwner.h"
#include "nsIScriptRuntime.h" #include "nsIScriptRuntime.h"
#include "nsIScriptSecurityManager.h" #include "nsIScriptSecurityManager.h"
#include "nsNodeInfoManager.h" #include "nsNodeInfoManager.h"

Просмотреть файл

@ -179,9 +179,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsXULPrototypeDocument)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXULPrototypeDocument) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXULPrototypeDocument)
NS_INTERFACE_MAP_ENTRY(nsIScriptGlobalObjectOwner)
NS_INTERFACE_MAP_ENTRY(nsISerializable) NS_INTERFACE_MAP_ENTRY(nsISerializable)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIScriptGlobalObjectOwner) NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsXULPrototypeDocument) NS_IMPL_CYCLE_COLLECTING_ADDREF(nsXULPrototypeDocument)
@ -208,8 +207,7 @@ NS_NewXULPrototypeDocument(nsXULPrototypeDocument** aResult)
// Helper method that shares a system global among all prototype documents // Helper method that shares a system global among all prototype documents
// that have the system principal as their security principal. Called by // that have the system principal as their security principal. Called by
// nsXULPrototypeDocument::Read and // nsXULPrototypeDocument::Read and nsXULPrototypeDocument::GetCompilationGlobal.
// nsXULPrototypeDocument::GetScriptGlobalObject.
// This method greatly reduces the number of nsXULPDGlobalObjects and their // This method greatly reduces the number of nsXULPDGlobalObjects and their
// nsIScriptContexts in apps that load many XUL documents via chrome: URLs. // nsIScriptContexts in apps that load many XUL documents via chrome: URLs.
@ -629,8 +627,11 @@ nsXULPrototypeDocument::SetDocumentPrincipal(nsIPrincipal* aPrincipal)
JSObject* JSObject*
nsXULPrototypeDocument::GetCompilationGlobal() nsXULPrototypeDocument::GetCompilationGlobal()
{ {
GetScriptGlobalObject()->EnsureScriptEnvironment(); if (!mGlobalObject) {
return GetScriptGlobalObject()->GetGlobalJSObject(); mGlobalObject = NewXULPDGlobalObject();
}
mGlobalObject->EnsureScriptEnvironment();
return mGlobalObject->GetGlobalJSObject();
} }
nsNodeInfoManager* nsNodeInfoManager*
@ -694,20 +695,6 @@ nsXULPrototypeDocument::TraceProtos(JSTracer* aTrc, uint32_t aGCNumber)
} }
} }
//----------------------------------------------------------------------
//
// nsIScriptGlobalObjectOwner methods
//
nsIScriptGlobalObject*
nsXULPrototypeDocument::GetScriptGlobalObject()
{
if (!mGlobalObject)
mGlobalObject = NewXULPDGlobalObject();
return mGlobalObject;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// //
// nsXULPDGlobalObject // nsXULPDGlobalObject

Просмотреть файл

@ -11,7 +11,6 @@
#include "nsCOMArray.h" #include "nsCOMArray.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsTArray.h" #include "nsTArray.h"
#include "nsIScriptGlobalObjectOwner.h"
#include "nsISerializable.h" #include "nsISerializable.h"
#include "nsCycleCollectionParticipant.h" #include "nsCycleCollectionParticipant.h"
@ -37,8 +36,7 @@ class XULDocument;
* objects, from which the real DOM tree is built later in * objects, from which the real DOM tree is built later in
* XULDocument::ResumeWalk. * XULDocument::ResumeWalk.
*/ */
class nsXULPrototypeDocument : public nsIScriptGlobalObjectOwner, class nsXULPrototypeDocument : public nsISerializable
public nsISerializable
{ {
public: public:
static nsresult static nsresult
@ -116,16 +114,12 @@ public:
JSObject* GetCompilationGlobal(); JSObject* GetCompilationGlobal();
// nsIScriptGlobalObjectOwner methods
virtual nsIScriptGlobalObject* GetScriptGlobalObject() MOZ_OVERRIDE;
void MarkInCCGeneration(uint32_t aCCGeneration) void MarkInCCGeneration(uint32_t aCCGeneration)
{ {
mCCGeneration = aCCGeneration; mCCGeneration = aCCGeneration;
} }
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXULPrototypeDocument, NS_DECL_CYCLE_COLLECTION_CLASS(nsXULPrototypeDocument)
nsIScriptGlobalObjectOwner)
void TraceProtos(JSTracer* aTrc, uint32_t aGCNumber); void TraceProtos(JSTracer* aTrc, uint32_t aGCNumber);