Backed out changeset 3a8afc1650db (bug 1311145) for mochitest browser chrome failures on browser_all_files_referenced.js.
authorCosmin Sabou <csabou@mozilla.com>
Wed, 28 Mar 2018 08:33:41 +0300
changeset 410333 5adc5494450ba08d4b3ae6cc39b8ee3dc3f16acb
parent 410332 d6ed830430a75fceb4303ad4db9ed93d9b12a2d9
child 410334 73958e9bfd07b97e2030315ac61e4f2772ce3705
child 410406 5bf126434fac78a31256c994b9dbf4b1031b0350
push id61812
push usercsabou@mozilla.com
push dateWed, 28 Mar 2018 05:34:24 +0000
treeherderautoland@5adc5494450b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1311145
milestone61.0a1
backs out3a8afc1650db3c1be5b145a7f247798d65d43338
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 3a8afc1650db (bug 1311145) for mochitest browser chrome failures on browser_all_files_referenced.js.
toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd
toolkit/locales/en-US/chrome/mozapps/extensions/extensions.properties
toolkit/mozapps/extensions/content/about.js
toolkit/mozapps/extensions/content/about.xul
toolkit/mozapps/extensions/content/extensions.js
toolkit/mozapps/extensions/content/extensions.xul
toolkit/mozapps/extensions/jar.mn
toolkit/mozapps/extensions/test/browser/addon_about.xul
toolkit/mozapps/extensions/test/browser/browser.ini
toolkit/mozapps/extensions/test/browser/browser_about.js
toolkit/mozapps/extensions/test/browser/browser_discovery.js
--- a/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd
+++ b/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd
@@ -75,16 +75,18 @@
 <!ENTITY cmd.showDetails.label                "Show More Information">
 <!ENTITY cmd.showDetails.accesskey            "S">
 <!ENTITY cmd.findUpdates.label                "Find Updates">
 <!ENTITY cmd.findUpdates.accesskey            "F">
 <!ENTITY cmd.preferencesWin.label             "Options">
 <!ENTITY cmd.preferencesWin.accesskey         "O">
 <!ENTITY cmd.preferencesUnix.label            "Preferences">
 <!ENTITY cmd.preferencesUnix.accesskey        "P">
+<!ENTITY cmd.about.label                      "About">
+<!ENTITY cmd.about.accesskey                  "A">
 
 <!ENTITY cmd.enableAddon.label                "Enable">
 <!ENTITY cmd.enableAddon.accesskey            "E">
 <!ENTITY cmd.disableAddon.label               "Disable">
 <!ENTITY cmd.disableAddon.accesskey           "D">
 <!ENTITY cmd.enableTheme.label                "Wear Theme">
 <!ENTITY cmd.enableTheme.accesskey            "W">
 <!ENTITY cmd.disableTheme.label               "Stop Wearing Theme">
--- a/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.properties
+++ b/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.properties
@@ -1,12 +1,20 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+#LOCALIZATION NOTE (aboutWindowTitle) %S is the addon name
+aboutWindowTitle=About %S
+aboutWindowCloseButton=Close
+#LOCALIZATION NOTE (aboutWindowVersionString) %S is the addon version
+aboutWindowVersionString=version %S
+#LOCALIZATION NOTE (aboutAddon) %S is the addon name
+aboutAddon=About %S
+
 #LOCALIZATION NOTE (uninstallNotice) %S is the add-on name
 uninstallNotice=%S has been removed.
 
 #LOCALIZATION NOTE (numReviews): Semicolon-separated list of plural forms.
 # See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
 # #1 is the number of reviews
 numReviews=#1 review;#1 reviews
 
