[Pkg-mozext-commits] [firebug] 01/04: Imported Upstream version 1.12.3

David Prévot taffit at alioth.debian.org
Wed Oct 9 14:15:40 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository firebug.

commit 35944a93d816de6b491856e0e9f878227f699f34
Author: David Prévot <taffit at debian.org>
Date:   Wed Oct 9 08:58:09 2013 -0400

    Imported Upstream version 1.12.3
---
 content/firebug/branch.properties                  |    2 +-
 content/firebug/chrome/knownIssues.js              |  157 ++++++++++++++++++--
 content/firebug/chrome/panelActivation.js          |   25 ++--
 content/firebug/console/commandEditor.js           |   23 ++-
 content/firebug/console/commandLine.js             |   55 ++++++-
 content/firebug/console/commandLineExposed.js      |   33 +++-
 .../firebug/console/commands/commandLineInclude.js |  128 +++++++++++++---
 content/firebug/console/console.js                 |    2 +-
 content/firebug/console/consolePanel.js            |    2 +
 content/firebug/firebug.js                         |    4 +-
 defaults/preferences/firebug.js                    |    3 +
 install.rdf                                        |    2 +-
 locale/en-US/firebug.properties                    |    9 +-
 skin/classic/console.css                           |    8 +
 14 files changed, 387 insertions(+), 66 deletions(-)

diff --git a/content/firebug/branch.properties b/content/firebug/branch.properties
index 93206c3..a06aa82 100644
--- a/content/firebug/branch.properties
+++ b/content/firebug/branch.properties
@@ -1,5 +1,5 @@
 # DO NOT MERGE INTO TRUNK
-RELEASE=.2
+RELEASE=.3
 VERSION=1.12
 TRUNK=
 # To allow build.xml to drop the xpi directly into the svn working copy for getfirebug.com
