https://bugs.webkit.org/show_bug.cgi?id=175244
Patch by Sam Weinig <sam@webkit.org> on 2017-08-09
Reviewed by Sam Weinig.
Source/JavaScriptCore:
* runtime/ArrayBuffer.cpp:
(JSC::ArrayBufferContents::transferTo):
Call reset(), rather than clear() to avoid the call to destroy() in clear(). The
destroy call needed to be a no-op anyway, since the data is being moved.
Source/WebCore:
* bindings/js/JSCustomElementInterface.h:
(WebCore::JSCustomElementInterface::invokeCallback):
Update the default value for the addArguments parameter to be an empty lambda, rather than
default initialization, which leads to a null WTF::Function. This allows us to remove support
for calling null WTF::Function. No change in behavior.
Source/WebKit:
* UIProcess/WebResourceLoadStatisticsStore.h:
Update the default value for the updateCookiePartitioningForDomainsHandler parameter to be an
empty lambda, rather than default initialization, which leads to a null WTF::Function. This allows
us to remove support for calling null WTF::Function. No change in behavior.
Source/WTF:
When Function, then NoncopyableFunction, was templatized to allow non-void return values
in r201493, it maintained the behavior of being callable even if the Function was null.
To accomplish this, when null, the default construction of the return parameter was used.
This means Function can't be used with return types that are not default constructible,
such as reference types and Ref.
This behavior of returning something when null is surprising, as this is not how normal
functions behave, and not very useful. Instead, we now assert that the function is not
null when being called.
* wtf/Function.h:
(WTF::Function operator(...)):
Instead of allowing a null callable wrapper by returning the default construction of
the return type, assert that the wrapper is there when calling a Function.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220477
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2017-08-09 Sam Weinig <sam@webkit.org>
+
+ WTF::Function does not allow for reference / non-default constructible return types
+ https://bugs.webkit.org/show_bug.cgi?id=175244
+
+ Reviewed by Sam Weinig.
+
+ * runtime/ArrayBuffer.cpp:
+ (JSC::ArrayBufferContents::transferTo):
+ Call reset(), rather than clear() to avoid the call to destroy() in clear(). The
+ destroy call needed to be a no-op anyway, since the data is being moved.
+
2017-08-09 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS DnD] ENABLE_DRAG_SUPPORT should be turned off for iOS 10 and enabled by default
other.m_sizeInBytes = m_sizeInBytes;
other.m_destructor = WTFMove(m_destructor);
other.m_shared = m_shared;
- clear();
+ reset();
}
void ArrayBufferContents::copyTo(ArrayBufferContents& other)
+2017-08-09 Sam Weinig <sam@webkit.org>
+
+ WTF::Function does not allow for reference / non-default constructible return types
+ https://bugs.webkit.org/show_bug.cgi?id=175244
+
+ Reviewed by Sam Weinig.
+
+ When Function, then NoncopyableFunction, was templatized to allow non-void return values
+ in r201493, it maintained the behavior of being callable even if the Function was null.
+ To accomplish this, when null, the default construction of the return parameter was used.
+ This means Function can't be used with return types that are not default constructible,
+ such as reference types and Ref.
+
+ This behavior of returning something when null is surprising, as this is not how normal
+ functions behave, and not very useful. Instead, we now assert that the function is not
+ null when being called.
+
+ * wtf/Function.h:
+ (WTF::Function operator(...)):
+ Instead of allowing a null callable wrapper by returning the default construction of
+ the return type, assert that the wrapper is there when calling a Function.
+
2017-08-09 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, rolling out r220457.
Out operator()(In... in) const
{
- if (m_callableWrapper)
- return m_callableWrapper->call(std::forward<In>(in)...);
- return Out();
+ ASSERT(m_callableWrapper);
+ return m_callableWrapper->call(std::forward<In>(in)...);
}
explicit operator bool() const { return !!m_callableWrapper; }
+2017-08-09 Sam Weinig <sam@webkit.org>
+
+ WTF::Function does not allow for reference / non-default constructible return types
+ https://bugs.webkit.org/show_bug.cgi?id=175244
+
+ Reviewed by Sam Weinig.
+
+ * bindings/js/JSCustomElementInterface.h:
+ (WebCore::JSCustomElementInterface::invokeCallback):
+ Update the default value for the addArguments parameter to be an empty lambda, rather than
+ default initialization, which leads to a null WTF::Function. This allows us to remove support
+ for calling null WTF::Function. No change in behavior.
+
2017-08-09 Brady Eidson <beidson@apple.com>
Teach ScriptExecutionContexts about their SessionID.
RefPtr<Element> tryToConstructCustomElement(Document&, const AtomicString&);
- void invokeCallback(Element&, JSC::JSObject* callback, const WTF::Function<void(JSC::ExecState*, JSDOMGlobalObject*, JSC::MarkedArgumentBuffer&)>& addArguments = { });
+ void invokeCallback(Element&, JSC::JSObject* callback, const WTF::Function<void(JSC::ExecState*, JSDOMGlobalObject*, JSC::MarkedArgumentBuffer&)>& addArguments = [](JSC::ExecState*, JSDOMGlobalObject*, JSC::MarkedArgumentBuffer&) { });
QualifiedName m_name;
JSC::Weak<JSC::JSObject> m_constructor;
+2017-08-09 Sam Weinig <sam@webkit.org>
+
+ WTF::Function does not allow for reference / non-default constructible return types
+ https://bugs.webkit.org/show_bug.cgi?id=175244
+
+ Reviewed by Sam Weinig.
+
+ * UIProcess/WebResourceLoadStatisticsStore.h:
+ Update the default value for the updateCookiePartitioningForDomainsHandler parameter to be an
+ empty lambda, rather than default initialization, which leads to a null WTF::Function. This allows
+ us to remove support for calling null WTF::Function. No change in behavior.
+
2017-08-09 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS DnD] ENABLE_DRAG_SUPPORT should be turned off for iOS 10 and enabled by default
class WebResourceLoadStatisticsStore final : public IPC::Connection::WorkQueueMessageReceiver {
public:
using UpdateCookiePartitioningForDomainsHandler = WTF::Function<void(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, ShouldClearFirst)>;
- static Ref<WebResourceLoadStatisticsStore> create(const String& resourceLoadStatisticsDirectory, Function<void (const String&)>&& testingCallback, UpdateCookiePartitioningForDomainsHandler&& updateCookiePartitioningForDomainsHandler = { })
+ static Ref<WebResourceLoadStatisticsStore> create(const String& resourceLoadStatisticsDirectory, Function<void (const String&)>&& testingCallback, UpdateCookiePartitioningForDomainsHandler&& updateCookiePartitioningForDomainsHandler = [](const Vector<String>&, const Vector<String>&, ShouldClearFirst) { })
{
return adoptRef(*new WebResourceLoadStatisticsStore(resourceLoadStatisticsDirectory, WTFMove(testingCallback), WTFMove(updateCookiePartitioningForDomainsHandler)));
}