| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script> | 3 <script> |
| 4 // Called when the user clicks on the browser action. | 4 // Called when the user clicks on the browser action. |
| 5 var clicks = 0; | 5 var clicks = 0; |
| 6 chrome.browserAction.onClicked.addListener(function() { | 6 chrome.browserAction.onClicked.addListener(function() { |
| 7 chrome.browserAction.setIcon({iconIndex:clicks}); | 7 chrome.browserAction.setIcon({iconIndex:clicks}); |
| 8 chrome.browserAction.setBadgeText({text:""+i}); | |
| 9 clicks++; | 8 clicks++; |
| 10 // We only have 1 icon, but cycle through 3 icons to test the | 9 // We only have 1 icon, but cycle through 3 icons to test the |
| 11 // out-of-bounds index bug. | 10 // out-of-bounds index bug. |
| 12 if (clicks > 2) | 11 if (clicks > 2) |
| 13 clicks = 0; | 12 clicks = 0; |
| 14 }); | 13 }); |
| 15 var i = 0; | 14 var i = 0; |
| 16 | 15 |
| 17 window.setInterval(function() { | 16 window.setInterval(function() { |
| 18 // Don't animate while in "click" mode. | 17 // Don't animate while in "click" mode. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 33 context.fillRect((startx + 10) % 20, (starty + 10) % 20, 8, 8); | 32 context.fillRect((startx + 10) % 20, (starty + 10) % 20, 8, 8); |
| 34 return context.getImageData(0, 0, 20, 20); | 33 return context.getImageData(0, 0, 20, 20); |
| 35 } | 34 } |
| 36 </script> | 35 </script> |
| 37 </head> | 36 </head> |
| 38 <body> | 37 <body> |
| 39 <canvas id="canvas" width="20" height="20"></canvas> | 38 <canvas id="canvas" width="20" height="20"></canvas> |
| 40 </body> | 39 </body> |
| 41 </html> | 40 </html> |
| 42 | 41 |
| OLD | NEW |