Bug 596580: fix versioning on mozJSSubScriptLoader. (r=sayrer,brendan)
[mozilla-central.git] / js / src / xpconnect / tests / unit / test_bug596580.js
blob00778060bbaa2fee21a9b561d37feb444f3e992f
1 const Cc = Components.classes;
2 const Ci = Components.interfaces;
4 function run_test() {
5   var file = do_get_file("bug596580_versioned.js");
6   var ios = Cc["@mozilla.org/network/io-service;1"]
7               .getService(Ci.nsIIOService);
8   var uri = ios.newFileURI(file);
9   var scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
10                        .getService(Ci.mozIJSSubScriptLoader);
11   scriptLoader.loadSubScript(uri.spec);
12   version(150)
13   try {
14       scriptLoader.loadSubScript(uri.spec);
15       throw new Exception("Subscript should fail to load.");
16   } catch (e if e instanceof SyntaxError) {
17       // Okay.
18   }