mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 14:46:02 +00:00
Fix for bug 368369 (nsIScriptContextOwner looks unused). r/sr=jst.
This commit is contained in:
parent
88192d2709
commit
e1a7411a91
@ -637,12 +637,8 @@ nsXULPDGlobalObject::SetScriptContext(PRUint32 lang_id, nsIScriptContext *aScrip
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
nsIScriptContext *existing;
|
||||
existing = mScriptContexts[lang_ndx];
|
||||
NS_ASSERTION(!aScriptContext || !existing, "Bad call to SetContext()!");
|
||||
NS_ASSERTION(!aScriptContext, "Bad call to SetContext()!");
|
||||
|
||||
if (existing)
|
||||
existing->SetOwner(nsnull);
|
||||
void *script_glob = nsnull;
|
||||
|
||||
if (aScriptContext) {
|
||||
|
@ -47,8 +47,7 @@ GRE_MODULE = 1
|
||||
|
||||
DIRS = idl coreEvents base
|
||||
|
||||
XPIDLSRCS = nsIScriptContextOwner.idl \
|
||||
nsIEntropyCollector.idl \
|
||||
XPIDLSRCS = nsIEntropyCollector.idl \
|
||||
nsIScriptChannel.idl \
|
||||
$(NULL)
|
||||
|
||||
|
@ -46,7 +46,6 @@
|
||||
|
||||
class nsIScriptGlobalObject;
|
||||
class nsIScriptSecurityManager;
|
||||
class nsIScriptContextOwner;
|
||||
class nsIPrincipal;
|
||||
class nsIAtom;
|
||||
class nsIArray;
|
||||
@ -361,22 +360,6 @@ public:
|
||||
virtual nsresult Deserialize(nsIObjectInputStream* aStream,
|
||||
nsScriptObjectHolder &aResult) = 0;
|
||||
|
||||
/**
|
||||
* Let the script context know who its owner is.
|
||||
* The script context should not addref the owner. It
|
||||
* will be told when the owner goes away.
|
||||
* @return NS_OK if the method is successful
|
||||
*/
|
||||
virtual void SetOwner(nsIScriptContextOwner* owner) = 0;
|
||||
|
||||
/**
|
||||
* Get the script context of the owner. The method
|
||||
* addrefs the returned reference according to regular
|
||||
* XPCOM rules, even though the internal reference itself
|
||||
* is a "weak" reference.
|
||||
*/
|
||||
virtual nsIScriptContextOwner *GetOwner() = 0;
|
||||
|
||||
/**
|
||||
* JS only - this function need not be implemented by languages other
|
||||
* than JS (ie, this should be moved to a private interface!)
|
||||
|
@ -583,7 +583,6 @@ nsGlobalWindow::CleanUp()
|
||||
|
||||
mOpener = nsnull; // Forces Release
|
||||
if (mContext) {
|
||||
mContext->SetOwner(nsnull);
|
||||
mContext = nsnull; // Forces Release
|
||||
}
|
||||
mChromeEventHandler = nsnull; // Forces Release
|
||||
@ -819,12 +818,8 @@ nsGlobalWindow::SetScriptContext(PRUint32 lang_id, nsIScriptContext *aScriptCont
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
nsIScriptContext *existing;
|
||||
existing = mScriptContexts[lang_ndx];
|
||||
NS_ASSERTION(!aScriptContext || !existing, "Bad call to SetContext()!");
|
||||
NS_ASSERTION(!aScriptContext, "Bad call to SetContext()!");
|
||||
|
||||
if (existing)
|
||||
existing->SetOwner(nsnull);
|
||||
void *script_glob = nsnull;
|
||||
|
||||
if (aScriptContext) {
|
||||
@ -1781,7 +1776,6 @@ nsGlobalWindow::SetDocShell(nsIDocShell* aDocShell)
|
||||
langCtx = mScriptContexts[st_ndx];
|
||||
if (langCtx) {
|
||||
langCtx->GC();
|
||||
langCtx->SetOwner(nsnull);
|
||||
langCtx->FinalizeContext();
|
||||
mScriptContexts[st_ndx] = nsnull;
|
||||
}
|
||||
|
@ -38,7 +38,6 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsJSEnvironment.h"
|
||||
#include "nsIScriptContextOwner.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
#include "nsIDOMChromeWindow.h"
|
||||
@ -956,7 +955,6 @@ nsJSContext::nsJSContext(JSRuntime *aRuntime) : mGCOnDestruction(PR_TRUE)
|
||||
}
|
||||
mIsInitialized = PR_FALSE;
|
||||
mNumEvaluations = 0;
|
||||
mOwner = nsnull;
|
||||
mTerminations = nsnull;
|
||||
mScriptsEnabled = PR_TRUE;
|
||||
mBranchCallbackCount = 0;
|
||||
@ -3061,20 +3059,6 @@ nsJSContext::ScriptEvaluated(PRBool aTerminated)
|
||||
mBranchCallbackTime = LL_ZERO;
|
||||
}
|
||||
|
||||
void
|
||||
nsJSContext::SetOwner(nsIScriptContextOwner* owner)
|
||||
{
|
||||
// The owner should not be addrefed!! We'll be told
|
||||
// when the owner goes away.
|
||||
mOwner = owner;
|
||||
}
|
||||
|
||||
nsIScriptContextOwner *
|
||||
nsJSContext::GetOwner()
|
||||
{
|
||||
return mOwner;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsJSContext::SetTerminationFunction(nsScriptTerminationFunc aFunc,
|
||||
nsISupports* aRef)
|
||||
|
@ -135,8 +135,6 @@ public:
|
||||
virtual void GC();
|
||||
|
||||
virtual void ScriptEvaluated(PRBool aTerminated);
|
||||
virtual void SetOwner(nsIScriptContextOwner* owner);
|
||||
virtual nsIScriptContextOwner *GetOwner();
|
||||
virtual nsresult SetTerminationFunction(nsScriptTerminationFunc aFunc,
|
||||
nsISupports* aRef);
|
||||
virtual PRBool GetScriptsEnabled();
|
||||
@ -195,8 +193,6 @@ private:
|
||||
JSContext *mContext;
|
||||
PRUint32 mNumEvaluations;
|
||||
|
||||
nsIScriptContextOwner* mOwner; /* NB: weak reference, not ADDREF'd */
|
||||
|
||||
protected:
|
||||
struct TerminationFuncHolder;
|
||||
friend struct TerminationFuncHolder;
|
||||
|
@ -856,20 +856,6 @@ nsPythonContext::SetScriptsEnabled(PRBool aEnabled, PRBool aFireTimeouts)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsPythonContext::SetOwner(nsIScriptContextOwner* owner)
|
||||
{
|
||||
// The owner should not be addrefed!! We'll be told
|
||||
// when the owner goes away.
|
||||
mOwner = owner;
|
||||
}
|
||||
|
||||
nsIScriptContextOwner *
|
||||
nsPythonContext::GetOwner()
|
||||
{
|
||||
return mOwner;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPythonContext::SetTerminationFunction(nsScriptTerminationFunc aFunc,
|
||||
nsISupports* aRef)
|
||||
|
@ -184,8 +184,6 @@ public:
|
||||
virtual void GC();
|
||||
|
||||
virtual void ScriptEvaluated(PRBool aTerminated);
|
||||
virtual void SetOwner(nsIScriptContextOwner* owner);
|
||||
virtual nsIScriptContextOwner *GetOwner();
|
||||
virtual nsresult SetTerminationFunction(nsScriptTerminationFunc aFunc,
|
||||
nsISupports* aRef);
|
||||
virtual PRBool GetScriptsEnabled();
|
||||
@ -231,8 +229,7 @@ protected:
|
||||
PRPackedBool mScriptsEnabled;
|
||||
PRPackedBool mProcessingScriptTag;
|
||||
|
||||
nsIScriptContextOwner* mOwner; /* NB: weak reference, not ADDREF'd */
|
||||
// ditto - not ADDREF'd - but Python itself takes one!
|
||||
// not ADDREF'd - but Python itself takes one!
|
||||
nsIScriptGlobalObject *mScriptGlobal;
|
||||
|
||||
nsresult HandlePythonError();
|
||||
|
Loading…
x
Reference in New Issue
Block a user