OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "V8ArrayBufferViewCustom.h" | 32 #include "V8ArrayBufferViewCustom.h" |
33 #include "V8Binding.h" | 33 #include "V8Binding.h" |
34 #include "V8BindingMacros.h" | 34 #include "V8BindingMacros.h" |
35 #include "V8DataView.h" | 35 #include "V8DataView.h" |
36 #include "V8Proxy.h" | 36 #include "V8Proxy.h" |
37 | 37 |
38 namespace WebCore { | 38 namespace WebCore { |
39 | 39 |
40 v8::Handle<v8::Value> V8DataView::constructorCallback(const v8::Arguments& args) | 40 v8::Handle<v8::Value> V8DataView::constructorCallback(const v8::Arguments& args) |
41 { | 41 { |
42 INC_STATS("DOM.ArrayBuffer.Constructor"); | 42 INC_STATS("DOM.DataView.Constructor"); |
| 43 |
| 44 if (!args.IsConstructCall()) |
| 45 return throwError("DOM object constructor cannot be called as a function
", V8Proxy::SyntaxError); |
43 | 46 |
44 if (args[0]->IsNull() || !V8ArrayBuffer::HasInstance(args[0])) | 47 if (args[0]->IsNull() || !V8ArrayBuffer::HasInstance(args[0])) |
45 return V8Proxy::throwTypeError(); | 48 return V8Proxy::throwTypeError(); |
46 return constructWebGLArrayWithArrayBufferArgument<DataView, char>(args, &inf
o, v8::kExternalByteArray, false); | 49 return constructWebGLArrayWithArrayBufferArgument<DataView, char>(args, &inf
o, v8::kExternalByteArray, false); |
47 } | 50 } |
48 | 51 |
49 v8::Handle<v8::Value> toV8(DataView* impl) | 52 v8::Handle<v8::Value> toV8(DataView* impl) |
50 { | 53 { |
51 if (!impl) | 54 if (!impl) |
52 return v8::Null(); | 55 return v8::Null(); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 EXCEPTION_BLOCK(int, value, toInt32(args[1])); | 118 EXCEPTION_BLOCK(int, value, toInt32(args[1])); |
116 imp->setUint8(byteOffset, static_cast<uint8_t>(value), ec); | 119 imp->setUint8(byteOffset, static_cast<uint8_t>(value), ec); |
117 if (UNLIKELY(ec)) | 120 if (UNLIKELY(ec)) |
118 V8Proxy::setDOMException(ec); | 121 V8Proxy::setDOMException(ec); |
119 return v8::Handle<v8::Value>(); | 122 return v8::Handle<v8::Value>(); |
120 } | 123 } |
121 | 124 |
122 } // namespace WebCore | 125 } // namespace WebCore |
123 | 126 |
124 #endif // ENABLE(3D_CANVAS) || ENABLE(BLOB) | 127 #endif // ENABLE(3D_CANVAS) || ENABLE(BLOB) |
OLD | NEW |