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

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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