new file mode 100644
--- /dev/null
+++ b/toolkit/mozapps/extensions/content/about.js
@@ -0,0 +1,104 @@
+// -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
+
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+/* import-globals-from ../../../content/contentAreaUtils.js */
+
+/* exported init, loadHomepage */
+
+ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
+
+function init() {
+  var addon = window.arguments[0];
+  var extensionsStrings = document.getElementById("extensionsStrings");
+
+  document.documentElement.setAttribute("addontype", addon.type);
+
+  var iconURL = AddonManager.getPreferredIconURL(addon, 48, window);
+  if (iconURL) {
+    var extensionIcon = document.getElementById("extensionIcon");
+    extensionIcon.src = iconURL;
+  }
+
+  document.title = extensionsStrings.getFormattedString("aboutWindowTitle", [addon.name]);
+  var extensionName = document.getElementById("extensionName");
+  extensionName.textContent = addon.name;
+
+  var extensionVersion = document.getElementById("extensionVersion");
+  if (addon.version)
+    extensionVersion.setAttribute("value", extensionsStrings.getFormattedString("aboutWindowVersionString", [addon.version]));
+  else
+    extensionVersion.hidden = true;
+
+  var extensionDescription = document.getElementById("extensionDescription");
+  if (addon.description)
+    extensionDescription.textContent = addon.description;
+  else
+    extensionDescription.hidden = true;
+
+  var numDetails = 0;
+
+  var extensionCreator = document.getElementById("extensionCreator");
+  if (addon.creator) {
+    extensionCreator.setAttribute("value", addon.creator);
+    numDetails++;
+  } else {
+    extensionCreator.hidden = true;
+    var extensionCreatorLabel = document.getElementById("extensionCreatorLabel");
+    extensionCreatorLabel.hidden = true;
+  }
+
+  var extensionHomepage = document.getElementById("extensionHomepage");
+  var homepageURL = addon.homepageURL;
+  if (homepageURL) {
+    extensionHomepage.setAttribute("homepageURL", homepageURL);
+    extensionHomepage.setAttribute("tooltiptext", homepageURL);
+    numDetails++;
+  } else {
+    extensionHomepage.hidden = true;
+  }
+
+  numDetails += appendToList("extensionDevelopers", "developersBox", addon.developers);
+  numDetails += appendToList("extensionTranslators", "translatorsBox", addon.translators);
+  numDetails += appendToList("extensionContributors", "contributorsBox", addon.contributors);
+
+  if (numDetails == 0) {
+    var groove = document.getElementById("groove");
+    groove.hidden = true;
+    var extensionDetailsBox = document.getElementById("extensionDetailsBox");
+    extensionDetailsBox.hidden = true;
+  }
+
+  var acceptButton = document.documentElement.getButton("accept");
+  acceptButton.label = extensionsStrings.getString("aboutWindowCloseButton");
+
+  setTimeout(sizeToContent, 0);
+}
+
+function appendToList(aHeaderId, aNodeId, aItems) {
+  var header = document.getElementById(aHeaderId);
+  var node = document.getElementById(aNodeId);
+
+  if (!aItems || aItems.length == 0) {
+    header.hidden = true;
+    return 0;
+  }
+
+  for (let currentItem of aItems) {
+    var label = document.createElement("label");
+    label.textContent = currentItem;
+    label.setAttribute("class", "contributor");
+    node.appendChild(label);
+  }
+
+  return aItems.length;
+}
+
+function loadHomepage(aEvent) {
+  window.close();
+  openURL(aEvent.target.getAttribute("homepageURL"));
+}
new file mode 100644
--- /dev/null
+++ b/toolkit/mozapps/extensions/content/about.xul
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this
+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> 
+<?xml-stylesheet href="chrome://mozapps/skin/extensions/about.css" type="text/css"?> 
+
+<!DOCTYPE dialog SYSTEM "chrome://mozapps/locale/extensions/about.dtd">
+
+<dialog id="genericAbout"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+        onload="init();"
+        buttons="accept"
+        buttoniconaccept="close"
+        onaccept="close();">
+
+  <script type="application/javascript" src="chrome://mozapps/content/extensions/about.js"/>
+  <script type="application/javascript" src="chrome://global/content/contentAreaUtils.js"/>
+
+  <stringbundleset id="aboutSet">
+    <stringbundle id="extensionsStrings" src="chrome://mozapps/locale/extensions/extensions.properties"/>
+  </stringbundleset>
+
+  <vbox id="clientBox" flex="1">
+    <hbox class="basic-info">
+      <vbox pack="center">
+        <image id="extensionIcon"/>
+      </vbox>
+      <vbox flex="1">
+        <label id="extensionName"/>
+        <label id="extensionVersion" crop="end"/>
+      </vbox>
+    </hbox>
+    <description id="extensionDescription" class="boxIndent"/>
+
+    <separator id="groove" class="groove"/>
+
+    <vbox id="extensionDetailsBox" flex="1">
+      <label id="extensionCreatorLabel" class="sectionTitle">&creator.label;</label>
+      <hbox id="creatorBox" class="boxIndent">
+        <label id="extensionCreator" flex="1" crop="end"/>
+        <label id="extensionHomepage" onclick="if (event.button == 0) { loadHomepage(event); }"
+               class="text-link" value="&homepage.label;"/>
+      </hbox>
+  
+      <label id="extensionDevelopers" class="sectionTitle">&developers.label;</label>
+      <vbox flex="1" id="developersBox" class="boxIndent"/>
+      <label id="extensionTranslators" class="sectionTitle">&translators.label;</label>
+      <vbox flex="1" id="translatorsBox" class="boxIndent"/>
+      <label id="extensionContributors" class="sectionTitle">&contributors.label;</label>
+      <vbox flex="1" id="contributorsBox" class="boxIndent"/>
+    </vbox>
+  </vbox>
+
+</dialog>
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -146,16 +146,17 @@ function initialize(event) {
     gDragDrop.onDragOver(event);
   });
   addonPage.addEventListener("drop", function(event) {
     gDragDrop.onDrop(event);
   });
   addonPage.addEventListener("keypress", function(event) {
     gHeader.onKeyPress(event);
   });
