Merge m-c to inbound.

This commit is contained in:
Ryan VanderMeulen 2013-07-19 09:57:34 -04:00
commit 9b32797ff4
16 changed files with 105 additions and 101 deletions

View File

@ -421,7 +421,6 @@ pref("services.push.udp.port", 2442);
// NetworkStats
#ifdef MOZ_B2G_RIL
pref("dom.mozNetworkStats.enabled", true);
pref("ril.lastKnownMcc", "724");
pref("ril.cellbroadcast.disabled", false);
#endif

View File

@ -1,4 +1,4 @@
{
"revision": "20b7d51bd03d385e816b49d6c4b86b8cd59a97fd",
"revision": "4ecf580f46388510b61c13485f331e2269f0d8c2",
"repo_path": "/integration/gaia-central"
}

View File

@ -3027,6 +3027,9 @@ DOMGCSliceCallback(JSRuntime *aRt, JS::GCProgress aProgress, const JS::GCDescrip
// The GC has more work to do, so schedule another GC slice.
if (aProgress == JS::GC_SLICE_END) {
if (ShouldTriggerCC(nsCycleCollector_suspectedCount())) {
nsCycleCollector_dispatchDeferredDeletion();
}
nsJSContext::KillInterSliceGCTimer();
if (!sShuttingDown) {
CallCreateInstance("@mozilla.org/timer;1", &sInterSliceGCTimer);

View File

@ -107,7 +107,7 @@ function BrowserElementParent(frameLoader, hasRemoteFrame) {
let mmCalls = {
"hello": this._recvHello,
"contextmenu": this._fireCtxMenuEvent,
"locationchange": this._gotLocationChange,
"locationchange": this._fireEventFromMsg,
"loadstart": this._fireEventFromMsg,
"loadend": this._fireEventFromMsg,
"titlechange": this._fireEventFromMsg,
@ -612,11 +612,6 @@ BrowserElementParent.prototype = {
this._frameElement.dispatchEvent(evt);
},
_gotLocationChange: function(data) {
this[data._payload_] = 'BEP location';
this._fireEventFromMsg(data);
},
observe: function(subject, topic, data) {
switch(topic) {
case 'oop-frameloader-crashed':

View File

@ -18,7 +18,7 @@ Cu.import("resource://gre/modules/IndexedDBHelper.jsm");
Cu.import("resource://gre/modules/PhoneNumberUtils.jsm");
const DB_NAME = "contacts";
const DB_VERSION = 12;
const DB_VERSION = 13;
const STORE_NAME = "contacts";
const SAVED_GETALL_STORE_NAME = "getallcache";
const CHUNK_SIZE = 20;
@ -456,6 +456,42 @@ ContactDB.prototype = {
next();
}
};
},
function upgrade12to13() {
if (DEBUG) debug("Add phone substring to the search index if appropriate for country");
if (this.substringMatching) {
if (!objectStore) {
objectStore = aTransaction.objectStore(STORE_NAME);
}
objectStore.openCursor().onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
if (cursor.value.properties.tel) {
cursor.value.search.parsedTel = cursor.value.search.parsedTel || [];
cursor.value.properties.tel.forEach(
function(tel) {
let normalized = PhoneNumberUtils.normalize(tel.value.toString());
if (normalized) {
if (this.substringMatching && normalized.length > this.substringMatching) {
let sub = normalized.slice(-this.substringMatching);
if (cursor.value.search.parsedTel.indexOf(sub) === -1) {
if (DEBUG) debug("Adding substring index: " + tel + ", " + sub);
cursor.value.search.parsedTel.push(sub);
}
}
}
}.bind(this)
);
cursor.update(cursor.value);
}
cursor.continue();
} else {
next();
}
}.bind(this);
} else {
next();
}
}
];
@ -472,7 +508,7 @@ ContactDB.prototype = {
try {
var i = index++;
if (DEBUG) debug("Upgrade step: " + i + "\n");
steps[i]();
steps[i].call(outer);
} catch(ex) {
dump("Caught exception" + ex);
aTransaction.abort();
@ -1001,9 +1037,15 @@ ContactDB.prototype = {
// Enable special phone number substring matching. Does not update existing DB entries.
enableSubstringMatching: function enableSubstringMatching(aDigits) {
if (DEBUG) debug("MCC enabling substring matching " + aDigits);
this.substringMatching = aDigits;
},
disableSubstringMatching: function disableSubstringMatching() {
if (DEBUG) debug("MCC disabling substring matching");
delete this.substringMatching;
},
init: function init(aGlobal) {
this.initDBHelper(DB_NAME, DB_VERSION, [STORE_NAME, SAVED_GETALL_STORE_NAME, REVISION_STORE], aGlobal);
}

View File

@ -43,17 +43,10 @@ let ContactService = {
this._db = new ContactDB(myGlobal);
this._db.init(myGlobal);
let countryName = PhoneNumberUtils.getCountryName();
if (Services.prefs.getPrefType("dom.phonenumber.substringmatching." + countryName) == Ci.nsIPrefBranch.PREF_INT) {
if (DEBUG) debug("Enable Substring Matching for Phone Numbers: " + countryName);
let val = Services.prefs.getIntPref("dom.phonenumber.substringmatching." + countryName);
if (val && val > 0) {
this._db.enableSubstringMatching(val);
}
}
this.configureSubstringMatching();
Services.obs.addObserver(this, "profile-before-change", false);
Services.prefs.addObserver("dom.phonenumber.substringmatching", this, false);
Services.prefs.addObserver("ril.lastKnownSimMcc", this, false);
},
observe: function(aSubject, aTopic, aData) {
@ -71,16 +64,23 @@ let ContactService = {
this._db = null;
this._children = null;
this._cursors = null;
} else if (aTopic === 'nsPref:changed' && aData.contains("dom.phonenumber.substringmatching")) {
// We don't fully support changing substringMatching during runtime. This is mostly for testing.
let countryName = PhoneNumberUtils.getCountryName();
if (Services.prefs.getPrefType("dom.phonenumber.substringmatching." + countryName) == Ci.nsIPrefBranch.PREF_INT) {
let val = Services.prefs.getIntPref("dom.phonenumber.substringmatching." + countryName);
if (val && val > 0) {
this._db.enableSubstringMatching(val);
}
} else if (aTopic === 'nsPref:changed' && aData === "ril.lastKnownSimMcc") {
this.configureSubstringMatching();
}
},
configureSubstringMatching: function() {
let countryName = PhoneNumberUtils.getCountryName();
if (Services.prefs.getPrefType("dom.phonenumber.substringmatching." + countryName) == Ci.nsIPrefBranch.PREF_INT) {
let val = Services.prefs.getIntPref("dom.phonenumber.substringmatching." + countryName);
if (val) {
this._db.enableSubstringMatching(val);
return;
}
}
// if we got here, we dont have a substring setting
// for this country, so disable substring matching
this._db.disableSubstringMatching();
},
assertPermission: function(aMessage, aPerm) {

View File

@ -27,6 +27,7 @@ if (SpecialPowers.isMainProcess()) {
var substringLength = 8;
SpecialPowers.setIntPref("dom.phonenumber.substringmatching.BR", substringLength);
SpecialPowers.setCharPref("ril.lastKnownSimMcc", "724");
SpecialPowers.addPermission("contacts-write", true, document);
SpecialPowers.addPermission("contacts-read", true, document);
@ -258,4 +259,4 @@ addLoadEvent(next);
</script>
</pre>
</body>
</html>
</html>

View File

@ -11,7 +11,7 @@ interface nsIDOMMozMobileNetworkInfo;
interface nsIDOMMozMobileCellInfo;
interface nsIDOMMozMobileCFInfo;
[scriptable, builtinclass, uuid(7fd42b7e-8100-4f2b-bc85-858603d499c8)]
[scriptable, builtinclass, uuid(61e5729c-100f-436e-bc20-b7706ec40229)]
interface nsIDOMMozMobileConnection : nsIDOMEventTarget
{
const long ICC_SERVICE_CLASS_VOICE = (1 << 0);
@ -59,14 +59,6 @@ interface nsIDOMMozMobileConnection : nsIDOMEventTarget
readonly attribute DOMString lastKnownNetwork;
readonly attribute DOMString lastKnownHomeNetwork;
/**
* Indicates the number of retries remaining when cardState equals 'pinRequired'
* or 'pukRequired'. 0 denotes the retry count is unavailable.
*
* Value is undefined for other cardState values.
*/
readonly attribute long retryCount;
/**
* Information about the voice connection.
*/
@ -297,7 +289,7 @@ interface nsIDOMMozMobileConnection : nsIDOMEventTarget
[implicit_jscontext] attribute jsval oncfstatechange;
};
[scriptable, uuid(c9d9ff61-a2f0-41cd-b478-9cefa7b31f31)]
[scriptable, uuid(49706beb-a160-40b7-b745-50f62e389a2c)]
interface nsIDOMMozMobileConnectionInfo : nsISupports
{
/**
@ -332,11 +324,6 @@ interface nsIDOMMozMobileConnectionInfo : nsISupports
*/
readonly attribute nsIDOMMozMobileNetworkInfo network;
/**
* Mobile Country Code (MCC) of last known network operator.
*/
readonly attribute DOMString lastKnownMcc;
/**
* Type of connection.
*

View File

@ -30,7 +30,7 @@ interface nsIMobileConnectionListener : nsISupports
* XPCOM component (in the content process) that provides the mobile
* network information.
*/
[scriptable, uuid(477d93f0-c913-11e2-8b8b-0800200c9a66)]
[scriptable, uuid(3fea6ca5-c535-4662-9f42-eb2fc2ae9975)]
interface nsIMobileConnectionProvider : nsISupports
{
/**
@ -41,7 +41,6 @@ interface nsIMobileConnectionProvider : nsISupports
void registerMobileConnectionMsg(in nsIMobileConnectionListener listener);
void unregisterMobileConnectionMsg(in nsIMobileConnectionListener listener);
readonly attribute long retryCount;
readonly attribute nsIDOMMozMobileConnectionInfo voiceConnectionInfo;
readonly attribute nsIDOMMozMobileConnectionInfo dataConnectionInfo;
readonly attribute DOMString networkSelectionMode;

View File

@ -160,17 +160,6 @@ MobileConnection::CheckPermission(const char* type)
return permission == nsIPermissionManager::ALLOW_ACTION;
}
NS_IMETHODIMP
MobileConnection::GetRetryCount(int32_t* retryCount)
{
*retryCount = 0;
if (!mProvider || !CheckPermission("mobileconnection")) {
return NS_OK;
}
return mProvider->GetRetryCount(retryCount);
}
NS_IMETHODIMP
MobileConnection::GetVoice(nsIDOMMozMobileConnectionInfo** voice)
{

View File

@ -36,7 +36,6 @@ function testConnectionInfo() {
is(voice.emergencyCallsOnly, false);
is(voice.roaming, false);
isAndroidNetwork(voice.network);
is(voice.lastKnownMcc, "310");
let data = connection.data;
// data.connected = true means there's an active data call which we
@ -45,7 +44,6 @@ function testConnectionInfo() {
is(data.emergencyCallsOnly, false);
is(data.roaming, false);
isAndroidNetwork(data.network);
is(data.lastKnownMcc, null);
testGetNetworks();
}

View File

@ -24,7 +24,7 @@ XPCOMUtils.defineLazyServiceGetter(this, "mobileConnection",
this.PhoneNumberUtils = {
// 1. See whether we have a network mcc
// 2. If we don't have that, look for the simcard mcc
// 3. TODO: If we don't have that or its 0 (not activated), pick up the last used mcc
// 3. If we don't have that or its 0 (not activated), pick up the last used mcc
// 4. If we don't have, default to some mcc
// mcc for Brasil
@ -36,19 +36,22 @@ this.PhoneNumberUtils = {
#ifdef MOZ_B2G_RIL
// Get network mcc
if (mobileConnection.voiceConnectionInfo &&
mobileConnection.voiceConnectionInfo.network) {
mcc = mobileConnection.voiceConnectionInfo.network.mcc;
let voice = mobileConnection.voiceConnectionInfo;
if (voice && voice.network && voice.network.mcc) {
mcc = voice.network.mcc;
}
// Get SIM mcc
if (!mcc) {
mcc = mobileConnection.iccInfo.mcc;
let iccInfo = mobileConnection.iccInfo;
if (!mcc && iccInfo.mcc) {
mcc = iccInfo.mcc;
}
// Get previous mcc
if (!mcc && mobileConnection.voiceConnectionInfo) {
mcc = mobileConnection.voiceConnectionInfo.lastKnownMcc;
// Attempt to grab last known sim mcc from prefs
if (!mcc) {
try {
mcc = Services.prefs.getCharPref("ril.lastKnownSimMcc");
} catch (e) {}
}
// Set to default mcc

View File

@ -181,7 +181,6 @@ MobileConnectionInfo.prototype = {
emergencyCallsOnly: false,
roaming: false,
network: null,
lastKnownMcc: null,
cell: null,
type: null,
signalStrength: null,
@ -390,7 +389,6 @@ DOMMMIError.prototype = {
function RILContentHelper() {
this.rilContext = {
cardState: RIL.GECKO_CARDSTATE_UNKNOWN,
retryCount: 0,
networkSelectionMode: RIL.GECKO_NETWORK_SELECTION_UNKNOWN,
iccInfo: new IccInfo(),
voiceConnectionInfo: new MobileConnectionInfo(),
@ -482,7 +480,6 @@ RILContentHelper.prototype = {
return;
}
this.rilContext.cardState = rilContext.cardState;
this.rilContext.retryCount = rilContext.retryCount;
this.rilContext.networkSelectionMode = rilContext.networkSelectionMode;
this.updateInfo(rilContext.iccInfo, this.rilContext.iccInfo);
this.updateConnectionInfo(rilContext.voice, this.rilContext.voiceConnectionInfo);
@ -515,11 +512,6 @@ RILContentHelper.prototype = {
return context && context.cardState;
},
get retryCount() {
let context = this.getRilContext();
return context && context.retryCount;
},
get networkSelectionMode() {
let context = this.getRilContext();
return context && context.networkSelectionMode;
@ -1376,7 +1368,6 @@ RILContentHelper.prototype = {
switch (msg.name) {
case "RIL:CardStateChanged": {
let data = msg.json.data;
this.rilContext.retryCount = data.retryCount;
if (this.rilContext.cardState != data.cardState) {
this.rilContext.cardState = data.cardState;
this._deliverEvent("_iccListeners",

View File

@ -637,7 +637,6 @@ function RadioInterface(options) {
this.rilContext = {
radioState: RIL.GECKO_RADIOSTATE_UNAVAILABLE,
cardState: RIL.GECKO_CARDSTATE_UNKNOWN,
retryCount: 0, // TODO: Please see bug 868896
networkSelectionMode: RIL.GECKO_NETWORK_SELECTION_UNKNOWN,
iccInfo: null,
imsi: null,
@ -650,7 +649,6 @@ function RadioInterface(options) {
emergencyCallsOnly: false,
roaming: false,
network: null,
lastKnownMcc: null,
cell: null,
type: null,
signalStrength: null,
@ -659,18 +657,12 @@ function RadioInterface(options) {
emergencyCallsOnly: false,
roaming: false,
network: null,
lastKnownMcc: null,
cell: null,
type: null,
signalStrength: null,
relSignalStrength: null},
};
try {
this.rilContext.voice.lastKnownMcc =
Services.prefs.getCharPref("ril.lastKnownMcc");
} catch (e) {}
this.voicemailInfo = {
number: null,
displayName: null
@ -1346,18 +1338,6 @@ RadioInterface.prototype = {
let data = this.rilContext.data;
if (this.networkChanged(message, voice.network)) {
// Update lastKnownMcc.
if (message.mcc) {
voice.lastKnownMcc = message.mcc;
// Update pref if mcc is changed.
// !voice.network is in case voice.network is still null.
if (!voice.network || voice.network.mcc != message.mcc) {
try {
Services.prefs.setCharPref("ril.lastKnownMcc", message.mcc);
} catch (e) {}
}
}
// Update lastKnownNetwork
if (message.mcc && message.mnc) {
try {
@ -2171,6 +2151,14 @@ RadioInterface.prototype = {
gMessageManager.sendIccMessage("RIL:IccInfoChanged",
this.clientId, message);
// Update lastKnownSimMcc.
if (message.mcc) {
try {
Services.prefs.setCharPref("ril.lastKnownSimMcc",
message.mcc.toString());
} catch (e) {}
}
// Update lastKnownHomeNetwork.
if (message.mcc && message.mnc) {
try {

View File

@ -88,7 +88,7 @@ let RILQUIRKS_SIM_APP_STATE_EXTRA_FIELDS = libcutils.property_get("ro.moz.ril.si
// Needed for call-waiting on Peak device
let RILQUIRKS_EXTRA_UINT32_2ND_CALL = libcutils.property_get("ro.moz.ril.extra_int_2nd_call", "false") == "true";
// On the emulator we support querying the number of lock retries
let RILQUIRKS_HAVE_QUERY_ICC_LOCK_RETRY_COUNT = libcutils.property_get("ro.moz.ril.have_query_icc_lock_retry_count", "false") == "true";
let RILQUIRKS_HAVE_QUERY_ICC_LOCK_RETRY_COUNT = libcutils.property_get("ro.moz.ril.query_icc_count", "false") == "true";
// Marker object.
let PENDING_NETWORK_TYPE = {};

View File

@ -2158,7 +2158,15 @@ class SnowWhiteKiller
public:
SnowWhiteKiller(uint32_t aMaxCount)
{
mObjects.SetCapacity(aMaxCount);
while (true) {
if (mObjects.SetCapacity(aMaxCount)) {
break;
}
if (aMaxCount == 1) {
NS_RUNTIMEABORT("Not enough memory to even delete objects!");
}
aMaxCount /= 2;
}
}
~SnowWhiteKiller()
@ -2181,8 +2189,9 @@ public:
nsCycleCollectionParticipant *cp = aEntry->mParticipant;
CanonicalizeParticipant(&o, &cp);
SnowWhiteObject swo = { o, cp, aEntry->mRefCnt };
mObjects.AppendElement(swo);
aBuffer.Remove(aEntry);
if (mObjects.AppendElement(swo)) {
aBuffer.Remove(aEntry);
}
}
}
@ -2191,7 +2200,7 @@ public:
return mObjects.Length() > 0;
}
private:
nsTArray<SnowWhiteObject> mObjects;
FallibleTArray<SnowWhiteObject> mObjects;
};
class RemoveSkippableVisitor : public SnowWhiteKiller