mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 697989 - don't use domstorage-flush-timer test_bug624047.html. r=mak77.
Use a new domstorage-flush-force message for testing calling FlushAndDeleteTemporaryTables with a 'true' argument. We want to add more work to profile-before-change and that would interfere with the testing in dom/tests/mochitest/localstorage/test_bug624047.html. Also move the NS_DOMSTORAGE_FLUSH_TIMER_OBSERVER define to the .cpp file since that is the only place it is used and rename it to end in _TOPIC.
This commit is contained in:
parent
83c942acf5
commit
306af67699
@ -74,6 +74,12 @@ using mozilla::dom::StorageChild;
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
// calls FlushAndDeleteTemporaryTables(false)
|
||||
#define NS_DOMSTORAGE_FLUSH_TIMER_TOPIC "domstorage-flush-timer"
|
||||
|
||||
// calls FlushAndDeleteTemporaryTables(true)
|
||||
#define NS_DOMSTORAGE_FLUSH_FORCE_TOPIC "domstorage-flush-force"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
static const PRUint32 ASK_BEFORE_ACCEPT = 1;
|
||||
@ -290,7 +296,7 @@ nsDOMStorageManager::Initialize()
|
||||
// Used for temporary table flushing
|
||||
os->AddObserver(gStorageManager, "profile-before-change", false);
|
||||
os->AddObserver(gStorageManager, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
|
||||
os->AddObserver(gStorageManager, NS_DOMSTORAGE_FLUSH_TIMER_OBSERVER, false);
|
||||
os->AddObserver(gStorageManager, NS_DOMSTORAGE_FLUSH_TIMER_TOPIC, false);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -440,7 +446,7 @@ nsDOMStorageManager::Observe(nsISupports *aSubject,
|
||||
} else if (!strcmp(aTopic, "timer-callback")) {
|
||||
nsCOMPtr<nsIObserverService> obsserv = mozilla::services::GetObserverService();
|
||||
if (obsserv)
|
||||
obsserv->NotifyObservers(nsnull, NS_DOMSTORAGE_FLUSH_TIMER_OBSERVER, nsnull);
|
||||
obsserv->NotifyObservers(nsnull, NS_DOMSTORAGE_FLUSH_TIMER_TOPIC, nsnull);
|
||||
} else if (!strcmp(aTopic, "browser:purge-domain-data")) {
|
||||
// Convert the domain name to the ACE format
|
||||
nsCAutoString aceDomain;
|
||||
@ -475,13 +481,20 @@ nsDOMStorageManager::Observe(nsISupports *aSubject,
|
||||
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
|
||||
"DOMStorage: temporary table commit failed");
|
||||
}
|
||||
} else if (!strcmp(aTopic, NS_DOMSTORAGE_FLUSH_TIMER_OBSERVER)) {
|
||||
} else if (!strcmp(aTopic, NS_DOMSTORAGE_FLUSH_TIMER_TOPIC)) {
|
||||
if (DOMStorageImpl::gStorageDB) {
|
||||
DebugOnly<nsresult> rv =
|
||||
DOMStorageImpl::gStorageDB->FlushAndDeleteTemporaryTables(false);
|
||||
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
|
||||
"DOMStorage: temporary table commit failed");
|
||||
}
|
||||
} else if (!strcmp(aTopic, NS_DOMSTORAGE_FLUSH_FORCE_TOPIC)) {
|
||||
if (DOMStorageImpl::gStorageDB) {
|
||||
DebugOnly<nsresult> rv =
|
||||
DOMStorageImpl::gStorageDB->FlushAndDeleteTemporaryTables(true);
|
||||
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
|
||||
"DOMStorage: temporary table commit failed");
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -62,8 +62,6 @@
|
||||
#include "nsITimer.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
#define NS_DOMSTORAGE_FLUSH_TIMER_OBSERVER "domstorage-flush-timer"
|
||||
|
||||
#include "nsDOMStorageDBWrapper.h"
|
||||
|
||||
#define IS_PERMISSION_ALLOWED(perm) \
|
||||
|
@ -24,7 +24,7 @@ function flushTables()
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var storageManager = Components.classes["@mozilla.org/dom/storagemanager;1"]
|
||||
.getService(Components.interfaces.nsIObserver);
|
||||
storageManager.observe(null, "profile-before-change", null);
|
||||
storageManager.observe(null, "domstorage-flush-force", null);
|
||||
}
|
||||
|
||||
function startTest()
|
||||
|
Loading…
Reference in New Issue
Block a user