Merge mozilla-central to mozilla-inbound

This commit is contained in:
Carsten "Tomcat" Book 2014-11-13 16:23:31 +01:00
commit ed7e607af1
146 changed files with 1909 additions and 1591 deletions

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="3ab0d9c70f0b2e1ededc679112c392303f037361">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="be8b0151d2f9a4c41fc63952128e0b723cd1161d"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a222358a6210c0bb94e53e036ec8c73dc2e3d4d0"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="45c54a55e31758f7e54e5eafe0d01d387f35897a"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="dfb7845803f3afcdcf157c5babec357bf9ce74eb"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0494efbb157e863dec6f1fd4d4652b0917ce263d"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>

View File

@ -19,13 +19,13 @@
<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="be8b0151d2f9a4c41fc63952128e0b723cd1161d"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="a222358a6210c0bb94e53e036ec8c73dc2e3d4d0"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="45c54a55e31758f7e54e5eafe0d01d387f35897a"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="67f2907bc340bad250b4ea6ce2902b52896c9ef0"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="dfb7845803f3afcdcf157c5babec357bf9ce74eb"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0494efbb157e863dec6f1fd4d4652b0917ce263d"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>

View File

@ -17,10 +17,10 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="be8b0151d2f9a4c41fc63952128e0b723cd1161d"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a222358a6210c0bb94e53e036ec8c73dc2e3d4d0"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="45c54a55e31758f7e54e5eafe0d01d387f35897a"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="dfb7845803f3afcdcf157c5babec357bf9ce74eb"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0494efbb157e863dec6f1fd4d4652b0917ce263d"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="3ab0d9c70f0b2e1ededc679112c392303f037361">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="be8b0151d2f9a4c41fc63952128e0b723cd1161d"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a222358a6210c0bb94e53e036ec8c73dc2e3d4d0"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="45c54a55e31758f7e54e5eafe0d01d387f35897a"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="dfb7845803f3afcdcf157c5babec357bf9ce74eb"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0494efbb157e863dec6f1fd4d4652b0917ce263d"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>

View File

@ -19,13 +19,13 @@
<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="be8b0151d2f9a4c41fc63952128e0b723cd1161d"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="a222358a6210c0bb94e53e036ec8c73dc2e3d4d0"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="45c54a55e31758f7e54e5eafe0d01d387f35897a"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="67f2907bc340bad250b4ea6ce2902b52896c9ef0"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="dfb7845803f3afcdcf157c5babec357bf9ce74eb"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0494efbb157e863dec6f1fd4d4652b0917ce263d"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="3ab0d9c70f0b2e1ededc679112c392303f037361">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="be8b0151d2f9a4c41fc63952128e0b723cd1161d"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a222358a6210c0bb94e53e036ec8c73dc2e3d4d0"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="45c54a55e31758f7e54e5eafe0d01d387f35897a"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="dfb7845803f3afcdcf157c5babec357bf9ce74eb"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0494efbb157e863dec6f1fd4d4652b0917ce263d"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>

View File

@ -17,10 +17,10 @@
</project>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="be8b0151d2f9a4c41fc63952128e0b723cd1161d"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a222358a6210c0bb94e53e036ec8c73dc2e3d4d0"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="45c54a55e31758f7e54e5eafe0d01d387f35897a"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="dfb7845803f3afcdcf157c5babec357bf9ce74eb"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0494efbb157e863dec6f1fd4d4652b0917ce263d"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

View File

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "2e0f2f070a2265b537e6a2ff4e0f2e1f2aca49c6",
"revision": "c1bed74af46cb81a7092d6e80624134bae5d1bf0",
"repo_path": "integration/gaia-central"
}

View File

@ -17,11 +17,11 @@
<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="be8b0151d2f9a4c41fc63952128e0b723cd1161d"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="a222358a6210c0bb94e53e036ec8c73dc2e3d4d0"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="45c54a55e31758f7e54e5eafe0d01d387f35897a"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="dfb7845803f3afcdcf157c5babec357bf9ce74eb"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0494efbb157e863dec6f1fd4d4652b0917ce263d"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
<project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>

View File

@ -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="be8b0151d2f9a4c41fc63952128e0b723cd1161d"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="a222358a6210c0bb94e53e036ec8c73dc2e3d4d0"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="45c54a55e31758f7e54e5eafe0d01d387f35897a"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -17,10 +17,10 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="be8b0151d2f9a4c41fc63952128e0b723cd1161d"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="a222358a6210c0bb94e53e036ec8c73dc2e3d4d0"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="45c54a55e31758f7e54e5eafe0d01d387f35897a"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="dfb7845803f3afcdcf157c5babec357bf9ce74eb"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0494efbb157e863dec6f1fd4d4652b0917ce263d"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

View File

@ -17,12 +17,12 @@
<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="be8b0151d2f9a4c41fc63952128e0b723cd1161d"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="a222358a6210c0bb94e53e036ec8c73dc2e3d4d0"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="45c54a55e31758f7e54e5eafe0d01d387f35897a"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="dfb7845803f3afcdcf157c5babec357bf9ce74eb"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0494efbb157e863dec6f1fd4d4652b0917ce263d"/>
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>

View File

@ -350,13 +350,14 @@ pref("browser.urlbar.match.title", "#");
pref("browser.urlbar.match.url", "@");
// The default behavior for the urlbar can be configured to use any combination
// of the restrict or match filters with each additional filter restricting
// more (intersection). Add the following values to set the behavior as the
// default: 1: history, 2: bookmark, 4: tag, 8: title, 16: url, 32: typed,
// 64: javascript, 128: tabs
// E.g., 0 = show all results (no filtering), 1 = only visited pages in history,
// 2 = only bookmarks, 3 = visited bookmarks, 1+16 = history matching in the url
pref("browser.urlbar.default.behavior", 0);
// of the match filters with each additional filter adding more results (union).
pref("browser.urlbar.suggest.history", true);
pref("browser.urlbar.suggest.bookmark", true);
pref("browser.urlbar.suggest.openpage", true);
// Restrictions to current suggestions can also be applied (intersection).
// Typed suggestion works only if history is set to true.
pref("browser.urlbar.suggest.history.onlyTyped", false);
pref("browser.urlbar.formatting.enabled", true);
pref("browser.urlbar.trimURLs", true);
@ -1262,7 +1263,6 @@ pref("services.sync.prefs.sync.browser.tabs.loadInBackground", true);
pref("services.sync.prefs.sync.browser.tabs.warnOnClose", true);
pref("services.sync.prefs.sync.browser.tabs.warnOnOpen", true);
pref("services.sync.prefs.sync.browser.urlbar.autocomplete.enabled", true);
pref("services.sync.prefs.sync.browser.urlbar.default.behavior", true);
pref("services.sync.prefs.sync.browser.urlbar.maxRichResults", true);
pref("services.sync.prefs.sync.dom.disable_open_during_load", true);
pref("services.sync.prefs.sync.dom.disable_window_flip", true);

View File

@ -43,10 +43,12 @@ let gCustomize = {
return Promise.resolve(nodes);
}
panel.hidden = false;
panel.openPopup(button);
button.setAttribute("active", true);
panel.addEventListener("popuphidden", function onHidden() {
panel.removeEventListener("popuphidden", onHidden);
panel.hidden = true;
button.removeAttribute("active");
});

View File

@ -20,6 +20,7 @@ let gIntro = {
}
this._nodes.panel.addEventListener("popupshowing", e => this._setUpPanel());
this._nodes.panel.addEventListener("popuphidden", e => this._hidePanel());
this._nodes.what.addEventListener("click", e => this.showPanel());
},
@ -32,6 +33,7 @@ let gIntro = {
showPanel: function() {
// Point the panel at the 'what' link
this._nodes.panel.hidden = false;
this._nodes.panel.openPopup(this._nodes.what);
},
@ -48,4 +50,8 @@ let gIntro = {
});
}
},
_hidePanel: function() {
this._nodes.panel.hidden = true;
}
};

View File

@ -21,19 +21,19 @@
title="&newtab.pageTitle;">
<xul:panel id="newtab-intro-panel" orient="vertical" type="arrow"
noautohide="true">
noautohide="true" hidden="true">
<h1>&newtab.intro.header;</h1>
</xul:panel>
<xul:panel id="newtab-search-panel" orient="vertical" type="arrow"
noautohide="true">
noautohide="true" hidden="true">
<xul:hbox id="newtab-search-manage" class="newtab-search-panel-engine">
<xul:label>&cmd_engineManager.label;</xul:label>
</xul:hbox>
</xul:panel>
<xul:panel id="newtab-customize-panel" orient="vertical" type="arrow"
noautohide="true">
noautohide="true" hidden="true">
<xul:hbox id="newtab-customize-enhanced" class="newtab-customize-panel-item">
<xul:label>&newtab.customize.enhanced;</xul:label>
</xul:hbox>

View File

