1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/test/unit/test_bug380994.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,22 @@ 1.4 +/* check resource: protocol for traversal problems */ 1.5 + 1.6 +const specs = [ 1.7 + "resource:///chrome/../plugins", 1.8 + "resource:///chrome%2f../plugins", 1.9 + "resource:///chrome/..%2fplugins", 1.10 + "resource:///chrome%2f%2e%2e%2fplugins", 1.11 + "resource:///../../../..", 1.12 + "resource:///..%2f..%2f..%2f..", 1.13 + "resource:///%2e%2e" 1.14 +]; 1.15 + 1.16 +function run_test() { 1.17 + var ios = Cc["@mozilla.org/network/io-service;1"]. 1.18 + getService(Ci.nsIIOService); 1.19 + 1.20 + for each (spec in specs) { 1.21 + var uri = ios.newURI(spec, null, null); 1.22 + if (uri.spec.indexOf("..") != -1) 1.23 + do_throw("resource: traversal remains: '"+spec+"' ==> '"+uri.spec+"'"); 1.24 + } 1.25 +}