From 99521124d044cf2e2fd209b3ffa16fc1ab8fe5cd Mon Sep 17 00:00:00 2001 From: Karl Tomlinson Date: Wed, 10 Apr 2019 15:25:15 +0000 Subject: [PATCH] Bug 1542932 align CustomElementConstructor::Construct() parameters with WebIDL bindings conventions r=bzbarsky Depends on D26865 Differential Revision: https://phabricator.services.mozilla.com/D26866 --HG-- extra : moz-landing-system : lando --- dom/base/CustomElementRegistry.cpp | 10 +++++----- dom/base/CustomElementRegistry.h | 5 +++-- dom/base/nsContentUtils.cpp | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/dom/base/CustomElementRegistry.cpp b/dom/base/CustomElementRegistry.cpp index 4511842d7905..5f7be03e652e 100644 --- a/dom/base/CustomElementRegistry.cpp +++ b/dom/base/CustomElementRegistry.cpp @@ -159,9 +159,9 @@ CustomElementCallback::CustomElementCallback( // CustomElementConstructor already_AddRefed CustomElementConstructor::Construct( - const char* aExecutionReason, ErrorResult& aRv) { - CallSetup s(this, aRv, aExecutionReason, - CallbackFunction::eRethrowExceptions); + ErrorResult& aRv, const char* aExecutionReason, + ExceptionHandling aExceptionHandling) { + CallSetup s(this, aRv, aExecutionReason, aExceptionHandling); JSContext* cx = s.GetContext(); if (!cx) { @@ -1068,8 +1068,8 @@ static void DoUpgrade(Element* aElement, CustomElementConstructor* aConstructor, ErrorResult& aRv) { // Rethrow the exception since it might actually throw the exception from the // upgrade steps back out to the caller of document.createElement. - RefPtr constructResult = - aConstructor->Construct("Custom Element Upgrade", aRv); + RefPtr constructResult = aConstructor->Construct( + aRv, "Custom Element Upgrade", CallbackFunction::eRethrowExceptions); if (aRv.Failed()) { return; } diff --git a/dom/base/CustomElementRegistry.h b/dom/base/CustomElementRegistry.h index a95ba2f258ea..1b25aadf56bd 100644 --- a/dom/base/CustomElementRegistry.h +++ b/dom/base/CustomElementRegistry.h @@ -87,8 +87,9 @@ class CustomElementConstructor final : public CallbackFunction { MOZ_ASSERT(JS::IsConstructor(mCallback)); } - already_AddRefed Construct(const char* aExecutionReason, - ErrorResult& aRv); + already_AddRefed Construct( + ErrorResult& aRv, const char* aExecutionReason = nullptr, + ExceptionHandling aExceptionHandling = eReportExceptions); }; // Each custom element has an associated callback queue and an element is diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 65ad938e9bf3..3c96cb45bc88 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -9457,8 +9457,8 @@ static void DoCustomElementCreate(Element** aElement, Document* aDoc, NodeInfo* aNodeInfo, CustomElementConstructor* aConstructor, ErrorResult& aRv) { - RefPtr element = - aConstructor->Construct("Custom Element Create", aRv); + RefPtr element = aConstructor->Construct( + aRv, "Custom Element Create", CallbackFunction::eRethrowExceptions); if (aRv.Failed()) { return; }