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

Side by Side Diff: chrome/test/data/extensions/api_test/tabs/basics/move.html

Issue 5018002: Fixes a crash when entering a negative index with chrome.tabs.move .... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 10 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 <script src="tabs_util.js"></script> 1 <script src="tabs_util.js"></script>
2 2
3 <script> 3 <script>
4 var firstWindowId; 4 var firstWindowId;
5 var secondWindowId; 5 var secondWindowId;
6 var moveTabIds = {}; 6 var moveTabIds = {};
7 7
8 chrome.test.runTests([ 8 chrome.test.runTests([
9 // Do a series of moves so that we get the following 9 // Do a series of moves so that we get the following
10 // 10 //
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 chrome.tabs.move(moveTabIds['e'], {"index": 2}, 62 chrome.tabs.move(moveTabIds['e'], {"index": 2},
63 pass(function(tabE) { 63 pass(function(tabE) {
64 chrome.test.assertEq(2, tabE.index); 64 chrome.test.assertEq(2, tabE.index);
65 chrome.tabs.move(moveTabIds['d'], {"windowId": secondWindowId, 65 chrome.tabs.move(moveTabIds['d'], {"windowId": secondWindowId,
66 "index": 2}, pass(function(tabD) { 66 "index": 2}, pass(function(tabD) {
67 chrome.test.assertEq(2, tabD.index); 67 chrome.test.assertEq(2, tabD.index);
68 checkMoveResults(); 68 checkMoveResults();
69 })); 69 }));
70 })); 70 }));
71 })); 71 }));
72
73 // Check that the browser doesn't segfault on a negative index
Aaron Boodman 2010/11/16 20:21:28 Nit: add a period to the end of this sentence. Als
74 chrome.tabs.getAllInWindow(firstWindowId, pass(function(tabs) {
75 lastTab = tabs.pop()
76 try{
Aaron Boodman 2010/11/16 20:21:28 Nit: spaces before "{": http://google-styleguide.g
77 chrome.tabs.move(lastTab.id, {'windowId': firstWindowId, 'index': -1});
78 }
79 catch(err){
80 }
Aaron Boodman 2010/11/16 20:21:28 Add a comment inside the catch block like: // No
81 }));
72 }, 82 },
73 83
74 function remove() { 84 function remove() {
75 chrome.tabs.remove(moveTabIds["d"], pass(function() { 85 chrome.tabs.remove(moveTabIds["d"], pass(function() {
76 chrome.tabs.getAllInWindow(secondWindowId, 86 chrome.tabs.getAllInWindow(secondWindowId,
77 pass(function(tabs) { 87 pass(function(tabs) {
78 assertEq(2, tabs.length); 88 assertEq(2, tabs.length);
79 assertEq(pageUrl("b"), tabs[0].url); 89 assertEq(pageUrl("b"), tabs[0].url);
80 assertEq("chrome://newtab/", tabs[1].url); 90 assertEq("chrome://newtab/", tabs[1].url);
81 })); 91 }));
82 })); 92 }));
83 } 93 }
84 ]); 94 ]);
85 </script> 95 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698