toolkit/components/search/tests/xpcshell/test_invalid_engine_from_dir.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 const Ci = Components.interfaces;
michael@0 5
michael@0 6 /*
michael@0 7 * Test that invalid engine files with xml extensions will not break
michael@0 8 * initialization. See Bug 940446.
michael@0 9 */
michael@0 10 function run_test() {
michael@0 11 do_test_pending();
michael@0 12
michael@0 13 removeMetadata();
michael@0 14 removeCacheFile();
michael@0 15
michael@0 16 do_check_false(Services.search.isInitialized);
michael@0 17
michael@0 18 let engineFile = gProfD.clone();
michael@0 19 engineFile.append("searchplugins");
michael@0 20 engineFile.append("test-search-engine.xml");
michael@0 21 engineFile.parent.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
michael@0 22
michael@0 23 // Copy the invalid engine to the test profile.
michael@0 24 let engineTemplateFile = do_get_file("data/invalid-engine.xml");
michael@0 25 engineTemplateFile.copyTo(engineFile.parent, "test-search-engine.xml");
michael@0 26
michael@0 27 Services.search.init(function search_initialized(aStatus) {
michael@0 28 // The invalid engine should have been skipped and should not
michael@0 29 // have caused an exception.
michael@0 30 do_check_true(Components.isSuccessCode(aStatus));
michael@0 31 do_check_true(Services.search.isInitialized);
michael@0 32
michael@0 33 removeMetadata();
michael@0 34 removeCacheFile();
michael@0 35 do_test_finished();
michael@0 36 });
michael@0 37 }

mercurial