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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 109 |
110 DOMWindow* sourceArg = 0; | 110 DOMWindow* sourceArg = 0; |
111 if (args[6]->IsObject()) { | 111 if (args[6]->IsObject()) { |
112 v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(args[6]); | 112 v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(args[6]); |
113 v8::Handle<v8::Object> window = wrapper->FindInstanceInPrototypeChain(V8
Window::GetTemplate(args.GetIsolate(), worldTypeInMainThread(args.GetIsolate()))
); | 113 v8::Handle<v8::Object> window = wrapper->FindInstanceInPrototypeChain(V8
Window::GetTemplate(args.GetIsolate(), worldTypeInMainThread(args.GetIsolate()))
); |
114 if (!window.IsEmpty()) | 114 if (!window.IsEmpty()) |
115 sourceArg = V8Window::toNative(window); | 115 sourceArg = V8Window::toNative(window); |
116 } | 116 } |
117 OwnPtr<MessagePortArray> portArray; | 117 OwnPtr<MessagePortArray> portArray; |
118 | 118 |
119 if (!isUndefinedOrNull(args[7])) { | 119 const int portArrayIndex = 7; |
| 120 if (!isUndefinedOrNull(args[portArrayIndex])) { |
120 portArray = adoptPtr(new MessagePortArray); | 121 portArray = adoptPtr(new MessagePortArray); |
121 if (!getMessagePortArray(args[7], *portArray, args.GetIsolate())) | 122 if (!getMessagePortArray(args[portArrayIndex], portArrayIndex + 1, *port
Array, args.GetIsolate())) |
122 return; | 123 return; |
123 } | 124 } |
124 event->initMessageEvent(typeArg, canBubbleArg, cancelableArg, originArg, las
tEventIdArg, sourceArg, portArray.release()); | 125 event->initMessageEvent(typeArg, canBubbleArg, cancelableArg, originArg, las
tEventIdArg, sourceArg, portArray.release()); |
125 | 126 |
126 if (!dataArg.IsEmpty()) { | 127 if (!dataArg.IsEmpty()) { |
127 args.Holder()->SetHiddenValue(V8HiddenPropertyName::data(args.GetIsolate
()), dataArg); | 128 args.Holder()->SetHiddenValue(V8HiddenPropertyName::data(args.GetIsolate
()), dataArg); |
128 if (isolatedWorldForIsolate(args.GetIsolate())) | 129 if (isolatedWorldForIsolate(args.GetIsolate())) |
129 event->setSerializedData(SerializedScriptValue::createAndSwallowExce
ptions(dataArg, args.GetIsolate())); | 130 event->setSerializedData(SerializedScriptValue::createAndSwallowExce
ptions(dataArg, args.GetIsolate())); |
130 } | 131 } |
131 } | 132 } |
132 | 133 |
133 void V8MessageEvent::webkitInitMessageEventMethodCustom(const v8::FunctionCallba
ckInfo<v8::Value>& args) | 134 void V8MessageEvent::webkitInitMessageEventMethodCustom(const v8::FunctionCallba
ckInfo<v8::Value>& args) |
134 { | 135 { |
135 initMessageEventMethodCustom(args); | 136 initMessageEventMethodCustom(args); |
136 } | 137 } |
137 | 138 |
138 | 139 |
139 } // namespace WebCore | 140 } // namespace WebCore |
OLD | NEW |