As we can't see the picture, you can find it here :
http://s17.postimg.org/bwra06wnj/firefoxapp_readium_ebook.png
Le lundi 6 octobre 2014 15:16:03 UTC+2, Johan Poirier a écrit :
> Hi,
>
>
> At TEA (the ebook alternative), we aim at building an epub reader app for firefox os phones. For that purpose, we're using the open source project Readium, a JavaScript library and viewer for EPUB 3 rendering optimized for use to render EPUB files directly from websites and in browser-based "cloud" readers. We tried to use it in a privileged app but we ran into a few issues (CSP, storage, ...) : I'll explain why.
>
>
>
> But first, what's an epub file ? it's basically a website zipped in a file. Here's the structure :
>
>
> --ZIP Container--
> mimetype
> META-INF/
> container.xml
> OEBPS/
> content.opf
> chapter1.xhtml
> ch1-pic.png
> css/
> style.css
> myfont.otf
>
>
> An epub file contains HTML pages, CSS, fonts, and javascript. In order to render it in a browser, Readium loads the content of the epub into an <iframe>.
>
>
> You can see in the diagram below the architecture of the application with Readium and the iFrame containing the epub content :
>
>
>
>
>
>
>
>
>
>
>
>
>
> As you can see, we packaged Readium into a HTML5 privileged app to have access to the SD card. But privileged apps enforce a CSP (content security policy) by default. Inline scripts are forbidden and blob URLs too. For example, <link href="blob:38849-4530-7873-1072" rel="stylesheet"> violates the CSP. In that particular case, the workaround is to put the content of the blob into a <style> element as 'unsafe-inline' style is authorized. But as far as I know, there is no workaround for javascript code. We are stuck here and that's why we're seeking your help.
>
>
> We found this discussion on Google Groups speaking about iFrame and sandboxing. We'd like to know your opinion about the last post from Jonas Sicking :
>
>
> You might be able to use
>
> <iframe src="..." sandbox="allow-scripts">
> since that would mean that the sandboxed document isn't same-origin
> with the app. In general, it would be nice if we had some way of
> loading a resource from the package such that it didn't have
> permission to use any privileged APIs, but that it didn't have CSP
> applied.
>
>
> Though ideally such an iframe would run out-of-process for security reasons.
>
>
>
>
>
>
> We wanted to share our issues and discuss it with you, in order to move the firefox os platform forward. Maybe you have some solutions for us, maybe not but we want to be able to talk about it with you.
>
>