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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 v8::Handle<v8::Context> context = creationContext->CreationContext(); | 94 v8::Handle<v8::Context> context = creationContext->CreationContext(); |
95 | 95 |
96 if (!element->isUpgradedCustomElement() || DOMWrapperWorld::world(context).i sIsolatedWorld()) | 96 if (!element->isUpgradedCustomElement() || DOMWrapperWorld::world(context).i sIsolatedWorld()) |
97 return createUpgradeCandidateWrapper(element.get(), creationContext, iso late, createSpecificWrapper); | 97 return createUpgradeCandidateWrapper(element.get(), creationContext, iso late, createSpecificWrapper); |
98 | 98 |
99 V8PerContextData* perContextData = V8PerContextData::from(context); | 99 V8PerContextData* perContextData = V8PerContextData::from(context); |
100 if (!perContextData) | 100 if (!perContextData) |
101 return v8::Handle<v8::Object>(); | 101 return v8::Handle<v8::Object>(); |
102 | 102 |
103 CustomElementBinding* binding = perContextData->customElementBinding(element ->customElementDefinition()); | 103 CustomElementBinding* binding = perContextData->customElementBinding(element ->customElementDefinition()); |
104 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , binding->wrapperType(), element.get(), isolate); | 104 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , binding->wrapperType(), WrapperType::toInternalPointer(element.get()), isolate ); |
haraken
2014/08/08 15:50:31
What happens if someone passes element.get() to cr
Yuki
2014/08/11 05:42:00
Your idea sounds very nice and I'll add that check
| |
105 if (wrapper.IsEmpty()) | 105 if (wrapper.IsEmpty()) |
106 return v8::Handle<v8::Object>(); | 106 return v8::Handle<v8::Object>(); |
107 | 107 |
108 wrapper->SetPrototype(binding->prototype()); | 108 wrapper->SetPrototype(binding->prototype()); |
109 | 109 |
110 V8DOMWrapper::associateObjectWithWrapper<WrapperType>(element, binding->wrap perType(), wrapper, isolate, WrapperConfiguration::Dependent); | 110 V8DOMWrapper::associateObjectWithWrapper<WrapperType>(element, binding->wrap perType(), wrapper, isolate, WrapperConfiguration::Dependent); |
111 return wrapper; | 111 return wrapper; |
112 } | 112 } |
113 | 113 |
114 template | 114 template |
115 class CustomElementWrapper<HTMLElement, V8HTMLElement>; | 115 class CustomElementWrapper<HTMLElement, V8HTMLElement>; |
116 | 116 |
117 template | 117 template |
118 class CustomElementWrapper<SVGElement, V8SVGElement>; | 118 class CustomElementWrapper<SVGElement, V8SVGElement>; |
119 | 119 |
120 } // namespace blink | 120 } // namespace blink |
OLD | NEW |