@ -4,6 +4,9 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#endif
// The amount of time we wait while coalescing updates for hidden pages.
const SCHEDULE_UPDATE_TIMEOUT_MS = 1000;
/**
* This singleton represents the whole 'New Tab Page' and takes care of
* initializing all its components.
@ -69,16 +72,39 @@ let gPage = {
},
/**
* Updates the whole page and the grid when the storage has changed.
* @param aOnlyIfHidden If true, the page is updated only if it's hidden in
* the preloader.
* Updates the page's grid right away for visible pages. If the page is
* currently hidden, i.e. in a background tab or in the preloader, then we
* batch multiple update requests and refresh the grid once after a short
* delay. Accepts a single parameter the specifies the reason for requesting
* a page update. The page may decide to delay or prevent a requested updated
* based on the given reason.
*/
update: function Page_update(aOnlyIfHidden=false) {
let skipUpdate = aOnlyIfHidden && !document.hidden;
// The grid might not be ready yet as we initialize it asynchronously.
if (gGrid.ready && !skipUpdate) {
gGrid.refresh();
update(reason = "") {
// Update immediately if we're visible.
if (!document.hidden) {
// Ignore updates where reason=links-changed as those signal that the
// provider's set of links changed. We don't want to update visible pages
// in that case, it is ok to wait until the user opens the next tab.
if (reason != "links-changed" && gGrid.ready) {
gGrid.refresh();
}
return;
}
// Bail out if we scheduled before.
if (this._scheduleUpdateTimeout) {
return;
}
this._scheduleUpdateTimeout = setTimeout(() => {
// Refresh if the grid is ready.
if (gGrid.ready) {
gGrid.refresh();
}
this._scheduleUpdateTimeout = null;
}, SCHEDULE_UPDATE_TIMEOUT_MS);
},
/**
@ -170,6 +196,15 @@ let gPage = {
}
break;
case "visibilitychange":
// Cancel any delayed updates for hidden pages now that we're visible.
if (this._scheduleUpdateTimeout) {
clearTimeout(this._scheduleUpdateTimeout);
this._scheduleUpdateTimeout = null;
// An update was pending so force an update now.
this.update();
}
setTimeout(() => this.onPageFirstVisible());
removeEventListener("visibilitychange", this);
break;

View File

@ -21,10 +21,12 @@ let gSearch = {
showPanel: function () {
let panel = this._nodes.panel;
let logo = this._nodes.logo;
panel.hidden = false;
panel.openPopup(logo);
logo.setAttribute("active", "true");
panel.addEventListener("popuphidden", function onHidden() {
panel.removeEventListener("popuphidden", onHidden);
panel.hidden = true;
logo.removeAttribute("active");
});
},

View File

@ -44,6 +44,10 @@ function runTests() {
"New page grid is updated correctly.");
gBrowser.removeTab(newTab);
// Wait until the original tab is visible again.
let doc = existingTab.linkedBrowser.contentDocument;
yield waitForCondition(() => !doc.hidden).then(TestRunner.next);
}
gBrowser.removeTab(existingTab);

View File

@ -354,8 +354,8 @@ let checkCurrentEngine = Task.async(function* ({name: basename, logoPrefix1x, lo
ok(base64.startsWith(expectedLogoPrefix), "Checking image prefix.");
logo.click();
let panel = searchPanel();
panel.openPopup(logo);
yield promisePanelShown(panel);
panel.hidePopup();

View File

@ -1,44 +1,32 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Checks that newtab is updated as its links change.
*/
function runTests() {
// First, start with an empty page. setLinks will trigger a hidden page
// update because it calls clearHistory. We need to wait for that update to
// happen so that the next time we wait for a page update below, we catch the
// right update and not the one triggered by setLinks.
//
// Why this weird way of yielding? First, these two functions don't return
// promises, they call TestRunner.next when done. Second, the point at which
// setLinks is done is independent of when the page update will happen, so
// calling whenPagesUpdated cannot wait until that time.
setLinks([]);
whenPagesUpdated(null, true);
yield null;
yield null;
yield whenPagesUpdatedAnd(resolve => setLinks([], resolve));
// Strategy: Add some visits, open a new page, check the grid, repeat.
fillHistory([link(1)]);
yield whenPagesUpdated(null, true);
yield fillHistoryAndWaitForPageUpdate([1]);
yield addNewTabPageTab();
checkGrid("1,,,,,,,,");
fillHistory([link(2)]);
yield whenPagesUpdated(null, true);
yield fillHistoryAndWaitForPageUpdate([2]);
yield addNewTabPageTab();
checkGrid("2,1,,,,,,,");
fillHistory([link(1)]);
yield whenPagesUpdated(null, true);
yield fillHistoryAndWaitForPageUpdate([1]);
yield addNewTabPageTab();
checkGrid("1,2,,,,,,,");
// Wait for fillHistory to add all links before waiting for an update
yield fillHistory([link(2), link(3), link(4)], TestRunner.next);
yield whenPagesUpdated(null, true);
yield fillHistoryAndWaitForPageUpdate([2, 3, 4]);
yield addNewTabPageTab();
checkGrid("2,1,3,4,,,,,");
@ -46,6 +34,16 @@ function runTests() {
is(getCell(1).site.link.type, "history", "added link is history");
}
function fillHistoryAndWaitForPageUpdate(links) {
return whenPagesUpdatedAnd(resolve => fillHistory(links.map(link), resolve));
}
function whenPagesUpdatedAnd(promiseConstructor) {
let promise1 = new Promise(whenPagesUpdated);
let promise2 = new Promise(promiseConstructor);
return Promise.all([promise1, promise2]).then(TestRunner.next);
}
function link(id) {
return { url: "http://example" + id + ".com/", title: "site#" + id };
}

View File

@ -214,7 +214,7 @@ function getCell(aIndex) {
* {url: "http://example2.com/", title: "site#2"},
* {url: "http://example3.com/", title: "site#3"}]
*/
function setLinks(aLinks) {
function setLinks(aLinks, aCallback = TestRunner.next) {
let links = aLinks;
if (typeof links == "string") {
@ -233,7 +233,7 @@ function setLinks(aLinks) {
fillHistory(links, function () {
NewTabUtils.links.populateCache(function () {
NewTabUtils.allPages.update();
TestRunner.next();
aCallback();
}, true);
});
});
@ -249,7 +249,7 @@ function clearHistory(aCallback) {
PlacesUtils.history.removeAllPages();
}
function fillHistory(aLinks, aCallback) {
function fillHistory(aLinks, aCallback = TestRunner.next) {
let numLinks = aLinks.length;
if (!numLinks) {
if (aCallback)
@ -323,6 +323,33 @@ function restore() {
NewTabUtils.restore();
}
/**
* Wait until a given condition becomes true.
*/
function waitForCondition(aConditionFn, aMaxTries=50, aCheckInterval=100) {
return new Promise((resolve, reject) => {
let tries = 0;
function tryNow() {
tries++;
if (aConditionFn()) {
resolve();
} else if (tries < aMaxTries) {
tryAgain();
} else {
reject("Condition timed out: " + aConditionFn.toSource());
}
}
function tryAgain() {
setTimeout(tryNow, aCheckInterval);
}
tryAgain();
});
}
/**
* Creates a new tab containing 'about:newtab'.
*/
@ -349,7 +376,7 @@ function addNewTabPageTabPromise() {
// The new tab page might have been preloaded in the background.
if (browser.contentDocument.readyState == "complete") {
whenNewTabLoaded();
waitForCondition(() => !browser.contentDocument.hidden).then(whenNewTabLoaded);
return deferred.promise;
}
@ -617,18 +644,14 @@ function createDragEvent(aEventType, aData) {
/**
* Resumes testing when all pages have been updated.
* @param aCallback Called when done. If not specified, TestRunner.next is used.
* @param aOnlyIfHidden If true, this resumes testing only when an update that
* applies to pre-loaded, hidden pages is observed. If
* false, this resumes testing when any update is observed.
*/
function whenPagesUpdated(aCallback, aOnlyIfHidden=false) {
function whenPagesUpdated(aCallback = TestRunner.next) {
let page = {
observe: _ => _,
update: function (onlyIfHidden=false) {
if (onlyIfHidden == aOnlyIfHidden) {
NewTabUtils.allPages.unregister(this);
executeSoon(aCallback || TestRunner.next);
}
update() {
NewTabUtils.allPages.unregister(this);
executeSoon(aCallback);
}
};

View File

@ -743,16 +743,19 @@ html, .fx-embedded, #main,
position: relative;
}
.standalone .room-inner-action-area {
.standalone .room-inner-info-area {
position: absolute;
top: 35%;
left: 0;
right: 25%;
z-index: 1000;
margin: 0 auto;
width: 50%;
color: #fff;
font-weight: bold;
}
.standalone .room-inner-action-area button {
position: absolute;
.standalone .room-inner-info-area button {
border-radius: 3px;
font-size: 1.2em;
padding: .2em 1.2em;

View File

@ -129,19 +129,33 @@ loop.standaloneRoomViews = (function(mozL10n) {
this.state.roomState === ROOM_STATES.HAS_PARTICIPANTS;
},
_renderActionButtons: function() {
_renderContextualRoomInfo: function() {
switch(this.state.roomState) {
case ROOM_STATES.INIT:
case ROOM_STATES.READY: {
// Join button
return (
React.DOM.div({className: "room-inner-info-area"},
React.DOM.button({className: "btn btn-join btn-info", onClick: this.joinRoom},
mozL10n.get("rooms_room_join_label")
)
)
);
}
case ROOM_STATES.JOINED:
case ROOM_STATES.SESSION_CONNECTED: {
// Empty room message
return (
React.DOM.div({className: "room-inner-info-area"},
React.DOM.p({className: "empty-room-message"},
mozL10n.get("rooms_only_occupant_label")
)
)
);
}
}
// XXX Render "Start your own" button when room is over capacity (see
// bug 1074709)
if (this.state.roomState === ROOM_STATES.INIT ||
this.state.roomState === ROOM_STATES.READY) {
return (
React.DOM.div({className: "room-inner-action-area"},
React.DOM.button({className: "btn btn-join btn-info", onClick: this.joinRoom},
mozL10n.get("rooms_room_join_label")
)
)
);
}
},
render: function() {
@ -154,7 +168,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
return (
React.DOM.div({className: "room-conversation-wrapper"},
this._renderActionButtons(),
this._renderContextualRoomInfo(),
React.DOM.div({className: "video-layout-wrapper"},
React.DOM.div({className: "conversation room-conversation"},
React.DOM.h2({className: "room-name"}, this.state.roomName),

View File

@ -129,19 +129,33 @@ loop.standaloneRoomViews = (function(mozL10n) {
this.state.roomState === ROOM_STATES.HAS_PARTICIPANTS;
},
_renderActionButtons: function() {
_renderContextualRoomInfo: function() {
switch(this.state.roomState) {
case ROOM_STATES.INIT:
case ROOM_STATES.READY: {
// Join button
return (
<div className="room-inner-info-area">
<button className="btn btn-join btn-info" onClick={this.joinRoom}>
{mozL10n.get("rooms_room_join_label")}
</button>
</div>
);
}
case ROOM_STATES.JOINED:
case ROOM_STATES.SESSION_CONNECTED: {
// Empty room message
return (
<div className="room-inner-info-area">
<p className="empty-room-message">
{mozL10n.get("rooms_only_occupant_label")}
</p>
</div>
);
}
}
// XXX Render "Start your own" button when room is over capacity (see
// bug 1074709)
if (this.state.roomState === ROOM_STATES.INIT ||
this.state.roomState === ROOM_STATES.READY) {
return (
<div className="room-inner-action-area">
<button className="btn btn-join btn-info" onClick={this.joinRoom}>
{mozL10n.get("rooms_room_join_label")}
</button>
</div>
);
}
},
render: function() {
@ -154,7 +168,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
return (
<div className="room-conversation-wrapper">
{this._renderActionButtons()}
{this._renderContextualRoomInfo()}
<div className="video-layout-wrapper">
<div className="conversation room-conversation">
<h2 className="room-name">{this.state.roomName}</h2>

View File

@ -102,6 +102,32 @@ describe("loop.standaloneRoomViews", function() {
view = mountTestComponent();
});
describe("Empty room message", function() {
it("should display an empty room message on JOINED",
function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.JOINED});
expect(view.getDOMNode().querySelector(".empty-room-message"))
.not.eql(null);
});
it("should display an empty room message on SESSION_CONNECTED",
function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.SESSION_CONNECTED});
expect(view.getDOMNode().querySelector(".empty-room-message"))
.not.eql(null);
});
it("shouldn't display an empty room message on HAS_PARTICIPANTS",
function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.HAS_PARTICIPANTS});
expect(view.getDOMNode().querySelector(".empty-room-message"))
.eql(null);
});
});
describe("Join button", function() {
function getJoinButton(view) {
return view.getDOMNode().querySelector(".btn-join");

View File

@ -569,6 +569,15 @@
)
),
Example({summary: "Standalone room conversation (joined)"},
React.DOM.div({className: "standalone"},
StandaloneRoomView({
dispatcher: dispatcher,
activeRoomStore: activeRoomStore,
roomState: ROOM_STATES.JOINED})
)
),
Example({summary: "Standalone room conversation (has-participants)"},
React.DOM.div({className: "standalone"},
StandaloneRoomView({

View File

@ -569,6 +569,15 @@
</div>
</Example>
<Example summary="Standalone room conversation (joined)">
<div className="standalone">
<StandaloneRoomView
dispatcher={dispatcher}
activeRoomStore={activeRoomStore}
roomState={ROOM_STATES.JOINED} />
</div>
</Example>
<Example summary="Standalone room conversation (has-participants)">
<div className="standalone">
<StandaloneRoomView

View File

@ -230,7 +230,7 @@ BrowserGlue.prototype = {
},
#endif
// nsIObserver implementation
// nsIObserver implementation
observe: function BG_observe(subject, topic, data) {
switch (topic) {
case "prefservice:after-app-defaults":
@ -1459,7 +1459,7 @@ BrowserGlue.prototype = {
},
_migrateUI: function BG__migrateUI() {
const UI_VERSION = 25;
const UI_VERSION = 26;
const BROWSER_DOCURL = "chrome://browser/content/browser.xul";
let currentUIVersion = 0;
try {
@ -1735,6 +1735,40 @@ BrowserGlue.prototype = {
catch (ex) {}
}
if (currentUIVersion < 26) {
// Refactor urlbar suggestion preferences to make it extendable and
// allow new suggestion types (e.g: search suggestions).
let types = ["history", "bookmark", "openpage"];
let defaultBehavior = 0;
try {
defaultBehavior = Services.prefs.getIntPref("browser.urlbar.default.behavior");
} catch (ex) {}
try {
let autocompleteEnabled = Services.prefs.getBoolPref("browser.urlbar.autocomplete.enabled");
if (!autocompleteEnabled) {
defaultBehavior = -1;
}
} catch (ex) {}
// If the default behavior is:
// -1 - all new "...suggest.*" preferences will be false
// 0 - all new "...suggest.*" preferences will use the default values
// > 0 - all new "...suggest.*" preferences will be inherited
for (let type of types) {
let prefValue = defaultBehavior == 0;
if (defaultBehavior > 0) {
prefValue = !!(defaultBehavior & Ci.mozIPlacesAutoComplete["BEHAVIOR_" + type.toUpperCase()]);
}
Services.prefs.setBoolPref("browser.urlbar.suggest." + type, prefValue);
}
// Typed behavior will be used only for results from history.
if (defaultBehavior != -1 &&
!!(defaultBehavior & Ci.mozIPlacesAutoComplete["BEHAVIOR_TYPED"])) {
Services.prefs.setBoolPref("browser.urlbar.suggest.history.onlyTyped", true);
}
}
// Update the migration version.
Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
},

View File

@ -0,0 +1,150 @@
/* 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/. */
const UI_VERSION = 26;
const TOPIC_BROWSERGLUE_TEST = "browser-glue-test";
const TOPICDATA_BROWSERGLUE_TEST = "force-ui-migration";
const DEFAULT_BEHAVIOR_PREF = "browser.urlbar.default.behavior";
const AUTOCOMPLETE_PREF = "browser.urlbar.autocomplete.enabled";
let gBrowserGlue = Cc["@mozilla.org/browser/browserglue;1"]
.getService(Ci.nsIObserver);
let gGetBoolPref = Services.prefs.getBoolPref;
function run_test() {
run_next_test();
};
do_register_cleanup(cleanup);
function cleanup() {
let prefix = "browser.urlbar.suggest.";
for (let type of ["history", "bookmark", "openpage", "history.onlyTyped"]) {
Services.prefs.clearUserPref(prefix + type);
}
Services.prefs.clearUserPref("browser.migration.version");
Services.prefs.clearUserPref(AUTOCOMPLETE_PREF);
};
function setupBehaviorAndMigrate(aDefaultBehavior, aAutocompleteEnabled = true) {
cleanup();
// Migrate browser.urlbar.default.behavior preference.
Services.prefs.setIntPref("browser.migration.version", UI_VERSION - 1);
Services.prefs.setIntPref(DEFAULT_BEHAVIOR_PREF, aDefaultBehavior);
Services.prefs.setBoolPref(AUTOCOMPLETE_PREF, aAutocompleteEnabled);
// Simulate a migration.
gBrowserGlue.observe(null, TOPIC_BROWSERGLUE_TEST, TOPICDATA_BROWSERGLUE_TEST);
};
add_task(function*() {
do_log_info("Migrate default.behavior = 0");
setupBehaviorAndMigrate(0);
Assert.ok(gGetBoolPref("browser.urlbar.suggest.history"),
"History preference should be true.");
Assert.ok(gGetBoolPref("browser.urlbar.suggest.bookmark"),
"Bookmark preference should be true.");
Assert.ok(gGetBoolPref("browser.urlbar.suggest.openpage"),
"Openpage preference should be true.");
Assert.equal(gGetBoolPref("browser.urlbar.suggest.history.onlyTyped"), false,
"Typed preference should be false.");
});
add_task(function*() {
do_log_info("Migrate default.behavior = 1");
setupBehaviorAndMigrate(1);
Assert.ok(gGetBoolPref("browser.urlbar.suggest.history"),
"History preference should be true.");
Assert.equal(gGetBoolPref("browser.urlbar.suggest.bookmark"), false,
"Bookmark preference should be false.");
Assert.equal(gGetBoolPref("browser.urlbar.suggest.openpage"), false,
"Openpage preference should be false");
Assert.equal(gGetBoolPref("browser.urlbar.suggest.history.onlyTyped"), false,
"Typed preference should be false");
});
add_task(function*() {
do_log_info("Migrate default.behavior = 2");
setupBehaviorAndMigrate(2);
Assert.equal(gGetBoolPref("browser.urlbar.suggest.history"), false,
"History preference should be false.");
Assert.ok(gGetBoolPref("browser.urlbar.suggest.bookmark"),
"Bookmark preference should be true.");
Assert.equal(gGetBoolPref("browser.urlbar.suggest.openpage"), false,
"Openpage preference should be false");
Assert.equal(gGetBoolPref("browser.urlbar.suggest.history.onlyTyped"), false,
"Typed preference should be false");
});
add_task(function*() {
do_log_info("Migrate default.behavior = 3");
setupBehaviorAndMigrate(3);
Assert.ok(gGetBoolPref("browser.urlbar.suggest.history"),
"History preference should be true.");
Assert.ok(gGetBoolPref("browser.urlbar.suggest.bookmark"),
"Bookmark preference should be true.");
Assert.equal(gGetBoolPref("browser.urlbar.suggest.openpage"), false,
"Openpage preference should be false");
Assert.equal(gGetBoolPref("browser.urlbar.suggest.history.onlyTyped"), false,
"Typed preference should be false");
});
add_task(function*() {
do_log_info("Migrate default.behavior = 19");
setupBehaviorAndMigrate(19);
Assert.ok(gGetBoolPref("browser.urlbar.suggest.history"),
"History preference should be true.");
Assert.ok(gGetBoolPref("browser.urlbar.suggest.bookmark"),
"Bookmark preference should be true.");
Assert.equal(gGetBoolPref("browser.urlbar.suggest.openpage"), false,
"Openpage preference should be false");
Assert.equal(gGetBoolPref("browser.urlbar.suggest.history.onlyTyped"), false,
"Typed preference should be false");
});
add_task(function*() {
do_log_info("Migrate default.behavior = 33");
setupBehaviorAndMigrate(33);
Assert.ok(gGetBoolPref("browser.urlbar.suggest.history"),
"History preference should be true.");
Assert.equal(gGetBoolPref("browser.urlbar.suggest.bookmark"), false,
"Bookmark preference should be false.");
Assert.equal(gGetBoolPref("browser.urlbar.suggest.openpage"), false,
"Openpage preference should be false");
Assert.ok(gGetBoolPref("browser.urlbar.suggest.history.onlyTyped"),
"Typed preference should be true");
});
add_task(function*() {
do_log_info("Migrate default.behavior = 129");
setupBehaviorAndMigrate(129);
Assert.ok(gGetBoolPref("browser.urlbar.suggest.history"),
"History preference should be true.");
Assert.equal(gGetBoolPref("browser.urlbar.suggest.bookmark"), false,
"Bookmark preference should be false.");
Assert.ok(gGetBoolPref("browser.urlbar.suggest.openpage"),
"Openpage preference should be true");
Assert.equal(gGetBoolPref("browser.urlbar.suggest.history.onlyTyped"), false,
"Typed preference should be false");
});
add_task(function*() {
do_log_info("Migrate default.behavior = 0, autocomplete.enabled = false");
setupBehaviorAndMigrate(0, false);
Assert.equal(gGetBoolPref("browser.urlbar.suggest.history"), false,
"History preference should be false.");
Assert.equal(gGetBoolPref("browser.urlbar.suggest.bookmark"), false,
"Bookmark preference should be false.");
Assert.equal(gGetBoolPref("browser.urlbar.suggest.openpage"), false,
"Openpage preference should be false");
Assert.equal(gGetBoolPref("browser.urlbar.suggest.history.onlyTyped"), false,
"Typed preference should be false");
});

View File

@ -19,6 +19,7 @@ support-files =
[test_browserGlue_prefs.js]
[test_browserGlue_restore.js]
[test_browserGlue_smartBookmarks.js]
[test_browserGlue_urlbar_defaultbehavior_migration.js]
[test_clearHistory_shutdown.js]
[test_leftpane_corruption_handling.js]
[test_PUIU_makeTransaction.js]

View File

@ -32,6 +32,25 @@ var gPrivacyPane = {
},
#endif
/**
* Initialize autocomplete to ensure prefs are in sync.
*/
_initAutocomplete: function () {
let unifiedCompletePref = false;
try {
unifiedCompletePref =
Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
} catch (ex) {}
if (unifiedCompletePref) {
Components.classes["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
.getService(Components.interfaces.mozIPlacesAutoComplete);
} else {
Components.classes["@mozilla.org/autocomplete/search;1?name=history"]
.getService(Components.interfaces.mozIPlacesAutoComplete);
}
},
/**
* Sets up the UI for the number of days of history to keep, and updates the
* label of the "Clear Now..." button.
@ -52,11 +71,8 @@ var gPrivacyPane = {
#ifdef NIGHTLY_BUILD
this._initTrackingProtection();
#endif
this._initAutocomplete();
setEventListener("browser.urlbar.default.behavior", "change",
document.getElementById('browser.urlbar.autocomplete.enabled')
.updateElements
);
setEventListener("privacy.sanitize.sanitizeOnShutdown", "change",
gPrivacyPane._updateSanitizeSettingsButton);
setEventListener("browser.privatebrowsing.autostart", "change",
@ -328,40 +344,16 @@ var gPrivacyPane = {
// HISTORY
/**
* Read the location bar enabled and suggestion prefs
* @return Int value for suggestion menulist
* Update browser.urlbar.autocomplete.enabled when a
* browser.urlbar.suggest.* pref is changed from the ui.
*/
readSuggestionPref: function PPP_readSuggestionPref()
{
let getVal = function(aPref)
document.getElementById("browser.urlbar." + aPref).value;
// Suggest nothing if autocomplete is not enabled
if (!getVal("autocomplete.enabled"))
return -1;
// Bottom 2 bits of default.behavior specify history/bookmark
return getVal("default.behavior") & 3;
},
/**
* Write the location bar enabled and suggestion prefs when necessary
* @return Bool value for enabled pref
*/
writeSuggestionPref: function PPP_writeSuggestionPref()
{
let menuVal = document.getElementById("locationBarSuggestion").value;
let enabled = menuVal != -1;
// Only update default.behavior if we're giving suggestions
if (enabled) {
// Put the selected menu item's value directly into the bottom 2 bits
let behavior = document.getElementById("browser.urlbar.default.behavior");
behavior.value = behavior.value >> 2 << 2 | menuVal;
writeSuggestionPref: function () {
let getVal = (aPref) => {
return document.getElementById("browser.urlbar.suggest." + aPref).value;
}
// Always update the enabled pref
return enabled;
// autocomplete.enabled is true if any of the suggestions is true
let enabled = ["history", "bookmark", "openpage"].map(getVal).some(v => v);
Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", enabled);
},
/*

View File

@ -29,9 +29,15 @@
<preference id="browser.urlbar.autocomplete.enabled"
name="browser.urlbar.autocomplete.enabled"
type="bool"/>
<preference id="browser.urlbar.default.behavior"
name="browser.urlbar.default.behavior"
type="int"/>
<preference id="browser.urlbar.suggest.bookmark"
name="browser.urlbar.suggest.bookmark"
type="bool"/>
<preference id="browser.urlbar.suggest.history"
name="browser.urlbar.suggest.history"
type="bool"/>
<preference id="browser.urlbar.suggest.openpage"
name="browser.urlbar.suggest.openpage"
type="bool"/>
<!-- History -->
<preference id="places.history.enabled"
@ -231,23 +237,21 @@
</groupbox>
<!-- Location Bar -->
<groupbox id="locationBarGroup" data-category="panePrivacy" hidden="true">
<groupbox id="locationBarGroup"
data-category="panePrivacy"
hidden="true">
<caption><label>&locationBar.label;</label></caption>
<hbox align="center">
<label id="locationBarSuggestionLabel"
control="locationBarSuggestion"
accesskey="&locbar.pre.accessKey;">&locbar.pre.label;</label>
<menulist id="locationBarSuggestion"
preference="browser.urlbar.autocomplete.enabled"
onsyncfrompreference="return gPrivacyPane.readSuggestionPref();"
onsynctopreference="return gPrivacyPane.writeSuggestionPref();">
<menupopup>
<menuitem label="&locbar.both.label;" value="0"/>
<menuitem label="&locbar.history.label;" value="1"/>
<menuitem label="&locbar.bookmarks.label;" value="2"/>
<menuitem label="&locbar.nothing.label;" value="-1"/>
</menupopup>
</menulist>
<label>&locbar.post.label;</label>
</hbox>
<label id="locationBarSuggestionLabel">&locbar.pre.label;</label>
<checkbox id="historySuggestion" label="&locbar.history.label;"
onsyncfrompreference="return gPrivacyPane.writeSuggestionPref();"
accesskey="&locbar.history.accesskey;"
preference="browser.urlbar.suggest.history"/>
<checkbox id="bookmarkSuggestion" label="&locbar.bookmarks.label;"
onsyncfrompreference="return gPrivacyPane.writeSuggestionPref();"
accesskey="&locbar.bookmarks.accesskey;"
preference="browser.urlbar.suggest.bookmark"/>
<checkbox id="openpageSuggestion" label="&locbar.openpage.label;"
onsyncfrompreference="return gPrivacyPane.writeSuggestionPref();"
accesskey="&locbar.openpage.accesskey;"
preference="browser.urlbar.suggest.openpage"/>
</groupbox>

View File

@ -13,13 +13,13 @@ function test() {
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
run_test_subset([
test_locbar_suggestion_retention(-1, undefined),
test_locbar_suggestion_retention(1, -1),
test_locbar_suggestion_retention(2, 1),
test_locbar_suggestion_retention(0, 2),
test_locbar_suggestion_retention(0, 0),
test_locbar_suggestion_retention("history", true),
test_locbar_suggestion_retention("bookmark", true),
test_locbar_suggestion_retention("openpage", false),
test_locbar_suggestion_retention("history", true),
test_locbar_suggestion_retention("history", false),
// reset all preferences to their default values once we're done
reset_preferences
]);
}
}

View File

@ -301,18 +301,14 @@ function test_custom_retention(controlToChange, expect, valueIncrement) {
};
}
function test_locbar_suggestion_retention(mode, expect) {
function test_locbar_suggestion_retention(suggestion, autocomplete) {
return function(win) {
let locbarsuggest = win.document.getElementById("locationBarSuggestion");
ok(locbarsuggest, "location bar suggestion menulist should exist");
let elem = win.document.getElementById(suggestion + "Suggestion");
ok(elem, "Suggest " + suggestion + " checkbox should exist.");
elem.click();
if (expect !== undefined) {
is(locbarsuggest.value, expect,
"location bar suggestion is expected to remain " + expect);
}
locbarsuggest.value = mode;
controlChanged(locbarsuggest);
is(Services.prefs.getBoolPref("browser.urlbar.autocomplete.enabled"), autocomplete,
"browser.urlbar.autocomplete.enabled pref should be " + autocomplete);
};
}

View File

@ -35,6 +35,25 @@ var gPrivacyPane = {
},
#endif
/**
* Initialize autocomplete to ensure prefs are in sync.
*/
_initAutocomplete: function () {
let unifiedCompletePref = false;
try {
unifiedCompletePref =
Services.prefs.getBoolPref("browser.urlbar.unifiedcomplete");
} catch (ex) {}
if (unifiedCompletePref) {
Components.classes["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
.getService(Components.interfaces.mozIPlacesAutoComplete);
} else {
Components.classes["@mozilla.org/autocomplete/search;1?name=history"]
.getService(Components.interfaces.mozIPlacesAutoComplete);
}
},
/**
* Sets up the UI for the number of days of history to keep, and updates the
* label of the "Clear Now..." button.
@ -49,6 +68,7 @@ var gPrivacyPane = {
#ifdef NIGHTLY_BUILD
this._initTrackingProtection();
#endif
this._initAutocomplete();
},
// HISTORY MODE
@ -291,40 +311,16 @@ var gPrivacyPane = {
// HISTORY
/**
* Read the location bar enabled and suggestion prefs
* @return Int value for suggestion menulist
* Update browser.urlbar.autocomplete.enabled when a
* browser.urlbar.suggest.* pref is changed from the ui.
*/
readSuggestionPref: function PPP_readSuggestionPref()
{
let getVal = function(aPref)
document.getElementById("browser.urlbar." + aPref).value;
// Suggest nothing if autocomplete is not enabled
if (!getVal("autocomplete.enabled"))
return -1;
// Bottom 2 bits of default.behavior specify history/bookmark
return getVal("default.behavior") & 3;
},
/**
* Write the location bar enabled and suggestion prefs when necessary
* @return Bool value for enabled pref
*/
writeSuggestionPref: function PPP_writeSuggestionPref()
{
let menuVal = document.getElementById("locationBarSuggestion").value;
let enabled = menuVal != -1;
// Only update default.behavior if we're giving suggestions
if (enabled) {
// Put the selected menu item's value directly into the bottom 2 bits
let behavior = document.getElementById("browser.urlbar.default.behavior");
behavior.value = behavior.value >> 2 << 2 | menuVal;
writeSuggestionPref: function PPP_writeSuggestionPref() {
let getVal = (aPref) => {
return document.getElementById("browser.urlbar.suggest." + aPref).value;
}
// Always update the enabled pref
return enabled;
// autocomplete.enabled is true if any of the suggestions is true
let enabled = ["history", "bookmark", "openpage"].map(getVal).some(v => v);
Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", enabled);
},
/*

View File

@ -42,10 +42,15 @@
<preference id="browser.urlbar.autocomplete.enabled"
name="browser.urlbar.autocomplete.enabled"
type="bool"/>
<preference id="browser.urlbar.default.behavior"
name="browser.urlbar.default.behavior"
type="int"
onchange="document.getElementById('browser.urlbar.autocomplete.enabled').updateElements();"/>
<preference id="browser.urlbar.suggest.bookmark"
name="browser.urlbar.suggest.bookmark"
type="bool"/>
<preference id="browser.urlbar.suggest.history"
name="browser.urlbar.suggest.history"
type="bool"/>
<preference id="browser.urlbar.suggest.openpage"
name="browser.urlbar.suggest.openpage"
type="bool"/>
<!-- History -->
<preference id="places.history.enabled"
@ -254,23 +259,22 @@
<groupbox id="locationBarGroup">
<caption label="&locationBar.label;"/>
<hbox align="center">
<label id="locationBarSuggestionLabel"
control="locationBarSuggestion"
accesskey="&locbar.pre.accessKey;">&locbar.pre.label;</label>
<menulist id="locationBarSuggestion"
preference="browser.urlbar.autocomplete.enabled"
onsyncfrompreference="return gPrivacyPane.readSuggestionPref();"
onsynctopreference="return gPrivacyPane.writeSuggestionPref();">
<menupopup>
<menuitem label="&locbar.both.label;" value="0"/>
<menuitem label="&locbar.history.label;" value="1"/>
<menuitem label="&locbar.bookmarks.label;" value="2"/>
<menuitem label="&locbar.nothing.label;" value="-1"/>
</menupopup>
</menulist>
<label>&locbar.post.label;</label>
</hbox>
<label id="locationBarSuggestionLabel">&locbar.pre.label;</label>
<vbox id="tabPrefsBox" align="start" flex="1">
<checkbox id="historySuggestion" label="&locbar.history.label;"
onsyncfrompreference="return gPrivacyPane.writeSuggestionPref();"
accesskey="&locbar.history.accesskey;"
preference="browser.urlbar.suggest.history"/>
<checkbox id="bookmarkSuggestion" label="&locbar.bookmarks.label;"
onsyncfrompreference="return gPrivacyPane.writeSuggestionPref();"
accesskey="&locbar.bookmarks.accesskey;"
preference="browser.urlbar.suggest.bookmark"/>
<checkbox id="openpageSuggestion" label="&locbar.openpage.label;"
onsyncfrompreference="return gPrivacyPane.writeSuggestionPref();"
accesskey="&locbar.openpage.accesskey;"
preference="browser.urlbar.suggest.openpage"/>
</vbox>
</groupbox>
</prefpane>

View File

@ -19,5 +19,4 @@ skip-if = !healthreport || (os == 'linux' && debug)
[browser_privacypane_4.js]
skip-if = e10s # leaks windows
[browser_privacypane_5.js]
skip-if = e10s # leaks windows
[browser_privacypane_8.js]

View File

@ -1,6 +1,5 @@
/* 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/. */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
@ -14,13 +13,13 @@ function test() {
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
run_test_subset([
test_locbar_suggestion_retention(-1, undefined),
test_locbar_suggestion_retention(1, -1),
test_locbar_suggestion_retention(2, 1),
test_locbar_suggestion_retention(0, 2),
test_locbar_suggestion_retention(0, 0),
test_locbar_suggestion_retention("history", true),
test_locbar_suggestion_retention("bookmark", true),
test_locbar_suggestion_retention("openpage", false),
test_locbar_suggestion_retention("history", true),
test_locbar_suggestion_retention("history", false),
// reset all preferences to their default values once we're done
reset_preferences
]);
}
}

View File

@ -310,18 +310,14 @@ function test_custom_retention(controlToChange, expect, valueIncrement) {
};
}
function test_locbar_suggestion_retention(mode, expect) {
function test_locbar_suggestion_retention(suggestion, autocomplete) {
return function(win) {
let locbarsuggest = win.document.getElementById("locationBarSuggestion");
ok(locbarsuggest, "location bar suggestion menulist should exist");
let elem = win.document.getElementById(suggestion + "Suggestion");
ok(elem, "Suggest " + suggestion + " checkbox should exist.");
elem.click();
if (expect !== undefined) {
is(locbarsuggest.value, expect,
"location bar suggestion is expected to remain " + expect);
}
locbarsuggest.value = mode;
controlChanged(locbarsuggest);
is(Services.prefs.getBoolPref("browser.urlbar.autocomplete.enabled"), autocomplete,
"browser.urlbar.autocomplete.enabled pref should be " + autocomplete);
};
}

View File

@ -0,0 +1,58 @@
/* 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/. */
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
var stringBundle = Cc["@mozilla.org/intl/stringbundle;1"].getService(Ci.nsIStringBundleService)
.createBundle("chrome://browser/locale/aboutPrivateBrowsing.properties");
if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
document.title = stringBundle.GetStringFromName("title.normal");
setFavIcon("chrome://global/skin/icons/question-16.png");
} else {
document.title = stringBundle.GetStringFromName("title");
setFavIcon("chrome://browser/skin/Privacy-16.png");
}
var mainWindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem)
.rootTreeItem
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
function setFavIcon(url) {
var icon = document.createElement("link");
icon.setAttribute("rel", "icon");
icon.setAttribute("type", "image/png");
icon.setAttribute("href", url);
var head = document.getElementsByTagName("head")[0];
head.insertBefore(icon, head.firstChild);
}
document.addEventListener("DOMContentLoaded", function () {
if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
document.body.setAttribute("class", "normal");
}
// Set up the help link
let learnMoreURL = Cc["@mozilla.org/toolkit/URLFormatterService;1"]
.getService(Ci.nsIURLFormatter)
.formatURLPref("app.support.baseURL");
let learnMore = document.getElementById("learnMore");
if (learnMore) {
learnMore.setAttribute("href", learnMoreURL + "private-browsing");
}
let startPrivateBrowsing = document.getElementById("startPrivateBrowsing");
if (startPrivateBrowsing) {
startPrivateBrowsing.addEventListener("command", openPrivateWindow);
}
}, false);
function openPrivateWindow() {
mainWindow.OpenBrowserWindow({private: true});
}

View File

@ -20,56 +20,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="chrome://browser/content/aboutPrivateBrowsing.css" type="text/css" media="all"/>
<script type="application/javascript;version=1.7"><![CDATA[
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
document.title = "]]>&aboutPrivateBrowsing.title.normal;<![CDATA[";
setFavIcon("chrome://global/skin/icons/question-16.png");
} else {
#ifndef XP_MACOSX
document.title = "]]>&aboutPrivateBrowsing.title;<![CDATA[";
#endif
setFavIcon("chrome://browser/skin/Privacy-16.png");
}
var mainWindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem)
.rootTreeItem
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
function setFavIcon(url) {
var icon = document.createElement("link");
icon.setAttribute("rel", "icon");
icon.setAttribute("type", "image/png");
icon.setAttribute("href", url);
var head = document.getElementsByTagName("head")[0];
head.insertBefore(icon, head.firstChild);
}
document.addEventListener("DOMContentLoaded", function () {
if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
document.body.setAttribute("class", "normal");
}
// Set up the help link
let learnMoreURL = Cc["@mozilla.org/toolkit/URLFormatterService;1"]
.getService(Ci.nsIURLFormatter)
.formatURLPref("app.support.baseURL");
let learnMore = document.getElementById("learnMore");
if (learnMore) {
learnMore.setAttribute("href", learnMoreURL + "private-browsing");
}
}, false);
function openPrivateWindow() {
mainWindow.OpenBrowserWindow({private: true});
}
]]></script>
<script type="application/javascript;version=1.7" src="chrome://browser/content/aboutPrivateBrowsing.js"></script>
</head>
<body dir="&locale.dir;" class="private">
@ -85,10 +36,10 @@
<p class="notPrivateText showNormal">&aboutPrivateBrowsing.notPrivate;</p>
<button xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="startPrivateBrowsing"
class="openPrivate showNormal"
label="&privatebrowsingpage.openPrivateWindow.label;"
accesskey="&privatebrowsingpage.openPrivateWindow.accesskey;"
oncommand="openPrivateWindow();"/>
accesskey="&privatebrowsingpage.openPrivateWindow.accesskey;"/>
<div class="showPrivate">
<p class="moreInfoText">&aboutPrivateBrowsing.moreInfo;</p>
<p><a id="learnMore" target="_blank">&aboutPrivateBrowsing.learnMore;</a></p>

View File

@ -4,4 +4,5 @@
browser.jar:
* content/browser/aboutPrivateBrowsing.css (content/aboutPrivateBrowsing.css)
* content/browser/aboutPrivateBrowsing.xhtml (content/aboutPrivateBrowsing.xhtml)
content/browser/aboutPrivateBrowsing.xhtml (content/aboutPrivateBrowsing.xhtml)
* content/browser/aboutPrivateBrowsing.js (content/aboutPrivateBrowsing.js)

View File

@ -27,7 +27,7 @@ function test() {
about_pb_title = "Open a private window?";
pb_page_with_title = test_title + " - (Private Browsing)";
pb_page_without_title = app_name + " - (Private Browsing)";
pb_about_pb_title = pb_page_without_title;
pb_about_pb_title = "You're browsing privately - (Private Browsing)";
}
else {
page_with_title = test_title + " - " + app_name;

View File

@ -539,12 +539,12 @@ StyleEditorUI.prototype = {
editor.removeAllUnusedRegions();
if (data.reports.length > 0) {
// So there is some coverage markup, but can we apply it?
let text = editor.sourceEditor.getText() + "\r";
// If the CSS text contains a '}' with some non-whitespace
// after then we assume this is compressed CSS and stop
// marking-up.
if (!/}\s*\S+\s*\r/.test(text)) {
// Only apply if this file isn't compressed. We detect a
// compressed file if there are more rules than lines.
let text = editor.sourceEditor.getText();
let lineCount = text.split("\n").length;
let ruleCount = editor.styleSheet.ruleCount;
if (lineCount >= ruleCount) {
editor.addUnusedRegions(data.reports);
}
else {

View File

@ -0,0 +1,2 @@
title=You're browsing privately
title.normal=Open a private window?

View File

@ -16,12 +16,12 @@
<!ENTITY locationBar.label "Location Bar">
<!ENTITY locbar.pre.label "When using the location bar, suggest:">
<!ENTITY locbar.pre.accessKey "u">
<!ENTITY locbar.post.label "">
<!ENTITY locbar.both.label "History and Bookmarks">
<!ENTITY locbar.history.label "History">
<!ENTITY locbar.history.accesskey "i">
<!ENTITY locbar.bookmarks.label "Bookmarks">
<!ENTITY locbar.nothing.label "Nothing">
<!ENTITY locbar.bookmarks.accesskey "d">
<!ENTITY locbar.openpage.label "Open tabs">
<!ENTITY locbar.openpage.accesskey "g">
<!ENTITY acceptCookies.label "Accept cookies from sites">
<!ENTITY acceptCookies.accesskey "A">

View File

@ -10,6 +10,7 @@
locale/browser/aboutCertError.dtd (%chrome/browser/aboutCertError.dtd)
locale/browser/aboutDialog.dtd (%chrome/browser/aboutDialog.dtd)
locale/browser/aboutPrivateBrowsing.dtd (%chrome/browser/aboutPrivateBrowsing.dtd)
locale/browser/aboutPrivateBrowsing.properties (%chrome/browser/aboutPrivateBrowsing.properties)
locale/browser/aboutRobots.dtd (%chrome/browser/aboutRobots.dtd)
locale/browser/aboutHome.dtd (%chrome/browser/aboutHome.dtd)
#ifdef MOZ_SERVICES_HEALTHREPORT

View File

@ -305,14 +305,21 @@ pref("browser.search.official", true);
// enable xul error pages
pref("browser.xul.error_pages.enabled", true);
// Specify emptyRestriction = 0 so that bookmarks appear in the list by default
pref("browser.urlbar.default.behavior", 0);
pref("browser.urlbar.default.behavior.emptyRestriction", 0);
// Let the faviconservice know that we display favicons as 25x25px so that it
// uses the right size when optimizing favicons
pref("places.favicons.optimizeToDimension", 25);
// The default behavior for the urlbar can be configured to use any combination
// of the match filters with each additional filter adding more results (union).
pref("browser.urlbar.suggest.history", true);
pref("browser.urlbar.suggest.bookmark", true);
pref("browser.urlbar.suggest.openpage", true);
pref("browser.urlbar.suggest.search", true);
// Restrictions to current suggestions can also be applied (intersection).
// Typed suggestion works only if history is set to true.
pref("browser.urlbar.suggest.history.onlyTyped", false);
// various and sundry awesomebar prefs (should remove/re-evaluate
// these once bug 447900 is fixed)
pref("browser.urlbar.trimURLs", true);

View File

@ -300,6 +300,12 @@ HiddenBrowser.prototype = {
this._applySize();
doc.getElementById("win").appendChild(this._browser);
// The browser might not have a docShell here if the HostFrame was
// destroyed while the promise was resolved. Simply bail out.
if (!this._browser.docShell) {
return;
}
// Let the docShell be inactive so that document.hidden=true.
this._browser.docShell.isActive = false;

File diff suppressed because it is too large Load Diff

View File

@ -89,8 +89,6 @@ startTest(function() {
.then(() => check(PHONE_STATE_NORMAL))
// End
.then(null, error => {
ok(false, 'promise rejects during test.');
})
.catch(error => ok(false, "Promise reject: " + error))
.then(finish);
});

View File

@ -64,8 +64,6 @@ function testConferenceAddError() {
// Start the test
startTest(function() {
testConferenceAddError()
.then(null, error => {
ok(false, 'promise rejects during test.');
})
.catch(error => ok(false, "Promise reject: " + error))
.then(finish);
});

View File

@ -41,8 +41,6 @@ function testConferenceTwoCallsTwice() {
// Start the test
startTest(function() {
testConferenceTwoCallsTwice()
.then(null, error => {
ok(false, 'promise rejects during test.');
})
.catch(error => ok(false, "Promise reject: " + error))
.then(finish);
});

View File

@ -61,8 +61,6 @@ function testConferenceRemoveError() {
// Start the test
startTest(function() {
testConferenceRemoveError()
.then(null, error => {
ok(false, 'promise rejects during test.');
})
.catch(error => ok(false, "Promise reject: " + error))
.then(finish);
});

View File

@ -30,8 +30,6 @@ function testConferenceThreeAndHangupOne() {
// Start the test
startTest(function() {
testConferenceThreeAndHangupOne()
.then(null, error => {
ok(false, 'promise rejects during test.');
})
.catch(error => ok(false, "Promise reject: " + error))
.then(finish);
});

View File

@ -34,8 +34,6 @@ function testConferenceThreeAndRemoveOne() {
// Start the test
startTest(function() {
testConferenceThreeAndRemoveOne()
.then(null, error => {
ok(false, 'promise rejects during test.');
})
.catch(error => ok(false, "Promise reject: " + error))
.then(finish);
});

View File

@ -23,8 +23,6 @@ function testConferenceTwoCalls() {
// Start the test
startTest(function() {
testConferenceTwoCalls()
.then(null, error => {
ok(false, 'promise rejects during test.');
})
.catch(error => ok(false, "Promise reject: " + error))
.then(finish);
});

View File

@ -49,8 +49,6 @@ function testConferenceHangUpBackground() {
startTest(function() {
testConferenceHangUpForeground()
.then(() => testConferenceHangUpBackground())
.then(null, error => {
ok(false, 'promise rejects during test.');
})
.catch(error => ok(false, "Promise reject: " + error))
.then(finish);
});

View File

@ -28,8 +28,6 @@ function testConferenceTwoAndHangupOne() {
// Start the test
startTest(function() {
testConferenceTwoAndHangupOne()
.then(null, error => {
ok(false, 'promise rejects during test.');
})
.catch(error => ok(false, "Promise reject: " + error))
.then(finish);
});

View File

@ -35,8 +35,6 @@ function testConferenceHoldAndResume() {
// Start the test
startTest(function() {
testConferenceHoldAndResume()
.then(null, error => {
ok(false, 'promise rejects during test.');
})
.catch(error => ok(false, "Promise reject: " + error))
.then(finish);
});

View File

@ -30,8 +30,6 @@ function testConferenceTwoAndRemoveOne() {
// Start the test
startTest(function() {
testConferenceTwoAndRemoveOne()
.then(null, error => {
ok(false, 'promise rejects during test.');
})
.catch(error => ok(false, "Promise reject: " + error))
.then(finish);
});

View File

@ -46,8 +46,6 @@ startDSDSTest(function() {
testNewCallWhenOtherConnectionInUse(0, 1)
.then(() => testNewCallWhenOtherConnectionInUse(1, 0))
.then(() => muxModem(0))
.then(null, () => {
ok(false, "promise rejects during test.");
})
.catch(error => ok(false, "Promise reject: " + error))
.then(finish);
});

View File

@ -73,8 +73,6 @@ function testIncomingCall() {
startDSDSTest(function() {
testOutgoingCall()
.then(testIncomingCall)
.then(null, () => {
ok(false, "promise rejects during test.");
})
.catch(error => ok(false, "Promise reject: " + error))
.then(finish);
});

View File

@ -78,8 +78,6 @@ startTest(function() {
.then(() => testEmergencyLabel("119", eccList))
.then(() => testEmergencyLabel("112", eccList))
.then(() => setEccListProperty(origEccList))
.then(null, error => {
ok(false, 'promise rejects during test: ' + error);
})
.catch(error => ok(false, "Promise reject: " + error))
.then(finish);
});

View File

@ -21,8 +21,6 @@ function testGettingIMEI() {
// Start test
startTest(function() {
testGettingIMEI()
.then(null, cause => {
ok(false, 'promise rejects during test: ' + cause);
})
.catch(error => ok(false, "Promise reject: " + error))
.then(finish);
});

View File

@ -185,8 +185,6 @@ startTestWithPermissions(['mobileconnection'], function() {
// reset call forwarding settings.
return promise.then(() => clearAllCallForwardingSettings())
.then(null, cause => {
ok(false, 'promise rejects during test: ' + cause);
})
.catch(error => ok(false, "Promise reject: " + error))
.then(finish);
});

View File

@ -108,8 +108,6 @@ startTest(function() {
}
return promise
.then(null, cause => {
ok(false, 'promise rejects during test: ' + cause);
})
.catch(error => ok(false, "Promise reject: " + error))
.then(finish);
});

View File

@ -98,8 +98,6 @@ function testOutgoingCallRadioOff() {
// Start test
startTestWithPermissions(['mobileconnection'], function() {
testOutgoingCallRadioOff()
.then(null, () => {
ok(false, "promise rejects during test.");
})
.catch(error => ok(false, "Promise reject: " + error))
.then(finish);
});

View File

@ -45,8 +45,6 @@ function testAutoHoldConferenceCall() {
startTest(function() {
testAutoHoldCall()
.then(() => testAutoHoldConferenceCall())
.then(null, () => {
ok(false, 'promise rejects during test.');
})
.catch(error => ok(false, "Promise reject: " + error))
.then(finish);
});

View File

@ -36,8 +36,6 @@ startTestWithPermissions(['mobileconnection'], function() {
.then(() => gRemoteAnswer(outCall))
.then(() => gDelay(1000)) // See Bug 1018051 for the purpose of the delay.
.then(() => gRemoteHangUp(outCall))
.then(null, () => {
ok(false, "promise rejects during test.");
})
.catch(error => ok(false, "Promise reject: " + error))
.then(finish);
});

View File

@ -6,57 +6,22 @@ MARIONETTE_HEAD_JS = 'head.js';
let connection;
function setRadioEnabled(enabled, callback) {
let request = connection.setRadioEnabled(enabled);
function setRadioEnabled(enabled) {
let desiredRadioState = enabled ? 'enabled' : 'disabled';
log("Set radio: " + desiredRadioState);
let pending = ['onradiostatechange', 'onsuccess'];
let done = callback;
let promises = [];
connection.onradiostatechange = function() {
let promise = gWaitForEvent(connection, "radiostatechange", event => {
let state = connection.radioState;
log("Received 'radiostatechange' event, radioState: " + state);
if (state == desiredRadioState) {
gReceivedPending('onradiostatechange', pending, done);
}
};
request.onsuccess = function onsuccess() {
gReceivedPending('onsuccess', pending, done);
};
request.onerror = function onerror() {
ok(false, "setRadioEnabled should be ok");
};
}
function dial(number) {
// Verify initial state before dial.
ok(telephony);
is(telephony.active, null);
ok(telephony.calls);
is(telephony.calls.length, 0);
log("Make an outgoing call.");
telephony.dial(number).then(null, cause => {
log("Received promise 'reject'");
is(telephony.active, null);
is(telephony.calls.length, 0);
is(cause, "RadioNotAvailable");
emulator.runCmdWithCallback("gsm list", function(result) {
log("Initial call list: " + result);
setRadioEnabled(true, cleanUp);
});
log("current radioState: " + state);
return state == desiredRadioState;
});
}
promises.push(promise);
function cleanUp() {
finish();
promises.push(connection.setRadioEnabled(enabled));
return Promise.all(promises);
}
startTestWithPermissions(['mobileconnection'], function() {
@ -64,7 +29,14 @@ startTestWithPermissions(['mobileconnection'], function() {
ok(connection instanceof MozMobileConnection,
"connection is instanceof " + connection.constructor);
setRadioEnabled(false, function() {
dial("0912345678");
});
setRadioEnabled(false)
.then(() => gDial("0912345678"))
.catch(cause => {
is(telephony.active, null);
is(telephony.calls.length, 0);
is(cause, "RadioNotAvailable");
})
.then(() => setRadioEnabled(true))
.catch(error => ok(false, "Promise reject: " + error))
.then(finish);
});

View File

@ -27,8 +27,6 @@ function testReject3rdCall() {
startTest(function() {
testReject3rdCall()
.then(null, () => {
ok(false, 'promise rejects during test.');
})
.catch(error => ok(false, "Promise reject: " + error))
.then(finish);
});

View File

@ -29,9 +29,6 @@ startTest(function() {
return deferred.promise;
})
.then(() => gRemoteHangUp(outCall))
// End
.then(null, error => {
ok(false, 'promise rejects during test.');
})
.catch(error => ok(false, "Promise reject: " + error))
.then(finish);
});

View File

@ -1072,7 +1072,6 @@ DisableFMRadio() {
void
FMRadioSeek(const FMRadioSeekDirection& aDirection) {
AssertMainThread();
PROXY_IF_SANDBOXED(FMRadioSeek(aDirection));
}
@ -1084,7 +1083,6 @@ GetFMRadioSettings(FMRadioSettings* aInfo) {
void
SetFMRadioFrequency(const uint32_t aFrequency) {
AssertMainThread();
PROXY_IF_SANDBOXED(SetFMRadioFrequency(aFrequency));
}

View File

@ -72,9 +72,7 @@ public final class EventDispatcher {
listeners.add(listener);
}
}
} catch (final IllegalAccessException e) {
throw new IllegalArgumentException("Invalid new list type", e);
} catch (final InstantiationException e) {
} catch (final IllegalAccessException | InstantiationException e) {
throw new IllegalArgumentException("Invalid new list type", e);
}
}

View File

@ -387,13 +387,13 @@ public abstract class GeckoApp
if (mMenuPanel == null) {
mMenuPanel = new MenuPanel(this, null);
} else {
// Prepare the panel everytime before showing the menu.
// Prepare the panel every time before showing the menu.
onPreparePanel(featureId, mMenuPanel, mMenu);
}
return mMenuPanel;
}
return super.onCreatePanelView(featureId);
}

View File

@ -527,7 +527,7 @@ public class GeckoAppShell
}
}
private static Runnable sCallbackRunnable = new Runnable() {
private static final Runnable sCallbackRunnable = new Runnable() {
@Override
public void run() {
ThreadUtils.assertOnUiThread();
@ -1851,7 +1851,7 @@ public class GeckoAppShell
private static final String PLUGIN_TYPE = "type";
private static final String TYPE_NATIVE = "native";
static public ArrayList<PackageInfo> mPackageInfoCache = new ArrayList<PackageInfo>();
public static final ArrayList<PackageInfo> mPackageInfoCache = new ArrayList<>();
// Returns null if plugins are blocked on the device.
static String[] getPluginDirectories() {
@ -2127,7 +2127,7 @@ public class GeckoAppShell
static native void cameraCallbackBridge(byte[] data);
static int kPreferedFps = 25;
static final int kPreferredFPS = 25;
static byte[] sCameraBuffer;
@ -2166,13 +2166,13 @@ public class GeckoAppShell
Iterator<Integer> it = params.getSupportedPreviewFrameRates().iterator();
while (it.hasNext()) {
int nFps = it.next();
if (Math.abs(nFps - kPreferedFps) < fpsDelta) {
fpsDelta = Math.abs(nFps - kPreferedFps);
if (Math.abs(nFps - kPreferredFPS) < fpsDelta) {
fpsDelta = Math.abs(nFps - kPreferredFPS);
params.setPreviewFrameRate(nFps);
}
}
} catch(Exception e) {
params.setPreviewFrameRate(kPreferedFps);
params.setPreviewFrameRate(kPreferredFPS);
}
// set up the closest preview size available
@ -2197,9 +2197,7 @@ public class GeckoAppShell
sCamera.setPreviewTexture(((TextureView)cameraView).getSurfaceTexture());
}
}
} catch(IOException e) {
Log.w(LOGTAG, "Error setPreviewXXX:", e);
} catch(RuntimeException e) {
} catch (IOException | RuntimeException e) {
Log.w(LOGTAG, "Error setPreviewXXX:", e);
}

View File

@ -79,6 +79,9 @@ public interface TelemetryContract {
// Sharing content.
SHARE("share.1"),
// Show a UI element.
SHOW("show.1"),
// Undoing a user action.
// Note: Only used in JavaScript for now, but here for completeness.
UNDO("undo.1"),
@ -161,6 +164,9 @@ public interface TelemetryContract {
// Action triggered from a settings screen.
SETTINGS("settings"),
// Actions triggered from the share overlay.
SHARE_OVERLAY("shareoverlay"),
// Action triggered from a suggestion provided to the user.
SUGGESTION("suggestion"),

View File

@ -103,11 +103,7 @@ public abstract class BackgroundService extends IntentService {
} catch (NoSuchMethodException e) {
Logger.error(LOG_TAG, "Method " + className + "/" + methodName + " not found!");
return;
} catch (IllegalArgumentException e) {
Logger.error(LOG_TAG, "Got exception invoking " + methodName + ".");
} catch (IllegalAccessException e) {
Logger.error(LOG_TAG, "Got exception invoking " + methodName + ".");
} catch (InvocationTargetException e) {
} catch (IllegalArgumentException | InvocationTargetException | IllegalAccessException e) {
Logger.error(LOG_TAG, "Got exception invoking " + methodName + ".");
}
}

View File

@ -123,13 +123,11 @@ public abstract class EnvironmentV1 {
EnvironmentAppender appender = null;
try {
appender = appenderClass.newInstance();
} catch (InstantiationException ex) {
// Should never happen, but...
Logger.warn(LOG_TAG, "Could not compute hash.", ex);
} catch (IllegalAccessException ex) {
} catch (InstantiationException | IllegalAccessException ex) {
// Should never happen, but...
Logger.warn(LOG_TAG, "Could not compute hash.", ex);
}
return appender;
}

View File

@ -201,9 +201,7 @@ public class DSACryptoImplementation {
BigInteger q = new BigInteger(o.getString("q"), SERIALIZATION_BASE);
BigInteger g = new BigInteger(o.getString("g"), SERIALIZATION_BASE);
return createPrivateKey(x, p, q, g);
} catch (NullPointerException e) {
throw new InvalidKeySpecException("x, p, q, and g must be integers encoded as strings, base " + SERIALIZATION_BASE);
} catch (NumberFormatException e) {
} catch (NullPointerException | NumberFormatException e) {
throw new InvalidKeySpecException("x, p, q, and g must be integers encoded as strings, base " + SERIALIZATION_BASE);
}
}
@ -219,9 +217,7 @@ public class DSACryptoImplementation {
BigInteger q = new BigInteger(o.getString("q"), SERIALIZATION_BASE);
BigInteger g = new BigInteger(o.getString("g"), SERIALIZATION_BASE);
return createPublicKey(y, p, q, g);
} catch (NullPointerException e) {
throw new InvalidKeySpecException("y, p, q, and g must be integers encoded as strings, base " + SERIALIZATION_BASE);
} catch (NumberFormatException e) {
} catch (NullPointerException | NumberFormatException e) {
throw new InvalidKeySpecException("y, p, q, and g must be integers encoded as strings, base " + SERIALIZATION_BASE);
}
}

View File

@ -145,9 +145,7 @@ public class RSACryptoImplementation {
BigInteger n = new BigInteger(o.getString("n"), SERIALIZATION_BASE);
BigInteger d = new BigInteger(o.getString("d"), SERIALIZATION_BASE);
return createPrivateKey(n, d);
} catch (NullPointerException e) {
throw new InvalidKeySpecException("n and d must be integers encoded as strings, base " + SERIALIZATION_BASE);
} catch (NumberFormatException e) {
} catch (NullPointerException | NumberFormatException e) {
throw new InvalidKeySpecException("n and d must be integers encoded as strings, base " + SERIALIZATION_BASE);
}
}
@ -161,9 +159,7 @@ public class RSACryptoImplementation {
BigInteger n = new BigInteger(o.getString("n"), SERIALIZATION_BASE);
BigInteger e = new BigInteger(o.getString("e"), SERIALIZATION_BASE);
return createPublicKey(n, e);
} catch (NullPointerException e) {
throw new InvalidKeySpecException("n and e must be integers encoded as strings, base " + SERIALIZATION_BASE);
} catch (NumberFormatException e) {
} catch (NullPointerException | NumberFormatException e) {
throw new InvalidKeySpecException("n and e must be integers encoded as strings, base " + SERIALIZATION_BASE);
}
}

View File

@ -417,8 +417,12 @@ public class LocalBrowserDB {
faviconField.setAccessible(true);
return faviconField.getInt(null);
} catch (IllegalAccessException | NoSuchFieldException ex) {
Log.wtf(LOGTAG, "Reflection error fetching favicon: " + name, ex);
} catch (IllegalAccessException | NoSuchFieldException e) {
// We'll end up here for any default bookmark that doesn't have a favicon in
// resources/raw/ (i.e., about:firefox). When this happens, the Favicons service will
// fall back to the default branding icon for about pages. Non-about pages should always
// specify an icon; otherwise, the placeholder globe favicon will be used.
Log.d(LOGTAG, "No raw favicon resource found for " + name);
}
Log.e(LOGTAG, "Failed to find favicon resource ID for " + name);

View File

@ -61,9 +61,7 @@ public class GeckoMenuInflater extends MenuInflater {
parseMenu(parser, attrs, menu);
} catch (XmlPullParserException e) {
throw new InflateException("Error inflating menu XML", e);
} catch (IOException e) {
} catch (XmlPullParserException | IOException e) {
throw new InflateException("Error inflating menu XML", e);
} finally {
if (parser != null)

View File

@ -12,6 +12,8 @@ import java.util.Arrays;
import org.mozilla.gecko.Assert;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.overlays.service.sharemethods.ParcelableClientRecord;
import android.app.AlertDialog;
@ -143,6 +145,12 @@ public class SendTabList extends ListView {
public void onClick(DialogInterface dialog, int index) {
listener.onSendTabTargetSelected(records[index].guid);
}
})
.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
Telemetry.sendUIEvent(TelemetryContract.Event.CANCEL, TelemetryContract.Method.SHARE_OVERLAY, "device_selection_cancel");
}
});
return builder.create();

View File

@ -12,6 +12,8 @@ import org.mozilla.gecko.Assert;
import org.mozilla.gecko.GeckoProfile;
import org.mozilla.gecko.LocaleAware;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.db.LocalBrowserDB;
import org.mozilla.gecko.overlays.OverlayConstants;
import org.mozilla.gecko.overlays.service.OverlayActionService;
@ -147,12 +149,17 @@ public class ShareDialog extends LocaleAware.LocaleAwareActivity implements Send
// If provided, we use the subject text to give us something nice to display.
// If not, we wing it with the URL.
// TODO: Consider polling Fennec databases to find better information to display.
String subjectText = intent.getStringExtra(Intent.EXTRA_SUBJECT);
String telemetryExtras = "title=" + (subjectText != null);
if (subjectText != null) {
((TextView) findViewById(R.id.title)).setText(subjectText);
}
Telemetry.sendUIEvent(TelemetryContract.Event.SHOW, TelemetryContract.Method.SHARE_OVERLAY, telemetryExtras);
title = subjectText;
url = pageUrl;
@ -321,16 +328,22 @@ public class ShareDialog extends LocaleAware.LocaleAwareActivity implements Send
startService(serviceIntent);
slideOut();
Telemetry.sendUIEvent(TelemetryContract.Event.SHARE, TelemetryContract.Method.SHARE_OVERLAY, "sendtab");
}
public void addToReadingList() {
startService(getServiceIntent(ShareMethod.Type.ADD_TO_READING_LIST));
slideOut();
Telemetry.sendUIEvent(TelemetryContract.Event.SAVE, TelemetryContract.Method.SHARE_OVERLAY, "reading_list");
}
public void addBookmark() {
startService(getServiceIntent(ShareMethod.Type.ADD_BOOKMARK));
slideOut();
Telemetry.sendUIEvent(TelemetryContract.Event.SAVE, TelemetryContract.Method.SHARE_OVERLAY, "bookmark");
}
public void launchBrowser() {
@ -386,6 +399,7 @@ public class ShareDialog extends LocaleAware.LocaleAwareActivity implements Send
@Override
public void onBackPressed() {
slideOut();
Telemetry.sendUIEvent(TelemetryContract.Event.CANCEL, TelemetryContract.Method.SHARE_OVERLAY);
}
/**
@ -394,6 +408,7 @@ public class ShareDialog extends LocaleAware.LocaleAwareActivity implements Send
@Override
public boolean onTouchEvent(MotionEvent event) {
slideOut();
Telemetry.sendUIEvent(TelemetryContract.Event.CANCEL, TelemetryContract.Method.SHARE_OVERLAY);
return true;
}
}

View File

@ -394,7 +394,6 @@
profile/bookmarks.inc (see bug 964946). Don't expose the URLs to L10N. -->
<string name="bookmarkdefaults_title_aboutfirefox">@bookmarks_aboutBrowser@</string>
<string name="bookmarkdefaults_url_aboutfirefox">about:firefox</string>
<string name="bookmarkdefaults_favicon_aboutfirefox">chrome/chrome/content/branding/favicon64.png</string>
<!-- Icon is automatically generated from R.drawable.bookmarkdefaults_favicon_addons -->
<string name="bookmarkdefaults_title_addons">@bookmarks_addons@</string>

View File

@ -138,12 +138,10 @@ public class CryptoInfo {
byte[] outputMessage = null;
try {
outputMessage = cipher.doFinal(inputMessage);
} catch (IllegalBlockSizeException e) {
throw new CryptoException(e);
} catch (BadPaddingException e) {
} catch (IllegalBlockSizeException | BadPaddingException e) {
throw new CryptoException(e);
}
return outputMessage;
return outputMessage;
}
/**
@ -176,9 +174,7 @@ public class CryptoInfo {
// Generate HMAC.
try {
hmac = generatedHMACFor(encryptedBytes, keys);
} catch (NoSuchAlgorithmException e) {
throw new CryptoException(e);
} catch (InvalidKeyException e) {
} catch (NoSuchAlgorithmException | InvalidKeyException e) {
throw new CryptoException(e);
}
@ -200,9 +196,7 @@ public class CryptoInfo {
if (!generatedHMACIsHMAC()) {
throw new HMACVerificationException();
}
} catch (NoSuchAlgorithmException e) {
throw new CryptoException(e);
} catch (InvalidKeyException e) {
} catch (NoSuchAlgorithmException | InvalidKeyException e) {
throw new CryptoException(e);
}
@ -231,9 +225,7 @@ public class CryptoInfo {
private static Cipher getCipher(String transformation) throws CryptoException {
try {
return Cipher.getInstance(transformation);
} catch (NoSuchAlgorithmException e) {
throw new CryptoException(e);
} catch (NoSuchPaddingException e) {
} catch (NoSuchAlgorithmException | NoSuchPaddingException e) {
throw new CryptoException(e);
}
}

View File

@ -44,9 +44,7 @@ public class KeyBundle {
// Hash appropriately.
try {
username = Utils.usernameFromAccount(username);
} catch (NoSuchAlgorithmException e) {
throw new IllegalArgumentException("Invalid username.");
} catch (UnsupportedEncodingException e) {
} catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
throw new IllegalArgumentException("Invalid username.");
}
@ -56,9 +54,7 @@ public class KeyBundle {
Mac hmacHasher;
try {
hmacHasher = HKDF.makeHMACHasher(syncKey);
} catch (NoSuchAlgorithmException e) {
throw new CryptoException(e);
} catch (InvalidKeyException e) {
} catch (NoSuchAlgorithmException | InvalidKeyException e) {
throw new CryptoException(e);
}
assert(hmacHasher != null); // If makeHMACHasher doesn't throw, then hmacHasher is non-null.

View File

@ -69,7 +69,7 @@ public class JPakeClient {
public boolean finished;
// J-PAKE values.
public int jpakePollInterval;
public final int jpakePollInterval;
public int jpakeMaxTries;
public String channel;
public volatile String channelUrl;
@ -82,7 +82,7 @@ public class JPakeClient {
public ExtendedJSONObject jIncoming;
public JPakeParty jParty;
public JPakeNumGenerator numGen;
public final JPakeNumGenerator numGen;
public int pollTries;
@ -420,11 +420,7 @@ public class JPakeClient {
ExtendedJSONObject jPayload = null;
try {
jPayload = encryptPayload(payload, keyBundle, true);
} catch (UnsupportedEncodingException e) {
Logger.error(LOG_TAG, "Failed to encrypt data.", e);
abort(Constants.JPAKE_ERROR_INTERNAL);
return;
} catch (CryptoException e) {
} catch (UnsupportedEncodingException | CryptoException e) {
Logger.error(LOG_TAG, "Failed to encrypt data.", e);
abort(Constants.JPAKE_ERROR_INTERNAL);
return;

View File

@ -44,7 +44,7 @@ public class DecryptDataStage extends JPakeStage {
Logger.debug(LOG_TAG, "Decrypting data.");
String cleartext = null;
try {
cleartext = new String(decryptPayload(iPayload, jClient.myKeyBundle), "UTF-8");
cleartext = new String(decryptPayload(iPayload, jClient.myKeyBundle), "UTF-8");
} catch (UnsupportedEncodingException e) {
Logger.error(LOG_TAG, "Failed to decrypt data.", e);
jClient.abort(Constants.JPAKE_ERROR_INTERNAL);
@ -60,11 +60,7 @@ public class DecryptDataStage extends JPakeStage {
Logger.error(LOG_TAG, "I/O exception while creating JSON object.", e);
jClient.abort(Constants.JPAKE_ERROR_INVALID);
return;
} catch (ParseException e) {
Logger.error(LOG_TAG, "JSON parse error.", e);
jClient.abort(Constants.JPAKE_ERROR_INVALID);
return;
} catch (NonObjectJSONException e) {
} catch (ParseException | NonObjectJSONException e) {
Logger.error(LOG_TAG, "JSON parse error.", e);
jClient.abort(Constants.JPAKE_ERROR_INVALID);
return;

View File

@ -162,10 +162,7 @@ public class Crypto5MiddlewareRepositorySession extends MiddlewareRepositorySess
rec.keyBundle = this.keyBundle;
try {
rec.encrypt();
} catch (UnsupportedEncodingException e) {
delegate.onRecordStoreFailed(e, record.guid);
return;
} catch (CryptoException e) {
} catch (UnsupportedEncodingException | CryptoException e) {
delegate.onRecordStoreFailed(e, record.guid);
return;
}

View File

@ -65,7 +65,7 @@ public class BaseResource implements Resource {
private boolean retryOnFailedRequest = true;
public static boolean rewriteLocalhost = true;
public static final boolean rewriteLocalhost = true;
private static final String LOG_TAG = "BaseResource";
@ -74,7 +74,7 @@ public class BaseResource implements Resource {
protected DefaultHttpClient client;
public ResourceDelegate delegate;
protected HttpRequestBase request;
public String charset = "utf-8";
public final String charset = "utf-8";
protected static WeakReference<HttpResponseObserver> httpResponseObserver = null;
@ -298,10 +298,6 @@ public class BaseResource implements Resource {
Logger.error(LOG_TAG, "Couldn't prepare client.", e);
delegate.handleTransportException(e);
return;
} catch (NoSuchAlgorithmException e) {
Logger.error(LOG_TAG, "Couldn't prepare client.", e);
delegate.handleTransportException(e);
return;
} catch (GeneralSecurityException e) {
Logger.error(LOG_TAG, "Couldn't prepare client.", e);
delegate.handleTransportException(e);

View File

@ -71,13 +71,9 @@ public class HMACAuthHeaderProvider implements AuthHeaderProvider {
try {
return getAuthHeader(request, context, client, timestamp, nonce, extra);
} catch (InvalidKeyException e) {
} catch (InvalidKeyException | NoSuchAlgorithmException | UnsupportedEncodingException e) {
// We lie a little and make every exception a GeneralSecurityException.
throw new GeneralSecurityException(e);
} catch (UnsupportedEncodingException e) {
throw new GeneralSecurityException(e);
} catch (NoSuchAlgorithmException e) {
throw new GeneralSecurityException(e);
}
}

View File

@ -112,7 +112,7 @@ public class AndroidBrowserBookmarksRepositorySession extends AndroidBrowserRepo
/**
* An array of known-special GUIDs.
*/
public static String[] SPECIAL_GUIDS = new String[] {
public static final String[] SPECIAL_GUIDS = new String[] {
// Mobile and desktop places roots have to come first.
"places",
"mobile",
@ -569,9 +569,6 @@ public class AndroidBrowserBookmarksRepositorySession extends AndroidBrowserRepo
Logger.error(LOG_TAG, "Got sqlite constraint exception working with Fennec bookmark DB.", e);
delegate.onBeginFailed(e);
return;
} catch (NullCursorException e) {
delegate.onBeginFailed(e);
return;
} catch (Exception e) {
delegate.onBeginFailed(e);
return;

View File

@ -34,7 +34,7 @@ public class AndroidBrowserHistoryRepositorySession extends AndroidBrowserReposi
/**
* The number of records to queue for insertion before writing to databases.
*/
public static int INSERT_RECORD_THRESHOLD = 50;
public static final int INSERT_RECORD_THRESHOLD = 50;
public AndroidBrowserHistoryRepositorySession(Repository repository, Context context) {
super(repository);
@ -154,7 +154,7 @@ public class AndroidBrowserHistoryRepositorySession extends AndroidBrowserReposi
super.finish(delegate);
}
protected Object recordsBufferMonitor = new Object();
protected final Object recordsBufferMonitor = new Object();
protected ArrayList<HistoryRecord> recordsBuffer = new ArrayList<HistoryRecord>();
/**
@ -223,10 +223,7 @@ public class AndroidBrowserHistoryRepositorySession extends AndroidBrowserReposi
try {
// Does not use androidID -- just GUID -> String map.
updateBookkeeping(succeeded);
} catch (NoGuidForIdException e) {
// Should not happen.
throw new NullCursorException(e);
} catch (ParentNotFoundException e) {
} catch (NoGuidForIdException | ParentNotFoundException e) {
// Should not happen.
throw new NullCursorException(e);
} catch (NullCursorException e) {

View File

@ -42,9 +42,6 @@ public abstract class AndroidBrowserRepository extends Repository {
public void run() {
try {
getDataAccessor(context).purgeDeleted();
} catch (NullCursorException e) {
delegate.onCleanFailed(AndroidBrowserRepository.this, e);
return;
} catch (Exception e) {
delegate.onCleanFailed(AndroidBrowserRepository.this, e);
return;

View File

@ -155,9 +155,6 @@ public abstract class AndroidBrowserRepositorySession extends StoreTrackingRepos
Logger.error(LOG_TAG, "ProfileDatabaseException from begin. Fennec must be launched once until this error is fixed");
deferredDelegate.onBeginFailed(e);
return;
} catch (NullCursorException e) {
deferredDelegate.onBeginFailed(e);
return;
} catch (Exception e) {
deferredDelegate.onBeginFailed(e);
return;
@ -219,9 +216,6 @@ public abstract class AndroidBrowserRepositorySession extends StoreTrackingRepos
Cursor cur;
try {
cur = dbHelper.getGUIDsSince(timestamp);
} catch (NullCursorException e) {
delegate.onGuidsSinceFailed(e);
return;
} catch (Exception e) {
delegate.onGuidsSinceFailed(e);
return;
@ -257,7 +251,7 @@ public abstract class AndroidBrowserRepositorySession extends StoreTrackingRepos
}
abstract class FetchingRunnable implements Runnable {
protected RepositorySessionFetchRecordsDelegate delegate;
protected final RepositorySessionFetchRecordsDelegate delegate;
public FetchingRunnable(RepositorySessionFetchRecordsDelegate delegate) {
this.delegate = delegate;
@ -538,10 +532,6 @@ public abstract class AndroidBrowserRepositorySession extends StoreTrackingRepos
Logger.error(LOG_TAG, "Store failed for " + record.guid, e);
delegate.onRecordStoreFailed(e, record.guid);
return;
} catch (NullCursorException e) {
Logger.error(LOG_TAG, "Store failed for " + record.guid, e);
delegate.onRecordStoreFailed(e, record.guid);
return;
} catch (Exception e) {
Logger.error(LOG_TAG, "Store failed for " + record.guid, e);
delegate.onRecordStoreFailed(e, record.guid);

View File

@ -37,7 +37,7 @@ import android.os.RemoteException;
public class FormHistoryRepositorySession extends
StoreTrackingRepositorySession {
public static String LOG_TAG = "FormHistoryRepoSess";
public static final String LOG_TAG = "FormHistoryRepoSess";
/**
* Number of records to insert in one batch.
@ -119,7 +119,7 @@ public class FormHistoryRepositorySession extends
super.finish(delegate);
}
protected static String[] GUID_COLUMNS = new String[] { FormHistory.GUID };
protected static final String[] GUID_COLUMNS = new String[] { FormHistory.GUID };
@Override
public void guidsSince(final long timestamp, final RepositorySessionGuidsSinceDelegate delegate) {
@ -142,10 +142,7 @@ public class FormHistoryRepositorySession extends
guids.add(cur.getString(0));
cur.moveToNext();
}
} catch (RemoteException e) {
delegate.onGuidsSinceFailed(e);
return;
} catch (NullCursorException e) {
} catch (RemoteException | NullCursorException e) {
delegate.onGuidsSinceFailed(e);
return;
} finally {
@ -161,10 +158,7 @@ public class FormHistoryRepositorySession extends
guids.add(cur.getString(0));
cur.moveToNext();
}
} catch (RemoteException e) {
delegate.onGuidsSinceFailed(e);
return;
} catch (NullCursorException e) {
} catch (RemoteException | NullCursorException e) {
delegate.onGuidsSinceFailed(e);
return;
} finally {
@ -443,7 +437,7 @@ public class FormHistoryRepositorySession extends
return cv;
}
protected Object recordsBufferMonitor = new Object();
protected final Object recordsBufferMonitor = new Object();
protected ArrayList<ContentValues> recordsBuffer = new ArrayList<ContentValues>();
protected void enqueueRegularRecord(Record record) {

Some files were not shown because too many files have changed in this diff Show More