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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "bindings/core/v8/V8Window.h" | 32 #include "bindings/core/v8/V8Window.h" |
33 | 33 |
34 #include "bindings/core/v8/BindingSecurity.h" | 34 #include "bindings/core/v8/BindingSecurity.h" |
35 #include "bindings/core/v8/ExceptionMessages.h" | 35 #include "bindings/core/v8/ExceptionMessages.h" |
36 #include "bindings/core/v8/ExceptionState.h" | 36 #include "bindings/core/v8/ExceptionState.h" |
37 #include "bindings/core/v8/ScriptController.h" | 37 #include "bindings/core/v8/ScriptController.h" |
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/V8Binding.h" | 41 #include "bindings/core/v8/V8Binding.h" |
41 #include "bindings/core/v8/V8EventListener.h" | 42 #include "bindings/core/v8/V8EventListener.h" |
42 #include "bindings/core/v8/V8EventListenerList.h" | 43 #include "bindings/core/v8/V8EventListenerList.h" |
43 #include "bindings/core/v8/V8HTMLCollection.h" | 44 #include "bindings/core/v8/V8HTMLCollection.h" |
44 #include "bindings/core/v8/V8HiddenValue.h" | 45 #include "bindings/core/v8/V8HiddenValue.h" |
45 #include "bindings/core/v8/V8Node.h" | 46 #include "bindings/core/v8/V8Node.h" |
46 #include "core/dom/DOMArrayBuffer.h" | 47 #include "core/dom/DOMArrayBuffer.h" |
47 #include "core/dom/ExceptionCode.h" | 48 #include "core/dom/ExceptionCode.h" |
48 #include "core/dom/MessagePort.h" | 49 #include "core/dom/MessagePort.h" |
49 #include "core/frame/FrameView.h" | 50 #include "core/frame/FrameView.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 targetOriginArgIndex = 2; | 193 targetOriginArgIndex = 2; |
193 transferablesArgIndex = 1; | 194 transferablesArgIndex = 1; |
194 } | 195 } |
195 if (!SerializedScriptValue::extractTransferables(info.GetIsolate(), info
[transferablesArgIndex], transferablesArgIndex, portArray, arrayBufferArray, exc
eptionState)) { | 196 if (!SerializedScriptValue::extractTransferables(info.GetIsolate(), info
[transferablesArgIndex], transferablesArgIndex, portArray, arrayBufferArray, exc
eptionState)) { |
196 exceptionState.throwIfNeeded(); | 197 exceptionState.throwIfNeeded(); |
197 return; | 198 return; |
198 } | 199 } |
199 } | 200 } |
200 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, targetOri
gin, info[targetOriginArgIndex]); | 201 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, targetOri
gin, info[targetOriginArgIndex]); |
201 | 202 |
202 RefPtr<SerializedScriptValue> message = SerializedScriptValue::create(info[0
], &portArray, &arrayBufferArray, exceptionState, info.GetIsolate()); | 203 RefPtr<SerializedScriptValue> message = SerializedScriptValueFactory::instan
ce().create(info[0], &portArray, &arrayBufferArray, exceptionState, info.GetIsol
ate()); |
203 if (exceptionState.throwIfNeeded()) | 204 if (exceptionState.throwIfNeeded()) |
204 return; | 205 return; |
205 | 206 |
206 window->postMessage(message.release(), &portArray, targetOrigin, source, exc
eptionState); | 207 window->postMessage(message.release(), &portArray, targetOrigin, source, exc
eptionState); |
207 exceptionState.throwIfNeeded(); | 208 exceptionState.throwIfNeeded(); |
208 } | 209 } |
209 | 210 |
210 // FIXME(fqian): returning string is cheating, and we should | 211 // FIXME(fqian): returning string is cheating, and we should |
211 // fix this by calling toString function on the receiver. | 212 // fix this by calling toString function on the receiver. |
212 // However, V8 implements toString in JavaScript, which requires | 213 // However, V8 implements toString in JavaScript, which requires |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::curren
t(isolate)); | 453 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::curren
t(isolate)); |
453 if (context.IsEmpty()) | 454 if (context.IsEmpty()) |
454 return v8Undefined(); | 455 return v8Undefined(); |
455 | 456 |
456 v8::Handle<v8::Object> global = context->Global(); | 457 v8::Handle<v8::Object> global = context->Global(); |
457 ASSERT(!global.IsEmpty()); | 458 ASSERT(!global.IsEmpty()); |
458 return global; | 459 return global; |
459 } | 460 } |
460 | 461 |
461 } // namespace blink | 462 } // namespace blink |
OLD | NEW |