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.

     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