зеркало из https://github.com/mozilla/gecko-dev.git
Bug 890409 - Re-enable browser_aboutHome.js but ignoring uncaught exceptions.
r=ttaubert
This commit is contained in:
Родитель
225c6feacc
Коммит
9ae07d3c2f
|
@ -51,7 +51,6 @@ endif
|
|||
# The following tests are disabled because they are unreliable:
|
||||
# browser_bug423833.js is bug 428712
|
||||
# browser_sanitize-download-history.js is bug 432425
|
||||
# browser_aboutHome.js is bug 890409
|
||||
#
|
||||
# browser_sanitizeDialog_treeView.js is disabled until the tree view is added
|
||||
# back to the clear recent history dialog (sanitize.xul), if it ever is (bug
|
||||
|
@ -72,6 +71,7 @@ MOCHITEST_BROWSER_FILES = \
|
|||
blockPluginVulnerableNoUpdate.xml \
|
||||
blockPluginVulnerableUpdatable.xml \
|
||||
browser_aboutHealthReport.js \
|
||||
browser_aboutHome.js \
|
||||
browser_aboutSyncProgress.js \
|
||||
browser_addKeywordSearch.js \
|
||||
browser_addon_bar_aomlistener.js \
|
||||
|
|
|
@ -104,23 +104,23 @@ let gTests = [
|
|||
let numSearchesBefore = 0;
|
||||
let deferred = Promise.defer();
|
||||
let doc = gBrowser.contentDocument;
|
||||
let engineName = doc.documentElement.getAttribute("searchEngineName");
|
||||
|
||||
// We rely on the listener in browser.js being installed and fired before
|
||||
// this one. If this ever changes, we should add an executeSoon() or similar.
|
||||
doc.addEventListener("AboutHomeSearchEvent", function onSearch(e) {
|
||||
let engineName = doc.documentElement.getAttribute("searchEngineName");
|
||||
is(e.detail, engineName, "Detail is search engine name");
|
||||
|
||||
gBrowser.stop();
|
||||
|
||||
getNumberOfSearches().then(num => {
|
||||
getNumberOfSearches(engineName).then(num => {
|
||||
is(num, numSearchesBefore + 1, "One more search recorded.");
|
||||
deferred.resolve();
|
||||
});
|
||||
}, true, true);
|
||||
|
||||
// Get the current number of recorded searches.
|
||||
getNumberOfSearches().then(num => {
|
||||
getNumberOfSearches(engineName).then(num => {
|
||||
numSearchesBefore = num;
|
||||
|
||||
info("Perform a search.");
|
||||
|
@ -263,6 +263,7 @@ function test()
|
|||
{
|
||||
waitForExplicitFinish();
|
||||
requestLongerTimeout(2);
|
||||
ignoreAllUncaughtExceptions();
|
||||
|
||||
Task.spawn(function () {
|
||||
for (let test of gTests) {
|
||||
|
@ -394,9 +395,12 @@ function promiseBrowserAttributes(aTab)
|
|||
/**
|
||||
* Retrieves the number of about:home searches recorded for the current day.
|
||||
*
|
||||
* @param aEngineName
|
||||
* name of the setup search engine.
|
||||
*
|
||||
* @return {Promise} Returns a promise resolving to the number of searches.
|
||||
*/
|
||||
function getNumberOfSearches() {
|
||||
function getNumberOfSearches(aEngineName) {
|
||||
let reporter = Components.classes["@mozilla.org/datareporting/service;1"]
|
||||
.getService()
|
||||
.wrappedJSObject
|
||||
|
@ -419,17 +423,15 @@ function getNumberOfSearches() {
|
|||
// different days. Tests are always run with an empty profile so there
|
||||
// are no searches from yesterday, normally. Should the test happen to run
|
||||
// past midnight we make sure to count them in as well.
|
||||
return getNumberOfSearchesByDate(data, now) +
|
||||
getNumberOfSearchesByDate(data, yday);
|
||||
return getNumberOfSearchesByDate(aEngineName, data, now) +
|
||||
getNumberOfSearchesByDate(aEngineName, data, yday);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getNumberOfSearchesByDate(aData, aDate) {
|
||||
function getNumberOfSearchesByDate(aEngineName, aData, aDate) {
|
||||
if (aData.days.hasDay(aDate)) {
|
||||
let doc = gBrowser.contentDocument;
|
||||
let engineName = doc.documentElement.getAttribute("searchEngineName");
|
||||
let id = Services.search.getEngineByName(engineName).identifier;
|
||||
let id = Services.search.getEngineByName(aEngineName).identifier;
|
||||
|
||||
let day = aData.days.getDay(aDate);
|
||||
let field = id + ".abouthome";
|
||||
|
|
Загрузка…
Ссылка в новой задаче