Index: chrome/browser/extensions/extension_tabs_module.cc |
diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc |
index dbf198bc71c1fd73545ff35ba40c7c0bf1c79986..24c9878ebbc10faf7675182168c2924656b349bc 100644 |
--- a/chrome/browser/extensions/extension_tabs_module.cc |
+++ b/chrome/browser/extensions/extension_tabs_module.cc |
@@ -5,6 +5,7 @@ |
#include "chrome/browser/extensions/extension_tabs_module.h" |
#include <algorithm> |
+#include <limits> |
#include <vector> |
#include "base/base64.h" |
@@ -1402,12 +1403,18 @@ bool MoveTabsFunction::RunImpl() { |
EXTENSION_FUNCTION_VALIDATE(ReadOneOrMoreIntegers(tab_value, &tab_ids)); |
DictionaryValue* update_props = NULL; |
- EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &update_props)); |
+ if (HasOptionalArgument(1)) { |
+ EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &update_props)); |
+ } |
int new_index = -1; |
- EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( |
- keys::kIndexKey, &new_index)); |
- EXTENSION_FUNCTION_VALIDATE(new_index >= 0); |
+ if (update_props && update_props->HasKey(keys::kIndexKey)) { |
+ EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( |
+ keys::kIndexKey, &new_index)); |
+ EXTENSION_FUNCTION_VALIDATE(new_index >= 0); |
+ } else { |
+ new_index = std::numeric_limits<int>::max(); // Will get clamped |
clintstaley
2012/03/20 17:19:29
. after all comments
mitchellwrosen
2012/03/27 01:19:49
Done.
|
+ } |
ListValue tab_values; |
for (size_t i = 0; i < tab_ids.size(); ++i) { |
@@ -1429,7 +1436,7 @@ bool MoveTabsFunction::RunImpl() { |
// Insert the tabs one after another. |
new_index += i; |
- if (update_props->HasKey(keys::kWindowIdKey)) { |
+ if (update_props && update_props->HasKey(keys::kWindowIdKey)) { |
Browser* target_browser = NULL; |
int window_id = extension_misc::kUnknownWindowId; |
EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( |