Merge mozilla-central and mozilla-inbound

This commit is contained in:
Ehsan Akhgari 2011-09-26 16:42:20 -04:00
commit 20508f2820
4 changed files with 18 additions and 93 deletions

View File

@ -62,7 +62,7 @@ anp_typeface_createFromName(const char name[], ANPTypefaceStyle aStyle)
ANPTypeface* tf = new ANPTypeface;
gfxAndroidPlatform * p = (gfxAndroidPlatform*)gfxPlatform::GetPlatform();
nsRefPtr<gfxFont> font = gfxFT2Font::GetOrMakeFont(NS_ConvertASCIItoUTF16(name), &style);
tf->mFont = font.forget();
font.forget(&tf->mFont);
if (tf->mFont) {
++tf->mRefCnt;
}

View File

@ -40,7 +40,6 @@ const Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/LightweightThemeManager.jsm");
// When modifying the payload in incompatible ways, please bump this version number
const PAYLOAD_VERSION = 1;
@ -221,54 +220,6 @@ TelemetryPing.prototype = {
h.add(val);
},
/**
* Descriptive metadata
*
* @param reason
* The reason for the telemetry ping, this will be included in the
* returned metadata,
* @return The metadata as a JS object
*/
getMetadata: function getMetadata(reason) {
let ai = Services.appinfo;
let ret = {
reason: reason,
OS: ai.OS,
appID: ai.ID,
appVersion: ai.version,
appName: ai.name,
appBuildID: ai.appBuildID,
platformBuildID: ai.platformBuildID,
};
// sysinfo fields are not always available, get what we can.
let sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2);
let fields = ["cpucount", "memsize", "arch", "version", "device", "manufacturer", "hardware"];
for each (let field in fields) {
let value;
try {
value = sysInfo.getProperty(field);
} catch (e) {
continue
}
if (field == "memsize") {
// Send RAM size in megabytes. Rounding because sysinfo doesn't
// always provide RAM in multiples of 1024.
value = Math.round(value / 1024 / 1024)
}
ret[field] = value
}
let theme = LightweightThemeManager.currentTheme;
if (theme)
ret.persona = theme.id;
if (this._addons)
ret.addons = this._addons;
return ret;
},
/**
* Pull values from about:memory into corresponding histograms
*/
@ -335,11 +286,10 @@ TelemetryPing.prototype = {
this.gatherMemory();
let payload = {
ver: PAYLOAD_VERSION,
info: this.getMetadata(reason),
info: getMetadata(reason),
simpleMeasurements: getSimpleMeasurements(),
histograms: getHistograms()
};
let isTestPing = (reason == "test-ping");
// Generate a unique id once per session so the server can cope with duplicate submissions.
// Use a deterministic url for testing.
@ -441,9 +391,6 @@ TelemetryPing.prototype = {
var server = this._server;
switch (aTopic) {
case "Add-ons":
this._addons = aData;
break;
case "profile-after-change":
this.setup();
break;

View File

@ -10,7 +10,6 @@
do_load_httpd_js();
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/LightweightThemeManager.jsm");
const PATH = "/submit/telemetry/test-ping";
const SERVER = "http://localhost:4444";
@ -22,7 +21,6 @@ const BinaryInputStream = Components.Constructor(
"setInputStream");
var httpserver = new nsHttpServer();
var gFinished = false;
function telemetry_ping () {
const TelemetryPing = Cc["@mozilla.org/base/telemetry-ping;1"].getService(Ci.nsIObserver);
@ -48,12 +46,27 @@ function telemetryObserver(aSubject, aTopic, aData) {
telemetry_ping();
}
function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
Services.obs.addObserver(nonexistentServerObserver, "telemetry-test-xhr-complete", false);
telemetry_ping();
// spin the event loop
do_test_pending();
}
function readBytesFromInputStream(inputStream, count) {
if (!count) {
count = inputStream.available();
}
return new BinaryInputStream(inputStream).readBytes(count);
}
function checkHistograms(request, response) {
// do not need the http server anymore
httpserver.stop(do_test_finished);
let s = request.bodyInputStream
let payload = Cc["@mozilla.org/dom/json;1"].createInstance(Ci.nsIJSON)
.decodeFromStream(s, s.available())
.decode(readBytesFromInputStream(s))
do_check_eq(request.getHeader("content-type"), "application/json; charset=UTF-8");
do_check_true(payload.simpleMeasurements.uptime >= 0)
@ -89,7 +102,6 @@ function checkHistograms(request, response) {
let tc = payload.histograms[TELEMETRY_SUCCESS]
do_check_eq(uneval(tc),
uneval(expected_tc));
gFinished = true;
}
// copied from toolkit/mozapps/extensions/test/xpcshell/head_addons.js
@ -140,34 +152,3 @@ function createAppInfo(id, name, version, platformVersion) {
registrar.registerFactory(XULAPPINFO_CID, "XULAppInfo",
XULAPPINFO_CONTRACTID, XULAppInfoFactory);
}
function dummyTheme(id) {
return {
id: id,
name: Math.random().toString(),
headerURL: "http://lwttest.invalid/a.png",
footerURL: "http://lwttest.invalid/b.png",
textcolor: Math.random().toString(),
accentcolor: Math.random().toString()
};
}
function run_test() {
// Addon manager needs a profile directory
do_get_profile();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
// try to make LightweightThemeManager do stuff
let gInternalManager = Cc["@mozilla.org/addons/integration;1"]
.getService(Ci.nsIObserver)
.QueryInterface(Ci.nsITimerCallback);
gInternalManager.observe(null, "addons-startup", null);
LightweightThemeManager.currentTheme = dummyTheme("1234");
Services.obs.addObserver(nonexistentServerObserver, "telemetry-test-xhr-complete", false);
telemetry_ping();
// spin the event loop
do_test_pending();
// ensure that test runs to completion
do_register_cleanup(function () do_check_true(gFinished))
}

View File

@ -1754,9 +1754,6 @@ var XPIProvider = {
Services.appinfo.annotateCrashReport("Add-ons", data);
}
catch (e) { }
const TelemetryPing = Cc["@mozilla.org/base/telemetry-ping;1"].getService(Ci.nsIObserver);
TelemetryPing.observe(null, "Add-ons", data);
},
/**