Implement view-source protocol. Fixes #4181.

This follows the recommendation from issue #4181. A handler
for 'view-source' delegates to the HTTP loader. In that
loader I check for view-source, adjust the URL to be the
URL to be viewed and modify the Content-Type header to be
text/plain.

This doesn't actually result in the source being
viewed as rendering text/plain is not yet implemented.
This commit is contained in:
Chris Double 2015-03-12 23:41:09 +13:00
parent f5ddbcf19f
commit 82c52a7a1c
3 changed files with 34 additions and 3 deletions

View file

@ -333,7 +333,7 @@ impl ResourceManager {
let loader = match load_data.url.scheme.as_slice() {
"file" => from_factory(file_loader::factory),
"http" | "https" => http_loader::factory(self.resource_task.clone()),
"http" | "https" | "view-source" => http_loader::factory(self.resource_task.clone()),
"data" => from_factory(data_loader::factory),
"about" => from_factory(about_loader::factory),
_ => {