This commit is contained in:
Robo 2016-01-11 12:24:01 +05:30
Родитель be50ca2653
Коммит 8557cd223c
2 изменённых файлов: 20 добавлений и 4 удалений

Просмотреть файл

@ -115,14 +115,27 @@ struct Converter<net::ProxyConfig> {
v8::Local<v8::Value> val,
net::ProxyConfig* out) {
mate::Dictionary options;
if (!ConvertFromV8(isolate, val, &options))
return false;
if (!ConvertFromV8(isolate, val, &options)) {
// Fallback to previous api (https://git.io/vuhjj).
std::string proxy;
if (!ConvertFromV8(isolate, val, &proxy))
return false;
auto pac_url = GURL(proxy);
if (pac_url.is_valid()) {
out->set_pac_url(pac_url);
} else {
out->proxy_rules().ParseFromString(proxy);
}
return true;
}
GURL pac_url;
std::string rules;
if (options.Get("pacScript", &pac_url))
if (options.Get("pacScript", &pac_url)) {
out->set_pac_url(pac_url);
else if (options.Get("proxyRules", &rules))
} else if (options.Get("proxyRules", &rules)) {
out->proxy_rules().ParseFromString(rules);
}
return true;
}
};

Просмотреть файл

@ -186,6 +186,9 @@ Clears the data of web storages.
* `proxyRules` String - Rules indicating which proxies to use.
* `callback` Function - Called when operation is done.
When `pacScript` and `proxyRules` are provided together, the `proxyRules`
option is ignored and `pacScript` configuration is applied.
```
proxyRules = scheme-proxies[";"<scheme-proxies>]
scheme-proxies = [<url-scheme>"="]<proxy-uri-list>