Bug 860994 - Fixup intermittent context menu failing tests

--HG--
extra : rebase_source : f577ee38b6e22398b4a8a160cd18dcfcfd3d3169
This commit is contained in:
Rodrigo Silveira 2013-04-10 23:06:19 -07:00
parent 124d1b4696
commit 0c8adb11bd
4 changed files with 20 additions and 10 deletions

View File

@ -382,14 +382,16 @@ MenuPopup.prototype = {
let self = this;
this._panel.addEventListener("transitionend", function () {
self._panel.removeEventListener("transitionend", arguments.callee);
self._panel.removeAttribute("hiding");
self._panel.hidden = true;
self._popupState = null;
let event = document.createEvent("Events");
event.initEvent("popuphidden", true, false);
document.dispatchEvent(event);
});
this._panel.removeAttribute("showing");
this._panel.setAttribute("hiding", "true");
setTimeout(()=>this._panel.removeAttribute("showing"), 0);
},
_position: function _position(aPositionOptions) {
@ -408,7 +410,6 @@ MenuPopup.prototype = {
let width = this._popup.boxObject.width;
let height = this._popup.boxObject.height;
let halfWidth = width / 2;
let halfHeight = height / 2;
let screenWidth = ContentAreaObserver.width;
let screenHeight = ContentAreaObserver.height;

View File

@ -30,7 +30,7 @@ function checkContextMenuPositionRange(aElement, aMinLeft, aMaxLeft, aMinTop, aM
ok(aElement.left > aMinLeft && aElement.left < aMaxLeft,
"Left position is " + aElement.left + ", expected between " + aMinLeft + " and " + aMaxLeft);
ok(aElement.top > aMinTop && aElement.top < aMaxTop,
ok(aElement.top > aMinTop && aElement.top < aMaxTop,
"Top position is " + aElement.top + ", expected between " + aMinTop + " and " + aMaxTop);
}
@ -347,7 +347,9 @@ gTests.push({
checkContextMenuPositionRange(ContextMenuUI._panel, 65, 80, notificationHeight + 155, notificationHeight + 180);
ContextMenuUI._menuPopup.hide();
promise = waitForEvent(document, "popuphidden");
ContextMenuUI.hide();
yield promise;
Browser.closeTab(Browser.selectedTab);
}
@ -497,6 +499,7 @@ gTests.push({
ok(imagetab != null, "tab created");
Browser.closeTab(imagetab);
yield waitForEvent(imagetab.chromeTab.parentNode, "TabRemove");
}
});
@ -511,7 +514,7 @@ gTests.push({
// Sometimes the context ui is visible, sometimes it isn't.
try {
yield waitForCondition(function () {
return ContextUI.isVisible;
return ContextUI.isVisible;
}, 500, 50);
} catch (ex) {}

View File

@ -474,19 +474,21 @@ function runTests() {
waitForExplicitFinish();
Task.spawn(function() {
while((gCurrentTest = gTests.shift())){
info(gCurrentTest.desc);
info("START " + gCurrentTest.desc);
try {
if ('function' == typeof gCurrentTest.setUp) {
info("SETUP " + gCurrentTest.desc);
yield Task.spawn(gCurrentTest.setUp.bind(gCurrentTest));
}
yield Task.spawn(gCurrentTest.run.bind(gCurrentTest));
if ('function' == typeof gCurrentTest.tearDown) {
info("TEARDOWN " + gCurrentTest.desc);
yield Task.spawn(gCurrentTest.tearDown.bind(gCurrentTest));
}
} catch (ex) {
ok(false, "runTests: Task failed - " + ex);
} finally {
info("END "+gCurrentTest.desc);
info("END " + gCurrentTest.desc);
}
}
finish();

View File

@ -160,7 +160,6 @@ menulist {
.menu-container {
position: absolute;
opacity: 0;
transition: opacity ease-out 0.2s;
}
.menu-container[showingfrom="below"] {
@ -171,10 +170,15 @@ menulist {
transform: translateY(-@metro_spacing_normal@);
}
.menu-container[hiding],
.menu-container[showing] {
transition: opacity ease-out 0.2s,
transform ease-out 0.2s;
}
.menu-container[showing] {
opacity: 1;
transform: none;
transition: all ease-out 0.2s;
}
.menu-popup > richlistbox {