summaryrefslogtreecommitdiffstats
path: root/js/xpconnect/wrappers/XrayWrapper.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
commitdef92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch)
tree2ef34b9ad8bb9a9220e05d60352558b15f513894 /js/xpconnect/wrappers/XrayWrapper.cpp
parentAdding debian version 125.0.3-1. (diff)
downloadfirefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz
firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/xpconnect/wrappers/XrayWrapper.cpp')
-rw-r--r--js/xpconnect/wrappers/XrayWrapper.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp
index cdedb02a5f..48696cd12d 100644
--- a/js/xpconnect/wrappers/XrayWrapper.cpp
+++ b/js/xpconnect/wrappers/XrayWrapper.cpp
@@ -1799,6 +1799,11 @@ bool DOMXrayTraits::call(JSContext* cx, HandleObject wrapper,
// using "legacycaller". At this time for all the legacycaller users it makes
// more sense to invoke on the xray compartment, so we just go ahead and do
// that for everything.
+ if (IsDOMConstructor(obj)) {
+ const JSNativeHolder* holder = NativeHolderFromObject(obj);
+ return holder->mNative(cx, args.length(), args.base());
+ }
+
if (js::IsProxy(obj)) {
if (JS::IsCallable(obj)) {
// Passing obj here, but it doesn't really matter because legacycaller
@@ -1822,20 +1827,21 @@ bool DOMXrayTraits::construct(JSContext* cx, HandleObject wrapper,
const JS::CallArgs& args,
const js::Wrapper& baseInstance) {
RootedObject obj(cx, getTargetObject(wrapper));
- MOZ_ASSERT(mozilla::dom::HasConstructor(obj));
- const JSClass* clasp = JS::GetClass(obj);
// See comments in DOMXrayTraits::call() explaining what's going on here.
- if (clasp->flags & JSCLASS_IS_DOMIFACEANDPROTOJSCLASS) {
- if (JSNative construct = clasp->getConstruct()) {
- if (!construct(cx, args.length(), args.base())) {
- return false;
- }
- } else {
+ if (IsDOMConstructor(obj)) {
+ const JSNativeHolder* holder = NativeHolderFromObject(obj);
+ if (!holder->mNative(cx, args.length(), args.base())) {
+ return false;
+ }
+ } else {
+ const JSClass* clasp = JS::GetClass(obj);
+ if (clasp->flags & JSCLASS_IS_DOMIFACEANDPROTOJSCLASS) {
+ MOZ_ASSERT(!clasp->getConstruct());
+
RootedValue v(cx, ObjectValue(*wrapper));
js::ReportIsNotFunction(cx, v);
return false;
}
- } else {
if (!baseInstance.construct(cx, wrapper, args)) {
return false;
}