Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: chrome/test/data/extensions/api_test/keybinding/continue_propagation/background.js

Issue 504183004: Continue key propagation for extensions without any listeners to chrome.commands.onCommand. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Add new test. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 var stage = 'DOM';
Finnur 2014/08/28 11:15:39 Add: // Keeps track of who should be receiving key
David Tseng 2014/08/28 23:37:11 Done.
6
7 function gotCommand(command) {
8 if (stage == 'onCommand') {
9 stage = 'DOM';
10 chrome.commands.onCommand.removeListener(gotCommand);
11 chrome.test.notifyPass();
12 } else {
13 chrome.test.notifyFail('Unexpected call to onCommand');
Finnur 2014/08/28 11:15:39 nit: Change error to something like: 'Webpage expe
David Tseng 2014/08/28 23:37:11 Done.
14 }
15 }
16
17 chrome.extension.onConnect.addListener(function(port) {
18 port.onMessage.addListener(function(message) {
19 if (stage == 'DOM') {
20 stage = 'onCommand';
21 chrome.commands.onCommand.addListener(gotCommand);
22 chrome.test.notifyPass();
23 } else {
24 chrome.test.notifyFail('Unexpected key event on page');
Finnur 2014/08/28 11:15:39 nit: Change error to something like: 'Extension ex
25 }
26 });
27 } );
Finnur 2014/08/28 11:15:39 nit: Extra spaces.
28
29 chrome.test.notifyPass();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698