B2G/gecko/browser/devtools/commandline/CmdCmd.jsm
/**
   * Called to look in a directory pointed at by the devtools.commands.dir pref
   * for *.mozcmd files which are then loaded.
   * @param nsIPrincipal aSandboxPrincipal Scope object for the Sandbox in which
   * we eval the script from the .mozcmd file. This should be a chrome window.
   */
Called to look in a directory pointed at by the devtools.commands.dir pref
for *.mozcmd files which are then loaded.
@param nsIPrincipal aSandboxPrincipal Scope object for the Sandbox in which
we eval the script from the .mozcmd file. This should be a chrome window.
Called to look in a directory pointed at by the devtools . commands . dir pref for * . mozcmd files which are then loaded . @param nsIPrincipal aSandboxPrincipal Scope object for the Sandbox in which we eval the script from the . mozcmd file . This should be a chrome window .
function GC_refreshAutoCommands(aSandboxPrincipal) {
    commands.forEach(function(name) {
      gcli.removeCommand(name);
    });
    let dirName = prefBranch.getComplexValue(PREF_DIR,
                                             Ci.nsISupportsString).data.trim();
    if (dirName == "") {
      return;
    }
    let dir = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
    dir.initWithPath(dirName);
    if (!dir.exists() || !dir.isDirectory()) {
      throw new Error('\'' + dirName + '\' is not a directory.');
    }
    let en = dir.directoryEntries.QueryInterface(Ci.nsIDirectoryEnumerator);
    while (true) {
      let file = en.nextFile;
      if (!file) {
        break;
      }
      if (file.leafName.match(/.*\.mozcmd$/) && file.isFile() && file.isReadable()) {
        loadCommandFile(file, aSandboxPrincipal);
      }
    }
  }
function GC_refreshAutoCommands ( aSandboxPrincipal ) { commands . forEach ( function ( name ) { gcli . removeCommand ( name ) ; } ) ; let dirName = prefBranch . getComplexValue ( PREF_DIR , Ci . nsISupportsString ) . data . trim ( ) ; if ( dirName == "" ) { return ; } let dir = Cc [ "@mozilla.org/file/local;1" ] . createInstance ( Ci . nsILocalFile ) ; dir . initWithPath ( dirName ) ; if ( ! dir . exists ( ) || ! dir . isDirectory ( ) ) { throw new Error ( '\'' + dirName + '\' is not a directory.' ) ; } let en = dir . directoryEntries . QueryInterface ( Ci . nsIDirectoryEnumerator ) ; while ( true ) { let file = en . nextFile ; if ( ! file ) { break ; } if ( file . leafName . match ( / .*\.mozcmd$ / ) && file . isFile ( ) && file . isReadable ( ) ) { loadCommandFile ( file , aSandboxPrincipal ) ; } } }
Called to look in a directory pointed at by the devtools.commands.dir pref
 for *.mozcmd files which are then loaded.
Called to look in a directory pointed at by the devtools . commands . dir pref for * . mozcmd files which are then loaded .
// First get rid of the last set of commands