Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | "use strict"; |
michael@0 | 6 | |
michael@0 | 7 | // Calling CustomizableUI.registerArea twice with no |
michael@0 | 8 | // properties should not throw an exception. |
michael@0 | 9 | add_task(function() { |
michael@0 | 10 | try { |
michael@0 | 11 | CustomizableUI.registerArea("area-996364", {}); |
michael@0 | 12 | CustomizableUI.registerArea("area-996364", {}); |
michael@0 | 13 | } catch (ex) { |
michael@0 | 14 | ok(false, ex.message); |
michael@0 | 15 | } |
michael@0 | 16 | |
michael@0 | 17 | CustomizableUI.unregisterArea("area-996364", true); |
michael@0 | 18 | }); |
michael@0 | 19 | |
michael@0 | 20 | add_task(function() { |
michael@0 | 21 | let exceptionThrown = false; |
michael@0 | 22 | try { |
michael@0 | 23 | CustomizableUI.registerArea("area-996364-2", {type: CustomizableUI.TYPE_TOOLBAR, defaultCollapsed: "false"}); |
michael@0 | 24 | } catch (ex) { |
michael@0 | 25 | exceptionThrown = true; |
michael@0 | 26 | } |
michael@0 | 27 | ok(exceptionThrown, "defaultCollapsed is not allowed as an external property"); |
michael@0 | 28 | |
michael@0 | 29 | // No need to unregister the area because registration fails. |
michael@0 | 30 | }); |
michael@0 | 31 | |
michael@0 | 32 | add_task(function() { |
michael@0 | 33 | let exceptionThrown; |
michael@0 | 34 | try { |
michael@0 | 35 | CustomizableUI.registerArea("area-996364-3", {type: CustomizableUI.TYPE_TOOLBAR}); |
michael@0 | 36 | CustomizableUI.registerArea("area-996364-3", {type: CustomizableUI.TYPE_MENU_PANEL}); |
michael@0 | 37 | } catch (ex) { |
michael@0 | 38 | exceptionThrown = ex; |
michael@0 | 39 | } |
michael@0 | 40 | ok(exceptionThrown, "Exception expected, an area cannot change types: " + (exceptionThrown ? exceptionThrown : "[no exception]")); |
michael@0 | 41 | |
michael@0 | 42 | CustomizableUI.unregisterArea("area-996364-3", true); |
michael@0 | 43 | }); |
michael@0 | 44 | |
michael@0 | 45 | add_task(function() { |
michael@0 | 46 | let exceptionThrown; |
michael@0 | 47 | try { |
michael@0 | 48 | CustomizableUI.registerArea("area-996364-4", {type: CustomizableUI.TYPE_MENU_PANEL}); |
michael@0 | 49 | CustomizableUI.registerArea("area-996364-4", {type: CustomizableUI.TYPE_TOOLBAR}); |
michael@0 | 50 | } catch (ex) { |
michael@0 | 51 | exceptionThrown = ex; |
michael@0 | 52 | } |
michael@0 | 53 | ok(exceptionThrown, "Exception expected, an area cannot change types: " + (exceptionThrown ? exceptionThrown : "[no exception]")); |
michael@0 | 54 | |
michael@0 | 55 | CustomizableUI.unregisterArea("area-996364-4", true); |
michael@0 | 56 | }); |
michael@0 | 57 | |
michael@0 | 58 | add_task(function() { |
michael@0 | 59 | let exceptionThrown; |
michael@0 | 60 | try { |
michael@0 | 61 | CustomizableUI.registerArea("area-996899-1", { anchor: "PanelUI-menu-button", |
michael@0 | 62 | type: CustomizableUI.TYPE_MENU_PANEL, |
michael@0 | 63 | defaultPlacements: [] }); |
michael@0 | 64 | CustomizableUI.registerArea("area-996899-1", { anchor: "home-button", |
michael@0 | 65 | type: CustomizableUI.TYPE_MENU_PANEL, |
michael@0 | 66 | defaultPlacements: [] }); |
michael@0 | 67 | } catch (ex) { |
michael@0 | 68 | exceptionThrown = ex; |
michael@0 | 69 | } |
michael@0 | 70 | ok(!exceptionThrown, "Changing anchors shouldn't throw an exception: " + (exceptionThrown ? exceptionThrown : "[no exception]")); |
michael@0 | 71 | CustomizableUI.unregisterArea("area-996899-1", true); |
michael@0 | 72 | }); |
michael@0 | 73 | |
michael@0 | 74 | add_task(function() { |
michael@0 | 75 | let exceptionThrown; |
michael@0 | 76 | try { |
michael@0 | 77 | CustomizableUI.registerArea("area-996899-2", { anchor: "PanelUI-menu-button", |
michael@0 | 78 | type: CustomizableUI.TYPE_MENU_PANEL, |
michael@0 | 79 | defaultPlacements: [] }); |
michael@0 | 80 | CustomizableUI.registerArea("area-996899-2", { anchor: "PanelUI-menu-button", |
michael@0 | 81 | type: CustomizableUI.TYPE_MENU_PANEL, |
michael@0 | 82 | defaultPlacements: ["feed-button"] }); |
michael@0 | 83 | } catch (ex) { |
michael@0 | 84 | exceptionThrown = ex; |
michael@0 | 85 | } |
michael@0 | 86 | ok(!exceptionThrown, "Changing defaultPlacements shouldn't throw an exception: " + (exceptionThrown ? exceptionThrown : "[no exception]")); |
michael@0 | 87 | CustomizableUI.unregisterArea("area-996899-2", true); |
michael@0 | 88 | }); |
michael@0 | 89 | |
michael@0 | 90 | add_task(function() { |
michael@0 | 91 | let exceptionThrown; |
michael@0 | 92 | try { |
michael@0 | 93 | CustomizableUI.registerArea("area-996899-3", { legacy: true }); |
michael@0 | 94 | CustomizableUI.registerArea("area-996899-3", { legacy: false }); |
michael@0 | 95 | } catch (ex) { |
michael@0 | 96 | exceptionThrown = ex; |
michael@0 | 97 | } |
michael@0 | 98 | ok(exceptionThrown, "Changing 'legacy' should throw an exception: " + (exceptionThrown ? exceptionThrown : "[no exception]")); |
michael@0 | 99 | CustomizableUI.unregisterArea("area-996899-3", true); |
michael@0 | 100 | }); |
michael@0 | 101 | |
michael@0 | 102 | add_task(function() { |
michael@0 | 103 | let exceptionThrown; |
michael@0 | 104 | try { |
michael@0 | 105 | CustomizableUI.registerArea("area-996899-4", { overflowable: true }); |
michael@0 | 106 | CustomizableUI.registerArea("area-996899-4", { overflowable: false }); |
michael@0 | 107 | } catch (ex) { |
michael@0 | 108 | exceptionThrown = ex; |
michael@0 | 109 | } |
michael@0 | 110 | ok(exceptionThrown, "Changing 'overflowable' should throw an exception: " + (exceptionThrown ? exceptionThrown : "[no exception]")); |
michael@0 | 111 | CustomizableUI.unregisterArea("area-996899-4", true); |
michael@0 | 112 | }); |