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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.cpp

Issue 2473113002: Stop preloading scripts that have invalid type/language attributes (Closed)
Patch Set: Update layout test, add {} block Created 4 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All Rights Reserved. 2 * Copyright (C) 2013 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 request.setCharset(preload->charset().isEmpty() 87 request.setCharset(preload->charset().isEmpty()
88 ? m_document->characterSet().getString() 88 ? m_document->characterSet().getString()
89 : preload->charset()); 89 : preload->charset());
90 request.setForPreload(true, preload->discoveryTime()); 90 request.setForPreload(true, preload->discoveryTime());
91 int duration = static_cast<int>( 91 int duration = static_cast<int>(
92 1000 * (monotonicallyIncreasingTime() - preload->discoveryTime())); 92 1000 * (monotonicallyIncreasingTime() - preload->discoveryTime()));
93 DEFINE_STATIC_LOCAL(CustomCountHistogram, preloadDelayHistogram, 93 DEFINE_STATIC_LOCAL(CustomCountHistogram, preloadDelayHistogram,
94 ("WebCore.PreloadDelayMs", 0, 2000, 20)); 94 ("WebCore.PreloadDelayMs", 0, 2000, 20));
95 preloadDelayHistogram.count(duration); 95 preloadDelayHistogram.count(duration);
96 96
97 if (preload->scriptHasInvalidTypeOrLanguage()) {
98 Deprecation::countDeprecation(m_document,
99 UseCounter::ScriptInvalidTypeOrLanguage);
100 }
101
102 Resource* resource = 97 Resource* resource =
103 m_document->loader()->startPreload(preload->resourceType(), request); 98 m_document->loader()->startPreload(preload->resourceType(), request);
104 if (resource && preload->resourceType() == Resource::CSSStyleSheet) { 99 if (resource && preload->resourceType() == Resource::CSSStyleSheet) {
105 Settings* settings = m_document->settings(); 100 Settings* settings = m_document->settings();
106 if (settings && (settings->cssExternalScannerNoPreload() || 101 if (settings && (settings->cssExternalScannerNoPreload() ||
107 settings->cssExternalScannerPreload())) 102 settings->cssExternalScannerPreload()))
108 m_cssPreloaders.add(new CSSPreloaderResourceClient(resource, this)); 103 m_cssPreloaders.add(new CSSPreloaderResourceClient(resource, this));
109 } 104 }
110 } 105 }
111 106
112 } // namespace blink 107 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698