merge fx-team to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2014-06-26 15:33:24 +02:00
Родитель 12e04d45a1 d023cfad45
Коммит 5de1cd29b1
43 изменённых файлов: 566 добавлений и 503 удалений

Просмотреть файл

@ -3,7 +3,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
ifndef .PYMAKE
ifeq (,$(MAKE_VERSION)) ifeq (,$(MAKE_VERSION))
$(error GNU Make is required) $(error GNU Make is required)
endif endif
@ -11,7 +10,6 @@ make_min_ver := 3.81
ifneq ($(make_min_ver),$(firstword $(sort $(make_min_ver) $(MAKE_VERSION)))) ifneq ($(make_min_ver),$(firstword $(sort $(make_min_ver) $(MAKE_VERSION))))
$(error GNU Make $(make_min_ver) or higher is required) $(error GNU Make $(make_min_ver) or higher is required)
endif endif
endif
export TOPLEVEL_BUILD := 1 export TOPLEVEL_BUILD := 1

Просмотреть файл

@ -4,13 +4,6 @@
GAIA_PATH := gaia/profile GAIA_PATH := gaia/profile
ifdef .PYMAKE
# For use of GNU make in pymake builds.
GAIA_MAKE=$(GMAKE)
else
GAIA_MAKE=$(MAKE)
endif
# This is needed to avoid making run-b2g depend on mozglue # This is needed to avoid making run-b2g depend on mozglue
WRAP_LDFLAGS := WRAP_LDFLAGS :=
@ -19,6 +12,6 @@ GENERATED_DIRS += $(DIST)/bin/$(GAIA_PATH)
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk
libs:: libs::
+$(GAIA_MAKE) -j1 -C $(GAIADIR) clean +$(MAKE) -j1 -C $(GAIADIR) clean
+$(GAIA_MAKE) -j1 -C $(GAIADIR) profile +$(MAKE) -j1 -C $(GAIADIR) profile
(cd $(GAIADIR)/profile && tar $(TAR_CREATE_FLAGS) - .) | (cd $(abspath $(DIST))/bin/$(GAIA_PATH) && tar -xf -) (cd $(GAIADIR)/profile && tar $(TAR_CREATE_FLAGS) - .) | (cd $(abspath $(DIST))/bin/$(GAIA_PATH) && tar -xf -)

Просмотреть файл

@ -90,6 +90,7 @@ SocialUI = {
if (!this._initialized) { if (!this._initialized) {
return; return;
} }
SocialSidebar.saveWindowState();
Services.obs.removeObserver(this, "social:ambient-notification-changed"); Services.obs.removeObserver(this, "social:ambient-notification-changed");
Services.obs.removeObserver(this, "social:profile-changed"); Services.obs.removeObserver(this, "social:profile-changed");
@ -710,6 +711,11 @@ SocialSidebar = {
}, },
restoreWindowState: function() { restoreWindowState: function() {
// Window state is used to allow different sidebar providers in each window.
// We also store the provider used in a pref as the default sidebar to
// maintain that state for users who do not restore window state. The
// existence of social.sidebar.provider means the sidebar is open with that
// provider.
this._initialized = true; this._initialized = true;
if (!this.canShow) if (!this.canShow)
return; return;
@ -737,13 +743,22 @@ SocialSidebar = {
let data = SessionStore.getWindowValue(window, "socialSidebar"); let data = SessionStore.getWindowValue(window, "socialSidebar");
// if this window doesn't have it's own state, use the state from the opener // if this window doesn't have it's own state, use the state from the opener
if (!data && window.opener && !window.opener.closed) { if (!data && window.opener && !window.opener.closed) {
try {
data = SessionStore.getWindowValue(window.opener, "socialSidebar"); data = SessionStore.getWindowValue(window.opener, "socialSidebar");
} catch(e) {
// Window is not tracked, which happens on osx if the window is opened
// from the hidden window. That happens when you close the last window
// without quiting firefox, then open a new window.
}
} }
if (data) { if (data) {
data = JSON.parse(data); data = JSON.parse(data);
document.getElementById("social-sidebar-browser").setAttribute("origin", data.origin); document.getElementById("social-sidebar-browser").setAttribute("origin", data.origin);
if (!data.hidden) if (!data.hidden)
this.show(data.origin); this.show(data.origin);
} else if (Services.prefs.prefHasUserValue("social.sidebar.provider")) {
// no window state, use the global state if it is available
this.show(Services.prefs.getCharPref("social.sidebar.provider"));
} }
}, },
@ -754,7 +769,18 @@ SocialSidebar = {
"hidden": broadcaster.hidden, "hidden": broadcaster.hidden,
"origin": sidebarOrigin "origin": sidebarOrigin
}; };
// Save a global state for users who do not restore state.
if (broadcaster.hidden)
Services.prefs.clearUserPref("social.sidebar.provider");
else
Services.prefs.setCharPref("social.sidebar.provider", sidebarOrigin);
try {
SessionStore.setWindowValue(window, "socialSidebar", JSON.stringify(data)); SessionStore.setWindowValue(window, "socialSidebar", JSON.stringify(data));
} catch(e) {
// window not tracked during uninit
}
}, },
setSidebarVisibilityState: function(aEnabled) { setSidebarVisibilityState: function(aEnabled) {

Просмотреть файл

@ -3,15 +3,13 @@
"use strict"; "use strict";
function test() { add_task(function* test_healthreport_search_recording() {
waitForExplicitFinish();
try { try {
let cm = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager); let cm = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
cm.getCategoryEntry("healthreport-js-provider-default", "SearchesProvider"); cm.getCategoryEntry("healthreport-js-provider-default", "SearchesProvider");
} catch (ex) { } catch (ex) {
// Health Report disabled, or no SearchesProvider. // Health Report disabled, or no SearchesProvider.
ok(true, "Firefox Health Report is not enabled."); ok(true, "Firefox Health Report is not enabled.");
finish();
return; return;
} }
@ -20,12 +18,12 @@ function test() {
.wrappedJSObject .wrappedJSObject
.healthReporter; .healthReporter;
ok(reporter, "Health Reporter available."); ok(reporter, "Health Reporter available.");
reporter.onInit().then(function onInit() { yield reporter.onInit();
let provider = reporter.getProvider("org.mozilla.searches"); let provider = reporter.getProvider("org.mozilla.searches");
ok(provider, "Searches provider is available."); ok(provider, "Searches provider is available.");
let m = provider.getMeasurement("counts", 3); let m = provider.getMeasurement("counts", 3);
m.getValues().then(function onData(data) { let data = yield m.getValues();
let now = new Date(); let now = new Date();
let oldCount = 0; let oldCount = 0;
@ -47,45 +45,36 @@ function test() {
getSubmission(searchStr, "", "keyword").uri.spec; getSubmission(searchStr, "", "keyword").uri.spec;
// Expect the search URL to load but stop it as soon as it starts. // Expect the search URL to load but stop it as soon as it starts.
let loadPromise = waitForDocLoadAndStopIt(expectedURL); let docLoadPromise = waitForDocLoadAndStopIt(expectedURL);
// Meanwhile, poll for the new measurement.
let count = 0;
let measurementDeferred = Promise.defer();
function getNewMeasurement() {
if (count++ >= 10) {
ok(false, "Timed out waiting for new measurement");
measurementDeferred.resolve();
return;
}
m.getValues().then(function onData(data) {
if (data.days.hasDay(now)) {
let day = data.days.getDay(now);
if (day.has(field)) {
let newCount = day.get(field);
if (newCount > oldCount) {
is(newCount, oldCount + 1,
"Exactly one search has been recorded.");
measurementDeferred.resolve();
return;
}
}
}
executeSoon(getNewMeasurement);
});
}
executeSoon(getNewMeasurement);
// Trigger the search. // Trigger the search.
gURLBar.value = searchStr; gURLBar.value = searchStr;
gURLBar.handleCommand(); gURLBar.handleCommand();
// Wait for the page load and new measurement. yield docLoadPromise;
Promise.all([loadPromise, measurementDeferred.promise]).then(() => {
gBrowser.removeTab(tab);
finish();
});
});
});
}
data = yield m.getValues();
ok(data.days.hasDay(now), "We have a search measurement for today.");
let day = data.days.getDay(now);
ok(day.has(field), "Have a search count for the urlbar.");
let newCount = day.get(field);
is(newCount, oldCount + 1, "We recorded one new search.");
// We should record the default search engine if Telemetry is enabled.
let oldTelemetry = Services.prefs.getBoolPref("toolkit.telemetry.enabled");
Services.prefs.setBoolPref("toolkit.telemetry.enabled", true);
m = provider.getMeasurement("engines", 1);
yield provider.collectDailyData();
data = yield m.getValues();
ok(data.days.hasDay(now), "Have engines data when Telemetry is enabled.");
day = data.days.getDay(now);
ok(day.has("default"), "We have default engine data.");
is(day.get("default"), "google", "The default engine is reported properly.");
// Restore.
Services.prefs.setBoolPref("toolkit.telemetry.enabled", oldTelemetry);
gBrowser.removeTab(tab);
});

Просмотреть файл

@ -30,17 +30,20 @@ function openWindowAndWaitForInit(parentWin, callback) {
}, topic, false); }, topic, false);
} }
function closeWindow(w, cb) {
waitForNotification("domwindowclosed", cb);
w.close();
}
function closeOneWindow(cb) { function closeOneWindow(cb) {
let w = createdWindows.pop(); let w = createdWindows.pop();
if (!w) { if (!w || w.closed) {
cb(); cb();
return; return;
} }
waitForCondition(function() w.closed, closeWindow(w, function() {
function() {
info("window closed, " + createdWindows.length + " windows left");
closeOneWindow(cb); closeOneWindow(cb);
}, "window did not close"); });
w.close(); w.close();
} }
@ -126,6 +129,51 @@ let tests = {
}, cbnext); }, cbnext);
}, },
testGlobalState: function(cbnext) {
setManifestPref("social.manifest.test", manifest);
ok(!SocialSidebar.opened, "sidebar is closed initially");
ok(!Services.prefs.prefHasUserValue("social.sidebar.provider"), "global state unset");
// mimick no session state in opener so we exercise the global state via pref
SessionStore.deleteWindowValue(window, "socialSidebar");
ok(!SessionStore.getWindowValue(window, "socialSidebar"), "window state unset");
SocialService.addProvider(manifest, function() {
openWindowAndWaitForInit(window, function(w1) {
w1.SocialSidebar.show();
waitForCondition(function() w1.SocialSidebar.opened,
function() {
ok(Services.prefs.prefHasUserValue("social.sidebar.provider"), "global state set");
ok(!SocialSidebar.opened, "1. main sidebar is still closed");
ok(w1.SocialSidebar.opened, "1. window sidebar is open");
closeWindow(w1, function() {
// this time, the global state should cause the sidebar to be opened
// in the new window
openWindowAndWaitForInit(window, function(w1) {
ok(!SocialSidebar.opened, "2. main sidebar is still closed");
ok(w1.SocialSidebar.opened, "2. window sidebar is open");
w1.SocialSidebar.hide();
ok(!w1.SocialSidebar.opened, "2. window sidebar is closed");
ok(!Services.prefs.prefHasUserValue("social.sidebar.provider"), "2. global state unset");
// global state should now be no sidebar gets opened on new window
closeWindow(w1, function() {
ok(!Services.prefs.prefHasUserValue("social.sidebar.provider"), "3. global state unset");
ok(!SocialSidebar.opened, "3. main sidebar is still closed");
openWindowAndWaitForInit(window, function(w1) {
ok(!Services.prefs.prefHasUserValue("social.sidebar.provider"), "4. global state unset");
ok(!SocialSidebar.opened, "4. main sidebar is still closed");
ok(!w1.SocialSidebar.opened, "4. window sidebar is closed");
SocialService.removeProvider(manifest.origin, function() {
Services.prefs.clearUserPref("social.manifest.test");
cbnext();
});
});
});
});
});
});
});
});
},
// Check per window sidebar functionality, including migration from using // Check per window sidebar functionality, including migration from using
// prefs to using session state, and state inheritance of windows (new windows // prefs to using session state, and state inheritance of windows (new windows
// inherit state from the opener). // inherit state from the opener).

