From df23f78ad16b40c244f518dba28a8555d61bdd0c Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Sat, 4 Jan 2020 10:28:38 -0500 Subject: Bug 1309147 - Part 3: Implement the support for CEReactions in Codegen. Tag UXP Issue #1344 --- dom/bindings/BindingUtils.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'dom/bindings/BindingUtils.cpp') diff --git a/dom/bindings/BindingUtils.cpp b/dom/bindings/BindingUtils.cpp index 6bc6b7143..c6452501a 100644 --- a/dom/bindings/BindingUtils.cpp +++ b/dom/bindings/BindingUtils.cpp @@ -16,6 +16,7 @@ #include "mozilla/SizePrintfMacros.h" #include "mozilla/Unused.h" #include "mozilla/UseCounter.h" +#include "mozilla/dom/DocGroup.h" #include "AccessCheck.h" #include "jsfriendapi.h" @@ -3405,6 +3406,28 @@ GetDesiredProto(JSContext* aCx, const JS::CallArgs& aCallArgs, return true; } +CustomElementReactionsStack* +GetCustomElementReactionsStack(JS::Handle aObj) +{ + // This might not be the right object, if there are wrappers. Unwrap if we can. + JSObject* obj = js::CheckedUnwrap(aObj); + if (!obj) { + return nullptr; + } + + nsGlobalWindow* window = xpc::WindowGlobalOrNull(obj); + if (!window) { + return nullptr; + } + + DocGroup* docGroup = window->AsInner()->GetDocGroup(); + if (!docGroup) { + return nullptr; + } + + return docGroup->CustomElementReactionsStack(); +} + // https://html.spec.whatwg.org/multipage/dom.html#htmlconstructor already_AddRefed CreateHTMLElement(const GlobalObject& aGlobal, const JS::CallArgs& aCallArgs, -- cgit v1.2.3