Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/ui.js

Issue 5705421486555136: First run page and subscription on install fix (FF for android) (Closed)
Patch Set: check if CustomizableUI is set in isToolbarIconVisible() and toggleToolbarIcon() methods Created April 25, 2014, 3:03 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/ui.js
===================================================================
--- a/lib/ui.js
+++ b/lib/ui.js
@@ -32,16 +32,7 @@
let {Notification} = require("notification");
let {initAntiAdblockNotification} = require("antiadblockInit");
-let CustomizableUI;
-try
-{
- ({CustomizableUI}) = Cu.import("resource:///modules/CustomizableUI.jsm", null);
-}
-catch (e)
-{
- // No built-in CustomizableUI API, use our own implementation.
- ({CustomizableUI}) = require("customizableUI");
-}
+let CustomizableUI = null;
/**
* Filter corresponding with "disable on site" menu item (set in fillIconMent()).
@@ -412,6 +403,16 @@
let {defaultToolbarPosition} = require("appSupport");
if ("abp-toolbarbutton" in this.overlay && defaultToolbarPosition)
{
+ try
+ {
+ ({CustomizableUI}) = Cu.import("resource:///modules/CustomizableUI.jsm", null);
+ }
+ catch (e)
+ {
+ // No built-in CustomizableUI API, use our own implementation.
+ ({CustomizableUI}) = require("customizableUI");
+ }
+
CustomizableUI.createWidget({
id: "abp-toolbarbutton",
type: "custom",
@@ -1034,6 +1035,8 @@
*/
toggleToolbarIcon: function()
{
+ if (!CustomizableUI)
+ return;
if (this.isToolbarIconVisible())
CustomizableUI.removeWidgetFromArea("abp-toolbarbutton");
else
@@ -1708,6 +1711,8 @@
*/
isToolbarIconVisible: function() /**Boolean*/
{
+ if (!CustomizableUI)
+ return false;
let placement = CustomizableUI.getPlacementOfWidget("abp-toolbarbutton");
return !!placement;
},
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld