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

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

mercurial