Guard against callback being called twice
This commit is contained in:
parent
96d53d279e
commit
ee51e37db7
3 changed files with 26 additions and 19 deletions
|
@ -19,16 +19,14 @@ URLRequestStringJob::URLRequestStringJob(net::URLRequest* request,
|
|||
}
|
||||
|
||||
void URLRequestStringJob::StartAsync(scoped_ptr<base::Value> options) {
|
||||
if (options) {
|
||||
if (options->IsType(base::Value::TYPE_DICTIONARY)) {
|
||||
base::DictionaryValue* dict =
|
||||
static_cast<base::DictionaryValue*>(options.get());
|
||||
dict->GetString("mimeType", &mime_type_);
|
||||
dict->GetString("charset", &charset_);
|
||||
dict->GetString("data", &data_);
|
||||
} else if (options->IsType(base::Value::TYPE_STRING)) {
|
||||
options->GetAsString(&data_);
|
||||
}
|
||||
if (options->IsType(base::Value::TYPE_DICTIONARY)) {
|
||||
base::DictionaryValue* dict =
|
||||
static_cast<base::DictionaryValue*>(options.get());
|
||||
dict->GetString("mimeType", &mime_type_);
|
||||
dict->GetString("charset", &charset_);
|
||||
dict->GetString("data", &data_);
|
||||
} else if (options->IsType(base::Value::TYPE_STRING)) {
|
||||
options->GetAsString(&data_);
|
||||
}
|
||||
net::URLRequestSimpleJob::Start();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue