Bug 675221 part E - fix up DOMStorage proxies (miscellaenous #includes from other places also included) r=mayhemer

--HG--
extra : rebase_source : 834aafda6e819602e73bd6017849bc4eaa202226
This commit is contained in:
Benjamin Smedberg 2011-08-19 11:50:37 -04:00
Родитель 6b29b9dd69
Коммит 48fea83d05
3 изменённых файлов: 31 добавлений и 23 удалений

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

@ -70,8 +70,8 @@ using mozilla::dom::StorageChild;
#include "nsIPrivateBrowsingService.h"
#include "nsDOMString.h"
#include "nsNetCID.h"
#include "nsIProxyObjectManager.h"
#include "mozilla/Preferences.h"
#include "nsThreadUtils.h"
using namespace mozilla;
@ -1898,6 +1898,34 @@ nsDOMStorage2::StorageType()
return nsPIDOMStorage::Unknown;
}
namespace {
class StorageNotifierRunnable : public nsRunnable
{
public:
StorageNotifierRunnable(nsISupports* aSubject)
: mSubject(aSubject)
{ }
NS_DECL_NSIRUNNABLE
private:
nsCOMPtr<nsISupports> mSubject;
};
NS_IMETHODIMP
StorageNotifierRunnable::Run()
{
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
if (observerService) {
observerService->NotifyObservers(mSubject, "dom-storage2-changed", nsnull);
}
return NS_OK;
}
} // anonymous namespace
void
nsDOMStorage2::BroadcastChangeNotification(const nsSubstring &aKey,
const nsSubstring &aOldValue,
@ -1917,26 +1945,8 @@ nsDOMStorage2::BroadcastChangeNotification(const nsSubstring &aKey,
return;
}
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
if (!observerService) {
return;
}
nsCOMPtr<nsIObserverService> observerServiceProxy;
rv = NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
NS_GET_IID(nsIObserverService),
observerService,
NS_PROXY_ASYNC | NS_PROXY_ALWAYS,
getter_AddRefs(observerServiceProxy));
if (NS_FAILED(rv)) {
return;
}
// Fire off a notification that a storage object changed.
observerServiceProxy->NotifyObservers(event,
"dom-storage2-changed",
nsnull);
nsRefPtr<StorageNotifierRunnable> r = new StorageNotifierRunnable(event);
NS_DispatchToMainThread(r);
}
NS_IMETHODIMP

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

@ -62,7 +62,6 @@
#include "nsIProgressEventSink.h"
#include "nsIChannelEventSink.h"
#include "nsIAsyncVerifyRedirectCallback.h"
#include "nsIProxyObjectManager.h"
#include "nsIServiceManager.h"
#include "nsIFileURL.h"
#include "nsThreadUtils.h"

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

@ -67,7 +67,6 @@
#include "nsIComponentManager.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIProxyObjectManager.h"
#include "nsIServiceManager.h"
#include "nsISupportsPrimitives.h"
#include "nsIScriptSecurityManager.h"