diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 53a1438c156..10401ae66ea 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -3091,7 +3091,8 @@ const DOMLinkHandler = { type = type.replace(/^\s+|\s*(?:;.*)?$/g, ""); if (type == "application/opensearchdescription+xml" && link.title && - /^(?:https?|ftp):/i.test(link.href)) { + /^(?:https?|ftp):/i.test(link.href) && + !gPrivateBrowsingUI.privateBrowsingEnabled) { var engine = { title: link.title, href: link.href }; BrowserSearch.addEngine(engine, link.ownerDocument); searchAdded = true; diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_searchbar.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_searchbar.js index 8519d833149..2abd944906b 100644 --- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_searchbar.js +++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_searchbar.js @@ -40,6 +40,7 @@ function test() { // initialization + waitForExplicitFinish(); gPrefService.setBoolPref("browser.privatebrowsing.keep_current_session", true); let pb = Cc["@mozilla.org/privatebrowsing;1"]. getService(Ci.nsIPrivateBrowsingService); @@ -68,6 +69,24 @@ function test() { is(searchBar.textbox.editor.transactionManager.numberOfUndoItems, 1, "leaving the private browsing mode should only leave 1 item in the undo list of the searchbar control"); - // cleanup - gPrefService.clearUserPref("browser.privatebrowsing.keep_current_session"); + // enter private browsing mode + pb.privateBrowsingEnabled = true; + + const TEST_URL = + "data:text/html,
"; + gBrowser.selectedTab = gBrowser.addTab(TEST_URL); + gBrowser.selectedBrowser.addEventListener("load", function(e) { + e.currentTarget.removeEventListener("load", arguments.callee, true); + + var browser = gBrowser.selectedBrowser; + is(typeof browser.engines, "undefined", + "An engine should not be discovered in private browsing mode"); + + gBrowser.removeTab(gBrowser.selectedTab); + pb.privateBrowsingEnabled = false; + + // cleanup + gPrefService.clearUserPref("browser.privatebrowsing.keep_current_session"); + finish(); + }, true); }