Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (200549 => 200550)
--- trunk/Source/WebCore/CMakeLists.txt 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/CMakeLists.txt 2016-05-08 04:39:13 UTC (rev 200550)
@@ -1224,6 +1224,7 @@
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
Modified: trunk/Source/WebCore/ChangeLog (200549 => 200550)
--- trunk/Source/WebCore/ChangeLog 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/ChangeLog 2016-05-08 04:39:13 UTC (rev 200550)
@@ -1,3 +1,119 @@
+2016-05-07 Chris Dumez <[email protected]>
+
+ 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 <[email protected]>
Fix crash introduced by the last patch.
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (200549 => 200550)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-05-08 04:39:13 UTC (rev 200550)
@@ -2873,6 +2873,7 @@
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 */; };
@@ -10545,6 +10546,7 @@
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>"; };
@@ -22342,6 +22344,7 @@
418C395D1C8F0AAB0051C8A3 /* JSReadableStreamSourceCustom.cpp */,
E1C36D320EB0A094007410BC /* JSWorkerGlobalScopeBase.cpp */,
E1C36D330EB0A094007410BC /* JSWorkerGlobalScopeBase.h */,
+ 836C14421CDEAFCA0073493F /* JSXPathNSResolverCustom.cpp */,
418C395E1C8F0AAB0051C8A3 /* ReadableStreamController.cpp */,
418C395F1C8F0AAB0051C8A3 /* ReadableStreamController.h */,
BCA378BA0D15F64200B793D6 /* ScheduledAction.cpp */,
@@ -30094,6 +30097,7 @@
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 */,
Modified: trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp (200549 => 200550)
--- trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp 2016-05-08 04:39:13 UTC (rev 200550)
@@ -138,6 +138,7 @@
#include "JSWorkerGlobalScopeBase.cpp"
#include "JSWorkerGlobalScopeCustom.cpp"
#include "JSXMLHttpRequestCustom.cpp"
+#include "JSXPathNSResolverCustom.cpp"
#include "JSXPathResultCustom.cpp"
#include "JSXSLTProcessorCustom.cpp"
#include "ScheduledAction.cpp"
Modified: trunk/Source/WebCore/bindings/js/JSDOMStringListCustom.cpp (200549 => 200550)
--- trunk/Source/WebCore/bindings/js/JSDOMStringListCustom.cpp 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/bindings/js/JSDOMStringListCustom.cpp 2016-05-08 04:39:13 UTC (rev 200550)
@@ -26,7 +26,7 @@
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();
@@ -37,7 +37,7 @@
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;
}
Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp (200549 => 200550)
--- trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp 2016-05-08 04:39:13 UTC (rev 200550)
@@ -612,16 +612,16 @@
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
Modified: trunk/Source/WebCore/bindings/js/JSDictionary.cpp (200549 => 200550)
--- trunk/Source/WebCore/bindings/js/JSDictionary.cpp 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/bindings/js/JSDictionary.cpp 2016-05-08 04:39:13 UTC (rev 200550)
@@ -173,14 +173,14 @@
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)
Modified: trunk/Source/WebCore/bindings/js/JSEventTargetCustom.cpp (200549 => 200550)
--- trunk/Source/WebCore/bindings/js/JSEventTargetCustom.cpp 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/bindings/js/JSEventTargetCustom.cpp 2016-05-08 04:39:13 UTC (rev 200550)
@@ -63,7 +63,7 @@
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)
@@ -74,9 +74,9 @@
#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);
Modified: trunk/Source/WebCore/bindings/js/JSIDBDatabaseCustom.cpp (200549 => 200550)
--- trunk/Source/WebCore/bindings/js/JSIDBDatabaseCustom.cpp 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/bindings/js/JSIDBDatabaseCustom.cpp 2016-05-08 04:39:13 UTC (rev 200550)
@@ -94,7 +94,7 @@
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();
Modified: trunk/Source/WebCore/bindings/js/JSMessageEventCustom.cpp (200549 => 200550)
--- trunk/Source/WebCore/bindings/js/JSMessageEventCustom.cpp 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/bindings/js/JSMessageEventCustom.cpp 2016-05-08 04:39:13 UTC (rev 200550)
@@ -109,7 +109,7 @@
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()) {
Added: trunk/Source/WebCore/bindings/js/JSXPathNSResolverCustom.cpp (0 => 200550)
--- trunk/Source/WebCore/bindings/js/JSXPathNSResolverCustom.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSXPathNSResolverCustom.cpp 2016-05-08 04:39:13 UTC (rev 200550)
@@ -0,0 +1,43 @@
+/*
+ * 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
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (200549 => 200550)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-05-08 04:39:13 UTC (rev 200550)
@@ -220,10 +220,7 @@
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);
@@ -1115,12 +1112,11 @@
# 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");
}
}
@@ -3623,16 +3619,7 @@
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) {
@@ -4242,8 +4229,8 @@
"DOMTimeStamp" => "DOMTimeStamp",
"Date" => "double",
"Dictionary" => "Dictionary",
- "NodeFilter" => "RefPtr<NodeFilter>",
"SerializedScriptValue" => "RefPtr<SerializedScriptValue>",
+ "XPathNSResolver" => "RefPtr<XPathNSResolver>",
"any" => "JSC::JSValue",
"boolean" => "bool",
"byte" => "int8_t",
@@ -4433,9 +4420,8 @@
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);
}
Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp (200549 => 200550)
--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp 2016-05-08 04:39:13 UTC (rev 200550)
@@ -38,6 +38,7 @@
#include "WebKitDOMTestEnumTypePrivate.h"
#include "WebKitDOMTestNodePrivate.h"
#include "WebKitDOMTestObjPrivate.h"
+#include "WebKitDOMXPathNSResolverPrivate.h"
#include "gobject/ConvertToUTF8String.h"
#include <wtf/GetPtr.h>
#include <wtf/RefPtr.h>
@@ -1374,6 +1375,16 @@
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;
@@ -1804,6 +1815,16 @@
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)
Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h (200549 => 200550)
--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h 2016-05-08 04:39:13 UTC (rev 200550)
@@ -277,6 +277,16 @@
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
*
@@ -729,6 +739,16 @@
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
*
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (200549 => 200550)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-05-08 04:39:13 UTC (rev 200550)
@@ -46,6 +46,7 @@
#include "JSTestNode.h"
#include "JSTestObj.h"
#include "JSTestSubObj.h"
+#include "JSXPathNSResolver.h"
#include "LifecycleCallbackQueue.h"
#include "RuntimeEnabledFeatures.h"
#include "SVGDocument.h"
@@ -527,6 +528,7 @@
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*);
@@ -581,6 +583,7 @@
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*);
@@ -1096,6 +1099,7 @@
{ "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) } },
@@ -1158,6 +1162,7 @@
{ "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) } },
@@ -4072,6 +4077,25 @@
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();
@@ -4904,6 +4928,21 @@
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();
@@ -5179,7 +5218,7 @@
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));
@@ -5528,7 +5567,7 @@
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))
Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h (200549 => 200550)
--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h 2016-05-08 04:39:13 UTC (rev 200550)
@@ -42,6 +42,7 @@
@class DOMany;
@class NSString;
@protocol DOMEventListener;
+@protocol DOMXPathNSResolver;
enum {
DOM_CONST_VALUE_0 = 0,
@@ -149,6 +150,7 @@
- (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;
@@ -197,6 +199,7 @@
- (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;
Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm (200549 => 200550)
--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm 2016-05-08 04:39:13 UTC (rev 200550)
@@ -29,6 +29,7 @@
#import "DOMTestObj.h"
+#import "DOMCustomXPathNSResolver.h"
#import "DOMDictionaryInternal.h"
#import "DOMDocumentInternal.h"
#import "DOMNodeInternal.h"
@@ -66,6 +67,7 @@
#import "URL.h"
#import "WebCoreObjCExtras.h"
#import "WebScriptObjectPrivate.h"
+#import "XPathNSResolver.h"
#import <wtf/GetPtr.h>
#define IMPL reinterpret_cast<WebCore::TestObj*>(_internal)
@@ -1110,6 +1112,24 @@
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;
@@ -1443,7 +1463,23 @@
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
{
Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (200549 => 200550)
--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2016-05-08 04:39:13 UTC (rev 200550)
@@ -110,6 +110,7 @@
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();
@@ -208,6 +209,7 @@
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.
Modified: trunk/Source/WebCore/dom/Document.cpp (200549 => 200550)
--- trunk/Source/WebCore/dom/Document.cpp 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/dom/Document.cpp 2016-05-08 04:39:13 UTC (rev 200550)
@@ -5081,13 +5081,11 @@
}
#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)
@@ -5097,11 +5095,11 @@
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()
Modified: trunk/Source/WebCore/dom/Document.h (200549 => 200550)
--- trunk/Source/WebCore/dom/Document.h 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/dom/Document.h 2016-05-08 04:39:13 UTC (rev 200550)
@@ -952,9 +952,9 @@
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 };
Modified: trunk/Source/WebCore/dom/Document.idl (200549 => 200550)
--- trunk/Source/WebCore/dom/Document.idl 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/dom/Document.idl 2016-05-08 04:39:13 UTC (rev 200550)
@@ -141,16 +141,15 @@
// 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.
Modified: trunk/Source/WebCore/inspector/InspectorNodeFinder.cpp (200549 => 200550)
--- trunk/Source/WebCore/inspector/InspectorNodeFinder.cpp 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/inspector/InspectorNodeFinder.cpp 2016-05-08 04:39:13 UTC (rev 200550)
@@ -38,6 +38,7 @@
#include "HTMLFrameOwnerElement.h"
#include "NodeList.h"
#include "NodeTraversal.h"
+#include "XPathNSResolver.h"
#include "XPathResult.h"
namespace WebCore {
Modified: trunk/Source/WebCore/xml/XPathEvaluator.cpp (200549 => 200550)
--- trunk/Source/WebCore/xml/XPathEvaluator.cpp 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/xml/XPathEvaluator.cpp 2016-05-08 04:39:13 UTC (rev 200550)
@@ -37,11 +37,9 @@
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)
@@ -49,12 +47,7 @@
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;
@@ -62,7 +55,7 @@
}
ec = 0;
- RefPtr<XPathExpression> expr = createExpression(_expression_, resolver, ec);
+ RefPtr<XPathExpression> expr = createExpression(_expression_, WTFMove(resolver), ec);
if (ec)
return nullptr;
Modified: trunk/Source/WebCore/xml/XPathEvaluator.h (200549 => 200550)
--- trunk/Source/WebCore/xml/XPathEvaluator.h 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/xml/XPathEvaluator.h 2016-05-08 04:39:13 UTC (rev 200550)
@@ -44,10 +44,10 @@
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() { }
Modified: trunk/Source/WebCore/xml/XPathEvaluator.idl (200549 => 200550)
--- trunk/Source/WebCore/xml/XPathEvaluator.idl 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/xml/XPathEvaluator.idl 2016-05-08 04:39:13 UTC (rev 200550)
@@ -22,15 +22,14 @@
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);
};
Modified: trunk/Source/WebCore/xml/XPathExpression.cpp (200549 => 200550)
--- trunk/Source/WebCore/xml/XPathExpression.cpp 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/xml/XPathExpression.cpp 2016-05-08 04:39:13 UTC (rev 200550)
@@ -45,9 +45,9 @@
{
}
-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;
Modified: trunk/Source/WebCore/xml/XPathExpression.h (200549 => 200550)
--- trunk/Source/WebCore/xml/XPathExpression.h 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/xml/XPathExpression.h 2016-05-08 04:39:13 UTC (rev 200550)
@@ -44,7 +44,7 @@
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&);
Modified: trunk/Source/WebCore/xml/XPathNSResolver.idl (200549 => 200550)
--- trunk/Source/WebCore/xml/XPathNSResolver.idl 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/xml/XPathNSResolver.idl 2016-05-08 04:39:13 UTC (rev 200550)
@@ -19,6 +19,7 @@
*/
[
+ JSCustomToNativeObject,
NoInterfaceObject,
ObjCProtocol,
SkipVTableValidation,
Modified: trunk/Source/WebCore/xml/XPathParser.cpp (200549 => 200550)
--- trunk/Source/WebCore/xml/XPathParser.cpp 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/xml/XPathParser.cpp 2016-05-08 04:39:13 UTC (rev 200550)
@@ -399,9 +399,9 @@
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)
@@ -456,9 +456,9 @@
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);
Modified: trunk/Source/WebCore/xml/XPathParser.h (200549 => 200550)
--- trunk/Source/WebCore/xml/XPathParser.h 2016-05-07 22:29:01 UTC (rev 200549)
+++ trunk/Source/WebCore/xml/XPathParser.h 2016-05-08 04:39:13 UTC (rev 200550)
@@ -43,14 +43,14 @@
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;
@@ -72,7 +72,7 @@
Token nextTokenInternal();
const String& m_data;
- XPathNSResolver* m_resolver;
+ RefPtr<XPathNSResolver> m_resolver;
unsigned m_nextPos;
int m_lastTokenType;