diff --git a/content/firebug/chrome/knownIssues.js b/content/firebug/chrome/knownIssues.js
index 1ffc1b6..4090bea 100644
--- a/content/firebug/chrome/knownIssues.js
+++ b/content/firebug/chrome/knownIssues.js
@@ -1,42 +1,177 @@
 /* See license.txt for terms of usage */
 
 define([
+    "firebug/firebug",
+    "firebug/lib/trace",
     "firebug/lib/object",
     "firebug/lib/options",
-    "firebug/firebug",
     "firebug/lib/dom",
     "firebug/chrome/firefox",
+    "firebug/lib/domplate",
+    "firebug/lib/locale",
+    "firebug/chrome/reps",
+    "firebug/chrome/window",
+    "firebug/chrome/panelActivation",
+    "firebug/lib/events",
+    "firebug/lib/css",
 ],
-function(Obj, Options, Firebug, Dom, Firefox) {
+function(Firebug, FBTrace, Obj, Options, Dom, Firefox, Domplate, Locale, FirebugReps, Win,
+    PanelActivation, Events, Css) {
+
+"use strict";
 
 // ********************************************************************************************* //
 // Constants
 
-const Cc = Components.classes;
-const Ci = Components.interfaces;
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+
+var {domplate, SPAN, P, DIV, BUTTON, TABLE, TR, TD, TBODY} = Domplate;
+
+var slowJSDBugUrl = "https://bugzilla.mozilla.org/show_bug.cgi?id=815603";
+
+// ********************************************************************************************* //
+// Domplate
+
+var slowJsdTag =
+    P({"class": "slowJsdMessage disabledPanelDescription",
+        style: "margin: 15px 0 15px 0; color: green"}
+    );
+
+var slowJsdRep = domplate(Firebug.Rep,
+{
+    className: "text",
+
+    tag:
+        FirebugReps.OBJECTBOX(
+            TABLE(
+                TBODY(
+                    TR(
+                        TD({"valign": "middle"},
+                            SPAN({"class": "slowJSD"})
+                        ),
+                        TD({"valign": "middle", "style": "white-space: nowrap;"},
+                            BUTTON({onclick: "$onClick"},
+                                Locale.$STR("knownissues.message.slowJSD.GotIt")
+                            )
+                        )
+                    )
+                )
+            )
+        ),
+
+    onClick: function(event)
+    {
+        Options.set("showSlowJSDMessage", false);
+
+        var row = Dom.getAncestorByClass(event.target, "logRow");
+        row.parentNode.removeChild(row);
+
+        Events.cancelEvent(event);
+    }
+});
 
 // ********************************************************************************************* //
 
 /**
- * This module is responsible for varisous hacky solutions related to known issues.
+ * This module is responsible for various hacks and workarounds related
+ * to known platform issues.
  */
-Firebug.KnownIssues = Obj.extend(Firebug.Module,
-/** @lends Firebug.KnownIssues */
+var KnownIssues = Obj.extend(Firebug.Module,
+/** @lends KnownIssues */
 {
     dispatchName: "knownIssues",
 
-    initialize: function()
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+    // Initialization
+
+    initialize: function(prefDomain, prefNames)
+    {
+        Firebug.Module.initialize.apply(this, arguments);
+
+        Firebug.registerUIListener(this);
+        PanelActivation.addListener(this);
+    },
+
+    shutdown: function()
+    {
+        Firebug.unregisterUIListener(this);
+        PanelActivation.removeListener(this);
+
+        Firebug.Module.shutdown.apply(this, arguments);
+    },
+
+    initContext: function(context)
     {
-        // TODO: put any workarounds here
+        Firebug.Module.initContext.apply(this, arguments);
+
+        // Initialize default value.
+        context.showSlowJSDMessage = Options.get("showSlowJSDMessage");
+
+        this.showSlowJSDMessage(context);
     },
+
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+    showSlowJSDMessage: function(context)
+    {
+        // Do not display twice for this context
+        if (!context.showSlowJSDMessage)
+            return;
+
+        // The message is displayed only if the Console panel is enabled.
+        if (!PanelActivation.isPanelEnabled(Firebug.getPanelType("console")))
+            return;
+
+        // The message is displayed only if the Script panel is enabled.
+        if (!PanelActivation.isPanelEnabled(Firebug.getPanelType("script")))
+            return;
+
+        var row = Firebug.Console.log({}, context, "warn", slowJsdRep, true);
+
+        // xxxHonza: couldn't we have vertical centering (50%) for all ".logRow" elements?
+        row.setAttribute("style", "background-position: 4px 50%;")
+
+        var parentNode = row.getElementsByClassName("slowJSD")[0];
+        FirebugReps.Description.render(Locale.$STR("knownissues.message.slowJSD"),
+            parentNode, Obj.bindFixed(Win.openNewTab, Win, slowJSDBugUrl));
+
+        context.showSlowJSDMessage = false;
+    },
+
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+    // UI Listener
+
+    /**
+     * Issue 6821: Tell the user that JSD slows down opening Firebug and tab switching
+     */
+    showDisabledPanelBox: function(panelName, parentNode)
+    {
+        if (panelName != "script")
+            return;
+
+        var box = parentNode.getElementsByClassName("disabledPanelDescription")[0];
+        var message = slowJsdTag.insertAfter({}, box);
+
+        FirebugReps.Description.render(Locale.$STR("knownissues.message.slowJSD"),
+            message, Obj.bindFixed(Win.openNewTab, Win, slowJSDBugUrl));
+    },
+
+    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+    // PanelActivation Listener
+
+    activationChanged: function(panelType, enable)
+    {
+        this.showSlowJSDMessage(Firebug.currentContext);
+    }
 });
 
 // ********************************************************************************************* //
 // Registration
 
-Firebug.registerModule(Firebug.KnownIssues);
+Firebug.registerModule(KnownIssues);
 
-return Firebug.KnownIssues;
+return KnownIssues;
 
 // ********************************************************************************************* //
 });
diff --git a/content/firebug/chrome/panelActivation.js b/content/firebug/chrome/panelActivation.js
index 8b04ab7..9765d49 100644
--- a/content/firebug/chrome/panelActivation.js
+++ b/content/firebug/chrome/panelActivation.js
@@ -16,11 +16,13 @@ function(Obj, Firebug, Firefox, Locale, Domplate, Xpcom, Url, Dom, Options) {
 // ********************************************************************************************* //
 // Constants
 
-const Cc = Components.classes;
-const Ci = Components.interfaces;
+var Cc = Components.classes;
+var Ci = Components.interfaces;
 
-const prefs = Xpcom.CCSV("@mozilla.org/preferences-service;1", "nsIPrefBranch");
-const prompts = Xpcom.CCSV("@mozilla.org/embedcomp/prompt-service;1", "nsIPromptService");
+var prefs = Xpcom.CCSV("@mozilla.org/preferences-service;1", "nsIPrefBranch");
+var prompts = Xpcom.CCSV("@mozilla.org/embedcomp/prompt-service;1", "nsIPromptService");
+
+var {domplate, DIV, H1, SPAN, P, A} = Domplate;
 
 // ********************************************************************************************* //
 // Panel Activation Implementation
@@ -75,7 +77,7 @@ Firebug.PanelActivation = Obj.extend(Firebug.Module,
 
     activatePanelTypes: function(panelTypes)
     {
-        for (var i=0; i<panelTypes.length; i++)
+        for (var i = 0; i < panelTypes.length; i++)
         {
             var panelType = panelTypes[i];
             if (!this.isPanelActivable(panelType))
@@ -88,7 +90,7 @@ Firebug.PanelActivation = Obj.extend(Firebug.Module,
 
     deactivatePanelTypes: function(panelTypes)
     {
-        for (var i=0; i<panelTypes.length; i++)
+        for (var i = 0; i < panelTypes.length; i++)
         {
             var panelType = panelTypes[i];
             if (!this.isPanelActivable(panelType))
@@ -134,7 +136,7 @@ Firebug.PanelActivation = Obj.extend(Firebug.Module,
 
     enableAllPanels: function()
     {
-        for (var i = 0; i < Firebug.panelTypes.length; ++i)
+        for (var i = 0; i < Firebug.panelTypes.length; i++)
         {
             var panelType = Firebug.panelTypes[i];
             this.setPanelState(panelType, true);
@@ -143,7 +145,7 @@ Firebug.PanelActivation = Obj.extend(Firebug.Module,
 
     disableAllPanels: function()
     {
-        for (var i = 0; i < Firebug.panelTypes.length; ++i)
+        for (var i = 0; i < Firebug.panelTypes.length; i++)
         {
             var panelType = Firebug.panelTypes[i];
             this.setPanelState(panelType, false);
@@ -304,11 +306,11 @@ Firebug.PanelActivation = Obj.extend(Firebug.Module,
 });
 
 // ********************************************************************************************* //
+// Disabled Panel Box
 
 /**
  * @domplate This template renders default content for disabled panels.
  */
-with (Domplate) {
 Firebug.DisabledPanelBox = domplate(Firebug.Rep,
 /** @lends Firebug.DisabledPanelBox */
 {
@@ -367,6 +369,10 @@ Firebug.DisabledPanelBox = domplate(Firebug.Rep,
         var parentNode = this.getParentNode(browser);
         this.tag.replace(args, parentNode, this);
         parentNode.removeAttribute("collapsed");
+
+        // Dispatch an event to UI listeners, so the box can be customized.
+        Firebug.dispatch(Firebug.uiListeners, "showDisabledPanelBox",
+            [panelName, parentNode]);
     },
 
     /**
@@ -391,7 +397,6 @@ Firebug.DisabledPanelBox = domplate(Firebug.Rep,
         return doc.documentElement.querySelector(".disabledPanelNode");
     },
 });
-};
 
 // ********************************************************************************************* //
 // Registration
diff --git a/content/firebug/console/commandEditor.js b/content/firebug/console/commandEditor.js
index 7ae9d3e..23df12e 100644
--- a/content/firebug/console/commandEditor.js
+++ b/content/firebug/console/commandEditor.js
@@ -12,6 +12,8 @@ define([
 ],
 function(Obj, Firebug, Events, Menu, Dom, Locale, Css, Options) {
 
+"use strict";
+
 // ********************************************************************************************* //
 // Constants
 
@@ -25,16 +27,27 @@ try
 {
     // Introduced in Firefox 8
     Cu["import"]("resource:///modules/source-editor.jsm");
+}
+catch (err)
+{
+    try
+    {
+        // URL changed in Firefox 27
+        Cu["import"]("resource:///modules/devtools/sourceeditor/source-editor.jsm");
+    }
+    catch (err)
+    {
+        if (FBTrace.DBG_ERRORS)
+            FBTrace.sysout("commandEditor: EXCEPTION source-editors is not available!");
+    }
+}
 
+if (typeof(SourceEditor) != "undefined")
+{
     MODE_JAVASCRIPT = SourceEditor.MODES.JAVASCRIPT;
     CONTEXT_MENU = SourceEditor.EVENTS.CONTEXT_MENU;
     TEXT_CHANGED = SourceEditor.EVENTS.TEXT_CHANGED;
 }
-catch (err)
-{
-    if (FBTrace.DBG_ERRORS)
-        FBTrace.sysout("commandEditor: EXCEPTION source-editors is not available!");
-}
 
 // ********************************************************************************************* //
 // Command Editor
diff --git a/content/firebug/console/commandLine.js b/content/firebug/console/commandLine.js
index 74680f0..ab94711 100644
--- a/content/firebug/console/commandLine.js
+++ b/content/firebug/console/commandLine.js
@@ -45,12 +45,36 @@ Firebug.CommandLine = Obj.extend(Firebug.Module,
 
     // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
+    /**
+     * Evaluates an expression either in the global scope or in the current scope
+     * of the JS debugger, depending on the state of Firebug (i.e. if the debugger is currently
+     * active, etc.).
+     *
+     * @param {string} expr The expression.
+     * @param {Context} context The Firebug context.
+     * @param {*} [thisValue] Deprecated. Set it to null or undefined.
+     * @param {Window} [targetWindow] The window in which the expression is evaluated.
+     * @param {function} [successConsoleFunction] The callback function in case of 
+     *      evaluation without errors.
+     * @param {function} [exceptionFunction] The callback function in case of 
+     *      evaluation with errors.
+     * @param {object} [options] The options with the following properties:
+     *      - noStateChange: if set to true, do not update the DOM and HTML panels. (default=false)
+     *      - noCmdLineAPI: if set to true, do not evaluate with the Firebug commands. (default=false)
+     */
     evaluate: function(expr, context, thisValue, targetWindow, successConsoleFunction,
-        exceptionFunction, noStateChange)
+        exceptionFunction, options)
     {
         if (!context)
             return;
 
+        // Previously there was `noStateChange` in place of `options`. For backward compatibility,
+        // if `options` is a boolean, its value is meant to be `noStateChange`.
+        if (typeof options === "boolean")
+            options = {noStateChange: options};
+        else if (options == undefined)
+            options = {};
+
         targetWindow = targetWindow || context.getCurrentGlobal();
 
         var debuggerState, result = null;
@@ -58,7 +82,9 @@ Firebug.CommandLine = Obj.extend(Firebug.Module,
         {
             debuggerState = Firebug.Debugger.beginInternalOperation();
 
-            var newExpr = ClosureInspector.extendLanguageSyntax(expr, targetWindow, context);
+            var newExpr = expr;
+            if (!options.noCmdLineAPI)
+                newExpr = ClosureInspector.extendLanguageSyntax(expr, targetWindow, context);
 
             if (this.isSandbox(context))
             {
@@ -73,10 +99,10 @@ Firebug.CommandLine = Obj.extend(Firebug.Module,
             else
             {
                 this.evaluateInGlobal(newExpr, context, thisValue, targetWindow,
-                    successConsoleFunction, exceptionFunction, expr);
+                    successConsoleFunction, exceptionFunction, expr, options);
             }
 
-            if (!noStateChange)
+            if (!options.noStateChange)
                 context.invalidatePanels("dom", "html");
         }
         catch (exc)
@@ -94,10 +120,27 @@ Firebug.CommandLine = Obj.extend(Firebug.Module,
         }
     },
 
+    /**
+     * Evaluates an expression in the global scope.
+     *
+     * @param {string} expr The expression.
+     * @param {Context} context The Firebug context.
+     * @param {*} [thisValue] Deprecated. Set it to null or undefined.
+     * @param {Window} [targetWindow] The window in which the expression is evaluated.
+     * @param {function} [successConsoleFunction] The callback function in case of 
+     *      evaluation without errors.
+     * @param {function} [exceptionFunction] The callback function in case of 
+     *      evaluation with errors.
+     * @param {string} [origExpr] The original expression before it has been transformed
+     *          (mainly used by ClosureInspector). If not set, origExpr=expr.
+     * @param {object} [options] The options with the following properties:
+     *      - noCmdLineAPI: if set to true, do not evaluate with the Firebug commands. (default=false)
+     */
     evaluateInGlobal: function(expr, context, thisValue, targetWindow,
-        successConsoleFunction, exceptionFunction, origExpr)
+        successConsoleFunction, exceptionFunction, origExpr, options)
     {
         var win = targetWindow || context.getCurrentGlobal();
+        options = options || {};
 
         if (!win)
         {
@@ -146,7 +189,7 @@ Firebug.CommandLine = Obj.extend(Firebug.Module,
         };
 
         origExpr = origExpr || expr;
-        CommandLineExposed.evaluate(context, win, expr, origExpr, onSuccess, onError);
+        CommandLineExposed.evaluate(context, win, expr, origExpr, onSuccess, onError, options);
     },
 
     evaluateInDebugFrame: function(expr, context, thisValue, targetWindow,
diff --git a/content/firebug/console/commandLineExposed.js b/content/firebug/console/commandLineExposed.js
index 935abf1..848a5fd 100644
--- a/content/firebug/console/commandLineExposed.js
+++ b/content/firebug/console/commandLineExposed.js
@@ -1,5 +1,5 @@
 /* See license.txt for terms of usage */
-/*jshint esnext:true, es5:true, curly:false, evil:true, forin: false*/
+/*jshint esnext:true, curly:false, evil:true, forin: false*/
 /*global Firebug:true, FBTrace:true, Components:true, define:true */
 
 define([
@@ -234,6 +234,7 @@ function unregisterCommand(name)
  * @param {string} origExpr The expression as typed by the user
  * @param {function} onSuccess The function to trigger in case of success
  * @param {function} onError The function to trigger in case of exception
+ * @param {object} [options] The options (see CommandLine.evaluateInGlobal for the details)
  *
  * @see CommandLine.evaluate
  */
@@ -251,19 +252,29 @@ function evaluateInPageContext(context, win)
  * @param {string} origExpr The expression as typed by the user
  * @param {function} onSuccess The function to trigger in case of success
  * @param {function} onError The function to trigger in case of exception
+ * @param {object} [options] The options (see CommandLine.evaluateInGlobal for the details)
  */
-function evaluate(context, win, expr, origExpr, onSuccess, onError)
+function evaluate(context, win, expr, origExpr, onSuccess, onError, options)
 {
+    if (!options)
+        options = {};
+
     var result;
     var contentView = Wrapper.getContentView(win);
-    var commandLine = createFirebugCommandLine(context, win);
     var dglobal = DebuggerLib.getDebuggeeGlobal(context, win);
     var resObj;
 
-    updateVars(commandLine, dglobal, context);
-    removeConflictingNames(commandLine, context, contentView);
+    if (!options.noCmdLineAPI)
+    {
+        var bindings = getCommandLineBindings(context, win, dglobal, contentView);
+
+        resObj = dglobal.evalInGlobalWithBindings(expr, bindings);
+    }
+    else
+    {
+        resObj = dglobal.evalInGlobal(expr);
+    }
 
-    resObj = dglobal.evalInGlobalWithBindings(expr, commandLine);
 
     var unwrap = function(obj)
     {
@@ -486,6 +497,16 @@ function getAutoCompletionList()
     return completionList;
 }
 
+function getCommandLineBindings(context, win, dglobal, contentView)
+{
+    var commandLine = createFirebugCommandLine(context, win);
+
+    updateVars(commandLine, dglobal, context);
+    removeConflictingNames(commandLine, context, contentView);
+
+    return commandLine;
+}
+
 // ********************************************************************************************* //
 // Registration
 
diff --git a/content/firebug/console/commands/commandLineInclude.js b/content/firebug/console/commands/commandLineInclude.js
index b7b7b6c..ae0f2ea 100644
--- a/content/firebug/console/commands/commandLineInclude.js
+++ b/content/firebug/console/commands/commandLineInclude.js
@@ -13,9 +13,11 @@ define([
     "firebug/lib/system",
     "firebug/lib/xpcom",
     "firebug/lib/object",
+    "firebug/console/console",
     "firebug/editor/editor",
 ],
-function(FirebugReps, Domplate, Locale, Dom, Win, Css, Str, Options, Menu, System, Xpcom, Obj) {
+function(FirebugReps, Domplate, Locale, Dom, Win, Css, Str, Options, Menu, System, Xpcom, 
+    Obj, Console) {
 with (Domplate) {
 
 // ********************************************************************************************* //
@@ -106,7 +108,7 @@ var CommandLineIncludeRep = domplate(FirebugReps.Table,
         if (keys.length === 0)
         {
             var msg = Locale.$STR("commandline.include.noDefinedAlias");
-            Firebug.Console.log(msg, context, null, FirebugReps.Hint);
+            Firebug.Console._log(msg, context, null, FirebugReps.Hint);
             return returnValue;
         }
 
@@ -322,17 +324,17 @@ var CommandLineInclude = Obj.extend(Firebug.Module,
         {
             var store = this.getStore();
             store.setItem(newAlias, url);
-            this.log("aliasCreated", [newAlias], [context, "info"]);
+            this._log("aliasCreated", [newAlias], [context, "info"]);
         }
 
         if (!hasWarnings)
-            this.log("includeSuccess", [filename], [context, "info", true]);
+            this._log("includeSuccess", [filename], [context, "info", true]);
     },
 
     onError: function(context, url, loadingMsgRow)
     {
         this.clearLoadingMessage(loadingMsgRow);
-        this.log("loadFail", [url], [context, "error"]);
+        this._log("loadFail", [url], [context, "error"]);
     },
 
     clearLoadingMessage: function(loadingMsgRow)
@@ -370,7 +372,9 @@ var CommandLineInclude = Obj.extend(Firebug.Module,
         return this.store;
     },
 
-    log: function(localeStr, localeArgs, logArgs, noAutoPrefix)
+    // xxxFlorent: Prefix with underscore until we fix Issue 6806
+    //             since we're listening to Firebug.Console events.
+    _log: function(localeStr, localeArgs, logArgs, noAutoPrefix)
     {
         var prefixedLocaleStr = (noAutoPrefix ? localeStr : "commandline.include."+localeStr);
 
@@ -379,8 +383,14 @@ var CommandLineInclude = Obj.extend(Firebug.Module,
         return Firebug.Console.logFormatted.apply(Firebug.Console, logArgs);
     },
 
-    // include(context, url[, newAlias])
-    // includes a remote script
+    /**
+     * Includes a remote script.
+     * Executed by the include() command.
+     *
+     * @param {Context} context The Firebug context.
+     * @param {string} url The location of the script.
+     * @param {string} [newAlias] The alias to define for the script.
+     */
     include: function(context, url, newAlias)
     {
         var reNotAlias = /[\.\/]/;
@@ -390,13 +400,13 @@ var CommandLineInclude = Obj.extend(Firebug.Module,
         // checking arguments:
         if ((newAlias !== undefined && typeof newAlias !== "string") || newAlias === "")
         {
-            this.log("invalidAliasArgumentType", [], [context, "error"]);
+            this._log("invalidAliasArgumentType", [], [context, "error"]);
             return returnValue;
         }
 
         if (url !== null && typeof url !== "string" || !url && !newAlias)
         {
-            this.log("invalidUrlArgumentType", [], [context, "error"]);
+            this._log("invalidUrlArgumentType", [], [context, "error"]);
             return returnValue;
         }
 
@@ -405,13 +415,13 @@ var CommandLineInclude = Obj.extend(Firebug.Module,
 
         if ((urlIsAlias && url.length > 30) || (newAlias && newAlias.length > 30))
         {
-            this.log("tooLongAliasName", [newAlias || url], [context, "error"]);
+            this._log("tooLongAliasName", [newAlias || url], [context, "error"]);
             return returnValue;
         }
 
         if (newAlias !== undefined && reNotAlias.test(newAlias))
         {
-            this.log("invalidAliasName", [newAlias], [context, "error"]);
+            this._log("invalidAliasName", [newAlias], [context, "error"]);
             return returnValue;
         }
 
@@ -422,7 +432,7 @@ var CommandLineInclude = Obj.extend(Firebug.Module,
             url = store.getItem(aliasName);
             if (url === undefined)
             {
-                this.log("aliasNotFound", [aliasName], [context, "error"]);
+                this._log("aliasNotFound", [aliasName], [context, "error"]);
                 return returnValue;
             }
         }
@@ -433,15 +443,15 @@ var CommandLineInclude = Obj.extend(Firebug.Module,
             var store = this.getStore();
             if (store.getItem(newAlias) === undefined)
             {
-                this.log("aliasNotFound", [newAlias], [context, "error"]);
+                this._log("aliasNotFound", [newAlias], [context, "error"]);
                 return returnValue;
             }
 
             store.removeItem(newAlias);
-            this.log("aliasRemoved", [newAlias], [context, "info"]);
+            this._log("aliasRemoved", [newAlias], [context, "info"]);
             return returnValue;
         }
-        var loadingMsgRow = this.log("Loading", [], [context, "loading", true], true);
+        var loadingMsgRow = this._log("Loading", [], [context, "loading", true], true);
         var onSuccess = this.onSuccess.bind(this, newAlias, context, loadingMsgRow);
         var onError = Obj.bindFixed(this.onError, this, context, url, loadingMsgRow);
         this.evaluateRemoteScript(url, context, onSuccess, onError, loadingMsgRow);
@@ -449,6 +459,16 @@ var CommandLineInclude = Obj.extend(Firebug.Module,
         return returnValue;
     },
 
+    /**
+     * Evaluates a remote script. Prints a warning message in the console in case of syntax error.
+     *
+     * @param {string} url The URL.
+     * @param {Context} context The Firebug context.
+     * @param {function} [successFunction] The callback if the script has been successfully run.
+     * @param {function} [errorFunction] The callback if the expression has been run with errors.
+     * @param {*} [loadingMsgRow] The row in the console printed while the script is loading and
+     *      that has to be cleared.
+     */
     evaluateRemoteScript: function(url, context, successFunction, errorFunction, loadingMsgRow)
     {
         var xhr = new XMLHttpRequest({ mozAnon: true, timeout:30});
@@ -465,12 +485,34 @@ var CommandLineInclude = Obj.extend(Firebug.Module,
             // test if the content is an HTML file, which is the most current after a mistake
             if (!isValidJS(codeToEval))
             {
-                CommandLineInclude.log("invalidSyntax", [], [context, "warn"]);
+                CommandLineInclude._log("invalidSyntax", [], [context, "warn"]);
                 CommandLineInclude.clearLoadingMessage(loadingMsgRow);
                 hasWarnings = true;
             }
 
-            Firebug.CommandLine.evaluateInWebPage(codeToEval, context);
+            // Do not print anything if  the inclusion succeeds.
+            var successFunctionEval = function() { };
+            // Let's use the default function to handle errors.
+            var errorFunctionEval = null;
+
+            // xxxFlorent: Using evaluateInGlobal doesn't allow to stop execution in the script
+            //             panel. Just use it when having CSP until we migrate to JSD2.
+            //             (see Issue 6551)
+            if (CommandLineInclude.isCSPDoc(context))
+            {
+                if (FBTrace.DBG_COMMANDLINE)
+                {
+                    FBTrace.sysout("CommandLineInclude.evaluateRemoteScript; "+
+                        "document is using CSP. use evaluateInGlobal");
+                }
+                Firebug.CommandLine.evaluateInGlobal(codeToEval, context, undefined, undefined,
+                    successFunctionEval, errorFunctionEval, undefined, {noCmdLineAPI: true});
+            }
+            else
+            {
+                Firebug.CommandLine.evaluateInWebPage(codeToEval, context);
+            }
+
             if (successFunction)
                 successFunction(xhr, hasWarnings);
         };
@@ -489,22 +531,46 @@ var CommandLineInclude = Obj.extend(Firebug.Module,
             this.clearLoadingMessage(loadingMsgRow);
             if (ex.name === "NS_ERROR_UNKNOWN_PROTOCOL")
             {
-                this.log("invalidRequestProtocol", [], [context, "error"]);
+                this._log("invalidRequestProtocol", [], [context, "error"]);
                 return;
             }
             throw ex;
         }
 
-        if (!~acceptedSchemes.indexOf(xhr.channel.URI.scheme))
+        if (acceptedSchemes.indexOf(xhr.channel.URI.scheme) === -1)
         {
-            this.log("invalidRequestProtocol", [], [context, "error"]);
+            this._log("invalidRequestProtocol", [], [context, "error"]);
             this.clearLoadingMessage(loadingMsgRow);
             return;
         }
 
         xhr.send(null);
+    },
 
-        // xxxFlorent: TODO show XHR progress
+    /**
+     * Hack; Should only be used inside CommandLineInclude.
+     * Test whether the current global is under CSP.
+     *
+     * @param {Context} context
+     *
+     * @return boolean
+     */
+    isCSPDoc: function(context)
+    {
+        // Create a random variable name:
+        var varName = "_" + Math.ceil(Math.random() * 1000000);
+        var codeToEval = "window['" + varName + "']" + " = true;";
+
+        var global = context.getCurrentGlobal();
+
+        context.includePatternToBlock = codeToEval;
+        Firebug.CommandLine.evaluateInWebPage(codeToEval, context);
+        var ret = global.wrappedJSObject[varName] !== true;
+
+        if (ret)
+            delete global.wrappedJSObject[varName];
+
+        return ret;
     },
 
     // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  //
@@ -517,6 +583,23 @@ var CommandLineInclude = Obj.extend(Firebug.Module,
             StorageService.removeStorage(storeFilename);
             this.store = null;
         }
+    },
+
+    /**
+     * Hack; Should only be used inside CommandLineInclude.
+     * Intercept the display of a warning if related to the use of isCSPDoc().
+     *
+     * Event triggered by Firebug.Console.logRow().
+     */
+    onLogRowCreated: function(panel, row, context)
+    {
+        if (row && row.className.indexOf("warningMessage") !== -1 &&
+            context.includePatternToBlock &&
+            row.textContent.indexOf(context.includePatternToBlock) !== -1)
+        {
+            row.parentNode.removeChild(row);
+            context.includePatternToBlock = "";
+        }
     }
 });
 
@@ -603,6 +686,7 @@ Firebug.registerCommand("include", {
 Firebug.registerRep(CommandLineIncludeRep);
 
 Firebug.registerModule(CommandLineInclude);
+Console.addListener(CommandLineInclude);
 
 return CommandLineInclude;
 
diff --git a/content/firebug/console/console.js b/content/firebug/console/console.js
index a66d29e..142abe1 100644
--- a/content/firebug/console/console.js
+++ b/content/firebug/console/console.js
@@ -88,7 +88,7 @@ Firebug.ConsoleBase =
                     panel.limit.limitInfo.totalCount++;
                     template.updateCounter(panel.limit);
                 }
-                Events.dispatch(this.fbListeners, "onLogRowCreated", [panel, row]);
+                Events.dispatch(this.fbListeners, "onLogRowCreated", [panel, row, context]);
                 return row;
             }
         }
diff --git a/content/firebug/console/consolePanel.js b/content/firebug/console/consolePanel.js
index b3ba9e8..38c0ac1 100644
--- a/content/firebug/console/consolePanel.js
+++ b/content/firebug/console/consolePanel.js
@@ -88,6 +88,8 @@ Firebug.ConsolePanel.prototype = Obj.extend(Firebug.ActivablePanel,
     {
         Firebug.ActivablePanel.initialize.apply(this, arguments);  // loads persisted content
 
+        this.filterMatchSet = [];
+
         if (!this.persistedContent && Firebug.Console.isAlwaysEnabled())
             this.insertLogLimit(this.context);
 
diff --git a/content/firebug/firebug.js b/content/firebug/firebug.js
index 0e749cc..a623525 100644
--- a/content/firebug/firebug.js
+++ b/content/firebug/firebug.js
@@ -102,7 +102,7 @@ window.Firebug =
     // Custom stylesheets registered by extensions.
     stylesheets: [],
 
-    // xxxHonza: hack, all "Firebug.Options" occurences should be replaced by "Options"
+    // xxxHonza: hack, all "Firebug.Options" occurrences should be replaced by "Options"
     Options: Options,
 
     viewChrome: null,
@@ -668,7 +668,7 @@ window.Firebug =
         return CommandLineExposed.registerCommand(name, config);
     },
 
-    unregistereCommand: function(name)
+    unregisterCommand: function(name)
     {
         return CommandLineExposed.unregisterCommand(name);
     },
diff --git a/defaults/preferences/firebug.js b/defaults/preferences/firebug.js
index 39e3d71..243a087 100644
--- a/defaults/preferences/firebug.js
+++ b/defaults/preferences/firebug.js
@@ -170,3 +170,6 @@ pref("extensions.firebug.key.shortcut.toggleBreakOn", "accel alt b");
 
 // Accessibility
 pref("extensions.firebug.a11y.enable", false);
+
+// Known Issues
+pref("extensions.firebug.showSlowJSDMessage", true);
diff --git a/install.rdf b/install.rdf
index 6e1be5c..b8ba139 100644
--- a/install.rdf
+++ b/install.rdf
@@ -5,7 +5,7 @@
 
   <Description about="urn:mozilla:install-manifest">
     <em:id>firebug at software.joehewitt.com</em:id>
-    <em:version>1.12.2</em:version>
+    <em:version>1.12.3</em:version>
     <em:type>2</em:type>
     <em:bootstrap>true</em:bootstrap>
 
diff --git a/locale/en-US/firebug.properties b/locale/en-US/firebug.properties
index caf5cb2..bde9850 100644
--- a/locale/en-US/firebug.properties
+++ b/locale/en-US/firebug.properties
@@ -1721,7 +1721,7 @@ perftiming.bars.label=Document phases start and elapsed time relative to the doc
 perftiming.events.label=Event timing relative to the document load:
 # LOCALIZATION NOTE (perftiming.details_title, perftiming.details_title_desc): A label used
 # for detailed performance timing info table.
-perftiming.details_title=Perfomance Timing
+perftiming.details_title=Performance Timing
 perftiming.details_title_desc=Detailed timing
 # LOCALIZATION NOTE (perftiming.connectEnd, perftiming.connectStart,
 # perftiming.domContentLoadedEventEnd, perftiming.domContentLoadedEventStart,
@@ -1753,3 +1753,10 @@ perftiming.responseEnd=Time after the end of a response or connection.
 perftiming.responseStart=Time just before the start of a response.
 perftiming.unloadEventEnd=Time after the previous document is unloaded.
 perftiming.unloadEventStart=Time just before the unload event is fired.
+
+# LOCALIZATION NOTE (knownissues.message.slowJSD, knownissues.message.slowJSD.GotIt):
+# A message displayed when the Script panel is disabled. It warns users about known platform
+# problems related to JSD. The message is also displayed in the Console panel + a button that
+# allows to hide it.
+knownissues.message.slowJSD=<B>Warning:</B> Enabling the Script panel slows down tab switching and Firebug activation due to a <a>platform problem</a>. This will be fixed with the next major Firebug version.
+knownissues.message.slowJSD.GotIt=Got It
diff --git a/skin/classic/console.css b/skin/classic/console.css
index de5071b..0b69817 100644
--- a/skin/classic/console.css
+++ b/skin/classic/console.css
@@ -902,6 +902,7 @@
 
 /************************************************************************************************/
 /* include() command */
+
 .tableCommandLineInclude td {
     height: 17px;
 }
@@ -926,3 +927,10 @@
     width: 75%;
     padding-right: 0 !important; 
 }
+
+/*************************************************************************************************/
+/* Description Box */
+
+.descriptionBox B {
+    font-weight: bold;
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firebug.git



More information about the Pkg-mozext-commits mailing list