diff --git a/b2g/app/b2g.js b/b2g/app/b2g.js index 7a742343f4a..54b008a3459 100644 --- a/b2g/app/b2g.js +++ b/b2g/app/b2g.js @@ -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 diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 14614dd8888..65c32c810de 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "20b7d51bd03d385e816b49d6c4b86b8cd59a97fd", + "revision": "4ecf580f46388510b61c13485f331e2269f0d8c2", "repo_path": "/integration/gaia-central" } diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 8f3a431f3bb..be638a742e0 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -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); diff --git a/dom/browser-element/BrowserElementParent.jsm b/dom/browser-element/BrowserElementParent.jsm index 8464d97467f..97b994bee61 100644 --- a/dom/browser-element/BrowserElementParent.jsm +++ b/dom/browser-element/BrowserElementParent.jsm @@ -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': diff --git a/dom/contacts/fallback/ContactDB.jsm b/dom/contacts/fallback/ContactDB.jsm index 9ff4fc2339b..31d4a632e18 100644 --- a/dom/contacts/fallback/ContactDB.jsm +++ b/dom/contacts/fallback/ContactDB.jsm @@ -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); } diff --git a/dom/contacts/fallback/ContactService.jsm b/dom/contacts/fallback/ContactService.jsm index a4a04741a34..a98f7426c6c 100644 --- a/dom/contacts/fallback/ContactService.jsm +++ b/dom/contacts/fallback/ContactService.jsm @@ -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) { diff --git a/dom/contacts/tests/test_contacts_substringmatching.html b/dom/contacts/tests/test_contacts_substringmatching.html index e1105960be6..d55693276be 100644 --- a/dom/contacts/tests/test_contacts_substringmatching.html +++ b/dom/contacts/tests/test_contacts_substringmatching.html @@ -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); - \ No newline at end of file + diff --git a/dom/network/interfaces/nsIDOMMobileConnection.idl b/dom/network/interfaces/nsIDOMMobileConnection.idl index fc9fe2b3f85..bd15abcc60e 100644 --- a/dom/network/interfaces/nsIDOMMobileConnection.idl +++ b/dom/network/interfaces/nsIDOMMobileConnection.idl @@ -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. * diff --git a/dom/network/interfaces/nsIMobileConnectionProvider.idl b/dom/network/interfaces/nsIMobileConnectionProvider.idl index 000d2d42c60..342f184a6ac 100644 --- a/dom/network/interfaces/nsIMobileConnectionProvider.idl +++ b/dom/network/interfaces/nsIMobileConnectionProvider.idl @@ -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; diff --git a/dom/network/src/MobileConnection.cpp b/dom/network/src/MobileConnection.cpp index bf7eb8b51ae..059cf24e422 100644 --- a/dom/network/src/MobileConnection.cpp +++ b/dom/network/src/MobileConnection.cpp @@ -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) { diff --git a/dom/network/tests/marionette/test_mobile_networks.js b/dom/network/tests/marionette/test_mobile_networks.js index 40e0818f4c7..f7f42e4d91e 100644 --- a/dom/network/tests/marionette/test_mobile_networks.js +++ b/dom/network/tests/marionette/test_mobile_networks.js @@ -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(); } diff --git a/dom/phonenumberutils/PhoneNumberUtils.jsm b/dom/phonenumberutils/PhoneNumberUtils.jsm index 5db22f7a5f0..484b6921999 100644 --- a/dom/phonenumberutils/PhoneNumberUtils.jsm +++ b/dom/phonenumberutils/PhoneNumberUtils.jsm @@ -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 diff --git a/dom/system/gonk/RILContentHelper.js b/dom/system/gonk/RILContentHelper.js index cf2e96826dd..2842fa64768 100644 --- a/dom/system/gonk/RILContentHelper.js +++ b/dom/system/gonk/RILContentHelper.js @@ -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", diff --git a/dom/system/gonk/RadioInterfaceLayer.js b/dom/system/gonk/RadioInterfaceLayer.js index d02eaf56f4d..6a0ce8c2082 100644 --- a/dom/system/gonk/RadioInterfaceLayer.js +++ b/dom/system/gonk/RadioInterfaceLayer.js @@ -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 { diff --git a/dom/system/gonk/ril_worker.js b/dom/system/gonk/ril_worker.js index 9352fb99b9f..f077dc60d0e 100644 --- a/dom/system/gonk/ril_worker.js +++ b/dom/system/gonk/ril_worker.js @@ -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 = {}; diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp index 03626fa2d78..63eaf1a2a8c 100644 --- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -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 mObjects; + FallibleTArray mObjects; }; class RemoveSkippableVisitor : public SnowWhiteKiller