Diff
Modified: trunk/LayoutTests/ChangeLog (207237 => 207238)
--- trunk/LayoutTests/ChangeLog 2016-10-12 20:38:37 UTC (rev 207237)
+++ trunk/LayoutTests/ChangeLog 2016-10-12 20:41:49 UTC (rev 207238)
@@ -1,3 +1,17 @@
+2016-10-12 Chris Dumez <cdu...@apple.com>
+
+ Update more events to stop using legacy [ConstructorTemplate=Event]
+ https://bugs.webkit.org/show_bug.cgi?id=163339
+
+ Reviewed by Ryosuke Niwa.
+
+ Update existing tests to reflect minor behavior changes.
+
+ * fast/events/constructors/storage-event-constructor-expected.txt:
+ * fast/events/constructors/storage-event-constructor.html:
+ * fast/events/constructors/webgl-context-event-constructor-expected.txt:
+ * fast/events/constructors/webgl-context-event-constructor.html:
+
2016-10-12 Joseph Pecoraro <pecor...@apple.com>
Web Inspector: Improve support for logging Proxy objects in console
Modified: trunk/LayoutTests/fast/events/constructors/storage-event-constructor-expected.txt (207237 => 207238)
--- trunk/LayoutTests/fast/events/constructors/storage-event-constructor-expected.txt 2016-10-12 20:38:37 UTC (rev 207237)
+++ trunk/LayoutTests/fast/events/constructors/storage-event-constructor-expected.txt 2016-10-12 20:41:49 UTC (rev 207238)
@@ -5,7 +5,7 @@
PASS new StorageEvent('eventType').bubbles is false
PASS new StorageEvent('eventType').cancelable is false
-PASS new StorageEvent('eventType').key is ""
+PASS new StorageEvent('eventType').key is null
PASS new StorageEvent('eventType').oldValue is null
PASS new StorageEvent('eventType').newValue is null
PASS new StorageEvent('eventType').url is ""
@@ -16,8 +16,8 @@
PASS new StorageEvent('eventType', { cancelable: true }).cancelable is true
PASS new StorageEvent('eventType', { key: 'abcde' }).key is "abcde"
PASS new StorageEvent('eventType', { key: '' }).key is ""
-PASS new StorageEvent('eventType', { key: undefined }).key is "undefined"
-PASS new StorageEvent('eventType', { key: null }).key is "null"
+PASS new StorageEvent('eventType', { key: undefined }).key is null
+PASS new StorageEvent('eventType', { key: null }).key is null
PASS new StorageEvent('eventType', { key: false }).key is "false"
PASS new StorageEvent('eventType', { key: true }).key is "true"
PASS new StorageEvent('eventType', { key: 12345 }).key is "12345"
@@ -29,8 +29,8 @@
PASS new StorageEvent('eventType', { key: {valueOf: function () { return 'abcde'; } } }).key is "[object Object]"
PASS new StorageEvent('eventType', { oldValue: 'abcde' }).oldValue is "abcde"
PASS new StorageEvent('eventType', { oldValue: '' }).oldValue is ""
-PASS new StorageEvent('eventType', { oldValue: undefined }).oldValue is "undefined"
-PASS new StorageEvent('eventType', { oldValue: null }).oldValue is "null"
+PASS new StorageEvent('eventType', { oldValue: undefined }).oldValue is null
+PASS new StorageEvent('eventType', { oldValue: null }).oldValue is null
PASS new StorageEvent('eventType', { oldValue: false }).oldValue is "false"
PASS new StorageEvent('eventType', { oldValue: true }).oldValue is "true"
PASS new StorageEvent('eventType', { oldValue: 12345 }).oldValue is "12345"
@@ -42,8 +42,8 @@
PASS new StorageEvent('eventType', { oldValue: {valueOf: function () { return 'abcde'; } } }).oldValue is "[object Object]"
PASS new StorageEvent('eventType', { newValue: 'abcde' }).newValue is "abcde"
PASS new StorageEvent('eventType', { newValue: '' }).newValue is ""
-PASS new StorageEvent('eventType', { newValue: undefined }).newValue is "undefined"
-PASS new StorageEvent('eventType', { newValue: null }).newValue is "null"
+PASS new StorageEvent('eventType', { newValue: undefined }).newValue is null
+PASS new StorageEvent('eventType', { newValue: null }).newValue is null
PASS new StorageEvent('eventType', { newValue: false }).newValue is "false"
PASS new StorageEvent('eventType', { newValue: true }).newValue is "true"
PASS new StorageEvent('eventType', { newValue: 12345 }).newValue is "12345"
@@ -55,7 +55,7 @@
PASS new StorageEvent('eventType', { newValue: {valueOf: function () { return 'abcde'; } } }).newValue is "[object Object]"
PASS new StorageEvent('eventType', { url: 'abcde' }).url is "abcde"
PASS new StorageEvent('eventType', { url: '' }).url is ""
-PASS new StorageEvent('eventType', { url: undefined }).url is "undefined"
+PASS new StorageEvent('eventType', { url: undefined }).url is ""
PASS new StorageEvent('eventType', { url: null }).url is "null"
PASS new StorageEvent('eventType', { url: false }).url is "false"
PASS new StorageEvent('eventType', { url: true }).url is "true"
@@ -68,20 +68,20 @@
PASS new StorageEvent('eventType', { url: {valueOf: function () { return 'abcde'; } } }).url is "[object Object]"
PASS new StorageEvent('eventType', { storageArea: localStorage }).storageArea is localStorage
PASS new StorageEvent('eventType', { storageArea: sessionStorage }).storageArea is sessionStorage
-PASS new StorageEvent('eventType', { storageArea: test_object }).storageArea is null
-PASS new StorageEvent('eventType', { storageArea: window }).storageArea is null
-PASS new StorageEvent('eventType', { storageArea: document }).storageArea is null
+PASS new StorageEvent('eventType', { storageArea: test_object }) threw exception TypeError: Type error.
+PASS new StorageEvent('eventType', { storageArea: window }) threw exception TypeError: Type error.
+PASS new StorageEvent('eventType', { storageArea: document }) threw exception TypeError: Type error.
PASS new StorageEvent('eventType', { storageArea: undefined }).storageArea is null
PASS new StorageEvent('eventType', { storageArea: null }).storageArea is null
-PASS new StorageEvent('eventType', { storageArea: false }).storageArea is null
-PASS new StorageEvent('eventType', { storageArea: true }).storageArea is null
-PASS new StorageEvent('eventType', { storageArea: '' }).storageArea is null
-PASS new StorageEvent('eventType', { storageArea: 'chocolate' }).storageArea is null
-PASS new StorageEvent('eventType', { storageArea: 12345 }).storageArea is null
-PASS new StorageEvent('eventType', { storageArea: 18446744073709551615 }).storageArea is null
-PASS new StorageEvent('eventType', { storageArea: NaN }).storageArea is null
-PASS new StorageEvent('eventType', { storageArea: {valueOf: function () { return window; } } }).storageArea == window is false
-PASS new StorageEvent('eventType', { get storageArea() { return 123; } }).storageArea is null
+PASS new StorageEvent('eventType', { storageArea: false }) threw exception TypeError: Type error.
+PASS new StorageEvent('eventType', { storageArea: true }) threw exception TypeError: Type error.
+PASS new StorageEvent('eventType', { storageArea: '' }) threw exception TypeError: Type error.
+PASS new StorageEvent('eventType', { storageArea: 'chocolate' }) threw exception TypeError: Type error.
+PASS new StorageEvent('eventType', { storageArea: 12345 }) threw exception TypeError: Type error.
+PASS new StorageEvent('eventType', { storageArea: 18446744073709551615 }) threw exception TypeError: Type error.
+PASS new StorageEvent('eventType', { storageArea: NaN }) threw exception TypeError: Type error.
+PASS new StorageEvent('eventType', { storageArea: {valueOf: function () { return window; } } }) threw exception TypeError: Type error.
+PASS new StorageEvent('eventType', { get storageArea() { return 123; } }).storageArea threw exception TypeError: Type error.
PASS new StorageEvent('eventType', { get storageArea() { throw 'StorageEvent Error'; } }) threw exception StorageEvent Error.
PASS new StorageEvent('eventType', { bubbles: true, cancelable: false, key: 'abc', oldValue: 'def', newValue: 'ghi', url: 'jkl', storageArea: localStorage }).bubbles is true
PASS new StorageEvent('eventType', { bubbles: false, cancelable: true, key: 'abc', oldValue: 'def', newValue: 'ghi', url: 'jkl', storageArea: localStorage }).cancelable is true
Modified: trunk/LayoutTests/fast/events/constructors/storage-event-constructor.html (207237 => 207238)
--- trunk/LayoutTests/fast/events/constructors/storage-event-constructor.html 2016-10-12 20:38:37 UTC (rev 207237)
+++ trunk/LayoutTests/fast/events/constructors/storage-event-constructor.html 2016-10-12 20:41:49 UTC (rev 207238)
@@ -13,7 +13,7 @@
// No initializer is passed.
shouldBe("new StorageEvent('eventType').bubbles", "false");
shouldBe("new StorageEvent('eventType').cancelable", "false");
-shouldBeEqualToString("new StorageEvent('eventType').key", "");
+shouldBe("new StorageEvent('eventType').key", "null");
// Note: oldValue is nullable.
shouldBe("new StorageEvent('eventType').oldValue", "null");
// Note: newValue is nullable.
@@ -36,8 +36,14 @@
shouldBeEqualToString("new StorageEvent('eventType', { " + attr + ": '' })." + attr, "");
// Non-strings.
- shouldBeEqualToString("new StorageEvent('eventType', { " + attr + ": undefined })." + attr, "undefined");
- shouldBeEqualToString("new StorageEvent('eventType', { " + attr + ": null })." + attr, "null");
+ if (attr == "key" || attr == "oldValue" || attr == "newValue") {
+ // Those members are nullable.
+ shouldBe("new StorageEvent('eventType', { " + attr + ": undefined })." + attr, "null");
+ shouldBe("new StorageEvent('eventType', { " + attr + ": null })." + attr, "null");
+ } else {
+ shouldBeEqualToString("new StorageEvent('eventType', { " + attr + ": undefined })." + attr, "");
+ shouldBeEqualToString("new StorageEvent('eventType', { " + attr + ": null })." + attr, "null");
+ }
shouldBeEqualToString("new StorageEvent('eventType', { " + attr + ": false })." + attr, "false");
shouldBeEqualToString("new StorageEvent('eventType', { " + attr + ": true })." + attr, "true");
shouldBeEqualToString("new StorageEvent('eventType', { " + attr + ": 12345 })." + attr, "12345");
@@ -56,21 +62,21 @@
// Non-Storage objects.
var test_object = {abc: 123};
-shouldBe("new StorageEvent('eventType', { storageArea: test_object }).storageArea", "null");
-shouldBe("new StorageEvent('eventType', { storageArea: window }).storageArea", "null");
-shouldBe("new StorageEvent('eventType', { storageArea: document }).storageArea", "null");
+shouldThrowErrorName("new StorageEvent('eventType', { storageArea: test_object })", "TypeError");
+shouldThrowErrorName("new StorageEvent('eventType', { storageArea: window })", "TypeError");
+shouldThrowErrorName("new StorageEvent('eventType', { storageArea: document })", "TypeError");
shouldBe("new StorageEvent('eventType', { storageArea: undefined }).storageArea", "null");
shouldBe("new StorageEvent('eventType', { storageArea: null }).storageArea", "null");
-shouldBe("new StorageEvent('eventType', { storageArea: false }).storageArea", "null");
-shouldBe("new StorageEvent('eventType', { storageArea: true }).storageArea", "null");
-shouldBe("new StorageEvent('eventType', { storageArea: '' }).storageArea", "null");
-shouldBe("new StorageEvent('eventType', { storageArea: 'chocolate' }).storageArea", "null");
-shouldBe("new StorageEvent('eventType', { storageArea: 12345 }).storageArea", "null");
-shouldBe("new StorageEvent('eventType', { storageArea: 18446744073709551615 }).storageArea", "null");
-shouldBe("new StorageEvent('eventType', { storageArea: NaN }).storageArea", "null");
+shouldThrowErrorName("new StorageEvent('eventType', { storageArea: false })", "TypeError");
+shouldThrowErrorName("new StorageEvent('eventType', { storageArea: true })", "TypeError");
+shouldThrowErrorName("new StorageEvent('eventType', { storageArea: '' })", "TypeError");
+shouldThrowErrorName("new StorageEvent('eventType', { storageArea: 'chocolate' })", "TypeError");
+shouldThrowErrorName("new StorageEvent('eventType', { storageArea: 12345 })", "TypeError");
+shouldThrowErrorName("new StorageEvent('eventType', { storageArea: 18446744073709551615 })", "TypeError");
+shouldThrowErrorName("new StorageEvent('eventType', { storageArea: NaN })", "TypeError");
// Note that valueOf() is not called, when the left hand side is evaluated.
-shouldBeFalse("new StorageEvent('eventType', { storageArea: {valueOf: function () { return window; } } }).storageArea == window");
-shouldBe("new StorageEvent('eventType', { get storageArea() { return 123; } }).storageArea", "null");
+shouldThrowErrorName("new StorageEvent('eventType', { storageArea: {valueOf: function () { return window; } } })", "TypeError");
+shouldThrowErrorName("new StorageEvent('eventType', { get storageArea() { return 123; } }).storageArea", "TypeError");
shouldThrow("new StorageEvent('eventType', { get storageArea() { throw 'StorageEvent Error'; } })");
// All initializers are passed.
Modified: trunk/LayoutTests/fast/events/constructors/webgl-context-event-constructor-expected.txt (207237 => 207238)
--- trunk/LayoutTests/fast/events/constructors/webgl-context-event-constructor-expected.txt 2016-10-12 20:38:37 UTC (rev 207237)
+++ trunk/LayoutTests/fast/events/constructors/webgl-context-event-constructor-expected.txt 2016-10-12 20:41:49 UTC (rev 207238)
@@ -12,7 +12,7 @@
PASS new WebGLContextEvent('eventType', { cancelable: true }).cancelable is true
PASS new WebGLContextEvent('eventType', { statusMessage: 'abcde' }).statusMessage is "abcde"
PASS new WebGLContextEvent('eventType', { statusMessage: '' }).statusMessage is ""
-PASS new WebGLContextEvent('eventType', { statusMessage: undefined }).statusMessage is "undefined"
+PASS new WebGLContextEvent('eventType', { statusMessage: undefined }).statusMessage is ""
PASS new WebGLContextEvent('eventType', { statusMessage: null }).statusMessage is "null"
PASS new WebGLContextEvent('eventType', { statusMessage: false }).statusMessage is "false"
PASS new WebGLContextEvent('eventType', { statusMessage: true }).statusMessage is "true"
Modified: trunk/LayoutTests/fast/events/constructors/webgl-context-event-constructor.html (207237 => 207238)
--- trunk/LayoutTests/fast/events/constructors/webgl-context-event-constructor.html 2016-10-12 20:38:37 UTC (rev 207237)
+++ trunk/LayoutTests/fast/events/constructors/webgl-context-event-constructor.html 2016-10-12 20:41:49 UTC (rev 207238)
@@ -29,7 +29,7 @@
shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: '' }).statusMessage", "");
// Non-strings.
-shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: undefined }).statusMessage", "undefined");
+shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: undefined }).statusMessage", "");
shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: null }).statusMessage", "null");
shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: false }).statusMessage", "false");
shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: true }).statusMessage", "true");
Modified: trunk/LayoutTests/storage/domstorage/events/basic-expected.txt (207237 => 207238)
--- trunk/LayoutTests/storage/domstorage/events/basic-expected.txt 2016-10-12 20:38:37 UTC (rev 207237)
+++ trunk/LayoutTests/storage/domstorage/events/basic-expected.txt 2016-10-12 20:41:49 UTC (rev 207238)
@@ -42,7 +42,7 @@
PASS storageEventList[6].newValue is null
storage.clear()
PASS storageEventList.length is 8
-PASS storageEventList[7].key is ""
+PASS storageEventList[7].key is null
PASS storageEventList[7].oldValue is null
PASS storageEventList[7].newValue is null
@@ -86,7 +86,7 @@
PASS storageEventList[6].newValue is null
storage.clear()
PASS storageEventList.length is 8
-PASS storageEventList[7].key is ""
+PASS storageEventList[7].key is null
PASS storageEventList[7].oldValue is null
PASS storageEventList[7].newValue is null
Modified: trunk/LayoutTests/storage/domstorage/events/basic-setattribute-expected.txt (207237 => 207238)
--- trunk/LayoutTests/storage/domstorage/events/basic-setattribute-expected.txt 2016-10-12 20:38:37 UTC (rev 207237)
+++ trunk/LayoutTests/storage/domstorage/events/basic-setattribute-expected.txt 2016-10-12 20:41:49 UTC (rev 207238)
@@ -44,7 +44,7 @@
PASS storageEventList[6].newValue is null
storage.clear()
PASS storageEventList.length is 8
-PASS storageEventList[7].key is ""
+PASS storageEventList[7].key is null
PASS storageEventList[7].oldValue is null
PASS storageEventList[7].newValue is null
@@ -90,7 +90,7 @@
PASS storageEventList[6].newValue is null
storage.clear()
PASS storageEventList.length is 8
-PASS storageEventList[7].key is ""
+PASS storageEventList[7].key is null
PASS storageEventList[7].oldValue is null
PASS storageEventList[7].newValue is null
Modified: trunk/LayoutTests/storage/domstorage/events/script-tests/basic-setattribute.js (207237 => 207238)
--- trunk/LayoutTests/storage/domstorage/events/script-tests/basic-setattribute.js 2016-10-12 20:38:37 UTC (rev 207237)
+++ trunk/LayoutTests/storage/domstorage/events/script-tests/basic-setattribute.js 2016-10-12 20:41:49 UTC (rev 207238)
@@ -86,7 +86,7 @@
function step6()
{
shouldBe("storageEventList.length", "8");
- shouldBeEqualToString("storageEventList[7].key", "");
+ shouldBeNull("storageEventList[7].key");
shouldBeNull("storageEventList[7].oldValue");
shouldBeNull("storageEventList[7].newValue");
Modified: trunk/LayoutTests/storage/domstorage/events/script-tests/basic.js (207237 => 207238)
--- trunk/LayoutTests/storage/domstorage/events/script-tests/basic.js 2016-10-12 20:38:37 UTC (rev 207237)
+++ trunk/LayoutTests/storage/domstorage/events/script-tests/basic.js 2016-10-12 20:41:49 UTC (rev 207238)
@@ -86,7 +86,7 @@
function step6()
{
shouldBe("storageEventList.length", "8");
- shouldBeEqualToString("storageEventList[7].key", "");
+ shouldBeNull("storageEventList[7].key");
shouldBeNull("storageEventList[7].oldValue");
shouldBeNull("storageEventList[7].newValue");
Modified: trunk/Source/WebCore/ChangeLog (207237 => 207238)
--- trunk/Source/WebCore/ChangeLog 2016-10-12 20:38:37 UTC (rev 207237)
+++ trunk/Source/WebCore/ChangeLog 2016-10-12 20:41:49 UTC (rev 207238)
@@ -1,3 +1,46 @@
+2016-10-12 Chris Dumez <cdu...@apple.com>
+
+ Update more events to stop using legacy [ConstructorTemplate=Event]
+ https://bugs.webkit.org/show_bug.cgi?id=163339
+
+ Reviewed by Ryosuke Niwa.
+
+ Update more events to stop using legacy [ConstructorTemplate=Event]
+ and use regular constructors instead.
+
+ No new tests, updated existing tests.
+
+ * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
+ (WebCore::convertDictionary<TestEventConstructor::Init>):
+ (WebCore::JSTestEventConstructorConstructor::construct):
+ (WebCore::JSTestEventConstructorConstructor::prototypeForStructure):
+ (WebCore::JSTestEventConstructor::JSTestEventConstructor):
+ (WebCore::JSTestEventConstructor::createPrototype):
+ (WebCore::JSTestEventConstructorPrototype::create): Deleted.
+ (WebCore::JSTestEventConstructorPrototype::createStructure): Deleted.
+ (WebCore::JSTestEventConstructorPrototype::JSTestEventConstructorPrototype): Deleted.
+ (WebCore::setJSTestEventConstructorConstructor): Deleted.
+ (WebCore::JSTestEventConstructor::getConstructor): Deleted.
+ * bindings/scripts/test/JS/JSTestEventConstructor.h:
+ (WebCore::JSTestEventConstructor::wrapped):
+ (WebCore::JSTestEventConstructor::create): Deleted.
+ (WebCore::toJS): Deleted.
+ (WebCore::toJSNewlyCreated): Deleted.
+ * bindings/scripts/test/TestEventConstructor.idl:
+ * css/CSSFontFaceLoadEvent.cpp:
+ (WebCore::CSSFontFaceLoadEvent::CSSFontFaceLoadEvent):
+ * css/CSSFontFaceLoadEvent.h:
+ * css/CSSFontFaceLoadEvent.idl:
+ * html/canvas/WebGLContextEvent.cpp:
+ (WebCore::WebGLContextEvent::WebGLContextEvent):
+ * html/canvas/WebGLContextEvent.h:
+ * html/canvas/WebGLContextEvent.idl:
+ * storage/StorageEvent.cpp:
+ (WebCore::StorageEvent::create):
+ (WebCore::StorageEvent::StorageEvent):
+ * storage/StorageEvent.h:
+ * storage/StorageEvent.idl:
+
2016-10-12 Andreas Kling <akl...@apple.com>
Make Document::existingAXObjectCache() fast with accessibility disabled.
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp (207237 => 207238)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp 2016-10-12 20:38:37 UTC (rev 207237)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp 2016-10-12 20:41:49 UTC (rev 207238)
@@ -21,12 +21,11 @@
#include "config.h"
#include "JSTestEventConstructor.h"
+#include "ExceptionCode.h"
#include "JSDOMBinding.h"
#include "JSDOMConstructor.h"
-#include "JSDictionary.h"
#include "URL.h"
#include <runtime/Error.h>
-#include <runtime/FunctionPrototype.h>
#include <runtime/JSString.h>
#include <wtf/GetPtr.h>
@@ -34,6 +33,54 @@
namespace WebCore {
+template<> Optional<TestEventConstructor::Init> convertDictionary<TestEventConstructor::Init>(ExecState& state, JSValue value)
+{
+ VM& vm = state.vm();
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ bool isNullOrUndefined = value.isUndefinedOrNull();
+ auto* object = isNullOrUndefined ? nullptr : value.getObject();
+ if (UNLIKELY(!isNullOrUndefined && !object)) {
+ throwTypeError(&state, throwScope);
+ return Nullopt;
+ }
+ if (UNLIKELY(object && object->type() == RegExpObjectType)) {
+ throwTypeError(&state, throwScope);
+ return Nullopt;
+ }
+ TestEventConstructor::Init result;
+ JSValue bubblesValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "bubbles"));
+ if (!bubblesValue.isUndefined()) {
+ result.bubbles = convert<IDLBoolean>(state, bubblesValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ result.bubbles = false;
+ JSValue cancelableValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "cancelable"));
+ if (!cancelableValue.isUndefined()) {
+ result.cancelable = convert<IDLBoolean>(state, cancelableValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ result.cancelable = false;
+ JSValue composedValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "composed"));
+ if (!composedValue.isUndefined()) {
+ result.composed = convert<IDLBoolean>(state, composedValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ result.composed = false;
+ JSValue attr2Value = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "attr2"));
+ if (!attr2Value.isUndefined()) {
+ result.attr2 = convert<IDLDOMString>(state, attr2Value);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ result.attr2 = "";
+ JSValue attr3Value = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "attr3"));
+ if (!attr3Value.isUndefined()) {
+ result.attr3 = convert<IDLDOMString>(state, attr3Value);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ result.attr3 = "";
+ return WTFMove(result);
+}
+
// Attributes
JSC::EncodedJSValue jsTestEventConstructorAttr1(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
@@ -75,53 +122,22 @@
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
- auto* jsConstructor = jsCast<JSTestEventConstructorConstructor*>(state->callee());
- ASSERT(jsConstructor);
-
- if (!jsConstructor->scriptExecutionContext())
- return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, "TestEventConstructor");
-
+ UNUSED_PARAM(throwScope);
+ auto* castedThis = jsCast<JSTestEventConstructorConstructor*>(state->callee());
+ ASSERT(castedThis);
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
-
- AtomicString eventType = state->uncheckedArgument(0).toString(state)->toAtomicString(state);
+ auto type = state->uncheckedArgument(0).toWTFString(state);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
-
- TestEventConstructorInit eventInit;
-
- JSValue initializerValue = state->argument(1);
- if (!initializerValue.isUndefinedOrNull()) {
- // Given the above test, this will always yield an object.
- JSObject* initializerObject = initializerValue.toObject(state);
- ASSERT(!throwScope.exception());
-
- // Create the dictionary wrapper from the initializer object.
- JSDictionary dictionary(state, initializerObject);
-
- // Attempt to fill in the EventInit.
- if (!fillTestEventConstructorInit(eventInit, dictionary))
- return JSValue::encode(jsUndefined());
- }
-
- Ref<TestEventConstructor> event = TestEventConstructor::createForBindings(eventType, eventInit);
- return JSValue::encode(createWrapper<TestEventConstructor>(jsConstructor->globalObject(), WTFMove(event)));
+ auto eventInitDict = convert<IDLDictionary<TestEventConstructor::Init>>(*state, state->argument(1));
+ RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+ auto object = TestEventConstructor::create(WTFMove(type), eventInitDict.value());
+ return JSValue::encode(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object)));
}
-bool fillTestEventConstructorInit(TestEventConstructorInit& eventInit, JSDictionary& dictionary)
-{
- if (!dictionary.tryGetProperty("attr2", eventInit.attr2))
- return false;
-#if ENABLE(SPECIAL_EVENT)
- if (!dictionary.tryGetProperty("attr3", eventInit.attr3))
- return false;
-#endif
- return true;
-}
-
template<> JSValue JSTestEventConstructorConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
{
- UNUSED_PARAM(vm);
- return globalObject.functionPrototype();
+ return JSEvent::getConstructor(vm, &globalObject);
}
template<> void JSTestEventConstructorConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
@@ -158,13 +174,13 @@
const ClassInfo JSTestEventConstructor::s_info = { "TestEventConstructor", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestEventConstructor) };
JSTestEventConstructor::JSTestEventConstructor(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestEventConstructor>&& impl)
- : JSDOMWrapper<TestEventConstructor>(structure, globalObject, WTFMove(impl))
+ : JSEvent(structure, globalObject, WTFMove(impl))
{
}
JSObject* JSTestEventConstructor::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
- return JSTestEventConstructorPrototype::create(vm, globalObject, JSTestEventConstructorPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
+ return JSTestEventConstructorPrototype::create(vm, globalObject, JSTestEventConstructorPrototype::createStructure(vm, globalObject, JSEvent::prototype(vm, globalObject)));
}
JSObject* JSTestEventConstructor::prototype(VM& vm, JSGlobalObject* globalObject)
@@ -172,12 +188,6 @@
return getDOMPrototype<JSTestEventConstructor>(vm, globalObject);
}
-void JSTestEventConstructor::destroy(JSC::JSCell* cell)
-{
- JSTestEventConstructor* thisObject = static_cast<JSTestEventConstructor*>(cell);
- thisObject->JSTestEventConstructor::~JSTestEventConstructor();
-}
-
template<> inline JSTestEventConstructor* BindingCaller<JSTestEventConstructor>::castForAttribute(ExecState&, EncodedJSValue thisValue)
{
return jsDynamicCast<JSTestEventConstructor*>(JSValue::decode(thisValue));
@@ -263,20 +273,6 @@
return getDOMConstructor<JSTestEventConstructorConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
}
-bool JSTestEventConstructorOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
-{
- UNUSED_PARAM(handle);
- UNUSED_PARAM(visitor);
- return false;
-}
-
-void JSTestEventConstructorOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
-{
- auto* jsTestEventConstructor = jsCast<JSTestEventConstructor*>(handle.slot()->asCell());
- auto& world = *static_cast<DOMWrapperWorld*>(context);
- uncacheWrapper(world, &jsTestEventConstructor->wrapped(), jsTestEventConstructor);
-}
-
#if ENABLE(BINDING_INTEGRITY)
#if PLATFORM(WIN)
#pragma warning(disable: 4483)
@@ -315,11 +311,5 @@
return wrap(state, globalObject, impl);
}
-TestEventConstructor* JSTestEventConstructor::toWrapped(JSC::JSValue value)
-{
- if (auto* wrapper = jsDynamicCast<JSTestEventConstructor*>(value))
- return &wrapper->wrapped();
- return nullptr;
-}
}
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.h (207237 => 207238)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.h 2016-10-12 20:38:37 UTC (rev 207237)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.h 2016-10-12 20:41:49 UTC (rev 207238)
@@ -20,17 +20,16 @@
#pragma once
-#include "JSDOMWrapper.h"
+#include "JSDOMConvert.h"
+#include "JSEvent.h"
#include "TestEventConstructor.h"
-#include <wtf/NeverDestroyed.h>
namespace WebCore {
-class JSDictionary;
-
-class JSTestEventConstructor : public JSDOMWrapper<TestEventConstructor> {
+class JSTestEventConstructor : public JSEvent {
public:
- using Base = JSDOMWrapper<TestEventConstructor>;
+ using Base = JSEvent;
+ using DOMWrapped = TestEventConstructor;
static JSTestEventConstructor* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestEventConstructor>&& impl)
{
JSTestEventConstructor* ptr = new (NotNull, JSC::allocateCell<JSTestEventConstructor>(globalObject->vm().heap)) JSTestEventConstructor(structure, *globalObject, WTFMove(impl));
@@ -40,8 +39,6 @@
static JSC::JSObject* createPrototype(JSC::VM&, JSC::JSGlobalObject*);
static JSC::JSObject* prototype(JSC::VM&, JSC::JSGlobalObject*);
- static TestEventConstructor* toWrapped(JSC::JSValue);
- static void destroy(JSC::JSCell*);
DECLARE_INFO;
@@ -51,6 +48,10 @@
}
static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
+ TestEventConstructor& wrapped() const
+ {
+ return static_cast<TestEventConstructor&>(Base::wrapped());
+ }
protected:
JSTestEventConstructor(JSC::Structure*, JSDOMGlobalObject&, Ref<TestEventConstructor>&&);
@@ -62,32 +63,15 @@
};
-class JSTestEventConstructorOwner : public JSC::WeakHandleOwner {
-public:
- virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
- virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
-};
-
-inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestEventConstructor*)
-{
- static NeverDestroyed<JSTestEventConstructorOwner> owner;
- return &owner.get();
-}
-
-inline void* wrapperKey(TestEventConstructor* wrappableObject)
-{
- return wrappableObject;
-}
-
JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestEventConstructor&);
inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestEventConstructor* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<TestEventConstructor>&&);
inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<TestEventConstructor>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
-bool fillTestEventConstructorInit(TestEventConstructorInit&, JSDictionary&);
-
template<> struct JSDOMWrapperConverterTraits<TestEventConstructor> {
using WrapperClass = JSTestEventConstructor;
};
+template<> Optional<TestEventConstructor::Init> convertDictionary<TestEventConstructor::Init>(JSC::ExecState&, JSC::JSValue);
+
} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/scripts/test/TestEventConstructor.idl (207237 => 207238)
--- trunk/Source/WebCore/bindings/scripts/test/TestEventConstructor.idl 2016-10-12 20:38:37 UTC (rev 207237)
+++ trunk/Source/WebCore/bindings/scripts/test/TestEventConstructor.idl 2016-10-12 20:41:49 UTC (rev 207238)
@@ -29,10 +29,15 @@
// This IDL file is for testing the bindings code generator and for tracking
// changes in its ouput.
[
- ConstructorTemplate=Event
-] interface TestEventConstructor {
+ Constructor(DOMString type, optional TestEventConstructorInit eventInitDict),
+] interface TestEventConstructor : Event {
// Attributes
readonly attribute DOMString attr1;
- [InitializedByEventConstructor] readonly attribute DOMString attr2;
- [InitializedByEventConstructor, Conditional=SPECIAL_EVENT] readonly attribute DOMString attr3;
+ readonly attribute DOMString attr2;
+ [Conditional=SPECIAL_EVENT] readonly attribute DOMString attr3;
};
+
+dictionary TestEventConstructorInit : EventInit {
+ DOMString attr2 = "";
+ [Conditional=SPECIAL_EVENT] DOMString attr3 = "";
+};
Modified: trunk/Source/WebCore/css/CSSFontFaceLoadEvent.cpp (207237 => 207238)
--- trunk/Source/WebCore/css/CSSFontFaceLoadEvent.cpp 2016-10-12 20:38:37 UTC (rev 207237)
+++ trunk/Source/WebCore/css/CSSFontFaceLoadEvent.cpp 2016-10-12 20:41:49 UTC (rev 207238)
@@ -46,8 +46,8 @@
{
}
-CSSFontFaceLoadEvent::CSSFontFaceLoadEvent(const AtomicString& type, const CSSFontFaceLoadEventInit& initializer)
- : Event(type, initializer)
+CSSFontFaceLoadEvent::CSSFontFaceLoadEvent(const AtomicString& type, const Init& initializer, IsTrusted isTrusted)
+ : Event(type, initializer, isTrusted)
, m_fontface(initializer.fontface)
, m_error(initializer.error)
{
Modified: trunk/Source/WebCore/css/CSSFontFaceLoadEvent.h (207237 => 207238)
--- trunk/Source/WebCore/css/CSSFontFaceLoadEvent.h 2016-10-12 20:38:37 UTC (rev 207237)
+++ trunk/Source/WebCore/css/CSSFontFaceLoadEvent.h 2016-10-12 20:41:49 UTC (rev 207238)
@@ -42,11 +42,6 @@
class DOMError;
-struct CSSFontFaceLoadEventInit : public EventInit {
- RefPtr<CSSFontFaceRule> fontface;
- RefPtr<DOMError> error;
-};
-
class CSSFontFaceLoadEvent final : public Event {
public:
static Ref<CSSFontFaceLoadEvent> create()
@@ -54,9 +49,14 @@
return adoptRef<CSSFontFaceLoadEvent>(*new CSSFontFaceLoadEvent);
}
- static Ref<CSSFontFaceLoadEvent> create(const AtomicString& type, const CSSFontFaceLoadEventInit& initializer)
+ struct Init : EventInit {
+ RefPtr<CSSFontFaceRule> fontface;
+ RefPtr<DOMError> error;
+ };
+
+ static Ref<CSSFontFaceLoadEvent> create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted = IsTrusted::No)
{
- return adoptRef<CSSFontFaceLoadEvent>(*new CSSFontFaceLoadEvent(type, initializer));
+ return adoptRef<CSSFontFaceLoadEvent>(*new CSSFontFaceLoadEvent(type, initializer, isTrusted));
}
static Ref<CSSFontFaceLoadEvent> createForFontFaceRule(const AtomicString& type, RefPtr<CSSFontFaceRule>&& rule)
@@ -79,7 +79,7 @@
private:
CSSFontFaceLoadEvent();
CSSFontFaceLoadEvent(const AtomicString&, RefPtr<CSSFontFaceRule>&&, RefPtr<DOMError>&&);
- CSSFontFaceLoadEvent(const AtomicString&, const CSSFontFaceLoadEventInit&);
+ CSSFontFaceLoadEvent(const AtomicString&, const Init&, IsTrusted);
RefPtr<CSSFontFaceRule> m_fontface;
RefPtr<DOMError> m_error;
Modified: trunk/Source/WebCore/css/CSSFontFaceLoadEvent.idl (207237 => 207238)
--- trunk/Source/WebCore/css/CSSFontFaceLoadEvent.idl 2016-10-12 20:38:37 UTC (rev 207237)
+++ trunk/Source/WebCore/css/CSSFontFaceLoadEvent.idl 2016-10-12 20:41:49 UTC (rev 207238)
@@ -29,10 +29,14 @@
*/
[
- NoInterfaceObject,
Conditional=FONT_LOAD_EVENTS,
- ConstructorTemplate=Event
+ Constructor(DOMString type, optional CSSFontFaceLoadEventInit eventInit),
] interface CSSFontFaceLoadEvent : Event {
- [InitializedByEventConstructor] readonly attribute CSSFontFaceRule fontface;
- [InitializedByEventConstructor] readonly attribute DOMError error;
+ readonly attribute CSSFontFaceRule? fontface;
+ readonly attribute DOMError? error;
};
+
+dictionary CSSFontFaceLoadEventInit : EventInit {
+ CSSFontFaceRule? fontface = null;
+ DOMError? error = null;
+};
Modified: trunk/Source/WebCore/html/canvas/WebGLContextEvent.cpp (207237 => 207238)
--- trunk/Source/WebCore/html/canvas/WebGLContextEvent.cpp 2016-10-12 20:38:37 UTC (rev 207237)
+++ trunk/Source/WebCore/html/canvas/WebGLContextEvent.cpp 2016-10-12 20:41:49 UTC (rev 207238)
@@ -38,8 +38,8 @@
{
}
-WebGLContextEvent::WebGLContextEvent(const AtomicString& type, const WebGLContextEventInit& initializer)
- : Event(type, initializer)
+WebGLContextEvent::WebGLContextEvent(const AtomicString& type, const Init& initializer, IsTrusted isTrusted)
+ : Event(type, initializer, isTrusted)
, m_statusMessage(initializer.statusMessage)
{
}
Modified: trunk/Source/WebCore/html/canvas/WebGLContextEvent.h (207237 => 207238)
--- trunk/Source/WebCore/html/canvas/WebGLContextEvent.h 2016-10-12 20:38:37 UTC (rev 207237)
+++ trunk/Source/WebCore/html/canvas/WebGLContextEvent.h 2016-10-12 20:41:49 UTC (rev 207238)
@@ -30,10 +30,6 @@
namespace WebCore {
-struct WebGLContextEventInit : public EventInit {
- String statusMessage;
-};
-
class WebGLContextEvent final : public Event {
public:
static Ref<WebGLContextEvent> create(const AtomicString& type, bool canBubble, bool cancelable, const String& statusMessage)
@@ -40,9 +36,14 @@
{
return adoptRef(*new WebGLContextEvent(type, canBubble, cancelable, statusMessage));
}
- static Ref<WebGLContextEvent> createForBindings(const AtomicString& type, const WebGLContextEventInit& initializer)
+
+ struct Init : EventInit {
+ String statusMessage;
+ };
+
+ static Ref<WebGLContextEvent> create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted = IsTrusted::No)
{
- return adoptRef(*new WebGLContextEvent(type, initializer));
+ return adoptRef(*new WebGLContextEvent(type, initializer, isTrusted));
}
virtual ~WebGLContextEvent();
@@ -52,7 +53,7 @@
private:
WebGLContextEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& statusMessage);
- WebGLContextEvent(const AtomicString&, const WebGLContextEventInit&);
+ WebGLContextEvent(const AtomicString&, const Init&, IsTrusted);
String m_statusMessage;
};
Modified: trunk/Source/WebCore/html/canvas/WebGLContextEvent.idl (207237 => 207238)
--- trunk/Source/WebCore/html/canvas/WebGLContextEvent.idl 2016-10-12 20:38:37 UTC (rev 207237)
+++ trunk/Source/WebCore/html/canvas/WebGLContextEvent.idl 2016-10-12 20:41:49 UTC (rev 207238)
@@ -25,8 +25,11 @@
[
Conditional=WEBGL,
- ConstructorTemplate=Event
+ Constructor(DOMString type, optional WebGLContextEventInit eventInit),
] interface WebGLContextEvent : Event {
- [InitializedByEventConstructor] readonly attribute DOMString statusMessage;
+ readonly attribute DOMString statusMessage;
};
+dictionary WebGLContextEventInit : EventInit {
+ DOMString statusMessage = "";
+};
Modified: trunk/Source/WebCore/storage/StorageEvent.cpp (207237 => 207238)
--- trunk/Source/WebCore/storage/StorageEvent.cpp 2016-10-12 20:38:37 UTC (rev 207237)
+++ trunk/Source/WebCore/storage/StorageEvent.cpp 2016-10-12 20:41:49 UTC (rev 207238)
@@ -49,9 +49,9 @@
return adoptRef(*new StorageEvent(type, key, oldValue, newValue, url, storageArea));
}
-Ref<StorageEvent> StorageEvent::createForBindings(const AtomicString& type, const StorageEventInit& initializer)
+Ref<StorageEvent> StorageEvent::create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted)
{
- return adoptRef(*new StorageEvent(type, initializer));
+ return adoptRef(*new StorageEvent(type, initializer, isTrusted));
}
StorageEvent::StorageEvent(const AtomicString& type, const String& key, const String& oldValue, const String& newValue, const String& url, Storage* storageArea)
@@ -64,8 +64,8 @@
{
}
-StorageEvent::StorageEvent(const AtomicString& type, const StorageEventInit& initializer)
- : Event(type, initializer)
+StorageEvent::StorageEvent(const AtomicString& type, const Init& initializer, IsTrusted isTrusted)
+ : Event(type, initializer, isTrusted)
, m_key(initializer.key)
, m_oldValue(initializer.oldValue)
, m_newValue(initializer.newValue)
Modified: trunk/Source/WebCore/storage/StorageEvent.h (207237 => 207238)
--- trunk/Source/WebCore/storage/StorageEvent.h 2016-10-12 20:38:37 UTC (rev 207237)
+++ trunk/Source/WebCore/storage/StorageEvent.h 2016-10-12 20:41:49 UTC (rev 207238)
@@ -33,19 +33,20 @@
class Storage;
-struct StorageEventInit : public EventInit {
- String key;
- String oldValue;
- String newValue;
- String url;
- RefPtr<Storage> storageArea;
-};
-
class StorageEvent : public Event {
public:
static Ref<StorageEvent> create(const AtomicString& type, const String& key, const String& oldValue, const String& newValue, const String& url, Storage* storageArea);
static Ref<StorageEvent> createForBindings();
- static Ref<StorageEvent> createForBindings(const AtomicString&, const StorageEventInit&);
+
+ struct Init : EventInit {
+ String key;
+ String oldValue;
+ String newValue;
+ String url;
+ RefPtr<Storage> storageArea;
+ };
+
+ static Ref<StorageEvent> create(const AtomicString&, const Init&, IsTrusted = IsTrusted::No);
virtual ~StorageEvent();
const String& key() const { return m_key; }
@@ -64,7 +65,7 @@
private:
StorageEvent();
StorageEvent(const AtomicString& type, const String& key, const String& oldValue, const String& newValue, const String& url, Storage* storageArea);
- StorageEvent(const AtomicString&, const StorageEventInit&);
+ StorageEvent(const AtomicString&, const Init&, IsTrusted);
String m_key;
String m_oldValue;
Modified: trunk/Source/WebCore/storage/StorageEvent.idl (207237 => 207238)
--- trunk/Source/WebCore/storage/StorageEvent.idl 2016-10-12 20:38:37 UTC (rev 207237)
+++ trunk/Source/WebCore/storage/StorageEvent.idl 2016-10-12 20:41:49 UTC (rev 207238)
@@ -24,13 +24,13 @@
*/
[
- ConstructorTemplate=Event,
+ Constructor(DOMString type, optional StorageEventInit eventInitDict)
] interface StorageEvent : Event {
- [InitializedByEventConstructor] readonly attribute DOMString key;
- [InitializedByEventConstructor] readonly attribute DOMString? oldValue;
- [InitializedByEventConstructor] readonly attribute DOMString? newValue;
- [InitializedByEventConstructor] readonly attribute USVString url;
- [InitializedByEventConstructor] readonly attribute Storage storageArea;
+ readonly attribute DOMString? key;
+ readonly attribute DOMString? oldValue;
+ readonly attribute DOMString? newValue;
+ readonly attribute USVString url;
+ readonly attribute Storage? storageArea;
// FIXME: Using "undefined" as default parameter value is wrong.
void initStorageEvent(optional DOMString typeArg = "undefined",
@@ -46,3 +46,10 @@
// void initStorageEventNS(DOMString namespaceURI, DOMString typeArg, boolean canBubbleArg, boolean cancelableArg, DOMString keyArg, DOMString oldValueArg, DOMString newValueArg, USVString urlArg, Storage? storageAreaArg);
};
+dictionary StorageEventInit : EventInit {
+ DOMString? key = null;
+ DOMString? oldValue = null;
+ DOMString? newValue = null;
+ USVString url = ""
+ Storage? storageArea = null;
+};