maintain api compatibility
This commit is contained in:
parent
be50ca2653
commit
8557cd223c
2 changed files with 20 additions and 4 deletions
|
@ -115,14 +115,27 @@ struct Converter<net::ProxyConfig> {
|
||||||
v8::Local<v8::Value> val,
|
v8::Local<v8::Value> val,
|
||||||
net::ProxyConfig* out) {
|
net::ProxyConfig* out) {
|
||||||
mate::Dictionary options;
|
mate::Dictionary options;
|
||||||
if (!ConvertFromV8(isolate, val, &options))
|
if (!ConvertFromV8(isolate, val, &options)) {
|
||||||
return false;
|
// 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;
|
GURL pac_url;
|
||||||
std::string rules;
|
std::string rules;
|
||||||
if (options.Get("pacScript", &pac_url))
|
if (options.Get("pacScript", &pac_url)) {
|
||||||
out->set_pac_url(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);
|
out->proxy_rules().ParseFromString(rules);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -186,6 +186,9 @@ Clears the data of web storages.
|
||||||
* `proxyRules` String - Rules indicating which proxies to use.
|
* `proxyRules` String - Rules indicating which proxies to use.
|
||||||
* `callback` Function - Called when operation is done.
|
* `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>]
|
proxyRules = scheme-proxies[";"<scheme-proxies>]
|
||||||
scheme-proxies = [<url-scheme>"="]<proxy-uri-list>
|
scheme-proxies = [<url-scheme>"="]<proxy-uri-list>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue