<commit_before>var FirebugLoadManager = function () {
    try
    {
        // Get ModuleLoader implementation (it's Mozilla JS code module)
        Components.utils["import"]("resource://firebug/moduleLoader.js");
        if (FBTrace.DBG_MODULES)
            FBTrace.sysout("Loaded ModuleLoader");
    }
    catch (exc)
    {
        var msg = exc.toString() +" "+(exc.fileName || exc.sourceName) + "@" + exc.lineNumber;
        if (FBTrace.DBG_MODULES)
        {
            dump("Import moduleLoader.js FAILS: "+msg+"\n");
            FBTrace.sysout("Import moduleLoader.js ERROR "+msg, exc);
        }
        Components.utils.reportError(msg);
        throw exc;
    }

    function preLoadInitialization()
    {
        // FIXME, create options.js as dependent of loader. Firebug.architecture = this.getPref(this.prefDomain, "architecture");
    }

    function getModuleLoaderScope(config)
    {
        Firebug.loadConfiguration = config;  // we need to get the values to options.js somehow.

        var firebugScope = // pump the objects from this scope down into module loader
        {
            window : window,
            Firebug: Firebug,
            fbXPCOMUtils: fbXPCOMUtils,
            FBL: FBL,
            FirebugReps: FirebugReps,
            FBTrace: FBTrace,
            domplate: domplate,
            setTimeout: function(fn, delay) { return window.setTimeout(fn, delay); }, // bind window via closure
            clearTimeout: function(timeout) { return window.clearTimeout(timeout); }, // bind window via closure
            setInterval: function(fn, delay) { return window.setInterval(fn, delay); }, // bind window via closure
            clearInterval: function(timeout) { return window.clearInterval(timeout); }, // bind window via closure
        };
        return firebugScope;
    }

    function getModuleLoaderConfig(config)
    {
        var uid = Math.random();  // to give each XUL window its own loader (for now)
        var config = {
            context:"Firebug "+uid, // TODO XUL window id on FF4.0+
            baseUrl: config.baseUrl,
            paths: config.paths,
            onDebug: function() {
                if (!this.FBTrace)
                {
                    // traceConsoleService is a global of |window| frome trace.js.
                    // on the first call we use it to get a ref to the Cu.import module object
                    this.FBTrace = traceConsoleService.getTracer("extensions.firebug");
                }
                if (this.FBTrace.DBG_MODULES)
                    this.FBTrace.sysout.apply(this.FBTrace,arguments);
            },
            onError: function()
            {
                Components.utils.reportError(arguments[0]);  // put something out for sure
                if (!this.FBTrace)
                {
                    // traceConsoleService is a global of |window| frome trace.js.
                    // on the first call we use it to get a ref to the Cu.import module object
                    this.FBTrace = traceConsoleService.getTracer("extensions.firebug");
                }
                if (this.FBTrace.DBG_ERRORS || this.FBTrace.DBG_MODULES)
                    this.FBTrace.sysout.apply(this.FBTrace, arguments);
                throw arguments[0];
            },
            waitSeconds: 0,
            debug: true,
            /* edit: function(errorMsg, errorURL, errorLineNumber)
            {
                window.alert(errorMsg+" "+errorURL+"@"+errorLineNumber);
            },
            edit: function(context, url, module)
            {
                FBTrace.sysout("opening window modal on "+url);
                var a = {url: url};
                return window.showModalDialog("chrome://firebug/content/external/editors.xul",{}, "resizable:yes;scroll:yes;dialogheight:480;dialogwidth:600;center:yes");
            }
            */
        };
        return config;
    }

    function createLoader(config)
    {
        preLoadInitialization();
        var firebugScope = getModuleLoaderScope(config);// pump the objects from this scope down into module loader
        var require_js_config = getModuleLoaderConfig(config);
        var loader = new ModuleLoader(firebugScope, require_js_config);
        return loader;
    }

    /*
     * config.arch: architecture to load, 'inProcess', 'remoteClient', 'remoteServer'
     * config.prefDomain: base for preferences systems, eg 'extension.firebug'
     * config.baseUrl: base for load path
     */

    function loadCore(config, coreInitialize)
    {
        setConfigurationDefaults(config);

        var loader = createLoader(config);

        if (Firebug.alwaysOpenTraceConsole || true)
        {
            loader.define(['traceModule.js'],function(traceModule)
            {
                FBTrace.sysout("traceModule scope includes FBL: "+FBL+" Firebug "+Firebug);
                traceModule.openConsole(config.prefDomain);
            } );  // synchronous

        }

        var coreModules = [];

        if (config.arch === 'inProcess')
        {
            coreModules.push("inProcess/tools.js");  // must be first
            coreModules.push("inProcess/options.js");  // debugger needs Firebug.Options because of $STR() in property initializes, TODO
            coreModules.push("inProcess/firebugadapter.js");
            coreModules.push("debugger.js");
            coreModules.push("inProcess/javascripttool.js");
        }
        else if (config.arch == "remoteClient")
        {
            coreModules.push("crossfireModules/tools.js");
            coreModules.push("inProcess/options.js");  // debugger needs Firebug.Options because of $STR() in property initializes, TODO
            coreModules.push("debugger.js");

        }
        else if (config.arch == "remoteServer")
        {

            coreModules.push("inProcess/tools.js");  // must be first
            coreModules.push("inProcess/options.js");  // debugger needs Firebug.Options because of $STR() in property initializes, TODO
            coreModules.push("debugger.js");

            coreModules.push("crossfireModules/crossfire-server.js");
        }
        else
        {
            throw new Error("ERROR Firebug.LoadManager.loadCore unknown architechture requested: "+Firebug.arch);
        }

        var defaultModules = [
         "tabContext.js",  // should be loaded by being a dep of tabWatcher
         "sourceBox.js",
         "script.js",
        ];

        var modules = coreModules.concat(defaultModules);

        loader.define(modules, coreInitialize);
    }

    function setConfigurationDefaults(config)
    {
        config.arch = config.arch || 'inProcess';
        config.prefDomain = config.prefDomain || 'extensions.firebug';
        config.baseUrl = config.baseUrl || 'resource://firebug_rjs/';
        config.paths = {"arch": config.arch};
    }

    return {loadCore: loadCore, arch: "inProcess"};
}();<commit_msg>[1.8] module load tracingModule, but the UI is not wired correctly<commit_after>var FirebugLoadManager = function () {
    try
    {
        // Get ModuleLoader implementation (it's Mozilla JS code module)
        Components.utils["import"]("resource://firebug/moduleLoader.js");
        if (FBTrace.DBG_MODULES)
            FBTrace.sysout("Loaded ModuleLoader");
    }
    catch (exc)
    {
        var msg = exc.toString() +" "+(exc.fileName || exc.sourceName) + "@" + exc.lineNumber;
        if (FBTrace.DBG_MODULES)
        {
            dump("Import moduleLoader.js FAILS: "+msg+"\n");
            FBTrace.sysout("Import moduleLoader.js ERROR "+msg, exc);
        }
        Components.utils.reportError(msg);
        throw exc;
    }

    function preLoadInitialization()
    {
        // FIXME, create options.js as dependent of loader. Firebug.architecture = this.getPref(this.prefDomain, "architecture");
    }

    function getModuleLoaderScope(config)
    {
        Firebug.loadConfiguration = config;  // we need to get the values to options.js somehow.

        var firebugScope = // pump the objects from this scope down into module loader
        {
            window : window,
            Firebug: Firebug,
            fbXPCOMUtils: fbXPCOMUtils,
            FBL: FBL,
            FirebugReps: FirebugReps,
            FBTrace: FBTrace,
            domplate: domplate,
            setTimeout: function(fn, delay) { return window.setTimeout(fn, delay); }, // bind window via closure
            clearTimeout: function(timeout) { return window.clearTimeout(timeout); }, // bind window via closure
            setInterval: function(fn, delay) { return window.setInterval(fn, delay); }, // bind window via closure
            clearInterval: function(timeout) { return window.clearInterval(timeout); }, // bind window via closure
        };
        return firebugScope;
    }

    function getModuleLoaderConfig(config)
    {
        var uid = Math.random();  // to give each XUL window its own loader (for now)
        var config = {
            context:"Firebug "+uid, // TODO XUL window id on FF4.0+
            baseUrl: config.baseUrl,
            paths: config.paths,
            onDebug: function() {
                if (!this.FBTrace)
                {
                    // traceConsoleService is a global of |window| frome trace.js.
                    // on the first call we use it to get a ref to the Cu.import module object
                    this.FBTrace = traceConsoleService.getTracer("extensions.firebug");
                }
                if (this.FBTrace.DBG_MODULES)
                    this.FBTrace.sysout.apply(this.FBTrace,arguments);
            },
            onError: function()
            {
                Components.utils.reportError(arguments[0]);  // put something out for sure
                if (!this.FBTrace)
                {
                    // traceConsoleService is a global of |window| frome trace.js.
                    // on the first call we use it to get a ref to the Cu.import module object
                    this.FBTrace = traceConsoleService.getTracer("extensions.firebug");
                }
                if (this.FBTrace.DBG_ERRORS || this.FBTrace.DBG_MODULES)
                    this.FBTrace.sysout.apply(this.FBTrace, arguments);
                throw arguments[0];
            },
            waitSeconds: 0,
            debug: true,
            /* edit: function(errorMsg, errorURL, errorLineNumber)
            {
                window.alert(errorMsg+" "+errorURL+"@"+errorLineNumber);
            },
            edit: function(context, url, module)
            {
                FBTrace.sysout("opening window modal on "+url);
                var a = {url: url};
                return window.showModalDialog("chrome://firebug/content/external/editors.xul",{}, "resizable:yes;scroll:yes;dialogheight:480;dialogwidth:600;center:yes");
            }
            */
        };
        return config;
    }

    function createLoader(config)
    {
        preLoadInitialization();
        var firebugScope = getModuleLoaderScope(config);// pump the objects from this scope down into module loader
        var require_js_config = getModuleLoaderConfig(config);
        var loader = new ModuleLoader(firebugScope, require_js_config);
        return loader;
    }

    /*
     * config.arch: architecture to load, 'inProcess', 'remoteClient', 'remoteServer'
     * config.prefDomain: base for preferences systems, eg 'extension.firebug'
     * config.baseUrl: base for load path
     */

    function loadCore(config, coreInitialize)
    {
        setConfigurationDefaults(config);

        var loader = createLoader(config);

        if (Firebug.alwaysOpenTraceConsole)
        {
            loader.define(['traceModule.js'],function(traceModule)
            {
                FBTrace.sysout("traceModule scope includes FBL: "+FBL+" Firebug "+Firebug);
                traceModule.openConsole(config.prefDomain);
            } );  // synchronous

        }

        var coreModules = [];

        if (config.arch === 'inProcess')
        {
            coreModules.push("inProcess/tools.js");  // must be first
            coreModules.push("inProcess/options.js");  // debugger needs Firebug.Options because of $STR() in property initializes, TODO
            coreModules.push("inProcess/firebugadapter.js");
            coreModules.push("debugger.js");
            coreModules.push("inProcess/javascripttool.js");
        }
        else if (config.arch == "remoteClient")
        {
            coreModules.push("crossfireModules/tools.js");
            coreModules.push("inProcess/options.js");  // debugger needs Firebug.Options because of $STR() in property initializes, TODO
            coreModules.push("debugger.js");

        }
        else if (config.arch == "remoteServer")
        {

            coreModules.push("inProcess/tools.js");  // must be first
            coreModules.push("inProcess/options.js");  // debugger needs Firebug.Options because of $STR() in property initializes, TODO
            coreModules.push("debugger.js");

            coreModules.push("crossfireModules/crossfire-server.js");
        }
        else
        {
            throw new Error("ERROR Firebug.LoadManager.loadCore unknown architechture requested: "+Firebug.arch);
        }

        var defaultModules = [
         "tabContext.js",  // should be loaded by being a dep of tabWatcher
         "sourceBox.js",
         "script.js",
         "traceModule.js"
        ];

        var modules = coreModules.concat(defaultModules);

        loader.define(modules, coreInitialize);
    }

    function setConfigurationDefaults(config)
    {
        config.arch = config.arch || 'inProcess';
        config.prefDomain = config.prefDomain || 'extensions.firebug';
        config.baseUrl = config.baseUrl || 'resource://firebug_rjs/';
        config.paths = {"arch": config.arch};
    }

    return {loadCore: loadCore, arch: "inProcess"};
}();
{'fraction_non_alphanumeric': 0.10841644543302002, 'fraction_numerical': 0.0017220348712061418, 'mean_word_length': 2.0006458557588807, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '911342', 'n_tokens_mistral': 3732, 'n_tokens_neox': 3639, 'n_words': 878}