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

Side by Side Diff: third_party/WebKit/Source/core/frame/SubresourceIntegrity.cpp

Issue 2668903003: Replace WTF::emptyString{16Bit}() with a static global (Closed)
Patch Set: Replace WTF::emptyString{16Bit}() with a static global Created 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/frame/SubresourceIntegrity.h" 5 #include "core/frame/SubresourceIntegrity.h"
6 6
7 #include "core/HTMLNames.h" 7 #include "core/HTMLNames.h"
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/Element.h" 9 #include "core/dom/Element.h"
10 #include "core/dom/ExecutionContext.h" 10 #include "core/dom/ExecutionContext.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 // [algorithm]-[hash] OR [algorithm]-[hash]?[options] 295 // [algorithm]-[hash] OR [algorithm]-[hash]?[options]
296 // ^ ^ ^ 296 // ^ ^ ^
297 // position/end position end 297 // position/end position end
298 bool SubresourceIntegrity::parseDigest(const UChar*& position, 298 bool SubresourceIntegrity::parseDigest(const UChar*& position,
299 const UChar* end, 299 const UChar* end,
300 String& digest) { 300 String& digest) {
301 const UChar* begin = position; 301 const UChar* begin = position;
302 skipWhile<UChar, isIntegrityCharacter>(position, end); 302 skipWhile<UChar, isIntegrityCharacter>(position, end);
303 303
304 if (position == begin || (position != end && *position != '?')) { 304 if (position == begin || (position != end && *position != '?')) {
305 digest = emptyString(); 305 digest = emptyString;
306 return false; 306 return false;
307 } 307 }
308 308
309 // We accept base64url encoding, but normalize to "normal" base64 internally: 309 // We accept base64url encoding, but normalize to "normal" base64 internally:
310 digest = normalizeToBase64(String(begin, position - begin)); 310 digest = normalizeToBase64(String(begin, position - begin));
311 return true; 311 return true;
312 } 312 }
313 313
314 SubresourceIntegrity::IntegrityParseResult 314 SubresourceIntegrity::IntegrityParseResult
315 SubresourceIntegrity::parseIntegrityAttribute( 315 SubresourceIntegrity::parseIntegrityAttribute(
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 metadataSet.insert(integrityMetadata.toPair()); 418 metadataSet.insert(integrityMetadata.toPair());
419 } 419 }
420 420
421 if (metadataSet.size() == 0 && error) 421 if (metadataSet.size() == 0 && error)
422 return IntegrityParseNoValidResult; 422 return IntegrityParseNoValidResult;
423 423
424 return IntegrityParseValidResult; 424 return IntegrityParseValidResult;
425 } 425 }
426 426
427 } // namespace blink 427 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/NavigatorID.cpp ('k') | third_party/WebKit/Source/core/html/HTMLFormControlElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698