Backed out changeset 948ac73a8cc0 (bug 785487) for test failures on a CLOSED TREE

--HG--
extra : amend_source : 1d2c229ab3be4737af7b57159f2781f17157a8fb
This commit is contained in:
Carsten "Tomcat" Book 2014-04-29 15:51:09 +02:00
parent 23faf3cac5
commit b65adffe20
5 changed files with 19 additions and 53 deletions

View File

@ -1,6 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
addMessageListener("AboutHome:SearchTriggered", function (msg) {
sendAsyncMessage("AboutHomeTest:CheckRecordedSearch", msg.data);
});

View File

@ -6,7 +6,6 @@ support-files =
app_bug575561.html
app_subframe_bug575561.html
authenticate.sjs
aboutHome_content_script.js
browser_bug479408_sample.html
browser_bug678392-1.html
browser_bug678392-2.html

View File

@ -9,7 +9,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "Task",
XPCOMUtils.defineLazyModuleGetter(this, "AboutHomeUtils",
"resource:///modules/AboutHome.jsm");
const TEST_CONTENT_HELPER = "chrome://mochitests/content/browser/browser/base/content/test/general/aboutHome_content_script.js";
let gRightsVersion = Services.prefs.getIntPref("browser.rights.version");
registerCleanupFunction(function() {
@ -111,19 +110,21 @@ let gTests = [
let searchEventDeferred = Promise.defer();
let doc = gBrowser.contentDocument;
let engineName = doc.documentElement.getAttribute("searchEngineName");
let mm = gBrowser.selectedTab.linkedBrowser.messageManager;
mm.loadFrameScript(TEST_CONTENT_HELPER, false);
mm.addMessageListener("AboutHomeTest:CheckRecordedSearch", function (msg) {
let data = JSON.parse(msg.data);
doc.addEventListener("AboutHomeSearchEvent", function onSearch(e) {
let data = JSON.parse(e.detail);
is(data.engineName, engineName, "Detail is search engine name");
getNumberOfSearches(engineName).then(num => {
is(num, numSearchesBefore + 1, "One more search recorded.");
searchEventDeferred.resolve();
// We use executeSoon() to ensure that this code runs after the
// count has been updated in browser.js, since it uses the same
// event.
executeSoon(function () {
getNumberOfSearches(engineName).then(num => {
is(num, numSearchesBefore + 1, "One more search recorded.");
searchEventDeferred.resolve();
});
});
});
}, true, true);
// Get the current number of recorded searches.
let searchStr = "a search";

View File

@ -17,8 +17,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "fxAccounts",
"resource://gre/modules/FxAccounts.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/Promise.jsm");
// Url to fetch snippets, in the urlFormatter service format.
const SNIPPETS_URL_PREF = "browser.aboutHomeSnippets.updateUrl";
@ -183,25 +181,13 @@ let AboutHome = {
Cu.reportError(ex);
break;
}
Services.search.init(function(status) {
if (!Components.isSuccessCode(status)) {
return;
}
let engine = Services.search.currentEngine;
let engine = Services.search.currentEngine;
#ifdef MOZ_SERVICES_HEALTHREPORT
window.BrowserSearch.recordSearchInHealthReport(engine, "abouthome");
window.BrowserSearch.recordSearchInHealthReport(engine, "abouthome");
#endif
// Trigger a search through nsISearchEngine.getSubmission()
let submission = engine.getSubmission(data.searchTerms, null, "homepage");
window.loadURI(submission.uri.spec, null, submission.postData);
// Used for testing
let mm = aMessage.target.messageManager;
mm.sendAsyncMessage("AboutHome:SearchTriggered", aMessage.data.searchData);
});
// Trigger a search through nsISearchEngine.getSubmission()
let submission = engine.getSubmission(data.searchTerms, null, "homepage");
window.loadURI(submission.uri.spec, null, submission.postData);
break;
}
},
@ -213,26 +199,13 @@ let AboutHome = {
Components.utils.import("resource:///modules/sessionstore/SessionStore.jsm",
wrapper);
let ss = wrapper.SessionStore;
ss.promiseInitialized.then(function() {
let deferred = Promise.defer();
Services.search.init(function (status){
if (!Components.isSuccessCode(status)) {
deferred.reject(status);
} else {
deferred.resolve(Services.search.defaultEngine.name);
}
});
return deferred.promise;
}).then(function(engineName) {
let data = {
showRestoreLastSession: ss.canRestoreLastSession,
snippetsURL: AboutHomeUtils.snippetsURL,
showKnowYourRights: AboutHomeUtils.showKnowYourRights,
snippetsVersion: AboutHomeUtils.snippetsVersion,
defaultEngineName: engineName
defaultEngineName: Services.search.defaultEngine.name
};
if (AboutHomeUtils.showKnowYourRights) {

View File

@ -21,8 +21,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
"resource://gre/modules/TelemetryStopwatch.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Deprecated",
"resource://gre/modules/Deprecated.jsm");
// A text encoder to UTF8, used whenever we commit the
// engine metadata to disk.
@ -2846,7 +2844,8 @@ SearchService.prototype = {
"Search service falling back to synchronous initialization. " +
"This is generally the consequence of an add-on using a deprecated " +
"search service API.";
Deprecated.warning(warning, "https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIBrowserSearchService#async_warning");
// Bug 785487 - Disable warning until our own callers are fixed.
//Deprecated.warning(warning, "https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIBrowserSearchService#async_warning");
LOG(warning);
engineMetadataService.syncInit();