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

Unified Diff: third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp

Issue 2707243006: [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: Created 3 years, 10 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/core/dom/DOMMatrixReadOnly.cpp
diff --git a/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp b/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp
index e4c1ed95915423ee26b242a647d136df8fafd511..2c1bb22678227b91717cee902b2c3451e5a5664c 100644
--- a/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp
+++ b/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp
@@ -115,8 +115,14 @@ DOMMatrixReadOnly* DOMMatrixReadOnly::create(Vector<double> sequence,
}
DOMMatrixReadOnly* DOMMatrixReadOnly::fromFloat32Array(
- DOMFloat32Array* float32Array,
+ const MaybeShared<DOMFloat32Array>& maybeShared,
ExceptionState& exceptionState) {
+ if (maybeShared.isShared()) {
+ exceptionState.throwTypeError(
+ "The Float32Array must not be backed by a SharedArrayBuffer.");
+ return nullptr;
+ }
+ DOMFloat32Array* float32Array = maybeShared.viewNotShared();
if (float32Array->length() != 6 && float32Array->length() != 16) {
exceptionState.throwTypeError(
"The sequence must contain 6 elements for a 2D matrix or 16 elements a "
@@ -127,8 +133,14 @@ DOMMatrixReadOnly* DOMMatrixReadOnly::fromFloat32Array(
}
DOMMatrixReadOnly* DOMMatrixReadOnly::fromFloat64Array(
- DOMFloat64Array* float64Array,
+ const MaybeShared<DOMFloat64Array>& maybeShared,
ExceptionState& exceptionState) {
+ if (maybeShared.isShared()) {
+ exceptionState.throwTypeError(
+ "The Float64Array must not be backed by a SharedArrayBuffer.");
+ return nullptr;
+ }
+ DOMFloat64Array* float64Array = maybeShared.viewNotShared();
if (float64Array->length() != 6 && float64Array->length() != 16) {
exceptionState.throwTypeError(
"The sequence must contain 6 elements for a 2D matrix or 16 elements "

Powered by Google App Engine
This is Rietveld 408576698