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
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
ifndef .PYMAKE
ifeq (,$(MAKE_VERSION))
$(error GNU Make is required)
endif
@ -11,7 +10,6 @@ make_min_ver := 3.81
ifneq ($(make_min_ver),$(firstword $(sort $(make_min_ver) $(MAKE_VERSION))))
$(error GNU Make $(make_min_ver) or higher is required)
endif
endif
export TOPLEVEL_BUILD := 1

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

@ -4,13 +4,6 @@
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
WRAP_LDFLAGS :=
@ -19,6 +12,6 @@ GENERATED_DIRS += $(DIST)/bin/$(GAIA_PATH)
include $(topsrcdir)/config/rules.mk
libs::
+$(GAIA_MAKE) -j1 -C $(GAIADIR) clean
+$(GAIA_MAKE) -j1 -C $(GAIADIR) profile
+$(MAKE) -j1 -C $(GAIADIR) clean
+$(MAKE) -j1 -C $(GAIADIR) profile
(cd $(GAIADIR)/profile && tar $(TAR_CREATE_FLAGS) - .) | (cd $(abspath $(DIST))/bin/$(GAIA_PATH) && tar -xf -)

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

@ -90,6 +90,7 @@ SocialUI = {
if (!this._initialized) {
return;
}
SocialSidebar.saveWindowState();
Services.obs.removeObserver(this, "social:ambient-notification-changed");
Services.obs.removeObserver(this, "social:profile-changed");
@ -710,6 +711,11 @@ SocialSidebar = {
},
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;
if (!this.canShow)
return;
@ -737,13 +743,22 @@ SocialSidebar = {
let data = SessionStore.getWindowValue(window, "socialSidebar");
// if this window doesn't have it's own state, use the state from the opener
if (!data && window.opener && !window.opener.closed) {
data = SessionStore.getWindowValue(window.opener, "socialSidebar");
try {
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) {
data = JSON.parse(data);
document.getElementById("social-sidebar-browser").setAttribute("origin", data.origin);
if (!data.hidden)
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,
"origin": sidebarOrigin
};
SessionStore.setWindowValue(window, "socialSidebar", JSON.stringify(data));
// 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));
} catch(e) {
// window not tracked during uninit
}
},
setSidebarVisibilityState: function(aEnabled) {

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

@ -3,15 +3,13 @@
"use strict";
function test() {
waitForExplicitFinish();
add_task(function* test_healthreport_search_recording() {
try {
let cm = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
cm.getCategoryEntry("healthreport-js-provider-default", "SearchesProvider");
} catch (ex) {
// Health Report disabled, or no SearchesProvider.
ok(true, "Firefox Health Report is not enabled.");
finish();
return;
}
@ -20,72 +18,63 @@ function test() {
.wrappedJSObject
.healthReporter;
ok(reporter, "Health Reporter available.");
reporter.onInit().then(function onInit() {
let provider = reporter.getProvider("org.mozilla.searches");
ok(provider, "Searches provider is available.");
let m = provider.getMeasurement("counts", 3);
yield reporter.onInit();
let provider = reporter.getProvider("org.mozilla.searches");
ok(provider, "Searches provider is available.");
let m = provider.getMeasurement("counts", 3);
m.getValues().then(function onData(data) {
let now = new Date();
let oldCount = 0;
let data = yield m.getValues();
let now = new Date();
let oldCount = 0;
// This will to be need changed if default search engine is not Google.
let field = "google.urlbar";
// This will to be need changed if default search engine is not Google.
let field = "google.urlbar";
if (data.days.hasDay(now)) {
let day = data.days.getDay(now);
if (day.has(field)) {
oldCount = day.get(field);
}
}
if (data.days.hasDay(now)) {
let day = data.days.getDay(now);
if (day.has(field)) {
oldCount = day.get(field);
}
}
let tab = gBrowser.addTab();
gBrowser.selectedTab = tab;
let tab = gBrowser.addTab();
gBrowser.selectedTab = tab;
let searchStr = "firefox health report";
let expectedURL = Services.search.currentEngine.
getSubmission(searchStr, "", "keyword").uri.spec;
let searchStr = "firefox health report";
let expectedURL = Services.search.currentEngine.
getSubmission(searchStr, "", "keyword").uri.spec;
// Expect the search URL to load but stop it as soon as it starts.
let loadPromise = waitForDocLoadAndStopIt(expectedURL);
// Expect the search URL to load but stop it as soon as it starts.
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.
gURLBar.value = searchStr;
gURLBar.handleCommand();
// Trigger the search.
gURLBar.value = searchStr;
gURLBar.handleCommand();
yield docLoadPromise;
// Wait for the page load and new measurement.
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);
}
function closeWindow(w, cb) {
waitForNotification("domwindowclosed", cb);
w.close();
}
function closeOneWindow(cb) {
let w = createdWindows.pop();
if (!w) {
if (!w || w.closed) {
cb();
return;
}
waitForCondition(function() w.closed,
function() {
info("window closed, " + createdWindows.length + " windows left");
closeOneWindow(cb);
}, "window did not close");
closeWindow(w, function() {
closeOneWindow(cb);
});
w.close();
}
@ -126,6 +129,51 @@ let tests = {
}, 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
// prefs to using session state, and state inheritance of windows (new windows
// inherit state from the opener).

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

@ -597,6 +597,7 @@ Experiments.Experiments.prototype = {
active: experiment.enabled,
endDate: experiment.endDate.getTime(),
detailURL: experiment._homepageURL,
branch: experiment.branch,
});
}
@ -628,6 +629,54 @@ Experiments.Experiments.prototype = {
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().
*/
@ -1013,6 +1062,17 @@ Experiments.Experiments.prototype = {
return e.id;
},
getActiveExperimentBranch: function() {
if (!this._experiments) {
return null;
}
let e = this._getActiveExperiment();
if (!e) {
return null;
}
return e.branch;
},
_getActiveExperiment: function () {
let enabled = [experiment for ([,experiment] of this._experiments) if (experiment._enabled)];
@ -1258,6 +1318,8 @@ Experiments.ExperimentEntry = function (policy) {
this._lastChangedDate = null;
// Has this experiment failed to activate before?
this._failedStart = false;
// The experiment branch
this._branch = null;
// We grab these from the addon after download.
this._name = null;
@ -1306,6 +1368,7 @@ Experiments.ExperimentEntry.prototype = {
"_addonId",
"_startDate",
"_endDate",
"_branch",
]),
DATE_KEYS: new Set([
@ -1313,6 +1376,10 @@ Experiments.ExperimentEntry.prototype = {
"_endDate",
]),
UPGRADE_KEYS: new Map([
["_branch", null],
]),
ADDON_CHANGE_NONE: 0,
ADDON_CHANGE_INSTALL: 1,
ADDON_CHANGE_UNINSTALL: 2,
@ -1344,6 +1411,14 @@ Experiments.ExperimentEntry.prototype = {
return this._manifestData.id;
},
get branch() {
return this._branch;
},
set branch(v) {
this._branch = v;
},
get startDate() {
return this._startDate;
},
@ -1376,6 +1451,12 @@ Experiments.ExperimentEntry.prototype = {
* @return boolean Whether initialization succeeded.
*/
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) {
if (!(key in data) && !this.DATE_KEYS.has(key)) {
this._log.error("initFromCacheData() - missing required key " + key);
@ -1970,6 +2051,9 @@ let stripDateToMidnight = function (d) {
function ExperimentsLastActiveMeasurement1() {
Metrics.Measurement.call(this);
}
function ExperimentsLastActiveMeasurement2() {
Metrics.Measurement.call(this);
}
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,
}
});
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 () {
Metrics.Provider.call(this);
@ -1997,6 +2092,7 @@ ExperimentsProvider.prototype = Object.freeze({
measurementTypes: [
ExperimentsLastActiveMeasurement1,
ExperimentsLastActiveMeasurement2,
],
_OBSERVERS: [
@ -2040,8 +2136,8 @@ ExperimentsProvider.prototype = Object.freeze({
this._experiments = Experiments.instance();
}
let m = this.getMeasurement(ExperimentsLastActiveMeasurement1.prototype.name,
ExperimentsLastActiveMeasurement1.prototype.version);
let m = this.getMeasurement(ExperimentsLastActiveMeasurement2.prototype.name,
ExperimentsLastActiveMeasurement2.prototype.version);
return this.enqueueStorageOperation(() => {
return Task.spawn(function* recordTask() {
@ -2055,6 +2151,11 @@ ExperimentsProvider.prototype = Object.freeze({
this._log.info("Recording last active experiment: " + todayActive.id);
yield m.setDailyLastText("lastActive", todayActive.id,
this._experiments._policy.now());
let branch = todayActive.branch;
if (branch) {
yield m.setDailyLastText("lastActiveBranch", branch,
this._experiments._policy.now());
}
}.bind(this));
});
},

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

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

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

@ -171,6 +171,14 @@ add_task(function* test_getExperiments() {
let addons = yield getExperimentAddons();
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.
now = futureDate(startDate1, 5 * MS_IN_ONE_DAY);
@ -196,6 +204,19 @@ add_task(function* test_getExperiments() {
"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,
"Experiment re-evaluation should have been scheduled correctly.");

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

@ -190,6 +190,13 @@ add_task(function* test_cache() {
checkExperimentListsEqual(experimentListData.slice(1), list);
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.
now = futureDate(now, 20 * MS_IN_ONE_DAY);
@ -207,6 +214,9 @@ add_task(function* test_cache() {
checkExperimentListsEqual(experimentListData.slice(1), list);
checkExperimentSerializations(experiments._experiments.values());
branch = yield experiments.getExperimentBranch(EXPERIMENT1_ID);
Assert.strictEqual(branch, "testbranch");
// Re-init, clock set for experiment 2 to start.
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-common/logging.js");
const kMeasurementVersion = 2;
function getStorageAndProvider(name) {
return Task.spawn(function* get() {
let storage = yield Metrics.Storage(name);
@ -53,7 +55,7 @@ add_task(function* test_collect() {
// Initial state should not report anything.
yield provider.collectDailyData();
let m = provider.getMeasurement("info", 1);
let m = provider.getMeasurement("info", kMeasurementVersion);
let values = yield m.getValues();
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);
Assert.ok(day.has("lastActive"), "Has lastActive field.");
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.
replaceExperiments(provider._experiments, FAKE_EXPERIMENTS_1);
@ -76,6 +80,8 @@ add_task(function* test_collect() {
values = yield m.getValues();
day = values.days.getDay(now);
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.
replaceExperiments(provider._experiments, FAKE_EXPERIMENTS_2);

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

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

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

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

@ -185,9 +185,7 @@ dnl A high level macro for selecting compiler options.
AC_DEFUN([MOZ_COMPILER_OPTS],
[
if test "${MOZ_PSEUDO_DERECURSE-unset}" = unset; then
dnl Don't enable on pymake, because of bug 918652. Bug 912979 is an annoyance
dnl with pymake, too.
MOZ_PSEUDO_DERECURSE=no-pymake
MOZ_PSEUDO_DERECURSE=1
fi
MOZ_DEBUGGING_OPTS
@ -246,6 +244,13 @@ if test "$GNU_CC" -a -n "$MOZ_FORCE_GOLD"; then
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 -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.
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
===========================
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
UNIX-y systems such as Linux. This is because Windows has optimized new
threads while the \*NIX platforms typically optimize new processes.

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

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

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

@ -145,13 +145,6 @@ endif
ifndef MOZ_OBJDIR
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
ifdef MOZ_BUILD_PROJECTS

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

@ -194,16 +194,6 @@ endif
CONFIG_TOOLS = $(MOZ_BUILD_ROOT)/config
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.
ifneq (,$(MOZ_PROFILE_USE)$(MOZ_PROFILE_GENERATE))
MOZ_PSEUDO_DERECURSE :=
@ -238,10 +228,6 @@ MKDIR ?= mkdir
SLEEP ?= sleep
TOUCH ?= touch
ifdef .PYMAKE
PYCOMMANDPATH += $(PYTHON_SITE_PACKAGES)
endif
PYTHON_PATH = $(PYTHON) $(topsrcdir)/config/pythonpath.py
# determine debug-related options
@ -720,9 +706,6 @@ endif # NSINSTALL_BIN
ifeq (,$(CROSS_COMPILE)$(filter-out WINNT, $(OS_ARCH)))
INSTALL = $(NSINSTALL) -t
ifdef .PYMAKE
install_cmd = $(NSINSTALL_NATIVECMD) -t $(1)
endif # .PYMAKE
else
@ -839,6 +822,7 @@ endif
define CHECK_BINARY
$(call CHECK_STDCXX,$(1))
$(call CHECK_TEXTREL,$(1))
$(call LOCAL_CHECKS,$(1))
endef
# 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::
# $(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)
endif

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

@ -35,23 +35,8 @@ endif
USE_AUTOTARGETS_MK = 1
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 .PYMAKE
REPORT_BUILD = @%rebuild_check rebuild_check $@ $^
else
REPORT_BUILD = $(info $(shell $(PYTHON) $(MOZILLA_DIR)/config/rebuild_check.py $@ $^))
endif
else
REPORT_BUILD = $(info $(notdir $@))
endif
@ -66,15 +51,11 @@ endif
# ELOG prints out failed command when building silently (gmake -s). Pymake
# prints out failed commands anyway, so ELOG just makes things worse by
# forcing shell invocations.
ifndef .PYMAKE
ifneq (,$(findstring s, $(filter-out --%, $(MAKEFLAGS))))
ELOG := $(EXEC) sh $(BUILD_TOOLS)/print-failed-commands.sh
else
ELOG :=
endif # -s
else
ELOG :=
endif # ifndef .PYMAKE
_VPATH_SRCS = $(abspath $<)
@ -238,7 +219,7 @@ endif
COMPILE_CFLAGS += $(COMPILE_PDB_FLAG)
COMPILE_CXXFLAGS += $(COMPILE_PDB_FLAG)
LINK_PDBFILE = $(basename $(@F)).pdb
LINK_PDBFILE ?= $(basename $(@F)).pdb
ifdef MOZ_DEBUG
CODFILE=$(basename $(@F)).cod
endif
@ -1142,9 +1123,7 @@ else
endif
# Cancel GNU make built-in implicit rules
ifndef .PYMAKE
MAKEFLAGS += -r
endif
ifneq (,$(filter WINNT,$(OS_ARCH)))
SEP := ;

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

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

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

@ -44,32 +44,24 @@ include $(topsrcdir)/config/rules.mk
ifdef ENABLE_INTL_API
ifndef MOZ_NATIVE_ICU
ifdef .PYMAKE
ICU_MAKE = $(GMAKE)
else
ICU_MAKE = $(MAKE)
endif
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
# will discard all files with a non-standard suffix (bug 857450).
# - Options for genrb: -k strict parsing; -R omit collation tailoring rules.
buildicu::
# ICU's build system is full of races, so force non-parallel build.
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
+$(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)
distclean clean::
ifdef CROSS_COMPILE
+$(ICU_MAKE) -C host $@ STATIC_O=$(OBJ_SUFFIX)
+$(MAKE) -C host $@ STATIC_O=$(OBJ_SUFFIX)
endif
+$(ICU_MAKE) -C target $@ STATIC_O=$(OBJ_SUFFIX)
+$(MAKE) -C target $@ STATIC_O=$(OBJ_SUFFIX)
endif
endif

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

@ -4,7 +4,6 @@
# 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/.
ifndef .PYMAKE
ifeq (,$(MAKE_VERSION))
$(error GNU Make is required)
endif
@ -12,7 +11,6 @@ make_min_ver := 3.81
ifneq ($(make_min_ver),$(firstword $(sort $(make_min_ver) $(MAKE_VERSION))))
$(error GNU Make $(make_min_ver) or higher is required)
endif
endif
TOPLEVEL_BUILD := 1

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

@ -5,6 +5,7 @@
package org.mozilla.gecko;
import org.mozilla.gecko.widget.GeckoPopupMenu;
import org.mozilla.gecko.menu.GeckoMenuItem;
import android.view.Gravity;
import android.view.Menu;
@ -99,7 +100,7 @@ class ActionModeCompat implements GeckoPopupMenu.OnMenuItemClickListener,
/* GeckoPopupMenu.onMenuItemLongClickListener */
@Override
public boolean onMenuItemLongClick(MenuItem item) {
showTooltip(item);
showTooltip((GeckoMenuItem) item);
return true;
}
@ -109,7 +110,7 @@ class ActionModeCompat implements GeckoPopupMenu.OnMenuItemClickListener,
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
// menu item's position (i.e below the item and slightly to the left)
int[] location = new int[2];

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

@ -758,12 +758,17 @@ public class BrowserApp extends GeckoApp
if (!TextUtils.isEmpty(text)) {
Tabs.getInstance().loadUrl(text);
Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.CONTEXT_MENU);
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.CONTEXT_MENU, "pasteandgo");
}
return true;
}
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));
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.CONTEXT_MENU, "site_settings");
}
return true;
}
@ -771,11 +776,13 @@ public class BrowserApp extends GeckoApp
String text = Clipboard.getText();
if (!TextUtils.isEmpty(text)) {
enterEditingMode(text);
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.CONTEXT_MENU, "paste");
}
return true;
}
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();
if (tab != null && tab.hasFeeds()) {
JSONObject args = new JSONObject();
@ -785,6 +792,9 @@ public class BrowserApp extends GeckoApp
Log.e(LOGTAG, "error building json arguments");
}
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;
}
@ -815,6 +825,7 @@ public class BrowserApp extends GeckoApp
String url = tab.getURL();
if (url != null) {
Clipboard.setText(url);
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.CONTEXT_MENU, "copyurl");
}
}
return true;

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

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

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

@ -434,9 +434,7 @@ class MozbuildObject(ProcessExecutionMixin):
args.append('-s')
# Print entering/leaving directory messages. Some consumers look at
# these to measure progress. Ideally, we'd do everything with pymake
# and use hooks in its API. Unfortunately, it doesn't provide that
# feature... yet.
# these to measure progress.
if print_directory:
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)): 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))):
$(DEFAULT_GMAKE_ENV) $(MAKE) -C $(NSS_SRCDIR)/security/$* $(@:-$*=) $(DEFAULT_GMAKE_FLAGS)

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

@ -1402,6 +1402,36 @@ Example
"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
---------------------
@ -1639,13 +1669,22 @@ lastActive
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
^^^^^^^
::
"org.mozilla.experiments.info": {
"_v": 1,
"lastActive": "some.experiment.id"
"_v": 2,
"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 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_TEXT_FIELD = {type: Metrics.Storage.FIELD_DAILY_LAST_TEXT};
const DAILY_COUNTER_FIELD = {type: Metrics.Storage.FIELD_DAILY_COUNTER};
const TELEMETRY_PREF = "toolkit.telemetry.enabled";
function isTelemetryEnabled(prefs) {
return prefs.get(TELEMETRY_PREF, false);
}
/**
* Represents basic application state.
*
@ -353,7 +358,7 @@ AppInfoProvider.prototype = Object.freeze({
},
_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);
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 () {
Metrics.Provider.call(this);
this._prefs = new Preferences({defaultBranch: null});
};
this.SearchesProvider.prototype = Object.freeze({
@ -1294,6 +1316,7 @@ this.SearchesProvider.prototype = Object.freeze({
SearchCountMeasurement1,
SearchCountMeasurement2,
SearchCountMeasurement3,
SearchEnginesMeasurement1,
],
/**
@ -1308,6 +1331,36 @@ this.SearchesProvider.prototype = Object.freeze({
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.
*

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

@ -6,6 +6,7 @@
const {utils: Cu} = Components;
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");
const DEFAULT_ENGINES = [
@ -41,7 +42,7 @@ add_test(function test_constructor() {
run_next_test();
});
add_task(function test_record() {
add_task(function* test_record() {
let storage = yield Metrics.Storage("record");
let provider = new MockSearchesProvider();
@ -104,7 +105,7 @@ add_task(function test_record() {
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 provider = new MockSearchesProvider();
@ -134,3 +135,50 @@ add_task(function test_includes_other_fields() {
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
# Windows PGO builds.
# Bug 1029469: fix_stack_using_bpsyms.py doesn't know how to deal with the
# second xul.pdb file that linking xul-gtest.dll creates.
ifeq (WINNT,$(OS_ARCH))
ifeq (1_WINNT,$(MOZ_PGO)_$(OS_ARCH))
SKIP_GTEST_DURING_MAKE_CHECK ?= 1
endif

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

@ -535,9 +535,11 @@ let Impl = {
try {
let 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) {
ret.activeExperiment = activeExperiment;
ret.activeExperimentBranch = experiments.getActiveExperimentBranch();
}
} catch(e) {
// 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
sed -e 's|$(SHARED_LIBRARY)|gtest/$(SHARED_LIBRARY)|' $< > $@
LINK_PDBFILE = xul-gtest.pdb
endif

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

@ -246,3 +246,28 @@ OS_LIBS += $(LIBICONV)
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
OS_LIBS += $(call EXPAND_LIBNAME,usp10 oleaut32)
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'
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':
SOURCES += [
'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 += [
'/config',
# 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
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)
# define NSMODULE_NAME(_name) _name##_NSModule
# define NSMODULE_DECL(_name) extern mozilla::Module const *const NSMODULE_NAME(_name)
# define NSMODULE_DEFN(_name) NSMODULE_DECL(_name)
# if defined(_MSC_VER)
# 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
# define NSMODULE_NAME(_name) NSModule
# define NSMODULE_DEFN(_name) extern "C" NS_EXPORT mozilla::Module const *const NSModule

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

@ -81,10 +81,6 @@ using namespace mozilla;
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)
#define SHOW_DENIED_ON_SHUTDOWN
#define SHOW_CI_ON_EXISTING_SERVICE
@ -278,6 +274,15 @@ nsComponentManagerImpl::nsComponentManagerImpl()
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
nsComponentManagerImpl::InitializeStaticModules()
{
@ -285,9 +290,10 @@ nsComponentManagerImpl::InitializeStaticModules()
return;
sStaticModules = new nsTArray<const mozilla::Module*>;
for (const mozilla::Module *const *const *staticModules = kPStaticModules;
*staticModules; ++staticModules)
sStaticModules->AppendElement(**staticModules);
for (const mozilla::Module *const *staticModules = &NSMODULE_NAME(start_kPStaticModules) + 1;
staticModules < &NSMODULE_NAME(end_kPStaticModules); ++staticModules)
if (*staticModules) // ASAN adds padding
sStaticModules->AppendElement(*staticModules);
}
nsTArray<nsComponentManagerImpl::ComponentLocation>*