| Index: third_party/WebKit/Source/modules/webshare/NavigatorShare.cpp
|
| diff --git a/third_party/WebKit/Source/modules/webshare/NavigatorShare.cpp b/third_party/WebKit/Source/modules/webshare/NavigatorShare.cpp
|
| index 74124c9ee9db4cc7a3e5883071a52667af8c6874..fdc669c2ab98df6b9e01cab11e6f541d129d302b 100644
|
| --- a/third_party/WebKit/Source/modules/webshare/NavigatorShare.cpp
|
| +++ b/third_party/WebKit/Source/modules/webshare/NavigatorShare.cpp
|
| @@ -24,6 +24,8 @@ class NavigatorShare::ShareClientImpl final
|
|
|
| void callback(const String& error);
|
|
|
| + void onConnectionError();
|
| +
|
| DEFINE_INLINE_TRACE() {
|
| visitor->trace(m_navigator);
|
| visitor->trace(m_resolver);
|
| @@ -51,6 +53,11 @@ void NavigatorShare::ShareClientImpl::callback(const String& error) {
|
| }
|
| }
|
|
|
| +void NavigatorShare::ShareClientImpl::onConnectionError() {
|
| + m_resolver->reject(
|
| + DOMException::create(SecurityError, "WebShare is disabled."));
|
| +}
|
| +
|
| NavigatorShare::~NavigatorShare() = default;
|
|
|
| NavigatorShare& NavigatorShare::from(Navigator& navigator) {
|
| @@ -94,6 +101,8 @@ ScriptPromise NavigatorShare::share(ScriptState* scriptState,
|
| LocalFrame* frame = doc->frame();
|
| DCHECK(frame);
|
| frame->interfaceProvider()->getInterface(mojo::GetProxy(&m_service));
|
| + m_service.set_connection_error_handler(convertToBaseCallback(WTF::bind(
|
| + &NavigatorShare::onConnectionError, wrapWeakPersistent(this))));
|
| DCHECK(m_service);
|
| }
|
|
|
| @@ -117,4 +126,12 @@ ScriptPromise NavigatorShare::share(ScriptState* scriptState,
|
| return from(navigator).share(scriptState, shareData);
|
| }
|
|
|
| +void NavigatorShare::onConnectionError() {
|
| + for (auto& client : m_clients) {
|
| + client->onConnectionError();
|
| + }
|
| + m_clients.clear();
|
| + m_service.reset();
|
| +}
|
| +
|
| } // namespace blink
|
|
|