Sat, 03 Jan 2015 20:18:00 +0100
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.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | function run_test() |
michael@0 | 6 | { |
michael@0 | 7 | // We're testing migration to this version from one version below |
michael@0 | 8 | var targetVersion = 7; |
michael@0 | 9 | |
michael@0 | 10 | // First import the downloads.sqlite file |
michael@0 | 11 | importDatabaseFile("v" + (targetVersion - 1) + ".sqlite"); |
michael@0 | 12 | |
michael@0 | 13 | // Init the download manager which will try migrating to the new version |
michael@0 | 14 | var dm = Cc["@mozilla.org/download-manager;1"]. |
michael@0 | 15 | getService(Ci.nsIDownloadManager); |
michael@0 | 16 | var dbConn = dm.DBConnection; |
michael@0 | 17 | |
michael@0 | 18 | // Check schema version |
michael@0 | 19 | do_check_true(dbConn.schemaVersion >= targetVersion); |
michael@0 | 20 | |
michael@0 | 21 | // Make sure all the columns are there |
michael@0 | 22 | var stmt = dbConn.createStatement( |
michael@0 | 23 | "SELECT name, source, target, tempPath, startTime, endTime, state, " + |
michael@0 | 24 | "referrer, entityID, currBytes, maxBytes, mimeType, " + |
michael@0 | 25 | "preferredApplication, preferredAction " + |
michael@0 | 26 | "FROM moz_downloads " + |
michael@0 | 27 | "WHERE id = 28"); |
michael@0 | 28 | stmt.executeStep(); |
michael@0 | 29 | |
michael@0 | 30 | // This data is based on the original values in the table |
michael@0 | 31 | var data = [ |
michael@0 | 32 | "firefox-3.0a9pre.en-US.linux-i686.tar.bz2", |
michael@0 | 33 | "http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/firefox-3.0a9pre.en-US.linux-i686.tar.bz2", |
michael@0 | 34 | "file:///Users/Ed/Desktop/firefox-3.0a9pre.en-US.linux-i686.tar.bz2", |
michael@0 | 35 | "/Users/Ed/Desktop/+EZWafFQ.bz2.part", |
michael@0 | 36 | 1192469856209164, |
michael@0 | 37 | 1192469877017396, |
michael@0 | 38 | Ci.nsIDownloadManager.DOWNLOAD_FINISHED, |
michael@0 | 39 | "http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/", |
michael@0 | 40 | "%2210e66c1-8a2d6b-9b33f380%22/9055595/Mon, 15 Oct 2007 11:45:34 GMT", |
michael@0 | 41 | 1210772, |
michael@0 | 42 | 9055595, |
michael@0 | 43 | // For the new columns added, check for null or default values |
michael@0 | 44 | true, |
michael@0 | 45 | true, |
michael@0 | 46 | 0, |
michael@0 | 47 | ]; |
michael@0 | 48 | |
michael@0 | 49 | // Make sure the values are correct after the migration |
michael@0 | 50 | var i = 0; |
michael@0 | 51 | do_check_eq(data[i], stmt.getString(i++)); |
michael@0 | 52 | do_check_eq(data[i], stmt.getUTF8String(i++)); |
michael@0 | 53 | do_check_eq(data[i], stmt.getUTF8String(i++)); |
michael@0 | 54 | do_check_eq(data[i], stmt.getString(i++)); |
michael@0 | 55 | do_check_eq(data[i], stmt.getInt64(i++)); |
michael@0 | 56 | do_check_eq(data[i], stmt.getInt64(i++)); |
michael@0 | 57 | do_check_eq(data[i], stmt.getInt32(i++)); |
michael@0 | 58 | do_check_eq(data[i], stmt.getUTF8String(i++)); |
michael@0 | 59 | do_check_eq(data[i], stmt.getUTF8String(i++)); |
michael@0 | 60 | do_check_eq(data[i], stmt.getInt64(i++)); |
michael@0 | 61 | do_check_eq(data[i], stmt.getInt64(i++)); |
michael@0 | 62 | do_check_eq(data[i], stmt.getIsNull(i++)); |
michael@0 | 63 | do_check_eq(data[i], stmt.getIsNull(i++)); |
michael@0 | 64 | do_check_eq(data[i], stmt.getInt32(i++)); |
michael@0 | 65 | |
michael@0 | 66 | stmt.reset(); |
michael@0 | 67 | stmt.finalize(); |
michael@0 | 68 | |
michael@0 | 69 | cleanup(); |
michael@0 | 70 | } |