From 0c07aa9fc70fe0af0f2f212ddaae1d6fcfc79a05 Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Thu, 3 May 2012 15:23:32 -0400 Subject: [PATCH] Bug 670514 - LNK file test for Windows share security. r=bz --- netwerk/test/unit/data/system_root.lnk | Bin 0 -> 1677 bytes netwerk/test/unit/test_file_protocol.js | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 netwerk/test/unit/data/system_root.lnk diff --git a/netwerk/test/unit/data/system_root.lnk b/netwerk/test/unit/data/system_root.lnk new file mode 100644 index 0000000000000000000000000000000000000000..e5885ce9a5c6b06e7a670f8fcf36524a66b7d714 GIT binary patch literal 1677 zcmd^9T}YEr7=E@kSQ#~OMT({UOsrUabERuksACh#@vUv3f)_%YweTk#;f+vTcwq|( zR#6u&5vz;3C?bL^*_{v=qYEiPDXE*HWL98c(er+@h2GTt-ota=-*e9Uo$Wl00CW~T zXCS4`@W%Bfm}&P-JosrhywFX3A5F|uOy)GsW(##$m76cZf-?VGHC_JE6*Z5%Hes)# z3>9O)+tr#Y`fCJW*PLYSP|S>`XjizqH-^J7!GQVkFRuO)$?RcGzt-RCYNQl%D#l#xo-uU!;`Mi2n4Y})lez3hir*qLhj@JL0S2keb-aK~L z8f*!MJiY*TxAK&{6f1&gAwuxLhX7QL5c2jq^720*A1%+!$TzWz`aB^|vVgwfTl}kg z>q33Pcxtwwa%rdJZt?M~W$p@Xd(aHNh6Q4$m;Ij8k=Qw*-DR2Wdvrau k7(af&c(ZiQcl7CpAIBC36YmN~9u6iaX6%#y%F8yt0ZE3r-~a#s literal 0 HcmV?d00001 diff --git a/netwerk/test/unit/test_file_protocol.js b/netwerk/test/unit/test_file_protocol.js index f454e8784f6..bd3475e39f1 100644 --- a/netwerk/test/unit/test_file_protocol.js +++ b/netwerk/test/unit/test_file_protocol.js @@ -12,6 +12,7 @@ const special_type = "application/x-our-special-type"; test_read_dir_1, test_read_dir_2, test_upload_file, + test_load_replace, do_test_finished ].forEach(add_test); @@ -222,6 +223,28 @@ function test_upload_file() { chan.asyncOpen(new FileStreamListener(on_upload_complete), null); } +function test_load_replace() { + // lnk files should resolve to their targets + const isWindows = ("@mozilla.org/windows-registry-key;1" in Cc); + if (isWindows) { + dump("*** test_load_replace\n"); + file = do_get_file("data/system_root.lnk", false); + var chan = new_file_channel(file); + + // The LOAD_REPLACE flag should be set + do_check_eq(chan.loadFlags & chan.LOAD_REPLACE, chan.LOAD_REPLACE); + + // The original URI path should differ from the URI path + do_check_neq(chan.URI.path, chan.originalURI.path); + + // The original URI path should be the same as the lnk file path + var ios = Cc["@mozilla.org/network/io-service;1"]. + getService(Ci.nsIIOService); + do_check_eq(chan.originalURI.path, ios.newFileURI(file).path); + } + run_next_test(); +} + function run_test() { run_next_test(); }