You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.
2. Next to index.html make a file an name it worker.js, it's exactly `yaml.js file with these lines added at the end:
onmessage = function (message) {
postMessage(yaml.compose(message.data));
}
Which is basically adding a very simple Web Worker API to yaml-js. It also fixes the bug I reported in #16 by using this as global: var global = this;
3. Make another file and name it file.yaml. Content of this file can be found here: http://pastebin.com/c8AYYEGF
4. Run a static web server like http-server from this folder and open the browser. What I see is Chrome's "Aw! Snap!" message. When I profiled this, memory usage goes up and up until tab crashes
Firefox crashes also. Safari doesn't have the Fetch API so I can't test it but I'm pretty sure that would crash also.
Note that the same file and the same method is not having this issue when run in the main thread. So if you change the content of HTML file to following code, the error won't happen:
I'm going to close it since this repository is going to be archived. yaml-js has been unmaintained for some time, so it would be best to use something else.
Here is what I've done to reproduce this bug:
1. Make an HTML file with following content:
2. Next to
index.html
make a file an name itworker.js
, it's exactly `yaml.js file with these lines added at the end:Which is basically adding a very simple Web Worker API to yaml-js. It also fixes the bug I reported in #16 by using
this
asglobal
:var global = this;
3. Make another file and name it
file.yaml
. Content of this file can be found here: http://pastebin.com/c8AYYEGF4. Run a static web server like
http-server
from this folder and open the browser. What I see is Chrome's "Aw! Snap!" message. When I profiled this, memory usage goes up and up until tab crashesFirefox crashes also. Safari doesn't have the Fetch API so I can't test it but I'm pretty sure that would crash also.
Note that the same file and the same method is not having this issue when run in the main thread. So if you change the content of HTML file to following code, the error won't happen:
You can also download all the files in one zip file from here: https://github.com/mohsen1/mohsen1.github.io/blob/b8d76793a1e81a6c35fe83de3fea322edac910db/assets/yaml.zip
This issue was originally raised in Swagger Editor:
swagger-api/swagger-editor#641
swagger-api/swagger-editor#658
swagger-api/swagger-editor#651
The text was updated successfully, but these errors were encountered: