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 "nsContentList.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptGlobalObjectOwner.h"
#include "nsIScriptRuntime.h"
#include "nsIScriptSecurityManager.h"
#include "nsNodeInfoManager.h"

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

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

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

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