Merge mozilla-central to mozilla-inbound

This commit is contained in:
Ed Morley 2011-11-22 02:42:27 +00:00
commit 870b8d7d2c
7 changed files with 79 additions and 19 deletions

View File

@ -66,6 +66,7 @@ endif
JAVAC_FLAGS = \
-target $(JAVA_VERSION) \
-source $(JAVA_VERSION) \
-classpath $(JAVA_CLASSPATH) \
-bootclasspath $(JAVA_BOOTCLASSPATH) \
-encoding ascii \

View File

@ -251,6 +251,7 @@ SHELL_WRAPPER1(nativeRun, jstring)
SHELL_WRAPPER1(notifyGeckoOfEvent, jobject)
SHELL_WRAPPER0(processNextNativeEvent)
SHELL_WRAPPER1(setSurfaceView, jobject)
SHELL_WRAPPER1(setSoftwareLayerClient, jobject)
SHELL_WRAPPER0(onResume)
SHELL_WRAPPER0(onLowMemory)
SHELL_WRAPPER3(callObserver, jstring, jstring, jstring)
@ -259,6 +260,7 @@ SHELL_WRAPPER1(onChangeNetworkLinkStatus, jstring)
SHELL_WRAPPER1(reportJavaCrash, jstring)
SHELL_WRAPPER0(executeNextRunnable)
SHELL_WRAPPER1(cameraCallbackBridge, jbyteArray)
SHELL_WRAPPER1(notifyUriVisited, jstring)
SHELL_WRAPPER3(notifyBatteryChange, jdouble, jboolean, jdouble);
static void * xul_handle = NULL;
@ -653,6 +655,7 @@ loadLibs(const char *apkName)
GETFUNC(notifyGeckoOfEvent);
GETFUNC(processNextNativeEvent);
GETFUNC(setSurfaceView);
GETFUNC(setSoftwareLayerClient);
GETFUNC(onResume);
GETFUNC(onLowMemory);
GETFUNC(callObserver);
@ -661,6 +664,7 @@ loadLibs(const char *apkName)
GETFUNC(reportJavaCrash);
GETFUNC(executeNextRunnable);
GETFUNC(cameraCallbackBridge);
GETFUNC(notifyUriVisited);
GETFUNC(notifyBatteryChange);
#undef GETFUNC
sStartupTimeline = (uint64_t *)__wrap_dlsym(xul_handle, "_ZN7mozilla15StartupTimeline16sStartupTimelineE");

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<searchresults total_results="1">
<addon id="5617">
<name>Restartless Test XPI</name>
<type id="1">Extension</type>
<guid>restartless-xpi@tests.mozilla.org</guid>
<slug>restartless-xpi</slug>
<version>1.0</version>
<compatible_applications><application>
<name>Firefox</name>
<application_id>1</application_id>
<min_version>3.6</min_version>
<max_version>*</max_version>
<appID>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</appID>
</application></compatible_applications>
<all_compatible_os><os>ALL</os></all_compatible_os>
<install os="ALL" size="485">http://127.0.0.1:4567/restartless.xpi</install>
<created epoch="1252903662">
2009-09-14T04:47:42Z
</created>
<last_updated epoch="1315255329">
2011-09-05T20:42:09Z
</last_updated>
</addon>
</searchresults>

Binary file not shown.

View File

