Backout bug 723001.

This commit is contained in:
Josh Matthews 2012-10-11 22:22:43 -04:00
parent 9faab0110c
commit f4cce5808f
6 changed files with 18 additions and 108 deletions

View File

@ -436,7 +436,7 @@
}
// Save the current value in the form history
if (textValue && !gPrivateBrowsingUI.privateWindow) {
if (textValue) {
try {
textBox._formHistSvc.addEntry(textBox.getAttribute("autocompletesearchparam"),
textValue);

View File

@ -22,7 +22,6 @@ MOCHITEST_BROWSER_FILES = browser_405664.js \
483086-1.xml \
483086-2.xml \
test.html \
browser_private_search.js \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -59,7 +59,6 @@ function test() {
is(searchItem.label, 'Search ' + ENGINE_NAME + ' for "test search"', "Check context menu label");
is(searchItem.disabled, false, "Check that search context menu item is enabled");
searchItem.click();
contextMenu.hidePopup();
}
function checkSearchURL(event){

View File

@ -1,101 +0,0 @@
// This test performs a search in a public window, then a different
// search in a private window, and then checks in the public window
// whether there is an autocomplete entry for the private search.
function onLoad(callback) {
gBrowser.addEventListener("DOMContentLoaded", function load() {
gBrowser.removeEventListener("DOMContentLoaded", load, false);
callback();
}, false);
}
function doPrivateTest(searchBar) {
gPrivateBrowsingUI.toggleMode();
Services.prefs.clearUserPref("browser.privatebrowsing.keep_current_session");
searchBar.value = "p";
searchBar.focus();
let popup = searchBar.textbox.popup;
//searchBar.textbox.closePopup();
info("adding listener");
popup.addEventListener("popupshowing", function showing() {
let entries = getMenuEntries(searchBar);
for (var i = 0; i < entries.length; i++)
isnot(entries[0], "private test", "shouldn't see private autocomplete entries");
popup.removeEventListener("popupshowing", showing, false);
searchBar.textbox.toggleHistoryPopup();
executeSoon(function() {
searchBar.value = "";
gBrowser.addTab();
gBrowser.removeCurrentTab();
content.location.href = "about:blank";
var engine = Services.search.getEngineByName("Bug 426329");
Services.search.removeEngine(engine);
finish();
});
}, false);
info("triggering popup");
searchBar.textbox.showHistoryPopup();
}
function doTest() {
let searchBar = BrowserSearch.searchBar;
ok(searchBar, "got search bar");
onLoad(function() {
Services.prefs.setBoolPref("browser.privatebrowsing.keep_current_session", true);
gPrivateBrowsingUI.toggleMode();
onLoad(function() {
doPrivateTest(searchBar);
});
searchBar.value = "private test";
searchBar.focus();
EventUtils.synthesizeKey("VK_RETURN", {});
});
searchBar.value = "public test";
searchBar.focus();
EventUtils.synthesizeKey("VK_RETURN", {});
}
function test() {
waitForExplicitFinish();
//gBrowser.addTab();
//let testBrowser = gBrowser.selectedBrowser;
function observer(aSub, aTopic, aData) {
switch (aData) {
case "engine-current":
ok(ss.currentEngine.name == "Bug 426329", "currentEngine set");
doTest();
break;
default:
break;
}
}
var ss = Services.search;
Services.obs.addObserver(observer, "browser-search-engine-modified", false);
ss.addEngine("http://mochi.test:8888/browser/browser/components/search/test/426329.xml",
Ci.nsISearchEngine.DATA_XML, "data:image/x-icon,%00",
false);
}
function getMenuEntries(searchBar) {
var entries = [];
var autocompleteMenu = searchBar.textbox.popup;
// Could perhaps pull values directly from the controller, but it seems
// more reliable to test the values that are actually in the tree?
var column = autocompleteMenu.tree.columns[0];
var numRows = autocompleteMenu.tree.view.rowCount;
for (var i = 0; i < numRows; i++) {
entries.push(autocompleteMenu.tree.view.getValueAt(i, column));
}
return entries;
}

View File

@ -9,7 +9,6 @@ var Ci = Components.interfaces;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
var satchelFormListener = {
QueryInterface : XPCOMUtils.generateQI([Ci.nsIFormSubmitObserver,
@ -104,8 +103,6 @@ var satchelFormListener = {
if (!this.enabled)
return;
if (PrivateBrowsingUtils.isWindowPrivate(domWin))
return;
this.log("Form submit observer notified.");

View File

@ -73,6 +73,21 @@ FormHistory.prototype = {
return this._uuidService;
},
// Private Browsing Service
// If the service is not available, null will be returned.
_privBrowsingSvc : undefined,
get privBrowsingSvc() {
if (this._privBrowsingSvc == undefined) {
if ("@mozilla.org/privatebrowsing;1" in Cc)
this._privBrowsingSvc = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
else
this._privBrowsingSvc = null;
}
return this._privBrowsingSvc;
},
log : function log(message) {
if (!this.debug)
return;
@ -128,7 +143,8 @@ FormHistory.prototype = {
addEntry : function addEntry(name, value) {
if (!this.enabled)
if (!this.enabled ||
this.privBrowsingSvc && this.privBrowsingSvc.privateBrowsingEnabled)
return;
this.log("addEntry for " + name + "=" + value);