Bug 1386337 - Disable Photon page actions when Photon is not enabled. r?Gijs draft
authorDrew Willcoxon <adw@mozilla.com>
Tue, 01 Aug 2017 20:37:22 -0700
changeset 619473 c2c466bb3189c022ede9e59dda24f029bf47a7f8
parent 619442 fec8d72590053c3ad72cd3492d389213dfabc2ff
child 640407 605ed8c59ac919262314c8abf039a61179688ca8
push id71689
push userdwillcoxon@mozilla.com
push dateWed, 02 Aug 2017 03:37:36 +0000
reviewersGijs
bugs1386337
milestone56.0a1
Bug 1386337 - Disable Photon page actions when Photon is not enabled. r?Gijs MozReview-Commit-ID: 3GrsscIxeyW
browser/base/content/browser-pageActions.js
browser/modules/PageActions.jsm
browser/modules/test/browser/browser.ini
--- a/browser/base/content/browser-pageActions.js
+++ b/browser/base/content/browser-pageActions.js
@@ -42,16 +42,19 @@ var BrowserPageActions = {
     delete this.mainViewBodyNode;
     return this.mainViewBodyNode = this.mainViewNode.querySelector(".panel-subview-body");
   },
 
   /**
    * Inits.  Call to init.
    */
   init() {
+    if (!AppConstants.MOZ_PHOTON_THEME) {
+      return;
+    }
     for (let action of PageActions.actions) {
       this.placeAction(action, PageActions.insertBeforeActionIDInUrlbar(action));
     }
   },
 
   /**
    * Adds or removes as necessary DOM nodes for the given action.
    *
--- a/browser/modules/PageActions.jsm
+++ b/browser/modules/PageActions.jsm
@@ -13,31 +13,37 @@ this.EXPORTED_SYMBOLS = [
   // PageActions.ACTION_ID_BUILT_IN_SEPARATOR
 ];
 
 const { utils: Cu } = Components;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
+XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
+  "resource://gre/modules/AppConstants.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "BinarySearch",
   "resource://gre/modules/BinarySearch.jsm");
 
 
 const ACTION_ID_BOOKMARK_SEPARATOR = "bookmarkSeparator";
 const ACTION_ID_BUILT_IN_SEPARATOR = "builtInSeparator";
 
 const PREF_PERSISTED_ACTIONS = "browser.pageActions.persistedActions";
 
 
 this.PageActions = {
   /**
    * Inits.  Call to init.
    */
   init() {
+    if (!AppConstants.MOZ_PHOTON_THEME) {
+      return;
+    }
+
     let callbacks = this._deferredAddActionCalls;
     delete this._deferredAddActionCalls;
 
     this._loadPersistedActions();
 
     // Add the built-in actions, which are defined below in this file.
     for (let options of gBuiltInActions) {
       if (options._isSeparator || !this.actionForID(options.id)) {
--- a/browser/modules/test/browser/browser.ini
+++ b/browser/modules/test/browser/browser.ini
@@ -14,16 +14,17 @@ skip-if = !e10s # Bug 1373549
 support-files =
   contentSearch.js
   contentSearchBadImage.xml
   contentSearchSuggestions.sjs
   contentSearchSuggestions.xml
   !/browser/components/search/test/head.js
   !/browser/components/search/test/testEngine.xml
 [browser_PageActions.js]
+run-if = nightly_build # Photon only
 [browser_PermissionUI.js]
 [browser_PermissionUI_prompts.js]
 [browser_ProcessHangNotifications.js]
 skip-if = !e10s
 [browser_SitePermissions.js]
 [browser_SitePermissions_combinations.js]
 [browser_SitePermissions_expiry.js]
 [browser_SitePermissions_tab_urls.js]