OLD | NEW |
1 (function() | 1 (function() |
2 { | 2 { |
3 let {application} = require("info"); | 3 let {application} = require("info"); |
4 if (application != "firefox") | 4 if (application != "firefox") |
5 return; | 5 return; |
6 | 6 |
7 let CustomizableUI = null; | 7 let CustomizableUI = null; |
8 let usingShim = false; | 8 let usingShim = false; |
9 try | 9 try |
10 { | 10 { |
11 ({CustomizableUI}) = Cu.import("resource:///modules/CustomizableUI.jsm", nul
l); | 11 ({CustomizableUI}) = Cu.import("resource:///modules/CustomizableUI.jsm", nul
l); |
12 } | 12 } |
13 catch (e) | 13 catch (e) |
14 { | 14 { |
15 usingShim = true; | 15 usingShim = true; |
16 // No built-in CustomizableUI API, use our own implementation. | 16 // No built-in CustomizableUI API, use our own implementation. |
17 ({CustomizableUI}) = require("customizableUI"); | 17 ({CustomizableUI}) = require("customizableUI"); |
18 } | 18 } |
19 | 19 |
20 let wnd = Utils.getChromeWindow(window); | 20 let wnd = UI.currentWindow; |
21 let defaultParent = require("appSupport").defaultToolbarPosition.parent; | 21 let defaultParent = require("appSupport").defaultToolbarPosition.parent; |
22 | 22 |
23 let toolbox; | 23 let toolbox; |
24 if (usingShim) | 24 if (usingShim) |
25 { | 25 { |
26 let toolbar = wnd.document.getElementById(defaultParent); | 26 let toolbar = wnd.document.getElementById(defaultParent); |
27 if (!toolbar) | 27 if (!toolbar) |
28 return; | 28 return; |
29 toolbox = toolbar.toolbox; | 29 toolbox = toolbar.toolbox; |
30 } | 30 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 ok(!placement, "Button is invisible"); | 86 ok(!placement, "Button is invisible"); |
87 | 87 |
88 UI.toggleToolbarIcon(); | 88 UI.toggleToolbarIcon(); |
89 placement = CustomizableUI.getPlacementOfWidget("abp-toolbarbutton"); | 89 placement = CustomizableUI.getPlacementOfWidget("abp-toolbarbutton"); |
90 ok(placement, "Button is visible"); | 90 ok(placement, "Button is visible"); |
91 if (placement) | 91 if (placement) |
92 equal(placement.area, CustomizableUI.AREA_NAVBAR, "Button is at default po
sition"); | 92 equal(placement.area, CustomizableUI.AREA_NAVBAR, "Button is at default po
sition"); |
93 }); | 93 }); |
94 | 94 |
95 })(); | 95 })(); |
OLD | NEW |