toolkit/devtools/tests/mochitest/test_loader_paths.html
author Ryan VanderMeulen <ryanvm@gmail.com>
Fri, 17 Jan 2014 15:53:55 -0500
changeset 175850 e9358bde4d0f774eb90233f52eb652d29f6a5869
parent 175845 9b91c7e0aa11117a3b6aa4d8dcb6e58f084fa942
child 175870 009513120418c90adb9a1a423a08f083bc994988
permissions -rw-r--r--
Backed out changeset 9b91c7e0aa11 (bug 946813) for xpcshell crashes. a=backout

<!DOCTYPE html>
<!--
  Any copyright is dedicated to the Public Domain.
  http://creativecommons.org/publicdomain/zero/1.0/
-->

<html>

  <head>
    <meta charset="utf8">
    <title></title>

    <script type="application/javascript"
            src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    <link rel="stylesheet" type="text/css"
          href="chrome://mochikit/content/tests/SimpleTest/test.css">
  </head>

  <body>

    <script type="application/javascript;version=1.8">
      const { classes: Cc, interfaces: Ci, utils: Cu } = Components;

      const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});

      const SRCDIR_PREF = "devtools.loader.srcdir";
      let srcDir = Cc["@mozilla.org/file/directory_service;1"]
                   .getService(Components.interfaces.nsIProperties)
                   .get("CurWorkD", Components.interfaces.nsIFile).path;

      let srcDirStr = Cc["@mozilla.org/supports-string;1"]
                      .createInstance(Ci.nsISupportsString);
      srcDirStr.data = srcDir;
      Services.prefs.setComplexValue(SRCDIR_PREF, Ci.nsISupportsString,
                                     srcDirStr);

      const { BuiltinProvider, SrcdirProvider } =
        Cu.import("resource://gre/modules/devtools/Loader.jsm", {});

      BuiltinProvider.load();
      SrcdirProvider.load();

      is(BuiltinProvider.loader.mapping.length,
         SrcdirProvider.loader.mapping.length + 1,
         "The built-in loader should have only one more mapping for testing.");

      Services.prefs.clearUserPref(SRCDIR_PREF);
    </script>
  </body>
</html>