Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (226077 => 226078)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2017-12-18 21:51:36 UTC (rev 226077)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2017-12-18 21:56:54 UTC (rev 226078)
@@ -1,3 +1,14 @@
+2017-12-18 Chris Dumez <cdu...@apple.com>
+
+ ExtendableMessageEvent.data should return the value it was initialized to
+ https://bugs.webkit.org/show_bug.cgi?id=180868
+
+ Reviewed by Geoffrey Garen.
+
+ Rebaseline WPT test now that one more subtest is passing.
+
+ * web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/extendable-message-event-constructor.https-expected.txt:
+
2017-12-18 Youenn Fablet <you...@apple.com>
Add support for response blob given to fetch events
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/extendable-message-event-constructor.https-expected.txt (226077 => 226078)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/extendable-message-event-constructor.https-expected.txt 2017-12-18 21:51:36 UTC (rev 226077)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/extendable-message-event-constructor.https-expected.txt 2017-12-18 21:56:54 UTC (rev 226078)
@@ -3,11 +3,11 @@
PASS no initializer specified
PASS `bubbles` is specified
PASS `cancelable` is specified
-FAIL `data` is specified assert_equals: expected object "[object Object]" but got object "[object Object]"
+PASS `data` is specified
PASS `origin` is specified
PASS `lastEventId` is specified
FAIL `source` is specified assert_equals: expected object "[object MessagePort]" but got null
FAIL `ports` is specified assert_throws: function "function () {
createEvent({ get ports() { throw { name: 'Error' }; } }); }" threw object "TypeError: Value is not a sequence" ("TypeError") expected object "[object Object]" ("Error")
-FAIL all initial values are specified assert_equals: expected object "[object Object]" but got object "[object Object]"
+FAIL all initial values are specified assert_equals: expected object "[object MessagePort]" but got null
Modified: trunk/Source/WebCore/ChangeLog (226077 => 226078)
--- trunk/Source/WebCore/ChangeLog 2017-12-18 21:51:36 UTC (rev 226077)
+++ trunk/Source/WebCore/ChangeLog 2017-12-18 21:56:54 UTC (rev 226078)
@@ -1,3 +1,18 @@
+2017-12-18 Chris Dumez <cdu...@apple.com>
+
+ ExtendableMessageEvent.data should return the value it was initialized to
+ https://bugs.webkit.org/show_bug.cgi?id=180868
+
+ Reviewed by Geoffrey Garen.
+
+ No new tests, rebaselined existing test.
+
+ * bindings/js/JSExtendableMessageEventCustom.cpp:
+ (WebCore::constructJSExtendableMessageEvent):
+ * workers/service/ExtendableMessageEvent.cpp:
+ (WebCore::ExtendableMessageEvent::ExtendableMessageEvent):
+ * workers/service/ExtendableMessageEvent.idl:
+
2017-12-18 Megan Gardner <megan_gard...@apple.com>
Support Autoscrolling in contenteditable for WK2
Modified: trunk/Source/WebCore/bindings/js/JSExtendableMessageEventCustom.cpp (226077 => 226078)
--- trunk/Source/WebCore/bindings/js/JSExtendableMessageEventCustom.cpp 2017-12-18 21:51:36 UTC (rev 226077)
+++ trunk/Source/WebCore/bindings/js/JSExtendableMessageEventCustom.cpp 2017-12-18 21:56:54 UTC (rev 226078)
@@ -28,10 +28,41 @@
#if ENABLE(SERVICE_WORKER)
#include "JSExtendableMessageEvent.h"
+#include "JSDOMConstructor.h"
+
namespace WebCore {
using namespace JSC;
+JSC::EncodedJSValue constructJSExtendableMessageEvent(JSC::ExecState& state)
+{
+ VM& vm = state.vm();
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ UNUSED_PARAM(throwScope);
+
+ auto* jsConstructor = jsCast<JSDOMConstructorBase*>(state.jsCallee());
+ ASSERT(jsConstructor);
+ if (UNLIKELY(state.argumentCount() < 1))
+ return throwVMError(&state, throwScope, createNotEnoughArgumentsError(&state));
+ auto type = convert<IDLDOMString>(state, state.uncheckedArgument(0));
+ RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+ auto eventInitDict = convert<IDLDictionary<ExtendableMessageEvent::Init>>(state, state.argument(1));
+ RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+
+ JSValue data = ""
+ auto object = ExtendableMessageEvent::create(state, WTFMove(type), WTFMove(eventInitDict));
+ RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+
+ JSValue wrapper = toJSNewlyCreated<IDLInterface<ExtendableMessageEvent>>(state, *jsConstructor->globalObject(), WTFMove(object));
+
+ // Cache the JSValue passed in for data parameter in the wrapper so the getter returns the exact value
+ // it was initialized too. We do not store the JSValue in the implementation object to avoid leaks.
+ auto* jsMessageEvent = jsCast<JSExtendableMessageEvent*>(wrapper);
+ jsMessageEvent->m_data.set(state.vm(), jsMessageEvent, data);
+
+ return JSValue::encode(wrapper);
+}
+
JSValue JSExtendableMessageEvent::data(ExecState& state) const
{
if (JSValue cachedValue = m_data.get()) {
Modified: trunk/Source/WebCore/workers/service/ExtendableMessageEvent.cpp (226077 => 226078)
--- trunk/Source/WebCore/workers/service/ExtendableMessageEvent.cpp 2017-12-18 21:51:36 UTC (rev 226077)
+++ trunk/Source/WebCore/workers/service/ExtendableMessageEvent.cpp 2017-12-18 21:56:54 UTC (rev 226078)
@@ -39,7 +39,7 @@
ExtendableMessageEvent::ExtendableMessageEvent(JSC::ExecState& state, const AtomicString& type, const Init& init, IsTrusted isTrusted)
: ExtendableEvent(type, init, isTrusted)
- , m_data(SerializedScriptValue::create(state, init.data))
+ , m_data(SerializedScriptValue::create(state, init.data, SerializationErrorMode::NonThrowing))
, m_origin(init.origin)
, m_lastEventId(init.lastEventId)
, m_ports(init.ports)
Modified: trunk/Source/WebCore/workers/service/ExtendableMessageEvent.idl (226077 => 226078)
--- trunk/Source/WebCore/workers/service/ExtendableMessageEvent.idl 2017-12-18 21:51:36 UTC (rev 226077)
+++ trunk/Source/WebCore/workers/service/ExtendableMessageEvent.idl 2017-12-18 21:56:54 UTC (rev 226078)
@@ -24,11 +24,11 @@
*/
[
- Constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict),
- ConstructorCallWith=ScriptState,
+ CustomConstructor(DOMString type, optional ExtendableMessageEventInit eventInitDict),
Conditional=SERVICE_WORKER,
EnabledAtRuntime=ServiceWorker,
Exposed=ServiceWorker,
+ JSGenerateToJSObject,
] interface ExtendableMessageEvent : ExtendableEvent {
[CachedAttribute, CustomGetter] readonly attribute any data;
readonly attribute USVString origin;