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

Side by Side Diff: Source/core/inspector/ContentSearchUtils.cpp

Issue 256543002: DevTools: do not recognize inline sourceURL, require it to end with the crlf. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: For landing Created 6 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/inspector/sources/debugger/source-url-comment-expected.txt ('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 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 10 *
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 if (deprecated && content[pos + 2] == '@') 153 if (deprecated && content[pos + 2] == '@')
154 *deprecated = true; 154 *deprecated = true;
155 155
156 ASSERT(equalSignPos); 156 ASSERT(equalSignPos);
157 ASSERT(commentType != CSSMagicComment || closingCommentPos); 157 ASSERT(commentType != CSSMagicComment || closingCommentPos);
158 size_t urlPos = equalSignPos + 1; 158 size_t urlPos = equalSignPos + 1;
159 String match = commentType == CSSMagicComment 159 String match = commentType == CSSMagicComment
160 ? content.substring(urlPos, closingCommentPos - urlPos) 160 ? content.substring(urlPos, closingCommentPos - urlPos)
161 : content.substring(urlPos); 161 : content.substring(urlPos);
162
163 size_t newLine = match.find("\n");
164 if (newLine != kNotFound)
165 match = match.substring(0, newLine);
162 match = match.stripWhiteSpace(); 166 match = match.stripWhiteSpace();
163 167
164 String disallowedChars("\"' \t\n\r"); 168 String disallowedChars("\"' \t");
165 for (unsigned i = 0; i < match.length(); ++i) { 169 for (unsigned i = 0; i < match.length(); ++i) {
166 if (disallowedChars.find(match[i]) != kNotFound) 170 if (disallowedChars.find(match[i]) != kNotFound)
167 return match.substring(0, i); 171 return "";
168 } 172 }
169 173
170 return match; 174 return match;
171 } 175 }
172 176
173 String findSourceURL(const String& content, MagicCommentType commentType, bool* deprecated) 177 String findSourceURL(const String& content, MagicCommentType commentType, bool* deprecated)
174 { 178 {
175 return findMagicComment(content, "sourceURL", commentType, deprecated); 179 return findMagicComment(content, "sourceURL", commentType, deprecated);
176 } 180 }
177 181
178 String findSourceMapURL(const String& content, MagicCommentType commentType, boo l* deprecated) 182 String findSourceMapURL(const String& content, MagicCommentType commentType, boo l* deprecated)
179 { 183 {
180 return findMagicComment(content, "sourceMappingURL", commentType, deprecated ); 184 return findMagicComment(content, "sourceMappingURL", commentType, deprecated );
181 } 185 }
182 186
183 } // namespace ContentSearchUtils 187 } // namespace ContentSearchUtils
184 } // namespace WebCore 188 } // namespace WebCore
185 189
OLDNEW
« no previous file with comments | « LayoutTests/inspector/sources/debugger/source-url-comment-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698