https://bugs.webkit.org/show_bug.cgi?id=157454
Reviewed by Darin Adler.
Reduce special handling of XPathNSResolver type in the bindings.
* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSBindingsAllInOne.cpp:
Add new JSXPathNSResolverCustom.cpp file.
* bindings/js/JSDOMStringListCustom.cpp:
(WebCore::JSDOMStringList::toWrapped):
Take the ExecState by reference instead of pointer.
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::toWrapped):
Update to take an ExecState& parameter. The bindings now pass
an ExecState to all custom toWrapped() methods for consistency
and flexibility.
* bindings/js/JSDictionary.cpp:
(WebCore::JSDictionary::convertValue):
Pass an ExecState now that those toWrapped() methods expect
it.
* bindings/js/JSEventTargetCustom.cpp:
(WebCore::JSEventTarget::toWrapped):
Update to take an ExecState& parameter.
* bindings/js/JSIDBDatabaseCustom.cpp:
(WebCore::JSIDBDatabase::transaction):
Pass ExecState by reference instead of pointer.
* bindings/js/JSMessageEventCustom.cpp:
(WebCore::handleInitMessageEvent):
Pass ExecState to JSDOMWindow::toWrapped().
* bindings/js/JSXPathNSResolverCustom.cpp: Added.
(WebCore::JSXPathNSResolver::toWrapped):
Provide a custom implementation of JSXPathNSResolver::toWrapped()
instead of having the custom code in the bindings generator.
* bindings/scripts/CodeGeneratorJS.pm:
(AddIncludesForType):
Drop special includes for XPathNSResolver as they are no longer needed.
(GenerateHeader):
Drop special casing of certain types for generating the toWrapped()
declaration by:
1. Relying on GetNativeType() for the return value as certain types
return a RefPtr instead of a raw pointer.
2. Adding an extra ExecState parameter when a custom implementation of
toWrapped() is provided, given that some of them need it.
(GenerateParametersCheck):
Drop custom code for XPathNSResolver and use the normal code path for
this type now. The custom code now resides in the custom implementation
of JSXPathNSResolver::toWrapped(), in custom bindings.
(JSValueToNative):
- Drop NodeFilter from the nativeType hash map as it was updated to
be a callback interface a while back.
- Add XPathNSResolver to nativeType hash map so that we now to use
a RefPtr<> instead of a raw pointer in the bindings. We should
probably add an IDL extended attribute for this at some point.
- Drop special casing for DOMStringList which was outdated since there
is no toDOMStringList() function. DOMStringList has a custom
toWrapped() function instead nowadays so we now call this one
instead. We apparently do not have any DOMStringList parameters
outside our bindings tests at the moment, which is why no one
noticed.
- Pass an ExecState to toWrapped() if the interface has the
JSCustomToNativeObject IDL extended attribute.
* bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
* bindings/scripts/test/GObject/WebKitDOMTestObj.h:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/ObjC/DOMTestObj.h:
* bindings/scripts/test/ObjC/DOMTestObj.mm:
* bindings/scripts/test/TestObj.idl:
Add bindings test coverage for having an operation with an
XPathNSResolver parameter.
* dom/Document.idl:
* xml/XPathEvaluator.idl:
Drop some unnecessary default parameter values.
* xml/XPathNSResolver.idl:
Add JSCustomToNativeObject IDL extended attribute so that we can
provide our own custom implementation of JSXPathNSResolver::toWrapped(),
instead of having the custom code in the bindings generator.
* dom/Document.cpp:
(WebCore::Document::createExpression):
(WebCore::Document::evaluate):
* dom/Document.h:
* inspector/InspectorNodeFinder.cpp:
* xml/XPathEvaluator.cpp:
(WebCore::XPathEvaluator::createExpression):
(WebCore::XPathEvaluator::evaluate):
* xml/XPathEvaluator.h:
* xml/XPathExpression.cpp:
(WebCore::XPathExpression::createExpression):
* xml/XPathExpression.h:
* xml/XPathParser.cpp:
(WebCore::XPath::Parser::Parser):
(WebCore::XPath::Parser::parseStatement):
* xml/XPathParser.h:
Take XPathNSResolver parameter as a Ref<XPathNSResolver>&& as this is
what the generated bindings now provide us, given that this sometimes
have to create a wrapper around a JSObject.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@200550
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
bindings/js/JSWorkerGlobalScopeBase.cpp
bindings/js/JSWorkerGlobalScopeCustom.cpp
bindings/js/JSXMLHttpRequestCustom.cpp
+ bindings/js/JSXPathNSResolverCustom.cpp
bindings/js/JSXPathResultCustom.cpp
bindings/js/JSXSLTProcessorCustom.cpp
bindings/js/ReadableStreamController.cpp
+2016-05-07 Chris Dumez <cdumez@apple.com>
+
+ Reduce special handling of XPathNSResolver type in the bindings
+ https://bugs.webkit.org/show_bug.cgi?id=157454
+
+ Reviewed by Darin Adler.
+
+ Reduce special handling of XPathNSResolver type in the bindings.
+
+ * CMakeLists.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSBindingsAllInOne.cpp:
+ Add new JSXPathNSResolverCustom.cpp file.
+
+ * bindings/js/JSDOMStringListCustom.cpp:
+ (WebCore::JSDOMStringList::toWrapped):
+ Take the ExecState by reference instead of pointer.
+
+ * bindings/js/JSDOMWindowCustom.cpp:
+ (WebCore::JSDOMWindow::toWrapped):
+ Update to take an ExecState& parameter. The bindings now pass
+ an ExecState to all custom toWrapped() methods for consistency
+ and flexibility.
+
+ * bindings/js/JSDictionary.cpp:
+ (WebCore::JSDictionary::convertValue):
+ Pass an ExecState now that those toWrapped() methods expect
+ it.
+
+ * bindings/js/JSEventTargetCustom.cpp:
+ (WebCore::JSEventTarget::toWrapped):
+ Update to take an ExecState& parameter.
+
+ * bindings/js/JSIDBDatabaseCustom.cpp:
+ (WebCore::JSIDBDatabase::transaction):
+ Pass ExecState by reference instead of pointer.
+
+ * bindings/js/JSMessageEventCustom.cpp:
+ (WebCore::handleInitMessageEvent):
+ Pass ExecState to JSDOMWindow::toWrapped().
+
+ * bindings/js/JSXPathNSResolverCustom.cpp: Added.
+ (WebCore::JSXPathNSResolver::toWrapped):
+ Provide a custom implementation of JSXPathNSResolver::toWrapped()
+ instead of having the custom code in the bindings generator.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (AddIncludesForType):
+ Drop special includes for XPathNSResolver as they are no longer needed.
+
+ (GenerateHeader):
+ Drop special casing of certain types for generating the toWrapped()
+ declaration by:
+ 1. Relying on GetNativeType() for the return value as certain types
+ return a RefPtr instead of a raw pointer.
+ 2. Adding an extra ExecState parameter when a custom implementation of
+ toWrapped() is provided, given that some of them need it.
+
+ (GenerateParametersCheck):
+ Drop custom code for XPathNSResolver and use the normal code path for
+ this type now. The custom code now resides in the custom implementation
+ of JSXPathNSResolver::toWrapped(), in custom bindings.
+
+ (JSValueToNative):
+ - Drop NodeFilter from the nativeType hash map as it was updated to
+ be a callback interface a while back.
+ - Add XPathNSResolver to nativeType hash map so that we now to use
+ a RefPtr<> instead of a raw pointer in the bindings. We should
+ probably add an IDL extended attribute for this at some point.
+ - Drop special casing for DOMStringList which was outdated since there
+ is no toDOMStringList() function. DOMStringList has a custom
+ toWrapped() function instead nowadays so we now call this one
+ instead. We apparently do not have any DOMStringList parameters
+ outside our bindings tests at the moment, which is why no one
+ noticed.
+ - Pass an ExecState to toWrapped() if the interface has the
+ JSCustomToNativeObject IDL extended attribute.
+
+ * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
+ * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ * bindings/scripts/test/ObjC/DOMTestObj.h:
+ * bindings/scripts/test/ObjC/DOMTestObj.mm:
+ * bindings/scripts/test/TestObj.idl:
+ Add bindings test coverage for having an operation with an
+ XPathNSResolver parameter.
+
+ * dom/Document.idl:
+ * xml/XPathEvaluator.idl:
+ Drop some unnecessary default parameter values.
+
+ * xml/XPathNSResolver.idl:
+ Add JSCustomToNativeObject IDL extended attribute so that we can
+ provide our own custom implementation of JSXPathNSResolver::toWrapped(),
+ instead of having the custom code in the bindings generator.
+
+ * dom/Document.cpp:
+ (WebCore::Document::createExpression):
+ (WebCore::Document::evaluate):
+ * dom/Document.h:
+ * inspector/InspectorNodeFinder.cpp:
+ * xml/XPathEvaluator.cpp:
+ (WebCore::XPathEvaluator::createExpression):
+ (WebCore::XPathEvaluator::evaluate):
+ * xml/XPathEvaluator.h:
+ * xml/XPathExpression.cpp:
+ (WebCore::XPathExpression::createExpression):
+ * xml/XPathExpression.h:
+ * xml/XPathParser.cpp:
+ (WebCore::XPath::Parser::Parser):
+ (WebCore::XPath::Parser::parseStatement):
+ * xml/XPathParser.h:
+ Take XPathNSResolver parameter as a Ref<XPathNSResolver>&& as this is
+ what the generated bindings now provide us, given that this sometimes
+ have to create a wrapper around a JSObject.
+
2016-05-07 Darin Adler <darin@apple.com>
Fix crash introduced by the last patch.
8367587F1C56E99B008A1087 /* JSHTMLDataElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 834B86A81C56E93E00F3F0E3 /* JSHTMLDataElement.h */; };
836BAD211BD1CA670037356A /* HTMLTableHeaderCellElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 836BAD1F1BD1CA670037356A /* HTMLTableHeaderCellElement.h */; };
836BAD221BD1CA670037356A /* HTMLTableDataCellElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 836BAD201BD1CA670037356A /* HTMLTableDataCellElement.h */; };
+ 836C14431CDEAFD80073493F /* JSXPathNSResolverCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 836C14421CDEAFCA0073493F /* JSXPathNSResolverCustom.cpp */; };
836CB1F61BD1E41800AF1591 /* JSHTMLTableHeaderCellElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 836CB1F21BD1E41800AF1591 /* JSHTMLTableHeaderCellElement.h */; };
836CB1F71BD1E41800AF1591 /* JSHTMLTableHeaderCellElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 836CB1F31BD1E41800AF1591 /* JSHTMLTableHeaderCellElement.cpp */; };
836CB1F81BD1E41800AF1591 /* JSHTMLTableDataCellElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 836CB1F41BD1E41800AF1591 /* JSHTMLTableDataCellElement.h */; };
8369E58F1AFDD0300087DF68 /* NonDocumentTypeChildNode.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = NonDocumentTypeChildNode.idl; sourceTree = "<group>"; };
836BAD1F1BD1CA670037356A /* HTMLTableHeaderCellElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLTableHeaderCellElement.h; sourceTree = "<group>"; };
836BAD201BD1CA670037356A /* HTMLTableDataCellElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLTableDataCellElement.h; sourceTree = "<group>"; };
+ 836C14421CDEAFCA0073493F /* JSXPathNSResolverCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXPathNSResolverCustom.cpp; sourceTree = "<group>"; };
836CB1F21BD1E41800AF1591 /* JSHTMLTableHeaderCellElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLTableHeaderCellElement.h; sourceTree = "<group>"; };
836CB1F31BD1E41800AF1591 /* JSHTMLTableHeaderCellElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLTableHeaderCellElement.cpp; sourceTree = "<group>"; };
836CB1F41BD1E41800AF1591 /* JSHTMLTableDataCellElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLTableDataCellElement.h; sourceTree = "<group>"; };
418C395D1C8F0AAB0051C8A3 /* JSReadableStreamSourceCustom.cpp */,
E1C36D320EB0A094007410BC /* JSWorkerGlobalScopeBase.cpp */,
E1C36D330EB0A094007410BC /* JSWorkerGlobalScopeBase.h */,
+ 836C14421CDEAFCA0073493F /* JSXPathNSResolverCustom.cpp */,
418C395E1C8F0AAB0051C8A3 /* ReadableStreamController.cpp */,
418C395F1C8F0AAB0051C8A3 /* ReadableStreamController.h */,
BCA378BA0D15F64200B793D6 /* ScheduledAction.cpp */,
DB23C2CB0A508D29002489EB /* IndentOutdentCommand.cpp in Sources */,
517138EF1BED1D1A000D5F01 /* IndexKey.cpp in Sources */,
51EEAA731BEFFAB100218008 /* IndexValueEntry.cpp in Sources */,
+ 836C14431CDEAFD80073493F /* JSXPathNSResolverCustom.cpp in Sources */,
517138F71BF128BB000D5F01 /* IndexValueStore.cpp in Sources */,
A8CFF5E60A155A05000A4234 /* InlineBox.cpp in Sources */,
B57CB52D182A3EED0079A647 /* InlineElementBox.cpp in Sources */,
#include "JSWorkerGlobalScopeBase.cpp"
#include "JSWorkerGlobalScopeCustom.cpp"
#include "JSXMLHttpRequestCustom.cpp"
+#include "JSXPathNSResolverCustom.cpp"
#include "JSXPathResultCustom.cpp"
#include "JSXSLTProcessorCustom.cpp"
#include "ScheduledAction.cpp"
namespace WebCore {
-RefPtr<DOMStringList> JSDOMStringList::toWrapped(ExecState* exec, JSValue value)
+RefPtr<DOMStringList> JSDOMStringList::toWrapped(ExecState& state, JSValue value)
{
if (value.inherits(JSDOMStringList::info()))
return &jsCast<JSDOMStringList*>(asObject(value))->wrapped();
JSArray* array = asArray(value);
RefPtr<DOMStringList> stringList = DOMStringList::create();
for (unsigned i = 0; i < array->length(); ++i)
- stringList->append(array->getIndex(exec, i).toString(exec)->value(exec));
+ stringList->append(array->getIndex(&state, i).toString(&state)->value(&state));
return stringList;
}
return jsNumber(result);
}
-DOMWindow* JSDOMWindow::toWrapped(JSValue value)
+DOMWindow* JSDOMWindow::toWrapped(ExecState&, JSValue value)
{
if (!value.isObject())
- return 0;
+ return nullptr;
JSObject* object = asObject(value);
if (object->inherits(JSDOMWindow::info()))
return &jsCast<JSDOMWindow*>(object)->wrapped();
if (object->inherits(JSDOMWindowShell::info()))
return &jsCast<JSDOMWindowShell*>(object)->wrapped();
- return 0;
+ return nullptr;
}
} // namespace WebCore
result = SerializedScriptValue::create(exec, value, 0, 0);
}
-void JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<DOMWindow>& result)
+void JSDictionary::convertValue(ExecState* state, JSValue value, RefPtr<DOMWindow>& result)
{
- result = JSDOMWindow::toWrapped(value);
+ result = JSDOMWindow::toWrapped(*state, value);
}
-void JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<EventTarget>& result)
+void JSDictionary::convertValue(ExecState* state, JSValue value, RefPtr<EventTarget>& result)
{
- result = JSEventTarget::toWrapped(value);
+ result = JSEventTarget::toWrapped(*state, value);
}
void JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<Node>& result)
if (value.inherits(JS##interfaceName::info())) \
return &jsCast<JS##interfaceName*>(asObject(value))->wrapped();
-EventTarget* JSEventTarget::toWrapped(JSC::JSValue value)
+EventTarget* JSEventTarget::toWrapped(ExecState&, JSValue value)
{
TRY_TO_UNWRAP_WITH_INTERFACE(DOMWindowShell)
TRY_TO_UNWRAP_WITH_INTERFACE(DOMWindow)
#undef TRY_TO_UNWRAP_WITH_INTERFACE
-std::unique_ptr<JSEventTargetWrapper> jsEventTargetCast(JSC::JSValue thisValue)
+std::unique_ptr<JSEventTargetWrapper> jsEventTargetCast(JSValue thisValue)
{
- if (auto* target = JSC::jsDynamicCast<JSEventTarget*>(thisValue))
+ if (auto* target = jsDynamicCast<JSEventTarget*>(thisValue))
return std::make_unique<JSEventTargetWrapper>(target->wrapped(), *target);
if (auto* window = toJSDOMWindow(thisValue))
return std::make_unique<JSEventTargetWrapper>(window->wrapped(), *window);
Vector<String> scope;
JSValue scopeArg(exec.argument(0));
- auto domStringList = JSDOMStringList::toWrapped(&exec, scopeArg);
+ auto domStringList = JSDOMStringList::toWrapped(exec, scopeArg);
if (exec.hadException())
return jsUndefined();
bool cancelableArg = state.argument(2).toBoolean(&state);
const String originArg = state.argument(4).toString(&state)->value(&state);
const String lastEventIdArg = state.argument(5).toString(&state)->value(&state);
- DOMWindow* sourceArg = JSDOMWindow::toWrapped(state.argument(6));
+ DOMWindow* sourceArg = JSDOMWindow::toWrapped(state, state.argument(6));
std::unique_ptr<MessagePortArray> messagePorts;
std::unique_ptr<ArrayBufferArray> arrayBuffers;
if (!state.argument(7).isUndefinedOrNull()) {
--- /dev/null
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSXPathNSResolver.h"
+
+#include "JSCustomXPathNSResolver.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+RefPtr<XPathNSResolver> JSXPathNSResolver::toWrapped(ExecState& state, JSValue value)
+{
+ if (value.inherits(JSXPathNSResolver::info()))
+ return &jsCast<JSXPathNSResolver*>(asObject(value))->wrapped();
+
+ return JSCustomXPathNSResolver::create(&state, value);
+}
+
+} // namespace WebCore
return if $codeGenerator->SkipIncludeHeader($type);
# When we're finished with the one-file-per-class reorganization, we won't need these special cases.
- if ($type eq "XPathNSResolver") {
- $includesRef->{"JSXPathNSResolver.h"} = 1;
- $includesRef->{"JSCustomXPathNSResolver.h"} = 1;
- } elsif ($isCallback && $codeGenerator->IsWrapperType($type)) {
+ if ($isCallback && $codeGenerator->IsWrapperType($type)) {
$includesRef->{"JS${type}.h"} = 1;
} elsif ($codeGenerator->GetArrayOrSequenceType($type)) {
my $arrayType = $codeGenerator->GetArrayType($type);
# JSValue to implementation type
if (ShouldGenerateToWrapped($hasParent, $interface)) {
- if ($interfaceName eq "NodeFilter") {
- push(@headerContent, " static RefPtr<NodeFilter> toWrapped(JSC::VM&, JSC::JSValue);\n");
- } elsif ($interfaceName eq "DOMStringList") {
- push(@headerContent, " static RefPtr<DOMStringList> toWrapped(JSC::ExecState*, JSC::JSValue);\n");
+ my $nativeType = GetNativeType($interface, $implType);
+ if ($interface->extendedAttributes->{"JSCustomToNativeObject"}) {
+ push(@headerContent, " static $nativeType toWrapped(JSC::ExecState&, JSC::JSValue);\n");
} else {
- push(@headerContent, " static $implType* toWrapped(JSC::JSValue);\n");
+ push(@headerContent, " static $nativeType toWrapped(JSC::JSValue);\n");
}
}
my $name = $parameter->name;
my $value = $name;
- if ($argType eq "XPathNSResolver") {
- push(@$outputArray, " RefPtr<XPathNSResolver> customResolver;\n");
- push(@$outputArray, " XPathNSResolver* resolver = JSXPathNSResolver::toWrapped(state->argument($argsIndex));\n");
- push(@$outputArray, " if (!resolver) {\n");
- push(@$outputArray, " customResolver = JSCustomXPathNSResolver::create(state, state->argument($argsIndex));\n");
- push(@$outputArray, " if (UNLIKELY(state->hadException()))\n");
- push(@$outputArray, " return JSValue::encode(jsUndefined());\n");
- push(@$outputArray, " resolver = customResolver.get();\n");
- push(@$outputArray, " }\n");
- } elsif ($codeGenerator->IsCallbackInterface($argType)) {
+ if ($codeGenerator->IsCallbackInterface($argType)) {
my $callbackClassName = GetCallbackClassName($argType);
$implIncludes{"$callbackClassName.h"} = 1;
if ($parameter->isOptional) {
"DOMTimeStamp" => "DOMTimeStamp",
"Date" => "double",
"Dictionary" => "Dictionary",
- "NodeFilter" => "RefPtr<NodeFilter>",
"SerializedScriptValue" => "RefPtr<SerializedScriptValue>",
+ "XPathNSResolver" => "RefPtr<XPathNSResolver>",
"any" => "JSC::JSValue",
"boolean" => "bool",
"byte" => "int8_t",
AddToImplIncludes("JS$type.h", $conditional);
- return ("toDOMStringList(state, $value)", 1) if $type eq "DOMStringList";
- return ("JSNodeFilter::toWrapped(state->vm(), $value)", 1) if $type eq "NodeFilter";
-
+ my $extendedAttributes = $codeGenerator->getInterfaceExtendedAttributesFromName($type);
+ return ("JS${type}::toWrapped(*state, $value)", 1) if $extendedAttributes->{"JSCustomToNativeObject"};
return ("JS${type}::toWrapped($value)", 0);
}
#include "WebKitDOMTestEnumTypePrivate.h"
#include "WebKitDOMTestNodePrivate.h"
#include "WebKitDOMTestObjPrivate.h"
+#include "WebKitDOMXPathNSResolverPrivate.h"
#include "gobject/ConvertToUTF8String.h"
#include <wtf/GetPtr.h>
#include <wtf/RefPtr.h>
item->methodWithArgTreatingNullAsEmptyString(convertedArg);
}
+void webkit_dom_test_obj_method_with_xpath_ns_resolver_parameter(WebKitDOMTestObj* self, WebKitDOMXPathNSResolver* resolver)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self));
+ g_return_if_fail(WEBKIT_DOM_IS_XPATH_NS_RESOLVER(resolver));
+ WebCore::TestObj* item = WebKit::core(self);
+ RefPtr<WebCore::XPathNSResolver> convertedResolver = WebKit::core(resolver);
+ item->methodWithXPathNSResolverParameter(WTF::getPtr(*convertedResolver));
+}
+
gchar* webkit_dom_test_obj_nullable_string_method(WebKitDOMTestObj* self)
{
WebCore::JSMainThreadNullState state;
item->methodWithOptionalNullableWrapperIsNull(convertedObj);
}
+void webkit_dom_test_obj_method_with_optional_xpath_ns_resolver(WebKitDOMTestObj* self, WebKitDOMXPathNSResolver* resolver)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self));
+ g_return_if_fail(WEBKIT_DOM_IS_XPATH_NS_RESOLVER(resolver));
+ WebCore::TestObj* item = WebKit::core(self);
+ RefPtr<WebCore::XPathNSResolver> convertedResolver = WebKit::core(resolver);
+ item->methodWithOptionalXPathNSResolver(WTF::getPtr(convertedResolver));
+}
+
gchar* webkit_dom_test_obj_conditional_method1(WebKitDOMTestObj* self)
{
#if ENABLE(Condition1)
webkit_dom_test_obj_method_with_arg_treating_null_as_empty_string(WebKitDOMTestObj* self, const gchar* arg);
/**
+ * webkit_dom_test_obj_method_with_xpath_ns_resolver_parameter:
+ * @self: A #WebKitDOMTestObj
+ * @resolver: A #WebKitDOMXPathNSResolver
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_obj_method_with_xpath_ns_resolver_parameter(WebKitDOMTestObj* self, WebKitDOMXPathNSResolver* resolver);
+
+/**
* webkit_dom_test_obj_nullable_string_method:
* @self: A #WebKitDOMTestObj
*
webkit_dom_test_obj_method_with_optional_nullable_wrapper_is_null(WebKitDOMTestObj* self, WebKitDOMTestObj* obj);
/**
+ * webkit_dom_test_obj_method_with_optional_xpath_ns_resolver:
+ * @self: A #WebKitDOMTestObj
+ * @resolver: A #WebKitDOMXPathNSResolver
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_obj_method_with_optional_xpath_ns_resolver(WebKitDOMTestObj* self, WebKitDOMXPathNSResolver* resolver);
+
+/**
* webkit_dom_test_obj_conditional_method1:
* @self: A #WebKitDOMTestObj
*
#include "JSTestNode.h"
#include "JSTestObj.h"
#include "JSTestSubObj.h"
+#include "JSXPathNSResolver.h"
#include "LifecycleCallbackQueue.h"
#include "RuntimeEnabledFeatures.h"
#include "SVGDocument.h"
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjInstanceFunctionUnforgeableMethod(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithArgTreatingNullAsEmptyString(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithXPathNSResolverParameter(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionNullableStringMethod(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionNullableStringStaticMethod(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionNullableStringSpecialMethod(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalAny(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapper(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapperIsNull(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalXPathNSResolver(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg(JSC::ExecState*);
{ "objMethod", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionObjMethod), (intptr_t) (0) } },
{ "objMethodWithArgs", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionObjMethodWithArgs), (intptr_t) (3) } },
{ "methodWithArgTreatingNullAsEmptyString", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithArgTreatingNullAsEmptyString), (intptr_t) (1) } },
+ { "methodWithXPathNSResolverParameter", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithXPathNSResolverParameter), (intptr_t) (1) } },
{ "nullableStringMethod", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionNullableStringMethod), (intptr_t) (0) } },
{ "nullableStringSpecialMethod", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionNullableStringSpecialMethod), (intptr_t) (1) } },
{ "methodWithSequenceArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithSequenceArg), (intptr_t) (1) } },
{ "methodWithOptionalAny", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalAny), (intptr_t) (0) } },
{ "methodWithOptionalNullableWrapper", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapper), (intptr_t) (0) } },
{ "methodWithOptionalNullableWrapperIsNull", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapperIsNull), (intptr_t) (0) } },
+ { "methodWithOptionalXPathNSResolver", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalXPathNSResolver), (intptr_t) (0) } },
{ "methodWithCallbackArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithCallbackArg), (intptr_t) (1) } },
{ "methodWithNonCallbackArgAndCallbackArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg), (intptr_t) (2) } },
{ "methodWithCallbackAndOptionalArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg), (intptr_t) (0) } },
return JSValue::encode(jsUndefined());
}
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithXPathNSResolverParameter(ExecState* state)
+{
+ JSValue thisValue = state->thisValue();
+ auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+ if (UNLIKELY(!castedThis))
+ return throwThisTypeError(*state, "TestObj", "methodWithXPathNSResolverParameter");
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+ auto& impl = castedThis->wrapped();
+ if (UNLIKELY(state->argumentCount() < 1))
+ return throwVMError(state, createNotEnoughArgumentsError(state));
+ auto resolver = JSXPathNSResolver::toWrapped(*state, state->argument(0));
+ if (UNLIKELY(state->hadException()))
+ return JSValue::encode(jsUndefined());
+ if (UNLIKELY(!resolver))
+ return throwVMTypeError(state);
+ impl.methodWithXPathNSResolverParameter(*resolver);
+ return JSValue::encode(jsUndefined());
+}
+
EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionNullableStringMethod(ExecState* state)
{
JSValue thisValue = state->thisValue();
return JSValue::encode(jsUndefined());
}
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalXPathNSResolver(ExecState* state)
+{
+ JSValue thisValue = state->thisValue();
+ auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+ if (UNLIKELY(!castedThis))
+ return throwThisTypeError(*state, "TestObj", "methodWithOptionalXPathNSResolver");
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+ auto& impl = castedThis->wrapped();
+ auto resolver = JSXPathNSResolver::toWrapped(*state, state->argument(0));
+ if (UNLIKELY(state->hadException()))
+ return JSValue::encode(jsUndefined());
+ impl.methodWithOptionalXPathNSResolver(WTFMove(resolver));
+ return JSValue::encode(jsUndefined());
+}
+
EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(ExecState* state)
{
JSValue thisValue = state->thisValue();
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto listArg = toDOMStringList(state, state->argument(0));
+ auto listArg = JSDOMStringList::toWrapped(*state, state->argument(0));
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.overloadedMethod(WTFMove(listArg));
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
ExceptionCode ec = 0;
- auto values = toDOMStringList(state, state->argument(0));
+ auto values = JSDOMStringList::toWrapped(*state, state->argument(0));
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
if (UNLIKELY(!values))
@class DOMany;
@class NSString;
@protocol DOMEventListener;
+@protocol DOMXPathNSResolver;
enum {
DOM_CONST_VALUE_0 = 0,
- (DOMTestObj *)objMethodWithArgs:(int)longArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg;
- (int)unforgeableMethod;
- (void)methodWithArgTreatingNullAsEmptyString:(NSString *)arg;
+- (void)methodWithXPathNSResolverParameter:(id <DOMXPathNSResolver>)resolver;
- (NSString *)nullableStringMethod;
- (NSString *)nullableStringStaticMethod;
- (NSString *)nullableStringSpecialMethod:(unsigned)index;
- (void)methodWithOptionalAny:(DOMany *)a;
- (void)methodWithOptionalNullableWrapper:(DOMTestObj *)obj;
- (void)methodWithOptionalNullableWrapperIsNull:(DOMTestObj *)obj;
+- (void)methodWithOptionalXPathNSResolver:(id <DOMXPathNSResolver>)resolver;
- (void)classMethod;
- (int)classMethodWithOptional:(int)arg;
- (void)classMethod2:(int)arg;
#import "DOMTestObj.h"
+#import "DOMCustomXPathNSResolver.h"
#import "DOMDictionaryInternal.h"
#import "DOMDocumentInternal.h"
#import "DOMNodeInternal.h"
#import "URL.h"
#import "WebCoreObjCExtras.h"
#import "WebScriptObjectPrivate.h"
+#import "XPathNSResolver.h"
#import <wtf/GetPtr.h>
#define IMPL reinterpret_cast<WebCore::TestObj*>(_internal)
IMPL->methodWithArgTreatingNullAsEmptyString(arg);
}
+- (void)methodWithXPathNSResolverParameter:(id <DOMXPathNSResolver>)resolver
+{
+ WebCore::JSMainThreadNullState state;
+ if (!resolver)
+ WebCore::raiseTypeErrorException();
+ WebCore::XPathNSResolver* nativeResolver = 0;
+ RefPtr<WebCore::XPathNSResolver> customResolver;
+ if (resolver) {
+ if ([resolver isMemberOfClass:[DOMNativeXPathNSResolver class]])
+ nativeResolver = core(static_cast<DOMNativeXPathNSResolver *>(resolver));
+ else {
+ customResolver = WebCore::DOMCustomXPathNSResolver::create(resolver);
+ nativeResolver = WTF::getPtr(customResolver);
+ }
+ }
+ IMPL->methodWithXPathNSResolverParameter(*WTF::getPtr(nativeResolver));
+}
+
- (NSString *)nullableStringMethod
{
WebCore::JSMainThreadNullState state;
IMPL->methodWithOptionalNullableWrapperIsNull(core(obj));
}
+- (void)methodWithOptionalXPathNSResolver:(id <DOMXPathNSResolver>)resolver
+{
+ WebCore::JSMainThreadNullState state;
+ WebCore::XPathNSResolver* nativeResolver = 0;
+ RefPtr<WebCore::XPathNSResolver> customResolver;
+ if (resolver) {
+ if ([resolver isMemberOfClass:[DOMNativeXPathNSResolver class]])
+ nativeResolver = core(static_cast<DOMNativeXPathNSResolver *>(resolver));
+ else {
+ customResolver = WebCore::DOMCustomXPathNSResolver::create(resolver);
+ nativeResolver = WTF::getPtr(customResolver);
+ }
+ }
+ IMPL->methodWithOptionalXPathNSResolver(WTF::getPtr(nativeResolver));
+}
+
#if ENABLE(Condition1)
- (NSString *)conditionalMethod1
TestObj objMethodWithArgs(long longArg, DOMString strArg, TestObj objArg);
[Unforgeable] long unforgeableMethod();
void methodWithArgTreatingNullAsEmptyString([TreatNullAs=EmptyString] DOMString arg);
+ void methodWithXPathNSResolverParameter(XPathNSResolver resolver);
// Nullable String return values.
DOMString? nullableStringMethod();
void methodWithOptionalAny(optional any a);
void methodWithOptionalNullableWrapper(optional TestObj? obj);
void methodWithOptionalNullableWrapperIsNull(optional TestObj? obj = null);
+ void methodWithOptionalXPathNSResolver(optional XPathNSResolver? resolver);
#if defined(TESTING_JS)
// Callback interface parameters.
}
#endif
-RefPtr<XPathExpression> Document::createExpression(const String& expression,
- XPathNSResolver* resolver,
- ExceptionCode& ec)
+RefPtr<XPathExpression> Document::createExpression(const String& expression, RefPtr<XPathNSResolver>&& resolver, ExceptionCode& ec)
{
if (!m_xpathEvaluator)
m_xpathEvaluator = XPathEvaluator::create();
- return m_xpathEvaluator->createExpression(expression, resolver, ec);
+ return m_xpathEvaluator->createExpression(expression, WTFMove(resolver), ec);
}
RefPtr<XPathNSResolver> Document::createNSResolver(Node* nodeResolver)
return m_xpathEvaluator->createNSResolver(nodeResolver);
}
-RefPtr<XPathResult> Document::evaluate(const String& expression, Node* contextNode, XPathNSResolver* resolver, unsigned short type, XPathResult* result, ExceptionCode& ec)
+RefPtr<XPathResult> Document::evaluate(const String& expression, Node* contextNode, RefPtr<XPathNSResolver>&& resolver, unsigned short type, XPathResult* result, ExceptionCode& ec)
{
if (!m_xpathEvaluator)
m_xpathEvaluator = XPathEvaluator::create();
- return m_xpathEvaluator->evaluate(expression, contextNode, resolver, type, result, ec);
+ return m_xpathEvaluator->evaluate(expression, contextNode, WTFMove(resolver), type, result, ec);
}
void Document::initSecurityContext()
uint64_t domTreeVersion() const { return m_domTreeVersion; }
// XPathEvaluator methods
- RefPtr<XPathExpression> createExpression(const String& expression, XPathNSResolver*, ExceptionCode&);
+ RefPtr<XPathExpression> createExpression(const String& expression, RefPtr<XPathNSResolver>&&, ExceptionCode&);
RefPtr<XPathNSResolver> createNSResolver(Node* nodeResolver);
- RefPtr<XPathResult> evaluate(const String& expression, Node* contextNode, XPathNSResolver*, unsigned short type, XPathResult*, ExceptionCode&);
+ RefPtr<XPathResult> evaluate(const String& expression, Node* contextNode, RefPtr<XPathNSResolver>&&, unsigned short type, XPathResult*, ExceptionCode&);
enum PendingSheetLayout { NoLayoutWithPendingSheets, DidLayoutWithPendingSheets, IgnoreLayoutWithPendingSheets };
// DOM Level 3 XPath (XPathEvaluator interface)
// FIXME: Using "undefined" as default parameter value is wrong.
- [ObjCLegacyUnnamedParameters, RaisesException] XPathExpression createExpression(optional DOMString expression = "undefined",
- optional XPathNSResolver? resolver = null);
- XPathNSResolver createNSResolver(Node? nodeResolver);
+ [ObjCLegacyUnnamedParameters, RaisesException] XPathExpression createExpression(optional DOMString expression = "undefined", optional XPathNSResolver? resolver);
+ XPathNSResolver createNSResolver(Node? nodeResolver);
// FIXME: Using "undefined" as default parameter value is wrong.
[ObjCLegacyUnnamedParameters, RaisesException] XPathResult evaluate(optional DOMString expression = "undefined",
- optional Node? contextNode = null,
- optional XPathNSResolver? resolver = null,
+ optional Node? contextNode,
+ optional XPathNSResolver? resolver,
optional unsigned short type = 0,
- optional XPathResult? inResult = null);
+ optional XPathResult? inResult);
// Common extensions
// FIXME: Using "undefined" as default parameter value is wrong.
#include "HTMLFrameOwnerElement.h"
#include "NodeList.h"
#include "NodeTraversal.h"
+#include "XPathNSResolver.h"
#include "XPathResult.h"
namespace WebCore {
using namespace XPath;
-RefPtr<XPathExpression> XPathEvaluator::createExpression(const String& expression,
- XPathNSResolver* resolver,
- ExceptionCode& ec)
+RefPtr<XPathExpression> XPathEvaluator::createExpression(const String& expression, RefPtr<XPathNSResolver>&& resolver, ExceptionCode& ec)
{
- return XPathExpression::createExpression(expression, resolver, ec);
+ return XPathExpression::createExpression(expression, WTFMove(resolver), ec);
}
Ref<XPathNSResolver> XPathEvaluator::createNSResolver(Node* nodeResolver)
return NativeXPathNSResolver::create(nodeResolver);
}
-RefPtr<XPathResult> XPathEvaluator::evaluate(const String& expression,
- Node* contextNode,
- XPathNSResolver* resolver,
- unsigned short type,
- XPathResult* result,
- ExceptionCode& ec)
+RefPtr<XPathResult> XPathEvaluator::evaluate(const String& expression, Node* contextNode, RefPtr<XPathNSResolver>&& resolver, unsigned short type, XPathResult* result, ExceptionCode& ec)
{
if (!isValidContextNode(contextNode)) {
ec = NOT_SUPPORTED_ERR;
}
ec = 0;
- RefPtr<XPathExpression> expr = createExpression(expression, resolver, ec);
+ RefPtr<XPathExpression> expr = createExpression(expression, WTFMove(resolver), ec);
if (ec)
return nullptr;
public:
static Ref<XPathEvaluator> create() { return adoptRef(*new XPathEvaluator); }
- RefPtr<XPathExpression> createExpression(const String& expression, XPathNSResolver*, ExceptionCode&);
+ RefPtr<XPathExpression> createExpression(const String& expression, RefPtr<XPathNSResolver>&&, ExceptionCode&);
Ref<XPathNSResolver> createNSResolver(Node* nodeResolver);
RefPtr<XPathResult> evaluate(const String& expression, Node* contextNode,
- XPathNSResolver*, unsigned short type, XPathResult*, ExceptionCode&);
+ RefPtr<XPathNSResolver>&&, unsigned short type, XPathResult*, ExceptionCode&);
private:
XPathEvaluator() { }
ImplementationLacksVTable,
] interface XPathEvaluator {
// FIXME: Using "undefined" as default parameter value is wrong.
- [RaisesException] XPathExpression createExpression(optional DOMString expression = "undefined",
- optional XPathNSResolver? resolver = null);
+ [RaisesException] XPathExpression createExpression(optional DOMString expression = "undefined", optional XPathNSResolver? resolver);
- XPathNSResolver createNSResolver(optional Node? nodeResolver = null);
+ XPathNSResolver createNSResolver(optional Node? nodeResolver);
// FIXME: Using "undefined" as default parameter value is wrong.
[RaisesException] XPathResult evaluate(optional DOMString expression = "undefined",
- optional Node? contextNode = null,
- optional XPathNSResolver? resolver = null,
+ optional Node? contextNode,
+ optional XPathNSResolver? resolver,
optional unsigned short type = 0,
- optional XPathResult? inResult = null);
+ optional XPathResult? inResult);
};
{
}
-RefPtr<XPathExpression> XPathExpression::createExpression(const String& expression, XPathNSResolver* resolver, ExceptionCode& ec)
+RefPtr<XPathExpression> XPathExpression::createExpression(const String& expression, RefPtr<XPathNSResolver>&& resolver, ExceptionCode& ec)
{
- auto parsedExpression = Parser::parseStatement(expression, resolver, ec);
+ auto parsedExpression = Parser::parseStatement(expression, WTFMove(resolver), ec);
if (!parsedExpression)
return nullptr;
class XPathExpression : public RefCounted<XPathExpression> {
public:
- static RefPtr<XPathExpression> createExpression(const String& expression, XPathNSResolver*, ExceptionCode&);
+ static RefPtr<XPathExpression> createExpression(const String& expression, RefPtr<XPathNSResolver>&&, ExceptionCode&);
~XPathExpression();
RefPtr<XPathResult> evaluate(Node* contextNode, unsigned short type, XPathResult*, ExceptionCode&);
*/
[
+ JSCustomToNativeObject,
NoInterfaceObject,
ObjCProtocol,
SkipVTableValidation,
return token;
}
-Parser::Parser(const String& statement, XPathNSResolver* resolver)
+Parser::Parser(const String& statement, RefPtr<XPathNSResolver>&& resolver)
: m_data(statement)
- , m_resolver(resolver)
+ , m_resolver(WTFMove(resolver))
, m_nextPos(0)
, m_lastTokenType(0)
, m_sawNamespaceError(false)
return true;
}
-std::unique_ptr<Expression> Parser::parseStatement(const String& statement, XPathNSResolver* resolver, ExceptionCode& ec)
+std::unique_ptr<Expression> Parser::parseStatement(const String& statement, RefPtr<XPathNSResolver>&& resolver, ExceptionCode& ec)
{
- Parser parser(statement, resolver);
+ Parser parser(statement, WTFMove(resolver));
int parseError = xpathyyparse(parser);
class Parser {
WTF_MAKE_NONCOPYABLE(Parser);
public:
- static std::unique_ptr<Expression> parseStatement(const String& statement, XPathNSResolver*, ExceptionCode&);
+ static std::unique_ptr<Expression> parseStatement(const String& statement, RefPtr<XPathNSResolver>&&, ExceptionCode&);
int lex(YYSTYPE&);
bool expandQualifiedName(const String& qualifiedName, String& localName, String& namespaceURI);
void setParseResult(std::unique_ptr<Expression> expression) { m_result = WTFMove(expression); }
private:
- Parser(const String&, XPathNSResolver*);
+ Parser(const String&, RefPtr<XPathNSResolver>&&);
struct Token;
Token nextTokenInternal();
const String& m_data;
- XPathNSResolver* m_resolver;
+ RefPtr<XPathNSResolver> m_resolver;
unsigned m_nextPos;
int m_lastTokenType;