OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
4 * Copyright (C) 2013 Samsung Electronics. All rights reserved. | 4 * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions are | 7 * modification, are permitted provided that the following conditions are |
8 * met: | 8 * met: |
9 * | 9 * |
10 * * Redistributions of source code must retain the above copyright | 10 * * Redistributions of source code must retain the above copyright |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 { | 58 { |
59 if (encodedString.isNull()) | 59 if (encodedString.isNull()) |
60 return String(); | 60 return String(); |
61 | 61 |
62 if (!encodedString.containsOnlyLatin1()) { | 62 if (!encodedString.containsOnlyLatin1()) { |
63 es.throwDOMException(InvalidCharacterError, "'atob' failed: The string t
o be decoded contains characters outside of the Latin1 range."); | 63 es.throwDOMException(InvalidCharacterError, "'atob' failed: The string t
o be decoded contains characters outside of the Latin1 range."); |
64 return String(); | 64 return String(); |
65 } | 65 } |
66 | 66 |
67 Vector<char> out; | 67 Vector<char> out; |
68 if (!base64Decode(encodedString, out, Base64FailOnInvalidCharacter, Base64St
rictPaddingValidation)) { | 68 if (!base64Decode(encodedString, out, Base64FailOnInvalidCharacterOrExcessPa
dding)) { |
69 es.throwDOMException(InvalidCharacterError, "'atob' failed: The string t
o be decoded is not correctly encoded."); | 69 es.throwDOMException(InvalidCharacterError, "'atob' failed: The string t
o be decoded is not correctly encoded."); |
70 return String(); | 70 return String(); |
71 } | 71 } |
72 | 72 |
73 return String(out.data(), out.size()); | 73 return String(out.data(), out.size()); |
74 } | 74 } |
75 | 75 |
76 } // namespace DOMWindowBase64 | 76 } // namespace DOMWindowBase64 |
77 | 77 |
78 } // namespace WebCore | 78 } // namespace WebCore |
OLD | NEW |