Commit fd8c89c1 authored by Sam Goto's avatar Sam Goto Committed by Chromium LUCI CQ

[webid] Resolve the promise with the idtoken and add details to request errors

Bug: 1141125
Change-Id: I3f71f116ed17eb1014e7bd08c3850421ff7a957d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2630425Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Commit-Queue: Sam Goto <goto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843789}
parent 2fbd9e64
...@@ -70,7 +70,7 @@ void OnRequestIdToken(ScriptPromiseResolver* resolver, ...@@ -70,7 +70,7 @@ void OnRequestIdToken(ScriptPromiseResolver* resolver,
return; return;
} }
case mojom::blink::RequestIdTokenStatus::kSuccess: { case mojom::blink::RequestIdTokenStatus::kSuccess: {
resolver->Resolve(); resolver->Resolve(id_token);
return; return;
} }
} }
...@@ -95,8 +95,13 @@ WebID::WebID(ExecutionContext& context) ...@@ -95,8 +95,13 @@ WebID::WebID(ExecutionContext& context)
ScriptPromise WebID::get(ScriptState* script_state, ScriptPromise WebID::get(ScriptState* script_state,
const WebIDRequestOptions* options, const WebIDRequestOptions* options,
ExceptionState& exception_state) { ExceptionState& exception_state) {
if (!options->hasProvider() || !options->hasRequest()) { if (!options->hasProvider()) {
exception_state.ThrowTypeError("Invalid WebIDRequestOptions"); exception_state.ThrowTypeError("Invalid parameters: provider required.");
return ScriptPromise();
}
if (!options->hasRequest()) {
exception_state.ThrowTypeError("Invalid parameters: request required.");
return ScriptPromise(); return ScriptPromise();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment