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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 const Ci = Components.interfaces;
     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();
    13   removeMetadata();
    14   removeCacheFile();
    16   do_check_false(Services.search.isInitialized);
    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);
    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");
    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);
    33     removeMetadata();
    34     removeCacheFile();
    35     do_test_finished();
    36   });
    37 }

mercurial