| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Reading through the Mozilla documentation it looks like this property is considered legacy and they suggest allow="fullscreen" as the preferred attribute now. It seems that supporting the allow attribute with perhaps a sum type covering the available cases would be the better long-term fix. |
Sorry, something went wrong.
|
@thomashoneyman that's a good idea. Do you know if allow accepts multiple values? It seems that allow="fullscreen" and allow="payment" both use the same key but I do not see any docs about using both at the same time. Also, should the sum type go in src/Halogen/HTML/Properties.purs? |
Sorry, something went wrong.
|
Do not accept yet I am adding multiple value capabilities |
Sorry, something went wrong.
|
now takes multiple values |
Sorry, something went wrong.
|
It looks like it uses the syntax of feature policies that also can be set in HTTP requests: https://developer.mozilla.org/en-US/docs/Web/HTTP/Feature_Policy/Using_Feature_Policy Syntax and list of features here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy Maybe a Map would be appropriate? |
Sorry, something went wrong.
|
It is annoying that they "allow" so many syntactic differences. |
Sorry, something went wrong.
|
@MonoidMusician Didn't use Map but did include a key value constructor. |
Sorry, something went wrong.
|
@MonoidMusician @thomashoneyman Is there anything else that needs to be done here? |
Sorry, something went wrong.
| preload = prop (PropName "preload") | ||
|
|
||
| allow :: forall r i. Allow -> IProp (allow :: String | r) i | ||
| allow = prop (PropName "allowfullscreen") <<< renderAllow |
There was a problem hiding this comment.
| allow = prop (PropName "allowfullscreen") <<< renderAllow | |
| allow = prop (PropName "allow") <<< renderAllow |
Shouldn't this have the prop name "allow"?
Sorry, something went wrong.
|
|
||
| tabIndex :: forall r i. Int -> IProp (tabIndex :: Int | r) i | ||
| tabIndex = prop (PropName "tabIndex") | ||
|
|
There was a problem hiding this comment.
Sorry, something went wrong.
|
I took a moment to walk through the documentation on MDN. I’d like to share some snippets from the documentation that describe the purpose and syntax of this policy — I wasn’t aware of this information until this moment, so I’d like to share these in case other reviewers are also unfamiliar with how this works! Then, with this knowledge in hand, I’d like to share what adjustments I think should be made to the types. The Feature Policy page summarizes what this policy is about:
You can enforce some restrictions on APIs and features that a website can use. This can be done via an HTTP header or via the allow attribute on an <iframe>, which is what we care about in this instance. In both cases the idea and the syntax seem to be the same. Those are documented further on the Using Feature Policy page:
This gives more direction on what exactly allow is controlling: it lets you write a ‘feature policy’ by combining a set of individual ‘policy directives’, where each policy directive combines a feature name with an allowlist of origins that can use the feature. Using the MDN terminology brings to mind another way to structure the types:
There are many ways we could define types to capture this structure. For example, a minimal version might say that allow accepts an Array PolicyDirective and each PolicyDirective is a simple tuple of a FeatureName and an Array Origin, where an empty array represents the default. But there’s yet more detail about what constitutes an acceptable allowlist:
So it’s not quite correct that you can just have a list of origins. Instead, you can either have:
So perhaps we would want to have a Allowlist type that captures these possibilities rather than just being a flat array of origins. After all, it’s not correct that you could do an allow list like: [ All, Self, None, Origin "https://example.com" ] Turning now to what features might make up a FeatureName, I took a look at the full list of supported feature directives, and it seems like we ought to at least support directives with Chrome, Edge, Firefox, Opera, or Safari compatibility. In the current type only two of these directives are represented (”fullscreen” and ”payment”) and the rest would have to be written manually the Allow String or AllowMultiple (Array Allow) or AllowOrigin String Origin constructors, but I think we should support all the directives with at least one major non-IE browser supporting the feature. Whew! Sorry for such a lengthy dive into the documentation, but I wanted to get this information out into this PR so we can all use it as a basis for further discussion. With all of this in mind, I think that we should adjust these types a little bit to accommodate the MDN specification. Here’s what I propose (but I’m open to other suggestions): First, allow should be restricted to accept policy directives. The policy directive type should either be:
Second, FeatureName should be a type which covers all supported feature directives that a major non-IE browser can leverage. Third, the Allowlist type should properly represent that it can be ‘*’, ‘none’ or ‘self’, ‘src’, and/or a list of strings representing other origins. Finally, we should have a string renderer which follows these rules:
As a bonus (which I’m happy to add on to your PR as a follow-up), it would be really nice to have a test that makes sure that the formatting is correct for various cases: -- fromFoldable [ Tuple Fullscreen Nothing ]
"fullscreen"
-- fromFoldable [ Tuple Fullscreen (Just [ SrcOrigin ]) ]
"fullscreen 'src'"
-- fromFoldable [ Tuple Geolocation (Just [ Origin "https://example.com", "https://google-developers.appspot.com" ]) ]
"geolocation https://example.com https://google-developers.appspot.com"
-- fromFoldable [ Tuple Camera (Just NoOrigin), Tuple Microphone (Just NoOrigin) ]
"camera 'none'; microphone 'none'"Finally, it’s worth noting this little warning in the MDN documentation:
So perhaps any reference to ‘Feature’ in this review should really be ‘Permission’ @BebeSparkelSparkel I understand this bumps up the work necessary to get this PR merged, and I'm sorry to be requesting that additional work. On the other hand, doing so would mean you're really adding the ability to support permission policies to Halogen, which is a pretty big (and welcome) addition! |
Sorry, something went wrong.
|
Lot of things going on right now. I'll try read this soon |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
iframe can go full screen
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-allowfullscreen