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

Side by Side Diff: Source/bindings/v8/custom/V8BlobCustomHelpers.cpp

Issue 111373003: Migrate bindings constructors to the new ExceptionState model. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Ugh. Created 7 years 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
OLDNEW
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 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "V8BlobCustomHelpers.h" 32 #include "V8BlobCustomHelpers.h"
33 33
34 #include "V8Blob.h" 34 #include "V8Blob.h"
35 #include "bindings/v8/Dictionary.h" 35 #include "bindings/v8/Dictionary.h"
36 #include "bindings/v8/ExceptionState.h"
36 #include "bindings/v8/V8Binding.h" 37 #include "bindings/v8/V8Binding.h"
37 #include "bindings/v8/V8Utilities.h" 38 #include "bindings/v8/V8Utilities.h"
38 #include "bindings/v8/custom/V8ArrayBufferCustom.h" 39 #include "bindings/v8/custom/V8ArrayBufferCustom.h"
39 #include "bindings/v8/custom/V8ArrayBufferViewCustom.h" 40 #include "bindings/v8/custom/V8ArrayBufferViewCustom.h"
40 #include "core/fileapi/BlobBuilder.h" 41 #include "core/fileapi/BlobBuilder.h"
41 #include "wtf/DateMath.h" 42 #include "wtf/DateMath.h"
42 43
43 namespace WebCore { 44 namespace WebCore {
44 45
45 namespace V8BlobCustomHelpers { 46 namespace V8BlobCustomHelpers {
(...skipping 15 matching lines...) Expand all
61 #ifndef NDEBUG 62 #ifndef NDEBUG
62 m_hasLastModified = true; 63 m_hasLastModified = true;
63 #endif // NDEBUG 64 #endif // NDEBUG
64 } 65 }
65 66
66 void ParsedProperties::setDefaultLastModified() 67 void ParsedProperties::setDefaultLastModified()
67 { 68 {
68 setLastModified(currentTime()); 69 setLastModified(currentTime());
69 } 70 }
70 71
71 bool ParsedProperties::parseBlobPropertyBag(v8::Local<v8::Value> propertyBag, co nst char* blobClassName, v8::Isolate* isolate) 72 bool ParsedProperties::parseBlobPropertyBag(v8::Local<v8::Value> propertyBag, co nst char* blobClassName, ExceptionState& exceptionState, v8::Isolate* isolate)
72 { 73 {
73 ASSERT(m_endings == "transparent"); 74 ASSERT(m_endings == "transparent");
74 75
75 V8TRYCATCH_RETURN(Dictionary, dictionary, Dictionary(propertyBag, isolate), false); 76 V8TRYCATCH_RETURN(Dictionary, dictionary, Dictionary(propertyBag, isolate), false);
76 77
77 V8TRYCATCH_RETURN(bool, containsEndings, dictionary.get("endings", m_endings ), false); 78 V8TRYCATCH_RETURN(bool, containsEndings, dictionary.get("endings", m_endings ), false);
78 if (containsEndings) { 79 if (containsEndings) {
79 if (m_endings != "transparent" && m_endings != "native") { 80 if (m_endings != "transparent" && m_endings != "native") {
80 throwTypeError(ExceptionMessages::failedToConstruct(blobClassName, " The \"endings\" property must be either \"transparent\" or \"native\"."), isolat e); 81 exceptionState.throwTypeError("The 'endings' property must be either 'transparent' or 'native'.");
81 return false; 82 return false;
82 } 83 }
83 } 84 }
84 85
85 V8TRYCATCH_RETURN(bool, containsType, dictionary.get("type", m_contentType), false); 86 V8TRYCATCH_RETURN(bool, containsType, dictionary.get("type", m_contentType), false);
86 if (containsType) { 87 if (containsType) {
87 if (!m_contentType.containsOnlyASCII()) { 88 if (!m_contentType.containsOnlyASCII()) {
88 throwError(v8SyntaxError, ExceptionMessages::failedToConstruct(blobC lassName, "The \"type\" property must consist of ASCII characters."), isolate); 89 exceptionState.throwDOMException(SyntaxError, "The 'type' property m ust consist of ASCII characters.");
89 return false; 90 return false;
90 } 91 }
91 m_contentType = m_contentType.lower(); 92 m_contentType = m_contentType.lower();
92 } 93 }
93 94
94 if (!m_hasFileProperties) 95 if (!m_hasFileProperties)
95 return true; 96 return true;
96 97
97 v8::Local<v8::Value> lastModified; 98 v8::Local<v8::Value> lastModified;
98 V8TRYCATCH_RETURN(bool, containsLastModified, dictionary.get("lastModified", lastModified), false); 99 V8TRYCATCH_RETURN(bool, containsLastModified, dictionary.get("lastModified", lastModified), false);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(V8StringResource<>, stringVal ue, item, false); 132 V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(V8StringResource<>, stringVal ue, item, false);
132 blobBuilder.append(stringValue, endings); 133 blobBuilder.append(stringValue, endings);
133 } 134 }
134 } 135 }
135 return true; 136 return true;
136 } 137 }
137 138
138 } // namespace V8BlobCustomHelpers 139 } // namespace V8BlobCustomHelpers
139 140
140 } // namespace WebCore 141 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8BlobCustomHelpers.h ('k') | Source/bindings/v8/custom/V8FileCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698