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

Side by Side Diff: Source/bindings/core/v8/custom/V8WindowCustom.cpp

Issue 1097773004: Sharing of SharedArrayBuffer via PostMessage transfer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: update for non-split typedarray hierarchy Created 5 years, 6 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 /* 1 /*
2 * Copyright (C) 2009, 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2011 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 27 matching lines...) Expand all
38 #include "bindings/core/v8/ScriptSourceCode.h" 38 #include "bindings/core/v8/ScriptSourceCode.h"
39 #include "bindings/core/v8/SerializedScriptValue.h" 39 #include "bindings/core/v8/SerializedScriptValue.h"
40 #include "bindings/core/v8/SerializedScriptValueFactory.h" 40 #include "bindings/core/v8/SerializedScriptValueFactory.h"
41 #include "bindings/core/v8/V8Binding.h" 41 #include "bindings/core/v8/V8Binding.h"
42 #include "bindings/core/v8/V8EventListener.h" 42 #include "bindings/core/v8/V8EventListener.h"
43 #include "bindings/core/v8/V8EventListenerList.h" 43 #include "bindings/core/v8/V8EventListenerList.h"
44 #include "bindings/core/v8/V8HTMLCollection.h" 44 #include "bindings/core/v8/V8HTMLCollection.h"
45 #include "bindings/core/v8/V8HiddenValue.h" 45 #include "bindings/core/v8/V8HiddenValue.h"
46 #include "bindings/core/v8/V8Node.h" 46 #include "bindings/core/v8/V8Node.h"
47 #include "core/dom/DOMArrayBuffer.h" 47 #include "core/dom/DOMArrayBuffer.h"
48 #include "core/dom/DOMSharedArrayBuffer.h"
48 #include "core/dom/ExceptionCode.h" 49 #include "core/dom/ExceptionCode.h"
49 #include "core/dom/MessagePort.h" 50 #include "core/dom/MessagePort.h"
50 #include "core/frame/FrameView.h" 51 #include "core/frame/FrameView.h"
51 #include "core/frame/LocalDOMWindow.h" 52 #include "core/frame/LocalDOMWindow.h"
52 #include "core/frame/LocalFrame.h" 53 #include "core/frame/LocalFrame.h"
53 #include "core/frame/Settings.h" 54 #include "core/frame/Settings.h"
54 #include "core/frame/UseCounter.h" 55 #include "core/frame/UseCounter.h"
55 #include "core/frame/csp/ContentSecurityPolicy.h" 56 #include "core/frame/csp/ContentSecurityPolicy.h"
56 #include "core/html/HTMLCollection.h" 57 #include "core/html/HTMLCollection.h"
57 #include "core/html/HTMLDocument.h" 58 #include "core/html/HTMLDocument.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 } 190 }
190 191
191 // This function has variable arguments and can be: 192 // This function has variable arguments and can be:
192 // Per current spec: 193 // Per current spec:
193 // postMessage(message, targetOrigin) 194 // postMessage(message, targetOrigin)
194 // postMessage(message, targetOrigin, {sequence of transferrables}) 195 // postMessage(message, targetOrigin, {sequence of transferrables})
195 // Legacy non-standard implementations in webkit allowed: 196 // Legacy non-standard implementations in webkit allowed:
196 // postMessage(message, {sequence of transferrables}, targetOrigin); 197 // postMessage(message, {sequence of transferrables}, targetOrigin);
197 OwnPtrWillBeRawPtr<MessagePortArray> portArray = adoptPtrWillBeNoop(new Mess agePortArray); 198 OwnPtrWillBeRawPtr<MessagePortArray> portArray = adoptPtrWillBeNoop(new Mess agePortArray);
198 ArrayBufferArray arrayBufferArray; 199 ArrayBufferArray arrayBufferArray;
200 SharedArrayBufferArray sharedArrayBufferArray;
199 int targetOriginArgIndex = 1; 201 int targetOriginArgIndex = 1;
200 if (info.Length() > 2) { 202 if (info.Length() > 2) {
201 int transferablesArgIndex = 2; 203 int transferablesArgIndex = 2;
202 if (isLegacyTargetOriginDesignation(info[2])) { 204 if (isLegacyTargetOriginDesignation(info[2])) {
203 UseCounter::countIfNotPrivateScript(info.GetIsolate(), window->frame (), UseCounter::WindowPostMessageWithLegacyTargetOriginArgument); 205 UseCounter::countIfNotPrivateScript(info.GetIsolate(), window->frame (), UseCounter::WindowPostMessageWithLegacyTargetOriginArgument);
204 targetOriginArgIndex = 2; 206 targetOriginArgIndex = 2;
205 transferablesArgIndex = 1; 207 transferablesArgIndex = 1;
206 } 208 }
207 if (!SerializedScriptValue::extractTransferables(info.GetIsolate(), info [transferablesArgIndex], transferablesArgIndex, *portArray, arrayBufferArray, ex ceptionState)) { 209 if (!SerializedScriptValue::extractTransferables(info.GetIsolate(), info [transferablesArgIndex], transferablesArgIndex, *portArray, arrayBufferArray, sh aredArrayBufferArray, exceptionState)) {
208 exceptionState.throwIfNeeded(); 210 exceptionState.throwIfNeeded();
209 return; 211 return;
210 } 212 }
211 } 213 }
212 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, targetOri gin, info[targetOriginArgIndex]); 214 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, targetOri gin, info[targetOriginArgIndex]);
213 215
214 RefPtr<SerializedScriptValue> message = SerializedScriptValueFactory::instan ce().create(info.GetIsolate(), info[0], portArray.get(), &arrayBufferArray, exce ptionState); 216 RefPtr<SerializedScriptValue> message = SerializedScriptValueFactory::instan ce().create(info.GetIsolate(), info[0], portArray.get(), &arrayBufferArray, &sha redArrayBufferArray, exceptionState);
215 if (exceptionState.throwIfNeeded()) 217 if (exceptionState.throwIfNeeded())
216 return; 218 return;
217 219
218 window->postMessage(message.release(), portArray.get(), targetOrigin, source , exceptionState); 220 window->postMessage(message.release(), portArray.get(), targetOrigin, source , exceptionState);
219 exceptionState.throwIfNeeded(); 221 exceptionState.throwIfNeeded();
220 } 222 }
221 223
222 // FIXME(fqian): returning string is cheating, and we should 224 // FIXME(fqian): returning string is cheating, and we should
223 // fix this by calling toString function on the receiver. 225 // fix this by calling toString function on the receiver.
224 // However, V8 implements toString in JavaScript, which requires 226 // However, V8 implements toString in JavaScript, which requires
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 { 348 {
347 return securityCheck(host); 349 return securityCheck(host);
348 } 350 }
349 351
350 bool V8Window::indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t i ndex, v8::AccessType type, v8::Local<v8::Value>) 352 bool V8Window::indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t i ndex, v8::AccessType type, v8::Local<v8::Value>)
351 { 353 {
352 return securityCheck(host); 354 return securityCheck(host);
353 } 355 }
354 356
355 } // namespace blink 357 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698