Merge mozilla-central to mozilla-inbound

This commit is contained in:
Ed Morley 2012-06-08 14:24:47 +01:00
Родитель b354f9cf8c f86da2f0f4
Коммит 5d4779f937
4 изменённых файлов: 47 добавлений и 3 удалений

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

@ -876,7 +876,7 @@ ContinueHelper::GetSuccessResult(JSContext* aCx,
UpdateCursorState();
if (mKey.IsUnset()) {
*aVal = JSVAL_VOID;
*aVal = JSVAL_NULL;
}
else {
nsresult rv = WrapNative(aCx, mCursor, aVal);

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

@ -54,6 +54,9 @@
// Preference that users can set to override DEFAULT_QUOTA_MB
#define PREF_INDEXEDDB_QUOTA "dom.indexedDB.warningQuota"
// profile-before-change, when we need to shut down IDB
#define PROFILE_BEFORE_CHANGE_OBSERVER_ID "profile-before-change"
USING_INDEXEDDB_NAMESPACE
using namespace mozilla::services;
using mozilla::Preferences;
@ -238,7 +241,7 @@ IndexedDatabaseManager::GetOrCreate()
NS_ENSURE_TRUE(obs, nsnull);
// We need this callback to know when to shut down all our threads.
rv = obs->AddObserver(instance, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
rv = obs->AddObserver(instance, PROFILE_BEFORE_CHANGE_OBSERVER_ID, false);
NS_ENSURE_SUCCESS(rv, nsnull);
if (NS_FAILED(Preferences::AddIntVarCache(&gIndexedDBQuotaMB,
@ -1270,7 +1273,7 @@ IndexedDatabaseManager::Observe(nsISupports* aSubject,
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
if (!strcmp(aTopic, PROFILE_BEFORE_CHANGE_OBSERVER_ID)) {
// Setting this flag prevents the service from being recreated and prevents
// further databases from being created.
if (PR_ATOMIC_SET(&gShutdown, 1)) {

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

@ -231,6 +231,7 @@ function testSteps()
keyIndex += keyIndex ? 1 : 7;
}
else {
ok(cursor === null, "The request result should be null.");
testGenerator.next();
}
}
@ -242,9 +243,12 @@ function testSteps()
request = objectStore.openCursor();
request.onerror = errorHandler;
let storedCursor = null;
request.onsuccess = function (event) {
let cursor = event.target.result;
if (cursor) {
storedCursor = cursor;
is(cursor.key, sortedKeys[keyIndex], "Correct key");
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
is(cursor.value, "foo", "Correct value");
@ -263,6 +267,8 @@ function testSteps()
}
}
else {
ok(cursor === null, "The request result should be null.");
ok(storedCursor.value === undefined, "The cursor's value should be undefined.");
testGenerator.next();
}
}
@ -289,9 +295,12 @@ function testSteps()
request = objectStore.openCursor(null, "next");
request.onerror = errorHandler;
storedCursor = null;
request.onsuccess = function (event) {
let cursor = event.target.result;
if (cursor) {
storedCursor = cursor;
is(cursor.key, sortedKeys[keyIndex], "Correct key");
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
is(cursor.value, "foo", "Correct value");
@ -310,6 +319,8 @@ function testSteps()
cursor.continue();
}
else {
ok(cursor === null, "The request result should be null.");
ok(storedCursor.value === undefined, "The cursor's value should be undefined.");
testGenerator.next();
}
}
@ -334,9 +345,12 @@ function testSteps()
request = objectStore.openCursor(null, "prev");
request.onerror = errorHandler;
storedCursor = null;
request.onsuccess = function (event) {
let cursor = event.target.result;
if (cursor) {
storedCursor = cursor;
is(cursor.key, sortedKeys[keyIndex], "Correct key");
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
is(cursor.value, "foo", "Correct value");
@ -350,6 +364,8 @@ function testSteps()
keyIndex--;
}
else {
ok(cursor === null, "The request result should be null.");
ok(storedCursor.value === undefined, "The cursor's value should be undefined.");
testGenerator.next();
}
}

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

@ -14,6 +14,31 @@
#include "nsStringGlue.h"
#endif
/**
* In order to compare version numbers in Mozilla, you need to use the
* mozilla::Version class. You can construct an object of this type by passing
* in a string version number to the constructor. Objects of this type can be
* compared using the standard comparison operators.
*
* For example, let's say that you want to make sure that a given version
* number is not older than 15.a2. Here's how you would write a function to
* do that.
*
* bool IsVersionValid(const char* version) {
* return mozilla::Version("15.a2") <= mozilla::Version(version);
* }
*
* Or, since Version's constructor is implicit, you can simplify this code:
*
* bool IsVersionValid(const char* version) {
* return mozilla::Version("15.a2") <= version;
* }
*
* On Windows, if your version strings are wide characters, you should use the
* mozilla::VersionW variant instead. The semantics of that class is the same
* as Version.
*/
namespace mozilla {
PRInt32 NS_COM_GLUE