Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: third_party/WebKit/Source/core/loader/LinkLoader.cpp

Issue 1632523002: `<link rel=preload>` with no `as` should be subject to connect-src (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit tests Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameFetchContext.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameFetchContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698