Merge fx-team to m-c

This commit is contained in:
Wes Kocher 2014-06-02 19:00:58 -07:00
commit a5860ae957
6 changed files with 105 additions and 11 deletions

View File

@ -4723,7 +4723,7 @@
<method name="_mouseenter">
<body><![CDATA[
if (this.closing)
if (this.hidden || this.closing)
return;
let tabContainer = this.parentNode;

View File

@ -6,6 +6,7 @@ package org.mozilla.gecko.db;
import java.lang.IllegalArgumentException;
import java.util.HashMap;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.GeckoEvent;
import org.mozilla.gecko.db.BrowserContract.FormHistory;
@ -33,6 +34,7 @@ public class FormHistoryProvider extends SQLiteBridgeContentProvider {
// This should be kept in sync with the db version in toolkit/components/satchel/nsFormHistory.js
private static int DB_VERSION = 4;
private static String DB_FILENAME = "formhistory.sqlite";
private static final String TELEMETRY_TAG = "SQLITEBRIDGE_PROVIDER_FORMS";
private static final String WHERE_GUID_IS_NULL = BrowserContract.DeletedFormHistory.GUID + " IS NULL";
private static final String WHERE_GUID_IS_VALUE = BrowserContract.DeletedFormHistory.GUID + " = ?";
@ -153,6 +155,11 @@ public class FormHistoryProvider extends SQLiteBridgeContentProvider {
return DB_FILENAME;
}
@Override
protected String getTelemetryPrefix() {
return TELEMETRY_TAG;
}
@Override
protected int getDBVersion(){
return DB_VERSION;

View File

@ -29,6 +29,7 @@ public class HomeProvider extends SQLiteBridgeContentProvider {
// This should be kept in sync with the db version in mobile/android/modules/HomeProvider.jsm
private static int DB_VERSION = 2;
private static String DB_FILENAME = "home.sqlite";
private static final String TELEMETRY_TAG = "SQLITEBRIDGE_PROVIDER_HOME";
private static final String TABLE_ITEMS = "items";
@ -144,6 +145,11 @@ public class HomeProvider extends SQLiteBridgeContentProvider {
return DB_FILENAME;
}
@Override
protected String getTelemetryPrefix() {
return TELEMETRY_TAG;
}
@Override
protected int getDBVersion(){
return DB_VERSION;

View File

@ -29,6 +29,8 @@ public class PasswordsProvider extends SQLiteBridgeContentProvider {
static final String TABLE_PASSWORDS = "moz_logins";
static final String TABLE_DELETED_PASSWORDS = "moz_deleted_logins";
private static final String TELEMETRY_TAG = "SQLITEBRIDGE_PROVIDER_PASSWORDS";
private static final int PASSWORDS = 100;
private static final int DELETED_PASSWORDS = 101;
@ -91,6 +93,11 @@ public class PasswordsProvider extends SQLiteBridgeContentProvider {
return DB_FILENAME;
}
@Override
protected String getTelemetryPrefix() {
return TELEMETRY_TAG;
}
@Override
protected int getDBVersion(){
return DB_VERSION;

View File

@ -6,14 +6,14 @@ package org.mozilla.gecko.db;
import java.io.File;
import java.util.HashMap;
import java.util.Collection;
import java.util.Iterator;
import org.mozilla.gecko.GeckoProfile;
import org.mozilla.gecko.GeckoThread;
import org.mozilla.gecko.db.BrowserContract;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.mozglue.GeckoLoader;
import org.mozilla.gecko.sqlite.SQLiteBridge;
import org.mozilla.gecko.sqlite.SQLiteBridgeException;
import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
@ -35,6 +35,8 @@ import android.util.Log;
*/
public abstract class SQLiteBridgeContentProvider extends ContentProvider {
private static final String ERROR_MESSAGE_DATABASE_IS_LOCKED = "Can't step statement: (5) database is locked";
private HashMap<String, SQLiteBridge> mDatabasePerProfile;
protected Context mContext = null;
private final String mLogTag;
@ -43,6 +45,42 @@ public abstract class SQLiteBridgeContentProvider extends ContentProvider {
mLogTag = logTag;
}
/**
* Subclasses must override this to allow error reporting code to compose
* the correct histogram name.
*
* Ensure that you define the new histograms if you define a new class!
*/
protected abstract String getTelemetryPrefix();
/**
* Errors are recorded in telemetry using an enumerated histogram.
*
* <https://developer.mozilla.org/en-US/docs/Mozilla/Performance/
* Adding_a_new_Telemetry_probe#Choosing_a_Histogram_Type>
*
* These are the allowable enumeration values. Keep these in sync with the
* histogram definition!
*
*/
private static enum TelemetryErrorOp {
BULKINSERT (0),
DELETE (1),
INSERT (2),
QUERY (3),
UPDATE (4);
private final int bucket;
TelemetryErrorOp(final int bucket) {
this.bucket = bucket;
}
public int getBucket() {
return bucket;
}
}
@Override
public void shutdown() {
if (mDatabasePerProfile == null) {
@ -255,7 +293,7 @@ public abstract class SQLiteBridgeContentProvider extends ContentProvider {
try {
deleted = db.delete(getTable(uri), selection, selectionArgs);
} catch (SQLiteBridgeException ex) {
Log.e(mLogTag, "Error deleting record", ex);
reportError(ex, TelemetryErrorOp.DELETE);
throw ex;
}
@ -291,7 +329,7 @@ public abstract class SQLiteBridgeContentProvider extends ContentProvider {
db.setTransactionSuccessful();
}
} catch (SQLiteBridgeException ex) {
Log.e(mLogTag, "Error inserting in db", ex);
reportError(ex, TelemetryErrorOp.INSERT);
throw ex;
} finally {
if (useTransaction) {
@ -312,7 +350,6 @@ public abstract class SQLiteBridgeContentProvider extends ContentProvider {
return 0;
}
long id = -1;
int rowsAdded = 0;
String table = getTable(uri);
@ -323,12 +360,12 @@ public abstract class SQLiteBridgeContentProvider extends ContentProvider {
ContentValues values = new ContentValues(initialValues);
setupDefaults(uri, values);
onPreInsert(values, uri, db);
id = db.insert(table, null, values);
db.insert(table, null, values);
rowsAdded++;
}
db.setTransactionSuccessful();
} catch (SQLiteBridgeException ex) {
Log.e(mLogTag, "Error inserting in db", ex);
reportError(ex, TelemetryErrorOp.BULKINSERT);
throw ex;
} finally {
db.endTransaction();
@ -360,7 +397,7 @@ public abstract class SQLiteBridgeContentProvider extends ContentProvider {
try {
updated = db.update(getTable(uri), values, selection, selectionArgs);
} catch (SQLiteBridgeException ex) {
Log.e(mLogTag, "Error updating table", ex);
reportError(ex, TelemetryErrorOp.UPDATE);
throw ex;
}
@ -386,13 +423,32 @@ public abstract class SQLiteBridgeContentProvider extends ContentProvider {
cursor = db.query(getTable(uri), projection, selection, selectionArgs, null, null, sortOrder, null);
onPostQuery(cursor, uri, db);
} catch (SQLiteBridgeException ex) {
Log.e(mLogTag, "Error querying database", ex);
reportError(ex, TelemetryErrorOp.QUERY);
throw ex;
}
return cursor;
}
private String getHistogram(SQLiteBridgeException e) {
// If you add values here, make sure to update
// toolkit/components/telemetry/Histograms.json.
if (ERROR_MESSAGE_DATABASE_IS_LOCKED.equals(e.getMessage())) {
return getTelemetryPrefix() + "_LOCKED";
}
return null;
}
protected void reportError(SQLiteBridgeException e, TelemetryErrorOp op) {
Log.e(mLogTag, "Error in database " + op.name(), e);
final String histogram = getHistogram(e);
if (histogram == null) {
return;
}
Telemetry.HistogramAdd(histogram, op.getBucket());
}
protected abstract String getDBName();
protected abstract int getDBVersion();

View File

@ -5908,6 +5908,24 @@
"extended_statistics_ok": true,
"description": "Time spent to open an existing cache entry"
},
"SQLITEBRIDGE_PROVIDER_PASSWORDS_LOCKED": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": "10",
"description": "The number of errors using the PasswordsProvider due to a locked DB."
},
"SQLITEBRIDGE_PROVIDER_FORMS_LOCKED": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": "10",
"description": "The number of errors using the FormHistoryProvider due to a locked DB."
},
"SQLITEBRIDGE_PROVIDER_HOME_LOCKED": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": "10",
"description": "The number of errors using the HomeProvider due to a locked DB."
},
"SSL_TLS12_INTOLERANCE_REASON_PRE": {
"expires_in_version": "never",
"kind": "enumerated",