OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 27 matching lines...) Expand all Loading... | |
38 #include "bindings/v8/V8Binding.h" | 38 #include "bindings/v8/V8Binding.h" |
39 #include "bindings/v8/V8DOMWrapper.h" | 39 #include "bindings/v8/V8DOMWrapper.h" |
40 #include "bindings/v8/V8HiddenPropertyName.h" | 40 #include "bindings/v8/V8HiddenPropertyName.h" |
41 #include "core/dom/ContextFeatures.h" | 41 #include "core/dom/ContextFeatures.h" |
42 #include "core/dom/ExceptionCode.h" | 42 #include "core/dom/ExceptionCode.h" |
43 #include "core/page/Frame.h" | 43 #include "core/page/Frame.h" |
44 #include "RuntimeEnabledFeatures.h" | 44 #include "RuntimeEnabledFeatures.h" |
45 | 45 |
46 namespace WebCore { | 46 namespace WebCore { |
47 | 47 |
48 static v8::Handle<v8::Value> cacheState(v8::Handle<v8::Object> customEvent, v8:: Handle<v8::Value> detail) | |
49 { | |
50 customEvent->SetHiddenValue(V8HiddenPropertyName::detail(), detail); | |
51 return detail; | |
52 } | |
53 | |
54 | |
48 void V8CustomEvent::detailAttrGetterCustom(v8::Local<v8::String> name, const v8: :PropertyCallbackInfo<v8::Value>& info) | 55 void V8CustomEvent::detailAttrGetterCustom(v8::Local<v8::String> name, const v8: :PropertyCallbackInfo<v8::Value>& info) |
haraken
2013/06/27 04:50:27
Why does this method need to be custom? I guess th
jww
2013/06/27 17:44:42
This function has always been custom (in fact, it
haraken
2013/06/28 00:08:01
I'd guess it's worth auto-generating this method,
| |
49 { | 56 { |
50 CustomEvent* imp = V8CustomEvent::toNative(info.Holder()); | 57 CustomEvent* event = V8CustomEvent::toNative(info.Holder()); |
51 RefPtr<SerializedScriptValue> serialized = imp->serializedScriptValue(); | 58 ASSERT(!event->serializedScriptValue().get()); |
52 if (serialized) { | 59 |
53 v8::Handle<v8::Value> value = info.Holder()->GetHiddenValue(V8HiddenProp ertyName::detail()); | 60 v8::Handle<v8::Value> result = info.Holder()->GetHiddenValue(V8HiddenPropert yName::detail()); |
54 if (value.IsEmpty()) { | 61 |
55 value = serialized->deserialize(); | 62 if (!result.IsEmpty()) { |
56 info.Holder()->SetHiddenValue(V8HiddenPropertyName::detail(), value) ; | 63 v8SetReturnValue(info, result); |
57 } | |
58 v8SetReturnValue(info, value); | |
59 return; | 64 return; |
60 } | 65 } |
61 v8SetReturnValue(info, imp->detail().v8Value()); | 66 |
67 RefPtr<SerializedScriptValue> serialized = event->serializedScriptValue(); | |
68 if (serialized) { | |
69 result = serialized->deserialize(); | |
70 v8SetReturnValue(info, cacheState(info.Holder(), result)); | |
71 return; | |
72 } | |
73 | |
74 v8SetReturnValue(info, cacheState(info.Holder(), v8Null(info.GetIsolate()))) ; | |
75 } | |
76 | |
77 void V8CustomEvent::initCustomEventMethodCustom(const v8::FunctionCallbackInfo<v 8::Value>& args) | |
78 { | |
79 CustomEvent* event = V8CustomEvent::toNative(args.Holder()); | |
80 String typeArg = toWebCoreString(args[0]); | |
haraken
2013/06/27 04:50:27
You should use V8TRYCATCH_FOR_V8STRINGRESOURCE_VOI
jww
2013/06/27 17:44:42
Done.
| |
81 bool canBubbleArg = args[1]->BooleanValue(); | |
haraken
2013/06/27 04:50:27
You should use V8TRYCATCH_VOID().
jww
2013/06/27 17:44:42
Done.
| |
82 bool cancelableArg = args[2]->BooleanValue(); | |
haraken
2013/06/27 04:50:27
Ditto.
jww
2013/06/27 17:44:42
Done.
| |
83 v8::Handle<v8::Value> detailsArg = args[3]; | |
84 | |
85 args.Holder()->SetHiddenValue(V8HiddenPropertyName::detail(), detailsArg); | |
86 event->initEvent(typeArg, canBubbleArg, cancelableArg); | |
62 } | 87 } |
63 | 88 |
64 } // namespace WebCore | 89 } // namespace WebCore |
OLD | NEW |