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

Firefox Extention - Conent Security Policy Issue #416

Closed
wilgaboury opened this issue Aug 18, 2020 · 2 comments
Closed

Firefox Extention - Conent Security Policy Issue #416

wilgaboury opened this issue Aug 18, 2020 · 2 comments
Labels

Comments

@wilgaboury
Copy link

wilgaboury commented Aug 18, 2020

Currently writing a Firefox plugin and wanted to use this library. Using any of the version 0.9.x of Muuri gives me the following error in the console:

Content Security Policy: The page’s settings blocked the loading of a resource at blob:moz-extension://... (“script-src”).

In my case, (using the library for a grid layout) all the items end are sitting in the same location in the top left corner of the grid. They can be dragged around but wherever they are dragged to they just stay there as if there is no attempt being made to layout the items, even when calling grid.layout() nothing happens.

Looking at the changes to the library it looks like in 0.9 muuri started doing layout calculations in web workers when possible. If those web workers are being loaded as blobs, in my case, Firefox will block them for security reasons. When using version 0.8 this problem does not happen, and I'm assuming that it's because the layout is by default calculated synchronously.

Seems to me like the fix would be to offer a manual setting for synchronous or asynchronous layout algorithm (if that already exists, I couldn't find it in the readme), or add a case that accounts for this issue to the fallback logic so that when the web workers are blocked it automatically uses the synchronous layout code.

@wilgaboury wilgaboury changed the title Conent Security Policy Issue Firefox Extention - Conent Security Policy Issue Aug 18, 2020
@niklasramo
Copy link
Collaborator

Yep, you are 100% correct in your reasoning and gladly there exists an easy way to make Muuri work synchronously. Just run this piece of code once before instantiating any grids.

Muuri.defaultPacker.destroy();
Muuri.defaultPacker = new Muuri.Packer(0);

Let me know if that helps :)

@wilgaboury
Copy link
Author

Yup that fixed the issue. Thank you.

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

No branches or pull requests

2 participants