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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 81 } |
82 | 82 |
83 v8::Handle<v8::Value> V8MessageEvent::portsAccessorGetter(v8::Local<v8::String>
name, const v8::AccessorInfo& info) | 83 v8::Handle<v8::Value> V8MessageEvent::portsAccessorGetter(v8::Local<v8::String>
name, const v8::AccessorInfo& info) |
84 { | 84 { |
85 INC_STATS("DOM.MessageEvent.ports"); | 85 INC_STATS("DOM.MessageEvent.ports"); |
86 MessageEvent* event = V8MessageEvent::toNative(info.Holder()); | 86 MessageEvent* event = V8MessageEvent::toNative(info.Holder()); |
87 | 87 |
88 MessagePortArray* ports = event->ports(); | 88 MessagePortArray* ports = event->ports(); |
89 if (!ports) | 89 if (!ports) |
90 return v8::Array::New(0); | 90 return v8::Array::New(0); |
| 91 |
| 92 MessagePortArray portsCopy(*ports); |
91 | 93 |
92 v8::Local<v8::Array> portArray = v8::Array::New(ports->size()); | 94 v8::Local<v8::Array> portArray = v8::Array::New(portsCopy.size()); |
93 for (size_t i = 0; i < ports->size(); ++i) | 95 for (size_t i = 0; i < portsCopy.size(); ++i) |
94 portArray->Set(v8::Integer::New(i), toV8((*ports)[i].get())); | 96 portArray->Set(v8::Integer::New(i), toV8(portsCopy[i].get())); |
95 | 97 |
96 return portArray; | 98 return portArray; |
97 } | 99 } |
98 | 100 |
99 v8::Handle<v8::Value> V8MessageEvent::initMessageEventCallback(const v8::Argumen
ts& args) | 101 v8::Handle<v8::Value> V8MessageEvent::initMessageEventCallback(const v8::Argumen
ts& args) |
100 { | 102 { |
101 INC_STATS("DOM.MessageEvent.initMessageEvent"); | 103 INC_STATS("DOM.MessageEvent.initMessageEvent"); |
102 MessageEvent* event = V8MessageEvent::toNative(args.Holder()); | 104 MessageEvent* event = V8MessageEvent::toNative(args.Holder()); |
103 String typeArg = v8ValueToWebCoreString(args[0]); | 105 String typeArg = v8ValueToWebCoreString(args[0]); |
104 bool canBubbleArg = args[1]->BooleanValue(); | 106 bool canBubbleArg = args[1]->BooleanValue(); |
(...skipping 16 matching lines...) Expand all Loading... |
121 if (!getMessagePortArray(args[7], *portArray)) | 123 if (!getMessagePortArray(args[7], *portArray)) |
122 return v8::Undefined(); | 124 return v8::Undefined(); |
123 } | 125 } |
124 event->initMessageEvent(typeArg, canBubbleArg, cancelableArg, dataArg.releas
e(), originArg, lastEventIdArg, sourceArg, portArray.release()); | 126 event->initMessageEvent(typeArg, canBubbleArg, cancelableArg, dataArg.releas
e(), originArg, lastEventIdArg, sourceArg, portArray.release()); |
125 v8::PropertyAttribute dataAttr = static_cast<v8::PropertyAttribute>(v8::Dont
Delete | v8::ReadOnly); | 127 v8::PropertyAttribute dataAttr = static_cast<v8::PropertyAttribute>(v8::Dont
Delete | v8::ReadOnly); |
126 SerializedScriptValue::deserializeAndSetProperty(args.Holder(), "data", data
Attr, event->dataAsSerializedScriptValue()); | 128 SerializedScriptValue::deserializeAndSetProperty(args.Holder(), "data", data
Attr, event->dataAsSerializedScriptValue()); |
127 return v8::Undefined(); | 129 return v8::Undefined(); |
128 } | 130 } |
129 | 131 |
130 } // namespace WebCore | 132 } // namespace WebCore |
OLD | NEW |