mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 14:02:46 +00:00 
			
		
		
		
	LibWeb+Browser: Support about: URL protocol so "about:blank" works :^)
For now, we simply load an empty resource from any about: URL.
This commit is contained in:
		
							parent
							
								
									56dbe58bbb
								
							
						
					
					
						commit
						fe0de26277
					
				
					 3 changed files with 10 additions and 2 deletions
				
			
		|  | @ -100,7 +100,7 @@ Tab::Tab() | |||
| 
 | ||||
|     m_location_box->on_return_pressed = [this] { | ||||
|         String location = m_location_box->text(); | ||||
|         if (!location.starts_with("file://") && !location.starts_with("http://") && !location.starts_with("https://")) { | ||||
|         if (!URL(location).is_valid()) { | ||||
|             StringBuilder builder; | ||||
|             builder.append("http://"); | ||||
|             builder.append(location); | ||||
|  |  | |||
|  | @ -413,7 +413,7 @@ void HtmlView::load(const URL& url) | |||
|             load_error_page(url, error); | ||||
|         }); | ||||
| 
 | ||||
|     if (url.protocol() != "file") { | ||||
|     if (url.protocol() != "file" && url.protocol() != "about") { | ||||
|         URL favicon_url; | ||||
|         favicon_url.set_protocol(url.protocol()); | ||||
|         favicon_url.set_host(url.host()); | ||||
|  |  | |||
|  | @ -73,6 +73,14 @@ void ResourceLoader::load(const URL& url, Function<void(const ByteBuffer&, const | |||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     if (url.protocol() == "about") { | ||||
|         dbg() << "Loading about: URL " << url; | ||||
|         deferred_invoke([success_callback = move(success_callback)](auto&) { | ||||
|             success_callback(ByteBuffer::wrap(String::empty().characters(), 1), {}); | ||||
|         }); | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     if (url.protocol() == "data") { | ||||
|         dbg() << "ResourceLoader loading a data URL with mime-type: '" << url.data_mime_type() << "', base64=" << url.data_payload_is_base64() << ", payload='" << url.data_payload() << "'"; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling