mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 577685 - Do not allow adding search engines during private browsing mode; r=gavin.sharp ui-r=beltzner approval2.0=beltzner
This commit is contained in:
parent
c91d03b575
commit
0ad0994cc4
@ -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;
|
||||
|
@ -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");
|
||||
|
||||
// enter private browsing mode
|
||||
pb.privateBrowsingEnabled = true;
|
||||
|
||||
const TEST_URL =
|
||||
"data:text/html,<head><link rel=search type='application/opensearchdescription+xml' href='http://foo.bar' title=dummy></head>";
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user