Merge mozilla-central to mozilla-inbound

This commit is contained in:
Carsten "Tomcat" Book 2015-01-22 14:39:29 +01:00
Родитель cb11691673 fbdef879d2
Коммит eca1dab264
96 изменённых файлов: 1307 добавлений и 1078 удалений

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

@ -46,12 +46,6 @@ AB := $(firstword $(subst -, ,$(AB_CD)))
clean clobber repackage::
rm -rf $(DIST)/$(APP_NAME).app
ifdef LIBXUL_SDK
APPFILES = Resources
else
APPFILES = MacOS
endif
libs-preqs = \
$(call mkdir_deps,$(DIST)/$(APP_NAME).app/Contents/MacOS) \
$(call mkdir_deps,$(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj) \
@ -63,9 +57,8 @@ tools repackage:: $(libs-preqs)
rsync -a --exclude '*.in' $(srcdir)/macbuild/Contents/Resources/English.lproj/ $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj
sed -e 's/%MOZ_APP_VERSION%/$(MOZ_APP_VERSION)/' -e 's/%MOZ_APP_NAME%/$(MOZ_APP_NAME)/' -e 's/%APP_VERSION%/$(APP_VERSION)/' -e 's/%APP_NAME%/$(APP_NAME)/' -e 's/%APP_BINARY%/$(APP_BINARY)/' $(srcdir)/macbuild/Contents/Info.plist.in > $(DIST)/$(APP_NAME).app/Contents/Info.plist
sed -e 's/%APP_VERSION%/$(APP_VERSION)/' -e 's/%APP_NAME%/$(APP_NAME)/' $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | iconv -f UTF-8 -t UTF-16 > $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj/InfoPlist.strings
rsync -a $(DIST)/bin/ $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)
mv $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)/dependentlibs.list $(DIST)/$(APP_NAME).app/Contents/Resources
$(RM) $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)/mangle $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)/shlibsign
rsync -a --exclude 'mangle' --exclude 'shlibsign' --exclude-from='$(srcdir)/macbuild/Contents/MacOS-files.in' $(DIST)/bin/ $(DIST)/$(APP_NAME).app/Contents/Resources
rsync -a --include-from='$(srcdir)/macbuild/Contents/MacOS-files.in' --exclude '*' $(DIST)/bin/ $(DIST)/$(APP_NAME).app/Contents/MacOS
ifdef LIBXUL_SDK
cp $(LIBXUL_DIST)/bin/xulrunner$(BIN_SUFFIX) $(DIST)/$(APP_NAME).app/Contents/MacOS/$(APP_BINARY)
rsync -a --exclude nsinstall --copy-unsafe-links $(LIBXUL_DIST)/XUL.framework $(DIST)/$(APP_NAME).app/Contents/Frameworks

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

@ -9,7 +9,7 @@
<key>CFBundleGetInfoString</key>
<string>%APP_NAME% %APP_VERSION%</string>
<key>CFBundleIconFile</key>
<string>%MOZ_APP_NAME%</string>
<string>%MOZ_APP_NAME%.icns</string>
<key>CFBundleIdentifier</key>
<string>org.mozilla.b2g</string>
<key>CFBundleInfoDictionaryVersion</key>

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

