| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 break; | 90 break; |
| 91 } | 91 } |
| 92 | 92 |
| 93 // Overwrite the data attribute so it returns the cached result in future in
vocations. | 93 // Overwrite the data attribute so it returns the cached result in future in
vocations. |
| 94 // This custom handler (dataAccessGetter) will not be called again. | 94 // This custom handler (dataAccessGetter) will not be called again. |
| 95 v8::PropertyAttribute dataAttr = static_cast<v8::PropertyAttribute>(v8::Dont
Delete | v8::ReadOnly); | 95 v8::PropertyAttribute dataAttr = static_cast<v8::PropertyAttribute>(v8::Dont
Delete | v8::ReadOnly); |
| 96 info.Holder()->ForceSet(name, result, dataAttr); | 96 info.Holder()->ForceSet(name, result, dataAttr); |
| 97 v8SetReturnValue(info, result); | 97 v8SetReturnValue(info, result); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void V8MessageEvent::initMessageEventMethodCustom(const v8::FunctionCallbackInfo
<v8::Value>& args) | 100 void V8MessageEvent::initMessageEventMethodCustom(const v8::FunctionCallbackInfo
<v8::Value>& info) |
| 101 { | 101 { |
| 102 MessageEvent* event = V8MessageEvent::toNative(args.Holder()); | 102 MessageEvent* event = V8MessageEvent::toNative(info.Holder()); |
| 103 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, typeArg, args[0]); | 103 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, typeArg, info[0]); |
| 104 V8TRYCATCH_VOID(bool, canBubbleArg, args[1]->BooleanValue()); | 104 V8TRYCATCH_VOID(bool, canBubbleArg, info[1]->BooleanValue()); |
| 105 V8TRYCATCH_VOID(bool, cancelableArg, args[2]->BooleanValue()); | 105 V8TRYCATCH_VOID(bool, cancelableArg, info[2]->BooleanValue()); |
| 106 v8::Handle<v8::Value> dataArg = args[3]; | 106 v8::Handle<v8::Value> dataArg = info[3]; |
| 107 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, originArg, args[4])
; | 107 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, originArg, info[4])
; |
| 108 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, lastEventIdArg, arg
s[5]); | 108 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, lastEventIdArg, inf
o[5]); |
| 109 | 109 |
| 110 DOMWindow* sourceArg = 0; | 110 DOMWindow* sourceArg = 0; |
| 111 if (args[6]->IsObject()) { | 111 if (info[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(info[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(info.GetIsolate(), worldTypeInMainThread(info.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 const int portArrayIndex = 7; | 119 const int portArrayIndex = 7; |
| 120 if (!isUndefinedOrNull(args[portArrayIndex])) { | 120 if (!isUndefinedOrNull(info[portArrayIndex])) { |
| 121 portArray = adoptPtr(new MessagePortArray); | 121 portArray = adoptPtr(new MessagePortArray); |
| 122 if (!getMessagePortArray(args[portArrayIndex], portArrayIndex + 1, *port
Array, args.GetIsolate())) | 122 if (!getMessagePortArray(info[portArrayIndex], portArrayIndex + 1, *port
Array, info.GetIsolate())) |
| 123 return; | 123 return; |
| 124 } | 124 } |
| 125 event->initMessageEvent(typeArg, canBubbleArg, cancelableArg, originArg, las
tEventIdArg, sourceArg, portArray.release()); | 125 event->initMessageEvent(typeArg, canBubbleArg, cancelableArg, originArg, las
tEventIdArg, sourceArg, portArray.release()); |
| 126 | 126 |
| 127 if (!dataArg.IsEmpty()) { | 127 if (!dataArg.IsEmpty()) { |
| 128 args.Holder()->SetHiddenValue(V8HiddenPropertyName::data(args.GetIsolate
()), dataArg); | 128 info.Holder()->SetHiddenValue(V8HiddenPropertyName::data(info.GetIsolate
()), dataArg); |
| 129 if (isolatedWorldForIsolate(args.GetIsolate())) | 129 if (isolatedWorldForIsolate(info.GetIsolate())) |
| 130 event->setSerializedData(SerializedScriptValue::createAndSwallowExce
ptions(dataArg, args.GetIsolate())); | 130 event->setSerializedData(SerializedScriptValue::createAndSwallowExce
ptions(dataArg, info.GetIsolate())); |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| 134 void V8MessageEvent::webkitInitMessageEventMethodCustom(const v8::FunctionCallba
ckInfo<v8::Value>& args) | 134 void V8MessageEvent::webkitInitMessageEventMethodCustom(const v8::FunctionCallba
ckInfo<v8::Value>& info) |
| 135 { | 135 { |
| 136 initMessageEventMethodCustom(args); | 136 initMessageEventMethodCustom(info); |
| 137 } | 137 } |
| 138 | 138 |
| 139 | 139 |
| 140 } // namespace WebCore | 140 } // namespace WebCore |
| OLD | NEW |