File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed
Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 44 const params = Object . fromEntries ( new URLSearchParams ( window . location . search ) . entries ( ) ) ;
55 const url = new URL ( params . url ) ;
66
7+ const allow = [
8+ 'accelerometer' ,
9+ 'bluetooth' ,
10+ 'camera' ,
11+ 'encrypted-media' ,
12+ 'display-capture' ,
13+ 'geolocation' ,
14+ 'gyroscope' ,
15+ 'microphone' ,
16+ 'midi' ,
17+ 'clipboard-read' ,
18+ 'clipboard-write' ,
19+ 'web-share' ,
20+ 'serial' ,
21+ 'xr-spatial-tracking' ,
22+ ] . map ( v => `${ v } *` ) . join ( '; ' ) ;
23+
724 let iframe ;
825
926 async function startServiceWorker ( ) {
@@ -144,6 +161,7 @@ iframe {
144161 function insertInBlob ( mainHTML , mainJS , mainCSS ) {
145162 applyCSSToSelfToRunContentInIFrame ( ) ;
146163 const iframe = document . createElement ( 'iframe' ) ;
164+ iframe . allow = allow ;
147165 const html = makePageHTML ( mainHTML , mainJS , mainCSS ) ;
148166 registerSections ( html ) ;
149167 const blob = new Blob ( [ html ] , { type : 'text/html' } ) ;
@@ -155,6 +173,7 @@ iframe {
155173 function insertInServiceWorker ( mainHTML , mainJS , mainCSS ) {
156174 applyCSSToSelfToRunContentInIFrame ( ) ;
157175 const iframe = document . createElement ( 'iframe' ) ;
176+ iframe . allow = "accelerometer *; bluetooth *; camera *; encrypted-media *; display-capture *; geolocation *; gyroscope *; microphone *; midi *; clipboard-read *; clipboard-write *; web-share *; serial *; xr-spatial-tracking *"
158177 const html = makePageHTML ( mainHTML , mainJS , mainCSS ) ;
159178 registerSections ( html ) ;
160179 cacheFile ( '/user-jsgist.html' , 'text/html' , html ) ;
Original file line number Diff line number Diff line change @@ -5,6 +5,23 @@ import ServiceContext from '../ServiceContext.js';
55import { createURL } from '../libs/url.js' ;
66import * as winMsgMgr from '../libs/WindowMessageManager' ;
77
8+ const allow = [
9+ 'accelerometer' ,
10+ 'bluetooth' ,
11+ 'camera' ,
12+ 'encrypted-media' ,
13+ 'display-capture' ,
14+ 'geolocation' ,
15+ 'gyroscope' ,
16+ 'microphone' ,
17+ 'midi' ,
18+ 'clipboard-read' ,
19+ 'clipboard-write' ,
20+ 'web-share' ,
21+ 'serial' ,
22+ 'xr-spatial-tracking' ,
23+ ] . map ( v => `${ v } *` ) . join ( '; ' ) ;
24+
825export default class Runner extends React . Component {
926 constructor ( props ) {
1027 super ( props ) ;
@@ -45,6 +62,7 @@ export default class Runner extends React.Component {
4562 this . data = data ;
4663 this . removeIFrame ( ) ;
4764 const iframe = document . createElement ( 'iframe' ) ;
65+ iframe . allow = allow ;
4866 this . iframe = iframe ;
4967 iframe . src = isDevelopment
5068 ? createURL ( `http://${ window . location . hostname } :8081/runner-03.html` , { url : `http://${ window . location . hostname } :8080/jsgist-runner.js` , ...extra } )
You can’t perform that action at this time.
0 commit comments