[Pkg-mozext-commits] [firebug] 09/16: Update notification message

David Prévot taffit at moszumanska.debian.org
Sun Feb 7 19:14:47 UTC 2016


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

taffit pushed a commit to branch master
in repository firebug.

commit 27171345f06ec4ae814b58ca697131c1cd33b967
Author: Jan Odvarko <odvarko at gmail.com>
Date:   Thu Jan 28 16:58:24 2016 +0100

    Update notification message
---
 .../content/firebug/firefox/browserOverlay.css     |  11 ++
 .../content/firebug/firefox/browserOverlay.js      |  94 +++++++++++++-
 .../firefox/newMultiprocessNotificationPanel.xml   | 137 +++++++++++++++++++++
 .../en-US/multiprocess-notification.properties     |  11 +-
 4 files changed, 249 insertions(+), 4 deletions(-)

diff --git a/extension/content/firebug/firefox/browserOverlay.css b/extension/content/firebug/firefox/browserOverlay.css
index 89904ac..6ddcfda 100644
--- a/extension/content/firebug/firefox/browserOverlay.css
+++ b/extension/content/firebug/firefox/browserOverlay.css
@@ -200,6 +200,10 @@ fbMultiprocessNotificationPanel {
     -moz-binding: url("chrome://firebug/content/firefox/multiprocessNotificationPanel.xml#panel");
 }
 
+fbNewMultiprocessNotificationPanel {
+    -moz-binding: url("chrome://firebug/content/firefox/newMultiprocessNotificationPanel.xml#panel");
+}
+
 fbAuroraNotificationPanel {
     -moz-binding: url("chrome://firebug/content/firefox/auroraNotificationPanel.xml#panel");
 }
