Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: chrome/ext/background.js

Issue 4808773210210304: Issue 437 - Fixed broken onclick handler for context menu entries (Closed)
Patch Set: Created May 7, 2014, 6:40 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 contextMenuUpdating = false; 187 contextMenuUpdating = false;
188 188
189 if (tabs.length == 0) 189 if (tabs.length == 0)
190 return; 190 return;
191 191
192 var items = contextMenuItems.get({_id: tabs[0].id}); 192 var items = contextMenuItems.get({_id: tabs[0].id});
193 193
194 if (!items) 194 if (!items)
195 return; 195 return;
196 196
197 for (var i = 0; i < items.length; i++) 197 items.forEach(function(item)
198 { 198 {
199 chrome.contextMenus.create({ 199 chrome.contextMenus.create({
200 title: items[i].title, 200 title: item.title,
201 contexts: items[i].contexts, 201 contexts: item.contexts,
202 onclick: items[i].onclick 202 onclick: function(info, tab)
203 {
204 item.onclick(info.srcUrl, new Page(tab));
205 }
203 }); 206 });
204 } 207 });
205 }); 208 });
206 }); 209 });
207 }; 210 };
208 211
209 var ContextMenus = function(page) 212 var ContextMenus = function(page)
210 { 213 {
211 this._page = page; 214 this._page = page;
212 }; 215 };
213 ContextMenus.prototype = { 216 ContextMenus.prototype = {
214 create: function(item) 217 create: function(item)
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 }; 359 };
357 360
358 return ext.onMessage._dispatch(message, sender, sendResponse); 361 return ext.onMessage._dispatch(message, sender, sendResponse);
359 }); 362 });
360 363
361 364
362 /* Storage */ 365 /* Storage */
363 366
364 ext.storage = localStorage; 367 ext.storage = localStorage;
365 })(); 368 })();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld