Chromium Code Reviews| Index: Source/devtools/front_end/ui/ShortcutRegistry.js |
| diff --git a/Source/devtools/front_end/ui/ShortcutRegistry.js b/Source/devtools/front_end/ui/ShortcutRegistry.js |
| index b603e89e80f41becd2f8ccfa18699dea2b1ab550..89b00d2ace2a0473897b3571cb707c180d6a77c7 100644 |
| --- a/Source/devtools/front_end/ui/ShortcutRegistry.js |
| +++ b/Source/devtools/front_end/ui/ShortcutRegistry.js |
| @@ -97,13 +97,34 @@ WebInspector.ShortcutRegistry.prototype = { |
| return; |
| } |
| - for (var i = 0; i < actionIds.length; ++i) { |
| - if (!isPossiblyInputKey()) { |
| - if (handler.call(this, actionIds[i])) |
| - break; |
| - } else { |
| - this._pendingActionTimer = setTimeout(handler.bind(this, actionIds[i]), 0); |
| - break; |
| + if (!isPossiblyInputKey()) |
| + processActionIdsSequentially.call(this); |
| + else |
| + this._pendingActionTimer = setTimeout(processActionIdsSequentially.bind(this), 0); |
| + |
| + /** |
| + * @this {WebInspector.ShortcutRegistry} |
| + */ |
| + function processActionIdsSequentially() |
| + { |
| + delete this._pendingActionTimer; |
| + var actionId = actionIds.shift(); |
| + if (!actionId) |
| + return; |
| + |
| + this._actionRegistry.execute(actionId).then(continueIfNecessary.bind(this)); |
| + |
| + /** |
| + * @this {WebInspector.ShortcutRegistry} |
| + */ |
| + function continueIfNecessary(result) |
| + { |
| + if (result) { |
| + if (event) |
| + event.consume(true); |
|
dgozman
2014/10/16 10:28:17
How does this work when consuming event asynchrono
dgozman
2014/10/16 10:41:16
Let's comment about "best effort" you are doing he
pfeldman
2014/10/16 10:46:46
Acknowledged.
pfeldman
2014/10/16 10:46:47
Done.
|
| + return; |
| + } |
| + return processActionIdsSequentially.call(this); |
|
dgozman
2014/10/16 10:28:17
nit: processActionIdsSequentially does not return
pfeldman
2014/10/16 10:46:47
It actually does return a Promise.<undefined> that
pfeldman
2014/10/16 10:56:49
nm, you are right.
|
| } |
| } |
| @@ -133,20 +154,6 @@ WebInspector.ShortcutRegistry.prototype = { |
| { |
| return !!(keyModifiers & mod); |
| } |
| - |
| - /** |
| - * @param {string} actionId |
| - * @return {boolean} |
| - * @this {WebInspector.ShortcutRegistry} |
| - */ |
| - function handler(actionId) |
| - { |
| - var result = this._actionRegistry.execute(actionId); |
| - if (result && event) |
| - event.consume(true); |
| - delete this._pendingActionTimer; |
| - return result; |
| - } |
| }, |
| /** |