@ -0,0 +1,9 @@
/*.app/***
/*.dylib
/b2g
/certutil
/gtest/***
/pk12util
/ssltunnel
/xpcshell
/XUL

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

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e06971db7acf7a35c32eb74d675a4e12e288e6be">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="917b6c36717fddc6e71ffc1ec249633c8044c93c"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="966b3a7a13a7f0d5b86cbc9e64cb78d43ec7dba8"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

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

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="917b6c36717fddc6e71ffc1ec249633c8044c93c"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="966b3a7a13a7f0d5b86cbc9e64cb78d43ec7dba8"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d5d3f93914558b6f168447b805cd799c8233e300"/>

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

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="917b6c36717fddc6e71ffc1ec249633c8044c93c"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="966b3a7a13a7f0d5b86cbc9e64cb78d43ec7dba8"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="fe91ec3af5396edab45b15e546e21613785724b5"/>

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

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e06971db7acf7a35c32eb74d675a4e12e288e6be">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="917b6c36717fddc6e71ffc1ec249633c8044c93c"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="966b3a7a13a7f0d5b86cbc9e64cb78d43ec7dba8"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

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

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="917b6c36717fddc6e71ffc1ec249633c8044c93c"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="966b3a7a13a7f0d5b86cbc9e64cb78d43ec7dba8"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d5d3f93914558b6f168447b805cd799c8233e300"/>

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

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e06971db7acf7a35c32eb74d675a4e12e288e6be">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="917b6c36717fddc6e71ffc1ec249633c8044c93c"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="966b3a7a13a7f0d5b86cbc9e64cb78d43ec7dba8"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

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

@ -17,7 +17,7 @@
</project>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="917b6c36717fddc6e71ffc1ec249633c8044c93c"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="966b3a7a13a7f0d5b86cbc9e64cb78d43ec7dba8"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="fe91ec3af5396edab45b15e546e21613785724b5"/>

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

@ -1,9 +1,9 @@
{
"git": {
"git_revision": "917b6c36717fddc6e71ffc1ec249633c8044c93c",
"git_revision": "966b3a7a13a7f0d5b86cbc9e64cb78d43ec7dba8",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
"revision": "3033c2214b5863d8ac50d2067b34c5cb02fb054d",
"revision": "9a9aef701b1c69e9fb76eb3cc629be10aecfa3f3",
"repo_path": "integration/gaia-central"
}

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

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="917b6c36717fddc6e71ffc1ec249633c8044c93c"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="966b3a7a13a7f0d5b86cbc9e64cb78d43ec7dba8"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>

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

@ -15,7 +15,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="917b6c36717fddc6e71ffc1ec249633c8044c93c"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="966b3a7a13a7f0d5b86cbc9e64cb78d43ec7dba8"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

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

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="917b6c36717fddc6e71ffc1ec249633c8044c93c"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="966b3a7a13a7f0d5b86cbc9e64cb78d43ec7dba8"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="fe91ec3af5396edab45b15e546e21613785724b5"/>

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

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="917b6c36717fddc6e71ffc1ec249633c8044c93c"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="966b3a7a13a7f0d5b86cbc9e64cb78d43ec7dba8"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

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

@ -49,6 +49,9 @@ endif
ifndef _BINPATH
_BINPATH = /$(_APPNAME)/Contents/MacOS
endif
ifndef _RESPATH
_RESPATH = /$(_APPNAME)/Contents/Resources
endif
endif
include $(topsrcdir)/toolkit/mozapps/installer/packager.mk
@ -64,12 +67,16 @@ endif
ifeq (bundle, $(MOZ_FS_LAYOUT))
BINPATH = $(_BINPATH)
RESPATH = $(_RESPATH)
DEFINES += -DAPPNAME=$(_APPNAME)
else
# Every other platform just winds up in dist/bin
BINPATH = bin
RESPATH = bin
endif
DEFINES += -DBINPATH=$(BINPATH)
DEFINES += -DRESPATH=$(RESPATH)
ifneq (,$(filter WINNT Darwin Android,$(OS_TARGET)))
DEFINES += -DMOZ_SHARED_MOZGLUE=1

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -246,7 +246,6 @@ pref("browser.uitour.enabled", true);
pref("browser.uitour.loglevel", "Error");
pref("browser.uitour.requireSecure", true);
pref("browser.uitour.themeOrigin", "https://addons.mozilla.org/%LOCALE%/firefox/themes/");
pref("browser.uitour.pinnedTabUrl", "https://support.mozilla.org/%LOCALE%/kb/pinned-tabs-keep-favorite-websites-open");
pref("browser.uitour.url", "https://www.mozilla.org/%LOCALE%/firefox/%VERSION%/tour/");
pref("browser.customizemode.tip0.shown", false);
@ -1497,6 +1496,7 @@ pref("devtools.gcli.underscoreSrc", "https://cdnjs.cloudflare.com/ajax/libs/unde
pref("devtools.webconsole.filter.network", true);
pref("devtools.webconsole.filter.networkinfo", false);
pref("devtools.webconsole.filter.netwarn", true);
pref("devtools.webconsole.filter.netxhr", false);
pref("devtools.webconsole.filter.csserror", true);
pref("devtools.webconsole.filter.cssparser", false);
pref("devtools.webconsole.filter.csslog", false);
@ -1514,6 +1514,7 @@ pref("devtools.webconsole.filter.secwarn", true);
pref("devtools.browserconsole.filter.network", true);
pref("devtools.browserconsole.filter.networkinfo", false);
pref("devtools.browserconsole.filter.netwarn", true);
pref("devtools.browserconsole.filter.netxhr", false);
pref("devtools.browserconsole.filter.csserror", true);
pref("devtools.browserconsole.filter.cssparser", false);
pref("devtools.browserconsole.filter.csslog", false);

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

@ -146,7 +146,7 @@ const DEFAULT_SNIPPETS_URLS = [
, "https://addons.mozilla.org/firefox/?utm_source=snippet&utm_medium=snippet&utm_campaign=addons"
];
const SNIPPETS_UPDATE_INTERVAL_MS = 86400000; // 1 Day.
const SNIPPETS_UPDATE_INTERVAL_MS = 14400000; // 4 hours.
// IndexedDB storage constants.
const DATABASE_NAME = "abouthome";

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

@ -348,8 +348,8 @@ let gFxAccounts = {
// An entryPoint param is used for server-side metrics. If the current tab
// is UITour, assume that it initiated the call to this method and override
// the entryPoint accordingly.
if (UITour.originTabs.get(window) &&
UITour.originTabs.get(window).has(gBrowser.selectedTab)) {
if (UITour.tourBrowsersByWindow.get(window) &&
UITour.tourBrowsersByWindow.get(window).has(gBrowser.selectedBrowser)) {
urlParams.entryPoint = "uitour";
}
let params = new URLSearchParams();

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

@ -305,7 +305,8 @@ let gSyncUI = {
this.openPrefs();
} else {
// If the user is also in an uitour, set the entrypoint to `uitour`
if (UITour.originTabs.get(window) && UITour.originTabs.get(window).has(gBrowser.selectedTab)) {
if (UITour.tourBrowsersByWindow.get(window) &&
UITour.tourBrowsersByWindow.get(window).has(gBrowser.selectedBrowser)) {
entryPoint = "uitour";
}
switchToTabHavingURI("about:accounts?entrypoint=" + entryPoint, true, {

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

@ -2656,15 +2656,6 @@
if (this.tabs.length == 1)
return null;
let event = new CustomEvent("TabBecomingWindow", {
bubbles: true,
cancelable: true
});
aTab.dispatchEvent(event);
if (event.defaultPrevented) {
return null;
}
var options = "chrome,dialog=no,all";
for (var name in aOptions)
options += "," + name + "=" + aOptions[name];

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

@ -22,8 +22,8 @@ function openAboutAccountsFromMenuPanel(entryPoint) {
yield PanelUI.show();
if (entryPoint == "uitour") {
UITour.originTabs.set(window, new Set());
UITour.originTabs.get(window).add(gBrowser.selectedTab);
UITour.tourBrowsersByWindow.set(window, new Set());
UITour.tourBrowsersByWindow.get(window).add(gBrowser.selectedBrowser);
}
let syncButton = document.getElementById("sync-button");
@ -65,7 +65,7 @@ function asyncCleanup() {
// restore the tabs
gBrowser.addTab(initialLocation);
gBrowser.removeTab(newTab);
UITour.originTabs.delete(window);
UITour.tourBrowsersByWindow.delete(window);
}
add_task(() => openAboutAccountsFromMenuPanel("syncbutton"));

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

@ -180,14 +180,6 @@ if (typeof Mozilla == 'undefined') {
nextTheme();
};
Mozilla.UITour.addPinnedTab = function() {
_sendEvent('addPinnedTab');
};
Mozilla.UITour.removePinnedTab = function() {
_sendEvent('removePinnedTab');
};
Mozilla.UITour.showMenu = function(name, callback) {
var showCallbackID;
if (callback)

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

@ -29,6 +29,15 @@ XPCOMUtils.defineLazyModuleGetter(this, "Metrics",
// See LOG_LEVELS in Console.jsm. Common examples: "All", "Info", "Warn", & "Error".
const PREF_LOG_LEVEL = "browser.uitour.loglevel";
const PREF_SEENPAGEIDS = "browser.uitour.seenPageIDs";
const BACKGROUND_PAGE_ACTIONS_ALLOWED = new Set([
"getConfiguration",
"getTreatmentTag",
"ping",
"registerPageID",
"setConfiguration",
"setTreatmentTag",
]);
const MAX_BUTTONS = 4;
const BUCKET_NAME = "UITour";
@ -59,20 +68,14 @@ XPCOMUtils.defineLazyGetter(this, "log", () => {
this.UITour = {
url: null,
seenPageIDs: null,
pageIDSourceTabs: new WeakMap(),
pageIDSourceWindows: new WeakMap(),
/* Map from browser windows to a set of tabs in which a tour is open */
originTabs: new WeakMap(),
/* Map from browser windows to a set of pinned tabs opened by (a) tour(s) */
pinnedTabs: new WeakMap(),
pageIDSourceBrowsers: new WeakMap(),
/* Map from browser chrome windows to a Set of <browser>s in which a tour is open (both visible and hidden) */
tourBrowsersByWindow: new WeakMap(),
urlbarCapture: new WeakMap(),
appMenuOpenForAnnotation: new Set(),
availableTargetsCache: new WeakMap(),
_detachingTab: false,
_annotationPanelMutationObservers: new WeakMap(),
_queuedEvents: [],
_pendingDoc: null,
highlightEffects: ["random", "wobble", "zoom", "color"],
targets: new Map([
@ -332,7 +335,7 @@ this.UITour = {
let tab = window.gBrowser.getTabForBrowser(browser);
let messageManager = browser.messageManager;
log.debug("onPageEvent:", aEvent.detail);
log.debug("onPageEvent:", aEvent.detail, aMessage);
if (typeof aEvent.detail != "object") {
log.warn("Malformed event - detail not an object");
@ -351,23 +354,18 @@ this.UITour = {
return false;
}
if ((aEvent.pageVisibilityState == "hidden" ||
aEvent.pageVisibilityState == "unloaded") &&
!BACKGROUND_PAGE_ACTIONS_ALLOWED.has(action)) {
log.warn("Ignoring disallowed action from a hidden page:", action);
return false;
}
// Do this before bailing if there's no tab, so later we can pick up the pieces:
window.gBrowser.tabContainer.addEventListener("TabSelect", this);
if (!window.gMultiProcessBrowser) { // Non-e10s. See bug 1089000.
contentDocument = browser.contentWindow.document;
if (!tab) {
// This should only happen while detaching a tab:
if (this._detachingTab) {
log.debug("Got event while detatching a tab");
this._queuedEvents.push(aEvent);
this._pendingDoc = Cu.getWeakReference(contentDocument);
return;
}
log.error("Discarding tabless UITour event (" + action + ") while not detaching a tab." +
"This shouldn't happen!");
return;
}
}
switch (action) {
@ -387,12 +385,7 @@ this.UITour = {
}
this.addSeenPageID(data.pageID);
// Store tabs and windows separately so we don't need to loop over all
// tabs when a window is closed.
this.pageIDSourceTabs.set(tab, data.pageID);
this.pageIDSourceWindows.set(window, data.pageID);
this.pageIDSourceBrowsers.set(browser, data.pageID);
this.setTelemetryBucket(data.pageID);
break;
@ -485,16 +478,6 @@ this.UITour = {
break;
}
case "addPinnedTab": {
this.ensurePinnedTab(window, true);
break;
}
case "removePinnedTab": {
this.removePinnedTab(window);
break;
}
case "showMenu": {
this.showMenu(window, data.name, () => {
if (typeof data.showCallbackID == "string")
@ -650,101 +633,55 @@ this.UITour = {
}
}
if (!window.gMultiProcessBrowser) { // Non-e10s. See bug 1089000.
if (!this.originTabs.has(window)) {
this.originTabs.set(window, new Set());
}
this.originTabs.get(window).add(tab);
tab.addEventListener("TabClose", this);
tab.addEventListener("TabBecomingWindow", this);
window.addEventListener("SSWindowClosing", this);
if (!this.tourBrowsersByWindow.has(window)) {
this.tourBrowsersByWindow.set(window, new Set());
}
this.tourBrowsersByWindow.get(window).add(browser);
// We don't have a tab if we're in a <browser> without a tab.
if (tab) {
tab.addEventListener("TabClose", this);
}
window.addEventListener("SSWindowClosing", this);
return true;
},
handleEvent: function(aEvent) {
log.debug("handleEvent: type =", aEvent.type, "event =", aEvent);
switch (aEvent.type) {
case "pagehide": {
let window = this.getChromeWindow(aEvent.target);
this.teardownTour(window);
this.teardownTourForWindow(window);
break;
}
case "TabBecomingWindow":
this._detachingTab = true;
// Fall through
case "TabClose": {
let tab = aEvent.target;
if (this.pageIDSourceTabs.has(tab)) {
let pageID = this.pageIDSourceTabs.get(tab);
// Delete this from the window cache, so if the window is closed we
// don't expire this page ID twice.
let window = tab.ownerDocument.defaultView;
if (this.pageIDSourceWindows.get(window) == pageID)
this.pageIDSourceWindows.delete(window);
this.setExpiringTelemetryBucket(pageID, "closed");
}
let window = tab.ownerDocument.defaultView;
this.teardownTour(window);
this.teardownTourForBrowser(window, tab.linkedBrowser, true);
break;
}
case "TabSelect": {
let window = aEvent.target.ownerDocument.defaultView;
// Teardown the browser of the tab we just switched away from.
if (aEvent.detail && aEvent.detail.previousTab) {
let previousTab = aEvent.detail.previousTab;
if (this.pageIDSourceTabs.has(previousTab)) {
let pageID = this.pageIDSourceTabs.get(previousTab);
this.setExpiringTelemetryBucket(pageID, "inactive");
let openTourWindows = this.tourBrowsersByWindow.get(window);
if (openTourWindows.has(previousTab.linkedBrowser)) {
this.teardownTourForBrowser(window, previousTab.linkedBrowser, false);
}
}
let window = aEvent.target.ownerDocument.defaultView;
let selectedTab = window.gBrowser.selectedTab;
let pinnedTab = this.pinnedTabs.get(window);
if (pinnedTab && pinnedTab.tab == selectedTab)
break;
let originTabs = this.originTabs.get(window);
if (originTabs && originTabs.has(selectedTab))
break;
let pendingDoc;
if (this._detachingTab && this._pendingDoc && (pendingDoc = this._pendingDoc.get())) {
if (selectedTab.linkedBrowser.contentDocument == pendingDoc) {
if (!this.originTabs.get(window)) {
this.originTabs.set(window, new Set());
}
this.originTabs.get(window).add(selectedTab);
this.pendingDoc = null;
this._detachingTab = false;
while (this._queuedEvents.length) {
try {
this.onPageEvent(this._queuedEvents.shift());
} catch (ex) {
log.error(ex);
}
}
break;
}
}
this.teardownTour(window);
break;
}
case "SSWindowClosing": {
let window = aEvent.target;
if (this.pageIDSourceWindows.has(window)) {
let pageID = this.pageIDSourceWindows.get(window);
this.setExpiringTelemetryBucket(pageID, "closed");
}
this.teardownTour(window, true);
this.teardownTourForWindow(window);
break;
}
@ -779,29 +716,35 @@ this.UITour = {
};
},
teardownTour: function(aWindow, aWindowClosing = false) {
log.debug("teardownTour: aWindowClosing = " + aWindowClosing);
aWindow.gBrowser.tabContainer.removeEventListener("TabSelect", this);
aWindow.removeEventListener("SSWindowClosing", this);
/**
* Tear down a tour from a tab e.g. upon switching/closing tabs.
*/
teardownTourForBrowser: function(aWindow, aBrowser, aTourPageClosing = false) {
log.debug("teardownTourForBrowser: aBrowser = ", aBrowser, aTourPageClosing);
let originTabs = this.originTabs.get(aWindow);
if (originTabs) {
for (let tab of originTabs) {
if (this.pageIDSourceBrowsers.has(aBrowser)) {
let pageID = this.pageIDSourceBrowsers.get(aBrowser);
this.setExpiringTelemetryBucket(pageID, aTourPageClosing ? "closed" : "inactive");
}
let openTourBrowsers = this.tourBrowsersByWindow.get(aWindow);
if (aTourPageClosing) {
let tab = aWindow.gBrowser.getTabForBrowser(aBrowser);
if (tab) { // Handle standalone <browser>
tab.removeEventListener("TabClose", this);
tab.removeEventListener("TabBecomingWindow", this);
if (openTourBrowsers) {
openTourBrowsers.delete(aBrowser);
}
}
}
this.originTabs.delete(aWindow);
if (!aWindowClosing) {
this.hideHighlight(aWindow);
this.hideInfo(aWindow);
// Ensure the menu panel is hidden before calling recreatePopup so popup events occur.
this.hideMenu(aWindow, "appMenu");
this.hideMenu(aWindow, "loop");
}
this.hideHighlight(aWindow);
this.hideInfo(aWindow);
// Ensure the menu panel is hidden before calling recreatePopup so popup events occur.
this.hideMenu(aWindow, "appMenu");
this.hideMenu(aWindow, "loop");
// Clean up panel listeners after we may have called hideMenu above.
// Clean up panel listeners after calling hideMenu above.
aWindow.PanelUI.panel.removeEventListener("popuphiding", this.hideAppMenuAnnotations);
aWindow.PanelUI.panel.removeEventListener("ViewShowing", this.hideAppMenuAnnotations);
aWindow.PanelUI.panel.removeEventListener("popuphidden", this.onPanelHidden);
@ -810,8 +753,36 @@ this.UITour = {
loopPanel.removeEventListener("popuphiding", this.hideLoopPanelAnnotations);
this.endUrlbarCapture(aWindow);
this.removePinnedTab(aWindow);
this.resetTheme();
// If there are no more tour tabs left in the window, teardown the tour for the whole window.
if (!openTourBrowsers || openTourBrowsers.size == 0) {
this.teardownTourForWindow(aWindow);
}
},
/**
* Tear down all tours for a ChromeWindow.
*/
teardownTourForWindow: function(aWindow) {
log.debug("teardownTourForWindow");
aWindow.gBrowser.tabContainer.removeEventListener("TabSelect", this);
aWindow.removeEventListener("SSWindowClosing", this);
let openTourBrowsers = this.tourBrowsersByWindow.get(aWindow);
if (openTourBrowsers) {
for (let browser of openTourBrowsers) {
if (this.pageIDSourceBrowsers.has(browser)) {
let pageID = this.pageIDSourceBrowsers.get(browser);
this.setExpiringTelemetryBucket(pageID, "closed");
}
let tab = aWindow.gBrowser.getTabForBrowser(browser);
tab.removeEventListener("TabClose", this);
}
}
this.tourBrowsersByWindow.delete(aWindow);
},
getChromeWindow: function(aContentDocument) {
@ -875,14 +846,6 @@ this.UITour = {
return deferred.promise;
}
if (aTargetName == "pinnedTab") {
deferred.resolve({
targetName: aTargetName,
node: this.ensurePinnedTab(aWindow, aSticky)
});
return deferred.promise;
}
if (aTargetName.startsWith(TARGET_SEARCHENGINE_PREFIX)) {
let engineID = aTargetName.slice(TARGET_SEARCHENGINE_PREFIX.length);
return this.getSearchEngineTarget(aWindow, engineID);
@ -996,36 +959,6 @@ this.UITour = {
LightweightThemeManager.resetPreview();
},
ensurePinnedTab: function(aWindow, aSticky = false) {
let tabInfo = this.pinnedTabs.get(aWindow);
if (tabInfo) {
tabInfo.sticky = tabInfo.sticky || aSticky;
} else {
let url = Services.urlFormatter.formatURLPref("browser.uitour.pinnedTabUrl");
let tab = aWindow.gBrowser.addTab(url);
aWindow.gBrowser.pinTab(tab);
tab.addEventListener("TabClose", () => {
this.pinnedTabs.delete(aWindow);
});
tabInfo = {
tab: tab,
sticky: aSticky
};
this.pinnedTabs.set(aWindow, tabInfo);
}
return tabInfo.tab;
},
removePinnedTab: function(aWindow) {
let tabInfo = this.pinnedTabs.get(aWindow);
if (tabInfo)
aWindow.gBrowser.removeTab(tabInfo.tab);
},
/**
* @param aChromeWindow The chrome window that the highlight is in. Necessary since some targets
* are in a sub-frame so the defaultView is not the same as the chrome
@ -1127,10 +1060,6 @@ this.UITour = {
},
hideHighlight: function(aWindow) {
let tabData = this.pinnedTabs.get(aWindow);
if (tabData && !tabData.sticky)
this.removePinnedTab(aWindow);
let highlighter = aWindow.document.getElementById("UITourHighlight");
this._removeAnnotationPanelMutationObserver(highlighter.parentElement);
highlighter.parentElement.hidePopup();
@ -1294,6 +1223,7 @@ this.UITour = {
},
showMenu: function(aWindow, aMenuName, aOpenCallback = null) {
log.debug("showMenu:", aMenuName);
function openMenuButton(aMenuBtn) {
if (!aMenuBtn || !aMenuBtn.boxObject || aMenuBtn.open) {
if (aOpenCallback)
@ -1358,6 +1288,7 @@ this.UITour = {
},
hideMenu: function(aWindow, aMenuName) {
log.debug("hideMenu:", aMenuName);
function closeMenuButton(aMenuBtn) {
if (aMenuBtn && aMenuBtn.boxObject)
aMenuBtn.boxObject.openMenu(false);
@ -1529,10 +1460,7 @@ this.UITour = {
}
let targetObjects = yield Promise.all(promises);
let targetNames = [
"pinnedTab",
];
let targetNames = [];
for (let targetObject of targetObjects) {
if (targetObject.node)
targetNames.push(targetObject.targetName);
@ -1690,12 +1618,16 @@ this.UITour = {
if (window.closed)
continue;
let originTabs = this.originTabs.get(window);
if (!originTabs)
let openTourBrowsers = this.tourBrowsersByWindow.get(window);
if (!openTourBrowsers)
continue;
for (let tab of originTabs) {
let messageManager = tab.linkedBrowser.messageManager;
for (let browser of openTourBrowsers) {
let messageManager = browser.messageManager;
if (!messageManager) {
log.error("notify: Trying to notify a browser without a messageManager", browser);
continue;
}
let detail = {
event: eventName,
params: params,

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

@ -17,7 +17,11 @@ let UITourListener = {
}
addMessageListener("UITour:SendPageCallback", this);
addMessageListener("UITour:SendPageNotification", this);
sendAsyncMessage("UITour:onPageEvent", {detail: event.detail, type: event.type});
sendAsyncMessage("UITour:onPageEvent", {
detail: event.detail,
type: event.type,
pageVisibilityState: content.document.visibilityState,
});
},
isTestingOrigin: function(aURI) {

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

@ -67,28 +67,6 @@ let tests = [
});
}).then(null, Components.utils.reportError);
},
taskify(function* test_pinnedTab() {
is(UITour.pinnedTabs.get(window), null, "Should not already have a pinned tab");
yield addPinnedTabPromise();
let tabInfo = UITour.pinnedTabs.get(window);
isnot(tabInfo, null, "Should have recorded data about a pinned tab after addPinnedTab()");
isnot(tabInfo.tab, null, "Should have added a pinned tab after addPinnedTab()");
is(tabInfo.tab.pinned, true, "Tab should be marked as pinned");
let tab = tabInfo.tab;
yield removePinnedTabPromise();
isnot(gBrowser.tabs[0], tab, "First tab should not be the pinned tab");
tabInfo = UITour.pinnedTabs.get(window);
is(tabInfo, null, "Should not have any data about the removed pinned tab after removePinnedTab()");
yield addPinnedTabPromise();
yield addPinnedTabPromise();
yield addPinnedTabPromise();
is(gBrowser.tabs[1].pinned, false, "After multiple calls of addPinnedTab, should still only have one pinned tab");
}),
taskify(function* test_bookmarks_menu() {
let bookmarksMenuButton = document.getElementById("bookmarks-menu-button");

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

@ -37,7 +37,6 @@ let tests = [
"home",
"loop",
"devtools",
"pinnedTab",
"privateWindow",
"quit",
"search",
@ -68,7 +67,6 @@ let tests = [
"loop",
"devtools",
"home",
"pinnedTab",
"privateWindow",
"quit",
"search",
@ -104,7 +102,6 @@ let tests = [
"home",
"loop",
"devtools",
"pinnedTab",
"privateWindow",
"quit",
"urlbar",

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

@ -68,8 +68,8 @@ let tests = [
let selectedTab = gContentWindow.gBrowser.selectedTab;
is(selectedTab.linkedBrowser && selectedTab.linkedBrowser.contentDocument, gContentDoc, "Document should be selected in new window");
ok(UITour.originTabs && UITour.originTabs.has(gContentWindow), "Window should be known");
ok(UITour.originTabs.get(gContentWindow).has(selectedTab), "Tab should be known");
ok(UITour.tourBrowsersByWindow && UITour.tourBrowsersByWindow.has(gContentWindow), "Window should be known");
ok(UITour.tourBrowsersByWindow.get(gContentWindow).has(selectedTab.linkedBrowser), "Selected browser should be known");
let shownPromise = promisePanelShown(gContentWindow);
gContentAPI.showMenu("appMenu");

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

@ -48,4 +48,40 @@ let tests = [
UITour.notify("test-event-3", {key: "something"});
});
},
];
function test_background_tab(done) {
function listener(event, params) {
is(event, "test-event-background-1", "Correct event name");
is(params, null, "No param object");
gContentAPI.observe(null);
gBrowser.removeCurrentTab();
done();
}
gContentAPI.observe(listener, () => {
gBrowser.selectedTab = gBrowser.addTab("about:blank");
isnot(gBrowser.selectedTab, gTestTab, "Make sure the selected tab changed");
UITour.notify("test-event-background-1");
});
},
// Make sure the tab isn't torn down when switching back to the tour one.
function test_background_then_foreground_tab(done) {
let blankTab = null;
function listener(event, params) {
is(event, "test-event-4", "Correct event name");
is(params, null, "No param object");
gContentAPI.observe(null);
gBrowser.removeTab(blankTab);
done();
}
gContentAPI.observe(listener, () => {
blankTab = gBrowser.selectedTab = gBrowser.addTab("about:blank");
isnot(gBrowser.selectedTab, gTestTab, "Make sure the selected tab changed");
gBrowser.selectedTab = gTestTab;
is(gBrowser.selectedTab, gTestTab, "Switch back to the test tab");
UITour.notify("test-event-4");
});
},
];

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

@ -145,25 +145,6 @@ function waitForCallbackResultPromise() {
}, "callback should be called");
}
function addPinnedTabPromise() {
gContentAPI.addPinnedTab();
return waitForConditionPromise(() => {
let tabInfo = UITour.pinnedTabs.get(window);
if (!tabInfo) {
return false;
}
return tabInfo.tab.pinned;
});
}
function removePinnedTabPromise() {
gContentAPI.removePinnedTab();
return waitForConditionPromise(() => {
let tabInfo = UITour.pinnedTabs.get(window);
return tabInfo == null;
});
}
function promisePanelShown(win) {
let panelEl = win.PanelUI.panel;
return promisePanelElementShown(win, panelEl);
@ -251,8 +232,6 @@ function UITourTest() {
isnot(PanelUI.panel.state, "open", "The panel shouldn't be open");
is(document.getElementById("PanelUI-menu-button").hasAttribute("open"), false, "Menu button should know that the menu is closed");
is(UITour.pinnedTabs.get(window), null, "Any pinned tab should be closed after UITour tab is closed");
executeSoon(nextTest);
});
}

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

@ -190,6 +190,10 @@ AppValidator.prototype._getOriginURL = function () {
};
AppValidator.prototype.validateLaunchPath = function (manifest) {
// Addons don't use index page (yet?)
if (manifest.role && manifest.role === "addon") {
return promise.resolve();
}
let deferred = promise.defer();
// The launch_path field has to start with a `/`
if (manifest.launch_path && manifest.launch_path[0] !== "/") {

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

@ -31,9 +31,10 @@ function spawnTest() {
}
function inspectAndWaitForCopy() {
return waitForClipboard(() => {
inspectPage(); // setup: inspect the page
}, DIV_COLOR);
let copied = waitForClipboard(() => {}, DIV_COLOR);
let ready = inspectPage(); // resolves once eyedropper is destroyed
return Promise.all([copied, ready]);
}
function inspectPage() {
@ -54,6 +55,7 @@ function inspectPage() {
EventUtils.synthesizeMouse(target, x + 10, y + 10, { type: "mousemove" }, win);
EventUtils.synthesizeMouse(target, x + 10, y + 10, {}, win);
return dropper.once("destroy");
});
})
}

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

@ -400,6 +400,16 @@ let NetMonitorController = {
!this._target.isApp);
},
/**
* Getter that tells if the server includes the transferred (compressed /
* encoded) response size.
* @type boolean
*/
get supportsTransferredResponseSize() {
return this.webConsoleClient &&
this.webConsoleClient.traits.transferredResponseSize;
},
/**
* Getter that tells if the server can do network performance statistics.
* @type boolean
@ -606,6 +616,7 @@ NetworkEventsHandler.prototype = {
case "responseContent":
NetMonitorView.RequestsMenu.updateRequest(aPacket.from, {
contentSize: aPacket.contentSize,
transferredSize: aPacket.transferredSize,
mimeType: aPacket.mimeType
});
this.webConsoleClient.getResponseContent(actor, this._onResponseContent);

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

@ -417,6 +417,11 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
$("#requests-menu-network-summary-button").hidden = true;
$("#requests-menu-network-summary-label").hidden = true;
}
if (!NetMonitorController.supportsTransferredResponseSize) {
$("#requests-menu-transferred-header-box").hidden = true;
$("#requests-menu-item-template .requests-menu-transferred").hidden = true;
}
},
/**
@ -800,8 +805,8 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
* Sorts all network requests in this container by a specified detail.
*
* @param string aType
* Either "status", "method", "file", "domain", "type", "size" or
* "waterfall".
* Either "status", "method", "file", "domain", "type", "transferred",
* "size" or "waterfall".
*/
sortBy: function(aType = "waterfall") {
let target = $("#requests-menu-" + aType + "-button");
@ -862,6 +867,13 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
this.sortContents((a, b) => !this._byType(a, b));
}
break;
case "transferred":
if (direction == "ascending") {
this.sortContents(this._byTransferred);
} else {
this.sortContents((a, b) => !this._byTransferred(a, b));
}
break;
case "size":
if (direction == "ascending") {
this.sortContents(this._bySize);
@ -994,8 +1006,13 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
: firstType > secondType;
},
_bySize: function({ attachment: first }, { attachment: second })
first.contentSize > second.contentSize,
_byTransferred: function({ attachment: first }, { attachment: second }) {
return first.transferredSize > second.transferredSize;
},
_bySize: function({ attachment: first }, { attachment: second }) {
return first.contentSize > second.contentSize;
},
/**
* Refreshes the status displayed in this container's footer, providing
@ -1178,6 +1195,10 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
requestItem.attachment.contentSize = value;
this.updateMenuView(requestItem, key, value);
break;
case "transferredSize":
requestItem.attachment.transferredSize = value;
this.updateMenuView(requestItem, key, value);
break;
case "mimeType":
requestItem.attachment.mimeType = value;
this.updateMenuView(requestItem, key, value);
@ -1335,6 +1356,20 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
node.setAttribute("tooltiptext", text);
break;
}
case "transferredSize": {
let text;
if (aValue === null) {
text = L10N.getStr("networkMenu.sizeUnavailable");
} else {
let kb = aValue / 1024;
let size = L10N.numberWithDecimals(kb, CONTENT_SIZE_DECIMALS);
text = L10N.getFormatStr("networkMenu.sizeKB", size);
}
let node = $(".requests-menu-transferred", target);
node.setAttribute("value", text);
node.setAttribute("tooltiptext", text);
break;
}
case "mimeType": {
let type = this._getAbbreviatedMimeType(aValue);
let node = $(".requests-menu-type", target);

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

@ -103,6 +103,16 @@
flex="1">
</button>
</hbox>
<hbox id="requests-menu-transferred-header-box"
class="requests-menu-header requests-menu-transferred"
align="center">
<button id="requests-menu-transferred-button"
class="requests-menu-header-button requests-menu-transferred"
data-key="transferred"
label="&netmonitorUI.toolbar.transferred;"
flex="1">
</button>
</hbox>
<hbox id="requests-menu-size-header-box"
class="requests-menu-header requests-menu-size"
align="center">
@ -181,6 +191,8 @@
</hbox>
<label class="plain requests-menu-subitem requests-menu-type"
crop="end"/>
<label class="plain requests-menu-subitem requests-menu-transferred"
crop="end"/>
<label class="plain requests-menu-subitem requests-menu-size"
crop="end"/>
<hbox class="requests-menu-subitem requests-menu-waterfall"

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

@ -65,6 +65,8 @@ function test() {
is(requestItem.attachment.headersSize, undefined,
"The headersSize should not yet be set.");
is(requestItem.attachment.transferredSize, undefined,
"The transferredSize should not yet be set.");
is(requestItem.attachment.contentSize, undefined,
"The contentSize should not yet be set.");
@ -156,6 +158,8 @@ function test() {
aMonitor.panelWin.once(aMonitor.panelWin.EVENTS.UPDATING_RESPONSE_CONTENT, () => {
let requestItem = RequestsMenu.getItemAtIndex(0);
is(requestItem.attachment.transferredSize, "12",
"The transferredSize attachment has an incorrect value.");
is(requestItem.attachment.contentSize, "12",
"The contentSize attachment has an incorrect value.");
is(requestItem.attachment.mimeType, "text/plain; charset=utf-8",
@ -164,6 +168,7 @@ function test() {
verifyRequestItemTarget(requestItem, "GET", SIMPLE_SJS, {
type: "plain",
fullMimeType: "text/plain; charset=utf-8",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.01),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.01),
});
});
@ -183,6 +188,7 @@ function test() {
verifyRequestItemTarget(requestItem, "GET", SIMPLE_SJS, {
type: "plain",
fullMimeType: "text/plain; charset=utf-8",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.01),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.01),
});
});

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

@ -202,6 +202,7 @@ function test() {
statusText: "Switching Protocols",
type: "plain",
fullMimeType: "text/plain; charset=utf-8",
transferred: L10N.getStr("networkMenu.sizeUnavailable"),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0),
time: true
});
@ -211,6 +212,7 @@ function test() {
statusText: "Created",
type: "plain",
fullMimeType: "text/plain; charset=utf-8",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.02),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.02),
time: true
});
@ -220,6 +222,7 @@ function test() {
statusText: "See Other",
type: "plain",
fullMimeType: "text/plain; charset=utf-8",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.02),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0),
time: true
});
@ -229,6 +232,7 @@ function test() {
statusText: "Not Found",
type: "plain",
fullMimeType: "text/plain; charset=utf-8",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.02),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.02),
time: true
});
@ -238,6 +242,7 @@ function test() {
statusText: "Not Implemented",
type: "plain",
fullMimeType: "text/plain; charset=utf-8",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.02),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.02),
time: true
});

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

@ -102,6 +102,24 @@ function test() {
testHeaders("type", "ascending");
return testContents([0, 1, 2, 3, 4]);
})
.then(() => {
info("Testing transferred sort, ascending.");
EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-transferred-button"));
testHeaders("transferred", "ascending");
return testContents([0, 1, 2, 3, 4]);
})
.then(() => {
info("Testing transferred sort, descending.");
EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-transferred-button"));
testHeaders("transferred", "descending");
return testContents([4, 3, 2, 1, 0]);
})
.then(() => {
info("Testing transferred sort, ascending. Checking sort loops correctly.");
EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-transferred-button"));
testHeaders("transferred", "ascending");
return testContents([0, 1, 2, 3, 4]);
})
.then(() => {
info("Testing size sort, ascending.");
EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-size-button"));
@ -199,6 +217,7 @@ function test() {
statusText: "Meh",
type: "1",
fullMimeType: "text/1",
transferred: L10N.getStr("networkMenu.sizeUnavailable"),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0),
time: true
});
@ -209,6 +228,7 @@ function test() {
statusText: "Meh",
type: "2",
fullMimeType: "text/2",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.01),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.01),
time: true
});
@ -219,6 +239,7 @@ function test() {
statusText: "Meh",
type: "3",
fullMimeType: "text/3",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.02),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.02),
time: true
});
@ -229,6 +250,7 @@ function test() {
statusText: "Meh",
type: "4",
fullMimeType: "text/4",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.03),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.03),
time: true
});
@ -239,6 +261,7 @@ function test() {
statusText: "Meh",
type: "5",
fullMimeType: "text/5",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.04),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.04),
time: true
});

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

@ -130,6 +130,7 @@ function test() {
statusText: "Meh",
type: "1",
fullMimeType: "text/1",
transferred: L10N.getStr("networkMenu.sizeUnavailable"),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0),
time: true
});
@ -142,6 +143,7 @@ function test() {
statusText: "Meh",
type: "2",
fullMimeType: "text/2",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.01),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.01),
time: true
});
@ -154,6 +156,7 @@ function test() {
statusText: "Meh",
type: "3",
fullMimeType: "text/3",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.02),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.02),
time: true
});
@ -166,6 +169,7 @@ function test() {
statusText: "Meh",
type: "4",
fullMimeType: "text/4",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.03),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.03),
time: true
});
@ -178,6 +182,7 @@ function test() {
statusText: "Meh",
type: "5",
fullMimeType: "text/5",
transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.04),
size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.04),
time: true
});

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

@ -12,6 +12,12 @@ function test() {
let { document, L10N, NetMonitorView } = aMonitor.panelWin;
let { RequestsMenu } = NetMonitorView;
// Disable transferred size column support for this test.
// Without this, the waterfall only has enough room for one division, which
// would remove most of the value of this test.
document.querySelector("#requests-menu-transferred-header-box").hidden = true;
document.querySelector("#requests-menu-item-template .requests-menu-transferred").hidden = true;
RequestsMenu.lazyUpdate = false;
ok(document.querySelector("#requests-menu-waterfall-label"),

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

@ -266,7 +266,7 @@ function verifyRequestItemTarget(aRequestItem, aMethod, aUrl, aData = {}) {
info("Widget index of item: " + widgetIndex);
info("Visible index of item: " + visibleIndex);
let { fuzzyUrl, status, statusText, type, fullMimeType, size, time } = aData;
let { fuzzyUrl, status, statusText, type, fullMimeType, transferred, size, time } = aData;
let { attachment, target } = aRequestItem
let uri = Services.io.newURI(aUrl, null, null).QueryInterface(Ci.nsIURL);
@ -321,6 +321,14 @@ function verifyRequestItemTarget(aRequestItem, aMethod, aUrl, aData = {}) {
is(value, type, "The displayed type is incorrect.");
is(tooltip, fullMimeType, "The tooltip type is incorrect.");
}
if (transferred !== undefined) {
let value = target.querySelector(".requests-menu-transferred").getAttribute("value");
let tooltip = target.querySelector(".requests-menu-transferred").getAttribute("tooltiptext");
info("Displayed transferred size: " + value);
info("Tooltip transferred size: " + tooltip);
is(value, transferred, "The displayed transferred size is incorrect.");
is(tooltip, transferred, "The tooltip transferred size is incorrect.");
}
if (size !== undefined) {
let value = target.querySelector(".requests-menu-size").getAttribute("value");
let tooltip = target.querySelector(".requests-menu-size").getAttribute("tooltiptext");

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

@ -95,7 +95,7 @@
</toolbar>
<tabs>
<tab id="properties-tab"
label="&webAudioEditorUI.tab.properties;"/>
label="&webAudioEditorUI.tab.properties2;"/>
<tab id="automation-tab"
label="&webAudioEditorUI.tab.automation;"/>
</tabs>

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

@ -256,6 +256,7 @@ run-if = os == "win"
[browser_webconsole_bug_632347_iterators_generators.js]
skip-if = e10s # Bug 1042253 - webconsole tests disabled with e10s
[browser_webconsole_bug_632817.js]
skip-if = e10s # Bug 1042253 - webconsole tests disabled with e10s
[browser_webconsole_bug_642108_pruneTest.js]
[browser_webconsole_autocomplete_and_selfxss.js]
[browser_webconsole_bug_644419_log_limits.js]

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

@ -80,7 +80,7 @@ function consoleOpened(hud)
name: "network message",
text: "test-console.html",
category: CATEGORY_NETWORK,
severity: SEVERITY_LOG,
severity: SEVERITY_INFO,
},
],
});

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

@ -5,7 +5,8 @@ const prefs = {
"net": [
"network",
"netwarn",
"networkinfo",
"netxhr",
"networkinfo"
],
"css": [
"csserror",

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

@ -21,10 +21,13 @@ function test()
{
const PREF = "devtools.webconsole.persistlog";
let original = Services.prefs.getBoolPref("devtools.webconsole.filter.networkinfo");
let originalXhr = Services.prefs.getBoolPref("devtools.webconsole.filter.netxhr");
Services.prefs.setBoolPref("devtools.webconsole.filter.networkinfo", true);
Services.prefs.setBoolPref("devtools.webconsole.filter.netxhr", true);
Services.prefs.setBoolPref(PREF, true);
registerCleanupFunction(() => {
Services.prefs.setBoolPref("devtools.webconsole.filter.networkinfo", original);
Services.prefs.setBoolPref("devtools.webconsole.filter.netxhr", originalXhr);
Services.prefs.clearUserPref(PREF);
});
@ -139,7 +142,7 @@ function testFormSubmission()
{
text: "test-data.json",
category: CATEGORY_NETWORK,
severity: SEVERITY_LOG,
severity: SEVERITY_INFO,
count: 2,
},
],

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

@ -105,14 +105,14 @@ const SEVERITY_CLASS_FRAGMENTS = [
// Most of these rather idiosyncratic names are historical and predate the
// division of message type into "category" and "severity".
const MESSAGE_PREFERENCE_KEYS = [
// Error Warning Info Log
[ "network", "netwarn", null, "networkinfo", ], // Network
[ "csserror", "cssparser", null, "csslog", ], // CSS
[ "exception", "jswarn", null, "jslog", ], // JS
[ "error", "warn", "info", "log", ], // Web Developer
[ null, null, null, null, ], // Input
[ null, null, null, null, ], // Output
[ "secerror", "secwarn", null, null, ], // Security
// Error Warning Info Log
[ "network", "netwarn", "netxhr", "networkinfo", ], // Network
[ "csserror", "cssparser", null, "csslog", ], // CSS
[ "exception", "jswarn", null, "jslog", ], // JS
[ "error", "warn", "info", "log", ], // Web Developer
[ null, null, null, null, ], // Input
[ null, null, null, null, ], // Output
[ "secerror", "secwarn", null, null, ], // Security
];
// A mapping from the console API log event levels to the Web Console
@ -547,25 +547,29 @@ WebConsoleFrame.prototype = {
});
}
let saveBodiesDisabled = !this.getFilterState("networkinfo") &&
!this.getFilterState("netxhr") &&
!this.getFilterState("network");
let saveBodies = doc.getElementById("saveBodies");
saveBodies.addEventListener("command", reverseSaveBodiesPref);
saveBodies.disabled = !this.getFilterState("networkinfo") &&
!this.getFilterState("network");
saveBodies.disabled = saveBodiesDisabled;
let saveBodiesContextMenu = doc.getElementById("saveBodiesContextMenu");
saveBodiesContextMenu.addEventListener("command", reverseSaveBodiesPref);
saveBodiesContextMenu.disabled = !this.getFilterState("networkinfo") &&
!this.getFilterState("network");
saveBodiesContextMenu.disabled = saveBodiesDisabled;
saveBodies.parentNode.addEventListener("popupshowing", () => {
updateSaveBodiesPrefUI(saveBodies);
saveBodies.disabled = !this.getFilterState("networkinfo") &&
!this.getFilterState("netxhr") &&
!this.getFilterState("network");
});
saveBodiesContextMenu.parentNode.addEventListener("popupshowing", () => {
updateSaveBodiesPrefUI(saveBodiesContextMenu);
saveBodiesContextMenu.disabled = !this.getFilterState("networkinfo") &&
!this.getFilterState("netxhr") &&
!this.getFilterState("network");
});
@ -624,7 +628,7 @@ WebConsoleFrame.prototype = {
{
let prefs = ["network", "networkinfo", "csserror", "cssparser", "csslog",
"exception", "jswarn", "jslog", "error", "info", "warn", "log",
"secerror", "secwarn", "netwarn"];
"secerror", "secwarn", "netwarn", "netxhr"];
for (let pref of prefs) {
this.filterPrefs[pref] = Services.prefs
.getBoolPref(this._filterPrefsPrefix + pref);
@ -883,8 +887,9 @@ WebConsoleFrame.prototype = {
this.setFilterState(prefKey, state);
// Disable the log response and request body if network logging is off.
if (prefKey == "networkinfo" || prefKey == "network") {
if (prefKey == "networkinfo" || prefKey == "netxhr" || prefKey == "network") {
let checkState = !this.getFilterState("networkinfo") &&
!this.getFilterState("netxhr") &&
!this.getFilterState("network");
this.document.getElementById("saveBodies").disabled = checkState;
this.document.getElementById("saveBodiesContextMenu").disabled = checkState;
@ -1493,6 +1498,9 @@ WebConsoleFrame.prototype = {
let request = networkInfo.request;
let clipboardText = request.method + " " + request.url;
let severity = SEVERITY_LOG;
if (networkInfo.isXHR) {
severity = SEVERITY_INFO;
}
let mixedRequest =
WebConsoleUtils.isMixedHTTPSRequest(request.url, this.contentLocation);
if (mixedRequest) {
@ -1750,6 +1758,7 @@ WebConsoleFrame.prototype = {
url: aActor.url,
method: aActor.method,
},
isXHR: aActor.isXHR,
response: {},
timings: {},
updates: [], // track the list of network event updates

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

@ -98,6 +98,8 @@ function goUpdateConsoleCommands() {
prefKey="network"/>
<menuitem label="&btnConsoleWarnings;" type="checkbox" autocheck="false"
prefKey="netwarn"/>
<menuitem label="&btnConsoleXhr;" type="checkbox" autocheck="false"
prefKey="netxhr"/>
<menuitem label="&btnConsoleLog;" type="checkbox" autocheck="false"
prefKey="networkinfo"/>
<menuseparator id="saveBodiesSeparator" />

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

@ -510,6 +510,12 @@ let AppManager = exports.AppManager = {
project.manifest);
}
// Addons don't have any document to load (yet?)
// So that there is no need to run them, installing is enough
if (project.manifest.role && project.manifest.role === "addon") {
return;
}
let {app} = response;
if (!app.running) {
let deferred = promise.defer();

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

@ -42,8 +42,14 @@
- in the network table toolbar, above the "type" column. -->
<!ENTITY netmonitorUI.toolbar.type "Type">
<!-- LOCALIZATION NOTE (netmonitorUI.toolbar.transferred): This is the label displayed
- in the network table toolbar, above the "transferred" column, which is the
- compressed / encoded size. -->
<!ENTITY netmonitorUI.toolbar.transferred "Transferred">
<!-- LOCALIZATION NOTE (netmonitorUI.toolbar.size): This is the label displayed
- in the network table toolbar, above the "size" column. -->
- in the network table toolbar, above the "size" column, which is the
- uncompressed / decoded size. -->
<!ENTITY netmonitorUI.toolbar.size "Size">
<!-- LOCALIZATION NOTE (netmonitorUI.toolbar.waterfall): This is the label displayed

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

@ -169,6 +169,11 @@ networkMenu.summary=One request, #2 KB, #3 s;#1 requests, #2 KB, #3 s
# in the network menu specifying the size of a request (in kilobytes).
networkMenu.sizeKB=%S KB
# LOCALIZATION NOTE (networkMenu.sizeUnavailable): This is the label displayed
# in the network menu specifying the transferred size of a request is
# unavailable.
networkMenu.sizeUnavailable=
# LOCALIZATION NOTE (networkMenu.totalMS): This is the label displayed
# in the network menu specifying the time for a request to finish (in milliseconds).
networkMenu.totalMS=→ %S ms

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

@ -73,6 +73,7 @@
<!ENTITY btnConsoleInfo "Info">
<!ENTITY btnConsoleWarnings "Warnings">
<!ENTITY btnConsoleLog "Log">
<!ENTITY btnConsoleXhr "XHR">
<!ENTITY btnConsoleReflows "Reflows">
<!ENTITY filterOutput.placeholder "Filter output">

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

@ -23,9 +23,9 @@
- while the page is refreshing and the tool waits for a audio context. -->
<!ENTITY webAudioEditorUI.emptyNotice "Waiting for an audio context to be created…">
<!-- LOCALIZATION NOTE (webAudioEditorUI.tab.properties): This is the label shown
<!-- LOCALIZATION NOTE (webAudioEditorUI.tab.properties2): This is the label shown
- for the properties tab view. -->
<!ENTITY webAudioEditorUI.tab.properties "Parameters">
<!ENTITY webAudioEditorUI.tab.properties2 "Properties">
<!-- LOCALIZATION NOTE (webAudioEditorUI.tab.automation): This is the label shown
- for the automation tab view. -->

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

@ -193,6 +193,11 @@
width: 8em;
}
.requests-menu-transferred {
text-align: center;
width: 8em;
}
/* Network requests table: status codes */
box.requests-menu-status {

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

@ -143,6 +143,12 @@ text {
* Inspector Styles
*/
/* hide the variables view scope title as its redundant,
* because there's only one scope displayed. */
.variables-view-scope > .title {
display: none;
}
#web-audio-inspector-title {
margin: 6px;
}

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

@ -141,6 +141,10 @@ treecol {
-moz-margin-start: 0;
}
#handlersView {
height: 25em;
}
#handlersView > richlistitem {
min-height: 36px !important;
}

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

@ -2171,12 +2171,11 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
nsNPAPIPluginInstance *inst =
(nsNPAPIPluginInstance *) (npp ? npp->ndata : nullptr);
double scaleFactor = inst ? inst->GetContentsScaleFactor() : 1.0;
// Work around a Flash bug that causes long hangs when Flash tries to
// display its camera and microphone access dialog while it thinks HiDPI
// support is available. This is Adobe bug ADBE 3921114, which should get
// fixed in a future release. When this happens we'll no longer need this
// workaround. See QUIRK_FLASH_HIDE_HIDPI_SUPPORT in PluginModuleChild.h,
// and also bug 1118615.
// Work around a Flash ActionScript bug that causes long hangs if
// Flash thinks HiDPI support is available. Adobe is tracking this as
// ADBE 3921114. If this turns out to be Adobe's fault and they fix it,
// we'll no longer need this quirk. See QUIRK_FLASH_HIDE_HIDPI_SUPPORT
// in PluginModuleChild.h, and also bug 1118615.
if (inst) {
const char *mimeType;
inst->GetMIMEType(&mimeType);

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

@ -283,11 +283,10 @@ public:
// CGContextRef we pass to it in NPP_HandleEvent(NPCocoaEventDrawRect)
// outside of that call. See bug 804606.
QUIRK_FLASH_AVOID_CGMODE_CRASHES = 1 << 10,
// Mac: Work around a Flash bug that causes long hangs when Flash
// tries to display its camera and microphone access dialog while
// it thinks HiDPI support is available. This is Adobe bug
// ADBE 3921114, which should get fixed in a future release. When
// this happens we'll no longer need this quirk. See bug 1118615.
// Mac: Work around a Flash ActionScript bug that causes long hangs if
// Flash thinks HiDPI support is available. Adobe is tracking this as
// ADBE 3921114. If this turns out to be Adobe's fault and they fix it,
// we'll no longer need this quirk. See bug 1118615.
QUIRK_FLASH_HIDE_HIDPI_SUPPORT = 1 << 11,
};

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

@ -8,9 +8,6 @@ package org.mozilla.gecko;
import android.os.Build;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* A collection of constants that pertain to the build and runtime state of the
* application. Typically these are sourced from build-time definitions (see
@ -27,6 +24,9 @@ public class AppConstants {
public static final String ANDROID_PACKAGE_NAME = "@ANDROID_PACKAGE_NAME@";
public static final String MANGLED_ANDROID_PACKAGE_NAME = "@MANGLED_ANDROID_PACKAGE_NAME@";
public static final String MOZ_ANDROID_SHARED_ACCOUNT_TYPE = "@MOZ_ANDROID_SHARED_ACCOUNT_TYPE@";
public static final String MOZ_ANDROID_SHARED_FXACCOUNT_TYPE = "@MOZ_ANDROID_SHARED_FXACCOUNT_TYPE@";
/**
* Encapsulates access to compile-time version definitions, allowing
* for dead code removal for particular APKs.
@ -92,6 +92,7 @@ public class AppConstants {
public static final String MOZ_APP_NAME = "@MOZ_APP_NAME@";
public static final String MOZ_APP_VENDOR = "@MOZ_APP_VENDOR@";
public static final String MOZ_APP_VERSION = "@MOZ_APP_VERSION@";
public static final String MOZ_APP_DISPLAYNAME = "@MOZ_APP_DISPLAYNAME@";
// MOZILLA_VERSION is already quoted when it gets substituted in. If we
// add additional quotes we end up with ""x.y"", which is a syntax error.

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

@ -30,15 +30,12 @@ endif
UA_BUILDID=$(shell echo $(ANDROID_VERSION_CODE) | cut -c1-8)
MOZ_BUILD_TIMESTAMP=$(shell echo `$(PYTHON) $(topsrcdir)/toolkit/xre/make-platformini.py --print-timestamp`)
DEFINES += \
-DANDROID_VERSION_CODE=$(ANDROID_VERSION_CODE) \
-DMOZ_ANDROID_SHARED_ID="$(MOZ_ANDROID_SHARED_ID)" \
-DMOZ_ANDROID_SHARED_ACCOUNT_TYPE="$(MOZ_ANDROID_SHARED_ACCOUNT_TYPE)" \
-DMOZ_ANDROID_SHARED_FXACCOUNT_TYPE="$(MOZ_ANDROID_SHARED_FXACCOUNT_TYPE)" \
-DMOZ_APP_BUILDID=$(MOZ_APP_BUILDID) \
-DMOZ_BUILD_TIMESTAMP=$(MOZ_BUILD_TIMESTAMP) \
-DUA_BUILDID=$(UA_BUILDID) \
$(NULL)

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

@ -1,4 +1,3 @@
//#filter substitution
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
* 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
@ -15,9 +14,6 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.regex.Pattern;
/**
@ -225,13 +221,6 @@ public final class SysInfo {
return "Android";
}
/**
* @return the architecture string, excluding ABI.
*/
public static String getArch() {
return "@CPU_ARCH@"; // "arm"
}
/**
* @return the Android architecture string, including ABI.
*/

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

@ -770,6 +770,7 @@ sync_java_files = [
'background/bagheera/BoundedByteArrayEntity.java',
'background/bagheera/DeflateHelper.java',
'background/common/DateUtils.java',
'background/common/GlobalConstants.java',
'background/common/log/Logger.java',
'background/common/log/writers/AndroidLevelCachingLogWriter.java',
'background/common/log/writers/AndroidLogWriter.java',
@ -805,6 +806,7 @@ sync_java_files = [
'background/healthreport/EnvironmentV2.java',
'background/healthreport/HealthReportBroadcastReceiver.java',
'background/healthreport/HealthReportBroadcastService.java',
'background/healthreport/HealthReportConstants.java',
'background/healthreport/HealthReportDatabases.java',
'background/healthreport/HealthReportDatabaseStorage.java',
'background/healthreport/HealthReportGenerator.java',
@ -858,6 +860,7 @@ sync_java_files = [
'fxa/authenticator/FxAccountLoginDelegate.java',
'fxa/authenticator/FxAccountLoginException.java',
'fxa/FirefoxAccounts.java',
'fxa/FxAccountConstants.java',
'fxa/login/BaseRequestDelegate.java',
'fxa/login/Cohabiting.java',
'fxa/login/Doghouse.java',
@ -1116,6 +1119,7 @@ sync_java_files = [
'sync/syncadapter/SyncService.java',
'sync/SyncConfiguration.java',
'sync/SyncConfigurationException.java',
'sync/SyncConstants.java',
'sync/SyncException.java',
'sync/synchronizer/ConcurrentRecordConsumer.java',
'sync/synchronizer/RecordConsumer.java',
@ -1143,10 +1147,3 @@ sync_java_files = [
'tokenserver/TokenServerException.java',
'tokenserver/TokenServerToken.java',
]
sync_generated_java_files = [
'background/common/GlobalConstants.java',
'background/healthreport/HealthReportConstants.java',
'fxa/FxAccountConstants.java',
'sync/SyncConstants.java',
]

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

@ -1,41 +1,25 @@
//#filter substitution
/* 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/. */
package org.mozilla.gecko.background.common;
import org.mozilla.gecko.AppConstants;
/**
* Preprocessed class for storing preprocessed values common to all
* Android services.
*/
public class GlobalConstants {
public static final String ANDROID_CPU_ARCH = "@ANDROID_CPU_ARCH@";
// One of 'beta', 'aurora', 'nightly', 'default'.
// If this is an official build, 'default' means 'release'.
// Otherwise, it means 'dev'.
public static final String MOZ_UPDATE_CHANNEL = "@MOZ_UPDATE_CHANNEL@";
//#ifdef MOZ_OFFICIAL_BRANDING
public static final boolean MOZ_OFFICIAL_BRANDING = true;
//#else
public static final boolean MOZ_OFFICIAL_BRANDING = false;
//#endif
public static final long BUILD_TIMESTAMP_SECONDS = @MOZ_BUILD_TIMESTAMP@L;
public static final long BUILD_TIMESTAMP_MSEC = 1000L * @MOZ_BUILD_TIMESTAMP@L;
public static final String MOZ_APP_DISPLAYNAME = "@MOZ_APP_DISPLAYNAME@";
public static final String MOZ_APP_VERSION = "@MOZ_APP_VERSION@";
public static final String BROWSER_INTENT_PACKAGE = "@ANDROID_PACKAGE_NAME@";
public static final String BROWSER_INTENT_CLASS = "org.mozilla.gecko.BrowserApp";
public static final String BROWSER_INTENT_PACKAGE = AppConstants.ANDROID_PACKAGE_NAME;
public static final String BROWSER_INTENT_CLASS = AppConstants.BROWSER_INTENT_CLASS_NAME;
/**
* Bug 800244: this signing-level permission protects broadcast intents that
* should be received only by the Firefox versions with the given Android
* package name.
*/
public static final String PER_ANDROID_PACKAGE_PERMISSION = "@ANDROID_PACKAGE_NAME@.permission.PER_ANDROID_PACKAGE";
public static final String PER_ANDROID_PACKAGE_PERMISSION = AppConstants.ANDROID_PACKAGE_NAME + ".permission.PER_ANDROID_PACKAGE";
public static final int SHARED_PREFERENCES_MODE = 0;

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

@ -1,4 +1,3 @@
//#filter substitution
/* 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/. */
@ -6,12 +5,13 @@
package org.mozilla.gecko.background.healthreport;
import org.mozilla.gecko.background.common.GlobalConstants;
import org.mozilla.gecko.AppConstants;
public class HealthReportConstants {
public static final String HEALTH_AUTHORITY = "@ANDROID_PACKAGE_NAME@.health";
public static final String HEALTH_AUTHORITY = AppConstants.ANDROID_PACKAGE_NAME + ".health";
public static final String GLOBAL_LOG_TAG = "GeckoHealth";
public static final String USER_AGENT = "Firefox-Android-HealthReport/" + GlobalConstants.MOZ_APP_VERSION + " (" + GlobalConstants.MOZ_APP_DISPLAYNAME + ")";
public static final String USER_AGENT = "Firefox-Android-HealthReport/" + AppConstants.MOZ_APP_VERSION + " (" + AppConstants.MOZ_APP_DISPLAYNAME + ")";
/**
* The earliest allowable value for the last ping time, corresponding to May 2nd 2013.
@ -35,8 +35,8 @@ public class HealthReportConstants {
public static final String PREF_PRUNE_INTENT_INTERVAL_MSEC = "healthreport_prune_intent_interval_msec";
public static final long DEFAULT_PRUNE_INTENT_INTERVAL_MSEC = GlobalConstants.MILLISECONDS_PER_DAY;
public static final String ACTION_HEALTHREPORT_UPLOAD_PREF = "@ANDROID_PACKAGE_NAME@.HEALTHREPORT_UPLOAD_PREF";
public static final String ACTION_HEALTHREPORT_PRUNE = "@ANDROID_PACKAGE_NAME@.HEALTHREPORT_PRUNE";
public static final String ACTION_HEALTHREPORT_UPLOAD_PREF = AppConstants.ANDROID_PACKAGE_NAME + ".HEALTHREPORT_UPLOAD_PREF";
public static final String ACTION_HEALTHREPORT_PRUNE = AppConstants.ANDROID_PACKAGE_NAME + ".HEALTHREPORT_PRUNE";
public static final String PREF_MINIMUM_TIME_BETWEEN_UPLOADS = "healthreport_time_between_uploads";
public static final long DEFAULT_MINIMUM_TIME_BETWEEN_UPLOADS = GlobalConstants.MILLISECONDS_PER_DAY;

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

@ -1,15 +1,14 @@
//#filter substitution
/* 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/. */
package org.mozilla.gecko.fxa;
import org.mozilla.gecko.background.common.GlobalConstants;
import org.mozilla.gecko.AppConstants;
public class FxAccountConstants {
public static final String GLOBAL_LOG_TAG = "FxAccounts";
public static final String ACCOUNT_TYPE = "@MOZ_ANDROID_SHARED_FXACCOUNT_TYPE@";
public static final String ACCOUNT_TYPE = AppConstants.MOZ_ANDROID_SHARED_FXACCOUNT_TYPE;
public static final String DEFAULT_AUTH_SERVER_ENDPOINT = "https://api.accounts.firefox.com/v1";
public static final String DEFAULT_TOKEN_SERVER_ENDPOINT = "https://token.services.mozilla.com/1.0/sync/1.5";
@ -23,7 +22,7 @@ public class FxAccountConstants {
// You must wait 15 minutes after failing an age check before trying to create a different account.
public static final long MINIMUM_TIME_TO_WAIT_AFTER_AGE_CHECK_FAILED_IN_MILLISECONDS = 15 * 60 * 1000;
public static final String USER_AGENT = "Firefox-Android-FxAccounts/" + GlobalConstants.MOZ_APP_VERSION + " (" + GlobalConstants.MOZ_APP_DISPLAYNAME + ")";
public static final String USER_AGENT = "Firefox-Android-FxAccounts/" + AppConstants.MOZ_APP_VERSION + " (" + AppConstants.MOZ_APP_DISPLAYNAME + ")";
public static final String ACCOUNT_PICKLE_FILENAME = "fxa.account.json";
@ -53,7 +52,7 @@ public class FxAccountConstants {
*
* See bug 790931 for additional information in the context of Sync.
*/
public static final String ACCOUNT_DELETED_ACTION = "@MOZ_ANDROID_SHARED_FXACCOUNT_TYPE@.accounts.ACCOUNT_DELETED_ACTION";
public static final String ACCOUNT_DELETED_ACTION = AppConstants.MOZ_ANDROID_SHARED_FXACCOUNT_TYPE + ".accounts.ACCOUNT_DELETED_ACTION";
/**
* Version number of contents of SYNC_ACCOUNT_DELETED_ACTION intent.
@ -67,7 +66,7 @@ public class FxAccountConstants {
* This signing-level permission protects broadcast intents that should be
* received only by Firefox channels sharing the same Android Firefox Account type.
*/
public static final String PER_ACCOUNT_TYPE_PERMISSION = "@MOZ_ANDROID_SHARED_FXACCOUNT_TYPE@.permission.PER_ACCOUNT_TYPE";
public static final String PER_ACCOUNT_TYPE_PERMISSION = AppConstants.MOZ_ANDROID_SHARED_FXACCOUNT_TYPE + ".permission.PER_ACCOUNT_TYPE";
/**
* This action is broadcast when an Android Firefox Account's internal state
@ -77,5 +76,5 @@ public class FxAccountConstants {
* can be received only by Firefox versions sharing the same Android Firefox
* Account type.
*/
public static final String ACCOUNT_STATE_CHANGED_ACTION = "@MOZ_ANDROID_SHARED_FXACCOUNT_TYPE@.accounts.ACCOUNT_STATE_CHANGED_ACTION";
public static final String ACCOUNT_STATE_CHANGED_ACTION = AppConstants.MOZ_ANDROID_SHARED_FXACCOUNT_TYPE + ".accounts.ACCOUNT_STATE_CHANGED_ACTION";
}

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

@ -129,6 +129,8 @@ class JavaPanZoomController
private boolean mNegateWheelScrollY;
/* Whether the current event has been default-prevented. */
private boolean mDefaultPrevented;
/* Whether longpress events are enabled, or suppressed by robocop tests. */
private boolean isLongpressEnabled;
// Handler to be notified when overscroll occurs
private Overscroll mOverscroll;
@ -139,6 +141,7 @@ class JavaPanZoomController
mX = new AxisX(mSubscroller);
mY = new AxisY(mSubscroller);
mTouchEventHandler = new TouchEventHandler(view.getContext(), view, this);
isLongpressEnabled = true;
checkMainThread();
@ -1348,8 +1351,20 @@ class JavaPanZoomController
mWaitForDoubleTap = false;
}
/**
* MotionEventHelper dragAsync() robocop tests can have us suppress
* longpress events that are spuriously created on slower test devices.
*/
public void setIsLongpressEnabled(boolean isLongpressEnabled) {
this.isLongpressEnabled = isLongpressEnabled;
}
@Override
public void onLongPress(MotionEvent motionEvent) {
if (!isLongpressEnabled) {
return;
}
GeckoEvent e = GeckoEvent.createLongPressEvent(motionEvent);
GeckoAppShell.sendEventToGecko(e);
}

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

@ -138,6 +138,14 @@ public class LayerView extends FrameLayout implements Tabs.OnTabsChangedListener
GeckoAccessibility.setAccessibilityStateChangeListener(getContext());
}
/**
* MotionEventHelper dragAsync() robocop tests can instruct
* PanZoomController not to generate longpress events.
*/
public void setIsLongpressEnabled(boolean isLongpressEnabled) {
((JavaPanZoomController) mPanZoomController).setIsLongpressEnabled(isLongpressEnabled);
}
private static Point getEventRadius(MotionEvent event) {
return new Point((int)event.getToolMajor() / 2,
(int)event.getToolMinor() / 2);

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

@ -12,12 +12,12 @@ include('android-services.mozbuild')
thirdparty_source_dir = TOPSRCDIR + '/mobile/android/thirdparty/'
constants_jar = add_java_jar('constants')
constants_jar.sources = []
constants_jar.sources = [
'SysInfo.java',
]
constants_jar.generated_sources = [
'preprocessed/org/mozilla/gecko/AppConstants.java',
'preprocessed/org/mozilla/gecko/SysInfo.java',
]
constants_jar.generated_sources += ['preprocessed/org/mozilla/gecko/' + f for f in sync_generated_java_files]
resjar = add_java_jar('gecko-R')
resjar.sources = []
@ -679,7 +679,7 @@ for var in ('MOZ_UPDATER', 'MOZ_PKG_SPECIAL'):
if CONFIG[var]:
DEFINES[var] = CONFIG[var]
for var in ('ANDROID_PACKAGE_NAME', 'ANDROID_CPU_ARCH', 'CPU_ARCH',
for var in ('ANDROID_PACKAGE_NAME', 'ANDROID_CPU_ARCH',
'GRE_MILESTONE', 'MOZ_APP_BASENAME',
'MOZ_APP_DISPLAYNAME', 'MOZ_APP_ID', 'MOZ_APP_NAME',
'MOZ_APP_VENDOR', 'MOZ_APP_VERSION', 'MOZ_CHILD_PROCESS_NAME',

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

@ -4,8 +4,8 @@
package org.mozilla.gecko.sync;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.R;
import org.mozilla.gecko.background.common.GlobalConstants;
import org.mozilla.gecko.sync.delegates.ClientsDataDelegate;
import org.mozilla.gecko.util.HardwareUtils;
@ -54,7 +54,7 @@ public class SharedPreferencesClientsDataDelegate implements ClientsDataDelegate
@Override
public String getDefaultClientName() {
String name = GlobalConstants.MOZ_APP_DISPLAYNAME; // The display name is never translated.
String name = AppConstants.MOZ_APP_DISPLAYNAME; // The display name is never translated.
// Change "Firefox Aurora" or similar into "Aurora".
if (name.contains("Aurora")) {
name = "Aurora";

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

@ -1,11 +1,10 @@
//#filter substitution
/* 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/. */
package org.mozilla.gecko.sync;
import org.mozilla.gecko.background.common.GlobalConstants;
import org.mozilla.gecko.AppConstants;
/**
* Preprocessed class for storing preprocessed values specific to Android Sync.
@ -15,14 +14,14 @@ public class SyncConstants {
public static final String SYNC_MAJOR_VERSION = "1";
public static final String SYNC_MINOR_VERSION = "0";
public static final String SYNC_VERSION_STRING = SYNC_MAJOR_VERSION + "." +
GlobalConstants.MOZ_APP_VERSION + "." +
AppConstants.MOZ_APP_VERSION + "." +
SYNC_MINOR_VERSION;
public static final String USER_AGENT = "Firefox AndroidSync " +
SYNC_VERSION_STRING + " (" +
GlobalConstants.MOZ_APP_DISPLAYNAME + ")";
AppConstants.MOZ_APP_DISPLAYNAME + ")";
public static final String ACCOUNTTYPE_SYNC = "@MOZ_ANDROID_SHARED_ACCOUNT_TYPE@";
public static final String ACCOUNTTYPE_SYNC = AppConstants.MOZ_ANDROID_SHARED_ACCOUNT_TYPE;
/**
* Bug 790931: this action is broadcast when an Android Sync Account is
@ -36,7 +35,7 @@ public class SyncConstants {
* See {@link org.mozilla.gecko.sync.setup.SyncAccounts#makeSyncAccountDeletedIntent(android.content.Context, android.accounts.AccountManager, android.accounts.Account)}
* for contents of the intent.
*/
public static final String SYNC_ACCOUNT_DELETED_ACTION = "@MOZ_ANDROID_SHARED_ACCOUNT_TYPE@.accounts.SYNC_ACCOUNT_DELETED_ACTION";
public static final String SYNC_ACCOUNT_DELETED_ACTION = AppConstants.MOZ_ANDROID_SHARED_ACCOUNT_TYPE + ".accounts.SYNC_ACCOUNT_DELETED_ACTION";
/**
* Bug 790931: version number of contents of SYNC_ACCOUNT_DELETED_ACTION
@ -52,7 +51,7 @@ public class SyncConstants {
* should be received only by Firefox versions sharing the same Android Sync
* Account type.
*/
public static final String PER_ACCOUNT_TYPE_PERMISSION = "@MOZ_ANDROID_SHARED_ACCOUNT_TYPE@.permission.PER_ACCOUNT_TYPE";
public static final String PER_ACCOUNT_TYPE_PERMISSION = AppConstants.MOZ_ANDROID_SHARED_ACCOUNT_TYPE + ".permission.PER_ACCOUNT_TYPE";
public static final String DEFAULT_AUTH_SERVER = "https://auth.services.mozilla.com/";

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

@ -14,7 +14,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.background.common.GlobalConstants;
import org.mozilla.gecko.background.common.log.Logger;
import org.mozilla.gecko.sync.CommandProcessor;
import org.mozilla.gecko.sync.CommandProcessor.Command;
@ -39,9 +38,7 @@ import org.mozilla.gecko.sync.repositories.android.RepoUtils;
import org.mozilla.gecko.sync.repositories.domain.ClientRecord;
import org.mozilla.gecko.sync.repositories.domain.ClientRecordFactory;
import org.mozilla.gecko.sync.repositories.domain.VersionConstants;
import org.mozilla.gecko.util.HardwareUtils;
import android.content.Context;
import ch.boye.httpclientandroidlib.HttpStatus;
public class SyncClientsEngineStage extends AbstractSessionManagingSyncStage {
@ -362,7 +359,7 @@ public class SyncClientsEngineStage extends AbstractSessionManagingSyncStage {
}
protected String getLocalClientVersion() {
return GlobalConstants.MOZ_APP_VERSION;
return AppConstants.MOZ_APP_VERSION;
}
@SuppressWarnings("unchecked")
@ -383,7 +380,7 @@ public class SyncClientsEngineStage extends AbstractSessionManagingSyncStage {
r.protocols = getLocalClientProtocols();
r.os = "Android";
r.application = GlobalConstants.MOZ_APP_DISPLAYNAME;
r.application = AppConstants.MOZ_APP_DISPLAYNAME;
r.appPackage = AppConstants.ANDROID_PACKAGE_NAME;
r.device = android.os.Build.MODEL;
r.formfactor = delegate.getFormFactor();

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

@ -5,11 +5,7 @@
package org.mozilla.gecko.tests;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.util.GeckoRequest;
import org.mozilla.gecko.util.NativeJSObject;
import org.json.JSONException;
import org.json.JSONObject;
import org.mozilla.gecko.gfx.LayerView;
import android.app.Instrumentation;
import android.os.SystemClock;
@ -25,11 +21,13 @@ class MotionEventHelper {
private final Instrumentation mInstrumentation;
private final int mSurfaceOffsetX;
private final int mSurfaceOffsetY;
private final LayerView layerView;
public MotionEventHelper(Instrumentation inst, int surfaceOffsetX, int surfaceOffsetY) {
mInstrumentation = inst;
mSurfaceOffsetX = surfaceOffsetX;
mSurfaceOffsetY = surfaceOffsetY;
layerView = GeckoAppShell.getLayerView();
Log.i(LOGTAG, "Initialized using offset (" + mSurfaceOffsetX + "," + mSurfaceOffsetY + ")");
}
@ -82,6 +80,8 @@ class MotionEventHelper {
Thread t = new Thread() {
@Override
public void run() {
layerView.setIsLongpressEnabled(false);
int numEvents = (int)(durationMillis * DRAG_EVENTS_PER_SECOND / 1000);
float eventDx = (endX - startX) / numEvents;
float eventDy = (endY - startY) / numEvents;
@ -104,6 +104,8 @@ class MotionEventHelper {
// do the last one using endX/endY directly to avoid rounding errors
downTime = move(downTime, endX, endY);
downTime = up(downTime, endX, endY);
layerView.setIsLongpressEnabled(true);
}
};
t.start();
@ -167,29 +169,4 @@ class MotionEventHelper {
tap(x, y);
tap(x, y);
}
/**
* dragSync() can accidentally trigger longpress events on slower devices.
* Consumers can instruct Gecko to ignore them.
*/
public void disableGeckoLongpress() {
final JSONObject json = new JSONObject();
try {
json.put("isLongPressEnabled", 0);
} catch (JSONException e) {
Log.e(LOGTAG, "JSON error - Error creating request to ignore longpress events.", e);
return;
}
GeckoAppShell.sendRequestToGecko(new GeckoRequest("ContextMenu:SetIsLongpressEnabled", json) {
@Override
public void onResponse(NativeJSObject response) {
Log.d(LOGTAG, "Gecko received request to ignore longpress events.");
}
@Override
public void onError(NativeJSObject error) {
Log.d(LOGTAG, "No response from Gecko on request to ignore longpress events.");
}
});
}
}

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

@ -26,9 +26,6 @@ public class testAxisLocking extends PixelTest {
// load page and check we're at 0,0
loadAndVerifyBoxes(url);
// Tell Gecko to ignore any longpress events triggered by MEH.
meh.disableGeckoLongpress();
// drag page upwards by 100 pixels with a slight angle. verify that
// axis locking prevents any horizontal scrolling
Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();

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

@ -36,9 +36,6 @@ public class testCheck extends PixelTest {
mDriver.startCheckerboardRecording();
// Tell Gecko to ignore any longpress events triggered by MEH.
meh.disableGeckoLongpress();
// Scroll repeatedly downwards, then upwards. On each iteration of i,
// increase the scroll distance to test different scroll amounts.
for (int i = 2; i < 7; i++) {

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

@ -24,9 +24,6 @@ public class testFlingCorrectness extends PixelTest {
// load page and check we're at 0,0
loadAndVerifyBoxes(url);
// Tell Gecko to ignore any longpress events triggered by MEH.
meh.disableGeckoLongpress();
// drag page upwards by 200 pixels (use two drags instead of one in case
// the screen size is small)
Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();

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

@ -24,9 +24,6 @@ public class testPanCorrectness extends PixelTest {
// load page and check we're at 0,0
loadAndVerifyBoxes(url);
// Tell Gecko to ignore any longpress events triggered by MEH.
meh.disableGeckoLongpress();
// drag page upwards by 100 pixels
Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
meh.dragSync(10, 150, 10, 50);

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

@ -30,9 +30,6 @@ public class testVkbOverlap extends PixelTest {
// scroll to the bottom of the page and let it settle
Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop());
// Tell Gecko to ignore any longpress events triggered by MEH.
meh.disableGeckoLongpress();
meh.dragSync(10, 150, 10, 50);
// the input field has a green background, so let's count the number of green pixels

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

@ -2270,14 +2270,9 @@ var NativeWindow = {
contextmenus: {
items: {}, // a list of context menu items that we may show
DEFAULT_HTML5_ORDER: -1, // Sort order for HTML5 context menu items
_isLongPressEnabled: 1, // Android longpress events can be ignored during robocop tests.
init: function() {
BrowserApp.deck.addEventListener("contextmenu", this.show.bind(this), false);
Messaging.addListener((data) => {
return {result: (this._isLongPressEnabled = data.isLongPressEnabled)};
}, "ContextMenu:SetIsLongpressEnabled");
},
add: function() {
@ -2570,11 +2565,6 @@ var NativeWindow = {
* for chrome consumers to do lazy menuitem construction
*/
show: function(event) {
if (!this._isLongPressEnabled) {
dump("Longpress Event is ignored by request");
return;
}
// Android Long-press / contextmenu event provides clientX/Y data. This is not provided
// by mochitest: test_browserElement_inproc_ContextmenuEvents.html.
if (!event.clientX || !event.clientY) {

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

@ -58,10 +58,12 @@ if (window.readConfig) {
}
if (config.testRoot == "chrome" || config.testRoot == "a11y") {
for (p in params) {
if (params[p] == 1) {
for (var p in params) {
// Compare with arrays to find boolean equivalents, since that's what
// |parseQueryString| with useArrays returns.
if (params[p] == [1]) {
config[p] = true;
} else if (params[p] == 0) {
} else if (params[p] == [0]) {
config[p] = false;
} else {
config[p] = params[p];

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

@ -407,9 +407,8 @@ loadListener.prototype = {
onStatus: function (aRequest, aContext, aStatus, aStatusArg) {}
}
// Hacky method that tries to determine if this user is in a US geography, and
// using an en-US build.
function getIsUS() {
// Method to determine if we should be using geo-specific defaults
function geoSpecificDefaultsEnabled() {
let geoSpecificDefaults = false;
try {
geoSpecificDefaults = Services.prefs.getBoolPref("browser.search.geoSpecificDefaults");
@ -420,10 +419,12 @@ function getIsUS() {
distroID = Services.prefs.getCharPref("distribution.id");
} catch (e) {}
if (!geoSpecificDefaults || distroID) {
return false;
}
return (geoSpecificDefaults && !distroID);
}
// Hacky method that tries to determine if this user is in a US geography, and
// using an en-US build.
function getIsUS() {
// If we've set the pref before, just return that result.
let cachePref = "browser.search.isUS";
try {
@ -439,6 +440,15 @@ function getIsUS() {
return isNA;
}
// Helper method to modify preference keys with geo-specific modifiers, if needed
function getGeoSpecificPrefName(basepref) {
if (!geoSpecificDefaultsEnabled())
return basepref;
if (getIsUS())
return basepref + ".US";
return basepref;
}
function isUSTimezone() {
// Timezone assumptions! We assume that if the system clock's timezone is
// between Newfoundland and Hawaii, that the user is in North America.
@ -1963,10 +1973,7 @@ Engine.prototype = {
let defaultPrefB = Services.prefs.getDefaultBranch(BROWSER_SEARCH_PREF);
let nsIPLS = Ci.nsIPrefLocalizedString;
let defaultEngine;
let pref = "defaultenginename";
if (getIsUS()) {
pref += ".US";
}
let pref = getGeoSpecificPrefName("defaultenginename");
try {
defaultEngine = defaultPrefB.getComplexValue(pref, nsIPLS).data;
} catch (ex) {}
@ -3186,13 +3193,7 @@ SearchService.prototype = {
let nsIPLS = Ci.nsIPrefLocalizedString;
let defaultEngine;
let defPref;
if (getIsUS()) {
defPref = "defaultenginename.US";
} else {
defPref = "defaultenginename";
}
let defPref = getGeoSpecificPrefName("defaultenginename");
try {
defaultEngine = defaultPrefB.getComplexValue(defPref, nsIPLS).data;
} catch (ex) {
@ -3973,12 +3974,10 @@ SearchService.prototype = {
}
catch (e) { }
let prefNameBase = getGeoSpecificPrefName(BROWSER_SEARCH_PREF + "order");
while (true) {
prefName = BROWSER_SEARCH_PREF + "order.";
if (getIsUS()) {
prefName += "US.";
}
engineName = getLocalizedPref(prefName + (++i));
prefName = prefNameBase + "." + (++i);
engineName = getLocalizedPref(prefName);
if (!engineName)
break;
@ -4139,12 +4138,9 @@ SearchService.prototype = {
}
// Now look through the "browser.search.order" branch.
let prefNameBase = getGeoSpecificPrefName(BROWSER_SEARCH_PREF + "order");
for (var j = 1; ; j++) {
var prefName = BROWSER_SEARCH_PREF + "order.";
if (getIsUS()) {
prefName += "US.";
}
prefName += j;
let prefName = prefNameBase + "." + j;
engineName = getLocalizedPref(prefName);
if (!engineName)
break;
@ -4357,7 +4353,7 @@ SearchService.prototype = {
get defaultEngine() {
this._ensureInitialized();
if (!this._defaultEngine) {
let defPref = BROWSER_SEARCH_PREF + "defaultenginename";
let defPref = getGeoSpecificPrefName(BROWSER_SEARCH_PREF + "defaultenginename");
let defaultEngine = this.getEngineByName(getLocalizedPref(defPref, ""))
if (!defaultEngine)
defaultEngine = this._getSortedEngines(false)[0] || null;
@ -4385,7 +4381,8 @@ SearchService.prototype = {
this._defaultEngine = newDefaultEngine;
let defPref = BROWSER_SEARCH_PREF + "defaultenginename";
let defPref = getGeoSpecificPrefName(BROWSER_SEARCH_PREF + "defaultenginename");
// If we change the default engine in the future, that change should impact
// users who have switched away from and then back to the build's "default"
// engine. So clear the user pref when the defaultEngine is set to the

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

@ -20,10 +20,9 @@ function run_test() {
removeCacheFile();
});
// this will cause an "unknown host" error, but not report an external
// network connection in the tests (note that the hosts listed in
// server-locations.txt are *not* loaded for xpcshell tests...)
let url = "https://nocert.example.com:443";
// using a port > 2^32 causes an error to be reported.
let url = "http://localhost:111111111";
Services.prefs.setCharPref("browser.search.geoip.url", url);
Services.search.init(() => {
try {

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

@ -6800,7 +6800,7 @@
"description": "If any version of Firefox Sync is configured for this device"
},
"WEAVE_CONFIGURED_MASTER_PASSWORD": {
"expires_in_version": "default",
"expires_in_version": "never",
"kind": "boolean",
"description": "If both Firefox Sync and Master Password are configured for this device"
},
@ -6871,7 +6871,7 @@
"description": "Algorithms used with WebCrypto (see table in WebCryptoTask.cpp)"
},
"MASTER_PASSWORD_ENABLED": {
"expires_in_version": "40",
"expires_in_version": "never",
"kind": "flag",
"description": "If a master-password is enabled for this profile"
},

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

@ -214,6 +214,7 @@ this.TelemetryPing = Object.freeze({
*/
reset: function() {
this.uninstall();
Impl._clientID = null;
return this.setup();
},
/**
@ -222,6 +223,7 @@ this.TelemetryPing = Object.freeze({
setup: function() {
return Impl.setupChromeProcess(true);
},
/**
* Used only for testing purposes.
*/
@ -232,6 +234,13 @@ this.TelemetryPing = Object.freeze({
// Ignore errors
}
},
/**
* Used only for testing purposes.
*/
shutdown: function() {
return Impl.shutdown(true);
},
/**
* Descriptive metadata
*
@ -1025,10 +1034,7 @@ let Impl = {
AsyncShutdown.sendTelemetry.addBlocker(
"Telemetry: shutting down",
function condition(){
this.uninstall();
if (Telemetry.canSend) {
return this.savePendingPings();
}
this.shutdown();
}.bind(this));
Services.obs.addObserver(this, "sessionstore-windows-restored", false);
@ -1175,7 +1181,6 @@ let Impl = {
#ifdef MOZ_WIDGET_ANDROID
Services.obs.removeObserver(this, "application-background", false);
#endif
this._clientID = null;
},
getPayload: function getPayload() {
@ -1308,4 +1313,16 @@ let Impl = {
get clientID() {
return this._clientID;
},
/**
* This tells TelemetryPing to uninitialize and save any pending pings.
* @param testing Optional. If true, always saves the ping whether Telemetry
* can send pings or not, which is used for testing.
*/
shutdown: function(testing = false) {
this.uninstall();
if (Telemetry.canSend || testing) {
return this.savePendingPings();
}
},
};

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

@ -22,6 +22,7 @@ Cu.import("resource://gre/modules/TelemetryFile.jsm", this);
Cu.import("resource://gre/modules/Task.jsm", this);
Cu.import("resource://gre/modules/Promise.jsm", this);
Cu.import("resource://gre/modules/Preferences.jsm");
Cu.import("resource://gre/modules/osfile.jsm", this);
const IGNORE_HISTOGRAM = "test::ignore_me";
const IGNORE_HISTOGRAM_TO_CLONE = "MEMORY_HEAP_ALLOCATED";
@ -611,6 +612,20 @@ add_task(function* test_runOldPingFile() {
do_check_false(histogramsFile.exists());
});
add_task(function* test_savedSessionClientID() {
// Assure that we store the ping properly when saving sessions on shutdown.
// We make the TelemetryPings shutdown to trigger a session save.
const dir = TelemetryFile.pingDirectoryPath;
yield OS.File.removeDir(dir, {ignoreAbsent: true});
yield OS.File.makeDir(dir);
yield TelemetryPing.shutdown();
yield TelemetryFile.loadSavedPings();
Assert.equal(TelemetryFile.pingsLoaded, 1);
let ping = TelemetryFile.popPendingPings().next();
Assert.equal(ping.value.payload.clientID, gDataReportingClientID);
});
add_task(function* stopServer(){
gHttpServer.stop(do_test_finished);
});

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

@ -83,7 +83,8 @@ function WebConsoleActor(aConnection, aParentActor)
this.traits = {
customNetworkRequest: !this._parentIsContentActor,
evaluateJSAsync: true
evaluateJSAsync: true,
transferredResponseSize: true
};
}
@ -2009,6 +2010,7 @@ NetworkEventActor.prototype =
updateType: "responseContent",
mimeType: aContent.mimeType,
contentSize: aContent.text.length,
transferredSize: aContent.transferredSize,
discardResponseBody: aDiscardedResponseBody,
};

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

@ -4,7 +4,7 @@
"use strict";
const {Cc, Ci, Cu} = require("chrome");
const {Cc, Ci, Cu, Cr} = require("chrome");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
@ -56,13 +56,47 @@ function NetworkResponseListener(aOwner, aHttpActivity)
this.receivedData = "";
this.httpActivity = aHttpActivity;
this.bodySize = 0;
let channel = this.httpActivity.channel;
this._wrappedNotificationCallbacks = channel.notificationCallbacks;
channel.notificationCallbacks = this;
}
exports.NetworkResponseListener = NetworkResponseListener;
NetworkResponseListener.prototype = {
QueryInterface:
XPCOMUtils.generateQI([Ci.nsIStreamListener, Ci.nsIInputStreamCallback,
Ci.nsIRequestObserver, Ci.nsISupports]),
Ci.nsIRequestObserver, Ci.nsIInterfaceRequestor,
Ci.nsISupports]),
// nsIInterfaceRequestor implementation
/**
* This object implements nsIProgressEventSink, but also needs to forward
* interface requests to the notification callbacks of other objects.
*/
getInterface(iid) {
if (iid.equals(Ci.nsIProgressEventSink)) {
return this;
}
if (this._wrappedNotificationCallbacks) {
return this._wrappedNotificationCallbacks.getInterface(iid);
}
throw Cr.NS_ERROR_NO_INTERFACE;
},
/**
* Forward notifications for interfaces this object implements, in case other
* objects also implemented them.
*/
_forwardNotification(iid, method, args) {
if (!this._wrappedNotificationCallbacks) {
return;
}
try {
let impl = this._wrappedNotificationCallbacks.getInterface(iid);
impl[method].apply(impl, args);
} catch(e if e.result == Cr.NS_ERROR_NO_INTERFACE) {}
},
/**
* This NetworkResponseListener tracks the NetworkMonitor.openResponses object
@ -71,6 +105,12 @@ NetworkResponseListener.prototype = {
*/
_foundOpenResponse: false,
/**
* If the channel already had notificationCallbacks, hold them here internally
* so that we can forward getInterface requests to that object.
*/
_wrappedNotificationCallbacks: null,
/**
* The response listener owner.
*/
@ -93,10 +133,15 @@ NetworkResponseListener.prototype = {
receivedData: null,
/**
* The network response body size.
* The uncompressed, decoded response body size.
*/
bodySize: null,
/**
* Response body size on the wire, potentially compressed / encoded.
*/
transferredSize: null,
/**
* The nsIRequest we are started for.
*/
@ -191,6 +236,23 @@ NetworkResponseListener.prototype = {
this.sink.outputStream.close();
},
// nsIProgressEventSink implementation
/**
* Handle progress event as data is transferred. This is used to record the
* size on the wire, which may be compressed / encoded.
*/
onProgress: function(request, context, progress, progressMax) {
this.transferredSize = progress;
// Need to forward as well to keep things like Download Manager's progress
// bar working properly.
this._forwardNotification(Ci.nsIProgressEventSink, "onProgress", arguments);
},
onStatus: function () {
this._forwardNotification(Ci.nsIProgressEventSink, "onStatus", arguments);
},
/**
* Find the open response object associated to the current request. The
* NetworkMonitor._httpResponseExaminer() method saves the response headers in
@ -273,6 +335,7 @@ NetworkResponseListener.prototype = {
};
response.size = response.text.length;
response.transferredSize = this.transferredSize;
try {
response.mimeType = this.request.contentType;
@ -293,6 +356,7 @@ NetworkResponseListener.prototype = {
this.httpActivity.owner.
addResponseContent(response, this.httpActivity.discardResponseBody);
this._wrappedNotificationCallbacks = null;
this.httpActivity.channel = null;
this.httpActivity.owner = null;
this.httpActivity = null;

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

@ -4445,6 +4445,13 @@ this.XPIProvider = {
if (aMethod == "shutdown" && aReason != BOOTSTRAP_REASONS.APP_SHUTDOWN) {
logger.debug("Removing manifest for " + aFile.path);
Components.manager.removeBootstrappedManifestLocation(aFile);
let manifest = getURIForResourceInFile(aFile, "chrome.manifest");
for (let line of ChromeManifestParser.parseSync(manifest)) {
if (line.type == "resource") {
ResProtocolHandler.setSubstitution(line.args[0], null);
}
}
}
this.setTelemetry(aAddon.id, aMethod + "_MS", new Date() - timeStart);
}

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

@ -0,0 +1 @@
resource test-addon-1 .

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

@ -0,0 +1,24 @@
<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>addon6@tests.mozilla.org</em:id>
<em:version>1.0</em:version>
<!-- Front End MetaData -->
<em:name>Test 6</em:name>
<em:description>Test Description</em:description>
<em:bootstrap>true</em:bootstrap>
<em:targetApplication>
<Description>
<em:id>xpcshell@tests.mozilla.org</em:id>
<em:minVersion>1</em:minVersion>
<em:maxVersion>2</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
</RDF>

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

@ -0,0 +1,56 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Tests that resource protocol substitutions are set and unset for bootstrapped add-ons.
const profileDir = gProfD.clone();
profileDir.append("extensions");
function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "2");
let resourceProtocol = Services.io.getProtocolHandler("resource")
.QueryInterface(Components.interfaces.nsIResProtocolHandler);
startupManager();
installAllFiles([do_get_addon("test_chromemanifest_6")],
function() {
AddonManager.getAddonByID("addon6@tests.mozilla.org", function(addon) {
do_check_neq(addon, null);
do_check_true(addon.isActive);
do_check_true(resourceProtocol.hasSubstitution("test-addon-1"));
prepare_test({
"addon6@tests.mozilla.org": [
["onDisabling", false],
"onDisabled"
]
});
do_check_eq(addon.operationsRequiringRestart &
AddonManager.OP_NEEDS_RESTART_DISABLE, 0);
addon.userDisabled = true;
ensure_test_completed();
do_check_false(resourceProtocol.hasSubstitution("test-addon-1"))
prepare_test({
"addon6@tests.mozilla.org": [
["onEnabling", false],
"onEnabled"
]
});
do_check_eq(addon.operationsRequiringRestart &
AddonManager.OP_NEEDS_RESTART_ENABLE, 0);
addon.userDisabled = false;
ensure_test_completed();
do_check_true(resourceProtocol.hasSubstitution("test-addon-1"));
do_execute_soon(do_test_finished);
});
});
}

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

@ -5,7 +5,7 @@
// This verifies that flushing the zipreader cache happens when appropriate
var gExpectedFile = null;
var gCacheFlushed = false;
var gCacheFlushCount = 0;
var CacheFlushObserver = {
observe: function(aSubject, aTopic, aData) {
@ -15,16 +15,11 @@ var CacheFlushObserver = {
do_check_true(gExpectedFile != null);
do_check_true(aSubject instanceof AM_Ci.nsIFile);
do_check_eq(aSubject.path, gExpectedFile.path);
gCacheFlushed = true;
gExpectedFile = null;
gCacheFlushCount++;
}
};
function run_test() {
// This test only makes sense when leaving extensions packed
if (Services.prefs.getBoolPref("extensions.alwaysUnpack"))
return;
do_test_pending();
Services.obs.addObserver(CacheFlushObserver, "flush-cache-entry", false);
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "2");
@ -45,8 +40,9 @@ function run_test_1() {
gExpectedFile.append("addon1@tests.mozilla.org.xpi");
aInstall.cancel();
do_check_true(gCacheFlushed);
gCacheFlushed = false;
do_check_eq(gCacheFlushCount, 1);
gExpectedFile = null;
gCacheFlushCount = 0;
run_test_2();
});
@ -62,18 +58,24 @@ function run_test_2() {
gExpectedFile.append("staged");
gExpectedFile.append("addon1@tests.mozilla.org.xpi");
restartManager();
do_check_true(gCacheFlushed);
gCacheFlushed = false;
do_check_eq(gCacheFlushCount, 1);
gExpectedFile = null;
gCacheFlushCount = 0;
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
// We should flush the installed XPI when uninstalling
do_check_true(a1 != null);
a1.uninstall();
do_check_eq(gCacheFlushCount, 0);
gExpectedFile = gProfD.clone();
gExpectedFile.append("extensions");
gExpectedFile.append("addon1@tests.mozilla.org.xpi");
restartManager();
do_check_eq(gCacheFlushCount, 1);
gExpectedFile = null;
gCacheFlushCount = 0;
do_check_true(a1 != null);
a1.uninstall();
do_check_false(gCacheFlushed);
do_execute_soon(run_test_3);
});
});
@ -81,8 +83,6 @@ function run_test_2() {
// Tests that the cache is flushed when installing a restartless add-on
function run_test_3() {
restartManager();
AddonManager.getInstallForFile(do_get_addon("test_cacheflush2"), function(aInstall) {
aInstall.addListener({
onInstallStarted: function(aInstall) {
@ -94,8 +94,9 @@ function run_test_3() {
},
onInstallEnded: function(aInstall) {
do_check_true(gCacheFlushed);
gCacheFlushed = false;
do_check_eq(gCacheFlushCount, 1);
gExpectedFile = null;
gCacheFlushCount = 0;
do_execute_soon(run_test_4);
}
@ -114,8 +115,9 @@ function run_test_4() {
gExpectedFile.append("addon2@tests.mozilla.org.xpi");
a2.uninstall();
do_check_true(gCacheFlushed);
gCacheFlushed = false;
do_check_eq(gCacheFlushCount, 2);
gExpectedFile = null;
gCacheFlushCount = 0;
do_execute_soon(do_test_finished);
});

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

@ -29,6 +29,7 @@ skip-if = os == "android"
[test_bootstrap.js]
# Bug 676992: test consistently hangs on Android
skip-if = os == "android"
[test_bootstrap_resource.js]
[test_bug299716.js]
# Bug 676992: test consistently hangs on Android
skip-if = os == "android"
@ -148,7 +149,6 @@ fail-if = os == "android"
[test_bug753900.js]
[test_bug757663.js]
[test_bug953156.js]
[test_cacheflush.js]
[test_checkcompatibility.js]
[test_checkCompatibility_themeOverride.js]
[test_childprocess.js]

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

@ -10,6 +10,7 @@ support-files =
[test_addon_path_service.js]
[test_asyncBlocklistLoad.js]
[test_cacheflush.js]
[test_DeferredSave.js]
[test_isReady.js]
[test_metadata_update.js]

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

@ -3102,6 +3102,13 @@ XREMain::XRE_mainInit(bool* aExitFlag)
if (NS_FAILED(rv))
return 2;
#ifdef XP_MACOSX
nsCOMPtr<nsIFile> parent;
greDir->GetParent(getter_AddRefs(parent));
greDir = parent.forget();
greDir->AppendNative(NS_LITERAL_CSTRING("Resources"));
#endif
greDir.forget(&mAppData->xreDirectory);
}

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

@ -137,7 +137,7 @@ static const ManifestDirective kParsingTable[] = {
nullptr, &nsChromeRegistry::ManifestOverride, nullptr
},
{
"resource", 2, true, true, false, false,
"resource", 2, true, true, true, false,
nullptr, &nsChromeRegistry::ManifestResource, nullptr
}
};