| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 91 |
| 92 case MessageEvent::DataTypeArrayBuffer: | 92 case MessageEvent::DataTypeArrayBuffer: |
| 93 result = V8HiddenValue::getHiddenValue(info.GetIsolate(), info.Holder(),
V8HiddenValue::arrayBufferData(info.GetIsolate())); | 93 result = V8HiddenValue::getHiddenValue(info.GetIsolate(), info.Holder(),
V8HiddenValue::arrayBufferData(info.GetIsolate())); |
| 94 if (result.IsEmpty()) | 94 if (result.IsEmpty()) |
| 95 result = toV8(event->dataAsArrayBuffer(), info.Holder(), info.GetIso
late()); | 95 result = toV8(event->dataAsArrayBuffer(), info.Holder(), info.GetIso
late()); |
| 96 break; | 96 break; |
| 97 } | 97 } |
| 98 | 98 |
| 99 // Overwrite the data attribute so it returns the cached result in future in
vocations. | 99 // Overwrite the data attribute so it returns the cached result in future in
vocations. |
| 100 // This custom getter handler will not be called again. | 100 // This custom getter handler will not be called again. |
| 101 // TODO(bashi): Use CreateDataProperty() instead of ForceSet(). |
| 102 // http://crbug.com/475206 |
| 101 v8::PropertyAttribute dataAttr = static_cast<v8::PropertyAttribute>(v8::Dont
Delete | v8::ReadOnly); | 103 v8::PropertyAttribute dataAttr = static_cast<v8::PropertyAttribute>(v8::Dont
Delete | v8::ReadOnly); |
| 102 if (!v8CallBoolean(info.Holder()->ForceSet(info.GetIsolate()->GetCurrentCont
ext(), v8AtomicString(info.GetIsolate(), "data"), result, dataAttr))) { | 104 if (!v8CallBoolean(info.Holder()->ForceSet(info.GetIsolate()->GetCurrentCont
ext(), v8AtomicString(info.GetIsolate(), "data"), result, dataAttr))) { |
| 103 v8SetReturnValue(info, v8::Null(info.GetIsolate())); | 105 v8SetReturnValue(info, v8::Null(info.GetIsolate())); |
| 104 return; | 106 return; |
| 105 } | 107 } |
| 106 v8SetReturnValue(info, result); | 108 v8SetReturnValue(info, result); |
| 107 } | 109 } |
| 108 | 110 |
| 109 void V8MessageEvent::initMessageEventMethodCustom(const v8::FunctionCallbackInfo
<v8::Value>& info) | 111 void V8MessageEvent::initMessageEventMethodCustom(const v8::FunctionCallbackInfo
<v8::Value>& info) |
| 110 { | 112 { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 131 event->initMessageEvent(typeArg, canBubbleArg, cancelableArg, originArg, las
tEventIdArg, sourceArg, portArray.release()); | 133 event->initMessageEvent(typeArg, canBubbleArg, cancelableArg, originArg, las
tEventIdArg, sourceArg, portArray.release()); |
| 132 | 134 |
| 133 if (!dataArg.IsEmpty()) { | 135 if (!dataArg.IsEmpty()) { |
| 134 V8HiddenValue::setHiddenValue(info.GetIsolate(), info.Holder(), V8Hidden
Value::data(info.GetIsolate()), dataArg); | 136 V8HiddenValue::setHiddenValue(info.GetIsolate(), info.Holder(), V8Hidden
Value::data(info.GetIsolate()), dataArg); |
| 135 if (DOMWrapperWorld::current(info.GetIsolate()).isIsolatedWorld()) | 137 if (DOMWrapperWorld::current(info.GetIsolate()).isIsolatedWorld()) |
| 136 event->setSerializedData(SerializedScriptValueFactory::instance().cr
eateAndSwallowExceptions(info.GetIsolate(), dataArg)); | 138 event->setSerializedData(SerializedScriptValueFactory::instance().cr
eateAndSwallowExceptions(info.GetIsolate(), dataArg)); |
| 137 } | 139 } |
| 138 } | 140 } |
| 139 | 141 |
| 140 } // namespace blink | 142 } // namespace blink |
| OLD | NEW |