michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: const Ci = Components.interfaces; michael@0: michael@0: /* michael@0: * Test that invalid engine files with xml extensions will not break michael@0: * initialization. See Bug 940446. michael@0: */ michael@0: function run_test() { michael@0: do_test_pending(); michael@0: michael@0: removeMetadata(); michael@0: removeCacheFile(); michael@0: michael@0: do_check_false(Services.search.isInitialized); michael@0: michael@0: let engineFile = gProfD.clone(); michael@0: engineFile.append("searchplugins"); michael@0: engineFile.append("test-search-engine.xml"); michael@0: engineFile.parent.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY); michael@0: michael@0: // Copy the invalid engine to the test profile. michael@0: let engineTemplateFile = do_get_file("data/invalid-engine.xml"); michael@0: engineTemplateFile.copyTo(engineFile.parent, "test-search-engine.xml"); michael@0: michael@0: Services.search.init(function search_initialized(aStatus) { michael@0: // The invalid engine should have been skipped and should not michael@0: // have caused an exception. michael@0: do_check_true(Components.isSuccessCode(aStatus)); michael@0: do_check_true(Services.search.isInitialized); michael@0: michael@0: removeMetadata(); michael@0: removeCacheFile(); michael@0: do_test_finished(); michael@0: }); michael@0: }