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

Side by Side Diff: third_party/WebKit/Source/modules/push_messaging/PushSubscriptionOptions.cpp

Issue 2812833003: Revert of [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/push_messaging/PushSubscriptionOptions.h" 5 #include "modules/push_messaging/PushSubscriptionOptions.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "core/dom/DOMArrayBuffer.h" 8 #include "core/dom/DOMArrayBuffer.h"
9 #include "core/dom/ExceptionCode.h" 9 #include "core/dom/ExceptionCode.h"
10 #include "modules/push_messaging/PushSubscriptionOptionsInit.h" 10 #include "modules/push_messaging/PushSubscriptionOptionsInit.h"
(...skipping 13 matching lines...) Expand all
24 ExceptionState& exception_state) { 24 ExceptionState& exception_state) {
25 unsigned char* input; 25 unsigned char* input;
26 int length; 26 int length;
27 // Convert the input array into a string of bytes. 27 // Convert the input array into a string of bytes.
28 if (application_server_key.isArrayBuffer()) { 28 if (application_server_key.isArrayBuffer()) {
29 input = static_cast<unsigned char*>( 29 input = static_cast<unsigned char*>(
30 application_server_key.getAsArrayBuffer()->Data()); 30 application_server_key.getAsArrayBuffer()->Data());
31 length = application_server_key.getAsArrayBuffer()->ByteLength(); 31 length = application_server_key.getAsArrayBuffer()->ByteLength();
32 } else if (application_server_key.isArrayBufferView()) { 32 } else if (application_server_key.isArrayBufferView()) {
33 input = static_cast<unsigned char*>( 33 input = static_cast<unsigned char*>(
34 application_server_key.getAsArrayBufferView().View()->buffer()->Data()); 34 application_server_key.getAsArrayBufferView()->buffer()->Data());
35 length = application_server_key.getAsArrayBufferView() 35 length =
36 .View() 36 application_server_key.getAsArrayBufferView()->buffer()->ByteLength();
37 ->buffer()
38 ->ByteLength();
39 } else { 37 } else {
40 NOTREACHED(); 38 NOTREACHED();
41 return String(); 39 return String();
42 } 40 }
43 41
44 // Check the validity of the sender info. It must either be a 65-byte 42 // Check the validity of the sender info. It must either be a 65-byte
45 // uncompressed VAPID key, which has the byte 0x04 as the first byte or a 43 // uncompressed VAPID key, which has the byte 0x04 as the first byte or a
46 // numeric sender ID. 44 // numeric sender ID.
47 const bool is_vapid = length == 65 && *input == 0x04; 45 const bool is_vapid = length == 65 && *input == 0x04;
48 const bool is_sender_id = 46 const bool is_sender_id =
(...skipping 28 matching lines...) Expand all
77 : user_visible_only_(options.user_visible_only), 75 : user_visible_only_(options.user_visible_only),
78 application_server_key_( 76 application_server_key_(
79 DOMArrayBuffer::Create(options.application_server_key.Latin1().data(), 77 DOMArrayBuffer::Create(options.application_server_key.Latin1().data(),
80 options.application_server_key.length())) {} 78 options.application_server_key.length())) {}
81 79
82 DEFINE_TRACE(PushSubscriptionOptions) { 80 DEFINE_TRACE(PushSubscriptionOptions) {
83 visitor->Trace(application_server_key_); 81 visitor->Trace(application_server_key_);
84 } 82 }
85 83
86 } // namespace blink 84 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698