Diff
Modified: trunk/Source/WebCore/ChangeLog (217133 => 217134)
--- trunk/Source/WebCore/ChangeLog 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/ChangeLog 2017-05-19 18:07:49 UTC (rev 217134)
@@ -1,3 +1,121 @@
+2017-05-18 Sam Weinig <s...@webkit.org>
+
+ [WebIDL] Remove the need for the generator to know about native type mapping
+ https://bugs.webkit.org/show_bug.cgi?id=172310
+
+ Reviewed by Darin Adler.
+
+ Replace the use of explicit typename to native type mappings in CodeGeneratorJS.pm
+ with use of IDLTypes and Converter, which already need the mapping. This allows us
+ to have the information in only one spot.
+
+ Also, callback generation to account for nullability and update the IDLs to correctly
+ annotate only the types that need to be nullable.
+
+ * Modules/geolocation/GeoNotifier.cpp:
+ * Modules/geolocation/GeoNotifier.h:
+ * Modules/geolocation/Geolocation.cpp:
+ * Modules/geolocation/Geolocation.h:
+ * Modules/geolocation/PositionCallback.idl:
+ * Modules/geolocation/PositionErrorCallback.h:
+ Use references where possible in the Geolocation code. It was almost possible
+ to make PositionCallback take a non-nullable position, but some odd logic in
+ Geolocation::makeCachedPositionCallbacks() implies that there is a path where
+ passing null is possible, though it would assert. Added FIXME's to return to
+ this in a follow up.
+
+ * Modules/webaudio/AudioBufferCallback.idl:
+ Add nullable annotation and FIXME explaining that the latest spec splits the callback
+ into two separate ones.
+
+ * Modules/webdatabase/Database.cpp:
+ (WebCore::Database::runTransaction):
+ * Modules/webdatabase/DatabaseCallback.h:
+ * Modules/webdatabase/DatabaseManager.cpp:
+ (WebCore::DatabaseManager::openDatabase):
+ * Modules/webdatabase/SQLStatement.cpp:
+ (WebCore::SQLStatement::performCallback):
+ * Modules/webdatabase/SQLStatementCallback.h:
+ * Modules/webdatabase/SQLStatementErrorCallback.h:
+ * Modules/webdatabase/SQLTransaction.cpp:
+ (WebCore::SQLTransaction::deliverTransactionCallback):
+ (WebCore::SQLTransaction::deliverTransactionErrorCallback):
+ * Modules/webdatabase/SQLTransactionCallback.h:
+ * Modules/webdatabase/SQLTransactionErrorCallback.h:
+ * inspector/InspectorDatabaseAgent.cpp:
+ * bindings/js/JSSQLStatementErrorCallbackCustom.cpp:
+ (WebCore::JSSQLStatementErrorCallback::handleEvent):
+ Update to pass callback parameters as references, since they are never null.
+
+ * bindings/IDLTypes.h:
+ Add NullableParameterType to allow customization of nullable parameters (in much
+ the same way we allow customization of the nullable implementation type).
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateDefaultValue):
+ Use Converter<>::ReturnType{ } for default values rather than ${GetNativeType..}().
+
+ (GenerateHeader):
+ Remove use of GetNativeType for toWrapped by using the impl type, since this will never
+ be a complex type.
+
+ (GenerateImplementation):
+ Simplify DOMJIT UnsafeToNative by merging two identical paths and using auto.
+
+ (GenerateParametersCheck):
+ Rework parameter checks to use more specific variable names, make branches more clear,
+ and use Converter<>::ReturnType rather than GetNativeType.
+
+ (GenerateCallbackHeaderContent):
+ (GenerateCallbackImplementationContent):
+ Switch to using typename ${IDLType}::ParameterType as the parameters for callback functions. Also
+ add final and override to make sure the generated function matches the user provided base class.
+ (GetNativeType): Deleted.
+ (GetNativeInnerType): Deleted.
+ (GetNativeTypeForCallbacks): Deleted.
+ Remove native type mappings.
+
+ * css/MediaQueryListListener.h:
+ * css/MediaQueryListListener.idl:
+ * css/MediaQueryMatcher.cpp:
+ Update MediaQueryListListener to take a non-nullable MediaQueryList.
+
+ * dom/NativeNodeFilter.cpp:
+ * dom/NativeNodeFilter.h:
+ * dom/NodeFilter.h:
+ * dom/NodeFilter.idl:
+ * dom/NodeIterator.cpp:
+ * dom/Traversal.cpp:
+ * dom/Traversal.h:
+ * dom/TreeWalker.cpp:
+ * bindings/js/JSNodeFilterCustom.cpp:
+ Update acceptNode to be non-nullable and pass the Node by reference.
+
+ * dom/StringCallback.cpp:
+ * dom/StringCallback.h:
+ Pass the ScriptExecutionContext by reference.
+
+ * page/IntersectionObserverCallback.h:
+ Update to match new parameter types and pass IntersectionObserver by reference.
+
+ * page/PerformanceObserver.cpp:
+ * page/PerformanceObserverCallback.h:
+ Update to pass PerformanceObserverEntryList and PerformanceObserver by reference.
+
+ * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
+ * bindings/scripts/test/JS/JSTestCallbackFunction.h:
+ * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
+ * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h:
+ * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
+ * bindings/scripts/test/JS/JSTestCallbackInterface.h:
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ * bindings/scripts/test/JS/JSTestTypedefs.cpp:
+ Update test results.
+
+ * bindings/scripts/test/TestCallbackInterface.idl:
+ Update test to refer to actual interfaces as we now do lookup on these parameter
+ types rather than blindly assuming they are interfaces.
+
2017-05-19 Commit Queue <commit-qu...@webkit.org>
Unreviewed, rolling out r217098, r217111, r217113, and
Modified: trunk/Source/WebCore/Modules/geolocation/GeoNotifier.cpp (217133 => 217134)
--- trunk/Source/WebCore/Modules/geolocation/GeoNotifier.cpp 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/Modules/geolocation/GeoNotifier.cpp 2017-05-19 18:07:49 UTC (rev 217134)
@@ -79,7 +79,7 @@
m_successCallback->handleEvent(position);
}
-void GeoNotifier::runErrorCallback(PositionError* error)
+void GeoNotifier::runErrorCallback(PositionError& error)
{
if (m_errorCallback)
m_errorCallback->handleEvent(error);
@@ -106,7 +106,7 @@
// Test for fatal error first. This is required for the case where the Frame is
// disconnected and requests are cancelled.
if (m_fatalError) {
- runErrorCallback(m_fatalError.get());
+ runErrorCallback(*m_fatalError);
// This will cause this notifier to be deleted.
m_geolocation->fatalErrorOccurred(this);
return;
@@ -121,8 +121,8 @@
}
if (m_errorCallback) {
- RefPtr<PositionError> error = PositionError::create(PositionError::TIMEOUT, ASCIILiteral("Timeout expired"));
- m_errorCallback->handleEvent(error.get());
+ auto error = PositionError::create(PositionError::TIMEOUT, ASCIILiteral("Timeout expired"));
+ m_errorCallback->handleEvent(error);
}
m_geolocation->requestTimedOut(this);
}
Modified: trunk/Source/WebCore/Modules/geolocation/GeoNotifier.h (217133 => 217134)
--- trunk/Source/WebCore/Modules/geolocation/GeoNotifier.h 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/Modules/geolocation/GeoNotifier.h 2017-05-19 18:07:49 UTC (rev 217134)
@@ -55,8 +55,8 @@
bool useCachedPosition() const { return m_useCachedPosition; }
void setUseCachedPosition();
- void runSuccessCallback(Geoposition*);
- void runErrorCallback(PositionError*);
+ void runSuccessCallback(Geoposition*); // FIXME: This should take a reference.
+ void runErrorCallback(PositionError&);
void startTimerIfNeeded();
void stopTimer();
Modified: trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp (217133 => 217134)
--- trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp 2017-05-19 18:07:49 UTC (rev 217134)
@@ -232,7 +232,7 @@
}
if (m_errorWaitingForResume) {
- handleError(m_errorWaitingForResume.get());
+ handleError(*m_errorWaitingForResume);
m_errorWaitingForResume = nullptr;
}
}
@@ -435,6 +435,8 @@
// asynchronously, so we don't need to worry about it being modified from
// the callbacks.
for (auto& notifier : m_requestsAwaitingCachedPosition) {
+ // FIXME: This seems wrong, since makeCachedPositionCallbacks() is called in a branch where
+ // lastPosition() is known to be null in Geolocation::setIsAllowed().
notifier->runSuccessCallback(lastPosition());
// If this is a one-shot request, stop it. Otherwise, if the watch still
@@ -506,13 +508,12 @@
}
if (!isAllowed()) {
- RefPtr<PositionError> error = PositionError::create(PositionError::PERMISSION_DENIED, ASCIILiteral(permissionDeniedErrorMessage));
+ auto error = PositionError::create(PositionError::PERMISSION_DENIED, ASCIILiteral(permissionDeniedErrorMessage));
error->setIsFatal(true);
- handleError(error.get());
+ handleError(error);
m_requestsAwaitingCachedPosition.clear();
m_hasChangedPosition = false;
m_errorWaitingForResume = nullptr;
-
return;
}
@@ -519,22 +520,22 @@
// If the service has a last position, use it to call back for all requests.
// If any of the requests are waiting for permission for a cached position,
// the position from the service will be at least as fresh.
- if (lastPosition())
- makeSuccessCallbacks();
+ if (RefPtr<Geoposition> position = lastPosition())
+ makeSuccessCallbacks(*position);
else
makeCachedPositionCallbacks();
}
-void Geolocation::sendError(GeoNotifierVector& notifiers, PositionError* error)
+void Geolocation::sendError(GeoNotifierVector& notifiers, PositionError& error)
{
for (auto& notifier : notifiers)
notifier->runErrorCallback(error);
}
-void Geolocation::sendPosition(GeoNotifierVector& notifiers, Geoposition* position)
+void Geolocation::sendPosition(GeoNotifierVector& notifiers, Geoposition& position)
{
for (auto& notifier : notifiers)
- notifier->runSuccessCallback(position);
+ notifier->runSuccessCallback(&position);
}
void Geolocation::stopTimer(GeoNotifierVector& notifiers)
@@ -599,10 +600,8 @@
dest.add(notifier.get());
}
-void Geolocation::handleError(PositionError* error)
+void Geolocation::handleError(PositionError& error)
{
- ASSERT(error);
-
GeoNotifierVector oneShotsCopy;
copyToVector(m_oneShots, oneShotsCopy);
@@ -614,7 +613,7 @@
// further callbacks to these notifiers.
GeoNotifierVector oneShotsWithCachedPosition;
m_oneShots.clear();
- if (error->isFatal())
+ if (error.isFatal())
m_watchers.clear();
else {
// Don't send non-fatal errors to notifiers due to receive a cached position.
@@ -650,7 +649,7 @@
GeolocationController::from(page)->requestPermission(this);
}
-void Geolocation::makeSuccessCallbacks()
+void Geolocation::makeSuccessCallbacks(Geoposition& position)
{
ASSERT(lastPosition());
ASSERT(isAllowed());
@@ -666,8 +665,8 @@
// further callbacks to these notifiers.
m_oneShots.clear();
- sendPosition(oneShotsCopy, lastPosition());
- sendPosition(watchersCopy, lastPosition());
+ sendPosition(oneShotsCopy, position);
+ sendPosition(watchersCopy, position);
if (!hasListeners())
stopUpdating();
@@ -685,7 +684,10 @@
return;
}
- makeSuccessCallbacks();
+ RefPtr<Geoposition> position = lastPosition();
+ ASSERT(position);
+
+ makeSuccessCallbacks(*position);
}
void Geolocation::setError(GeolocationError* error)
@@ -694,8 +696,9 @@
m_errorWaitingForResume = createPositionError(error);
return;
}
- RefPtr<PositionError> positionError = createPositionError(error);
- handleError(positionError.get());
+
+ auto positionError = createPositionError(error);
+ handleError(positionError);
}
bool Geolocation::startUpdating(GeoNotifier* notifier)
Modified: trunk/Source/WebCore/Modules/geolocation/Geolocation.h (217133 => 217134)
--- trunk/Source/WebCore/Modules/geolocation/Geolocation.h 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/Modules/geolocation/Geolocation.h 2017-05-19 18:07:49 UTC (rev 217134)
@@ -111,8 +111,8 @@
bool hasListeners() const { return !m_oneShots.isEmpty() || !m_watchers.isEmpty(); }
- void sendError(GeoNotifierVector&, PositionError*);
- void sendPosition(GeoNotifierVector&, Geoposition*);
+ void sendError(GeoNotifierVector&, PositionError&);
+ void sendPosition(GeoNotifierVector&, Geoposition&);
static void extractNotifiersWithCachedPosition(GeoNotifierVector& notifiers, GeoNotifierVector* cached);
static void copyToSet(const GeoNotifierVector&, GeoNotifierSet&);
@@ -125,8 +125,8 @@
void cancelRequests(GeoNotifierVector&);
void cancelAllRequests();
- void makeSuccessCallbacks();
- void handleError(PositionError*);
+ void makeSuccessCallbacks(Geoposition&);
+ void handleError(PositionError&);
void requestPermission();
Modified: trunk/Source/WebCore/Modules/geolocation/PositionCallback.idl (217133 => 217134)
--- trunk/Source/WebCore/Modules/geolocation/PositionCallback.idl 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/Modules/geolocation/PositionCallback.idl 2017-05-19 18:07:49 UTC (rev 217134)
@@ -24,4 +24,4 @@
[
Conditional=GEOLOCATION,
-] callback PositionCallback = void (Geoposition position);
+] callback PositionCallback = void (Geoposition? position); // FIXME: This should not be nullable.
Modified: trunk/Source/WebCore/Modules/geolocation/PositionErrorCallback.h (217133 => 217134)
--- trunk/Source/WebCore/Modules/geolocation/PositionErrorCallback.h 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/Modules/geolocation/PositionErrorCallback.h 2017-05-19 18:07:49 UTC (rev 217134)
@@ -34,7 +34,7 @@
class PositionErrorCallback : public RefCounted<PositionErrorCallback> {
public:
virtual ~PositionErrorCallback() { }
- virtual bool handleEvent(PositionError*) = 0;
+ virtual bool handleEvent(PositionError&) = 0;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/webaudio/AudioBufferCallback.idl (217133 => 217134)
--- trunk/Source/WebCore/Modules/webaudio/AudioBufferCallback.idl 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBufferCallback.idl 2017-05-19 18:07:49 UTC (rev 217134)
@@ -22,7 +22,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+// FIXME: According to the latest WebAudio spec, this should be split into two
+// callbacks, DecodeSuccessCallback which takes a non-nullable AudioBuffer, and
+// DecodeErrorCallback, which takes DOMException. Currently, we pass an AudioBuffer
+// on success and null on failure.
+
[
Conditional=WEB_AUDIO,
JSGenerateToJSObject,
-] callback AudioBufferCallback = void (AudioBuffer audioBuffer);
+] callback AudioBufferCallback = void (AudioBuffer? audioBuffer);
Modified: trunk/Source/WebCore/Modules/webdatabase/Database.cpp (217133 => 217134)
--- trunk/Source/WebCore/Modules/webdatabase/Database.cpp 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/Modules/webdatabase/Database.cpp 2017-05-19 18:07:49 UTC (rev 217134)
@@ -682,7 +682,7 @@
if (errorCallback) {
RefPtr<SQLTransactionErrorCallback> errorCallbackProtector = WTFMove(errorCallback);
m_scriptExecutionContext->postTask([errorCallbackProtector](ScriptExecutionContext&) {
- errorCallbackProtector->handleEvent(SQLError::create(SQLError::UNKNOWN_ERR, "database has been closed").ptr());
+ errorCallbackProtector->handleEvent(SQLError::create(SQLError::UNKNOWN_ERR, "database has been closed"));
});
}
return;
Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseCallback.h (217133 => 217134)
--- trunk/Source/WebCore/Modules/webdatabase/DatabaseCallback.h 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseCallback.h 2017-05-19 18:07:49 UTC (rev 217134)
@@ -39,7 +39,7 @@
class DatabaseCallback : public ThreadSafeRefCounted<DatabaseCallback> {
public:
virtual ~DatabaseCallback() { }
- virtual bool handleEvent(Database*) = 0;
+ virtual bool handleEvent(Database&) = 0;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp (217133 => 217134)
--- trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp 2017-05-19 18:07:49 UTC (rev 217134)
@@ -217,7 +217,7 @@
LOG(StorageAPI, "Scheduling DatabaseCreationCallbackTask for database %p\n", database.get());
database->setHasPendingCreationEvent(true);
database->m_scriptExecutionContext->postTask([creationCallback, database] (ScriptExecutionContext&) {
- creationCallback->handleEvent(database.get());
+ creationCallback->handleEvent(*database);
database->setHasPendingCreationEvent(false);
});
}
Modified: trunk/Source/WebCore/Modules/webdatabase/SQLStatement.cpp (217133 => 217134)
--- trunk/Source/WebCore/Modules/webdatabase/SQLStatement.cpp 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLStatement.cpp 2017-05-19 18:07:49 UTC (rev 217134)
@@ -213,10 +213,10 @@
// because then we need to jump to the transaction error callback.
if (error) {
if (errorCallback)
- callbackError = errorCallback->handleEvent(transaction, error.get());
+ callbackError = errorCallback->handleEvent(*transaction, *error);
} else if (callback) {
RefPtr<SQLResultSet> resultSet = sqlResultSet();
- callbackError = !callback->handleEvent(transaction, resultSet.get());
+ callbackError = !callback->handleEvent(*transaction, *resultSet);
}
return callbackError;
Modified: trunk/Source/WebCore/Modules/webdatabase/SQLStatementCallback.h (217133 => 217134)
--- trunk/Source/WebCore/Modules/webdatabase/SQLStatementCallback.h 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLStatementCallback.h 2017-05-19 18:07:49 UTC (rev 217134)
@@ -38,7 +38,7 @@
class SQLStatementCallback : public ThreadSafeRefCounted<SQLStatementCallback> {
public:
virtual ~SQLStatementCallback() { }
- virtual bool handleEvent(SQLTransaction*, SQLResultSet*) = 0;
+ virtual bool handleEvent(SQLTransaction&, SQLResultSet&) = 0;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/webdatabase/SQLStatementErrorCallback.h (217133 => 217134)
--- trunk/Source/WebCore/Modules/webdatabase/SQLStatementErrorCallback.h 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLStatementErrorCallback.h 2017-05-19 18:07:49 UTC (rev 217134)
@@ -38,7 +38,7 @@
class SQLStatementErrorCallback : public ThreadSafeRefCounted<SQLStatementErrorCallback> {
public:
virtual ~SQLStatementErrorCallback() { }
- virtual bool handleEvent(SQLTransaction*, SQLError*) = 0;
+ virtual bool handleEvent(SQLTransaction&, SQLError&) = 0;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp (217133 => 217134)
--- trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp 2017-05-19 18:07:49 UTC (rev 217134)
@@ -371,7 +371,7 @@
RefPtr<SQLTransactionCallback> callback = m_callbackWrapper.unwrap();
if (callback) {
m_executeSqlAllowed = true;
- shouldDeliverErrorCallback = !callback->handleEvent(this);
+ shouldDeliverErrorCallback = !callback->handleEvent(*this);
m_executeSqlAllowed = false;
}
@@ -392,7 +392,7 @@
// error to have occurred in this transaction.
RefPtr<SQLTransactionErrorCallback> errorCallback = m_errorCallbackWrapper.unwrap();
if (errorCallback)
- errorCallback->handleEvent(m_transactionError.get());
+ errorCallback->handleEvent(*m_transactionError);
clearCallbackWrappers();
Modified: trunk/Source/WebCore/Modules/webdatabase/SQLTransactionCallback.h (217133 => 217134)
--- trunk/Source/WebCore/Modules/webdatabase/SQLTransactionCallback.h 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLTransactionCallback.h 2017-05-19 18:07:49 UTC (rev 217134)
@@ -37,7 +37,7 @@
class SQLTransactionCallback : public ThreadSafeRefCounted<SQLTransactionCallback> {
public:
virtual ~SQLTransactionCallback() { }
- virtual bool handleEvent(SQLTransaction*) = 0;
+ virtual bool handleEvent(SQLTransaction&) = 0;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/webdatabase/SQLTransactionErrorCallback.h (217133 => 217134)
--- trunk/Source/WebCore/Modules/webdatabase/SQLTransactionErrorCallback.h 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLTransactionErrorCallback.h 2017-05-19 18:07:49 UTC (rev 217134)
@@ -37,7 +37,7 @@
class SQLTransactionErrorCallback : public ThreadSafeRefCounted<SQLTransactionErrorCallback> {
public:
virtual ~SQLTransactionErrorCallback() { }
- virtual bool handleEvent(SQLError*) = 0;
+ virtual bool handleEvent(SQLError&) = 0;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/IDLTypes.h (217133 => 217134)
--- trunk/Source/WebCore/bindings/IDLTypes.h 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/bindings/IDLTypes.h 2017-05-19 18:07:49 UTC (rev 217134)
@@ -53,7 +53,9 @@
template<typename T>
struct IDLType {
using ImplementationType = T;
+
using ParameterType = T;
+ using NullableParameterType = std::optional<ImplementationType>;
using NullableType = std::optional<ImplementationType>;
static NullableType nullValue() { return std::nullopt; }
@@ -69,6 +71,7 @@
struct IDLAny : IDLType<JSC::Strong<JSC::Unknown>> {
using ParameterType = JSC::JSValue;
+ using NullableParameterType = JSC::JSValue;
using NullableType = JSC::Strong<JSC::Unknown>;
static inline std::nullptr_t nullValue() { return nullptr; }
@@ -106,6 +109,7 @@
template<typename StringType> struct IDLString : IDLType<StringType> {
using ParameterType = const StringType&;
+ using NullableParameterType = const StringType&;
using NullableType = StringType;
static StringType nullValue() { return StringType(); }
@@ -140,6 +144,7 @@
using RawType = T;
using ParameterType = T&;
+ using NullableParameterType = T*;
using NullableType = RefPtr<T>;
static inline std::nullptr_t nullValue() { return nullptr; }
@@ -153,6 +158,7 @@
template<typename T> struct IDLDictionary : IDLType<T> {
using ParameterType = const T&;
+ using NullableParameterType = const T&;
};
template<typename T> struct IDLEnumeration : IDLType<T> { };
@@ -160,6 +166,9 @@
template<typename T> struct IDLNullable : IDLType<typename T::NullableType> {
using InnerType = T;
+ using ParameterType = typename T::NullableParameterType;
+ using NullableParameterType = typename T::NullableParameterType;
+
using NullableType = typename T::NullableType;
static inline auto nullValue() -> decltype(T::nullValue()) { return T::nullValue(); }
template<typename U> static inline bool isNullValue(U&& value) { return T::isNullValue(std::forward<U>(value)); }
@@ -170,6 +179,7 @@
using InnerType = T;
using ParameterType = const Vector<typename T::ImplementationType>&;
+ using NullableParameterType = const std::optional<Vector<typename T::ImplementationType>>&;
};
template<typename T> struct IDLFrozenArray : IDLType<Vector<typename T::ImplementationType>> {
@@ -176,6 +186,7 @@
using InnerType = T;
using ParameterType = const Vector<typename T::ImplementationType>&;
+ using NullableParameterType = const std::optional<Vector<typename T::ImplementationType>>&;
};
template<typename K, typename V> struct IDLRecord : IDLType<Vector<WTF::KeyValuePair<typename K::ImplementationType, typename V::ImplementationType>>> {
@@ -183,6 +194,7 @@
using ValueType = V;
using ParameterType = const Vector<WTF::KeyValuePair<typename K::ImplementationType, typename V::ImplementationType>>&;
+ using NullableParameterType = const std::optional<Vector<WTF::KeyValuePair<typename K::ImplementationType, typename V::ImplementationType>>>&;
};
template<typename T> struct IDLPromise : IDLType<DOMPromise> {
@@ -197,6 +209,7 @@
using TypeList = brigand::list<Ts...>;
using ParameterType = const Variant<typename Ts::ImplementationType...>&;
+ using NullableParameterType = const std::optional<Variant<typename Ts::ImplementationType...>>&;
};
// Non-WebIDL extensions
@@ -210,6 +223,7 @@
struct IDLJSON : IDLType<String> {
using ParameterType = const String&;
+ using NullableParameterType = const String&;
using NullableType = String;
static String nullValue() { return String(); }
Modified: trunk/Source/WebCore/bindings/js/JSNodeFilterCustom.cpp (217133 => 217134)
--- trunk/Source/WebCore/bindings/js/JSNodeFilterCustom.cpp 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/bindings/js/JSNodeFilterCustom.cpp 2017-05-19 18:07:49 UTC (rev 217134)
@@ -38,7 +38,7 @@
// FIXME: The bindings generator is currently not able to generate
// callback function calls if they return something other than a
// boolean.
-uint16_t JSNodeFilter::acceptNode(Node* node)
+unsigned short JSNodeFilter::acceptNode(Node& node)
{
Ref<JSNodeFilter> protectedThis(*this);
Modified: trunk/Source/WebCore/bindings/js/JSSQLStatementErrorCallbackCustom.cpp (217133 => 217134)
--- trunk/Source/WebCore/bindings/js/JSSQLStatementErrorCallbackCustom.cpp 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/bindings/js/JSSQLStatementErrorCallbackCustom.cpp 2017-05-19 18:07:49 UTC (rev 217134)
@@ -29,6 +29,7 @@
#include "config.h"
#include "JSSQLStatementErrorCallback.h"
+#include "JSDOMConvertInterface.h"
#include "JSDOMExceptionHandling.h"
#include "JSSQLError.h"
#include "JSSQLTransaction.h"
@@ -41,7 +42,7 @@
using namespace JSC;
-bool JSSQLStatementErrorCallback::handleEvent(SQLTransaction* transaction, SQLError* error)
+bool JSSQLStatementErrorCallback::handleEvent(SQLTransaction& transaction, SQLError& error)
{
if (!m_data || !m_data->globalObject() || !canInvokeCallback())
return true;
@@ -52,8 +53,8 @@
ExecState* exec = m_data->globalObject()->globalExec();
MarkedArgumentBuffer args;
- args.append(toJS(exec, m_data->globalObject(), transaction));
- args.append(toJS(exec, m_data->globalObject(), error));
+ args.append(toJS<IDLInterface<SQLTransaction>>(*exec, *m_data->globalObject(), transaction));
+ args.append(toJS<IDLInterface<SQLError>>(*exec, *m_data->globalObject(), error));
NakedPtr<JSC::Exception> returnedException;
JSValue result = m_data->invokeCallback(args, JSCallbackData::CallbackType::Function, Identifier(), returnedException);
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (217133 => 217134)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2017-05-19 18:07:49 UTC (rev 217134)
@@ -1492,10 +1492,7 @@
if ($defaultValue eq "[]") {
my $IDLType = GetIDLType($typeScope, $type);
- return "Converter<${IDLType}>::ReturnType{ }" if $codeGenerator->IsSequenceOrFrozenArrayType($type);
-
- my $nativeType = GetNativeType($typeScope, $type);
- return "$nativeType()"
+ return "Converter<${IDLType}>::ReturnType{ }";
}
return "jsUndefined()" if $defaultValue eq "undefined";
@@ -1842,8 +1839,6 @@
# JSValue to implementation type
if (ShouldGenerateToWrapped($hasParent, $interface)) {
- my $nativeType = GetNativeType($interface, $interface->type);
-
# FIXME: Add extended attribute for this.
my @toWrappedArguments = ();
push(@toWrappedArguments, "JSC::VM&");
@@ -1850,9 +1845,11 @@
push(@toWrappedArguments, "JSC::ExecState&") if $interface->type->name eq "XPathNSResolver";
push(@toWrappedArguments, "JSC::JSValue");
+ my $toWrappedType = $interface->type->name eq "XPathNSResolver" ? "RefPtr<${implType}>" : "${implType}*";
+
my $export = "";
$export = "WEBCORE_EXPORT " if $interface->extendedAttributes->{ExportToWrappedFunction};
- push(@headerContent, " static $export$nativeType toWrapped(" . join(", ", @toWrappedArguments) . ");\n");
+ push(@headerContent, " static ${export}${toWrappedType} toWrapped(" . join(", ", @toWrappedArguments) . ");\n");
}
$headerTrailingIncludes{"${className}Custom.h"} = 1 if $interface->extendedAttributes->{JSCustomHeader};
@@ -2271,9 +2268,11 @@
}
if (NeedsImplementationClass($interface)) {
+ my $toWrappedType = $interface->type->name eq "XPathNSResolver" ? "RefPtr<${implType}>" : "${implType}*";
+
push(@headerContent, "template<> struct JSDOMWrapperConverterTraits<${implType}> {\n");
push(@headerContent, " using WrapperClass = ${className};\n");
- push(@headerContent, " using ToWrappedReturnType = " . GetNativeType($interface, $interface->type) . ";\n");
+ push(@headerContent, " using ToWrappedReturnType = ${toWrappedType};\n");
push(@headerContent, "};\n");
}
@@ -4257,22 +4256,12 @@
my $type = $argument->type;
my $name = $argument->name;
my $encodedName = "encoded" . $codeGenerator->WK_ucfirst($name);
- my $nativeType = GetNativeType($interface, $argument->type);
my $shouldPassByReference = ShouldPassArgumentByReference($argument);
- if (!$shouldPassByReference && ($codeGenerator->IsWrapperType($type) || $codeGenerator->IsTypedArrayType($type))) {
- $implIncludes{"<runtime/Error.h>"} = 1;
- my ($nativeValue, $mayThrowException) = UnsafeToNative($interface, $argument, $encodedName, $function->extendedAttributes->{Conditional});
- push(@implContent, " $nativeType $name = nullptr;\n");
- push(@implContent, " $name = $nativeValue;\n");
- push(@implContent, " RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n") if $mayThrowException;
- $value = "WTFMove($name)";
- } else {
- my ($nativeValue, $mayThrowException) = UnsafeToNative($interface, $argument, $encodedName, $function->extendedAttributes->{Conditional});
- push(@implContent, " auto $name = ${nativeValue};\n");
- $value = "WTFMove($name)";
- push(@implContent, " RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n") if $mayThrowException;
- }
+ my ($nativeValue, $mayThrowException) = UnsafeToNative($interface, $argument, $encodedName, $function->extendedAttributes->{Conditional});
+ push(@implContent, " auto $name = ${nativeValue};\n");
+ push(@implContent, " RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n") if $mayThrowException;
+ $value = "WTFMove($name)";
if ($shouldPassByReference) {
$value = "*$name";
@@ -4947,41 +4936,40 @@
push(@$outputArray, " }\n") if $indent ne "";
} else {
- my $outer;
- my $inner;
- my $nativeType = GetNativeType($interface, $argument->type);
-
- die "Variadic argument is already handled here" if $argument->isVariadic;
- my $argumentLookupMethod = $argument->isOptional ? "argument" : "uncheckedArgument";
+ my $argumentLookupForConversion;
+ my $optionalCheck;
my $nativeValueCastFunction;
- if ($argument->isOptional && defined($argument->default) && !WillConvertUndefinedToDefaultParameterValue($type, $argument->default)) {
- my $defaultValue = $argument->default;
+ if ($argument->isOptional) {
+ if (defined($argument->default)) {
+ if (WillConvertUndefinedToDefaultParameterValue($type, $argument->default)) {
+ $argumentLookupForConversion = "state->argument($argumentIndex)";
+ } else {
+ my $defaultValue = GenerateDefaultValue($interface, $argument, $argument->type, $argument->default);
+ $optionalCheck = "state->argument($argumentIndex).isUndefined() ? $defaultValue : ";
+ $argumentLookupForConversion = "state->uncheckedArgument($argumentIndex)"
+ }
+ } else {
+ my $argumentIDLType = GetIDLType($interface, $argument->type);
+ my $defaultValue = "std::optional<Converter<$argumentIDLType>::ReturnType>()";
- $defaultValue = GenerateDefaultValue($interface, $argument, $argument->type, $argument->default);
-
- $outer = "state->$argumentLookupMethod($argumentIndex).isUndefined() ? $defaultValue : ";
- $inner = "state->uncheckedArgument($argumentIndex)";
- } elsif ($argument->isOptional && !defined($argument->default)) {
- # Use std::optional<>() for optional arguments that are missing or undefined and that do not have a default value in the IDL.
- $outer = "state->$argumentLookupMethod($argumentIndex).isUndefined() ? std::optional<$nativeType>() : ";
- $nativeValueCastFunction = "std::optional<$nativeType>";
- $inner = "state->uncheckedArgument($argumentIndex)";
+ $optionalCheck = "state->argument($argumentIndex).isUndefined() ? $defaultValue : ";
+ $argumentLookupForConversion = "state->uncheckedArgument($argumentIndex)";
+ $nativeValueCastFunction = "std::optional<Converter<$argumentIDLType>::ReturnType>";
+ }
} else {
- $outer = "";
- $inner = "state->$argumentLookupMethod($argumentIndex)";
+ $argumentLookupForConversion = "state->uncheckedArgument($argumentIndex)";
}
-
+
my $globalObjectReference = $function->isStatic ? "*jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())" : "*castedThis->globalObject()";
my $argumentExceptionThrower = GetArgumentExceptionThrower($interface, $argument, $argumentIndex, $quotedFunctionName);
- my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $argument, $inner, $conditional, "state", "*state", "*castedThis", $globalObjectReference, $argumentExceptionThrower);
+ my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $argument, $argumentLookupForConversion, $conditional, "state", "*state", "*castedThis", $globalObjectReference, $argumentExceptionThrower);
- if (defined $nativeValueCastFunction) {
- push(@$outputArray, " auto $name = ${outer}$nativeValueCastFunction(${nativeValue});\n");
- } else {
- push(@$outputArray, " auto $name = ${outer}${nativeValue};\n");
- }
+ $nativeValue = "${nativeValueCastFunction}(" . $nativeValue . ")" if defined $nativeValueCastFunction;
+ $nativeValue = $optionalCheck . $nativeValue if defined $optionalCheck;
+
+ push(@$outputArray, " auto $name = ${nativeValue};\n");
push(@$outputArray, " RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n") if $mayThrowException;
$value = PassArgumentExpression($name, $argument);
@@ -5146,11 +5134,12 @@
my $className = "JS${name}";
$includesRef->{"ActiveDOMCallback.h"} = 1;
+ $includesRef->{"IDLTypes.h"} = 1;
$includesRef->{"JSCallbackData.h"} = 1;
$includesRef->{"<wtf/Forward.h>"} = 1;
$includesRef->{"${name}.h"} = 1;
- push(@$contentRef, "class $className : public ${name}, public ActiveDOMCallback {\n");
+ push(@$contentRef, "class $className final : public ${name}, public ActiveDOMCallback {\n");
push(@$contentRef, "public:\n");
# The static create() method.
@@ -5167,7 +5156,7 @@
push(@$contentRef, " static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);\n") if @{$constants};
- push(@$contentRef, " virtual bool operator==(const ${name}&) const;\n\n") if $interfaceOrCallback->extendedAttributes->{CallbackNeedsOperatorEqual};
+ push(@$contentRef, " virtual bool operator==(const ${name}&) const override;\n\n") if $interfaceOrCallback->extendedAttributes->{CallbackNeedsOperatorEqual};
# Functions
my $numFunctions = @{$functions};
@@ -5176,16 +5165,17 @@
foreach my $function (@{$functions}) {
my @arguments = ();
foreach my $argument (@{$function->arguments}) {
- push(@arguments, GetNativeTypeForCallbacks($argument->type, $interfaceOrCallback) . " " . $argument->name);
+ my $IDLType = GetIDLType($interfaceOrCallback, $argument->type);
+ push(@arguments, "typename ${IDLType}::ParameterType " . $argument->name);
}
# FIXME: Add support for non-void return types (the bool actually is returning exception state), for non-custom functions.
- my $nativeReturnType = $function->extendedAttributes->{Custom} ? GetNativeTypeForCallbacks($function->type, $interfaceOrCallback) : "bool";
+ my $nativeReturnType = $function->extendedAttributes->{Custom} ? "typename " . GetIDLType($interfaceOrCallback, $function->type) . "::ImplementationType" : "bool";
# FIXME: Change the default name (used for callback functions) to something other than handleEvent. It makes little sense.
my $functionName = $function->name ? $function->name : "handleEvent";
- push(@$contentRef, " virtual ${nativeReturnType} ${functionName}(" . join(", ", @arguments) . ");\n");
+ push(@$contentRef, " virtual ${nativeReturnType} ${functionName}(" . join(", ", @arguments) . ") override;\n");
}
}
@@ -5305,12 +5295,18 @@
# FIXME: Change the default name (used for callback functions) to something other than handleEvent. It makes little sense.
my $functionName = $function->name ? $function->name : "handleEvent";
+ # FIXME: Add support for non-void return types (the bool actually is returning exception state), for non-custom functions.
+ my $nativeReturnType = "bool";
+
my @args = ();
foreach my $argument (@{$function->arguments}) {
AddToIncludesForIDLType($argument->type, $includesRef, 1);
- push(@args, GetNativeTypeForCallbacks($argument->type, $interfaceOrCallback) . " " . $argument->name);
+
+ my $IDLType = GetIDLType($interfaceOrCallback, $argument->type);
+ push(@args, "typename ${IDLType}::ParameterType " . $argument->name);
}
- push(@$contentRef, "bool ${className}::${functionName}(" . join(", ", @args) . ")\n");
+
+ push(@$contentRef, "${nativeReturnType} ${className}::${functionName}(" . join(", ", @args) . ")\n");
push(@$contentRef, "{\n");
push(@$contentRef, " if (!canInvokeCallback())\n");
push(@$contentRef, " return true;\n\n");
@@ -5457,31 +5453,6 @@
}
}
-my %nativeType = (
- "ByteString" => "String",
- "DOMString" => "String",
- "USVString" => "String",
- "Date" => "double",
- "EventListener" => "RefPtr<EventListener>",
- "SerializedScriptValue" => "RefPtr<SerializedScriptValue>",
- "XPathNSResolver" => "RefPtr<XPathNSResolver>",
- "any" => "JSC::JSValue",
- "object" => "JSC::Strong<JSC::JSObject>",
- "boolean" => "bool",
- "byte" => "int8_t",
- "double" => "double",
- "float" => "float",
- "long long" => "int64_t",
- "long" => "int32_t",
- "octet" => "uint8_t",
- "short" => "int16_t",
- "unrestricted double" => "double",
- "unrestricted float" => "float",
- "unsigned long long" => "uint64_t",
- "unsigned long" => "uint32_t",
- "unsigned short" => "uint16_t",
-);
-
# http://heycam.github.io/webidl/#dfn-flattened-union-member-types
sub GetFlattenedMemberTypes
{
@@ -5627,54 +5598,6 @@
return $baseIDLType;
}
-sub GetNativeType
-{
- my ($interface, $type) = @_;
-
- assert("Not a type") if ref($type) ne "IDLType";
-
- my $typeName = $type->name;
-
- return $nativeType{$typeName} if exists $nativeType{$typeName};
-
- return GetEnumerationClassName($type, $interface) if $codeGenerator->IsEnumType($type);
- return GetDictionaryClassName($type, $interface) if $codeGenerator->IsDictionaryType($type);
- return "Vector<" . GetNativeInnerType(@{$type->subtypes}[0], $interface) . ">" if $codeGenerator->IsSequenceOrFrozenArrayType($type);
- return "Vector<WTF::KeyValuePair<" . GetNativeInnerType(@{$type->subtypes}[0], $interface) . ", " . GetNativeInnerType(@{$type->subtypes}[1], $interface) . ">>" if $codeGenerator->IsRecordType($type);
-
- if ($type->isUnion) {
- my $IDLType = GetIDLType($interface, $type);
- return "Converter<$IDLType>::ReturnType";
- }
-
- return "RefPtr<${typeName}>" if $codeGenerator->IsTypedArrayType($type) and $typeName ne "ArrayBuffer";
- return "${typeName}*";
-}
-
-sub GetNativeInnerType
-{
- my ($innerType, $interface) = @_;
-
- my $innerTypeName = $innerType->name;
-
- return $nativeType{$innerTypeName} if exists $nativeType{$innerTypeName};
-
- return GetEnumerationClassName($innerType, $interface) if $codeGenerator->IsEnumType($innerType);
- return GetDictionaryClassName($innerType, $interface) if $codeGenerator->IsDictionaryType($innerType);
- return "Vector<" . GetNativeInnerType(@{$innerType->subtypes}[0], $interface) . ">" if $codeGenerator->IsSequenceOrFrozenArrayType($innerType);
- return "Vector<WTF::KeyValuePair<" . GetNativeInnerType(@{$innerType->subtypes}[0], $interface) . ", " . GetNativeInnerType(@{$innerType->subtypes}[1], $interface) . ">>" if $codeGenerator->IsRecordType($innerType);
- return "RefPtr<$innerTypeName>";
-}
-
-sub GetNativeTypeForCallbacks
-{
- my ($type, $interface) = @_;
-
- return "RefPtr<SerializedScriptValue>&&" if $type->name eq "SerializedScriptValue";
- return "const String&" if $codeGenerator->IsStringType($type);
- return GetNativeType($interface, $type);
-}
-
sub ShouldPassArgumentByReference
{
my ($argument) = @_;
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp (217133 => 217134)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp 2017-05-19 18:07:49 UTC (rev 217134)
@@ -56,7 +56,7 @@
#endif
}
-bool JSTestCallbackFunction::handleEvent(RefPtr<Float32Array> arrayParam, RefPtr<SerializedScriptValue>&& srzParam, const String& strArg, bool boolParam, int32_t longParam, TestNode* testNodeParam)
+bool JSTestCallbackFunction::handleEvent(typename IDLInterface<Float32Array>::ParameterType arrayParam, typename IDLSerializedScriptValue<SerializedScriptValue>::ParameterType srzParam, typename IDLDOMString::ParameterType strArg, typename IDLBoolean::ParameterType boolParam, typename IDLLong::ParameterType longParam, typename IDLInterface<TestNode>::ParameterType testNodeParam)
{
if (!canInvokeCallback())
return true;
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.h (217133 => 217134)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.h 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.h 2017-05-19 18:07:49 UTC (rev 217134)
@@ -23,6 +23,7 @@
#if ENABLE(SPEECH_SYNTHESIS)
#include "ActiveDOMCallback.h"
+#include "IDLTypes.h"
#include "JSCallbackData.h"
#include "TestCallbackFunction.h"
#include <wtf/Forward.h>
@@ -29,7 +30,7 @@
namespace WebCore {
-class JSTestCallbackFunction : public TestCallbackFunction, public ActiveDOMCallback {
+class JSTestCallbackFunction final : public TestCallbackFunction, public ActiveDOMCallback {
public:
static Ref<JSTestCallbackFunction> create(JSC::JSObject* callback, JSDOMGlobalObject* globalObject)
{
@@ -42,7 +43,7 @@
JSCallbackDataStrong* callbackData() { return m_data; }
// Functions
- virtual bool handleEvent(RefPtr<Float32Array> arrayParam, RefPtr<SerializedScriptValue>&& srzParam, const String& strArg, bool boolParam, int32_t longParam, TestNode* testNodeParam);
+ virtual bool handleEvent(typename IDLInterface<Float32Array>::ParameterType arrayParam, typename IDLSerializedScriptValue<SerializedScriptValue>::ParameterType srzParam, typename IDLDOMString::ParameterType strArg, typename IDLBoolean::ParameterType boolParam, typename IDLLong::ParameterType longParam, typename IDLInterface<TestNode>::ParameterType testNodeParam) override;
private:
JSTestCallbackFunction(JSC::JSObject*, JSDOMGlobalObject*);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp (217133 => 217134)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp 2017-05-19 18:07:49 UTC (rev 217134)
@@ -52,7 +52,7 @@
#endif
}
-bool JSTestCallbackFunctionWithTypedefs::handleEvent(Vector<int32_t> sequenceArg, int32_t longArg)
+bool JSTestCallbackFunctionWithTypedefs::handleEvent(typename IDLSequence<IDLNullable<IDLLong>>::ParameterType sequenceArg, typename IDLLong::ParameterType longArg)
{
if (!canInvokeCallback())
return true;
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h (217133 => 217134)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h 2017-05-19 18:07:49 UTC (rev 217134)
@@ -21,6 +21,7 @@
#pragma once
#include "ActiveDOMCallback.h"
+#include "IDLTypes.h"
#include "JSCallbackData.h"
#include "TestCallbackFunctionWithTypedefs.h"
#include <wtf/Forward.h>
@@ -27,7 +28,7 @@
namespace WebCore {
-class JSTestCallbackFunctionWithTypedefs : public TestCallbackFunctionWithTypedefs, public ActiveDOMCallback {
+class JSTestCallbackFunctionWithTypedefs final : public TestCallbackFunctionWithTypedefs, public ActiveDOMCallback {
public:
static Ref<JSTestCallbackFunctionWithTypedefs> create(JSC::JSObject* callback, JSDOMGlobalObject* globalObject)
{
@@ -40,7 +41,7 @@
JSCallbackDataStrong* callbackData() { return m_data; }
// Functions
- virtual bool handleEvent(Vector<int32_t> sequenceArg, int32_t longArg);
+ virtual bool handleEvent(typename IDLSequence<IDLNullable<IDLLong>>::ParameterType sequenceArg, typename IDLLong::ParameterType longArg) override;
private:
JSTestCallbackFunctionWithTypedefs(JSC::JSObject*, JSDOMGlobalObject*);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.cpp (217133 => 217134)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.cpp 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.cpp 2017-05-19 18:07:49 UTC (rev 217134)
@@ -112,7 +112,7 @@
return !returnedException;
}
-bool JSTestCallbackInterface::callbackWithArrayParam(RefPtr<Float32Array> arrayParam)
+bool JSTestCallbackInterface::callbackWithArrayParam(typename IDLInterface<Float32Array>::ParameterType arrayParam)
{
if (!canInvokeCallback())
return true;
@@ -132,7 +132,7 @@
return !returnedException;
}
-bool JSTestCallbackInterface::callbackWithSerializedScriptValueParam(RefPtr<SerializedScriptValue>&& srzParam, const String& strParam)
+bool JSTestCallbackInterface::callbackWithSerializedScriptValueParam(typename IDLSerializedScriptValue<SerializedScriptValue>::ParameterType srzParam, typename IDLDOMString::ParameterType strParam)
{
if (!canInvokeCallback())
return true;
@@ -153,7 +153,7 @@
return !returnedException;
}
-bool JSTestCallbackInterface::callbackWithStringList(DOMStringList* listParam)
+bool JSTestCallbackInterface::callbackWithStringList(typename IDLInterface<DOMStringList>::ParameterType listParam)
{
if (!canInvokeCallback())
return true;
@@ -173,7 +173,7 @@
return !returnedException;
}
-bool JSTestCallbackInterface::callbackWithBoolean(bool boolParam)
+bool JSTestCallbackInterface::callbackWithBoolean(typename IDLBoolean::ParameterType boolParam)
{
if (!canInvokeCallback())
return true;
@@ -193,7 +193,7 @@
return !returnedException;
}
-bool JSTestCallbackInterface::callbackRequiresThisToPass(int32_t longParam, TestNode* testNodeParam)
+bool JSTestCallbackInterface::callbackRequiresThisToPass(typename IDLLong::ParameterType longParam, typename IDLInterface<TestNode>::ParameterType testNodeParam)
{
if (!canInvokeCallback())
return true;
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.h (217133 => 217134)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.h 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.h 2017-05-19 18:07:49 UTC (rev 217134)
@@ -23,6 +23,7 @@
#if ENABLE(SPEECH_SYNTHESIS)
#include "ActiveDOMCallback.h"
+#include "IDLTypes.h"
#include "JSCallbackData.h"
#include "TestCallbackInterface.h"
#include <wtf/Forward.h>
@@ -29,7 +30,7 @@
namespace WebCore {
-class JSTestCallbackInterface : public TestCallbackInterface, public ActiveDOMCallback {
+class JSTestCallbackInterface final : public TestCallbackInterface, public ActiveDOMCallback {
public:
static Ref<JSTestCallbackInterface> create(JSC::JSObject* callback, JSDOMGlobalObject* globalObject)
{
@@ -43,13 +44,13 @@
static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
// Functions
- virtual bool callbackWithNoParam();
- virtual bool callbackWithArrayParam(RefPtr<Float32Array> arrayParam);
- virtual bool callbackWithSerializedScriptValueParam(RefPtr<SerializedScriptValue>&& srzParam, const String& strParam);
- virtual int32_t customCallback(Class5* class5Param, Class6* class6Param);
- virtual bool callbackWithStringList(DOMStringList* listParam);
- virtual bool callbackWithBoolean(bool boolParam);
- virtual bool callbackRequiresThisToPass(int32_t longParam, TestNode* testNodeParam);
+ virtual bool callbackWithNoParam() override;
+ virtual bool callbackWithArrayParam(typename IDLInterface<Float32Array>::ParameterType arrayParam) override;
+ virtual bool callbackWithSerializedScriptValueParam(typename IDLSerializedScriptValue<SerializedScriptValue>::ParameterType srzParam, typename IDLDOMString::ParameterType strParam) override;
+ virtual typename IDLLong::ImplementationType customCallback(typename IDLInterface<TestObj>::ParameterType testObjParam, typename IDLInterface<TestNode>::ParameterType testNodeParam) override;
+ virtual bool callbackWithStringList(typename IDLInterface<DOMStringList>::ParameterType listParam) override;
+ virtual bool callbackWithBoolean(typename IDLBoolean::ParameterType boolParam) override;
+ virtual bool callbackRequiresThisToPass(typename IDLLong::ParameterType longParam, typename IDLInterface<TestNode>::ParameterType testNodeParam) override;
private:
JSTestCallbackInterface(JSC::JSObject*, JSDOMGlobalObject*);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (217133 => 217134)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2017-05-19 18:07:49 UTC (rev 217134)
@@ -6368,7 +6368,7 @@
UNUSED_PARAM(state);
UNUSED_PARAM(throwScope);
auto& impl = castedThis->wrapped();
- auto opt = state->argument(0).isUndefined() ? std::optional<int32_t>() : std::optional<int32_t>(convert<IDLLong>(*state, state->uncheckedArgument(0)));
+ auto opt = state->argument(0).isUndefined() ? std::optional<Converter<IDLLong>::ReturnType>() : std::optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(0)));
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
impl.methodWithOptionalArg(WTFMove(opt));
return JSValue::encode(jsUndefined());
@@ -6408,7 +6408,7 @@
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto nonOpt = convert<IDLLong>(*state, state->uncheckedArgument(0));
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
- auto opt = state->argument(1).isUndefined() ? std::optional<int32_t>() : std::optional<int32_t>(convert<IDLLong>(*state, state->uncheckedArgument(1)));
+ auto opt = state->argument(1).isUndefined() ? std::optional<Converter<IDLLong>::ReturnType>() : std::optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(1)));
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
impl.methodWithNonOptionalArgAndOptionalArg(WTFMove(nonOpt), WTFMove(opt));
return JSValue::encode(jsUndefined());
@@ -6430,9 +6430,9 @@
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto nonOpt = convert<IDLLong>(*state, state->uncheckedArgument(0));
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
- auto opt1 = state->argument(1).isUndefined() ? std::optional<int32_t>() : std::optional<int32_t>(convert<IDLLong>(*state, state->uncheckedArgument(1)));
+ auto opt1 = state->argument(1).isUndefined() ? std::optional<Converter<IDLLong>::ReturnType>() : std::optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(1)));
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
- auto opt2 = state->argument(2).isUndefined() ? std::optional<int32_t>() : std::optional<int32_t>(convert<IDLLong>(*state, state->uncheckedArgument(2)));
+ auto opt2 = state->argument(2).isUndefined() ? std::optional<Converter<IDLLong>::ReturnType>() : std::optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(2)));
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
impl.methodWithNonOptionalArgAndTwoOptionalArgs(WTFMove(nonOpt), WTFMove(opt1), WTFMove(opt2));
return JSValue::encode(jsUndefined());
@@ -6684,7 +6684,7 @@
UNUSED_PARAM(state);
UNUSED_PARAM(throwScope);
auto& impl = castedThis->wrapped();
- auto number = state->argument(0).isUndefined() ? std::optional<int64_t>() : std::optional<int64_t>(convert<IDLLongLong>(*state, state->uncheckedArgument(0)));
+ auto number = state->argument(0).isUndefined() ? std::optional<Converter<IDLLongLong>::ReturnType>() : std::optional<Converter<IDLLongLong>::ReturnType>(convert<IDLLongLong>(*state, state->uncheckedArgument(0)));
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
impl.methodWithOptionalLongLong(WTFMove(number));
return JSValue::encode(jsUndefined());
@@ -6720,7 +6720,7 @@
UNUSED_PARAM(state);
UNUSED_PARAM(throwScope);
auto& impl = castedThis->wrapped();
- auto number = state->argument(0).isUndefined() ? std::optional<uint64_t>() : std::optional<uint64_t>(convert<IDLUnsignedLongLong>(*state, state->uncheckedArgument(0)));
+ auto number = state->argument(0).isUndefined() ? std::optional<Converter<IDLUnsignedLongLong>::ReturnType>() : std::optional<Converter<IDLUnsignedLongLong>::ReturnType>(convert<IDLUnsignedLongLong>(*state, state->uncheckedArgument(0)));
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
impl.methodWithOptionalUnsignedLongLong(WTFMove(number));
return JSValue::encode(jsUndefined());
@@ -6792,7 +6792,7 @@
UNUSED_PARAM(state);
UNUSED_PARAM(throwScope);
auto& impl = castedThis->wrapped();
- auto b = state->argument(0).isUndefined() ? std::optional<bool>() : std::optional<bool>(convert<IDLBoolean>(*state, state->uncheckedArgument(0)));
+ auto b = state->argument(0).isUndefined() ? std::optional<Converter<IDLBoolean>::ReturnType>() : std::optional<Converter<IDLBoolean>::ReturnType>(convert<IDLBoolean>(*state, state->uncheckedArgument(0)));
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
impl.methodWithOptionalBoolean(WTFMove(b));
return JSValue::encode(jsUndefined());
@@ -6846,7 +6846,7 @@
UNUSED_PARAM(state);
UNUSED_PARAM(throwScope);
auto& impl = castedThis->wrapped();
- auto a = state->argument(0).isUndefined() ? std::optional<JSC::Strong<JSC::JSObject>>() : std::optional<JSC::Strong<JSC::JSObject>>(convert<IDLObject>(*state, state->uncheckedArgument(0)));
+ auto a = state->argument(0).isUndefined() ? std::optional<Converter<IDLObject>::ReturnType>() : std::optional<Converter<IDLObject>::ReturnType>(convert<IDLObject>(*state, state->uncheckedArgument(0)));
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
impl.methodWithOptionalObject(WTFMove(a));
return JSValue::encode(jsUndefined());
@@ -7162,7 +7162,7 @@
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto objArg = convert<IDLNullable<IDLInterface<TestObj>>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "objArg", "TestObject", "overloadedMethod", "TestObj"); });
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
- auto longArg = state->argument(1).isUndefined() ? std::optional<int32_t>() : std::optional<int32_t>(convert<IDLLong>(*state, state->uncheckedArgument(1)));
+ auto longArg = state->argument(1).isUndefined() ? std::optional<Converter<IDLLong>::ReturnType>() : std::optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(1)));
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
impl.overloadedMethod(WTFMove(objArg), WTFMove(longArg));
return JSValue::encode(jsUndefined());
@@ -7470,7 +7470,7 @@
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto objArg = convert<IDLNullable<IDLInterface<TestObj>>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "objArg", "TestObject", "overloadedMethodWithOptionalParameter", "TestObj"); });
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
- auto longArg = state->argument(1).isUndefined() ? std::optional<int32_t>() : std::optional<int32_t>(convert<IDLLong>(*state, state->uncheckedArgument(1)));
+ auto longArg = state->argument(1).isUndefined() ? std::optional<Converter<IDLLong>::ReturnType>() : std::optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(1)));
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
impl.overloadedMethodWithOptionalParameter(WTFMove(objArg), WTFMove(longArg));
return JSValue::encode(jsUndefined());
@@ -7877,7 +7877,7 @@
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
- auto arg = state->argument(0).isUndefined() ? std::optional<int32_t>() : std::optional<int32_t>(convert<IDLLong>(*state, state->uncheckedArgument(0)));
+ auto arg = state->argument(0).isUndefined() ? std::optional<Converter<IDLLong>::ReturnType>() : std::optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(0)));
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
return JSValue::encode(toJS<IDLLong>(TestObj::classMethodWithOptional(WTFMove(arg))));
}
@@ -8471,7 +8471,7 @@
UNUSED_PARAM(state);
UNUSED_PARAM(throwScope);
auto& impl = castedThis->wrapped();
- auto a = state->argument(0).isUndefined() ? std::optional<int32_t>() : std::optional<int32_t>(convert<IDLLong>(*state, state->uncheckedArgument(0)));
+ auto a = state->argument(0).isUndefined() ? std::optional<Converter<IDLLong>::ReturnType>() : std::optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(0)));
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
impl.testPromiseFunctionWithOptionalIntArgument(WTFMove(a), WTFMove(promise));
return JSValue::encode(jsUndefined());
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp (217133 => 217134)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp 2017-05-19 18:07:49 UTC (rev 217134)
@@ -607,7 +607,7 @@
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto color = state->argument(3).isUndefined() ? String() : convert<IDLDOMString>(*state, state->uncheckedArgument(3));
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
- auto alpha = state->argument(4).isUndefined() ? std::optional<float>() : std::optional<float>(convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(4)));
+ auto alpha = state->argument(4).isUndefined() ? std::optional<Converter<IDLUnrestrictedFloat>::ReturnType>() : std::optional<Converter<IDLUnrestrictedFloat>::ReturnType>(convert<IDLUnrestrictedFloat>(*state, state->uncheckedArgument(4)));
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
impl.setShadow(WTFMove(width), WTFMove(height), WTFMove(blur), WTFMove(color), WTFMove(alpha));
return JSValue::encode(jsUndefined());
@@ -748,7 +748,7 @@
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto arg1 = convert<IDLClampAdaptor<IDLUnsignedLongLong>>(*state, state->uncheckedArgument(0));
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
- auto arg2 = state->argument(1).isUndefined() ? std::optional<uint64_t>() : std::optional<uint64_t>(convert<IDLClampAdaptor<IDLUnsignedLongLong>>(*state, state->uncheckedArgument(1)));
+ auto arg2 = state->argument(1).isUndefined() ? std::optional<Converter<IDLClampAdaptor<IDLUnsignedLongLong>>::ReturnType>() : std::optional<Converter<IDLClampAdaptor<IDLUnsignedLongLong>>::ReturnType>(convert<IDLClampAdaptor<IDLUnsignedLongLong>>(*state, state->uncheckedArgument(1)));
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
impl.funcWithClamp(WTFMove(arg1), WTFMove(arg2));
return JSValue::encode(jsUndefined());
Modified: trunk/Source/WebCore/bindings/scripts/test/TestCallbackInterface.idl (217133 => 217134)
--- trunk/Source/WebCore/bindings/scripts/test/TestCallbackInterface.idl 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/bindings/scripts/test/TestCallbackInterface.idl 2017-05-19 18:07:49 UTC (rev 217134)
@@ -37,7 +37,7 @@
void callbackWithNoParam();
void callbackWithArrayParam(Float32Array arrayParam);
void callbackWithSerializedScriptValueParam(SerializedScriptValue srzParam, DOMString strParam);
- [Custom] long customCallback(Class5 class5Param, Class6 class6Param);
+ [Custom] long customCallback(TestObj testObjParam, TestNode testNodeParam);
void callbackWithStringList(DOMStringList listParam);
void callbackWithBoolean(boolean boolParam);
void callbackRequiresThisToPass(long longParam, TestNode testNodeParam);
Modified: trunk/Source/WebCore/css/MediaQueryListListener.h (217133 => 217134)
--- trunk/Source/WebCore/css/MediaQueryListListener.h 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/css/MediaQueryListListener.h 2017-05-19 18:07:49 UTC (rev 217134)
@@ -31,7 +31,7 @@
JSMediaQueryListListenerType
};
- virtual bool handleEvent(MediaQueryList*) = 0;
+ virtual bool handleEvent(MediaQueryList&) = 0;
virtual bool operator==(const MediaQueryListListener&) const = 0;
virtual ~MediaQueryListListener() { }
Modified: trunk/Source/WebCore/css/MediaQueryListListener.idl (217133 => 217134)
--- trunk/Source/WebCore/css/MediaQueryListListener.idl 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/css/MediaQueryListListener.idl 2017-05-19 18:07:49 UTC (rev 217134)
@@ -19,5 +19,5 @@
[
CallbackNeedsOperatorEqual
-] callback MediaQueryListListener = void (optional MediaQueryList? list = null);
+] callback MediaQueryListListener = void (MediaQueryList list);
Modified: trunk/Source/WebCore/css/MediaQueryMatcher.cpp (217133 => 217134)
--- trunk/Source/WebCore/css/MediaQueryMatcher.cpp 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/css/MediaQueryMatcher.cpp 2017-05-19 18:07:49 UTC (rev 217134)
@@ -127,7 +127,7 @@
bool notify;
listener.query->evaluate(evaluator, notify);
if (notify)
- listener.listener->handleEvent(listener.query.ptr());
+ listener.listener->handleEvent(listener.query);
}
}
Modified: trunk/Source/WebCore/dom/NativeNodeFilter.cpp (217133 => 217134)
--- trunk/Source/WebCore/dom/NativeNodeFilter.cpp 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/dom/NativeNodeFilter.cpp 2017-05-19 18:07:49 UTC (rev 217134)
@@ -30,12 +30,13 @@
NativeNodeFilter::NativeNodeFilter(RefPtr<NodeFilterCondition>&& condition)
: m_condition(condition)
-{ }
+{
+}
-uint16_t NativeNodeFilter::acceptNode(Node* node)
+unsigned short NativeNodeFilter::acceptNode(Node& node)
{
// cast to short silences "enumeral and non-enumeral types in return" warning
- return m_condition ? m_condition->acceptNode(node) : static_cast<uint16_t>(FILTER_ACCEPT);
+ return m_condition ? m_condition->acceptNode(&node) : static_cast<unsigned short>(FILTER_ACCEPT);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/dom/NativeNodeFilter.h (217133 => 217134)
--- trunk/Source/WebCore/dom/NativeNodeFilter.h 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/dom/NativeNodeFilter.h 2017-05-19 18:07:49 UTC (rev 217134)
@@ -43,7 +43,7 @@
return adoptRef(*new NativeNodeFilter());
}
- uint16_t acceptNode(Node*) override;
+ unsigned short acceptNode(Node&) override;
void setCondition(RefPtr<NodeFilterCondition>&& condition) { ASSERT(!m_condition); m_condition = condition; }
Modified: trunk/Source/WebCore/dom/NodeFilter.h (217133 => 217134)
--- trunk/Source/WebCore/dom/NodeFilter.h 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/dom/NodeFilter.h 2017-05-19 18:07:49 UTC (rev 217134)
@@ -33,7 +33,7 @@
class NodeFilter : public RefCounted<NodeFilter> {
public:
virtual ~NodeFilter() { }
- virtual uint16_t acceptNode(Node*) = 0;
+ virtual unsigned short acceptNode(Node&) = 0;
/*
* The following constants are returned by the acceptNode()
Modified: trunk/Source/WebCore/dom/NodeFilter.idl (217133 => 217134)
--- trunk/Source/WebCore/dom/NodeFilter.idl 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/dom/NodeFilter.idl 2017-05-19 18:07:49 UTC (rev 217134)
@@ -41,5 +41,5 @@
const unsigned long SHOW_DOCUMENT_FRAGMENT = 0x00000400;
const unsigned long SHOW_NOTATION = 0x00000800; // Historical.
- [Custom] unsigned short acceptNode(optional Node node);
+ [Custom] unsigned short acceptNode(Node node);
};
Modified: trunk/Source/WebCore/dom/NodeIterator.cpp (217133 => 217134)
--- trunk/Source/WebCore/dom/NodeIterator.cpp 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/dom/NodeIterator.cpp 2017-05-19 18:07:49 UTC (rev 217134)
@@ -97,7 +97,7 @@
// In other words, FILTER_REJECT does not pass over descendants
// of the rejected node. Hence, FILTER_REJECT is the same as FILTER_SKIP.
RefPtr<Node> provisionalResult = m_candidateNode.node;
- bool nodeWasAccepted = acceptNode(provisionalResult.get()) == NodeFilter::FILTER_ACCEPT;
+ bool nodeWasAccepted = acceptNode(*provisionalResult) == NodeFilter::FILTER_ACCEPT;
if (nodeWasAccepted) {
m_referenceNode = m_candidateNode;
result = WTFMove(provisionalResult);
@@ -119,7 +119,7 @@
// In other words, FILTER_REJECT does not pass over descendants
// of the rejected node. Hence, FILTER_REJECT is the same as FILTER_SKIP.
RefPtr<Node> provisionalResult = m_candidateNode.node;
- bool nodeWasAccepted = acceptNode(provisionalResult.get()) == NodeFilter::FILTER_ACCEPT;
+ bool nodeWasAccepted = acceptNode(*provisionalResult) == NodeFilter::FILTER_ACCEPT;
if (nodeWasAccepted) {
m_referenceNode = m_candidateNode;
result = WTFMove(provisionalResult);
Modified: trunk/Source/WebCore/dom/StringCallback.cpp (217133 => 217134)
--- trunk/Source/WebCore/dom/StringCallback.cpp 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/dom/StringCallback.cpp 2017-05-19 18:07:49 UTC (rev 217134)
@@ -36,10 +36,10 @@
namespace WebCore {
-void StringCallback::scheduleCallback(ScriptExecutionContext* context, const String& data)
+void StringCallback::scheduleCallback(ScriptExecutionContext& context, const String& data)
{
RefPtr<StringCallback> protectedThis(this);
- context->postTask([protectedThis, data] (ScriptExecutionContext&) {
+ context.postTask([protectedThis, data] (ScriptExecutionContext&) {
protectedThis->handleEvent(data);
});
}
Modified: trunk/Source/WebCore/dom/StringCallback.h (217133 => 217134)
--- trunk/Source/WebCore/dom/StringCallback.h 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/dom/StringCallback.h 2017-05-19 18:07:49 UTC (rev 217134)
@@ -43,7 +43,7 @@
virtual bool handleEvent(const String& data) = 0;
// Helper to post callback task.
- void scheduleCallback(ScriptExecutionContext*, const String& data);
+ void scheduleCallback(ScriptExecutionContext&, const String& data);
};
} // namespace WebCore
Modified: trunk/Source/WebCore/dom/Traversal.cpp (217133 => 217134)
--- trunk/Source/WebCore/dom/Traversal.cpp 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/dom/Traversal.cpp 2017-05-19 18:07:49 UTC (rev 217134)
@@ -37,11 +37,11 @@
{
}
-short NodeIteratorBase::acceptNode(Node* node) const
+short NodeIteratorBase::acceptNode(Node& node) const
{
// The bit twiddling here is done to map DOM node types, which are given as integers from
// 1 through 14, to whatToShow bit masks.
- if (!(((1 << (node->nodeType() - 1)) & m_whatToShow)))
+ if (!(((1 << (node.nodeType() - 1)) & m_whatToShow)))
return NodeFilter::FILTER_SKIP;
if (!m_filter)
return NodeFilter::FILTER_ACCEPT;
Modified: trunk/Source/WebCore/dom/Traversal.h (217133 => 217134)
--- trunk/Source/WebCore/dom/Traversal.h 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/dom/Traversal.h 2017-05-19 18:07:49 UTC (rev 217134)
@@ -41,7 +41,7 @@
protected:
NodeIteratorBase(Node&, unsigned whatToShow, RefPtr<NodeFilter>&&);
- short acceptNode(Node*) const;
+ short acceptNode(Node&) const;
private:
Ref<Node> m_root;
Modified: trunk/Source/WebCore/dom/TreeWalker.cpp (217133 => 217134)
--- trunk/Source/WebCore/dom/TreeWalker.cpp 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/dom/TreeWalker.cpp 2017-05-19 18:07:49 UTC (rev 217134)
@@ -55,7 +55,7 @@
node = node->parentNode();
if (!node)
return nullptr;
- short acceptNodeResult = acceptNode(node.get());
+ short acceptNodeResult = acceptNode(*node);
if (acceptNodeResult == NodeFilter::FILTER_ACCEPT)
return setCurrent(node.releaseNonNull());
}
@@ -65,7 +65,7 @@
Node* TreeWalker::firstChild()
{
for (RefPtr<Node> node = m_current->firstChild(); node; ) {
- short acceptNodeResult = acceptNode(node.get());
+ short acceptNodeResult = acceptNode(*node);
switch (acceptNodeResult) {
case NodeFilter::FILTER_ACCEPT:
m_current = node.releaseNonNull();
@@ -96,7 +96,7 @@
Node* TreeWalker::lastChild()
{
for (RefPtr<Node> node = m_current->lastChild(); node; ) {
- short acceptNodeResult = acceptNode(node.get());
+ short acceptNodeResult = acceptNode(*node);
switch (acceptNodeResult) {
case NodeFilter::FILTER_ACCEPT:
m_current = node.releaseNonNull();
@@ -133,7 +133,7 @@
auto isNext = type == SiblingTraversalType::Next;
while (true) {
for (RefPtr<Node> sibling = isNext ? node->nextSibling() : node->previousSibling(); sibling; ) {
- short acceptNodeResult = acceptNode(sibling.get());
+ short acceptNodeResult = acceptNode(*sibling);
if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) {
m_current = sibling.releaseNonNull();
return m_current.ptr();
@@ -146,7 +146,7 @@
node = node->parentNode();
if (!node || node == &root())
return nullptr;
- short acceptNodeResult = acceptNode(node.get());
+ short acceptNodeResult = acceptNode(*node);
if (acceptNodeResult == NodeFilter::FILTER_ACCEPT)
return nullptr;
}
@@ -168,12 +168,12 @@
while (node != &root()) {
while (Node* previousSibling = node->previousSibling()) {
node = previousSibling;
- short acceptNodeResult = acceptNode(node.get());
+ short acceptNodeResult = acceptNode(*node);
if (acceptNodeResult == NodeFilter::FILTER_REJECT)
continue;
while (Node* lastChild = node->lastChild()) {
node = lastChild;
- acceptNodeResult = acceptNode(node.get());
+ acceptNodeResult = acceptNode(*node);
if (acceptNodeResult == NodeFilter::FILTER_REJECT)
break;
}
@@ -188,7 +188,7 @@
if (!parent)
return nullptr;
node = parent;
- short acceptNodeResult = acceptNode(node.get());
+ short acceptNodeResult = acceptNode(*node);
if (acceptNodeResult == NodeFilter::FILTER_ACCEPT)
return setCurrent(node.releaseNonNull());
}
@@ -201,7 +201,7 @@
Children:
while (Node* firstChild = node->firstChild()) {
node = firstChild;
- short acceptNodeResult = acceptNode(node.get());
+ short acceptNodeResult = acceptNode(*node);
if (acceptNodeResult == NodeFilter::FILTER_ACCEPT)
return setCurrent(node.releaseNonNull());
if (acceptNodeResult == NodeFilter::FILTER_REJECT)
@@ -209,7 +209,7 @@
}
while (Node* nextSibling = NodeTraversal::nextSkippingChildren(*node, &root())) {
node = nextSibling;
- short acceptNodeResult = acceptNode(node.get());
+ short acceptNodeResult = acceptNode(*node);
if (acceptNodeResult == NodeFilter::FILTER_ACCEPT)
return setCurrent(node.releaseNonNull());
if (acceptNodeResult == NodeFilter::FILTER_SKIP)
Modified: trunk/Source/WebCore/inspector/InspectorDatabaseAgent.cpp (217133 => 217134)
--- trunk/Source/WebCore/inspector/InspectorDatabaseAgent.cpp 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/inspector/InspectorDatabaseAgent.cpp 2017-05-19 18:07:49 UTC (rev 217134)
@@ -55,11 +55,11 @@
namespace {
-void reportTransactionFailed(ExecuteSQLCallback& requestCallback, SQLError* error)
+void reportTransactionFailed(ExecuteSQLCallback& requestCallback, SQLError& error)
{
auto errorObject = Inspector::Protocol::Database::Error::create()
- .setMessage(error->message())
- .setCode(error->code())
+ .setMessage(error.message())
+ .setCode(error.code())
.release();
requestCallback.sendSuccess(nullptr, nullptr, WTFMove(errorObject));
}
@@ -75,9 +75,9 @@
StatementCallback(Ref<ExecuteSQLCallback>&& requestCallback)
: m_requestCallback(WTFMove(requestCallback)) { }
- bool handleEvent(SQLTransaction*, SQLResultSet* resultSet) final
+ bool handleEvent(SQLTransaction&, SQLResultSet& resultSet) final
{
- auto& rowList = resultSet->rows();
+ auto& rowList = resultSet.rows();
auto columnNames = Inspector::Protocol::Array<String>::create();
for (auto& column : rowList.columnNames())
@@ -110,7 +110,7 @@
StatementErrorCallback(Ref<ExecuteSQLCallback>&& requestCallback)
: m_requestCallback(WTFMove(requestCallback)) { }
- bool handleEvent(SQLTransaction*, SQLError* error) final
+ bool handleEvent(SQLTransaction&, SQLError& error) final
{
reportTransactionFailed(m_requestCallback.copyRef(), error);
return true;
@@ -131,7 +131,7 @@
: m_sqlStatement(sqlStatement)
, m_requestCallback(WTFMove(requestCallback)) { }
- bool handleEvent(SQLTransaction* transaction) final
+ bool handleEvent(SQLTransaction& transaction) final
{
if (!m_requestCallback->isActive())
return true;
@@ -138,7 +138,7 @@
Ref<SQLStatementCallback> callback(StatementCallback::create(m_requestCallback.copyRef()));
Ref<SQLStatementErrorCallback> errorCallback(StatementErrorCallback::create(m_requestCallback.copyRef()));
- transaction->executeSql(m_sqlStatement, { }, WTFMove(callback), WTFMove(errorCallback));
+ transaction.executeSql(m_sqlStatement, { }, WTFMove(callback), WTFMove(errorCallback));
return true;
}
@@ -157,7 +157,7 @@
TransactionErrorCallback(Ref<ExecuteSQLCallback>&& requestCallback)
: m_requestCallback(WTFMove(requestCallback)) { }
- bool handleEvent(SQLError* error) final
+ bool handleEvent(SQLError& error) final
{
reportTransactionFailed(m_requestCallback.get(), error);
return true;
Modified: trunk/Source/WebCore/page/IntersectionObserverCallback.h (217133 => 217134)
--- trunk/Source/WebCore/page/IntersectionObserverCallback.h 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/page/IntersectionObserverCallback.h 2017-05-19 18:07:49 UTC (rev 217134)
@@ -38,7 +38,7 @@
class IntersectionObserverCallback : public RefCounted<IntersectionObserverCallback> {
public:
virtual ~IntersectionObserverCallback() { }
- virtual bool handleEvent(Vector<RefPtr<IntersectionObserverEntry>>, IntersectionObserver*) = 0;
+ virtual bool handleEvent(const Vector<RefPtr<IntersectionObserverEntry>>&, IntersectionObserver&) = 0;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/page/PerformanceObserver.cpp (217133 => 217134)
--- trunk/Source/WebCore/page/PerformanceObserver.cpp 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/page/PerformanceObserver.cpp 2017-05-19 18:07:49 UTC (rev 217134)
@@ -99,7 +99,7 @@
Vector<RefPtr<PerformanceEntry>> entries = WTFMove(m_entriesToDeliver);
auto list = PerformanceObserverEntryList::create(WTFMove(entries));
- m_callback->handleEvent(list.ptr(), this);
+ m_callback->handleEvent(list, *this);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/page/PerformanceObserverCallback.h (217133 => 217134)
--- trunk/Source/WebCore/page/PerformanceObserverCallback.h 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebCore/page/PerformanceObserverCallback.h 2017-05-19 18:07:49 UTC (rev 217134)
@@ -37,7 +37,7 @@
class PerformanceObserverCallback : public RefCounted<PerformanceObserverCallback> {
public:
virtual ~PerformanceObserverCallback() { }
- virtual bool handleEvent(PerformanceObserverEntryList*, PerformanceObserver*) = 0;
+ virtual bool handleEvent(PerformanceObserverEntryList&, PerformanceObserver&) = 0;
};
} // namespace WebCore
Modified: trunk/Source/WebKit/mac/ChangeLog (217133 => 217134)
--- trunk/Source/WebKit/mac/ChangeLog 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebKit/mac/ChangeLog 2017-05-19 18:07:49 UTC (rev 217134)
@@ -1,3 +1,14 @@
+2017-05-18 Sam Weinig <s...@webkit.org>
+
+ [WebIDL] Remove the need for the generator to know about native type mapping
+ https://bugs.webkit.org/show_bug.cgi?id=172310
+
+ Reviewed by Darin Adler.
+
+ * DOM/DOM.mm:
+ (-[DOMNodeFilter acceptNode:]):
+ Update to pass Node by reference.
+
2017-05-19 Yusuke Suzuki <utatane....@gmail.com>
[JSC][DFG][DOMJIT] Extend CheckDOM to CheckSubClass
Modified: trunk/Source/WebKit/mac/DOM/DOM.mm (217133 => 217134)
--- trunk/Source/WebKit/mac/DOM/DOM.mm 2017-05-19 18:06:36 UTC (rev 217133)
+++ trunk/Source/WebKit/mac/DOM/DOM.mm 2017-05-19 18:07:49 UTC (rev 217134)
@@ -27,6 +27,7 @@
#import "DOM.h"
+#import "ExceptionHandlers.h"
#import "DOMElementInternal.h"
#import "DOMHTMLCanvasElement.h"
#import "DOMHTMLTableCellElementInternal.h"
@@ -858,7 +859,9 @@
- (short)acceptNode:(DOMNode *)node
{
- return core(self)->acceptNode(core(node));
+ if (!node)
+ raiseTypeErrorException();
+ return core(self)->acceptNode(*core(node));
}
@end