Backout bug 742805, 742778, 742775, 740974, 742765, 742761, 742092, 722197 for leaks.

This commit is contained in:
Ms2ger 2012-04-06 13:10:30 +02:00
parent 452d6c8f14
commit 67cc85db28
14 changed files with 28 additions and 132 deletions

View File

@ -30,14 +30,8 @@ XPCOMUtils.defineLazyGetter(Services, 'idle', function() {
});
XPCOMUtils.defineLazyGetter(Services, 'audioManager', function() {
#ifdef MOZ_WIDGET_GONK
return Cc['@mozilla.org/telephony/audiomanager;1']
.getService(Ci.nsIAudioManager);
#else
return {
"masterVolume": 0
};
#endif
});
XPCOMUtils.defineLazyServiceGetter(Services, 'fm', function() {
@ -85,12 +79,11 @@ var shell = {
return Services.prefs.getCharPref('browser.homescreenURL');
},
start: function shell_start() {
start: function shell_init() {
let homeURL = this.homeURL;
if (!homeURL) {
let msg = 'Fatal error during startup: No homescreen found: try setting B2G_HOMESCREEN';
alert(msg);
return;
return alert(msg);
}
['keydown', 'keypress', 'keyup'].forEach((function listenKey(type) {
@ -107,7 +100,9 @@ var shell = {
// a specific value when the device starts. This way the front-end
// can display a notification when the volume change and show a volume
// level modified from this point.
Services.audioManager.masterVolume = 0.5;
try {
Services.audioManager.masterVolume = 0.5;
} catch(e) {}
let domains = "";
try {
@ -302,7 +297,6 @@ var shell = {
}
}
}
let wakeLockHandler = function wakeLockHandler(topic, state) {
// Turn off the screen when no one needs the it or all of them are
// invisible, otherwise turn the screen on. Note that the CPU
@ -319,11 +313,7 @@ var shell = {
}
}
}
let idleTimeout = Services.prefs.getIntPref("power.screen.timeout");
if (!('mozSettings' in navigator))
return;
let request = navigator.mozSettings.getLock().get("power.screen.timeout");
request.onsuccess = function onSuccess() {
idleTimeout = request.result["power.screen.timeout"] || idleTimeout;
@ -332,14 +322,12 @@ var shell = {
power.addWakeLockListener(wakeLockHandler);
}
}
request.onerror = function onError() {
if (idleTimeout) {
Services.idle.addIdleObserver(idleHandler, idleTimeout);
power.addWakeLockListener(wakeLockHandler);
}
}
// XXX We may override other's callback here, but this is the only
// user of mozSettings in shell.js at this moment.
navigator.mozSettings.onsettingchange = function onSettingChange(e) {
@ -437,7 +425,7 @@ Services.obs.addObserver(function onConsoleAPILogEvent(subject, topic, data) {
serverSocket.asyncListen(listener);
})();
var CustomEventManager = {
CustomEventManager = {
init: function custevt_init() {
window.addEventListener("ContentStart", (function(evt) {
content.addEventListener("mozContentEvent", this, false, true);
@ -461,7 +449,7 @@ var CustomEventManager = {
}
}
var AlertsHelper = {
AlertsHelper = {
_listeners: {},
_count: 0,
@ -492,7 +480,7 @@ var AlertsHelper = {
}
}
var WebappsHelper = {
WebappsHelper = {
_installers: {},
_count: 0,

View File

@ -19,11 +19,14 @@
#ifndef MOZ_TOUCH
<script type="application/javascript" src="chrome://browser/content/touch.js"/>
#endif
#ifndef MOZ_WIDGET_GONK
<script type="application/javascript" src="chrome://browser/content/httpd.js"/>
#endif
<browser id="homescreen"
type="content-primary"
flex="1"
style="overflow: hidden;"
src="data:text/html;charset=utf-8,%3C!DOCTYPE html>%3Cbody style='background:black;'>"/>
src="data:text/html,%3C!DOCTYPE html>%3Cbody style='background:black;'>"/>
</window>

View File

@ -27,35 +27,12 @@ ContentPermissionPrompt.prototype = {
return false;
},
_id: 0,
prompt: function(request) {
// returns true if the request was handled
if (this.handleExistingPermission(request))
return;
let browser = Services.wm.getMostRecentWindow("navigator:browser");
let content = browser.content;
if (!content)
return;
let requestId = this._id++;
content.addEventListener("mozContentEvent", function contentEvent(evt) {
if (evt.detail.id != requestId)
return;
content.removeEventListener(evt.type, contentEvent);
if (evt.detail.type == "permission-allow") {
request.allow();
return;
}
request.cancel();
});
browser.shell.sendEvent(browser.content, "mozChromeEvent", {
"type": "permission-prompt", "permission": request.type,
"id": requestId, "url": request.uri.spec
});
// TODO : show UI to grant or deny permission
},
classID: Components.ID("{8c719f03-afe0-4aac-91ff-6c215895d467}"),

View File

@ -64,7 +64,7 @@ SettingsDB.prototype = {
}
let self = this;
debug("try to open database:" + DB_NAME + " " + DB_VERSION + " " + this.db);
debug("try to open database:" + DB_NAME + " " + DB_VERSION + " " + this._indexedDB);
let req = aGlobal.mozIndexedDB.open(DB_NAME, DB_VERSION);
req.onsuccess = function (event) {
debug("Opened database:", DB_NAME, DB_VERSION);

View File

@ -11,7 +11,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
const RIL_SMSDATABASESERVICE_CONTRACTID = "@mozilla.org/sms/rilsmsdatabaseservice;1";
const RIL_SMSDATABASESERVICE_CID = Components.ID("{a1fa610c-eb6c-4ac2-878f-b005d5e89249}");
const DEBUG = false;
const DEBUG = true;
const DB_NAME = "sms";
const DB_VERSION = 1;
const STORE_NAME = "sms";

View File

@ -1923,7 +1923,7 @@ RIL[REQUEST_VOICE_REGISTRATION_STATE] = function REQUEST_VOICE_REGISTRATION_STAT
}
let state = Buf.readStringList();
if (DEBUG) debug("voice registration state: " + state);
debug("voice registration state: " + state);
this._processVoiceRegistrationState(state);
};
RIL[REQUEST_DATA_REGISTRATION_STATE] = function REQUEST_DATA_REGISTRATION_STATE(length, options) {
@ -2047,11 +2047,9 @@ RIL[REQUEST_SIM_IO] = function REQUEST_SIM_IO(length, options) {
if (sw1 != ICC_STATUS_NORMAL_ENDING) {
// See GSM11.11, TS 51.011 clause 9.4, and ISO 7816-4 for the error
// description.
if (DEBUG) {
debug("ICC I/O Error EF id = " + options.fileid.toString(16) +
" command = " + options.command.toString(16) +
"(" + sw1.toString(16) + "/" + sw2.toString(16) + ")");
}
debug("ICC I/O Error EF id = " + options.fileid.toString(16) +
" command = " + options.command.toString(16) +
"(" + sw1.toString(16) + "/" + sw2.toString(16) + ")");
return;
}

View File

@ -12,7 +12,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
const DEBUG = false; // set to false to suppress debug messages
const DEBUG = true; // set to false to suppress debug messages
const DOMWIFIMANAGER_CONTRACTID = "@mozilla.org/wifimanager;1";
const DOMWIFIMANAGER_CID = Components.ID("{2cf775a7-1837-410c-9e26-323c42e076da}");

View File

@ -44,7 +44,7 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
const DEBUG = false; // set to false to suppress debug messages
const DEBUG = true; // set to false to suppress debug messages
const WIFIWORKER_CONTRACTID = "@mozilla.org/wifi/worker;1";
const WIFIWORKER_CID = Components.ID("{a14e8977-d259-433a-a88d-58dd44657e5b}");

View File

@ -13,17 +13,6 @@ var hwaddr = ctypes.uint8_t.array(6)();
var len = ctypes.size_t();
var ints = ctypes.int.array(8)();
const DEBUG = false;
let debug;
if (DEBUG) {
debug = function (s) {
dump("-*- WifiWorker component: " + s + "\n");
};
} else {
debug = function (s) {};
}
// TODO: consolidate with implementation in systemlibs.js
let libcutils = (function () {
let library = ctypes.open("libcutils.so");
@ -78,7 +67,7 @@ self.onmessage = function(e) {
postMessage({ id: id, status: ret });
break;
case "ifc_configure":
debug("WIFI: data: " + uneval(data) + "\n");
dump("WIFI: data: " + uneval(data) + "\n");
var ret = libnetutils.ifc_configure(data.ifname, data.ipaddr, data.mask, data.gateway, data.dns1, data.dns2);
postMessage({ id: id, status: ret });
break;
@ -104,7 +93,7 @@ self.onmessage = function(e) {
default:
var f = libhardware_legacy[cmd] || libnetutils[cmd];
var ret = f();
debug("WIFI: " + cmd + " returned: " + ret);
dump("WIFI: " + cmd + " returned: " + ret);
postMessage({ id: id, status: ret });
break;
}

View File

@ -229,9 +229,7 @@ RilClient::OpenSocket()
}
if (connect(mSocket.mFd, (struct sockaddr *) &addr, alen) < 0) {
#if defined(MOZ_WIDGET_GONK)
LOG("Cannot open socket for RIL!\n");
#endif
close(mSocket.mFd);
return false;
}

View File

@ -57,7 +57,6 @@
#include "prio.h"
#include "plstr.h"
#include "nsIOService.h"
#include "nsCharSeparatedTokenizer.h"
#include "mozilla/FunctionTimer.h"
@ -70,7 +69,6 @@ static const char kPrefEnableIDN[] = "network.enableIDN";
static const char kPrefIPv4OnlyDomains[] = "network.dns.ipv4OnlyDomains";
static const char kPrefDisableIPv6[] = "network.dns.disableIPv6";
static const char kPrefDisablePrefetch[] = "network.dns.disablePrefetch";
static const char kPrefDnsLocalDomains[] = "network.dns.localDomains";
//-----------------------------------------------------------------------------
@ -408,7 +406,6 @@ nsDNSService::Init()
int proxyType = nsIProtocolProxyService::PROXYCONFIG_DIRECT;
nsAdoptingCString ipv4OnlyDomains;
nsAdoptingCString localDomains;
// read prefs
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
@ -425,7 +422,6 @@ nsDNSService::Init()
prefs->GetBoolPref(kPrefEnableIDN, &enableIDN);
prefs->GetBoolPref(kPrefDisableIPv6, &disableIPv6);
prefs->GetCharPref(kPrefIPv4OnlyDomains, getter_Copies(ipv4OnlyDomains));
prefs->GetCharPref(kPrefDnsLocalDomains, getter_Copies(localDomains));
prefs->GetBoolPref(kPrefDisablePrefetch, &disablePrefetch);
// If a manual proxy is in use, disable prefetch implicitly
@ -435,8 +431,6 @@ nsDNSService::Init()
if (mFirstTime) {
mFirstTime = false;
mLocalDomains.Init();
// register as prefs observer
if (prefs) {
prefs->AddObserver(kPrefDnsCacheEntries, this, false);
@ -444,7 +438,6 @@ nsDNSService::Init()
prefs->AddObserver(kPrefDnsCacheGrace, this, false);
prefs->AddObserver(kPrefEnableIDN, this, false);
prefs->AddObserver(kPrefIPv4OnlyDomains, this, false);
prefs->AddObserver(kPrefDnsLocalDomains, this, false);
prefs->AddObserver(kPrefDisableIPv6, this, false);
prefs->AddObserver(kPrefDisablePrefetch, this, false);
@ -482,19 +475,6 @@ nsDNSService::Init()
// Disable prefetching either by explicit preference or if a manual proxy is configured
mDisablePrefetch = disablePrefetch || (proxyType == nsIProtocolProxyService::PROXYCONFIG_MANUAL);
mLocalDomains.Clear();
if (localDomains) {
nsAdoptingString domains;
domains.AssignASCII(nsDependentCString(localDomains).get());
nsCharSeparatedTokenizer tokenizer(domains, ',',
nsCharSeparatedTokenizerTemplate<>::SEPARATOR_OPTIONAL);
while (tokenizer.hasMoreTokens()) {
const nsSubstring& domain = tokenizer.nextToken();
mLocalDomains.PutEntry(nsDependentCString(NS_ConvertUTF16toUTF8(domain).get()));
}
}
}
return rv;
}
@ -597,7 +577,6 @@ nsDNSService::AsyncResolve(const nsACString &hostname,
// simultaneous shutdown!!
nsRefPtr<nsHostResolver> res;
nsCOMPtr<nsIIDNService> idn;
bool localDomain = false;
{
MutexAutoLock lock(mLock);
@ -606,22 +585,16 @@ nsDNSService::AsyncResolve(const nsACString &hostname,
res = mResolver;
idn = mIDN;
localDomain = mLocalDomains.GetEntry(hostname);
}
if (!res)
return NS_ERROR_OFFLINE;
const nsACString *hostPtr = &hostname;
static const nsCString localhost((const char *) "localhost");
if (localDomain) {
hostPtr = &localhost;
}
nsresult rv;
nsCAutoString hostACE;
if (idn && !IsASCII(*hostPtr)) {
if (NS_SUCCEEDED(idn->ConvertUTF8toACE(*hostPtr, hostACE)))
if (idn && !IsASCII(hostname)) {
if (NS_SUCCEEDED(idn->ConvertUTF8toACE(hostname, hostACE)))
hostPtr = &hostACE;
}
@ -692,26 +665,19 @@ nsDNSService::Resolve(const nsACString &hostname,
// simultaneous shutdown!!
nsRefPtr<nsHostResolver> res;
nsCOMPtr<nsIIDNService> idn;
bool localDomain = false;
{
MutexAutoLock lock(mLock);
res = mResolver;
idn = mIDN;
localDomain = mLocalDomains.GetEntry(hostname);
}
NS_ENSURE_TRUE(res, NS_ERROR_OFFLINE);
const nsACString *hostPtr = &hostname;
static const nsCString localhost((const char *) "localhost");
if (localDomain) {
hostPtr = &localhost;
}
nsresult rv;
nsCAutoString hostACE;
if (idn && !IsASCII(*hostPtr)) {
if (NS_SUCCEEDED(idn->ConvertUTF8toACE(*hostPtr, hostACE)))
if (idn && !IsASCII(hostname)) {
if (NS_SUCCEEDED(idn->ConvertUTF8toACE(hostname, hostACE)))
hostPtr = &hostACE;
}

View File

@ -40,8 +40,6 @@
#include "nsHostResolver.h"
#include "nsAutoPtr.h"
#include "nsString.h"
#include "nsTHashtable.h"
#include "nsHashKeys.h"
#include "mozilla/Mutex.h"
class nsDNSService : public nsPIDNSService
@ -72,5 +70,4 @@ private:
bool mDisableIPv6;
bool mDisablePrefetch;
bool mFirstTime;
nsTHashtable<nsCStringHashKey> mLocalDomains;
};

View File

@ -1,27 +1,7 @@
function run_test() {
check_localhost();
check_local_redirect();
}
function check_localhost() {
var dns = Components.classes["@mozilla.org/network/dns-service;1"]
.getService(Components.interfaces.nsIDNSService);
var rec = dns.resolve("localhost", 0);
var answer = rec.getNextAddrAsString();
do_check_true(answer == "127.0.0.1" || answer == "::1");
}
function check_local_redirect() {
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
prefs.setCharPref("network.dns.localDomains", "local.vingtetun.org");
var dns = Components.classes["@mozilla.org/network/dns-service;1"]
.getService(Components.interfaces.nsIDNSService);
var rec = dns.resolve("local.vingtetun.org", 0);
var answer = rec.getNextAddrAsString();
do_check_true(answer == "127.0.0.1" || answer == "::1");
prefs.clearUserPref("network.dns.localDomains");
}

View File

@ -225,7 +225,7 @@
<setter>
<![CDATA[
if (val == this.currentSet)
return val;
return;
var ids = (val == "__empty") ? [] : val.split(",");