popcodeorg / popcodeorg/popcode
Load preview in secure frame
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- JavaScript
- Star
- 191
- Fork
- 143
- Merge trung bình
- 4 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 5
Mô tả
Certain features, such as the camera API, don’t work properly in the preview iframe because it is not considered secure. This is odd to me, since it’s a srcdoc iframe in a secure parent frame, but it is what it is.
One idea: create a static HTML page whose job is to render the preview. That page would basically be a blank document with the previewSupport JavaScript bundle loaded in. In addition to the current previewSupport functionality, we’d listen for an initial message from the parent document containing the full HTML document that is to be previewed, and then use a document.open() followed by a document.write() to replace the entire DOM with the project preview. I think it would be most sensible for this hook to just be part of the initial JS Channel initialization handshake.
Live-updating of the preview should work pretty well out of the box, since we already load each successive compiled project iteration in a fresh iframe. The main thing to look out for is that we preload the on-deck iframe, with the preview support bundle loaded and ready. I think the current logic for managing the preview frames should naturally produce this behavior, but itʼs worth confirming.
Worth noting that this would considerably simplify the bundling and loading of previewSupport, which is currently quite hacky.
Original bug report
Submitter: Z
Email: zwilkinson@westinghousehs.org
I can’t use the browser’s Camera API from inside the preview window, because the preview is a data: URI that is not considered secure.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách xác định bundle previewSupport, handshake khởi tạo của JS Channel và logic quản lý các frame preview được tải trước. Theo dõi cách parent gửi HTML của project và cách các iteration đã biên dịch liên tiếp được tải, sau đó xác nhận rằng một secure page tĩnh có thể nhận document ban đầu, thay thế DOM của nó và duy trì các cập nhật trực tiếp.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript
- Lĩnh vực
- frontend
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100