OLD | NEW |
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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 exceptionState.throwIfNeeded(); | 186 exceptionState.throwIfNeeded(); |
187 return; | 187 return; |
188 } | 188 } |
189 | 189 |
190 // This function has variable arguments and can be: | 190 // This function has variable arguments and can be: |
191 // Per current spec: | 191 // Per current spec: |
192 // postMessage(message, targetOrigin) | 192 // postMessage(message, targetOrigin) |
193 // postMessage(message, targetOrigin, {sequence of transferrables}) | 193 // postMessage(message, targetOrigin, {sequence of transferrables}) |
194 // Legacy non-standard implementations in webkit allowed: | 194 // Legacy non-standard implementations in webkit allowed: |
195 // postMessage(message, {sequence of transferrables}, targetOrigin); | 195 // postMessage(message, {sequence of transferrables}, targetOrigin); |
196 Transferables transferables; | 196 Transferables* transferables = SerializedScriptValueFactory::instance().crea
teTransferables(); |
197 int targetOriginArgIndex = 1; | 197 int targetOriginArgIndex = 1; |
198 if (info.Length() > 2) { | 198 if (info.Length() > 2) { |
199 int transferablesArgIndex = 2; | 199 int transferablesArgIndex = 2; |
200 if (isLegacyTargetOriginDesignation(info[2])) { | 200 if (isLegacyTargetOriginDesignation(info[2])) { |
201 UseCounter::countIfNotPrivateScript(info.GetIsolate(), window->frame
(), UseCounter::WindowPostMessageWithLegacyTargetOriginArgument); | 201 UseCounter::countIfNotPrivateScript(info.GetIsolate(), window->frame
(), UseCounter::WindowPostMessageWithLegacyTargetOriginArgument); |
202 targetOriginArgIndex = 2; | 202 targetOriginArgIndex = 2; |
203 transferablesArgIndex = 1; | 203 transferablesArgIndex = 1; |
204 } | 204 } |
205 if (!SerializedScriptValue::extractTransferables(info.GetIsolate(), info
[transferablesArgIndex], transferablesArgIndex, transferables, exceptionState))
{ | 205 if (!SerializedScriptValue::extractTransferables(info.GetIsolate(), info
[transferablesArgIndex], transferablesArgIndex, *transferables, exceptionState))
{ |
206 exceptionState.throwIfNeeded(); | 206 exceptionState.throwIfNeeded(); |
207 return; | 207 return; |
208 } | 208 } |
209 } | 209 } |
210 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, targetOri
gin, info[targetOriginArgIndex]); | 210 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, targetOri
gin, info[targetOriginArgIndex]); |
211 | 211 |
212 RefPtr<SerializedScriptValue> message = SerializedScriptValueFactory::instan
ce().create(info.GetIsolate(), info[0], &transferables, exceptionState); | 212 RefPtr<SerializedScriptValue> message = SerializedScriptValueFactory::instan
ce().create(info.GetIsolate(), info[0], transferables, exceptionState); |
213 if (exceptionState.throwIfNeeded()) | 213 if (exceptionState.throwIfNeeded()) |
214 return; | 214 return; |
215 | 215 |
216 window->postMessage(message.release(), transferables.messagePorts, targetOri
gin, source, exceptionState); | 216 window->postMessage(message.release(), transferables->messagePorts, targetOr
igin, source, exceptionState); |
217 exceptionState.throwIfNeeded(); | 217 exceptionState.throwIfNeeded(); |
218 } | 218 } |
219 | 219 |
220 void V8Window::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) | 220 void V8Window::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) |
221 { | 221 { |
222 DOMWindow* impl = V8Window::toImpl(info.Holder()); | 222 DOMWindow* impl = V8Window::toImpl(info.Holder()); |
223 ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "Win
dow", info.Holder(), info.GetIsolate()); | 223 ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "Win
dow", info.Holder(), info.GetIsolate()); |
224 if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindo
w(info.GetIsolate()), impl, exceptionState)) { | 224 if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindo
w(info.GetIsolate()), impl, exceptionState)) { |
225 exceptionState.throwIfNeeded(); | 225 exceptionState.throwIfNeeded(); |
226 return; | 226 return; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 if (items->hasExactlyOneItem()) { | 338 if (items->hasExactlyOneItem()) { |
339 v8SetReturnValueFast(info, items->item(0), window); | 339 v8SetReturnValueFast(info, items->item(0), window); |
340 return; | 340 return; |
341 } | 341 } |
342 v8SetReturnValueFast(info, items, window); | 342 v8SetReturnValueFast(info, items, window); |
343 return; | 343 return; |
344 } | 344 } |
345 } | 345 } |
346 | 346 |
347 } // namespace blink | 347 } // namespace blink |
OLD | NEW |