зеркало из https://github.com/mozilla/gecko-dev.git
Bug 461199 (Part 12) - mozilla::dom::Link should unregister with mozilla::IHistory when it goes away
Call UnregisterWithHistory in Link's destructor to ensure that we are no longer registered with IHistory. r=sicking sr=bz
This commit is contained in:
Родитель
d7efe9418a
Коммит
6f84ecdb30
|
@ -58,6 +58,11 @@ Link::Link()
|
|||
{
|
||||
}
|
||||
|
||||
Link::~Link()
|
||||
{
|
||||
UnregisterFromHistory();
|
||||
}
|
||||
|
||||
nsLinkState
|
||||
Link::GetLinkState() const
|
||||
{
|
||||
|
@ -461,13 +466,11 @@ Link::UnregisterFromHistory()
|
|||
return;
|
||||
}
|
||||
|
||||
// Obtain the URI that we registered with.
|
||||
nsCOMPtr<nsIURI> hrefURI(GetURI());
|
||||
NS_ASSERTION(hrefURI, "mRegistered is true, but we have no URI?!");
|
||||
NS_ASSERTION(mCachedURI, "mRegistered is true, but we have no cached URI?!");
|
||||
|
||||
// And tell History to stop tracking us.
|
||||
IHistory *history = nsContentUtils::GetHistory();
|
||||
nsresult rv = history->UnregisterVisitedCallback(hrefURI, this);
|
||||
nsresult rv = history->UnregisterVisitedCallback(mCachedURI, this);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "This should only fail if we misuse the API!");
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mRegistered = false;
|
||||
|
|
|
@ -93,6 +93,8 @@ protected:
|
|||
*/
|
||||
virtual void ResetLinkState();
|
||||
|
||||
virtual ~Link();
|
||||
|
||||
private:
|
||||
/**
|
||||
* Unregisters from History so this node no longer gets notifications about
|
||||
|
|
|
@ -94,6 +94,10 @@ Link::Link()
|
|||
{
|
||||
}
|
||||
|
||||
Link::~Link()
|
||||
{
|
||||
}
|
||||
|
||||
nsLinkState
|
||||
Link::GetLinkState() const
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче