Skip to content

Commit

Permalink
Don't throw an error if access to the clipboard is denied.
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Zatsarynnyi <azatsary@redhat.com>
  • Loading branch information
azatsarynnyy committed Nov 11, 2019
1 parent 8bf4dfc commit 8f11551
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/core/src/browser/browser-clipboard-service.ts
Expand Up @@ -56,13 +56,13 @@ export class BrowserClipboardService implements ClipboardService {
It can be enabled by 'dom.events.testing.asyncClipboard' preference on 'about:config' page. Then reload Theia.
Note, it will allow FireFox getting full access to the system clipboard.`);
}
throw new Error('Failed reading clipboard content.');
return '';
}
}
if (permission.state === 'denied') {
// most likely, the user intentionally denied the access
this.messageService.error("Access to the clipboard is denied. Check your browser's permission.");
throw new Error('Access to the clipboard is denied.');
this.messageService.warn("Access to the clipboard is denied. Check your browser's permission.");
return '';
}
return this.getClipboardAPI().readText();
}
Expand All @@ -84,13 +84,13 @@ export class BrowserClipboardService implements ClipboardService {
It can be enabled by 'dom.events.testing.asyncClipboard' preference on 'about:config' page. Then reload Theia.
Note, it will allow FireFox getting full access to the system clipboard.`);
}
throw new Error('Failed writing the the clipboard.');
return;
}
}
if (permission.state === 'denied') {
// most likely, the user intentionally denied the access
this.messageService.error("Access to the clipboard is denied. Check your browser's permission.");
throw new Error('Access to the clipboard is denied.');
this.messageService.warn("Access to the clipboard is denied. Check your browser's permission.");
return;
}
return this.getClipboardAPI().writeText(value);
}
Expand Down

0 comments on commit 8f11551

Please sign in to comment.