Modified: branches/safari-603-branch/Source/WebCore/ChangeLog (211516 => 211517)
--- branches/safari-603-branch/Source/WebCore/ChangeLog 2017-02-01 21:26:31 UTC (rev 211516)
+++ branches/safari-603-branch/Source/WebCore/ChangeLog 2017-02-01 21:26:34 UTC (rev 211517)
@@ -1,5 +1,22 @@
2017-01-31 Matthew Hanson <matthew_han...@apple.com>
+ Merge r211309. rdar://problem/30240378
+
+ 2017-01-27 Michael Saboff <msab...@apple.com>
+
+ JSCustomElementInterface::invokeCallback can be called with a null callback because Weak<>
+ https://bugs.webkit.org/show_bug.cgi?id=167522
+
+ Reviewed by Filip Pizlo.
+
+ Added all provided callbacks to the global object with a private name the same way
+ that the constructor was added. This will keep these callbacks from being GC'ed.
+
+ * bindings/js/JSCustomElementRegistryCustom.cpp:
+ (WebCore::JSCustomElementRegistry::define):
+
+2017-01-31 Matthew Hanson <matthew_han...@apple.com>
+
Merge r211305. rdar://problem/29320059
2017-01-27 Simon Fraser <simon.fra...@apple.com>
Modified: branches/safari-603-branch/Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp (211516 => 211517)
--- branches/safari-603-branch/Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp 2017-02-01 21:26:31 UTC (rev 211516)
+++ branches/safari-603-branch/Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp 2017-02-01 21:26:34 UTC (rev 211517)
@@ -122,15 +122,18 @@
QualifiedName name(nullAtom, localName, HTMLNames::xhtmlNamespaceURI);
auto elementInterface = JSCustomElementInterface::create(name, constructor, globalObject());
- if (auto* connectedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "connectedCallback")))
+ auto* connectedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "connectedCallback"));
+ if (connectedCallback)
elementInterface->setConnectedCallback(connectedCallback);
RETURN_IF_EXCEPTION(scope, JSValue());
- if (auto* disconnectedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "disconnectedCallback")))
+ auto* disconnectedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "disconnectedCallback"));
+ if (disconnectedCallback)
elementInterface->setDisconnectedCallback(disconnectedCallback);
RETURN_IF_EXCEPTION(scope, JSValue());
- if (auto* adoptedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "adoptedCallback")))
+ auto* adoptedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "adoptedCallback"));
+ if (adoptedCallback)
elementInterface->setAdoptedCallback(adoptedCallback);
RETURN_IF_EXCEPTION(scope, JSValue());
@@ -146,9 +149,19 @@
}
}
- PrivateName uniquePrivateName;
- globalObject()->putDirect(vm, uniquePrivateName, constructor);
+ auto addToGlobalObjectWithPrivateName = [&] (JSObject* objectToAdd) {
+ if (objectToAdd) {
+ PrivateName uniquePrivateName;
+ globalObject()->putDirect(vm, uniquePrivateName, objectToAdd);
+ }
+ };
+ addToGlobalObjectWithPrivateName(constructor);
+ addToGlobalObjectWithPrivateName(connectedCallback);
+ addToGlobalObjectWithPrivateName(disconnectedCallback);
+ addToGlobalObjectWithPrivateName(adoptedCallback);
+ addToGlobalObjectWithPrivateName(attributeChangedCallback);
+
registry.addElementDefinition(WTFMove(elementInterface));
return jsUndefined();