Bug 670514 - LNK file test for Windows share security. r=bz
authorBrian R. Bondy <netzen@gmail.com>
Thu, 03 May 2012 15:23:32 -0400
changeset 92903 c045085c0436cf1ef4c4a4447c54b24e7894501e
parent 92902 60613f18435b3f3da1a997b6c228bf339004bbaa
child 92904 2db9df42823df471edd755e996267e7163bf09d5
push id22602
push userbbondy@mozilla.com
push dateThu, 03 May 2012 19:24:29 +0000
treeherdermozilla-central@c045085c0436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs670514
milestone15.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 670514 - LNK file test for Windows share security. r=bz
netwerk/test/unit/data/system_root.lnk
netwerk/test/unit/test_file_protocol.js
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..e5885ce9a5c6b06e7a670f8fcf36524a66b7d714
GIT binary patch
literal 1677
zc%1WLU|?VrVPXJ*17MQDt(%F1K>*08IlkeqA<HSoYhRa4zN>Z?PBRoh6f!cPf<^`r
z2Kj&o{udNpS!D_=y1~JqZD250l0o0uDuw|Q1Th$b>3I%wiv<|MGxJjN%ZnLo7&sVM
z7~b!DXVoeNlF<UHXl24?T{uG~Lmop4Lq0<}Lotvq2E>j)ECW>wqD`S{9e`L8h?#+S
z^}btAK;Com_YZM)^bKGDIuB+$P?H`I#t=oKIzWUOZ0!Qo;K<+*SKlC@>8e<KJtBZA
zLoh=m5Qi|hGWY@`+8+o*7)ESxj9385W~{(Gp#r4q86a7b8^~w*(*4<4_LI|O*7SSa
z8h?~Qa`S<ihZ86_0mwEC4hS~*sJi{VyOhAvk4y<Y^Ioq}1d4Nk43!6B4hGEpuL;B~
zFa<n7>;_bj!;s3Lz>o%1lmk?n%1{Ip7X@N|kU|F#5$OL9RLFq@`QU;dEvA4=Iw0tT
zy5~_>gxek;3+LT`geR-b$UT>fY@IF;2Lnk%AT|YJBQVPtNSXk#F;L7H$TA0uSpr4O
z7%YG+BcM1$wHbo}P}UsCvjEB)07XD%8Gs=Sm_i-$)?n`~XNFGq<v%V6FDXt_0+nki
zFo%F#<ji2j04s1^p_-OuC2QDDy(GBx8p8qqn-Uj5fh7mi#0}Sk9;OJ8zyK~i7eqk$
yMH#8ZrASKd)oh-2;77N21M5tgN4|Eup8oXu)HnH|;G&Iv^N!y&JWEI(WCj39hPmJX
--- a/netwerk/test/unit/test_file_protocol.js
+++ b/netwerk/test/unit/test_file_protocol.js
@@ -7,16 +7,17 @@ const PR_RDONLY = 0x1;  // see prio.h
 
 const special_type = "application/x-our-special-type";
 
 [
   test_read_file,
   test_read_dir_1,
   test_read_dir_2,
   test_upload_file,
+  test_load_replace,
   do_test_finished
 ].forEach(add_test);
 
 function getFile(key) {
   var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
                          .getService(Components.interfaces.nsIProperties);
   return dirSvc.get(key, Components.interfaces.nsILocalFile);
 }
@@ -217,11 +218,33 @@ function test_upload_file() {
     
     run_next_test();
   }
 
   chan.contentType = special_type;
   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();
 }