mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 10:15:41 +00:00
5495fb2264
We could not avoid controls being focused after De-XUL, in order to preventDefault before event propagate to focused control, we should change the way of keypress event propagation in media controls. MozReview-Commit-ID: 4KNPU4XlSDJ --HG-- extra : rebase_source : 1146e18e3beebca8ae36a4de126c5c920aa5cdfd
41 lines
1.0 KiB
JavaScript
41 lines
1.0 KiB
JavaScript
"use strict";
|
|
|
|
var tests = [];
|
|
|
|
function waitForCondition(condition, nextTest, errorMsg) {
|
|
var tries = 0;
|
|
var interval = setInterval(function() {
|
|
if (tries >= 30) {
|
|
ok(false, errorMsg);
|
|
moveOn();
|
|
}
|
|
var conditionPassed;
|
|
try {
|
|
conditionPassed = condition();
|
|
} catch (e) {
|
|
ok(false, e + "\n" + e.stack);
|
|
conditionPassed = false;
|
|
}
|
|
if (conditionPassed) {
|
|
moveOn();
|
|
}
|
|
tries++;
|
|
}, 100);
|
|
var moveOn = function() { clearInterval(interval); nextTest(); };
|
|
}
|
|
|
|
function getAnonElementWithinVideoByAttribute(video, aName, aValue) {
|
|
const domUtils = SpecialPowers.Cc["@mozilla.org/inspector/dom-utils;1"].
|
|
getService(SpecialPowers.Ci.inIDOMUtils);
|
|
const videoControl = domUtils.getChildrenForNode(video, true)[1];
|
|
|
|
return SpecialPowers.wrap(videoControl.ownerDocument)
|
|
.getAnonymousElementByAttribute(videoControl, aName, aValue);
|
|
}
|
|
|
|
function executeTests() {
|
|
return tests
|
|
.map(fn => () => new Promise(fn))
|
|
.reduce((promise, task) => promise.then(task), Promise.resolve());
|
|
}
|