Bug 823230 - (Part 1) Pass search term along with "keyword-search" notification. r=gavin

This commit is contained in:
Margaret Leibovic 2013-04-10 11:02:04 -07:00
parent 8bc89d2f03
commit a6380edcac
3 changed files with 5 additions and 5 deletions

View File

@ -301,7 +301,8 @@ BrowserGlue.prototype = {
reporter.onInit().then(function record() {
try {
reporter.getProvider("org.mozilla.searches").recordSearch(data,
let name = subject.QueryInterface(Ci.nsISearchEngine).name;
reporter.getProvider("org.mozilla.searches").recordSearch(name,
"urlbar");
} catch (ex) {
Cu.reportError(ex);

View File

@ -363,9 +363,7 @@ NS_IMETHODIMP nsDefaultURIFixup::KeywordToURI(const nsACString& aKeyword,
// the search engine's name through various function calls.
nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService();
if (obsSvc) {
nsAutoString name;
defaultEngine->GetName(name);
obsSvc->NotifyObservers(nullptr, "keyword-search", name.get());
obsSvc->NotifyObservers(defaultEngine, "keyword-search", NS_ConvertUTF8toUTF16(keyword).get());
}
return submission->GetUri(aURI);

View File

@ -13,7 +13,8 @@ function test() {
let engine = Services.search.defaultEngine;
ok(engine, "Have default search engine.");
is(engine.name, data, "Notification data is engine name.");
is(engine, subject, "Notification subject is engine.");
is("firefox health report", data, "Notification data is search term.");
executeSoon(function cleanup() {
gBrowser.removeTab(tab);