| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 void V8MessageEvent::initMessageEventMethodCustom(const v8::FunctionCallbackInfo
<v8::Value>& info) | 100 void V8MessageEvent::initMessageEventMethodCustom(const v8::FunctionCallbackInfo
<v8::Value>& info) |
| 101 { | 101 { |
| 102 MessageEvent* event = V8MessageEvent::toNative(info.Holder()); | 102 MessageEvent* event = V8MessageEvent::toNative(info.Holder()); |
| 103 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, typeArg, info[0]); | 103 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, typeArg, info[0]); |
| 104 V8TRYCATCH_VOID(bool, canBubbleArg, info[1]->BooleanValue()); | 104 V8TRYCATCH_VOID(bool, canBubbleArg, info[1]->BooleanValue()); |
| 105 V8TRYCATCH_VOID(bool, cancelableArg, info[2]->BooleanValue()); | 105 V8TRYCATCH_VOID(bool, cancelableArg, info[2]->BooleanValue()); |
| 106 v8::Handle<v8::Value> dataArg = info[3]; | 106 v8::Handle<v8::Value> dataArg = info[3]; |
| 107 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, originArg, info[4])
; | 107 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, originArg, info[4])
; |
| 108 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, lastEventIdArg, inf
o[5]); | 108 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, lastEventIdArg, inf
o[5]); |
| 109 | 109 DOMWindow* sourceArg = toNativeDOMWindow(info[6], info.GetIsolate()); |
| 110 DOMWindow* sourceArg = 0; | |
| 111 if (info[6]->IsObject()) { | |
| 112 v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(info[6]); | |
| 113 v8::Handle<v8::Object> window = wrapper->FindInstanceInPrototypeChain(V8
Window::domTemplate(info.GetIsolate(), worldTypeInMainThread(info.GetIsolate()))
); | |
| 114 if (!window.IsEmpty()) | |
| 115 sourceArg = V8Window::toNative(window); | |
| 116 } | |
| 117 OwnPtr<MessagePortArray> portArray; | 110 OwnPtr<MessagePortArray> portArray; |
| 118 | |
| 119 const int portArrayIndex = 7; | 111 const int portArrayIndex = 7; |
| 120 if (!isUndefinedOrNull(info[portArrayIndex])) { | 112 if (!isUndefinedOrNull(info[portArrayIndex])) { |
| 121 portArray = adoptPtr(new MessagePortArray); | 113 portArray = adoptPtr(new MessagePortArray); |
| 122 if (!getMessagePortArray(info[portArrayIndex], portArrayIndex + 1, *port
Array, info.GetIsolate())) | 114 if (!getMessagePortArray(info[portArrayIndex], portArrayIndex + 1, *port
Array, info.GetIsolate())) |
| 123 return; | 115 return; |
| 124 } | 116 } |
| 125 event->initMessageEvent(typeArg, canBubbleArg, cancelableArg, originArg, las
tEventIdArg, sourceArg, portArray.release()); | 117 event->initMessageEvent(typeArg, canBubbleArg, cancelableArg, originArg, las
tEventIdArg, sourceArg, portArray.release()); |
| 126 | 118 |
| 127 if (!dataArg.IsEmpty()) { | 119 if (!dataArg.IsEmpty()) { |
| 128 info.Holder()->SetHiddenValue(V8HiddenPropertyName::data(info.GetIsolate
()), dataArg); | 120 info.Holder()->SetHiddenValue(V8HiddenPropertyName::data(info.GetIsolate
()), dataArg); |
| 129 if (isolatedWorldForIsolate(info.GetIsolate())) | 121 if (isolatedWorldForIsolate(info.GetIsolate())) |
| 130 event->setSerializedData(SerializedScriptValue::createAndSwallowExce
ptions(dataArg, info.GetIsolate())); | 122 event->setSerializedData(SerializedScriptValue::createAndSwallowExce
ptions(dataArg, info.GetIsolate())); |
| 131 } | 123 } |
| 132 } | 124 } |
| 133 | 125 |
| 134 void V8MessageEvent::webkitInitMessageEventMethodCustom(const v8::FunctionCallba
ckInfo<v8::Value>& info) | 126 void V8MessageEvent::webkitInitMessageEventMethodCustom(const v8::FunctionCallba
ckInfo<v8::Value>& info) |
| 135 { | 127 { |
| 136 initMessageEventMethodCustom(info); | 128 initMessageEventMethodCustom(info); |
| 137 } | 129 } |
| 138 | 130 |
| 139 | 131 |
| 140 } // namespace WebCore | 132 } // namespace WebCore |
| OLD | NEW |