forked from mirrors/gecko-dev
		
	 882fa06e25
			
		
	
	
		882fa06e25
		
	
	
	
	
		
			
			* Harden the new `hideAllViewsExcept()` to not do erroneous things if called when
   the binding is already gone.
 * Generalize things into `hideAllViewsExcept(thisOne)`:
    - Clear `_viewShowing` in there and do the descriptionHeightWorkaround thing
      in there too,
    - For Photon panels, do all the 'current' attribute setting in there. To show
      a panel during transition, I introduced the 'in-transition' attribute.
 * I had to make sure not to over-eagerly dispatch 'ViewShowing' events, because
   that confuses some,
 * Move the temporary panel handling, which contains an ephemeral panelmultiview
   instance, internally. This cleans up the hacky, duplicate PanelUI.js code nicely.
 * Keep a local copy of `_transitionDetails` to ensure it's still there after transition,
 * Harden `_cleanupTransitionPhase()` to only clear the phase that belongs to a
   specific transition, _if_ that's passed in as an argument. This resolves any
   potential raciness that might occur when `showSubView()` is called again mid-transition.
 * Skip the UITour element visibility check when it's inside a panelview, because
   too many things need to happen and that check is too simple to be useful in
   that case.
MozReview-Commit-ID: 5HpJKs1Ny5j
--HG--
extra : rebase_source : b810e1de2dbd75932a42d68e751fdaecd9fee69a
		
	
			
		
			
				
	
	
		
			64 lines
		
	
	
	
		
			2.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			64 lines
		
	
	
	
		
			2.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| /* 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/. */
 | |
| /* eslint-disable mozilla/no-arbitrary-setTimeout */
 | |
| 
 | |
| "use strict";
 | |
| const kWidgetId = "test-981418-widget-onbeforecreated";
 | |
| 
 | |
| // Should be able to add broken view widget
 | |
| add_task(async function testAddOnBeforeCreatedWidget() {
 | |
|   let onBeforeCreatedCalled = false;
 | |
|   let widgetSpec = {
 | |
|     id: kWidgetId,
 | |
|     type: "view",
 | |
|     viewId: kWidgetId + "idontexistyet",
 | |
|     onBeforeCreated(doc) {
 | |
|       let view = doc.createElement("panelview");
 | |
|       view.id = kWidgetId + "idontexistyet";
 | |
|       document.getElementById("appMenu-viewCache").appendChild(view);
 | |
|       onBeforeCreatedCalled = true;
 | |
|     }
 | |
|   };
 | |
| 
 | |
|   CustomizableUI.createWidget(widgetSpec);
 | |
|   CustomizableUI.addWidgetToArea(kWidgetId, CustomizableUI.AREA_NAVBAR);
 | |
| 
 | |
|   ok(onBeforeCreatedCalled, "onBeforeCreated should have been called");
 | |
| 
 | |
|   let widgetNode = document.getElementById(kWidgetId);
 | |
|   let viewNode = document.getElementById(kWidgetId + "idontexistyet");
 | |
|   ok(widgetNode, "Widget should exist");
 | |
|   ok(viewNode, "Panelview should exist");
 | |
|   widgetNode.click();
 | |
| 
 | |
|   let tempPanel = document.getElementById("customizationui-widget-panel");
 | |
|   let panelShownPromise = promisePanelElementShown(window, tempPanel);
 | |
| 
 | |
|   await Promise.all([
 | |
|     BrowserTestUtils.waitForEvent(viewNode, "ViewShown"),
 | |
|     panelShownPromise
 | |
|   ]);
 | |
| 
 | |
|   let panelHiddenPromise = promisePanelElementHidden(window, tempPanel);
 | |
|   tempPanel.hidePopup();
 | |
|   await panelHiddenPromise;
 | |
| 
 | |
|   CustomizableUI.addWidgetToArea(kWidgetId, CustomizableUI.AREA_FIXED_OVERFLOW_PANEL);
 | |
|   await waitForOverflowButtonShown();
 | |
|   await document.getElementById("nav-bar").overflowable.show();
 | |
| 
 | |
|   widgetNode.click();
 | |
| 
 | |
|   await BrowserTestUtils.waitForEvent(viewNode, "ViewShown");
 | |
| 
 | |
|   let panelHidden = promiseOverflowHidden(window);
 | |
|   PanelUI.overflowPanel.hidePopup();
 | |
|   await panelHidden;
 | |
| 
 | |
|   CustomizableUI.destroyWidget(kWidgetId);
 | |
| });
 | |
| 
 | |
| add_task(async function asyncCleanup() {
 | |
|   await resetCustomization();
 | |
| });
 |