summaryrefslogtreecommitdiffstats
path: root/js/xpconnect/wrappers
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /js/xpconnect/wrappers
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/xpconnect/wrappers')
-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;
}