From 7381521cf771b5e2eec6b05b47ad7cf2c9d824c5 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Sat, 1 Jun 2024 19:30:47 +0200 Subject: [PATCH 1/2] Issue #2518 - Make various arguments optional in XPathEvaluator/XPathExpression. Resolves #2518 --- dom/webidl/XPathEvaluator.webidl | 10 ++++++---- dom/webidl/XPathExpression.webidl | 11 +++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/dom/webidl/XPathEvaluator.webidl b/dom/webidl/XPathEvaluator.webidl index a74909f2ab..9e5cc75745 100644 --- a/dom/webidl/XPathEvaluator.webidl +++ b/dom/webidl/XPathEvaluator.webidl @@ -9,11 +9,13 @@ interface XPathEvaluator { // Based on nsIDOMXPathEvaluator [NewObject, Throws] XPathExpression createExpression(DOMString expression, - XPathNSResolver? resolver); + optional XPathNSResolver? resolver = null); [Pure] Node createNSResolver(Node nodeResolver); [Throws] - XPathResult evaluate(DOMString expression, Node contextNode, - XPathNSResolver? resolver, unsigned short type, - object? result); + XPathResult evaluate(DOMString expression, + Node contextNode, + optional XPathNSResolver? resolver = null, + optional unsigned short type = 0 /* XPathResult.ANY_TYPE */, + optional object? result = null); }; diff --git a/dom/webidl/XPathExpression.webidl b/dom/webidl/XPathExpression.webidl index dd5835492e..4606cb9bd9 100644 --- a/dom/webidl/XPathExpression.webidl +++ b/dom/webidl/XPathExpression.webidl @@ -6,17 +6,20 @@ interface XPathExpression { // The result specifies a specific result object which may be reused and - // returned by this method. If this is specified as null or it's not an + // returned by this method. If this is omitted, specified as null, or it's not an // XPathResult object, a new result object will be constructed and returned. [Throws] - XPathResult evaluate(Node contextNode, unsigned short type, object? result); + XPathResult evaluate(Node contextNode, + optional unsigned short type = 0 /* XPathResult.ANY_TYPE */, + optional object? result = null); // The result specifies a specific result object which may be reused and - // returned by this method. If this is specified as null or it's not an + // returned by this method. If this is omitted, specified as null, or it's not an // XPathResult object, a new result object will be constructed and returned. [Throws, ChromeOnly] XPathResult evaluateWithContext(Node contextNode, unsigned long contextPosition, unsigned long contextSize, - unsigned short type, object? result); + optional unsigned short type = 0 /* XPathResult.ANY_TYPE */, + optional object? result = null); }; From 2128ac642e5b59a7d59057f7c07cc8298064595a Mon Sep 17 00:00:00 2001 From: Martok Date: Sun, 2 Jun 2024 21:15:57 +0200 Subject: [PATCH 2/2] Issue #2519 - Use parser error reporter to report missing module exports --- js/src/frontend/Parser.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 4e3181e06b..261d14480e 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -2286,8 +2286,7 @@ Parser::moduleBody(ModuleSharedContext* modulesc) if (!str.encodeLatin1(context, name)) return null(); - JS_ReportErrorNumberLatin1(context->asJSContext(), GetErrorMessage, nullptr, - JSMSG_MISSING_EXPORT, str.ptr()); + error(JSMSG_MISSING_EXPORT, str.ptr()); return null(); }