diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2017-09-25 12:32:48 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2017-09-25 13:04:52 +0200 |
commit | 40a72f3e83d2b04dea2a10905416201e7dad46ae (patch) | |
tree | c4fb8db5c61d9907719c043611a23d6ac8354b84 /components/script/document_loader.rs | |
parent | da392e3524732cacdbd6626994ce517fc0ab6f9f (diff) | |
download | servo-40a72f3e83d2b04dea2a10905416201e7dad46ae.tar.gz servo-40a72f3e83d2b04dea2a10905416201e7dad46ae.zip |
Decouple media load blockers from their resource URL
A media element can delay the document's load event without having a resource URL,
and it can even block it while being inserted into a different document AFAIK.
Diffstat (limited to 'components/script/document_loader.rs')
-rw-r--r-- | components/script/document_loader.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/components/script/document_loader.rs b/components/script/document_loader.rs index 2cbb0d150d1..1073403da7e 100644 --- a/components/script/document_loader.rs +++ b/components/script/document_loader.rs @@ -20,18 +20,18 @@ pub enum LoadType { Subframe(ServoUrl), Stylesheet(ServoUrl), PageSource(ServoUrl), - Media(ServoUrl), + Media, } impl LoadType { - fn url(&self) -> &ServoUrl { + fn url(&self) -> Option<&ServoUrl> { match *self { LoadType::Image(ref url) | LoadType::Script(ref url) | LoadType::Subframe(ref url) | LoadType::Stylesheet(ref url) | - LoadType::Media(ref url) | - LoadType::PageSource(ref url) => url, + LoadType::PageSource(ref url) => Some(url), + LoadType::Media => None, } } } @@ -68,7 +68,7 @@ impl LoadBlocker { /// Return the url associated with this load. pub fn url(&self) -> Option<&ServoUrl> { - self.load.as_ref().map(LoadType::url) + self.load.as_ref().and_then(LoadType::url) } } |