Rewild Your Web
at main 56 lines 1.8 kB view raw
1--- original 2+++ modified 3@@ -467,6 +467,10 @@ 4 self.fetch_and_process_prefetch_link(&href); 5 } 6 7+ if relations.contains(LinkRelations::WEBTASKS) { 8+ self.fetch_and_process_webtasks_link(&href); 9+ } 10+ 11 if relations.contains(LinkRelations::PRELOAD) { 12 self.handle_preload_url(); 13 } 14@@ -661,6 +665,33 @@ 15 document.fetch_background(request, fetch_context); 16 } 17 18+ /// Fetch and process a `<link rel="webtasks">` manifest. 19+ fn fetch_and_process_webtasks_link(&self, href: &str) { 20+ if href.is_empty() { 21+ return; 22+ } 23+ 24+ let mut options = self.processing_options(); 25+ options.destination = Destination::None; 26+ 27+ let Some(request) = options.create_link_request(self.owner_window().webview_id()) else { 28+ return; 29+ }; 30+ let url = request.url.url(); 31+ 32+ let document = self.upcast::<Node>().owner_doc(); 33+ let fetch_context = LinkFetchContext { 34+ url, 35+ link: Some(Trusted::new(self)), 36+ document: Trusted::new(&document), 37+ global: Trusted::new(&document.global()), 38+ type_: LinkFetchContextType::WebTasks, 39+ response_body: vec![], 40+ }; 41+ 42+ document.fetch_background(request, fetch_context); 43+ } 44+ 45 /// <https://html.spec.whatwg.org/multipage/#concept-link-obtain> 46 fn handle_stylesheet_url(&self) { 47 let document = self.owner_document(); 48@@ -755,7 +786,7 @@ 49 if !window.is_top_level() { 50 return; 51 } 52- let Ok(href) = self.Href().parse() else { 53+ let Ok(href) = self.Href().parse::<ServoUrl>() else { 54 return; 55 }; 56