Bug 1542932 Change define() parameter functionConstructor from Function to CustomElementConstructor r=bzbarsky

Depends on D26867

Differential Revision: https://phabricator.services.mozilla.com/D26868

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Karl Tomlinson 2019-04-10 15:45:11 +00:00
Родитель 9e68172512
Коммит e4131b866f
3 изменённых файлов: 10 добавлений и 10 удалений

Просмотреть файл

@ -637,10 +637,10 @@ int32_t CustomElementRegistry::InferNamespace(
}
// https://html.spec.whatwg.org/multipage/scripting.html#element-definition
void CustomElementRegistry::Define(JSContext* aCx, const nsAString& aName,
Function& aFunctionConstructor,
const ElementDefinitionOptions& aOptions,
ErrorResult& aRv) {
void CustomElementRegistry::Define(
JSContext* aCx, const nsAString& aName,
CustomElementConstructor& aFunctionConstructor,
const ElementDefinitionOptions& aOptions, ErrorResult& aRv) {
JS::Rooted<JSObject*> constructor(aCx, aFunctionConstructor.CallableOrNull());
// We need to do a dynamic unwrap in order to throw the right exception. We
@ -1387,7 +1387,8 @@ NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(CustomElementDefinition, Release)
CustomElementDefinition::CustomElementDefinition(
nsAtom* aType, nsAtom* aLocalName, int32_t aNamespaceID,
Function* aConstructor, nsTArray<RefPtr<nsAtom>>&& aObservedAttributes,
CustomElementConstructor* aConstructor,
nsTArray<RefPtr<nsAtom>>&& aObservedAttributes,
UniquePtr<LifecycleCallbacks>&& aCallbacks)
: mType(aType),
mLocalName(aLocalName),

Просмотреть файл

@ -15,7 +15,6 @@
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/CustomElementRegistryBinding.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/FunctionBinding.h"
#include "mozilla/dom/WebComponentsBinding.h"
#include "nsCycleCollectionParticipant.h"
#include "nsGenericHTMLElement.h"
@ -30,7 +29,6 @@ struct ElementDefinitionOptions;
class CallbackFunction;
class CustomElementReaction;
class DocGroup;
class Function;
class Promise;
struct LifecycleCallbackArgs {
@ -136,7 +134,8 @@ struct CustomElementDefinition {
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CustomElementDefinition)
CustomElementDefinition(nsAtom* aType, nsAtom* aLocalName,
int32_t aNamespaceID, Function* aConstructor,
int32_t aNamespaceID,
CustomElementConstructor* aConstructor,
nsTArray<RefPtr<nsAtom>>&& aObservedAttributes,
UniquePtr<LifecycleCallbacks>&& aCallbacks);
@ -551,7 +550,7 @@ class CustomElementRegistry final : public nsISupports, public nsWrapperCache {
JS::Handle<JSObject*> aGivenProto) override;
void Define(JSContext* aCx, const nsAString& aName,
Function& aFunctionConstructor,
CustomElementConstructor& aFunctionConstructor,
const ElementDefinitionOptions& aOptions, ErrorResult& aRv);
void Get(JSContext* cx, const nsAString& name,

Просмотреть файл

@ -5,7 +5,7 @@
// https://html.spec.whatwg.org/#dom-window-customelements
interface CustomElementRegistry {
[CEReactions, Throws, UseCounter]
void define(DOMString name, Function functionConstructor,
void define(DOMString name, CustomElementConstructor functionConstructor,
optional ElementDefinitionOptions options);
[ChromeOnly, Throws]
void setElementCreationCallback(DOMString name, CustomElementCreationCallback callback);