Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

because the document's frame is sandboxed and the 'allow-scripts' permission is not set #34

Open
xukaisjz opened this issue Aug 29, 2020 · 5 comments

Comments

@xukaisjz
Copy link

"Blocked script execution in 'file:///D:/makevideo/replay.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.", source: file:///D:/makevideo/replay.html (0)
TimeoutError: Navigation timeout of 30000 ms exceeded
at D:\software\nodejs\node_global\node_modules\timecut\node_modules\puppeteer\lib\LifecycleWatcher.js:142:21
-- ASYNC --
at Frame. (D:\software\nodejs\node_global\node_modules\timecut\node_modules\puppeteer\lib\helper.js:111:15)
at Page.goto (D:\software\nodejs\node_global\node_modules\timecut\node_modules\puppeteer\lib\Page.js:672:49)
at Page. (D:\software\nodejs\node_global\node_modules\timecut\node_modules\puppeteer\lib\helper.js:112:23)
at D:\software\nodejs\node_global\node_modules\timecut\node_modules\timesnap\index.js:173:21
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Error: spawn ffmpeg ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn ffmpeg',
path: 'ffmpeg',
spawnargs: [
'-framerate',
60,
'-i',
'D:\makevideo\timecut-temp-1598701129093\image-%09d.png',
'-pix_fmt',
'yuv420p',
'-y',
'D:\makevideo\video.mp4'
]
}

How to solve this problem,thank you very much

@tungs
Copy link
Owner

tungs commented Aug 30, 2020

Can you post what's inside replay.html? It might be that you have an iframe issue. You might also have luck running a local web server instead of loading it directly from file:///.

@xukaisjz
Copy link
Author

xukaisjz commented Aug 30, 2020 via email

@tungs
Copy link
Owner

tungs commented Aug 30, 2020

According to the docs for rrweb, it looks like the iframe is sandboxed so that no JavaScript is allowed to run: https://github.com/rrweb-io/rrweb/blob/0f227492dcbd7dd1de7c0c0990d3c4d2ea4e2e4b/docs/sandbox.md#iframe-sandbox

timesnap/timecut automatically adds time-handling JavaScript to a page and all of its children frames and runs JavaScript to coordinate virtual times. Because JavaScript is prohibited in a sandboxed iframe, this might be throwing an error which prevents the rest of the page to run.

There currently isn't any way to not run the time-handling code to children frames, without editing the timesnap's source code. If you want to edit it, change the line at https://github.com/tungs/timesnap/blob/386541965138b418e47a8ef004ed841b905b2df4/index.js#L187 to use only the main frame:

        var browserFrames = [ page.mainFrame() ];

If there are multiple child frames, this only works if none of them require JavaScript time handling. There's also initialization code that's run from page.evaluateOnNewDocument that's automatically run on all child frames, but I don't know if that would cause any errors.

In the future, there may be a configuration option to filter or not run time handling code on child browser frames.

@xukaisjz
Copy link
Author

According to the docs for rrweb, it looks like the iframe is sandboxed so that no JavaScript is allowed to run: https://github.com/rrweb-io/rrweb/blob/0f227492dcbd7dd1de7c0c0990d3c4d2ea4e2e4b/docs/sandbox.md#iframe-sandbox

timesnap/timecut automatically adds time-handling JavaScript to a page and all of its children frames and runs JavaScript to coordinate virtual times. Because JavaScript is prohibited in a sandboxed iframe, this might be throwing an error which prevents the rest of the page to run.

There currently isn't any way to not run the time-handling code to children frames, without editing the timesnap's source code. If you want to edit it, change the line at https://github.com/tungs/timesnap/blob/386541965138b418e47a8ef004ed841b905b2df4/index.js#L187 to use only the main frame:

        var browserFrames = [ page.mainFrame() ];

If there are multiple child frames, this only works if none of them require JavaScript time handling. There's also initialization code that's run from page.evaluateOnNewDocument that's automatically run on all child frames, but I don't know if that would cause any errors.

In the future, there may be a configuration option to filter or not run time handling code on child browser frames.

@xukaisjz xukaisjz reopened this Aug 31, 2020
@xukaisjz
Copy link
Author

Puppeeter may be the problem, and how to fix it

**TimeoutError: Navigation timeout of 30000 ms exceeded** **at D:\software\nodejs\node_global\node_modules\timecut\node_modules\puppeteer\lib\LifecycleWatcher.js:142:21** -- ASYNC -- at Frame.<anonymous> (D:\software\nodejs\node_global\node_modules\timecut\node_modules\puppeteer\lib\helper.js:111:15) at Page.goto (D:\software\nodejs\node_global\node_modules\timecut\node_modules\puppeteer\lib\Page.js:672:49) at Page.<anonymous> (D:\software\nodejs\node_global\node_modules\timecut\node_modules\puppeteer\lib\helper.js:112:23) at D:\software\nodejs\node_global\node_modules\timecut\node_modules\timesnap\index.js:173:21 at processTicksAndRejections (internal/process/task_queues.js:97:5) Error: spawn ffmpeg ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19) at onErrorNT (internal/child_process.js:469:16) at processTicksAndRejections (internal/process/task_queues.js:84:21) { errno: 'ENOENT', code: 'ENOENT', syscall: 'spawn ffmpeg', path: 'ffmpeg', spawnargs: [ '-framerate', 30, '-i', 'D:\\makevideo\\timecut-temp-1598839890051\\image-%09d.png', '-pix_fmt', 'yuv420p', '-y', 'D:\\makevideo\\video.mp4' ] } (node:4112) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, scandir 'D:\makevideo\timecut-temp-1598839890051' at Object.readdirSync (fs.js:948:3) at deleteFolder (D:\software\nodejs\node_global\node_modules\timecut\index.js:51:6) at D:\software\nodejs\node_global\node_modules\timecut\index.js:182:9 at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:4112) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:4112) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants