refactor: make util::Promise type safe when chaining in native (#19809)
* refactor: make util::Promise type safe when chaining in native * fixup! refactor: make util::Promise type safe when chaining in native * chore: remove spare brackets
This commit is contained in:
parent
f7e3e1f97a
commit
6a3922d330
39 changed files with 275 additions and 343 deletions
|
@ -232,18 +232,17 @@ v8::Local<v8::Promise> ProtocolNS::IsProtocolHandled(const std::string& scheme,
|
|||
"protocol.isProtocolRegistered or protocol.isProtocolIntercepted "
|
||||
"instead.",
|
||||
"ProtocolDeprecateIsProtocolHandled");
|
||||
util::Promise promise(isolate());
|
||||
promise.Resolve(IsProtocolRegistered(scheme) ||
|
||||
IsProtocolIntercepted(scheme) ||
|
||||
// The |isProtocolHandled| should return true for builtin
|
||||
// schemes, however with NetworkService it is impossible to
|
||||
// know which schemes are registered until a real network
|
||||
// request is sent.
|
||||
// So we have to test against a hard-coded builtin schemes
|
||||
// list make it work with old code. We should deprecate this
|
||||
// API with the new |isProtocolRegistered| API.
|
||||
base::Contains(kBuiltinSchemes, scheme));
|
||||
return promise.GetHandle();
|
||||
return util::Promise<bool>::ResolvedPromise(
|
||||
isolate(), IsProtocolRegistered(scheme) ||
|
||||
IsProtocolIntercepted(scheme) ||
|
||||
// The |isProtocolHandled| should return true for builtin
|
||||
// schemes, however with NetworkService it is impossible to
|
||||
// know which schemes are registered until a real network
|
||||
// request is sent.
|
||||
// So we have to test against a hard-coded builtin schemes
|
||||
// list make it work with old code. We should deprecate
|
||||
// this API with the new |isProtocolRegistered| API.
|
||||
base::Contains(kBuiltinSchemes, scheme));
|
||||
}
|
||||
|
||||
void ProtocolNS::HandleOptionalCallback(mate::Arguments* args,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue