OLD | NEW |
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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 void ParsedProperties::setDefaultLastModified() | 65 void ParsedProperties::setDefaultLastModified() |
66 { | 66 { |
67 setLastModified(currentTime()); | 67 setLastModified(currentTime()); |
68 } | 68 } |
69 | 69 |
70 bool ParsedProperties::parseBlobPropertyBag(v8::Local<v8::Value> propertyBag, co
nst char* blobClassName, ExceptionState& exceptionState, v8::Isolate* isolate) | 70 bool ParsedProperties::parseBlobPropertyBag(v8::Local<v8::Value> propertyBag, co
nst char* blobClassName, ExceptionState& exceptionState, v8::Isolate* isolate) |
71 { | 71 { |
72 TONATIVE_DEFAULT(Dictionary, dictionary, Dictionary(propertyBag, isolate), f
alse); | 72 TONATIVE_DEFAULT(Dictionary, dictionary, Dictionary(propertyBag, isolate), f
alse); |
73 | 73 |
74 String endings; | 74 String endings; |
75 TONATIVE_DEFAULT(bool, containsEndings, DictionaryHelper::get(dictionary, "e
ndings", endings), false); | 75 TONATIVE_DEFAULT(bool, containsEndings, dictionary.get("endings", endings),
false); |
76 if (containsEndings) { | 76 if (containsEndings) { |
77 if (endings != "transparent" && endings != "native") { | 77 if (endings != "transparent" && endings != "native") { |
78 exceptionState.throwTypeError("The 'endings' property must be either
'transparent' or 'native'."); | 78 exceptionState.throwTypeError("The 'endings' property must be either
'transparent' or 'native'."); |
79 return false; | 79 return false; |
80 } | 80 } |
81 if (endings == "native") | 81 if (endings == "native") |
82 m_normalizeLineEndingsToNative = true; | 82 m_normalizeLineEndingsToNative = true; |
83 } | 83 } |
84 | 84 |
85 TONATIVE_DEFAULT(bool, containsType, DictionaryHelper::get(dictionary, "type
", m_contentType), false); | 85 TONATIVE_DEFAULT(bool, containsType, dictionary.get("type", m_contentType),
false); |
86 if (containsType) { | 86 if (containsType) { |
87 if (!m_contentType.containsOnlyASCII()) { | 87 if (!m_contentType.containsOnlyASCII()) { |
88 exceptionState.throwDOMException(SyntaxError, "The 'type' property m
ust consist of ASCII characters."); | 88 exceptionState.throwDOMException(SyntaxError, "The 'type' property m
ust consist of ASCII characters."); |
89 return false; | 89 return false; |
90 } | 90 } |
91 m_contentType = m_contentType.lower(); | 91 m_contentType = m_contentType.lower(); |
92 } | 92 } |
93 | 93 |
94 if (!m_hasFileProperties) | 94 if (!m_hasFileProperties) |
95 return true; | 95 return true; |
96 | 96 |
97 v8::Local<v8::Value> lastModified; | 97 v8::Local<v8::Value> lastModified; |
98 TONATIVE_DEFAULT(bool, containsLastModified, DictionaryHelper::get(dictionar
y, "lastModified", lastModified), false); | 98 TONATIVE_DEFAULT(bool, containsLastModified, dictionary.get("lastModified",
lastModified), false); |
99 if (containsLastModified) { | 99 if (containsLastModified) { |
100 TONATIVE_DEFAULT(long long, lastModifiedInt, toInt64(lastModified), fals
e); | 100 TONATIVE_DEFAULT(long long, lastModifiedInt, toInt64(lastModified), fals
e); |
101 setLastModified(static_cast<double>(lastModifiedInt) / msPerSecond); | 101 setLastModified(static_cast<double>(lastModifiedInt) / msPerSecond); |
102 } else { | 102 } else { |
103 setDefaultLastModified(); | 103 setDefaultLastModified(); |
104 } | 104 } |
105 | 105 |
106 return true; | 106 return true; |
107 } | 107 } |
108 | 108 |
(...skipping 23 matching lines...) Expand all Loading... |
132 TOSTRING_DEFAULT(V8StringResource<>, stringValue, item, false); | 132 TOSTRING_DEFAULT(V8StringResource<>, stringValue, item, false); |
133 blobData.appendText(stringValue, normalizeLineEndingsToNative); | 133 blobData.appendText(stringValue, normalizeLineEndingsToNative); |
134 } | 134 } |
135 } | 135 } |
136 return true; | 136 return true; |
137 } | 137 } |
138 | 138 |
139 } // namespace V8BlobCustomHelpers | 139 } // namespace V8BlobCustomHelpers |
140 | 140 |
141 } // namespace blink | 141 } // namespace blink |
OLD | NEW |