| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 if (equalIgnoringCase(as, "style")) | 177 if (equalIgnoringCase(as, "style")) |
| 178 return Resource::CSSStyleSheet; | 178 return Resource::CSSStyleSheet; |
| 179 if (equalIgnoringCase(as, "audio") || equalIgnoringCase(as, "video")) | 179 if (equalIgnoringCase(as, "audio") || equalIgnoringCase(as, "video")) |
| 180 return Resource::Media; | 180 return Resource::Media; |
| 181 if (equalIgnoringCase(as, "font")) | 181 if (equalIgnoringCase(as, "font")) |
| 182 return Resource::Font; | 182 return Resource::Font; |
| 183 if (equalIgnoringCase(as, "track")) | 183 if (equalIgnoringCase(as, "track")) |
| 184 return Resource::TextTrack; | 184 return Resource::TextTrack; |
| 185 if (document && !as.isEmpty()) | 185 if (document && !as.isEmpty()) |
| 186 document->addConsoleMessage(ConsoleMessage::create(OtherMessageSource, W
arningMessageLevel, String("<link rel=preload> must have a valid `as` value"))); | 186 document->addConsoleMessage(ConsoleMessage::create(OtherMessageSource, W
arningMessageLevel, String("<link rel=preload> must have a valid `as` value"))); |
| 187 // TODO(yoav): Is this correct? If as is missing or invalid, it should be su
bject to "connect-src" CSP directives. | 187 return Resource::LinkPreload; |
| 188 return Resource::LinkSubresource; | |
| 189 } | 188 } |
| 190 | 189 |
| 191 void LinkLoader::createLinkPreloadResourceClient(ResourcePtr<Resource> resource) | 190 void LinkLoader::createLinkPreloadResourceClient(ResourcePtr<Resource> resource) |
| 192 { | 191 { |
| 193 if (!resource) | 192 if (!resource) |
| 194 return; | 193 return; |
| 195 switch (resource->type()) { | 194 switch (resource->type()) { |
| 196 case Resource::Image: | 195 case Resource::Image: |
| 197 m_linkPreloadResourceClient = LinkPreloadImageResourceClient::create(thi
s, toImageResource(resource.get())); | 196 m_linkPreloadResourceClient = LinkPreloadImageResourceClient::create(thi
s, toImageResource(resource.get())); |
| 198 break; | 197 break; |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 | 331 |
| 333 DEFINE_TRACE(LinkLoader) | 332 DEFINE_TRACE(LinkLoader) |
| 334 { | 333 { |
| 335 visitor->trace(m_client); | 334 visitor->trace(m_client); |
| 336 visitor->trace(m_prerender); | 335 visitor->trace(m_prerender); |
| 337 visitor->trace(m_linkPreloadResourceClient); | 336 visitor->trace(m_linkPreloadResourceClient); |
| 338 ResourceOwner<Resource, ResourceClient>::trace(visitor); | 337 ResourceOwner<Resource, ResourceClient>::trace(visitor); |
| 339 } | 338 } |
| 340 | 339 |
| 341 } | 340 } |
| OLD | NEW |