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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8Binding.h

Issue 2707243006: [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: remove unused checks Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/V8Binding.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8Binding.h b/third_party/WebKit/Source/bindings/core/v8/V8Binding.h
index 81b839e5862974baf9cb0b5b6aac647a29e9b3a4..cdb8907ab5c828b0ee1f9d5c1a0e2da54f694e34 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8Binding.h
+++ b/third_party/WebKit/Source/bindings/core/v8/V8Binding.h
@@ -47,6 +47,7 @@
#include "bindings/core/v8/V8ThrowException.h"
#include "bindings/core/v8/V8ValueCache.h"
#include "core/CoreExport.h"
+#include "core/dom/NotShared.h"
#include "platform/heap/Handle.h"
#include "v8/include/v8.h"
#include "wtf/text/AtomicString.h"
@@ -1152,6 +1153,23 @@ CORE_EXPORT v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>,
CORE_EXPORT v8::Local<v8::Value> fromJSONString(v8::Isolate*,
const String& stringifiedJSON,
ExceptionState&);
+
+// TODO(binji) : document
+template <typename NotSharedType>
+CORE_EXPORT NotSharedType toNotShared(v8::Isolate* isolate,
+ v8::Local<v8::Value> value,
+ ExceptionState& exceptionState) {
+ using DOMTypedArray = typename NotSharedType::TypedArrayType;
+ DOMTypedArray* domTypedArray =
+ V8TypeOf<DOMTypedArray>::Type::toImplWithTypeCheck(isolate, value);
+ if (domTypedArray->isShared()) {
+ exceptionState.throwTypeError(
+ "The provided ArrayBufferView value must not be shared.");
+ return NotSharedType();
+ }
+ return NotSharedType(domTypedArray);
+}
+
} // namespace blink
#endif // V8Binding_h

Powered by Google App Engine
This is Rietveld 408576698