@@ -210,12 +214,14 @@ fbUpgradeNotificationPanel {
 
 fbUpgradeNotificationPanel .iconbox,
 fbAuroraNotificationPanel .iconbox,
+fbNewMultiprocessNotificationPanel .iconbox,
 fbMultiprocessNotificationPanel .iconbox {
     padding-right: 10px;
 }
 
 fbUpgradeNotificationPanel .desc,
 fbAuroraNotificationPanel .desc,
+fbNewMultiprocessNotificationPanel .desc,
 fbMultiprocessNotificationPanel .desc {
     max-width: 300px;
 }
@@ -225,24 +231,29 @@ fbUpgradeNotificationPanel .title {
     font-size: 16px;
 }
 
+fbNewMultiprocessNotificationPanel .warn,
 fbMultiprocessNotificationPanel .warn {
     max-width: 275px;
 }
 
+fbNewMultiprocessNotificationPanel .warn,
 fbMultiprocessNotificationPanel .warn {
     color: gray;
 }
 
+fbNewMultiprocessNotificationPanel .warningbox,
 fbMultiprocessNotificationPanel .warningbox {
     margin-top: 15px;
 }
 
+fbNewMultiprocessNotificationPanel .warningicon,
 fbMultiprocessNotificationPanel .warningicon {
     margin-right: 4px;
 }
 
 fbUpgradeNotificationPanel .progress,
 fbAuroraNotificationPanel .progress,
+fbNewMultiprocessNotificationPanel .progress,
 fbMultiprocessNotificationPanel .progress {
     margin: 8px;
 }
diff --git a/extension/content/firebug/firefox/browserOverlay.js b/extension/content/firebug/firefox/browserOverlay.js
index 424eaf9..87df700 100644
--- a/extension/content/firebug/firefox/browserOverlay.js
+++ b/extension/content/firebug/firefox/browserOverlay.js
@@ -13,9 +13,10 @@ define([
     "firebug/firefox/browserMenu",
     "firebug/firefox/browserToolbar",
     "firebug/lib/system",
+    "firebug/lib/devtools",
 ],
 function(FBTrace, Options, Locale, Events, Arr, Str, Xpcom, BrowserOverlayLib,
-    BrowserCommands, BrowserMenu, BrowserToolbar, System) {
+    BrowserCommands, BrowserMenu, BrowserToolbar, System, DevTools) {
 
 // ********************************************************************************************* //
 // Constants
@@ -150,13 +151,18 @@ BrowserOverlay.prototype =
     {
         // Special case for e10s enabled browser.
         if (this.isMultiprocessEnabled()) {
+            this.showNewMultiprocessNotification();
+            return;
+        }
+
+        /*if (this.isMultiprocessEnabled()) {
             this.showMultiprocessNotification();
             return;
         }
         else if (this.isAuroraChannel()) {
             this.showAuroraNotification();
             return;
-        }
+        }*/
 
         if (this.win.Firebug.waitingForFirstLoad)
             return;
@@ -748,6 +754,28 @@ BrowserOverlay.prototype =
         panel.open();
     },
 
+    showNewMultiprocessNotification: function()
+    {
+        if (Options.get("noMultiprocessMessage"))
+        {
+          this.toggleDevTools();
+          return;
+        }
+
+        var popupSet = $(this.doc, "mainPopupSet");
+        var panel = this.doc.querySelector("fbNewMultiprocessNotificationPanel");
+        if (!panel)
+        {
+            panel = this.doc.createElement("fbNewMultiprocessNotificationPanel");
+            panel.setAttribute("opendevtoolscommand", "Firebug.browserOverlay.onOpenDevTools(event, 'fbMultiprocessNotificationPanel')");
+            panel.setAttribute("disablecommand", "Firebug.browserOverlay.onDisableE10s(event)");
+            popupSet.appendChild(panel);
+        }
+
+        panel.internationalize(Locale);
+        panel.open();
+    },
+
     onDisableE10s: function(event)
     {
       Events.cancelEvent(event);
@@ -757,9 +785,37 @@ BrowserOverlay.prototype =
       Options.setPref("browser.tabs", "remote.autostart", false);
       Options.setPref("browser.tabs", "remote.autostart.1", false);
 
+      var panel = this.doc.querySelector("fbNewMultiprocessNotificationPanel");
+      Options.set("noMultiprocessMessage", panel.notAgain.checked);
+
       restartFirefox();
     },
 
+    onOpenDevTools: function(event)
+    {
+      Events.cancelEvent(event);
+
+      var panel = this.doc.querySelector("fbNewMultiprocessNotificationPanel");
+      Options.set("noMultiprocessMessage", panel.notAgain.checked);
+
+      panel.close();
+
+      this.toggleDevTools(true);
+    },
+
+    toggleDevTools: function(forceOpen) {
+      var toolbox = getToolbox(this.win);
+      if (toolbox && forceOpen) {
+        return;
+      }
+
+      if (toolbox) {
+        destroyToolbox(this.win);
+      } else {
+        showToolbox(this.win);
+      }
+    },
+
     onUpgradeFirebug: function(event, panelId)
     {
         Events.cancelEvent(event);
@@ -852,6 +908,8 @@ BrowserOverlay.prototype =
     },
 };
 
+// Helpers
+
 function findFirebugUpdate(callback)
 {
     var xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance();
@@ -892,11 +950,41 @@ function findFirebugUpdate(callback)
     xhr.send(null);
 }
 
-function restartFirefox() {
+function restartFirefox()
+{
     Cc["@mozilla.org/toolkit/app-startup;1"].getService(Ci.nsIAppStartup).
         quit(Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit);
 }
 
+function getCurrentTab(win)
+{
+    let browserDoc = win.top.document;
+    let browser = browserDoc.getElementById("content");
+    return browser.selectedTab;
+}
+
+function showToolbox(win)
+{
+    let tab = getCurrentTab(win);
+    let target = DevTools.devtools.TargetFactory.forTab(tab);
+    return DevTools.gDevTools.showToolbox(target);
+}
+
+function destroyToolbox(win)
+{
+    let toolbox = getToolbox(win);
+    if (toolbox) {
+      return toolbox.destroy();
+    }
+}
+
+function getToolbox(win)
+{
+    let tab = getCurrentTab(win);
+    let target = DevTools.devtools.TargetFactory.forTab(tab);
+    return DevTools.gDevTools.getToolbox(target);
+}
+
 // ********************************************************************************************* //
 // Registration
 
diff --git a/extension/content/firebug/firefox/newMultiprocessNotificationPanel.xml b/extension/content/firebug/firefox/newMultiprocessNotificationPanel.xml
new file mode 100644
index 0000000..29754ff
--- /dev/null
+++ b/extension/content/firebug/firefox/newMultiprocessNotificationPanel.xml
@@ -0,0 +1,137 @@
+<?xml version="1.0"?>
+<!-- See license.txt for terms of usage -->
+
+<bindings xmlns="http://www.mozilla.org/xbl"
+    xmlns:xbl="http://www.mozilla.org/xbl"
+    xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+    xmlns:html="http://www.w3.org/1999/xhtml">
+
+<binding id="panel">
+    <resources>
+      <stylesheet src="chrome://global/skin/notification.css"/>
+    </resources>
+    <content>
+        <xul:panel anonid="panel" norestorefocus="true" noautofocus="true"
+            ignorekeys="true" role="presentation" type="arrow" class="panel">
+            <xul:hbox>
+                <xul:vbox class="iconbox">
+                    <xul:image src="chrome://firebug/skin/firebug64.png"/>
+                </xul:vbox>
+                <xul:vbox>
+                    <xul:description anonid="desc" class="desc" />
+
+                    <xul:hbox class="warningbox"></xul:hbox>
+
+                    <xul:description anonid="desc2" class="desc" />
+
+                    <xul:label anonid="learnMore"
+                        class="text-link popup-notification-learnmore-link learnMore"
+                        href="https://getfirebug.com/firebug3"/>
+
+                    <xul:hbox class="warningbox">
+                        <xul:vbox>
+                            <xul:spacer flex="1"/>
+                            <xul:image src="chrome://firebug/skin/warning.svg" class="warningicon"/>
+                            <xul:spacer flex="1"/>
+                        </xul:vbox>
+                        <xul:vbox>
+                            <xul:description anonid="warning" class="warn" />
+                        </xul:vbox>
+                    </xul:hbox>
+
+                    <xul:hbox class="warningbox">
+                        <xul:vbox>
+                            <xul:checkbox anonid="notAgain" checked="false"/>
+                        </xul:vbox>
+                    </xul:hbox>
+
+                    <xul:hbox class="warningbox" style="height: 10px;"></xul:hbox>
+
+                    <xul:hbox align="right">
+                        <xul:progressmeter anonid="progress" class="progress"
+                            mode="determined" value="0" collapsed="true"/>
+                        <xul:spacer width="20px" />
+                        <xul:button anonid="opendevtools" type="menu-button"
+                            xbl:inherits="oncommand=opendevtoolscommand"
+                            class="popup-notification-menubutton">
+                            <xul:menupopup>
+                                <xul:menuitem anonid="disable"
+                                    xbl:inherits="oncommand=disablecommand"/>
+                            </xul:menupopup>
+                        </xul:button>
+                    </xul:hbox>
+                </xul:vbox>
+            </xul:hbox>
+        </xul:panel>
+    </content>
+
+    <implementation>
+        <constructor><![CDATA[
+        ]]></constructor>
+
+        <method name="internationalize">
+            <parameter name="Locale" />
+            <body><![CDATA[
+                var desc = document.getAnonymousElementByAttribute(this, "anonid", "desc");
+                desc.textContent = Locale.$STR("multiprocess.description");
+
+                var desc2 = document.getAnonymousElementByAttribute(this, "anonid", "desc2");
+                desc2.textContent = Locale.$STR("multiprocess.description2");
+
+                var warn = document.getAnonymousElementByAttribute(this, "anonid", "warning");
+                warn.textContent = Locale.$STR("multiprocess.warning2");
+
+                var learnMore = document.getAnonymousElementByAttribute(this, "anonid", "learnMore");
+                learnMore.textContent = Locale.$STR("multiprocess.learnMore");
+
+                var notAgain = document.getAnonymousElementByAttribute(this, "anonid", "notAgain");
+                notAgain.label = Locale.$STR("multiprocess.notAgain");
+
+                var openDevToolsButton = document.getAnonymousElementByAttribute(this, "anonid", "opendevtools");
+                openDevToolsButton.label = Locale.$STR("multiprocess.openDevTools");
+
+                var disableMenu = document.getAnonymousElementByAttribute(this, "anonid", "disable");
+                disableMenu.label = Locale.$STR("multiprocess.disable");
+            ]]></body>
+        </method>
+
+        <method name="open">
+            <body><![CDATA[
+                var offsetY = 0;
+                var offsetX = 0;
+                var target = document.getElementById("nav-bar-customization-target");
+
+                var startButton = document.getElementById("firebug-button");
+                if (startButton) {
+                    var style = document.defaultView.getComputedStyle(startButton.button);
+                    offsetY = parseInt(style["padding-bottom"]);
+                    offsetX = parseInt(style["width"])/2;
+                    target = startButton.button;
+                }
+
+                var panel = document.getAnonymousElementByAttribute(this, "anonid", "panel");
+                panel.openPopup(target, "after_end", -offsetX, -offsetY, false, false);
+            ]]></body>
+        </method>
+
+        <method name="close">
+            <body><![CDATA[
+                var panel = document.getAnonymousElementByAttribute(this, "anonid", "panel");
+                panel.hidePopup();
+            ]]></body>
+        </method>
+
+        <property name="openDevToolsButton">
+            <getter><![CDATA[
+                return document.getAnonymousElementByAttribute(this, "anonid", "opendevtools");
+            ]]></getter>
+        </property>
+
+        <property name="notAgain">
+            <getter><![CDATA[
+                return document.getAnonymousElementByAttribute(this, "anonid", "notAgain");
+            ]]></getter>
+        </property>
+    </implementation>
+</binding>
+</bindings>
diff --git a/extension/locale/en-US/multiprocess-notification.properties b/extension/locale/en-US/multiprocess-notification.properties
index d62e42b..ad992ad 100644
--- a/extension/locale/en-US/multiprocess-notification.properties
+++ b/extension/locale/en-US/multiprocess-notification.properties
@@ -2,13 +2,22 @@
 # multiprocess.upgrade, multiprocess.disable, multiprocess.cancel):
 # Label used in a notification panel that is displayed when the user clicks on Firebug start
 # button in multiprocess Firefox browser (e10s enabled browser).
-multiprocess.description=Firebug 2 doesn't work with multiprocess Firefox (e10s). So you need to either disable e10s or upgrade to Firebug 3 alpha.
+multiprocess.description=Firebug 2 doesn't work with multiprocess Firefox (e10s). So, you need to either disable e10s or open Firefox Developer Tools.
 multiprocess.learnMore=Learn more...
 multiprocess.warning=Firebug 3 alpha is based on the built-in Firefox developer tools so Firebug 2 addons don't work just yet, however turning off e10s should only be a temporary measure since it brings performance, stability and security advantages.
 multiprocess.upgrade=Upgrade and Restart
 multiprocess.disable=Disable e10s and Restart
 multiprocess.cancel=Cancel
 
+# LOCALIZATION NOTE (multiprocess.notAgain, multiprocess.description2,
+# multiprocess.openDevTools, multiprocess.warning2): Label used in a new notification panel
+# that is displayed when the user clicks on Firebug start button in multiprocess
+# Firefox browser (e10s enabled browser).
+multiprocess.description2=We've ported many Firebug features into built-in tools in order to support existing Firebug users so, go ahead and check it out!
+multiprocess.openDevTools=Open Firefox Developer Tools
+multiprocess.warning2=Turning off e10s should only be a temporary measure since it brings performance, stability and security advantages.
+multiprocess.notAgain=Do not display this message again
+
 # LOCALIZATION NOTE (aurora.description, aurora.description2, aurora.notnow, aurora.nothanks):
 # Label used in a notification panel that is displayed when the user clicks on Firebug start
 # button in Aurora (Firefox) channel.

-- 
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