зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1246842 - Correct once function to remove correct event listener r=cpearce
The once function should add and then remove an event listener after it is invoked, but it appears to remove another event listener instead. This commit adjusts that behaviour. Note that the dom/media/mediasource/test/mediasource.js file has the same pattern and has been updated. This commit reflects using the same changes to remedy the once function here. MozReview-Commit-ID: DQ4bfxTQfjN --HG-- extra : transplant_source : 7%8E%19%DB74e%23%1511%1C%89%7D5%98%DE%12%BA%A2
This commit is contained in:
Родитель
af4cfedcf9
Коммит
ec7d44ede3
|
@ -1358,7 +1358,7 @@ function removeNodeAndSource(n) {
|
|||
function once(target, name, cb) {
|
||||
var p = new Promise(function(resolve, reject) {
|
||||
target.addEventListener(name, function() {
|
||||
target.removeEventListener(name, cb);
|
||||
target.removeEventListener(name, arguments.callee);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче