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

Side by Side Diff: chrome/test/data/extensions/context_menus/onclick_null/test.js

Issue 948243005: Merge custom bindings for context menus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits and tests Created 5 years, 9 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 (c) 2015 The Chromium Authors. All rights reserved.
lazyboy 2015/02/26 00:39:47 nit: new style is to ommit "(c)"
robwu 2015/02/26 09:33:46 Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 window.onload = function() {
6 chrome.contextMenus.create({
7 id: 'id',
8 title: 'Menu item',
9 onclick: function() {
10 chrome.runtime.sendMessage('onclick-unexpected');
11 }
12 }, onCreatedFirstMenu);
13 };
14
15 function onCreatedFirstMenu() {
16 chrome.contextMenus.update('id', {
17 onclick: null
18 }, function() {
19 chrome.runtime.sendMessage('update1', function() {
20 // Now create another context menu item, to test whether adding and
21 // updating a context menu with a new onclick handler works.
22 // Upon completing that test, we will also know whether menu 1's initial
23 // onclick attribute has been triggered unexpectedly.
24 createSecondMenu();
25 });
26 });
27 }
28
29 function createSecondMenu() {
30 chrome.contextMenus.create({
31 id: 'id2',
32 title: 'Menu item 2',
33 onclick: function() {
34 chrome.runtime.sendMessage('onclick2-unexpected');
35 }
36 }, function() {
37 chrome.contextMenus.update('id2', {
38 onclick: function() {
39 chrome.runtime.sendMessage('onclick2');
40 }
41 }, function() {
42 chrome.runtime.sendMessage('update2');
43 });
44 });
45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698