Changeset 211309 in webkit
- Timestamp:
- Jan 27, 2017, 4:03:36 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
bindings/js/JSCustomElementRegistryCustom.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r211308 r211309 1 2017-01-27 Michael Saboff <msaboff@apple.com> 2 3 JSCustomElementInterface::invokeCallback can be called with a null callback because Weak<> 4 https://bugs.webkit.org/show_bug.cgi?id=167522 5 6 Reviewed by Filip Pizlo. 7 8 Added all provided callbacks to the global object with a private name the same way 9 that the constructor was added. This will keep these callbacks from being GC'ed. 10 11 * bindings/js/JSCustomElementRegistryCustom.cpp: 12 (WebCore::JSCustomElementRegistry::define): 13 1 14 2017-01-27 Myles C. Maxfield <mmaxfield@apple.com> 2 15 -
trunk/Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp
r209390 r211309 123 123 auto elementInterface = JSCustomElementInterface::create(name, constructor, globalObject()); 124 124 125 if (auto* connectedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "connectedCallback"))) 125 auto* connectedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "connectedCallback")); 126 if (connectedCallback) 126 127 elementInterface->setConnectedCallback(connectedCallback); 127 128 RETURN_IF_EXCEPTION(scope, JSValue()); 128 129 129 if (auto* disconnectedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "disconnectedCallback"))) 130 auto* disconnectedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "disconnectedCallback")); 131 if (disconnectedCallback) 130 132 elementInterface->setDisconnectedCallback(disconnectedCallback); 131 133 RETURN_IF_EXCEPTION(scope, JSValue()); 132 134 133 if (auto* adoptedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "adoptedCallback"))) 135 auto* adoptedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "adoptedCallback")); 136 if (adoptedCallback) 134 137 elementInterface->setAdoptedCallback(adoptedCallback); 135 138 RETURN_IF_EXCEPTION(scope, JSValue()); … … 147 150 } 148 151 149 PrivateName uniquePrivateName; 150 globalObject()->putDirect(vm, uniquePrivateName, constructor); 152 auto addToGlobalObjectWithPrivateName = [&] (JSObject* objectToAdd) { 153 if (objectToAdd) { 154 PrivateName uniquePrivateName; 155 globalObject()->putDirect(vm, uniquePrivateName, objectToAdd); 156 } 157 }; 158 159 addToGlobalObjectWithPrivateName(constructor); 160 addToGlobalObjectWithPrivateName(connectedCallback); 161 addToGlobalObjectWithPrivateName(disconnectedCallback); 162 addToGlobalObjectWithPrivateName(adoptedCallback); 163 addToGlobalObjectWithPrivateName(attributeChangedCallback); 151 164 152 165 registry.addElementDefinition(WTFMove(elementInterface));
Note:
See TracChangeset
for help on using the changeset viewer.