@@ -325,6 +325,20 @@ def object_src(self, *sources: str) -> "ContentSecurityPolicy":
325325 self ._build ("object-src" , * sources )
326326 return self
327327
328+ def prefetch_src (self , * sources : str ) -> "ContentSecurityPolicy" :
329+ """Set valid resources that may prefetched or prerendered
330+
331+ Resouces:
332+ https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/prefetch-src
333+
334+ :param sources: variable number of sources
335+ :type sources: str
336+ :return: ContentSecurityPolicy class
337+ :rtype: ContentSecurityPolicy
338+ """
339+ self ._build ("prefetch-src" , * sources )
340+ return self
341+
328342 def report_to (self , report_to : ReportTo ) -> "ContentSecurityPolicy" :
329343 """Configure reporting endpoints
330344
@@ -786,12 +800,15 @@ def __init__(self) -> None:
786800 self .__policy : List [str ] = []
787801 self .header = "Permissions-Policy"
788802 self .value = (
789- "accelerometer=(), ambient-light-sensor=(), autoplay=(),"
790- "camera=(), encrypted-media=(), fullscreen=(),"
791- "geolocation=(), gyroscope=(), magnetometer=(),"
792- "microphone=(); midi=(), payment=(),"
793- "picture-in-picture=(), speaker=(), sync-xhr=(), usb=(),"
794- "vr=()"
803+ "accelerometer=(), ambient-light-sensor=(), autoplay=(), battery=(), "
804+ "camera=(), clipboard-read=(), clipboard-write=(), cross-origin-isolated=(), "
805+ "display-capture=(), document-domain=(), encrypted-media=(), "
806+ "execution-while-not-rendered=(), execution-while-out-of-viewport=(), "
807+ "fullscreen=(), gamepad=(), geolocation=(), gyroscope=(), magnetometer=(), "
808+ "microphone=(), midi=(), navigation-override=(), payment=(), "
809+ "picture-in-picture=(), publickey-credentials-get=(), screen-wake-lock=(), "
810+ "speaker-selection=(), sync-xhr=(), usb=(), web-share=(), "
811+ "xr-spatial-tracking=()"
795812 )
796813
797814 def _build (self , directive : str , * sources : str ) -> None :
@@ -807,17 +824,37 @@ def accelerometer(self, *allowlist: str) -> "PermissionsPolicy":
807824 return self
808825
809826 def ambient_light_sensor (self , * allowlist : str ) -> "PermissionsPolicy" :
810- self ._build ("ambient-light-sensor " , * allowlist )
827+ self ._build ("ambient-light-sensor" , * allowlist )
811828 return self
812829
813830 def autoplay (self , * allowlist : str ) -> "PermissionsPolicy" :
814831 self ._build ("autoplay" , * allowlist )
815832 return self
816833
834+ def battery (self , * allowlist : str ) -> "PermissionsPolicy" :
835+ self ._build ("battery" , * allowlist )
836+ return self
837+
817838 def camera (self , * allowlist : str ) -> "PermissionsPolicy" :
818839 self ._build ("camera" , * allowlist )
819840 return self
820841
842+ def clipboard_read (self , * allowlist : str ) -> "PermissionsPolicy" :
843+ self ._build ("clipboard-read" , * allowlist )
844+ return self
845+
846+ def clipboard_write (self , * allowlist : str ) -> "PermissionsPolicy" :
847+ self ._build ("clipboard-write" , * allowlist )
848+ return self
849+
850+ def cross_origin_isolated (self , * allowlist : str ) -> "PermissionsPolicy" :
851+ self ._build ("cross-origin-isolated" , * allowlist )
852+ return self
853+
854+ def display_capture (self , * allowlist : str ) -> "PermissionsPolicy" :
855+ self ._build ("display-capture" , * allowlist )
856+ return self
857+
821858 def document_domain (self , * allowlist : str ) -> "PermissionsPolicy" :
822859 self ._build ("document-domain" , * allowlist )
823860 return self
@@ -826,10 +863,22 @@ def encrypted_media(self, *allowlist: str) -> "PermissionsPolicy":
826863 self ._build ("encrypted-media" , * allowlist )
827864 return self
828865
866+ def execution_while_not_rendered (self , * allowlist : str ) -> "PermissionsPolicy" :
867+ self ._build ("execution-while-not-rendered" , * allowlist )
868+ return self
869+
870+ def execution_while_out_of_viewport (self , * allowlist : str ) -> "PermissionsPolicy" :
871+ self ._build ("execution-while-out-of-viewport" , * allowlist )
872+ return self
873+
829874 def fullscreen (self , * allowlist : str ) -> "PermissionsPolicy" :
830875 self ._build ("fullscreen" , * allowlist )
831876 return self
832877
878+ def gamepad (self , * allowlist : str ) -> "PermissionsPolicy" :
879+ self ._build ("gamepad" , * allowlist )
880+ return self
881+
833882 def geolocation (self , * allowlist : str ) -> "PermissionsPolicy" :
834883 self ._build ("geolocation" , * allowlist )
835884 return self
@@ -850,6 +899,10 @@ def midi(self, *allowlist: str) -> "PermissionsPolicy":
850899 self ._build ("midi" , * allowlist )
851900 return self
852901
902+ def navigation_override (self , * allowlist : str ) -> "PermissionsPolicy" :
903+ self ._build ("navigation-override" , * allowlist )
904+ return self
905+
853906 def payment (self , * allowlist : str ) -> "PermissionsPolicy" :
854907 self ._build ("payment" , * allowlist )
855908 return self
@@ -858,10 +911,26 @@ def picture_in_picture(self, *allowlist: str) -> "PermissionsPolicy":
858911 self ._build ("picture-in-picture" , * allowlist )
859912 return self
860913
914+ def publickey_credentials_get (self , * allowlist : str ) -> "PermissionsPolicy" :
915+ self ._build ("publickey-credentials-get" , * allowlist )
916+ return self
917+
918+ def screen_wake_lock (self , * allowlist : str ) -> "PermissionsPolicy" :
919+ self ._build ("screen-wake-lock" , * allowlist )
920+ return self
921+
861922 def speaker (self , * allowlist : str ) -> "PermissionsPolicy" :
923+ warnings .warn (
924+ "'speaker' feature was removed in favor of 'speaker_selection'" ,
925+ DeprecationWarning ,
926+ )
862927 self ._build ("speaker" , * allowlist )
863928 return self
864929
930+ def speaker_selection (self , * allowlist : str ) -> "PermissionsPolicy" :
931+ self ._build ("speaker-selection" , * allowlist )
932+ return self
933+
865934 def sync_xhr (self , * allowlist : str ) -> "PermissionsPolicy" :
866935 self ._build ("sync-xhr" , * allowlist )
867936 return self
@@ -870,10 +939,24 @@ def usb(self, *allowlist: str) -> "PermissionsPolicy":
870939 self ._build ("usb" , * allowlist )
871940 return self
872941
942+ def web_share (self , * allowlist : str ) -> "PermissionsPolicy" :
943+ self ._build ("web-share" , * allowlist )
944+ return self
945+
873946 def vibrate (self , * allowlist : str ) -> "PermissionsPolicy" :
874- self ._build ("vibrate" , * allowlist )
947+ warnings .warn (
948+ "'vibrate' feature has been removed without ever actually having been implemented" ,
949+ DeprecationWarning ,
950+ )
875951 return self
876952
877953 def vr (self , * allowlist : str ) -> "PermissionsPolicy" :
954+ warnings .warn (
955+ "'vr' feature was renamed to 'xr_spatial_tracking'" , DeprecationWarning
956+ )
878957 self ._build ("vr" , * allowlist )
879958 return self
959+
960+ def xr_spatial_tracking (self , * allowlist : str ) -> "PermissionsPolicy" :
961+ self ._build ("xr-spatial-tracking" , * allowlist )
962+ return self
0 commit comments