зеркало из https://github.com/mozilla/gecko-dev.git
Bug #37009; Drop bogus refcount twiddling methods and rely on dependent=yes window attribute instead; r=radha
This commit is contained in:
Родитель
406d3196ea
Коммит
cf5ee3ef0f
|
@ -38,7 +38,8 @@ class nsIWebShell;
|
|||
| default implementation of the find component. |
|
||||
| |
|
||||
| This interface is very simple: it provides 5 attributes that control the |
|
||||
| Find and FindNext methods of nsFindComponent. |
|
||||
| Find and FindNext methods of nsFindComponent. In addition, it provides |
|
||||
| two additional attributes used for implementation purposes. |
|
||||
------------------------------------------------------------------------------*/
|
||||
[scriptable, uuid(31ABA0F0-2D93-11d3-8069-00600811A9C3)]
|
||||
interface nsISearchContext : nsISupports {
|
||||
|
@ -49,6 +50,4 @@ interface nsISearchContext : nsISupports {
|
|||
attribute boolean wrapSearch;
|
||||
readonly attribute nsIDOMWindow targetWindow;
|
||||
attribute nsIDOMWindow findDialog;
|
||||
void ConvertToWeakReference();
|
||||
void ConvertToOwningReference();
|
||||
};
|
||||
|
|
|
@ -95,9 +95,6 @@
|
|||
// Tell search context about this dialog.
|
||||
data.findDialog = window;
|
||||
|
||||
// Turn "data" into weak reference.
|
||||
data.ConvertToWeakReference();
|
||||
|
||||
// Fill dialog.
|
||||
loadDialog();
|
||||
|
||||
|
@ -106,10 +103,6 @@
|
|||
}
|
||||
|
||||
function onUnload() {
|
||||
// Turn "data" back to owning reference (since xpconnect
|
||||
// will do Release() regardless).
|
||||
data.ConvertToOwningReference();
|
||||
|
||||
// Disconnect context from this dialog.
|
||||
data.findDialog = null;
|
||||
}
|
||||
|
|
|
@ -62,11 +62,11 @@ nsFindComponent::Context::Context()
|
|||
|
||||
nsFindComponent::Context::~Context()
|
||||
{
|
||||
#ifdef DEBUG_law
|
||||
printf( "\nnsFindComponent::Context destructor called\n\n" );
|
||||
#endif
|
||||
// Close the dialog (if there is one).
|
||||
if ( mFindDialog ) {
|
||||
// Bump refcnt so cleanup of the bogus owning reference in JS doesn't
|
||||
// cause re-entry.
|
||||
this->AddRef();
|
||||
mFindDialog->Close();
|
||||
mFindDialog = 0;
|
||||
}
|
||||
|
@ -668,16 +668,16 @@ nsFindComponent::Context::SetWrapSearch(PRBool aBool)
|
|||
NS_IMETHODIMP
|
||||
nsFindComponent::Context::GetTargetWindow( nsIDOMWindow * *aWindow)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aWindow);
|
||||
NS_IF_ADDREF(*aWindow = mTargetWindow);
|
||||
NS_ENSURE_ARG_POINTER(aWindow);
|
||||
NS_IF_ADDREF(*aWindow = mTargetWindow);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFindComponent::Context::GetFindDialog( nsIDOMWindow * *aDialog)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDialog);
|
||||
NS_IF_ADDREF(*aDialog = mFindDialog);
|
||||
NS_ENSURE_ARG_POINTER(aDialog);
|
||||
NS_IF_ADDREF(*aDialog = mFindDialog);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -688,21 +688,6 @@ nsFindComponent::Context::SetFindDialog( nsIDOMWindow *aDialog )
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFindComponent::Context::ConvertToWeakReference()
|
||||
{
|
||||
NS_ASSERTION( mRefCnt >= 1, "Can't convert last reference to a weak one!" );
|
||||
this->Release();
|
||||
return NS_OK;
|
||||
};
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFindComponent::Context::ConvertToOwningReference()
|
||||
{
|
||||
this->AddRef();
|
||||
return NS_OK;
|
||||
};
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче