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

Unified Diff: third_party/WebKit/Source/modules/webmidi/MIDIOutput.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/modules/webmidi/MIDIOutput.cpp
diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp b/third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp
index 576b0adc19411c9eca911e46b2ddb62fa9a50a3c..ae35c35e4a07bc7dc369323e1a20bc3af440d30c 100644
--- a/third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp
+++ b/third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp
@@ -221,10 +221,16 @@ MIDIOutput::MIDIOutput(MIDIAccess* access,
MIDIOutput::~MIDIOutput() {}
-void MIDIOutput::send(DOMUint8Array* array,
+void MIDIOutput::send(const MaybeShared<DOMUint8Array>& maybeShared,
double timestamp,
ExceptionState& exceptionState) {
- DCHECK(array);
+ DCHECK(maybeShared);
+ if (maybeShared.isShared()) {
+ exceptionState.throwTypeError(
+ "The array is backed by a SharedArrayBuffer.");
+ return;
+ }
+ DOMUint8Array* array = maybeShared.viewNotShared();
if (timestamp == 0.0)
timestamp = now(getExecutionContext());
@@ -263,7 +269,8 @@ void MIDIOutput::send(Vector<unsigned> unsignedData,
send(array, timestamp, exceptionState);
}
-void MIDIOutput::send(DOMUint8Array* data, ExceptionState& exceptionState) {
+void MIDIOutput::send(const MaybeShared<DOMUint8Array>& data,
+ ExceptionState& exceptionState) {
DCHECK(data);
send(data, 0.0, exceptionState);
}

Powered by Google App Engine
This is Rietveld 408576698