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

Side by Side Diff: Source/WebCore/css/CSSImportRule.cpp

Issue 10143006: Merge 114350 - Stack overflow in CSS parser caused by recursive stylesheet import (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1084/
Patch Set: Created 8 years, 8 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 | « no previous file | 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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2002, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 4 * Copyright (C) 2002, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 String absHref = m_strHref; 133 String absHref = m_strHref;
134 if (!parentSheet->finalURL().isNull()) 134 if (!parentSheet->finalURL().isNull())
135 // use parent styleheet's URL as the base URL 135 // use parent styleheet's URL as the base URL
136 absHref = KURL(parentSheet->finalURL(), m_strHref).string(); 136 absHref = KURL(parentSheet->finalURL(), m_strHref).string();
137 137
138 // Check for a cycle in our import chain. If we encounter a stylesheet 138 // Check for a cycle in our import chain. If we encounter a stylesheet
139 // in our parent chain with the same URL, then just bail. 139 // in our parent chain with the same URL, then just bail.
140 CSSStyleSheet* rootSheet = parentSheet; 140 CSSStyleSheet* rootSheet = parentSheet;
141 for (CSSStyleSheet* sheet = parentSheet; sheet; sheet = sheet->parentStyleSh eet()) { 141 for (CSSStyleSheet* sheet = parentSheet; sheet; sheet = sheet->parentStyleSh eet()) {
142 // FIXME: This is wrong if the finalURL was updated via document::update BaseURL. 142 // FIXME: This is wrong if the finalURL was updated via document::update BaseURL.
143 if (absHref == sheet->finalURL().string()) 143 if (absHref == sheet->finalURL().string() || absHref == sheet->href())
144 return; 144 return;
145 rootSheet = sheet; 145 rootSheet = sheet;
146 } 146 }
147 147
148 ResourceRequest request(document->completeURL(absHref)); 148 ResourceRequest request(document->completeURL(absHref));
149 if (parentSheet->isUserStyleSheet()) 149 if (parentSheet->isUserStyleSheet())
150 m_cachedSheet = cachedResourceLoader->requestUserCSSStyleSheet(request, parentSheet->charset()); 150 m_cachedSheet = cachedResourceLoader->requestUserCSSStyleSheet(request, parentSheet->charset());
151 else 151 else
152 m_cachedSheet = cachedResourceLoader->requestCSSStyleSheet(request, pare ntSheet->charset()); 152 m_cachedSheet = cachedResourceLoader->requestCSSStyleSheet(request, pare ntSheet->charset());
153 if (m_cachedSheet) { 153 if (m_cachedSheet) {
(...skipping 28 matching lines...) Expand all
182 return result.toString(); 182 return result.toString();
183 } 183 }
184 184
185 void CSSImportRule::addSubresourceStyleURLs(ListHashSet<KURL>& urls) 185 void CSSImportRule::addSubresourceStyleURLs(ListHashSet<KURL>& urls)
186 { 186 {
187 if (m_styleSheet) 187 if (m_styleSheet)
188 addSubresourceURL(urls, m_styleSheet->baseURL()); 188 addSubresourceURL(urls, m_styleSheet->baseURL());
189 } 189 }
190 190
191 } // namespace WebCore 191 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698