Enable strict type checking for Window dictionary members
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 31 Jul 2016 00:29:19 +0000 (00:29 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 31 Jul 2016 00:29:19 +0000 (00:29 +0000)
commit35ad0574f9549ebe458f4862a44bf220dff2982e
tree693c8332ae615af080cf4d489922d919ccdc122c
parent56a4ec1aaac88ffb6483d34a3c562ad899060a74
Enable strict type checking for Window dictionary members
https://bugs.webkit.org/show_bug.cgi?id=160356

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline W3C test now that one more check is passing.

* web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt:

Source/WebCore:

Enable strict type checking for Window dictionary members. Technically,
we should do strict type checking of all wrapper types but this patch
focuses on Window because it is common to pass a Window dictionary
member to Event constructors.

By strict type checking, I mean that we should throw a TypeError is
the value is not null/undefined and does not implement the Window
interface:
- http://heycam.github.io/webidl/#es-interface

Firefox and Chrome comply with the specification already.

No new tests, updated / rebaselined existing tests.

* bindings/js/JSDictionary.cpp:
(WebCore::JSDictionary::convertValue):

LayoutTests:

Update existing tests to reflect behavior change.

* fast/events/constructors/composition-event-constructor-expected.txt:
* fast/events/constructors/composition-event-constructor.html:
* fast/events/constructors/focus-event-constructor-expected.txt:
* fast/events/constructors/focus-event-constructor.html:
* fast/events/constructors/keyboard-event-constructor-expected.txt:
* fast/events/constructors/keyboard-event-constructor.html:
* fast/events/constructors/mouse-event-constructor.html:
* fast/events/constructors/ui-event-constructor-expected.txt:
* fast/events/constructors/ui-event-constructor.html:
* fast/events/constructors/wheel-event-constructor.html:
* platform/mac/fast/events/constructors/mouse-event-constructor-expected.txt:
* platform/mac/fast/events/constructors/wheel-event-constructor-expected.txt:

* resources/js-test-pre.js:
Add a shouldThrowErrorName() utility function that is similar to shouldThrow()
but only checks the error name instead of the full error message. Checking
only the error name has the benefit of working across browsers and facilitating
refactoring of error messages.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203950 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/events/constructors/composition-event-constructor-expected.txt
LayoutTests/fast/events/constructors/composition-event-constructor.html
LayoutTests/fast/events/constructors/focus-event-constructor-expected.txt
LayoutTests/fast/events/constructors/focus-event-constructor.html
LayoutTests/fast/events/constructors/keyboard-event-constructor-expected.txt
LayoutTests/fast/events/constructors/keyboard-event-constructor.html
LayoutTests/fast/events/constructors/mouse-event-constructor.html
LayoutTests/fast/events/constructors/ui-event-constructor-expected.txt
LayoutTests/fast/events/constructors/ui-event-constructor.html
LayoutTests/fast/events/constructors/wheel-event-constructor.html
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt
LayoutTests/platform/mac/fast/events/constructors/mouse-event-constructor-expected.txt
LayoutTests/platform/mac/fast/events/constructors/wheel-event-constructor-expected.txt
LayoutTests/resources/js-test-pre.js
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSDictionary.cpp