Просмотреть файл

@ -597,6 +597,7 @@ Experiments.Experiments.prototype = {
active: experiment.enabled, active: experiment.enabled,
endDate: experiment.endDate.getTime(), endDate: experiment.endDate.getTime(),
detailURL: experiment._homepageURL, detailURL: experiment._homepageURL,
branch: experiment.branch,
}); });
} }
@ -628,6 +629,54 @@ Experiments.Experiments.prototype = {
return info; return info;
}, },
/**
* Experiment "branch" support. If an experiment has multiple branches, it
* can record the branch with the experiment system and it will
* automatically be included in data reporting (FHR/telemetry payloads).
*/
/**
* Set the experiment branch for the specified experiment ID.
* @returns Promise<>
*/
setExperimentBranch: Task.async(function*(id, branchstr) {
yield this._loadTask;
let e = this._experiments.get(id);
if (!e) {
throw new Error("Experiment not found");
}
e.branch = String(branchstr);
this._dirty = true;
Services.obs.notifyObservers(null, EXPERIMENTS_CHANGED_TOPIC, null);
yield this._run();
}),
/**
* Get the branch of the specified experiment. If the experiment is unknown,
* throws an error.
*
* @param id The ID of the experiment. Pass null for the currently running
* experiment.
* @returns Promise<string|null>
* @throws Error if the specified experiment ID is unknown, or if there is no
* current experiment.
*/
getExperimentBranch: Task.async(function*(id=null) {
yield this._loadTask;
let e;
if (id) {
e = this._experiments.get(id);
if (!e) {
throw new Error("Experiment not found");
}
} else {
e = this._getActiveExperiment();
if (e === null) {
throw new Error("No active experiment");
}
}
return e.branch;
}),
/** /**
* Determine whether another date has the same UTC day as now(). * Determine whether another date has the same UTC day as now().
*/ */
@ -1013,6 +1062,17 @@ Experiments.Experiments.prototype = {
return e.id; return e.id;
}, },
getActiveExperimentBranch: function() {
if (!this._experiments) {
return null;
}
let e = this._getActiveExperiment();
if (!e) {
return null;
}
return e.branch;
},
_getActiveExperiment: function () { _getActiveExperiment: function () {
let enabled = [experiment for ([,experiment] of this._experiments) if (experiment._enabled)]; let enabled = [experiment for ([,experiment] of this._experiments) if (experiment._enabled)];
@ -1258,6 +1318,8 @@ Experiments.ExperimentEntry = function (policy) {
this._lastChangedDate = null; this._lastChangedDate = null;
// Has this experiment failed to activate before? // Has this experiment failed to activate before?
this._failedStart = false; this._failedStart = false;
// The experiment branch
this._branch = null;
// We grab these from the addon after download. // We grab these from the addon after download.
this._name = null; this._name = null;
@ -1306,6 +1368,7 @@ Experiments.ExperimentEntry.prototype = {
"_addonId", "_addonId",
"_startDate", "_startDate",
"_endDate", "_endDate",
"_branch",
]), ]),
DATE_KEYS: new Set([ DATE_KEYS: new Set([
@ -1313,6 +1376,10 @@ Experiments.ExperimentEntry.prototype = {
"_endDate", "_endDate",
]), ]),
UPGRADE_KEYS: new Map([
["_branch", null],
]),
ADDON_CHANGE_NONE: 0, ADDON_CHANGE_NONE: 0,
ADDON_CHANGE_INSTALL: 1, ADDON_CHANGE_INSTALL: 1,
ADDON_CHANGE_UNINSTALL: 2, ADDON_CHANGE_UNINSTALL: 2,
@ -1344,6 +1411,14 @@ Experiments.ExperimentEntry.prototype = {
return this._manifestData.id; return this._manifestData.id;
}, },
get branch() {
return this._branch;
},
set branch(v) {
this._branch = v;
},
get startDate() { get startDate() {
return this._startDate; return this._startDate;
}, },
@ -1376,6 +1451,12 @@ Experiments.ExperimentEntry.prototype = {
* @return boolean Whether initialization succeeded. * @return boolean Whether initialization succeeded.
*/ */
initFromCacheData: function (data) { initFromCacheData: function (data) {
for (let [key, dval] of this.UPGRADE_KEYS) {
if (!(key in data)) {
data.set(key, dval);
}
}
for (let key of this.SERIALIZE_KEYS) { for (let key of this.SERIALIZE_KEYS) {
if (!(key in data) && !this.DATE_KEYS.has(key)) { if (!(key in data) && !this.DATE_KEYS.has(key)) {
this._log.error("initFromCacheData() - missing required key " + key); this._log.error("initFromCacheData() - missing required key " + key);
@ -1970,6 +2051,9 @@ let stripDateToMidnight = function (d) {
function ExperimentsLastActiveMeasurement1() { function ExperimentsLastActiveMeasurement1() {
Metrics.Measurement.call(this); Metrics.Measurement.call(this);
} }
function ExperimentsLastActiveMeasurement2() {
Metrics.Measurement.call(this);
}
const FIELD_DAILY_LAST_TEXT = {type: Metrics.Storage.FIELD_DAILY_LAST_TEXT}; const FIELD_DAILY_LAST_TEXT = {type: Metrics.Storage.FIELD_DAILY_LAST_TEXT};
@ -1983,6 +2067,17 @@ ExperimentsLastActiveMeasurement1.prototype = Object.freeze({
lastActive: FIELD_DAILY_LAST_TEXT, lastActive: FIELD_DAILY_LAST_TEXT,
} }
}); });
ExperimentsLastActiveMeasurement2.prototype = Object.freeze({
__proto__: Metrics.Measurement.prototype,
name: "info",
version: 2,
fields: {
lastActive: FIELD_DAILY_LAST_TEXT,
lastActiveBranch: FIELD_DAILY_LAST_TEXT,
}
});
this.ExperimentsProvider = function () { this.ExperimentsProvider = function () {
Metrics.Provider.call(this); Metrics.Provider.call(this);
@ -1997,6 +2092,7 @@ ExperimentsProvider.prototype = Object.freeze({
measurementTypes: [ measurementTypes: [
ExperimentsLastActiveMeasurement1, ExperimentsLastActiveMeasurement1,
ExperimentsLastActiveMeasurement2,
], ],
_OBSERVERS: [ _OBSERVERS: [
@ -2040,8 +2136,8 @@ ExperimentsProvider.prototype = Object.freeze({
this._experiments = Experiments.instance(); this._experiments = Experiments.instance();
} }
let m = this.getMeasurement(ExperimentsLastActiveMeasurement1.prototype.name, let m = this.getMeasurement(ExperimentsLastActiveMeasurement2.prototype.name,
ExperimentsLastActiveMeasurement1.prototype.version); ExperimentsLastActiveMeasurement2.prototype.version);
return this.enqueueStorageOperation(() => { return this.enqueueStorageOperation(() => {
return Task.spawn(function* recordTask() { return Task.spawn(function* recordTask() {
@ -2055,6 +2151,11 @@ ExperimentsProvider.prototype = Object.freeze({
this._log.info("Recording last active experiment: " + todayActive.id); this._log.info("Recording last active experiment: " + todayActive.id);
yield m.setDailyLastText("lastActive", todayActive.id, yield m.setDailyLastText("lastActive", todayActive.id,
this._experiments._policy.now()); this._experiments._policy.now());
let branch = todayActive.branch;
if (branch) {
yield m.setDailyLastText("lastActiveBranch", branch,
this._experiments._policy.now());
}
}.bind(this)); }.bind(this));
}); });
}, },

Просмотреть файл

@ -76,6 +76,7 @@ const FAKE_EXPERIMENTS_1 = [
description: "experiment 1", description: "experiment 1",
active: true, active: true,
detailUrl: "https://dummy/experiment1", detailUrl: "https://dummy/experiment1",
branch: "foo",
}, },
]; ];
@ -87,6 +88,7 @@ const FAKE_EXPERIMENTS_2 = [
active: false, active: false,
endDate: new Date(2014, 2, 11, 2, 4, 35, 42).getTime(), endDate: new Date(2014, 2, 11, 2, 4, 35, 42).getTime(),
detailUrl: "https://dummy/experiment2", detailUrl: "https://dummy/experiment2",
branch: null,
}, },
{ {
id: "id1", id: "id1",
@ -95,6 +97,7 @@ const FAKE_EXPERIMENTS_2 = [
active: false, active: false,
endDate: new Date(2014, 2, 10, 0, 0, 0, 0).getTime(), endDate: new Date(2014, 2, 10, 0, 0, 0, 0).getTime(),
detailURL: "https://dummy/experiment1", detailURL: "https://dummy/experiment1",
branch: null,
}, },
]; ];

Просмотреть файл

@ -171,6 +171,14 @@ add_task(function* test_getExperiments() {
let addons = yield getExperimentAddons(); let addons = yield getExperimentAddons();
Assert.equal(addons.length, 0, "Precondition: No experiment add-ons are installed."); Assert.equal(addons.length, 0, "Precondition: No experiment add-ons are installed.");
try {
let b = yield experiments.getExperimentBranch();
Assert.ok(false, "getExperimentBranch should fail with no experiment");
}
catch (e) {
Assert.ok(true, "getExperimentBranch correctly threw");
}
// Trigger update, clock set for experiment 1 to start. // Trigger update, clock set for experiment 1 to start.
now = futureDate(startDate1, 5 * MS_IN_ONE_DAY); now = futureDate(startDate1, 5 * MS_IN_ONE_DAY);
@ -196,6 +204,19 @@ add_task(function* test_getExperiments() {
"Property " + k + " should match reference data."); "Property " + k + " should match reference data.");
} }
let b = yield experiments.getExperimentBranch();
Assert.strictEqual(b, null, "getExperimentBranch should return null by default");
b = yield experiments.getExperimentBranch(EXPERIMENT1_ID);
Assert.strictEqual(b, null, "getExperimentsBranch should return null (with id)");
yield experiments.setExperimentBranch(EXPERIMENT1_ID, "foo");
b = yield experiments.getExperimentBranch();
Assert.strictEqual(b, "foo", "getExperimentsBranch should return the set value");
Assert.equal(observerFireCount, ++expectedObserverFireCount,
"Experiments observer should have been called.");
Assert.equal(gTimerScheduleOffset, 10 * MS_IN_ONE_DAY, Assert.equal(gTimerScheduleOffset, 10 * MS_IN_ONE_DAY,
"Experiment re-evaluation should have been scheduled correctly."); "Experiment re-evaluation should have been scheduled correctly.");

Просмотреть файл

@ -190,6 +190,13 @@ add_task(function* test_cache() {
checkExperimentListsEqual(experimentListData.slice(1), list); checkExperimentListsEqual(experimentListData.slice(1), list);
checkExperimentSerializations(experiments._experiments.values()); checkExperimentSerializations(experiments._experiments.values());
let branch = yield experiments.getExperimentBranch(EXPERIMENT1_ID);
Assert.strictEqual(branch, null);
yield experiments.setExperimentBranch(EXPERIMENT1_ID, "testbranch");
branch = yield experiments.getExperimentBranch(EXPERIMENT1_ID);
Assert.strictEqual(branch, "testbranch");
// Re-init, clock set for experiment 1 to stop. // Re-init, clock set for experiment 1 to stop.
now = futureDate(now, 20 * MS_IN_ONE_DAY); now = futureDate(now, 20 * MS_IN_ONE_DAY);
@ -207,6 +214,9 @@ add_task(function* test_cache() {
checkExperimentListsEqual(experimentListData.slice(1), list); checkExperimentListsEqual(experimentListData.slice(1), list);
checkExperimentSerializations(experiments._experiments.values()); checkExperimentSerializations(experiments._experiments.values());
branch = yield experiments.getExperimentBranch(EXPERIMENT1_ID);
Assert.strictEqual(branch, "testbranch");
// Re-init, clock set for experiment 2 to start. // Re-init, clock set for experiment 2 to start.
now = futureDate(startDates[1], 20 * MS_IN_ONE_DAY); now = futureDate(startDates[1], 20 * MS_IN_ONE_DAY);

Просмотреть файл

@ -9,6 +9,8 @@ Cu.import("resource:///modules/experiments/Experiments.jsm");
Cu.import("resource://testing-common/services/healthreport/utils.jsm"); Cu.import("resource://testing-common/services/healthreport/utils.jsm");
Cu.import("resource://testing-common/services-common/logging.js"); Cu.import("resource://testing-common/services-common/logging.js");
const kMeasurementVersion = 2;
function getStorageAndProvider(name) { function getStorageAndProvider(name) {
return Task.spawn(function* get() { return Task.spawn(function* get() {
let storage = yield Metrics.Storage(name); let storage = yield Metrics.Storage(name);
@ -53,7 +55,7 @@ add_task(function* test_collect() {
// Initial state should not report anything. // Initial state should not report anything.
yield provider.collectDailyData(); yield provider.collectDailyData();
let m = provider.getMeasurement("info", 1); let m = provider.getMeasurement("info", kMeasurementVersion);
let values = yield m.getValues(); let values = yield m.getValues();
Assert.equal(values.days.size, 0, "Have no data if no experiments known."); Assert.equal(values.days.size, 0, "Have no data if no experiments known.");
@ -69,6 +71,8 @@ add_task(function* test_collect() {
let day = values.days.getDay(now); let day = values.days.getDay(now);
Assert.ok(day.has("lastActive"), "Has lastActive field."); Assert.ok(day.has("lastActive"), "Has lastActive field.");
Assert.equal(day.get("lastActive"), "id2", "Last active ID is sane."); Assert.equal(day.get("lastActive"), "id2", "Last active ID is sane.");
Assert.strictEqual(day.get("lastActiveBranch"), undefined,
"no branch should be set yet");
// Making an experiment active replaces the lastActive value. // Making an experiment active replaces the lastActive value.
replaceExperiments(provider._experiments, FAKE_EXPERIMENTS_1); replaceExperiments(provider._experiments, FAKE_EXPERIMENTS_1);
@ -76,6 +80,8 @@ add_task(function* test_collect() {
values = yield m.getValues(); values = yield m.getValues();
day = values.days.getDay(now); day = values.days.getDay(now);
Assert.equal(day.get("lastActive"), "id1", "Last active ID is the active experiment."); Assert.equal(day.get("lastActive"), "id1", "Last active ID is the active experiment.");
Assert.equal(day.get("lastActiveBranch"), "foo",
"Experiment branch should be visible");
// And make sure the observer works. // And make sure the observer works.
replaceExperiments(provider._experiments, FAKE_EXPERIMENTS_2); replaceExperiments(provider._experiments, FAKE_EXPERIMENTS_2);

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -185,9 +185,7 @@ dnl A high level macro for selecting compiler options.
AC_DEFUN([MOZ_COMPILER_OPTS], AC_DEFUN([MOZ_COMPILER_OPTS],
[ [
if test "${MOZ_PSEUDO_DERECURSE-unset}" = unset; then if test "${MOZ_PSEUDO_DERECURSE-unset}" = unset; then
dnl Don't enable on pymake, because of bug 918652. Bug 912979 is an annoyance MOZ_PSEUDO_DERECURSE=1
dnl with pymake, too.
MOZ_PSEUDO_DERECURSE=no-pymake
fi fi
MOZ_DEBUGGING_OPTS MOZ_DEBUGGING_OPTS
@ -246,6 +244,13 @@ if test "$GNU_CC" -a -n "$MOZ_FORCE_GOLD"; then
fi fi
fi fi
fi fi
if test "$GNU_CC"; then
if $CC $LDFLAGS -Wl,--version 2>&1 | grep -q "GNU ld"; then
LD_IS_BFD=1
fi
fi
AC_SUBST([LD_IS_BFD])
if test "$GNU_CC"; then if test "$GNU_CC"; then
if test -z "$DEVELOPER_OPTIONS"; then if test -z "$DEVELOPER_OPTIONS"; then

Просмотреть файл

@ -88,22 +88,9 @@ GB is likely entering the point of diminishing returns.
This cause impacts both clobber and incremental builds. This cause impacts both clobber and incremental builds.
You are building with pymake
============================
Pymake is slower than GNU make. One reason is Python is generally slower
than C. The build system maintainers are consistently looking at
optimizing pymake. However, it is death by a thousand cuts.
This cause impacts both clobber and incremental builds.
You are building on Windows You are building on Windows
=========================== ===========================
Builds on Windows are slow for a few reasons. First, Windows builds use
pymake, not GNU make (because of compatibility issues with GNU make).
But, there are other sources of slowness.
New processes on Windows are about a magnitude slower to spawn than on New processes on Windows are about a magnitude slower to spawn than on
UNIX-y systems such as Linux. This is because Windows has optimized new UNIX-y systems such as Linux. This is because Windows has optimized new
threads while the \*NIX platforms typically optimize new processes. threads while the \*NIX platforms typically optimize new processes.

Просмотреть файл

@ -46,8 +46,7 @@ except KeyError:
try: try:
proc = subprocess.Popen([binscope_path, "/target", binary_path, proc = subprocess.Popen([binscope_path, "/target", binary_path,
"/output", log_file_path, "/sympath", symbol_path, "/output", log_file_path, "/sympath", symbol_path,
"/c", "ATLVersionCheck", "/c", "ATLVulnCheck", "/c", "FunctionPointersCheck", "/c", "ATLVersionCheck", "/c", "ATLVulnCheck", "/c", "SharedSectionCheck", "/c", "APTCACheck", "/c", "NXCheck",
"/c", "SharedSectionCheck", "/c", "APTCACheck", "/c", "NXCheck",
"/c", "GSCheck", "/c", "GSFunctionSafeBuffersCheck", "/c", "GSFriendlyInitCheck", "/c", "GSCheck", "/c", "GSFunctionSafeBuffersCheck", "/c", "GSFriendlyInitCheck",
"/c", "CompilerVersionCheck", "/c", "SafeSEHCheck", "/c", "SNCheck", "/c", "CompilerVersionCheck", "/c", "SafeSEHCheck", "/c", "SNCheck",
"/c", "DBCheck"], stdout=subprocess.PIPE) "/c", "DBCheck"], stdout=subprocess.PIPE)

Просмотреть файл

@ -145,13 +145,6 @@ endif
ifndef MOZ_OBJDIR ifndef MOZ_OBJDIR
MOZ_OBJDIR = obj-$(CONFIG_GUESS) MOZ_OBJDIR = obj-$(CONFIG_GUESS)
else
# On Windows Pymake builds check MOZ_OBJDIR doesn't start with "/"
ifneq (,$(findstring mingw,$(CONFIG_GUESS)))
ifeq (1_a,$(.PYMAKE)_$(firstword a$(subst /, ,$(MOZ_OBJDIR))))
$(error For Windows Pymake builds, MOZ_OBJDIR must be a Windows [and not MSYS] style path.)
endif
endif
endif endif
ifdef MOZ_BUILD_PROJECTS ifdef MOZ_BUILD_PROJECTS

Просмотреть файл

@ -194,16 +194,6 @@ endif
CONFIG_TOOLS = $(MOZ_BUILD_ROOT)/config CONFIG_TOOLS = $(MOZ_BUILD_ROOT)/config
AUTOCONF_TOOLS = $(topsrcdir)/build/autoconf AUTOCONF_TOOLS = $(topsrcdir)/build/autoconf
# Disable MOZ_PSEUDO_DERECURSE when it contains no-pymake and we're running
# pymake. This can be removed when no-pymake is removed from the default in
# build/autoconf/compiler-opts.m4.
ifdef .PYMAKE
comma = ,
ifneq (,$(filter no-pymake,$(subst $(comma), ,$(MOZ_PSEUDO_DERECURSE))))
MOZ_PSEUDO_DERECURSE :=
endif
endif
# Disable MOZ_PSEUDO_DERECURSE on PGO builds until it's fixed. # Disable MOZ_PSEUDO_DERECURSE on PGO builds until it's fixed.
ifneq (,$(MOZ_PROFILE_USE)$(MOZ_PROFILE_GENERATE)) ifneq (,$(MOZ_PROFILE_USE)$(MOZ_PROFILE_GENERATE))
MOZ_PSEUDO_DERECURSE := MOZ_PSEUDO_DERECURSE :=
@ -238,10 +228,6 @@ MKDIR ?= mkdir
SLEEP ?= sleep SLEEP ?= sleep
TOUCH ?= touch TOUCH ?= touch
ifdef .PYMAKE
PYCOMMANDPATH += $(PYTHON_SITE_PACKAGES)
endif
PYTHON_PATH = $(PYTHON) $(topsrcdir)/config/pythonpath.py PYTHON_PATH = $(PYTHON) $(topsrcdir)/config/pythonpath.py
# determine debug-related options # determine debug-related options
@ -720,9 +706,6 @@ endif # NSINSTALL_BIN
ifeq (,$(CROSS_COMPILE)$(filter-out WINNT, $(OS_ARCH))) ifeq (,$(CROSS_COMPILE)$(filter-out WINNT, $(OS_ARCH)))
INSTALL = $(NSINSTALL) -t INSTALL = $(NSINSTALL) -t
ifdef .PYMAKE
install_cmd = $(NSINSTALL_NATIVECMD) -t $(1)
endif # .PYMAKE
else else
@ -839,6 +822,7 @@ endif
define CHECK_BINARY define CHECK_BINARY
$(call CHECK_STDCXX,$(1)) $(call CHECK_STDCXX,$(1))
$(call CHECK_TEXTREL,$(1)) $(call CHECK_TEXTREL,$(1))
$(call LOCAL_CHECKS,$(1))
endef endef
# autoconf.mk sets OBJ_SUFFIX to an error to avoid use before including # autoconf.mk sets OBJ_SUFFIX to an error to avoid use before including

Просмотреть файл

@ -27,8 +27,4 @@ core_winabspath = $(error core_winabspath is unsupported)
# #
# libs:: # libs::
# $(call py_action,purge_manifests,_build_manifests/purge/foo.manifest) # $(call py_action,purge_manifests,_build_manifests/purge/foo.manifest)
ifdef .PYMAKE
py_action = %mozbuild.action.$(1) main $(2)
else
py_action = $(PYTHON) -m mozbuild.action.$(1) $(2) py_action = $(PYTHON) -m mozbuild.action.$(1) $(2)
endif

Просмотреть файл

@ -35,23 +35,8 @@ endif
USE_AUTOTARGETS_MK = 1 USE_AUTOTARGETS_MK = 1
include $(topsrcdir)/config/makefiles/makeutils.mk include $(topsrcdir)/config/makefiles/makeutils.mk
# Only build with Pymake (not GNU make) on Windows.
ifeq ($(HOST_OS_ARCH),WINNT)
ifndef L10NBASEDIR
ifndef .PYMAKE
$(error Pymake is required to build on Windows. Run |./mach build| to \
automatically use pymake or invoke pymake directly via \
|python build/pymake/make.py|.)
endif
endif
endif
ifdef REBUILD_CHECK ifdef REBUILD_CHECK
ifdef .PYMAKE
REPORT_BUILD = @%rebuild_check rebuild_check $@ $^
else
REPORT_BUILD = $(info $(shell $(PYTHON) $(MOZILLA_DIR)/config/rebuild_check.py $@ $^)) REPORT_BUILD = $(info $(shell $(PYTHON) $(MOZILLA_DIR)/config/rebuild_check.py $@ $^))
endif
else else
REPORT_BUILD = $(info $(notdir $@)) REPORT_BUILD = $(info $(notdir $@))
endif endif
@ -66,15 +51,11 @@ endif
# ELOG prints out failed command when building silently (gmake -s). Pymake # ELOG prints out failed command when building silently (gmake -s). Pymake
# prints out failed commands anyway, so ELOG just makes things worse by # prints out failed commands anyway, so ELOG just makes things worse by
# forcing shell invocations. # forcing shell invocations.
ifndef .PYMAKE
ifneq (,$(findstring s, $(filter-out --%, $(MAKEFLAGS)))) ifneq (,$(findstring s, $(filter-out --%, $(MAKEFLAGS))))
ELOG := $(EXEC) sh $(BUILD_TOOLS)/print-failed-commands.sh ELOG := $(EXEC) sh $(BUILD_TOOLS)/print-failed-commands.sh
else else
ELOG := ELOG :=
endif # -s endif # -s
else
ELOG :=
endif # ifndef .PYMAKE
_VPATH_SRCS = $(abspath $<) _VPATH_SRCS = $(abspath $<)
@ -238,7 +219,7 @@ endif
COMPILE_CFLAGS += $(COMPILE_PDB_FLAG) COMPILE_CFLAGS += $(COMPILE_PDB_FLAG)
COMPILE_CXXFLAGS += $(COMPILE_PDB_FLAG) COMPILE_CXXFLAGS += $(COMPILE_PDB_FLAG)
LINK_PDBFILE = $(basename $(@F)).pdb LINK_PDBFILE ?= $(basename $(@F)).pdb
ifdef MOZ_DEBUG ifdef MOZ_DEBUG
CODFILE=$(basename $(@F)).cod CODFILE=$(basename $(@F)).cod
endif endif
@ -1142,9 +1123,7 @@ else
endif endif
# Cancel GNU make built-in implicit rules # Cancel GNU make built-in implicit rules
ifndef .PYMAKE
MAKEFLAGS += -r MAKEFLAGS += -r
endif
ifneq (,$(filter WINNT,$(OS_ARCH))) ifneq (,$(filter WINNT,$(OS_ARCH)))
SEP := ; SEP := ;

Просмотреть файл

@ -22,7 +22,6 @@ tgts =\
$(NULL) $(NULL)
export MAKE export MAKE
export .PYMAKE
##------------------_## ##------------------_##
##---] TARGETS [---## ##---] TARGETS [---##

Просмотреть файл

@ -44,32 +44,24 @@ include $(topsrcdir)/config/rules.mk
ifdef ENABLE_INTL_API ifdef ENABLE_INTL_API
ifndef MOZ_NATIVE_ICU ifndef MOZ_NATIVE_ICU
ifdef .PYMAKE
ICU_MAKE = $(GMAKE)
else
ICU_MAKE = $(MAKE)
endif
default:: buildicu default:: buildicu
# - ICU requires GNU make according to its readme.html. pymake can't be used
# because it doesn't support order only dependencies.
# - Force ICU to use the standard suffix for object files because expandlibs # - Force ICU to use the standard suffix for object files because expandlibs
# will discard all files with a non-standard suffix (bug 857450). # will discard all files with a non-standard suffix (bug 857450).
# - Options for genrb: -k strict parsing; -R omit collation tailoring rules. # - Options for genrb: -k strict parsing; -R omit collation tailoring rules.
buildicu:: buildicu::
# ICU's build system is full of races, so force non-parallel build. # ICU's build system is full of races, so force non-parallel build.
ifdef CROSS_COMPILE ifdef CROSS_COMPILE
+$(ICU_MAKE) -j1 -C host STATIC_O=$(OBJ_SUFFIX) GENRBOPTS='-k -R -C' +$(MAKE) -j1 -C host STATIC_O=$(OBJ_SUFFIX) GENRBOPTS='-k -R -C'
endif endif
+$(ICU_MAKE) -j1 -C target STATIC_O=$(OBJ_SUFFIX) GENRBOPTS='-k -R' +$(MAKE) -j1 -C target STATIC_O=$(OBJ_SUFFIX) GENRBOPTS='-k -R'
$(ICU_LIB_RENAME) $(ICU_LIB_RENAME)
distclean clean:: distclean clean::
ifdef CROSS_COMPILE ifdef CROSS_COMPILE
+$(ICU_MAKE) -C host $@ STATIC_O=$(OBJ_SUFFIX) +$(MAKE) -C host $@ STATIC_O=$(OBJ_SUFFIX)
endif endif
+$(ICU_MAKE) -C target $@ STATIC_O=$(OBJ_SUFFIX) +$(MAKE) -C target $@ STATIC_O=$(OBJ_SUFFIX)
endif endif
endif endif

Просмотреть файл

@ -4,7 +4,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
ifndef .PYMAKE
ifeq (,$(MAKE_VERSION)) ifeq (,$(MAKE_VERSION))
$(error GNU Make is required) $(error GNU Make is required)
endif endif
@ -12,7 +11,6 @@ make_min_ver := 3.81
ifneq ($(make_min_ver),$(firstword $(sort $(make_min_ver) $(MAKE_VERSION)))) ifneq ($(make_min_ver),$(firstword $(sort $(make_min_ver) $(MAKE_VERSION))))
$(error GNU Make $(make_min_ver) or higher is required) $(error GNU Make $(make_min_ver) or higher is required)
endif endif
endif
TOPLEVEL_BUILD := 1 TOPLEVEL_BUILD := 1

Просмотреть файл

@ -5,6 +5,7 @@
package org.mozilla.gecko; package org.mozilla.gecko;
import org.mozilla.gecko.widget.GeckoPopupMenu; import org.mozilla.gecko.widget.GeckoPopupMenu;
import org.mozilla.gecko.menu.GeckoMenuItem;
import android.view.Gravity; import android.view.Gravity;
import android.view.Menu; import android.view.Menu;
@ -99,7 +100,7 @@ class ActionModeCompat implements GeckoPopupMenu.OnMenuItemClickListener,
/* GeckoPopupMenu.onMenuItemLongClickListener */ /* GeckoPopupMenu.onMenuItemLongClickListener */
@Override @Override
public boolean onMenuItemLongClick(MenuItem item) { public boolean onMenuItemLongClick(MenuItem item) {
showTooltip(item); showTooltip((GeckoMenuItem) item);
return true; return true;
} }
@ -109,7 +110,7 @@ class ActionModeCompat implements GeckoPopupMenu.OnMenuItemClickListener,
mPresenter.endActionModeCompat(); mPresenter.endActionModeCompat();
} }
private void showTooltip(MenuItem item) { private void showTooltip(GeckoMenuItem item) {
// Computes the tooltip toast screen position (shown when long-tapping the menu item) with regards to the // Computes the tooltip toast screen position (shown when long-tapping the menu item) with regards to the
// menu item's position (i.e below the item and slightly to the left) // menu item's position (i.e below the item and slightly to the left)
int[] location = new int[2]; int[] location = new int[2];

Просмотреть файл

@ -758,12 +758,17 @@ public class BrowserApp extends GeckoApp
if (!TextUtils.isEmpty(text)) { if (!TextUtils.isEmpty(text)) {
Tabs.getInstance().loadUrl(text); Tabs.getInstance().loadUrl(text);
Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.CONTEXT_MENU); Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.CONTEXT_MENU);
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.CONTEXT_MENU, "pasteandgo");
} }
return true; return true;
} }
if (itemId == R.id.site_settings) { if (itemId == R.id.site_settings) {
// This can be selected from either the browser menu or the contextmenu, depending on the size and version (v11+) of the phone.
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Permissions:Get", null)); GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Permissions:Get", null));
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.CONTEXT_MENU, "site_settings");
}
return true; return true;
} }
@ -771,11 +776,13 @@ public class BrowserApp extends GeckoApp
String text = Clipboard.getText(); String text = Clipboard.getText();
if (!TextUtils.isEmpty(text)) { if (!TextUtils.isEmpty(text)) {
enterEditingMode(text); enterEditingMode(text);
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.CONTEXT_MENU, "paste");
} }
return true; return true;
} }
if (itemId == R.id.subscribe) { if (itemId == R.id.subscribe) {
// This can be selected from either the browser menu or the contextmenu, depending on the size and version (v11+) of the phone.
Tab tab = Tabs.getInstance().getSelectedTab(); Tab tab = Tabs.getInstance().getSelectedTab();
if (tab != null && tab.hasFeeds()) { if (tab != null && tab.hasFeeds()) {
JSONObject args = new JSONObject(); JSONObject args = new JSONObject();
@ -785,6 +792,9 @@ public class BrowserApp extends GeckoApp
Log.e(LOGTAG, "error building json arguments"); Log.e(LOGTAG, "error building json arguments");
} }
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Feeds:Subscribe", args.toString())); GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Feeds:Subscribe", args.toString()));
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.CONTEXT_MENU, "subscribe");
}
} }
return true; return true;
} }
@ -815,6 +825,7 @@ public class BrowserApp extends GeckoApp
String url = tab.getURL(); String url = tab.getURL();
if (url != null) { if (url != null) {
Clipboard.setText(url); Clipboard.setText(url);
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.CONTEXT_MENU, "copyurl");
} }
} }
return true; return true;

Просмотреть файл

@ -518,7 +518,8 @@ var SelectionHandler = {
id: "selectall_action", id: "selectall_action",
icon: "drawable://ab_select_all", icon: "drawable://ab_select_all",
action: function(aElement) { action: function(aElement) {
SelectionHandler.startSelection(aElement) SelectionHandler.startSelection(aElement);
UITelemetry.addEvent("action.1", "actionbar", null, "select_all");
}, },
order: 5, order: 5,
selector: { selector: {
@ -541,6 +542,7 @@ var SelectionHandler = {
// copySelection closes the selection. Show a caret where we just cut the text. // copySelection closes the selection. Show a caret where we just cut the text.
SelectionHandler.attachCaret(aElement); SelectionHandler.attachCaret(aElement);
UITelemetry.addEvent("action.1", "actionbar", null, "cut");
}, },
order: 4, order: 4,
selector: { selector: {
@ -557,6 +559,7 @@ var SelectionHandler = {
icon: "drawable://ab_copy", icon: "drawable://ab_copy",
action: function() { action: function() {
SelectionHandler.copySelection(); SelectionHandler.copySelection();
UITelemetry.addEvent("action.1", "actionbar", null, "copy");
}, },
order: 3, order: 3,
selector: { selector: {
@ -581,6 +584,7 @@ var SelectionHandler = {
target.editor.paste(Ci.nsIClipboard.kGlobalClipboard); target.editor.paste(Ci.nsIClipboard.kGlobalClipboard);
target.focus(); target.focus();
SelectionHandler._closeSelection(); SelectionHandler._closeSelection();
UITelemetry.addEvent("action.1", "actionbar", null, "paste");
} }
}, },
order: 2, order: 2,
@ -601,6 +605,7 @@ var SelectionHandler = {
icon: "drawable://ic_menu_share", icon: "drawable://ic_menu_share",
action: function() { action: function() {
SelectionHandler.shareSelection(); SelectionHandler.shareSelection();
UITelemetry.addEvent("action.1", "actionbar", null, "share");
}, },
selector: { selector: {
matches: function() { matches: function() {
@ -618,6 +623,7 @@ var SelectionHandler = {
action: function() { action: function() {
SelectionHandler.searchSelection(); SelectionHandler.searchSelection();
SelectionHandler._closeSelection(); SelectionHandler._closeSelection();
UITelemetry.addEvent("action.1", "actionbar", null, "search");
}, },
order: 1, order: 1,
selector: { selector: {
@ -633,6 +639,7 @@ var SelectionHandler = {
icon: "drawable://phone", icon: "drawable://phone",
action: function() { action: function() {
SelectionHandler.callSelection(); SelectionHandler.callSelection();
UITelemetry.addEvent("action.1", "actionbar", null, "call");
}, },
order: 1, order: 1,
selector: { selector: {

Просмотреть файл

@ -434,9 +434,7 @@ class MozbuildObject(ProcessExecutionMixin):
args.append('-s') args.append('-s')
# Print entering/leaving directory messages. Some consumers look at # Print entering/leaving directory messages. Some consumers look at
# these to measure progress. Ideally, we'd do everything with pymake # these to measure progress.
# and use hooks in its API. Unfortunately, it doesn't provide that
# feature... yet.
if print_directory: if print_directory:
args.append('-w') args.append('-w')

Просмотреть файл

@ -460,11 +460,6 @@ $(addprefix export-,$(NSS_DIRS)): export-%: private_export-%
$(addprefix private_export-,$(NSS_DIRS)): EXTRA_GMAKE_FLAGS = $(addprefix private_export-,$(NSS_DIRS)): EXTRA_GMAKE_FLAGS =
$(addprefix private_export-,$(NSS_DIRS)): private_export-%: $(addprefix private_export-,$(NSS_DIRS)): private_export-%:
# Work around bug #836228 in pymake
ifdef .PYMAKE
$(foreach p,libs export private_export,$(addprefix $(p)-,$(NSS_DIRS))): *=$(subst $(NULL) $(NULL),-,$(wordlist 2,$(words $(subst -, ,$@)),$(subst -, ,$@)))
endif
$(foreach p,libs export private_export,$(addprefix $(p)-,$(NSS_DIRS))): $(foreach p,libs export private_export,$(addprefix $(p)-,$(NSS_DIRS))):
$(DEFAULT_GMAKE_ENV) $(MAKE) -C $(NSS_SRCDIR)/security/$* $(@:-$*=) $(DEFAULT_GMAKE_FLAGS) $(DEFAULT_GMAKE_ENV) $(MAKE) -C $(NSS_SRCDIR)/security/$* $(@:-$*=) $(DEFAULT_GMAKE_FLAGS)

Просмотреть файл

@ -1402,6 +1402,36 @@ Example
"google.urlbar": 7 "google.urlbar": 7
}, },
org.mozilla.searches.engines
----------------------------
This measurement contains information about search engines.
Version 1
^^^^^^^^^
This version debuted with Firefox 31 on desktop. It contains the
following properties:
default
Daily string identifier or name of the default search engine provider.
This field will only be collected if Telemetry is enabled. If
Telemetry is enabled and then later disabled, this field may
disappear from future days in the payload.
The special value ``NONE`` could occur if there is no default search
engine.
The special value ``UNDEFINED`` could occur if a default search
engine exists but its identifier could not be determined.
This field's contents are
``Services.search.defaultEngine.identifier`` (if defined) or
``"other-"`` + ``Services.search.defaultEngine.name`` if not.
In other words, search engines without an ``.identifier``
are prefixed with ``other-``.
org.mozilla.sync.sync org.mozilla.sync.sync
--------------------- ---------------------
@ -1639,13 +1669,22 @@ lastActive
ID of the final Telemetry Experiment that is active on a given day, if any. ID of the final Telemetry Experiment that is active on a given day, if any.
Version 2
^^^^^^^^^
Adds an additional optional property:
lastActiveBranch
If the experiment uses branches, the branch identifier string.
Example Example
^^^^^^^ ^^^^^^^
:: ::
"org.mozilla.experiments.info": { "org.mozilla.experiments.info": {
"_v": 1, "_v": 2,
"lastActive": "some.experiment.id" "lastActive": "some.experiment.id",
"lastActiveBranch": "control"
} }

Просмотреть файл

@ -55,10 +55,15 @@ const LAST_NUMERIC_FIELD = {type: Metrics.Storage.FIELD_LAST_NUMERIC};
const LAST_TEXT_FIELD = {type: Metrics.Storage.FIELD_LAST_TEXT}; const LAST_TEXT_FIELD = {type: Metrics.Storage.FIELD_LAST_TEXT};
const DAILY_DISCRETE_NUMERIC_FIELD = {type: Metrics.Storage.FIELD_DAILY_DISCRETE_NUMERIC}; const DAILY_DISCRETE_NUMERIC_FIELD = {type: Metrics.Storage.FIELD_DAILY_DISCRETE_NUMERIC};
const DAILY_LAST_NUMERIC_FIELD = {type: Metrics.Storage.FIELD_DAILY_LAST_NUMERIC}; const DAILY_LAST_NUMERIC_FIELD = {type: Metrics.Storage.FIELD_DAILY_LAST_NUMERIC};
const DAILY_LAST_TEXT_FIELD = {type: Metrics.Storage.FIELD_DAILY_LAST_TEXT};
const DAILY_COUNTER_FIELD = {type: Metrics.Storage.FIELD_DAILY_COUNTER}; const DAILY_COUNTER_FIELD = {type: Metrics.Storage.FIELD_DAILY_COUNTER};
const TELEMETRY_PREF = "toolkit.telemetry.enabled"; const TELEMETRY_PREF = "toolkit.telemetry.enabled";
function isTelemetryEnabled(prefs) {
return prefs.get(TELEMETRY_PREF, false);
}
/** /**
* Represents basic application state. * Represents basic application state.
* *
@ -353,7 +358,7 @@ AppInfoProvider.prototype = Object.freeze({
}, },
_recordIsTelemetryEnabled: function (m) { _recordIsTelemetryEnabled: function (m) {
let enabled = TELEMETRY_PREF && this._prefs.get(TELEMETRY_PREF, false); let enabled = isTelemetryEnabled(this._prefs);
this._log.debug("Recording telemetry enabled (" + TELEMETRY_PREF + "): " + enabled); this._log.debug("Recording telemetry enabled (" + TELEMETRY_PREF + "): " + enabled);
yield m.setDailyLastNumeric("isTelemetryEnabled", enabled ? 1 : 0); yield m.setDailyLastNumeric("isTelemetryEnabled", enabled ? 1 : 0);
}, },
@ -1282,8 +1287,25 @@ SearchCountMeasurement3.prototype = Object.freeze({
}, },
}); });
function SearchEnginesMeasurement1() {
Metrics.Measurement.call(this);
}
SearchEnginesMeasurement1.prototype = Object.freeze({
__proto__: Metrics.Measurement.prototype,
name: "engines",
version: 1,
fields: {
default: DAILY_LAST_TEXT_FIELD,
},
});
this.SearchesProvider = function () { this.SearchesProvider = function () {
Metrics.Provider.call(this); Metrics.Provider.call(this);
this._prefs = new Preferences({defaultBranch: null});
}; };
this.SearchesProvider.prototype = Object.freeze({ this.SearchesProvider.prototype = Object.freeze({
@ -1294,6 +1316,7 @@ this.SearchesProvider.prototype = Object.freeze({
SearchCountMeasurement1, SearchCountMeasurement1,
SearchCountMeasurement2, SearchCountMeasurement2,
SearchCountMeasurement3, SearchCountMeasurement3,
SearchEnginesMeasurement1,
], ],
/** /**
@ -1308,6 +1331,36 @@ this.SearchesProvider.prototype = Object.freeze({
return deferred.promise; return deferred.promise;
}, },
collectDailyData: function () {
return this.storage.enqueueTransaction(function getDaily() {
// We currently only record this if Telemetry is enabled.
if (!isTelemetryEnabled(this._prefs)) {
return;
}
let m = this.getMeasurement(SearchEnginesMeasurement1.prototype.name,
SearchEnginesMeasurement1.prototype.version);
let engine;
try {
engine = Services.search.defaultEngine;
} catch (e) {}
let name;
if (!engine) {
name = "NONE";
} else if (engine.identifier) {
name = engine.identifier;
} else if (engine.name) {
name = "other-" + engine.name;
} else {
name = "UNDEFINED";
}
yield m.setDailyLastText("default", name);
}.bind(this));
},
/** /**
* Record that a search occurred. * Record that a search occurred.
* *

Просмотреть файл

@ -6,6 +6,7 @@
const {utils: Cu} = Components; const {utils: Cu} = Components;
Cu.import("resource://gre/modules/Metrics.jsm"); Cu.import("resource://gre/modules/Metrics.jsm");
Cu.import("resource://gre/modules/Services.jsm");
let bsp = Cu.import("resource://gre/modules/services/healthreport/providers.jsm"); let bsp = Cu.import("resource://gre/modules/services/healthreport/providers.jsm");
const DEFAULT_ENGINES = [ const DEFAULT_ENGINES = [
@ -41,7 +42,7 @@ add_test(function test_constructor() {
run_next_test(); run_next_test();
}); });
add_task(function test_record() { add_task(function* test_record() {
let storage = yield Metrics.Storage("record"); let storage = yield Metrics.Storage("record");
let provider = new MockSearchesProvider(); let provider = new MockSearchesProvider();
@ -104,7 +105,7 @@ add_task(function test_record() {
yield storage.close(); yield storage.close();
}); });
add_task(function test_includes_other_fields() { add_task(function* test_includes_other_fields() {
let storage = yield Metrics.Storage("includes_other_fields"); let storage = yield Metrics.Storage("includes_other_fields");
let provider = new MockSearchesProvider(); let provider = new MockSearchesProvider();
@ -134,3 +135,50 @@ add_task(function test_includes_other_fields() {
yield storage.close(); yield storage.close();
}); });
add_task(function* test_default_search_engine() {
let storage = yield Metrics.Storage("default_search_engine");
let provider = new SearchesProvider();
yield provider.init(storage);
let m = provider.getMeasurement("engines", 1);
// Ensure no collection if Telemetry not enabled.
Services.prefs.setBoolPref("toolkit.telemetry.enabled", false);
let now = new Date();
yield provider.collectDailyData();
let data = yield m.getValues();
Assert.equal(data.days.hasDay(now), false);
// Now enable telemetry and ensure we populate.
Services.prefs.setBoolPref("toolkit.telemetry.enabled", true);
yield provider.collectDailyData();
data = yield m.getValues();
Assert.ok(data.days.hasDay(now));
let day = data.days.getDay(now);
Assert.equal(day.size, 1);
Assert.ok(day.has("default"));
// test environment doesn't have a default engine.
Assert.equal(day.get("default"), "NONE");
Services.search.addEngineWithDetails("testdefault",
"http://localhost/icon.png",
null,
"test description",
"GET",
"http://localhost/search/%s");
let engine1 = Services.search.getEngineByName("testdefault");
Assert.ok(engine1);
Services.search.defaultEngine = engine1;
yield provider.collectDailyData();
data = yield m.getValues();
Assert.equal(data.days.getDay(now).get("default"), "other-testdefault");
yield storage.close();
});

Просмотреть файл

@ -9,9 +9,7 @@ include $(topsrcdir)/config/rules.mk
# Bug 1028035: Linking xul-gtest.dll takes too long, so we disable GTest on # Bug 1028035: Linking xul-gtest.dll takes too long, so we disable GTest on
# Windows PGO builds. # Windows PGO builds.
# Bug 1029469: fix_stack_using_bpsyms.py doesn't know how to deal with the ifeq (1_WINNT,$(MOZ_PGO)_$(OS_ARCH))
# second xul.pdb file that linking xul-gtest.dll creates.
ifeq (WINNT,$(OS_ARCH))
SKIP_GTEST_DURING_MAKE_CHECK ?= 1 SKIP_GTEST_DURING_MAKE_CHECK ?= 1
endif endif

Просмотреть файл

@ -535,9 +535,11 @@ let Impl = {
try { try {
let scope = {}; let scope = {};
Cu.import("resource:///modules/experiments/Experiments.jsm", scope); Cu.import("resource:///modules/experiments/Experiments.jsm", scope);
let activeExperiment = scope.Experiments.instance().getActiveExperimentID(); let experiments = scope.Experiments.instance()
let activeExperiment = experiments.getActiveExperimentID();
if (activeExperiment) { if (activeExperiment) {
ret.activeExperiment = activeExperiment; ret.activeExperiment = activeExperiment;
ret.activeExperimentBranch = experiments.getActiveExperimentBranch();
} }
} catch(e) { } catch(e) {
// If this is not Firefox, the import will fail. // If this is not Firefox, the import will fail.

Просмотреть файл

@ -0,0 +1,5 @@
SECTIONS {
.data.rel.ro : {
*(.kPStaticModules)
}
}

Просмотреть файл

@ -0,0 +1,14 @@
#include "mozilla/Module.h"
#include "mozilla/NullPtr.h"
/* Ensure end_kPStaticModules is at the end of the .kPStaticModules section
* on Windows. Somehow, placing the object last is not enough with PGO/LTCG. */
#ifdef _MSC_VER
/* Sections on Windows are in two parts, separated with $. When linking,
* sections with the same first part are all grouped, and ordered
* alphabetically with the second part as sort key. */
# pragma section(".kPStaticModules$Z", read)
# undef NSMODULE_SECTION
# define NSMODULE_SECTION __declspec(allocate(".kPStaticModules$Z"), dllexport)
#endif
NSMODULE_DEFN(end_kPStaticModules) = nullptr;

Просмотреть файл

@ -0,0 +1,11 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
SOURCES += [
'StaticXULComponentsEnd.cpp',
]
LIBRARY_NAME = 'StaticXULComponentsEnd'
DEFINES['MOZILLA_INTERNAL_API'] = True

Просмотреть файл

@ -0,0 +1,4 @@
#include "mozilla/Module.h"
#include "mozilla/NullPtr.h"
NSMODULE_DEFN(start_kPStaticModules) = nullptr;

Просмотреть файл

@ -24,4 +24,6 @@ endif
$(DIST)/bin/dependentlibs.list.gtest: $(DIST)/bin/dependentlibs.list $(DIST)/bin/dependentlibs.list.gtest: $(DIST)/bin/dependentlibs.list
sed -e 's|$(SHARED_LIBRARY)|gtest/$(SHARED_LIBRARY)|' $< > $@ sed -e 's|$(SHARED_LIBRARY)|gtest/$(SHARED_LIBRARY)|' $< > $@
LINK_PDBFILE = xul-gtest.pdb
endif endif

Просмотреть файл

@ -246,3 +246,28 @@ OS_LIBS += $(LIBICONV)
ifeq ($(MOZ_WIDGET_TOOLKIT),windows) ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
OS_LIBS += $(call EXPAND_LIBNAME,usp10 oleaut32) OS_LIBS += $(call EXPAND_LIBNAME,usp10 oleaut32)
endif endif
EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME_PATH,StaticXULComponentsEnd,$(DEPTH)/toolkit/library/StaticXULComponentsEnd)
# BFD ld doesn't create multiple PT_LOADs as usual when an unknown section
# exists. Using an implicit linker script to make it fold that section in
# .data.rel.ro makes it create multiple PT_LOADs. That implicit linker
# script however makes gold misbehave, first because it doesn't like that
# the linker script is given after crtbegin.o, and even past that, replaces
# the default section rules with those from the script instead of
# supplementing them. Which leads to a lib with a huge load of sections.
ifdef LD_IS_BFD
EXTRA_DSO_LDOPTS += $(topsrcdir)/toolkit/library/StaticXULComponents.ld
endif
ifeq (WINNT,$(OS_TARGET))
get_first_and_last = dumpbin -exports $1 | grep _NSModule@@ | sort -k 3 | sed -n 's/^.*?\([^@]*\)@@.*$$/\1/;1p;$$p'
else
get_first_and_last = $(TOOLCHAIN_PREFIX)nm -g $1 | grep _NSModule$$ | sort | sed -n 's/^.* _*\([^ ]*\)$$/\1/;1p;$$p'
endif
LOCAL_CHECKS = test "$$($(get_first_and_last) | xargs echo)" != "start_kPStaticModules_NSModule end_kPStaticModules_NSModule" && echo "NSModules are not ordered appropriately" && exit 1 || exit 0
ifeq (Linux,$(OS_ARCH))
LOCAL_CHECKS += ; test "$$($(TOOLCHAIN_PREFIX)readelf -l $1 | awk '$1 == "LOAD" { t += 1 } END { print t }')" -le 1 && echo "Only one PT_LOAD segment" && exit 1 || exit 0
endif

Просмотреть файл

@ -7,43 +7,18 @@
LIBRARY_NAME = 'xul' LIBRARY_NAME = 'xul'
SOURCES += [ SOURCES += [
'nsStaticXULComponents.cpp', 'StaticXULComponentsStart.cpp',
] ]
# This, combined with the fact the file is first, makes the start pointer
# it contains first in Windows PGO builds.
SOURCES['StaticXULComponentsStart.cpp'].no_pgo = True
if CONFIG['OS_ARCH'] == 'WINNT': if CONFIG['OS_ARCH'] == 'WINNT':
SOURCES += [ SOURCES += [
'nsDllMain.cpp', 'nsDllMain.cpp',
] ]
# component libraries
additional_defines = (
'MOZ_AUTH_EXTENSION',
'MOZ_GIO_COMPONENT',
'MOZ_JSDEBUGGER',
'MOZ_PERMISSIONS',
'MOZ_PREF_EXTENSIONS',
'MOZ_SPELLCHECK',
'MOZ_UNIVERSALCHARDET',
'MOZ_ZIPWRITER',
)
for var in additional_defines:
if CONFIG[var]:
DEFINES[var] = True
if CONFIG['MOZ_DEBUG'] and CONFIG['ENABLE_TESTS']:
DEFINES['ENABLE_LAYOUTDEBUG'] = True
if CONFIG['MOZ_WIDGET_TOOLKIT'] not in ('android', 'gonk', 'qt',
'cocoa', 'windows') and \
CONFIG['MOZ_XUL']:
DEFINES['MOZ_FILEVIEW'] = True
# Platform-specific icon channel stuff - supported mostly-everywhere
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'mac', 'cocoa',
'gtk2', 'gtk3', 'qt', 'android'):
DEFINES['ICON_DECODER'] = True
LOCAL_INCLUDES += [ LOCAL_INCLUDES += [
'/config', '/config',
# need widget/windows for resource.h (included from widget.rc) # need widget/windows for resource.h (included from widget.rc)
@ -57,4 +32,4 @@ if CONFIG['OS_ARCH'] == 'WINNT' and not CONFIG['GNU_CC']:
FAIL_ON_WARNINGS = True FAIL_ON_WARNINGS = True
DIRS += ['build', 'gtest'] DIRS += ['StaticXULComponentsEnd', 'build', 'gtest']

Просмотреть файл

@ -1,276 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Module.h"
#include "nsXPCOM.h"
#include "nsMemory.h"
#ifdef MOZ_AUTH_EXTENSION
#define AUTH_MODULE MODULE(nsAuthModule)
#else
#define AUTH_MODULE
#endif
#ifdef MOZ_PERMISSIONS
#define PERMISSIONS_MODULES \
MODULE(nsCookieModule) \
MODULE(nsPermissionsModule)
#else
#define PERMISSIONS_MODULES
#endif
#ifdef MOZ_UNIVERSALCHARDET
#define UNIVERSALCHARDET_MODULE MODULE(nsUniversalCharDetModule)
#else
#define UNIVERSALCHARDET_MODULE
#endif
#ifdef XP_WIN
# define WIDGET_MODULES MODULE(nsWidgetModule)
#elif defined(XP_MACOSX)
# define WIDGET_MODULES MODULE(nsWidgetMacModule)
#elif defined(MOZ_WIDGET_GTK)
# define WIDGET_MODULES MODULE(nsWidgetGtk2Module)
#elif defined(MOZ_WIDGET_QT)
# define WIDGET_MODULES MODULE(nsWidgetQtModule)
#elif defined(MOZ_WIDGET_ANDROID)
# define WIDGET_MODULES MODULE(nsWidgetAndroidModule)
#elif defined(MOZ_WIDGET_GONK)
# define WIDGET_MODULES MODULE(nsWidgetGonkModule)
#else
# error Unknown widget module.
#endif
#ifndef MOZ_B2G
#define CONTENT_PROCESS_WIDGET_MODULES MODULE(nsContentProcessWidgetModule)
#else
#define CONTENT_PROCESS_WIDGET_MODULES
#endif
#ifdef ICON_DECODER
#define ICON_MODULE MODULE(nsIconDecoderModule)
#else
#define ICON_MODULE
#endif
#ifdef MOZ_ENABLE_XREMOTE
#define XREMOTE_MODULES MODULE(RemoteServiceModule)
#else
#define XREMOTE_MODULES
#endif
#ifdef MOZ_PREF_EXTENSIONS
#define SYSTEMPREF_MODULES MODULE(nsAutoConfigModule)
#else
#define SYSTEMPREF_MODULES
#endif
#ifdef ENABLE_LAYOUTDEBUG
#define LAYOUT_DEBUG_MODULE MODULE(nsLayoutDebugModule)
#else
#define LAYOUT_DEBUG_MODULE
#endif
#ifdef MOZ_JSDEBUGGER
#define JSDEBUGGER_MODULES \
MODULE(JavaScript_Debugger)
#else
#define JSDEBUGGER_MODULES
#endif
#if defined(MOZ_FILEVIEW) && defined(MOZ_XUL)
#define FILEVIEW_MODULE MODULE(nsFileViewModule)
#else
#define FILEVIEW_MODULE
#endif
#ifdef MOZ_ZIPWRITER
#define ZIPWRITER_MODULE MODULE(ZipWriterModule)
#else
#define ZIPWRITER_MODULE
#endif
#ifdef MOZ_PLACES
#define PLACES_MODULES \
MODULE(nsPlacesModule)
#else
#define PLACES_MODULES
#endif
#ifdef MOZ_XUL
#define XULENABLED_MODULES \
MODULE(tkAutoCompleteModule) \
MODULE(satchel) \
MODULE(PKI)
#else
#define XULENABLED_MODULES
#endif
#ifdef MOZ_SPELLCHECK
#define SPELLCHECK_MODULE MODULE(mozSpellCheckerModule)
#else
#define SPELLCHECK_MODULE
#endif
#ifdef MOZ_XUL
#ifdef MOZ_WIDGET_GTK
#define UNIXPROXY_MODULE MODULE(nsUnixProxyModule)
#endif
#if defined(MOZ_WIDGET_QT)
#define UNIXPROXY_MODULE MODULE(nsUnixProxyModule)
#endif
#endif
#ifndef UNIXPROXY_MODULE
#define UNIXPROXY_MODULE
#endif
#if defined(XP_MACOSX)
#define OSXPROXY_MODULE MODULE(nsOSXProxyModule)
#else
#define OSXPROXY_MODULE
#endif
#if defined(XP_WIN)
#define WINDOWSPROXY_MODULE MODULE(nsWindowsProxyModule)
#else
#define WINDOWSPROXY_MODULE
#endif
#if defined(MOZ_WIDGET_ANDROID)
#define ANDROIDPROXY_MODULE MODULE(nsAndroidProxyModule)
#else
#define ANDROIDPROXY_MODULE
#endif
#if defined(BUILD_CTYPES)
#define JSCTYPES_MODULE MODULE(jsctypes)
#else
#define JSCTYPES_MODULE
#endif
#ifndef MOZ_APP_COMPONENT_MODULES
#if defined(MOZ_APP_COMPONENT_INCLUDE)
#include MOZ_APP_COMPONENT_INCLUDE
#define MOZ_APP_COMPONENT_MODULES APP_COMPONENT_MODULES
#else
#define MOZ_APP_COMPONENT_MODULES
#endif
#endif
#if defined(MOZ_ENABLE_PROFILER_SPS)
#define PROFILER_MODULE MODULE(nsProfilerModule)
#else
#define PROFILER_MODULE
#endif
#if defined(MOZ_WEBRTC)
#define PEERCONNECTION_MODULE MODULE(peerconnection)
#else
#define PEERCONNECTION_MODULE
#endif
#if defined(MOZ_GIO_COMPONENT)
#define GIO_MODULE MODULE(nsGIOModule)
#else
#define GIO_MODULE
#endif
#if defined(MOZ_SYNTH_PICO)
#define SYNTH_PICO_MODULE MODULE(synthpico)
#else
#define SYNTH_PICO_MODULE
#endif
#define XUL_MODULES \
MODULE(nsUConvModule) \
MODULE(nsI18nModule) \
MODULE(nsChardetModule) \
UNIVERSALCHARDET_MODULE \
MODULE(necko) \
PERMISSIONS_MODULES \
AUTH_MODULE \
MODULE(nsJarModule) \
ZIPWRITER_MODULE \
MODULE(StartupCacheModule) \
MODULE(nsPrefModule) \
MODULE(nsRDFModule) \
MODULE(nsWindowDataSourceModule) \
MODULE(nsParserModule) \
MODULE(nsImageLib2Module) \
MODULE(nsMediaSnifferModule) \
MODULE(nsGfxModule) \
PROFILER_MODULE \
WIDGET_MODULES \
CONTENT_PROCESS_WIDGET_MODULES \
ICON_MODULE \
MODULE(nsPluginModule) \
MODULE(nsLayoutModule) \
MODULE(docshell_provider) \
MODULE(embedcomponents) \
MODULE(Browser_Embedding_Module) \
MODULE(appshell) \
MODULE(nsTransactionManagerModule) \
MODULE(nsComposerModule) \
MODULE(application) \
MODULE(Apprunner) \
MODULE(CommandLineModule) \
FILEVIEW_MODULE \
MODULE(mozStorageModule) \
PLACES_MODULES \
XULENABLED_MODULES \
MODULE(nsToolkitCompsModule) \
XREMOTE_MODULES \
JSDEBUGGER_MODULES \
MODULE(BOOT) \
MODULE(NSS) \
SYSTEMPREF_MODULES \
SPELLCHECK_MODULE \
LAYOUT_DEBUG_MODULE \
UNIXPROXY_MODULE \
OSXPROXY_MODULE \
WINDOWSPROXY_MODULE \
ANDROIDPROXY_MODULE \
JSCTYPES_MODULE \
MODULE(jsreflect) \
MODULE(jsperf) \
MODULE(identity) \
MODULE(nsServicesCryptoModule) \
MOZ_APP_COMPONENT_MODULES \
MODULE(nsTelemetryModule) \
MODULE(jsinspector) \
MODULE(jsdebugger) \
PEERCONNECTION_MODULE \
GIO_MODULE \
SYNTH_PICO_MODULE \
MODULE(DiskSpaceWatcherModule) \
/* end of list */
#define MODULE(_name) \
NSMODULE_DECL(_name);
XUL_MODULES
#ifdef MOZ_WIDGET_GONK
MODULE(WifiCertServiceModule)
MODULE(WifiProxyServiceModule)
MODULE(NetworkWorkerModule)
#endif
#undef MODULE
#define MODULE(_name) \
&NSMODULE_NAME(_name),
extern const mozilla::Module *const *const kPStaticModules[] = {
XUL_MODULES
#ifdef MOZ_WIDGET_GONK
MODULE(WifiCertServiceModule)
MODULE(WifiProxyServiceModule)
MODULE(NetworkWorkerModule)
#endif
nullptr
};
#undef MODULE

Просмотреть файл

@ -118,8 +118,21 @@ struct Module
#if defined(MOZILLA_INTERNAL_API) #if defined(MOZILLA_INTERNAL_API)
# define NSMODULE_NAME(_name) _name##_NSModule # define NSMODULE_NAME(_name) _name##_NSModule
# define NSMODULE_DECL(_name) extern mozilla::Module const *const NSMODULE_NAME(_name) # if defined(_MSC_VER)
# define NSMODULE_DEFN(_name) NSMODULE_DECL(_name) # pragma section(".kPStaticModules$M", read)
# pragma comment(linker, "/merge:.kPStaticModules=.rdata")
# define NSMODULE_SECTION __declspec(allocate(".kPStaticModules$M"), dllexport)
# elif defined(__GNUC__)
# if defined(__ELF__)
# define NSMODULE_SECTION __attribute__((section(".kPStaticModules"), visibility("protected")))
# elif defined(__MACH__)
# define NSMODULE_SECTION __attribute__((section("__DATA, .kPStaticModules"), visibility("default")))
# endif
# endif
# if !defined(NSMODULE_SECTION)
# error Do not know how to define sections.
# endif
# define NSMODULE_DEFN(_name) extern NSMODULE_SECTION mozilla::Module const *const NSMODULE_NAME(_name)
#else #else
# define NSMODULE_NAME(_name) NSModule # define NSMODULE_NAME(_name) NSModule
# define NSMODULE_DEFN(_name) extern "C" NS_EXPORT mozilla::Module const *const NSModule # define NSMODULE_DEFN(_name) extern "C" NS_EXPORT mozilla::Module const *const NSModule

Просмотреть файл

@ -81,10 +81,6 @@ using namespace mozilla;
PRLogModuleInfo* nsComponentManagerLog = nullptr; PRLogModuleInfo* nsComponentManagerLog = nullptr;
// defined in nsStaticXULComponents.cpp to contain all the components in
// libxul.
extern mozilla::Module const *const *const kPStaticModules[];
#if 0 || defined (DEBUG_timeless) #if 0 || defined (DEBUG_timeless)
#define SHOW_DENIED_ON_SHUTDOWN #define SHOW_DENIED_ON_SHUTDOWN
#define SHOW_CI_ON_EXISTING_SERVICE #define SHOW_CI_ON_EXISTING_SERVICE
@ -278,6 +274,15 @@ nsComponentManagerImpl::nsComponentManagerImpl()
nsTArray<const mozilla::Module*>* nsComponentManagerImpl::sStaticModules; nsTArray<const mozilla::Module*>* nsComponentManagerImpl::sStaticModules;
NSMODULE_DEFN(start_kPStaticModules);
NSMODULE_DEFN(end_kPStaticModules);
/* The content between start_kPStaticModules and end_kPStaticModules is gathered
* by the linker from various objects containing symbols in a specific section.
* ASAN considers (rightfully) the use of this content as a global buffer
* overflow. But this is a deliberate and well-considered choice, with no proper
* way to make ASAN happy. */
MOZ_ASAN_BLACKLIST
/* static */ void /* static */ void
nsComponentManagerImpl::InitializeStaticModules() nsComponentManagerImpl::InitializeStaticModules()
{ {
@ -285,9 +290,10 @@ nsComponentManagerImpl::InitializeStaticModules()
return; return;
sStaticModules = new nsTArray<const mozilla::Module*>; sStaticModules = new nsTArray<const mozilla::Module*>;
for (const mozilla::Module *const *const *staticModules = kPStaticModules; for (const mozilla::Module *const *staticModules = &NSMODULE_NAME(start_kPStaticModules) + 1;
*staticModules; ++staticModules) staticModules < &NSMODULE_NAME(end_kPStaticModules); ++staticModules)
sStaticModules->AppendElement(**staticModules); if (*staticModules) // ASAN adds padding
sStaticModules->AppendElement(*staticModules);
} }
nsTArray<nsComponentManagerImpl::ComponentLocation>* nsTArray<nsComponentManagerImpl::ComponentLocation>*