@ -3,82 +3,89 @@ Cu.import("resource://services-sync/async.js");
const SQLITE_CONSTRAINT_VIOLATION = 19; // http://www.sqlite.org/c3ref/c_abort.html
function querySpinningly(query, names) {
let q = Svc.Form.DBConnection.createStatement(query);
let r = Async.querySpinningly(q, names);
q.finalize();
return r;
}
function run_test() {
initTestLogging("Trace");
_("Using the form service to test queries");
function c(query) Svc.Form.DBConnection.createStatement(query);
_("Make sure the call is async and allows other events to process");
let isAsync = false;
Utils.nextTick(function() { isAsync = true; });
do_check_false(isAsync);
_("Empty out the formhistory table");
let r0 = Async.querySpinningly(c("DELETE FROM moz_formhistory"));
let r0 = querySpinningly("DELETE FROM moz_formhistory");
do_check_eq(r0, null);
_("Make sure there's nothing there");
let r1 = Async.querySpinningly(c("SELECT 1 FROM moz_formhistory"));
let r1 = querySpinningly("SELECT 1 FROM moz_formhistory");
do_check_eq(r1, null);
_("Insert a row");
let r2 = Async.querySpinningly(c("INSERT INTO moz_formhistory (fieldname, value) VALUES ('foo', 'bar')"));
let r2 = querySpinningly("INSERT INTO moz_formhistory (fieldname, value) VALUES ('foo', 'bar')");
do_check_eq(r2, null);
_("Request a known value for the one row");
let r3 = Async.querySpinningly(c("SELECT 42 num FROM moz_formhistory"), ["num"]);
let r3 = querySpinningly("SELECT 42 num FROM moz_formhistory", ["num"]);
do_check_eq(r3.length, 1);
do_check_eq(r3[0].num, 42);
_("Get multiple columns");
let r4 = Async.querySpinningly(c("SELECT fieldname, value FROM moz_formhistory"), ["fieldname", "value"]);
let r4 = querySpinningly("SELECT fieldname, value FROM moz_formhistory", ["fieldname", "value"]);
do_check_eq(r4.length, 1);
do_check_eq(r4[0].fieldname, "foo");
do_check_eq(r4[0].value, "bar");
_("Get multiple columns with a different order");
let r5 = Async.querySpinningly(c("SELECT fieldname, value FROM moz_formhistory"), ["value", "fieldname"]);
let r5 = querySpinningly("SELECT fieldname, value FROM moz_formhistory", ["value", "fieldname"]);
do_check_eq(r5.length, 1);
do_check_eq(r5[0].fieldname, "foo");
do_check_eq(r5[0].value, "bar");
_("Add multiple entries (sqlite doesn't support multiple VALUES)");
let r6 = Async.querySpinningly(c("INSERT INTO moz_formhistory (fieldname, value) SELECT 'foo', 'baz' UNION SELECT 'more', 'values'"));
let r6 = querySpinningly("INSERT INTO moz_formhistory (fieldname, value) SELECT 'foo', 'baz' UNION SELECT 'more', 'values'");
do_check_eq(r6, null);
_("Get multiple rows");
let r7 = Async.querySpinningly(c("SELECT fieldname, value FROM moz_formhistory WHERE fieldname = 'foo'"), ["fieldname", "value"]);
let r7 = querySpinningly("SELECT fieldname, value FROM moz_formhistory WHERE fieldname = 'foo'", ["fieldname", "value"]);
do_check_eq(r7.length, 2);
do_check_eq(r7[0].fieldname, "foo");
do_check_eq(r7[1].fieldname, "foo");
_("Make sure updates work");
let r8 = Async.querySpinningly(c("UPDATE moz_formhistory SET value = 'updated' WHERE fieldname = 'more'"));
let r8 = querySpinningly("UPDATE moz_formhistory SET value = 'updated' WHERE fieldname = 'more'");
do_check_eq(r8, null);
_("Get the updated");
let r9 = Async.querySpinningly(c("SELECT value, fieldname FROM moz_formhistory WHERE fieldname = 'more'"), ["fieldname", "value"]);
let r9 = querySpinningly("SELECT value, fieldname FROM moz_formhistory WHERE fieldname = 'more'", ["fieldname", "value"]);
do_check_eq(r9.length, 1);
do_check_eq(r9[0].fieldname, "more");
do_check_eq(r9[0].value, "updated");
_("Grabbing fewer fields than queried is fine");
let r10 = Async.querySpinningly(c("SELECT value, fieldname FROM moz_formhistory"), ["fieldname"]);
let r10 = querySpinningly("SELECT value, fieldname FROM moz_formhistory", ["fieldname"]);
do_check_eq(r10.length, 3);
_("Generate an execution error");
let r11, except, query = c("INSERT INTO moz_formhistory (fieldname, value) VALUES ('one', NULL)");
let query = "INSERT INTO moz_formhistory (fieldname, value) VALUES ('one', NULL)";
let stmt = Svc.Form.DBConnection.createStatement(query);
let r11, except; ;
try {
r11 = Async.querySpinningly(query);
r11 = Async.querySpinningly(stmt);
} catch(e) {
except = e;
}
stmt.finalize()
do_check_true(!!except);
do_check_eq(except.result, SQLITE_CONSTRAINT_VIOLATION);
_("Cleaning up");
Async.querySpinningly(c("DELETE FROM moz_formhistory"));
querySpinningly("DELETE FROM moz_formhistory");
_("Make sure the timeout got to run before this function ends");
do_check_true(isAsync);

View File

@ -795,6 +795,22 @@ nsWindow::GetThebesSurface()
return new gfxImageSurface(gfxIntSize(5,5), gfxImageSurface::ImageFormatRGB24);
}
class DrawToFileRunnable : public nsRunnable {
public:
DrawToFileRunnable(nsWindow* win, const nsAString &path) {
mPath = path;
mWindow = win;
}
NS_IMETHOD Run() {
mWindow->DrawToFile(mPath);
return NS_OK;
}
private:
nsString mPath;
nsRefPtr<nsWindow> mWindow;
};
bool
nsWindow::DrawToFile(const nsAString &path)
{
@ -1008,7 +1024,11 @@ nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
break;
case AndroidGeckoEvent::SAVE_STATE:
win->DrawToFile(ae->Characters());
{
nsCOMPtr<nsIThread> thread;
nsRefPtr<DrawToFileRunnable> runnable = new DrawToFileRunnable(win, ae->Characters());
NS_NewThread(getter_AddRefs(thread), runnable);
}
break;
default:

View File

@ -176,12 +176,13 @@ public:
static bool sAccessibilityEnabled;
#endif
bool DrawToFile(const nsAString &path);
protected:
void BringToFront();
nsWindow *FindTopLevel();
bool DrawTo(gfxASurface *targetSurface);
bool DrawTo(gfxASurface *targetSurface, const nsIntRect &aRect);
bool DrawToFile(const nsAString &path);
bool IsTopLevel();
void OnIMEAddRange(mozilla::AndroidGeckoEvent *ae);