Bug 1441284 - Part 1 - Remove the "current" property. r=Gijs

MozReview-Commit-ID: GyqI8N3JQ9O

--HG--
extra : rebase_source : c2ac400d601c259ce17852a85d01230355885454
This commit is contained in:
Paolo Amadini 2018-02-26 18:36:59 +00:00
Родитель aa8c33b004
Коммит 2d4d390d41
4 изменённых файлов: 13 добавлений и 15 удалений

Просмотреть файл

@ -96,8 +96,10 @@ add_task(async function() {
for (let button of navButtons) {
info("Click " + button.id);
let promiseViewShown = BrowserTestUtils.waitForEvent(PanelUI.panel,
"ViewShown");
button.click();
await BrowserTestUtils.waitForEvent(PanelUI.panel, "ViewShown");
let viewShownEvent = await promiseViewShown;
// Workaround until bug 1363756 is fixed, then this can be removed.
let container = PanelUI.multiView.querySelector(".panel-viewcontainer");
@ -105,10 +107,12 @@ add_task(async function() {
return !container.hasAttribute("width");
});
info("Shown " + PanelUI.multiView.current.id);
await openSubViewsRecursively(PanelUI.multiView.current);
info("Shown " + viewShownEvent.originalTarget.id);
await openSubViewsRecursively(viewShownEvent.originalTarget);
promiseViewShown = BrowserTestUtils.waitForEvent(currentView,
"ViewShown");
PanelUI.multiView.goBack();
await BrowserTestUtils.waitForEvent(PanelUI.panel, "ViewShown");
await promiseViewShown;
// Workaround until bug 1363756 is fixed, then this can be removed.
await BrowserTestUtils.waitForCondition(() => {

Просмотреть файл

@ -379,14 +379,7 @@ var PanelMultiView = class extends this.AssociatedToNode {
return this.__screenManager = Cc["@mozilla.org/gfx/screenmanager;1"]
.getService(Ci.nsIScreenManager);
}
/**
* @return {panelview} the currently visible subview OR the subview that is
* about to be shown whilst a 'ViewShowing' event is being
* dispatched.
*/
get current() {
return this.node && this._currentSubView;
}
get _currentSubView() {
// Peek the top of the stack, but fall back to the main view if the list of
// opened views is currently empty.
@ -452,7 +445,7 @@ var PanelMultiView = class extends this.AssociatedToNode {
value: (...args) => this[method](...args)
});
});
["current", "showingSubView"].forEach(property => {
["showingSubView"].forEach(property => {
Object.defineProperty(this.node, property, {
enumerable: true,
get: () => this[property]

Просмотреть файл

@ -146,7 +146,7 @@ add_task(async function testStayopenBookmarksClicks() {
newTab = await promiseTabOpened;
ok(true, "Bookmark middle-click opened new tab.");
await BrowserTestUtils.removeTab(newTab);
is(PanelUI.multiView.current.id, "PanelUI-bookmarks", "Should still show the bookmarks subview");
ok(PanelView.forNode(BMview).active, "Should still show the bookmarks subview");
ok(appMenu.open, "Menu should remain open.");
// Close the App Menu

Просмотреть файл

@ -29,7 +29,8 @@ add_UITour_task(async function test_highlight_library_and_show_library_subview()
libraryBtn.dispatchEvent(new Event("command"));
await highlightHiddenPromise;
await ViewShownPromise;
is(PanelUI.multiView.current.id, "appMenu-libraryView", "Should show the library subview");
let libView = document.getElementById("appMenu-libraryView");
ok(PanelView.forNode(libView).active, "Should show the library subview");
is(appMenu.state, "open", "Should still open the app menu for the library subview");
// Clean up