michael@0: /* verify that certain invalid URIs are not parsed by the resource michael@0: protocol handler */ michael@0: michael@0: const specs = [ michael@0: "resource:////", michael@0: "resource:///http://www.mozilla.org/", michael@0: "resource:///file:///", michael@0: "resource:///..\\", michael@0: "resource:///..\\..\\", michael@0: "resource:///..%5C", michael@0: "resource:///..%5c" michael@0: ]; michael@0: michael@0: function check_for_exception(spec) michael@0: { michael@0: var ios = michael@0: Cc["@mozilla.org/network/io-service;1"]. michael@0: getService(Ci.nsIIOService); michael@0: michael@0: try { michael@0: var channel = ios.newChannel(spec, null, null); michael@0: } michael@0: catch (e) { michael@0: return; michael@0: } michael@0: michael@0: do_throw("Successfully opened invalid URI: '" + spec + "'"); michael@0: } michael@0: michael@0: function run_test() { michael@0: for each (spec in specs) { michael@0: check_for_exception(spec); michael@0: } michael@0: }