| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script> | 3 <script> |
| 4 function fail() { | 4 function fail() { |
| 5 window.domAutomationController.send(false); | 5 window.domAutomationController.send(false); |
| 6 throw "Failed!"; | 6 throw "Failed!"; |
| 7 } | 7 } |
| 8 | 8 |
| 9 function succeed() { | 9 function succeed() { |
| 10 window.domAutomationController.send(true); | 10 window.domAutomationController.send(true); |
| 11 } | 11 } |
| 12 | 12 |
| 13 function testLastError() { | 13 function testLastError() { |
| 14 // Make sure lastError is not yet set | 14 // Make sure lastError is not yet set |
| 15 if (chrome.tabs.lastError) | 15 if (chrome.tabs.lastError) |
| 16 fail(); | 16 fail(); |
| 17 | 17 |
| 18 var maxTabId = 0; | 18 var maxTabId = 0; |
| 19 | 19 |
| 20 // Find the highest tab id | 20 // Find the highest tab id |
| 21 chrome.windows.getAll(true, function(windows) { | 21 chrome.windows.getAll({populate:true}, function(windows) { |
| 22 // Make sure lastError is still not set. (this call have should succeeded). | 22 // Make sure lastError is still not set. (this call have should succeeded). |
| 23 if (chrome.tabs.lastError) | 23 if (chrome.tabs.lastError) |
| 24 fail(); | 24 fail(); |
| 25 | 25 |
| 26 for (var i = 0; i < windows.length; i++) { | 26 for (var i = 0; i < windows.length; i++) { |
| 27 var win = windows[i]; | 27 var win = windows[i]; |
| 28 for (var j = 0; j < win.tabs.length; j++) { | 28 for (var j = 0; j < win.tabs.length; j++) { |
| 29 var tab = win.tabs[j]; | 29 var tab = win.tabs[j]; |
| 30 if (tab.id > maxTabId) | 30 if (tab.id > maxTabId) |
| 31 maxTabId = tab.id; | 31 maxTabId = tab.id; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 52 | 52 |
| 53 succeed(); | 53 succeed(); |
| 54 } | 54 } |
| 55 </script> | 55 </script> |
| 56 </head> | 56 </head> |
| 57 <body> | 57 <body> |
| 58 <div onclick="testLastError();"> Last Error Test </div> | 58 <div onclick="testLastError();"> Last Error Test </div> |
| 59 </body> | 59 </body> |
| 60 </html> | 60 </html> |
| 61 | 61 |
| OLD | NEW |