| Index: third_party/WebKit/Source/modules/permissions/Permissions.cpp
|
| diff --git a/third_party/WebKit/Source/modules/permissions/Permissions.cpp b/third_party/WebKit/Source/modules/permissions/Permissions.cpp
|
| index c0d92a1cfc34953701f3791292e0bb6ff62a8140..35a5287ad18ba864bc27a64397772f73a88daf8b 100644
|
| --- a/third_party/WebKit/Source/modules/permissions/Permissions.cpp
|
| +++ b/third_party/WebKit/Source/modules/permissions/Permissions.cpp
|
| @@ -141,7 +141,25 @@ ScriptPromise Permissions::request(ScriptState* scriptState, const Dictionary& r
|
| return promise;
|
| }
|
|
|
| -ScriptPromise Permissions::request(ScriptState* scriptState, const Vector<Dictionary>& rawPermissions)
|
| +ScriptPromise Permissions::revoke(ScriptState* scriptState, const Dictionary& rawPermission)
|
| +{
|
| + WebPermissionClient* client = getClient(scriptState->executionContext());
|
| + if (!client)
|
| + return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(InvalidStateError, "In its current state, the global scope can't revoke permissions."));
|
| +
|
| + ExceptionState exceptionState(ExceptionState::GetterContext, "revoke", "Permissions", scriptState->context()->Global(), scriptState->isolate());
|
| + Nullable<WebPermissionType> type = parsePermission(scriptState, rawPermission, exceptionState);
|
| + if (exceptionState.hadException())
|
| + return exceptionState.reject(scriptState);
|
| +
|
| + ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
|
| + ScriptPromise promise = resolver->promise();
|
| +
|
| + client->revokePermission(type.get(), KURL(KURL(), scriptState->executionContext()->securityOrigin()->toString()), new PermissionCallback(resolver, type.get()));
|
| + return promise;
|
| +}
|
| +
|
| +ScriptPromise Permissions::requestAll(ScriptState* scriptState, const Vector<Dictionary>& rawPermissions)
|
| {
|
| WebPermissionClient* client = getClient(scriptState->executionContext());
|
| if (!client)
|
| @@ -179,22 +197,4 @@ ScriptPromise Permissions::request(ScriptState* scriptState, const Vector<Dictio
|
| return promise;
|
| }
|
|
|
| -ScriptPromise Permissions::revoke(ScriptState* scriptState, const Dictionary& rawPermission)
|
| -{
|
| - WebPermissionClient* client = getClient(scriptState->executionContext());
|
| - if (!client)
|
| - return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(InvalidStateError, "In its current state, the global scope can't revoke permissions."));
|
| -
|
| - ExceptionState exceptionState(ExceptionState::GetterContext, "revoke", "Permissions", scriptState->context()->Global(), scriptState->isolate());
|
| - Nullable<WebPermissionType> type = parsePermission(scriptState, rawPermission, exceptionState);
|
| - if (exceptionState.hadException())
|
| - return exceptionState.reject(scriptState);
|
| -
|
| - ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
|
| - ScriptPromise promise = resolver->promise();
|
| -
|
| - client->revokePermission(type.get(), KURL(KURL(), scriptState->executionContext()->securityOrigin()->toString()), new PermissionCallback(resolver, type.get()));
|
| - return promise;
|
| -}
|
| -
|
| } // namespace blink
|
|
|