Bug 1551183: Part 3 - Add a test to sanity check the default theme on all platforms. r=aswan a=jcristau
authorKris Maglione <maglione.k@gmail.com>
Wed, 22 May 2019 14:34:44 -0700
changeset 536753 09624608fc97fc4b52a317f965a75aebf29073c9
parent 536752 1118e4a2eb8b0e64e0dd11ca223e411e684540f8
child 536754 49a329216f65a28acdcaa77729030d7b22fadfb5
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaswan, jcristau
bugs1551183
milestone68.0
Bug 1551183: Part 3 - Add a test to sanity check the default theme on all platforms. r=aswan a=jcristau Differential Revision: https://phabricator.services.mozilla.com/D32225
toolkit/mozapps/extensions/internal/XPIDatabase.jsm
toolkit/mozapps/extensions/test/mochitest/chrome.ini
toolkit/mozapps/extensions/test/mochitest/test_default_theme.html
toolkit/mozapps/extensions/test/moz.build
--- a/toolkit/mozapps/extensions/internal/XPIDatabase.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIDatabase.jsm
@@ -391,17 +391,17 @@ class AddonInternal {
   // This matches Extension.isPrivileged with the exception of temporarily installed extensions.
   get isPrivileged() {
     return this.signedState === AddonManager.SIGNEDSTATE_PRIVILEGED ||
            this.signedState === AddonManager.SIGNEDSTATE_SYSTEM ||
            this.location.isBuiltin;
   }
 
   get hidden() {
-    return this.location.hidden || (this._hidden && this.isPrivileged);
+    return this.location.hidden || (this._hidden && this.isPrivileged) || false;
   }
 
   set hidden(val) {
     this._hidden = val;
   }
 
   get disabled() {
     return (this.userDisabled || this.appDisabled || this.softDisabled);
new file mode 100644
--- /dev/null
+++ b/toolkit/mozapps/extensions/test/mochitest/chrome.ini
@@ -0,0 +1,2 @@
+
+[test_default_theme.html]
new file mode 100644
--- /dev/null
+++ b/toolkit/mozapps/extensions/test/mochitest/test_default_theme.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <meta charset="utf-8">
+  <title>Test for correct installation of default theme</title>
+  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script src="chrome://mochikit/content/tests/SimpleTest/ExtensionTestUtils.js"></script>
+  <link rel="stylesheet" href="chrome://mochikit/contents/tests/SimpleTest/test.css">
+</head>
+<body>
+
+<script>
+"use strict";
+
+const {AddonManager} = ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
+
+add_task(async function() {
+  let addon = await AddonManager.getAddonByID("default-theme@mozilla.org");
+
+  ok(addon != null, "Default theme exists");
+  is(addon.type, "theme", "Add-on type is correct");
+  is(addon.isActive, true, "Add-on is active");
+  is(addon.hidden, false, "Add-on is not hidden");
+});
+
+</script>
+</body>
+</html>
--- a/toolkit/mozapps/extensions/test/moz.build
+++ b/toolkit/mozapps/extensions/test/moz.build
@@ -3,15 +3,16 @@
 # 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/.
 
 DIRS += ['browser']
 
 BROWSER_CHROME_MANIFESTS += ['xpinstall/browser.ini']
 MOCHITEST_MANIFESTS += ['mochitest/mochitest.ini']
+MOCHITEST_CHROME_MANIFESTS += ['mochitest/chrome.ini']
 
 XPCSHELL_TESTS_MANIFESTS += [
     'xpcshell/rs-blocklist/xpcshell.ini',
     'xpcshell/xml-blocklist/xpcshell.ini',
     'xpcshell/xpcshell-unpack.ini',
     'xpcshell/xpcshell.ini',
 ]