From 79d09d7777f2e45049df3f52428b9a1aac660f6c Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Mon, 19 Aug 2013 16:24:27 -0700 Subject: [PATCH] Bug 901106 - Stop implementing nsIScriptGlobalObjectOwner in nsXULPrototypeDocument. r=smaug --- content/xul/document/src/XULDocument.cpp | 1 - .../document/src/nsXULPrototypeDocument.cpp | 27 +++++-------------- .../xul/document/src/nsXULPrototypeDocument.h | 10 ++----- 3 files changed, 9 insertions(+), 29 deletions(-) diff --git a/content/xul/document/src/XULDocument.cpp b/content/xul/document/src/XULDocument.cpp index a8c25a55ff02..76ac268b8383 100644 --- a/content/xul/document/src/XULDocument.cpp +++ b/content/xul/document/src/XULDocument.cpp @@ -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" diff --git a/content/xul/document/src/nsXULPrototypeDocument.cpp b/content/xul/document/src/nsXULPrototypeDocument.cpp index ec95fdc9b7a1..b3211d75d5d9 100644 --- a/content/xul/document/src/nsXULPrototypeDocument.cpp +++ b/content/xul/document/src/nsXULPrototypeDocument.cpp @@ -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 diff --git a/content/xul/document/src/nsXULPrototypeDocument.h b/content/xul/document/src/nsXULPrototypeDocument.h index 912f4827849d..4b873e85f94e 100644 --- a/content/xul/document/src/nsXULPrototypeDocument.h +++ b/content/xul/document/src/nsXULPrototypeDocument.h @@ -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);