+
   if (!isDiscoverEnabled()) {
     gViewDefault = "addons://list/extension";
   }
 
   gViewController.initialize();
   gCategories.initialize();
   gHeader.initialize();
   gEventManager.initialize();
@@ -852,19 +853,18 @@ var gViewController = {
 
   loadViewInternal(aViewId, aPreviousView, aState) {
     var view = this.parseViewId(aViewId);
 
     if (!view.type || !(view.type in this.viewObjects))
       throw Components.Exception("Invalid view: " + view.type);
 
     var viewObj = this.viewObjects[view.type];
-    if (!viewObj.node) {
+    if (!viewObj.node)
       throw Components.Exception("Root node doesn't exist for '" + view.type + "' view");
-    }
 
     if (this.currentViewObj && aViewId != aPreviousView) {
       try {
         let canHide = this.currentViewObj.hide();
         if (canHide === false)
           return;
         this.displayedView.removeAttribute("loading");
       } catch (e) {
@@ -1160,16 +1160,31 @@ var gViewController = {
         if (hasInlineOptions(aAddon)) {
           gViewController.commands.cmd_showItemDetails.doCommand(aAddon, true);
         } else if (aAddon.optionsType == AddonManager.OPTIONS_TYPE_TAB) {
           openOptionsInTab(aAddon.optionsURL);
         }
       }
     },
 
+    cmd_showItemAbout: {
+      isEnabled(aAddon) {
+        // XXXunf This may be applicable to install items too. See bug 561260
+        return !!aAddon;
+      },
+      doCommand(aAddon) {
+        var aboutURL = aAddon.aboutURL;
+        if (aboutURL)
+          openDialog(aboutURL, "", "chrome,centerscreen,modal", aAddon);
+        else
+          openDialog("chrome://mozapps/content/extensions/about.xul",
+                     "", "chrome,centerscreen,modal", aAddon);
+      }
+    },
+
     cmd_enableItem: {
       isEnabled(aAddon) {
         if (!aAddon)
           return false;
         let addonType = AddonManager.addonTypes[aAddon.type];
         return (!(addonType.flags & AddonManager.TYPE_SUPPORTS_ASK_TO_ACTIVATE) &&
                 hasPermission(aAddon, "enable"));
       },
@@ -1758,20 +1773,16 @@ var gCategories = {
     this.node.value = gViewDefault;
     this.node.value = Services.prefs.getStringPref(PREF_UI_LASTCATEGORY, "");
 
     // If there was no last view or no existing category matched the last view
     // then switch to the default category
     if (!this.node.selectedItem) {
       this.node.value = gViewDefault;
     }
-    // If the previous node is the discover panel which has since been disabled set to default
-    if (this.node.value == "addons://discover/" && !isDiscoverEnabled()) {
-      this.node.value = gViewDefault;
-    }
 
     this.node.addEventListener("select", () => {
       gViewController.loadView(this.node.selectedItem.value);
     });
 
     this.node.addEventListener("click", (aEvent) => {
       var selectedItem = this.node.selectedItem;
       if (aEvent.target.localName == "richlistitem" &&
--- a/toolkit/mozapps/extensions/content/extensions.xul
+++ b/toolkit/mozapps/extensions/content/extensions.xul
@@ -59,16 +59,19 @@
                 accesskey="&cmd.preferencesWin.accesskey;"/>
 #else
                 label="&cmd.preferencesUnix.label;"
                 accesskey="&cmd.preferencesUnix.accesskey;"/>
 #endif
       <menuitem id="menuitem_findUpdates" command="cmd_findItemUpdates"
                 label="&cmd.findUpdates.label;"
                 accesskey="&cmd.findUpdates.accesskey;"/>
+      <menuitem id="menuitem_about" command="cmd_showItemAbout"
+                label="&cmd.about.label;"
+                accesskey="&cmd.about.accesskey;"/>
     </menupopup>
 
     <menulist popuponly="true" id="ContentSelectDropdown" hidden="true">
       <menupopup rolluponmousewheel="true"
                  activateontab="true" position="after_start"
                  level="parent"
 #ifdef XP_WIN
                  consumeoutsideclicks="false" ignorekeys="shortcuts"
@@ -111,16 +114,17 @@
   </commandset>
 
   <!-- view commands - these act on the selected addon -->
   <commandset id="viewCommandSet"
               events="richlistbox-select" commandupdater="true">
     <command id="cmd_showItemDetails"/>
     <command id="cmd_findItemUpdates"/>
     <command id="cmd_showItemPreferences"/>
+    <command id="cmd_showItemAbout"/>
     <command id="cmd_enableItem"/>
     <command id="cmd_disableItem"/>
     <command id="cmd_installItem"/>
     <command id="cmd_uninstallItem"/>
     <command id="cmd_cancelUninstallItem"/>
     <command id="cmd_cancelOperation"/>
     <command id="cmd_contribute"/>
     <command id="cmd_askToActivateItem"/>
--- a/toolkit/mozapps/extensions/jar.mn
+++ b/toolkit/mozapps/extensions/jar.mn
@@ -5,16 +5,18 @@
 toolkit.jar:
 #ifndef MOZ_FENNEC
 % content mozapps %content/mozapps/
 * content/mozapps/extensions/extensions.xul                     (content/extensions.xul)
   content/mozapps/extensions/extensions.css                     (content/extensions.css)
   content/mozapps/extensions/extensions.js                      (content/extensions.js)
 * content/mozapps/extensions/extensions.xml                     (content/extensions.xml)
   content/mozapps/extensions/updateinfo.xsl                     (content/updateinfo.xsl)
+  content/mozapps/extensions/about.xul                          (content/about.xul)
+  content/mozapps/extensions/about.js                           (content/about.js)
   content/mozapps/extensions/blocklist.xul                      (content/blocklist.xul)
   content/mozapps/extensions/blocklist.js                       (content/blocklist.js)
   content/mozapps/extensions/blocklist.css                      (content/blocklist.css)
   content/mozapps/extensions/blocklist.xml                      (content/blocklist.xml)
   content/mozapps/extensions/update.html                        (content/update.html)
   content/mozapps/extensions/update.js                          (content/update.js)
   content/mozapps/extensions/update.css                         (content/update.css)
   content/mozapps/extensions/eula.xul                           (content/eula.xul)
new file mode 100644
--- /dev/null
+++ b/toolkit/mozapps/extensions/test/browser/addon_about.xul
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+        id="addon-test-about-window">
+  <label value="Oh hai!"/>
+</window>
--- a/toolkit/mozapps/extensions/test/browser/browser.ini
+++ b/toolkit/mozapps/extensions/test/browser/browser.ini
@@ -1,12 +1,13 @@
 [DEFAULT]
 tags = addons
 support-files =
   addons/*
+  addon_about.xul
   addon_prefs.xul
   discovery.html
   head.js
   more_options.xul
   options.xul
   plugin_test.html
   redirect.sjs
   releaseNotes.xhtml
@@ -26,16 +27,18 @@ support-files =
   !/toolkit/mozapps/extensions/test/xpinstall/theme.xpi
   !/toolkit/mozapps/extensions/test/xpinstall/unsigned.xpi
   !/toolkit/mozapps/extensions/test/xpinstall/amosigned.xpi
   !/toolkit/mozapps/extensions/test/xpinstall/amosigned-restart-required.xpi
 
 [browser_CTP_plugins.js]
 tags = blocklist
 skip-if = buildapp == 'mulet'
+[browser_about.js]
+skip-if = os == 'linux' || os == 'win' # bug 632290
 [browser_bug523784.js]
 [browser_bug562797.js]
 [browser_bug562854.js]
 [browser_bug562890.js]
 skip-if = os == 'win' && !debug # Disabled on Windows opt/PGO builds due to intermittent failures (bug 1135866)
 [browser_bug562899.js]
 skip-if = buildapp == 'mulet'
 [browser_bug562992.js]
new file mode 100644
--- /dev/null
+++ b/toolkit/mozapps/extensions/test/browser/browser_about.js
@@ -0,0 +1,84 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+/**
+ * Tests the default and custom "about" dialogs of add-ons.
+ *
+ * Test for bug 610661 <https://bugzilla.mozilla.org/show_bug.cgi?id=610661>:
+ * Addon object not passed to custom about dialogs.
+ */
+
+var gManagerWindow;
+
+const URI_ABOUT_DEFAULT = "chrome://mozapps/content/extensions/about.xul";
+const URI_ABOUT_CUSTOM = CHROMEROOT + "addon_about.xul";
+
+function test() {
+  requestLongerTimeout(2);
+
+  waitForExplicitFinish();
+
+  var gProvider = new MockProvider();
+  gProvider.createAddons([{
+    id: "test1@tests.mozilla.org",
+    name: "Test add-on 1",
+    description: "foo"
+  },
+  {
+    id: "test2@tests.mozilla.org",
+    name: "Test add-on 2",
+    description: "bar",
+    aboutURL: URI_ABOUT_CUSTOM
+  }]);
+
+  open_manager("addons://list/extension", function(aManager) {
+    gManagerWindow = aManager;
+
+    test_about_window("Test add-on 1", URI_ABOUT_DEFAULT, function() {
+      test_about_window("Test add-on 2", URI_ABOUT_CUSTOM, function() {
+        close_manager(gManagerWindow, finish);
+      });
+    });
+  });
+}
+
+function test_about_window(aAddonItemName, aExpectedAboutUri, aCallback) {
+  var addonList = gManagerWindow.document.getElementById("addon-list");
+  for (var addonItem of addonList.childNodes) {
+    if (addonItem.hasAttribute("name") &&
+        addonItem.getAttribute("name") === aAddonItemName)
+      break;
+  }
+
+  info("Waiting for about dialog");
+  Services.ww.registerNotification(function TEST_ww_observer(aSubject, aTopic,
+                                                             aData) {
+    if (aTopic == "domwindowclosed") {
+      Services.ww.unregisterNotification(TEST_ww_observer);
+
+      info("About dialog closed, waiting for focus on browser window");
+      waitForFocus(() => executeSoon(aCallback));
+    } else if (aTopic == "domwindowopened") {
+      info("About dialog opened, waiting for focus");
+
+      let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
+      waitForFocus(function() {
+        info("Saw about dialog");
+
+        is(win.location,
+           aExpectedAboutUri,
+           "The correct add-on about window should have opened");
+
+        is(win.arguments && win.arguments[0] && win.arguments[0].name,
+           aAddonItemName,
+           "window.arguments[0] should refer to the add-on object");
+
+        executeSoon(() => win.close());
+      }, win);
+    }
+  });
+
+  gManagerWindow.gViewController.doCommand("cmd_showItemAbout",
+                                           addonItem.mAddon);
+}
--- a/toolkit/mozapps/extensions/test/browser/browser_discovery.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_discovery.js
@@ -510,17 +510,17 @@ add_test(function() {
     // This will actually stop the about:blank load
     browser.stop();
   });
 });
 
 // Test for Bug 703929 - Loading the discover view from a chrome XUL file fails when
 // the add-on manager is reopened.
 add_test(function() {
-  const url = "chrome://mochitests/content/" + RELATIVE_DIR + "addon_prefs.xul";
+  const url = "chrome://mochitests/content/" + RELATIVE_DIR + "addon_about.xul";
   Services.prefs.setCharPref(PREF_DISCOVERURL, url);
 
   open_manager("addons://discover/", function(aWindow) {
     gManagerWindow = aWindow;
     gCategoryUtilities = new CategoryUtilities(gManagerWindow);
 
     var browser = gManagerWindow.document.getElementById("discover-browser");
     is(getURL(browser), url, "Loading a chrome XUL file should work");