From 62fa5f7a993b6092383ee6774b70c180451a3908 Mon Sep 17 00:00:00 2001 From: Darwin Huang Date: Mon, 7 Oct 2019 18:32:23 -0700 Subject: [PATCH] Update Minimal Implementation section Update after more context from a Webkit perspective on a minimal implementation. Source: https://github.com/dway123/raw-clipboard-access/issues/3#issuecomment-538627436 --- explainer.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/explainer.md b/explainer.md index 6f31c46..15d6abf 100644 --- a/explainer.md +++ b/explainer.md @@ -200,8 +200,7 @@ This was decided against to simplify and minimize the API surface, by avoiding c After some discussion with Webkit, a proposed alternative was to allow only "partner" sites, for example native and web applications with the same source origin, to have raw clipboard access. This was decided against for this explainer as it would break the compatibility requirements for Raw Clipboard Access, but may be a viable reduced implementation for user agents concerned about the full described API that may satisfy some common use-cases. ### Minimal implementation for user agents -A user agent that decides not to implement all of Raw Clipboard Access for various reasons should consider at least rejecting immediately on any call with `{raw : true}`. This allows web applications to gracefully detect failure, as they should already do in case of rejected permission or failure to encode/decode, and fall back to existing sanitized clipboard APIs. Rejecting immediately is important because otherwise web applications may do user agent detection, using the raw clipboard access for user agents that implement it, and using a fallback API for user agents that don’t. This means that if the user agent were to later implement such a feature, they would either need to either ask the web application to remove/update user agent detection, have to live with the feature not working on sites that implemented user agent detection, or (even worse) have to masquerade as a browser that previously implemented such a feature. - +Feature detection should be possible by checking `ClipboardItem`'s prototype for the `raw` property, and may be helpful to detect whether to use Raw Clipboard Access is implemented, in environments where not all user agents have implemented. That said, Webkit has [suggested](https://github.com/dway123/raw-clipboard-access/issues/3#issuecomment-538627436) that a user agent that decides not to implement all of Raw Clipboard Access may also consider rejecting on any call with `{raw : true}`, and instead fall back and write the payload as `{raw : false}`. ## Permissions