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
Using libservo in another project requires copying the /resources/ directory into the embedder source code. Would it be possible to "include" these files within the libservo library?
We could certainly include them at compile time wth include_str! and include_bytes!. We'd probably only want to do this in library form in external apps, or alternatively do it always but have some runtime flag that gives it a place to look to override these.
Yes. As soon as I have some time, I'll finish my PR #17769. The idea is first to only keep what's absolutely necessary (many stuff in /resources/ are useless at runtime), then bundle the files with the library (what Jack said).
For these, because it's done during initialization of Servo, we can pass a Chrome URL resolver/reader to Servo. It should not be too hard.
userscripts
For this one, we can just let Servo read the files itself, without the help of the embedder.
WR: shaders
Apparently, they are compiled within WR now. So same as userscripts
The problematic components are:
image cache: rippy.png
dom/servoparser: badcert.html and neterror.html, to display a network error
Here, I don't know how to reach back to the embedder or the constellation or call a Fetch on the chrome url. Could we use some sort of redirect mechanism?
make the part of the Fetch algorithm that is responsible for processing response headers synchronous, so that FetchResponseListener::process_response could return an enum that means "I am ready to accept the body" or "please redirect transparently to [url]". This would also require that the Metadata structure contains some way of obtaining the pre-redirect URL, so that consumers of the redirected response would be able to transparently report the pretend URL as necessary. This would allow ServoDomParser::process_response to return chrome URLs for the error cases that it wants to be responsible for handling.
Make ScriptThread::handle_page_headers_available accept a Result argument for the page metadata, then abort the current load and initiate a new load for the appropriate chrome URL if an error is encountered.
Option 2 looks more contained to me, and will not impact the performance of non-error loads.
So, this is still relevant. We made it so that the embedder can provide its own way of reading the files, but the files are still necessary. We still need to copy the resources/ directory into the embedder project.
Activity
paulrouget commentedon Apr 29, 2017
/cc @metajack
metajack commentedon May 2, 2017
We could certainly include them at compile time wth include_str! and include_bytes!. We'd probably only want to do this in library form in external apps, or alternatively do it always but have some runtime flag that gives it a place to look to override these.
metajack commentedon May 2, 2017
We'd probably need some kind of file loader module that the code that reads these uses, which can do the right thing.
paulrouget commentedon May 30, 2017
If we manage to only keep the necessary resources, we would move 3.1Mb of strings to 880Kb.
tschneidereit commentedon Jun 26, 2017
@metajack let's talk about what to do here this week.
nox commentedon Oct 8, 2017
@tschneidereit @paulrouget Did you ever decide what's the way to go for this?
paulrouget commentedon Oct 8, 2017
Yes. As soon as I have some time, I'll finish my PR #17769. The idea is first to only keep what's absolutely necessary (many stuff in /resources/ are useless at runtime), then bundle the files with the library (what Jack said).
paulrouget commentedon Mar 23, 2018
I wanted to delegate resource file reading to the embedder, but the SSL certificates are read from a file descriptor: https://github.com/sfackler/rust-openssl/blob/95ea48978492ec918471249c0d66294b4af0ae16/openssl/src/ssl/mod.rs#L849
jdm commentedon Mar 23, 2018
@paulrouget according to https://stackoverflow.com/questions/5052563/c-openssl-use-root-ca-from-buffer-rather-than-file-ssl-ctx-load-verify-locat there are APIs to update the cert store directly, which correspond to cert_store_mut and add_cert.
jdm commentedon Mar 23, 2018
This is a code sample to get an x509 from a buffer, too.
paulrouget commentedon Mar 28, 2018
I'm working on delegating resources reading to the embedder.
The resources files are read from:
new_resource_threadswhen the constellation is createdI'm introducing an embedder message:
I also implemented a chrome_loader that resolve and read a chrome://resource url.
So all the components above need to either have access to, either, the EmbedderProxy or a way to make Fetch call to a chrome url.
new_resource_threadswhen the constellation is createdFor these, because it's done during initialization of Servo, we can pass a Chrome URL resolver/reader to Servo. It should not be too hard.
For this one, we can just let Servo read the files itself, without the help of the embedder.
Apparently, they are compiled within WR now. So same as userscripts
The problematic components are:
Here, I don't know how to reach back to the embedder or the constellation or call a Fetch on the chrome url. Could we use some sort of redirect mechanism?
jdm commentedon Mar 28, 2018
@paulrouget I see two possible solutions here:
FetchResponseListener::process_responsecould return an enum that means "I am ready to accept the body" or "please redirect transparently to [url]". This would also require that theMetadatastructure contains some way of obtaining the pre-redirect URL, so that consumers of the redirected response would be able to transparently report the pretend URL as necessary. This would allowServoDomParser::process_responseto return chrome URLs for the error cases that it wants to be responsible for handling.ScriptThread::handle_page_headers_availableaccept a Result argument for the page metadata, then abort the current load and initiate a new load for the appropriate chrome URL if an error is encountered.Option 2 looks more contained to me, and will not impact the performance of non-error loads.
Auto merge of #20533 - paulrouget:res, r=mbrubeck
Auto merge of #20533 - paulrouget:res, r=mbrubeck
Auto merge of #20533 - paulrouget:res, r=mbrubeck
paulrouget commentedon Apr 28, 2018
So, this is still relevant. We made it so that the embedder can provide its own way of reading the files, but the files are still necessary. We still need to copy the resources/ directory into the embedder project.
Keeping open.