Changeset 203950 in webkit
- Timestamp:
- Jul 30, 2016 5:29:19 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r203949 r203950 1 2016-07-30 Chris Dumez <cdumez@apple.com> 2 3 Enable strict type checking for Window dictionary members 4 https://bugs.webkit.org/show_bug.cgi?id=160356 5 6 Reviewed by Darin Adler. 7 8 Update existing tests to reflect behavior change. 9 10 * fast/events/constructors/composition-event-constructor-expected.txt: 11 * fast/events/constructors/composition-event-constructor.html: 12 * fast/events/constructors/focus-event-constructor-expected.txt: 13 * fast/events/constructors/focus-event-constructor.html: 14 * fast/events/constructors/keyboard-event-constructor-expected.txt: 15 * fast/events/constructors/keyboard-event-constructor.html: 16 * fast/events/constructors/mouse-event-constructor.html: 17 * fast/events/constructors/ui-event-constructor-expected.txt: 18 * fast/events/constructors/ui-event-constructor.html: 19 * fast/events/constructors/wheel-event-constructor.html: 20 * platform/mac/fast/events/constructors/mouse-event-constructor-expected.txt: 21 * platform/mac/fast/events/constructors/wheel-event-constructor-expected.txt: 22 23 * resources/js-test-pre.js: 24 Add a shouldThrowErrorName() utility function that is similar to shouldThrow() 25 but only checks the error name instead of the full error message. Checking 26 only the error name has the benefit of working across browsers and facilitating 27 refactoring of error messages. 28 1 29 2016-07-30 Chris Dumez <cdumez@apple.com> 2 30 -
trunk/LayoutTests/fast/events/constructors/composition-event-constructor-expected.txt
r141386 r203950 15 15 PASS new CompositionEvent('eventType', { view: window }).view is window 16 16 PASS new CompositionEvent('eventType', { view: this }).view is this 17 PASS new CompositionEvent('eventType', { view: testObject }).view is null18 PASS new CompositionEvent('eventType', { view: document }).view is null17 PASS new CompositionEvent('eventType', { view: testObject }).view threw exception TypeError: Dictionary member is not of type Window. 18 PASS new CompositionEvent('eventType', { view: document }).view threw exception TypeError: Dictionary member is not of type Window. 19 19 PASS new CompositionEvent('eventType', { view: undefined }).view is null 20 20 PASS new CompositionEvent('eventType', { view: null }).view is null 21 PASS new CompositionEvent('eventType', { view: false }).view is null22 PASS new CompositionEvent('eventType', { view: true }).view is null23 PASS new CompositionEvent('eventType', { view: '' }).view is null24 PASS new CompositionEvent('eventType', { view: 'chocolate' }).view is null25 PASS new CompositionEvent('eventType', { view: 12345 }).view is null26 PASS new CompositionEvent('eventType', { view: 18446744073709551615 }).view is null27 PASS new CompositionEvent('eventType', { view: NaN }).view is null28 PASS new CompositionEvent('eventType', { view: {valueOf: function () { return window; } } }).view == window is false29 PASS new CompositionEvent('eventType', { get view() { return 123; } }).view is null21 PASS new CompositionEvent('eventType', { view: false }).view threw exception TypeError: Dictionary member is not of type Window. 22 PASS new CompositionEvent('eventType', { view: true }).view threw exception TypeError: Dictionary member is not of type Window. 23 PASS new CompositionEvent('eventType', { view: '' }).view threw exception TypeError: Dictionary member is not of type Window. 24 PASS new CompositionEvent('eventType', { view: 'chocolate' }).view threw exception TypeError: Dictionary member is not of type Window. 25 PASS new CompositionEvent('eventType', { view: 12345 }).view threw exception TypeError: Dictionary member is not of type Window. 26 PASS new CompositionEvent('eventType', { view: 18446744073709551615 }).view threw exception TypeError: Dictionary member is not of type Window. 27 PASS new CompositionEvent('eventType', { view: NaN }).view threw exception TypeError: Dictionary member is not of type Window. 28 PASS new CompositionEvent('eventType', { view: {valueOf: function () { return window; } } }).view threw exception TypeError: Dictionary member is not of type Window. 29 PASS new CompositionEvent('eventType', { get view() { return 123; } }).view threw exception TypeError: Dictionary member is not of type Window. 30 30 PASS new CompositionEvent('eventType', { get view() { throw 'CompositionEvent Error'; } }) threw exception CompositionEvent Error. 31 31 PASS new CompositionEvent('eventType', { data: 'koakuma' }).data is "koakuma" -
trunk/LayoutTests/fast/events/constructors/composition-event-constructor.html
r155267 r203950 32 32 33 33 // Non-window objects. 34 should Be("new CompositionEvent('eventType', { view: testObject }).view", "null");35 should Be("new CompositionEvent('eventType', { view: document }).view", "null");36 shouldBe ("new CompositionEvent('eventType', { view: undefined }).view", "null");37 shouldBe ("new CompositionEvent('eventType', { view: null }).view", "null");38 should Be("new CompositionEvent('eventType', { view: false }).view", "null");39 should Be("new CompositionEvent('eventType', { view: true }).view", "null");40 should Be("new CompositionEvent('eventType', { view: '' }).view", "null");41 should Be("new CompositionEvent('eventType', { view: 'chocolate' }).view", "null");42 should Be("new CompositionEvent('eventType', { view: 12345 }).view", "null");43 should Be("new CompositionEvent('eventType', { view: 18446744073709551615 }).view", "null");44 should Be("new CompositionEvent('eventType', { view: NaN }).view", "null");34 shouldThrowErrorName("new CompositionEvent('eventType', { view: testObject }).view", "TypeError"); 35 shouldThrowErrorName("new CompositionEvent('eventType', { view: document }).view", "TypeError"); 36 shouldBeNull("new CompositionEvent('eventType', { view: undefined }).view"); 37 shouldBeNull("new CompositionEvent('eventType', { view: null }).view"); 38 shouldThrowErrorName("new CompositionEvent('eventType', { view: false }).view", "TypeError"); 39 shouldThrowErrorName("new CompositionEvent('eventType', { view: true }).view", "TypeError"); 40 shouldThrowErrorName("new CompositionEvent('eventType', { view: '' }).view", "TypeError"); 41 shouldThrowErrorName("new CompositionEvent('eventType', { view: 'chocolate' }).view", "TypeError"); 42 shouldThrowErrorName("new CompositionEvent('eventType', { view: 12345 }).view", "TypeError"); 43 shouldThrowErrorName("new CompositionEvent('eventType', { view: 18446744073709551615 }).view", "TypeError"); 44 shouldThrowErrorName("new CompositionEvent('eventType', { view: NaN }).view", "TypeError"); 45 45 // Note that valueOf() is not called, when the left hand side is evaluated. 46 should BeFalse("new CompositionEvent('eventType', { view: {valueOf: function () { return window; } } }).view == window");47 should Be("new CompositionEvent('eventType', { get view() { return 123; } }).view", "null");46 shouldThrowErrorName("new CompositionEvent('eventType', { view: {valueOf: function () { return window; } } }).view", "TypeError"); 47 shouldThrowErrorName("new CompositionEvent('eventType', { get view() { return 123; } }).view", "TypeError"); 48 48 shouldThrow("new CompositionEvent('eventType', { get view() { throw 'CompositionEvent Error'; } })"); 49 49 -
trunk/LayoutTests/fast/events/constructors/focus-event-constructor-expected.txt
r142205 r203950 15 15 PASS new FocusEvent('eventType', { view: window }).view is window 16 16 PASS new FocusEvent('eventType', { view: this }).view is this 17 PASS new FocusEvent('eventType', { view: testObject }).view is null18 PASS new FocusEvent('eventType', { view: document }).view is null17 PASS new FocusEvent('eventType', { view: testObject }).view threw exception TypeError: Dictionary member is not of type Window. 18 PASS new FocusEvent('eventType', { view: document }).view threw exception TypeError: Dictionary member is not of type Window. 19 19 PASS new FocusEvent('eventType', { view: undefined }).view is null 20 20 PASS new FocusEvent('eventType', { view: null }).view is null 21 PASS new FocusEvent('eventType', { view: false }).view is null22 PASS new FocusEvent('eventType', { view: true }).view is null23 PASS new FocusEvent('eventType', { view: '' }).view is null24 PASS new FocusEvent('eventType', { view: 'chocolate' }).view is null25 PASS new FocusEvent('eventType', { view: 12345 }).view is null26 PASS new FocusEvent('eventType', { view: 18446744073709551615 }).view is null27 PASS new FocusEvent('eventType', { view: NaN }).view is null28 PASS new FocusEvent('eventType', { view: {valueOf: function () { return window; } } }).view == window is false29 PASS new FocusEvent('eventType', { get view() { return 123; } }).view is null21 PASS new FocusEvent('eventType', { view: false }).view threw exception TypeError: Dictionary member is not of type Window. 22 PASS new FocusEvent('eventType', { view: true }).view threw exception TypeError: Dictionary member is not of type Window. 23 PASS new FocusEvent('eventType', { view: '' }).view threw exception TypeError: Dictionary member is not of type Window. 24 PASS new FocusEvent('eventType', { view: 'chocolate' }).view threw exception TypeError: Dictionary member is not of type Window. 25 PASS new FocusEvent('eventType', { view: 12345 }).view threw exception TypeError: Dictionary member is not of type Window. 26 PASS new FocusEvent('eventType', { view: 18446744073709551615 }).view threw exception TypeError: Dictionary member is not of type Window. 27 PASS new FocusEvent('eventType', { view: NaN }).view threw exception TypeError: Dictionary member is not of type Window. 28 PASS new FocusEvent('eventType', { view: {valueOf: function () { return window; } } }).view threw exception TypeError: Dictionary member is not of type Window. 29 PASS new FocusEvent('eventType', { get view() { return 123; } }).view threw exception TypeError: Dictionary member is not of type Window. 30 30 PASS new FocusEvent('eventType', { get view() { throw 'FocusEvent Error'; } }) threw exception FocusEvent Error. 31 31 PASS new FocusEvent('eventType', { relatedTarget: testDiv }).relatedTarget is testDiv -
trunk/LayoutTests/fast/events/constructors/focus-event-constructor.html
r155267 r203950 34 34 35 35 // Non-window objects. 36 should Be("new FocusEvent('eventType', { view: testObject }).view", "null");37 should Be("new FocusEvent('eventType', { view: document }).view", "null");38 shouldBe ("new FocusEvent('eventType', { view: undefined }).view", "null");39 shouldBe ("new FocusEvent('eventType', { view: null }).view", "null");40 should Be("new FocusEvent('eventType', { view: false }).view", "null");41 should Be("new FocusEvent('eventType', { view: true }).view", "null");42 should Be("new FocusEvent('eventType', { view: '' }).view", "null");43 should Be("new FocusEvent('eventType', { view: 'chocolate' }).view", "null");44 should Be("new FocusEvent('eventType', { view: 12345 }).view", "null");45 should Be("new FocusEvent('eventType', { view: 18446744073709551615 }).view", "null");46 should Be("new FocusEvent('eventType', { view: NaN }).view", "null");36 shouldThrowErrorName("new FocusEvent('eventType', { view: testObject }).view", "TypeError"); 37 shouldThrowErrorName("new FocusEvent('eventType', { view: document }).view", "TypeError"); 38 shouldBeNull("new FocusEvent('eventType', { view: undefined }).view"); 39 shouldBeNull("new FocusEvent('eventType', { view: null }).view"); 40 shouldThrowErrorName("new FocusEvent('eventType', { view: false }).view", "TypeError"); 41 shouldThrowErrorName("new FocusEvent('eventType', { view: true }).view", "TypeError"); 42 shouldThrowErrorName("new FocusEvent('eventType', { view: '' }).view", "TypeError"); 43 shouldThrowErrorName("new FocusEvent('eventType', { view: 'chocolate' }).view", "TypeError"); 44 shouldThrowErrorName("new FocusEvent('eventType', { view: 12345 }).view", "TypeError"); 45 shouldThrowErrorName("new FocusEvent('eventType', { view: 18446744073709551615 }).view", "TypeError"); 46 shouldThrowErrorName("new FocusEvent('eventType', { view: NaN }).view", "TypeError"); 47 47 // Note that valueOf() is not called, when the left hand side is evaluated. 48 should BeFalse("new FocusEvent('eventType', { view: {valueOf: function () { return window; } } }).view == window");49 should Be("new FocusEvent('eventType', { get view() { return 123; } }).view", "null");48 shouldThrowErrorName("new FocusEvent('eventType', { view: {valueOf: function () { return window; } } }).view", "TypeError"); 49 shouldThrowErrorName("new FocusEvent('eventType', { get view() { return 123; } }).view", "TypeError"); 50 50 shouldThrow("new FocusEvent('eventType', { get view() { throw 'FocusEvent Error'; } })"); 51 51 -
trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor-expected.txt
r153955 r203950 20 20 PASS new KeyboardEvent('eventType', { view: window }).view is window 21 21 PASS new KeyboardEvent('eventType', { view: this }).view is this 22 PASS new KeyboardEvent('eventType', { view: testObject }).view is null23 PASS new KeyboardEvent('eventType', { view: document }).view is null22 PASS new KeyboardEvent('eventType', { view: testObject }).view threw exception TypeError: Dictionary member is not of type Window. 23 PASS new KeyboardEvent('eventType', { view: document }).view threw exception TypeError: Dictionary member is not of type Window. 24 24 PASS new KeyboardEvent('eventType', { view: undefined }).view is null 25 25 PASS new KeyboardEvent('eventType', { view: null }).view is null 26 PASS new KeyboardEvent('eventType', { view: false }).view is null27 PASS new KeyboardEvent('eventType', { view: true }).view is null28 PASS new KeyboardEvent('eventType', { view: '' }).view is null29 PASS new KeyboardEvent('eventType', { view: 'chocolate' }).view is null30 PASS new KeyboardEvent('eventType', { view: 12345 }).view is null31 PASS new KeyboardEvent('eventType', { view: 18446744073709551615 }).view is null32 PASS new KeyboardEvent('eventType', { view: NaN }).view is null33 PASS new KeyboardEvent('eventType', { view: {valueOf: function () { return window; } } }).view == window is false34 PASS new KeyboardEvent('eventType', { get view() { return 123; } }).view is null26 PASS new KeyboardEvent('eventType', { view: false }).view threw exception TypeError: Dictionary member is not of type Window. 27 PASS new KeyboardEvent('eventType', { view: true }).view threw exception TypeError: Dictionary member is not of type Window. 28 PASS new KeyboardEvent('eventType', { view: '' }).view threw exception TypeError: Dictionary member is not of type Window. 29 PASS new KeyboardEvent('eventType', { view: 'chocolate' }).view threw exception TypeError: Dictionary member is not of type Window. 30 PASS new KeyboardEvent('eventType', { view: 12345 }).view threw exception TypeError: Dictionary member is not of type Window. 31 PASS new KeyboardEvent('eventType', { view: 18446744073709551615 }).view threw exception TypeError: Dictionary member is not of type Window. 32 PASS new KeyboardEvent('eventType', { view: NaN }).view threw exception TypeError: Dictionary member is not of type Window. 33 PASS new KeyboardEvent('eventType', { view: {valueOf: function () { return window; } } }).view threw exception TypeError: Dictionary member is not of type Window. 34 PASS new KeyboardEvent('eventType', { get view() { return 123; } }).view threw exception TypeError: Dictionary member is not of type Window. 35 35 PASS new KeyboardEvent('eventType', { get view() { throw 'KeyboardEvent Error'; } }) threw exception KeyboardEvent Error. 36 36 PASS new KeyboardEvent('eventType', { keyIdentifier: 'koakuma' }).keyIdentifier is "koakuma" -
trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor.html
r155267 r203950 37 37 38 38 // Non-window objects. 39 should Be("new KeyboardEvent('eventType', { view: testObject }).view", "null");40 should Be("new KeyboardEvent('eventType', { view: document }).view", "null");41 shouldBe ("new KeyboardEvent('eventType', { view: undefined }).view", "null");42 shouldBe ("new KeyboardEvent('eventType', { view: null }).view", "null");43 should Be("new KeyboardEvent('eventType', { view: false }).view", "null");44 should Be("new KeyboardEvent('eventType', { view: true }).view", "null");45 should Be("new KeyboardEvent('eventType', { view: '' }).view", "null");46 should Be("new KeyboardEvent('eventType', { view: 'chocolate' }).view", "null");47 should Be("new KeyboardEvent('eventType', { view: 12345 }).view", "null");48 should Be("new KeyboardEvent('eventType', { view: 18446744073709551615 }).view", "null");49 should Be("new KeyboardEvent('eventType', { view: NaN }).view", "null");39 shouldThrowErrorName("new KeyboardEvent('eventType', { view: testObject }).view", "TypeError"); 40 shouldThrowErrorName("new KeyboardEvent('eventType', { view: document }).view", "TypeError"); 41 shouldBeNull("new KeyboardEvent('eventType', { view: undefined }).view"); 42 shouldBeNull("new KeyboardEvent('eventType', { view: null }).view"); 43 shouldThrowErrorName("new KeyboardEvent('eventType', { view: false }).view", "TypeError"); 44 shouldThrowErrorName("new KeyboardEvent('eventType', { view: true }).view", "TypeError"); 45 shouldThrowErrorName("new KeyboardEvent('eventType', { view: '' }).view", "TypeError"); 46 shouldThrowErrorName("new KeyboardEvent('eventType', { view: 'chocolate' }).view", "TypeError"); 47 shouldThrowErrorName("new KeyboardEvent('eventType', { view: 12345 }).view", "TypeError"); 48 shouldThrowErrorName("new KeyboardEvent('eventType', { view: 18446744073709551615 }).view", "TypeError"); 49 shouldThrowErrorName("new KeyboardEvent('eventType', { view: NaN }).view", "TypeError"); 50 50 // Note that valueOf() is not called, when the left hand side is evaluated. 51 should BeFalse("new KeyboardEvent('eventType', { view: {valueOf: function () { return window; } } }).view == window");52 should Be("new KeyboardEvent('eventType', { get view() { return 123; } }).view", "null");51 shouldThrowErrorName("new KeyboardEvent('eventType', { view: {valueOf: function () { return window; } } }).view", "TypeError"); 52 shouldThrowErrorName("new KeyboardEvent('eventType', { get view() { return 123; } }).view", "TypeError"); 53 53 shouldThrow("new KeyboardEvent('eventType', { get view() { throw 'KeyboardEvent Error'; } })"); 54 54 -
trunk/LayoutTests/fast/events/constructors/mouse-event-constructor.html
r155267 r203950 43 43 44 44 // Non-window objects. 45 should Be("new MouseEvent('eventType', { view: testObject }).view", "null");46 should Be("new MouseEvent('eventType', { view: document }).view", "null");47 shouldBe ("new MouseEvent('eventType', { view: undefined }).view", "null");48 shouldBe ("new MouseEvent('eventType', { view: null }).view", "null");49 should Be("new MouseEvent('eventType', { view: false }).view", "null");50 should Be("new MouseEvent('eventType', { view: true }).view", "null");51 should Be("new MouseEvent('eventType', { view: '' }).view", "null");52 should Be("new MouseEvent('eventType', { view: 'chocolate' }).view", "null");53 should Be("new MouseEvent('eventType', { view: 12345 }).view", "null");54 should Be("new MouseEvent('eventType', { view: 18446744073709551615 }).view", "null");55 should Be("new MouseEvent('eventType', { view: NaN }).view", "null");45 shouldThrowErrorName("new MouseEvent('eventType', { view: testObject }).view", "TypeError"); 46 shouldThrowErrorName("new MouseEvent('eventType', { view: document }).view", "TypeError"); 47 shouldBeNull("new MouseEvent('eventType', { view: undefined }).view"); 48 shouldBeNull("new MouseEvent('eventType', { view: null }).view"); 49 shouldThrowErrorName("new MouseEvent('eventType', { view: false }).view", "TypeError"); 50 shouldThrowErrorName("new MouseEvent('eventType', { view: true }).view", "TypeError"); 51 shouldThrowErrorName("new MouseEvent('eventType', { view: '' }).view", "TypeError"); 52 shouldThrowErrorName("new MouseEvent('eventType', { view: 'chocolate' }).view", "TypeError"); 53 shouldThrowErrorName("new MouseEvent('eventType', { view: 12345 }).view", "TypeError"); 54 shouldThrowErrorName("new MouseEvent('eventType', { view: 18446744073709551615 }).view", "TypeError"); 55 shouldThrowErrorName("new MouseEvent('eventType', { view: NaN }).view", "TypeError"); 56 56 // Note that valueOf() is not called, when the left hand side is evaluated. 57 should BeFalse("new MouseEvent('eventType', { view: {valueOf: function () { return window; } } }).view == window");58 should Be("new MouseEvent('eventType', { get view() { return 123; } }).view", "null");57 shouldThrowErrorName("new MouseEvent('eventType', { view: {valueOf: function () { return window; } } }).view", "TypeError"); 58 shouldThrowErrorName("new MouseEvent('eventType', { get view() { return 123; } }).view", "TypeError"); 59 59 shouldThrow("new MouseEvent('eventType', { get view() { throw 'MouseEvent Error'; } })"); 60 60 -
trunk/LayoutTests/fast/events/constructors/ui-event-constructor-expected.txt
r140493 r203950 14 14 PASS new UIEvent('eventType', { view: window }).view is window 15 15 PASS new UIEvent('eventType', { view: this }).view is this 16 PASS new UIEvent('eventType', { view: testObject }).view is null17 PASS new UIEvent('eventType', { view: document }).view is null16 PASS new UIEvent('eventType', { view: testObject }).view threw exception TypeError: Dictionary member is not of type Window. 17 PASS new UIEvent('eventType', { view: document }).view threw exception TypeError: Dictionary member is not of type Window. 18 18 PASS new UIEvent('eventType', { view: undefined }).view is null 19 19 PASS new UIEvent('eventType', { view: null }).view is null 20 PASS new UIEvent('eventType', { view: false }).view is null21 PASS new UIEvent('eventType', { view: true }).view is null22 PASS new UIEvent('eventType', { view: '' }).view is null23 PASS new UIEvent('eventType', { view: 'chocolate' }).view is null24 PASS new UIEvent('eventType', { view: 12345 }).view is null25 PASS new UIEvent('eventType', { view: 18446744073709551615 }).view is null26 PASS new UIEvent('eventType', { view: NaN }).view is null27 PASS new UIEvent('eventType', { view: {valueOf: function () { return window; } } }).view == window is false28 PASS new UIEvent('eventType', { get view() { return 123; } }).view is null20 PASS new UIEvent('eventType', { view: false }).view threw exception TypeError: Dictionary member is not of type Window. 21 PASS new UIEvent('eventType', { view: true }).view threw exception TypeError: Dictionary member is not of type Window. 22 PASS new UIEvent('eventType', { view: '' }).view threw exception TypeError: Dictionary member is not of type Window. 23 PASS new UIEvent('eventType', { view: 'chocolate' }).view threw exception TypeError: Dictionary member is not of type Window. 24 PASS new UIEvent('eventType', { view: 12345 }).view threw exception TypeError: Dictionary member is not of type Window. 25 PASS new UIEvent('eventType', { view: 18446744073709551615 }).view threw exception TypeError: Dictionary member is not of type Window. 26 PASS new UIEvent('eventType', { view: NaN }).view threw exception TypeError: Dictionary member is not of type Window. 27 PASS new UIEvent('eventType', { view: {valueOf: function () { return window; } } }).view threw exception TypeError: Dictionary member is not of type Window. 28 PASS new UIEvent('eventType', { get view() { return 123; } }).view threw exception TypeError: Dictionary member is not of type Window. 29 29 PASS new UIEvent('eventType', { get view() { throw 'UIEvent Error'; } }) threw exception UIEvent Error. 30 30 PASS new UIEvent('eventType', { detail: 0 }).detail is 0 -
trunk/LayoutTests/fast/events/constructors/ui-event-constructor.html
r155267 r203950 31 31 32 32 // Non-window objects. 33 should Be("new UIEvent('eventType', { view: testObject }).view", "null");34 should Be("new UIEvent('eventType', { view: document }).view", "null");35 shouldBe ("new UIEvent('eventType', { view: undefined }).view", "null");36 shouldBe ("new UIEvent('eventType', { view: null }).view", "null");37 should Be("new UIEvent('eventType', { view: false }).view", "null");38 should Be("new UIEvent('eventType', { view: true }).view", "null");39 should Be("new UIEvent('eventType', { view: '' }).view", "null");40 should Be("new UIEvent('eventType', { view: 'chocolate' }).view", "null");41 should Be("new UIEvent('eventType', { view: 12345 }).view", "null");42 should Be("new UIEvent('eventType', { view: 18446744073709551615 }).view", "null");43 should Be("new UIEvent('eventType', { view: NaN }).view", "null");33 shouldThrowErrorName("new UIEvent('eventType', { view: testObject }).view", "TypeError"); 34 shouldThrowErrorName("new UIEvent('eventType', { view: document }).view", "TypeError"); 35 shouldBeNull("new UIEvent('eventType', { view: undefined }).view"); 36 shouldBeNull("new UIEvent('eventType', { view: null }).view"); 37 shouldThrowErrorName("new UIEvent('eventType', { view: false }).view", "TypeError"); 38 shouldThrowErrorName("new UIEvent('eventType', { view: true }).view", "TypeError"); 39 shouldThrowErrorName("new UIEvent('eventType', { view: '' }).view", "TypeError"); 40 shouldThrowErrorName("new UIEvent('eventType', { view: 'chocolate' }).view", "TypeError"); 41 shouldThrowErrorName("new UIEvent('eventType', { view: 12345 }).view", "TypeError"); 42 shouldThrowErrorName("new UIEvent('eventType', { view: 18446744073709551615 }).view", "TypeError"); 43 shouldThrowErrorName("new UIEvent('eventType', { view: NaN }).view", "TypeError"); 44 44 // Note that valueOf() is not called, when the left hand side is evaluated. 45 should BeFalse("new UIEvent('eventType', { view: {valueOf: function () { return window; } } }).view == window");46 should Be("new UIEvent('eventType', { get view() { return 123; } }).view", "null");45 shouldThrowErrorName("new UIEvent('eventType', { view: {valueOf: function () { return window; } } }).view", "TypeError"); 46 shouldThrowErrorName("new UIEvent('eventType', { get view() { return 123; } }).view", "TypeError"); 47 47 shouldThrow("new UIEvent('eventType', { get view() { throw 'UIEvent Error'; } })"); 48 48 -
trunk/LayoutTests/fast/events/constructors/wheel-event-constructor.html
r155267 r203950 46 46 47 47 // Non-window objects. 48 should Be("new WheelEvent('eventType', { view: testObject }).view", "null");49 should Be("new WheelEvent('eventType', { view: document }).view", "null");50 shouldBe ("new WheelEvent('eventType', { view: undefined }).view", "null");51 shouldBe ("new WheelEvent('eventType', { view: null }).view", "null");52 should Be("new WheelEvent('eventType', { view: false }).view", "null");53 should Be("new WheelEvent('eventType', { view: true }).view", "null");54 should Be("new WheelEvent('eventType', { view: '' }).view", "null");55 should Be("new WheelEvent('eventType', { view: 'chocolate' }).view", "null");56 should Be("new WheelEvent('eventType', { view: 12345 }).view", "null");57 should Be("new WheelEvent('eventType', { view: 18446744073709551615 }).view", "null");58 should Be("new WheelEvent('eventType', { view: NaN }).view", "null");48 shouldThrowErrorName("new WheelEvent('eventType', { view: testObject }).view", "TypeError"); 49 shouldThrowErrorName("new WheelEvent('eventType', { view: document }).view", "TypeError"); 50 shouldBeNull("new WheelEvent('eventType', { view: undefined }).view"); 51 shouldBeNull("new WheelEvent('eventType', { view: null }).view"); 52 shouldThrowErrorName("new WheelEvent('eventType', { view: false }).view", "TypeError"); 53 shouldThrowErrorName("new WheelEvent('eventType', { view: true }).view", "TypeError"); 54 shouldThrowErrorName("new WheelEvent('eventType', { view: '' }).view", "TypeError"); 55 shouldThrowErrorName("new WheelEvent('eventType', { view: 'chocolate' }).view", "TypeError"); 56 shouldThrowErrorName("new WheelEvent('eventType', { view: 12345 }).view", "TypeError"); 57 shouldThrowErrorName("new WheelEvent('eventType', { view: 18446744073709551615 }).view", "TypeError"); 58 shouldThrowErrorName("new WheelEvent('eventType', { view: NaN }).view", "TypeError"); 59 59 // Note that valueOf() is not called, when the left hand side is evaluated. 60 should BeFalse("new WheelEvent('eventType', { view: {valueOf: function () { return window; } } }).view == window");61 should Be("new WheelEvent('eventType', { get view() { return 123; } }).view", "null");60 shouldThrowErrorName("new WheelEvent('eventType', { view: {valueOf: function () { return window; } } }).view", "TypeError"); 61 shouldThrowErrorName("new WheelEvent('eventType', { get view() { return 123; } }).view", "TypeError"); 62 62 shouldThrow("new WheelEvent('eventType', { get view() { throw 'WheelEvent Error'; } })"); 63 63 -
trunk/LayoutTests/imported/w3c/ChangeLog
r203941 r203950 1 2016-07-30 Chris Dumez <cdumez@apple.com> 2 3 Enable strict type checking for Window dictionary members 4 https://bugs.webkit.org/show_bug.cgi?id=160356 5 6 Reviewed by Darin Adler. 7 8 Rebaseline W3C test now that one more check is passing. 9 10 * web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt: 11 1 12 2016-07-30 Chris Dumez <cdumez@apple.com> 2 13 -
trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt
r203164 r203950 42 42 PASS CompositionEvent constructor (argument with default values) 43 43 PASS CompositionEvent constructor (argument with non-default values) 44 FAIL UIEvent constructor (view argument with wrong type) assert_throws: function "function () { 45 new UIEvent("x", { view: 7 }) 46 }" did not throw 44 PASS UIEvent constructor (view argument with wrong type) 47 45 -
trunk/LayoutTests/platform/mac/fast/events/constructors/mouse-event-constructor-expected.txt
r174745 r203950 24 24 PASS new MouseEvent('eventType', { view: window }).view is window 25 25 PASS new MouseEvent('eventType', { view: this }).view is this 26 PASS new MouseEvent('eventType', { view: testObject }).view is null27 PASS new MouseEvent('eventType', { view: document }).view is null26 PASS new MouseEvent('eventType', { view: testObject }).view threw exception TypeError: Dictionary member is not of type Window. 27 PASS new MouseEvent('eventType', { view: document }).view threw exception TypeError: Dictionary member is not of type Window. 28 28 PASS new MouseEvent('eventType', { view: undefined }).view is null 29 29 PASS new MouseEvent('eventType', { view: null }).view is null 30 PASS new MouseEvent('eventType', { view: false }).view is null31 PASS new MouseEvent('eventType', { view: true }).view is null32 PASS new MouseEvent('eventType', { view: '' }).view is null33 PASS new MouseEvent('eventType', { view: 'chocolate' }).view is null34 PASS new MouseEvent('eventType', { view: 12345 }).view is null35 PASS new MouseEvent('eventType', { view: 18446744073709551615 }).view is null36 PASS new MouseEvent('eventType', { view: NaN }).view is null37 PASS new MouseEvent('eventType', { view: {valueOf: function () { return window; } } }).view == window is false38 PASS new MouseEvent('eventType', { get view() { return 123; } }).view is null30 PASS new MouseEvent('eventType', { view: false }).view threw exception TypeError: Dictionary member is not of type Window. 31 PASS new MouseEvent('eventType', { view: true }).view threw exception TypeError: Dictionary member is not of type Window. 32 PASS new MouseEvent('eventType', { view: '' }).view threw exception TypeError: Dictionary member is not of type Window. 33 PASS new MouseEvent('eventType', { view: 'chocolate' }).view threw exception TypeError: Dictionary member is not of type Window. 34 PASS new MouseEvent('eventType', { view: 12345 }).view threw exception TypeError: Dictionary member is not of type Window. 35 PASS new MouseEvent('eventType', { view: 18446744073709551615 }).view threw exception TypeError: Dictionary member is not of type Window. 36 PASS new MouseEvent('eventType', { view: NaN }).view threw exception TypeError: Dictionary member is not of type Window. 37 PASS new MouseEvent('eventType', { view: {valueOf: function () { return window; } } }).view threw exception TypeError: Dictionary member is not of type Window. 38 PASS new MouseEvent('eventType', { get view() { return 123; } }).view threw exception TypeError: Dictionary member is not of type Window. 39 39 PASS new MouseEvent('eventType', { get view() { throw 'MouseEvent Error'; } }) threw exception MouseEvent Error. 40 40 PASS new MouseEvent('eventType', { detail: 0 }).detail is 0 -
trunk/LayoutTests/platform/mac/fast/events/constructors/wheel-event-constructor-expected.txt
r174745 r203950 27 27 PASS new WheelEvent('eventType', { view: window }).view is window 28 28 PASS new WheelEvent('eventType', { view: this }).view is this 29 PASS new WheelEvent('eventType', { view: testObject }).view is null30 PASS new WheelEvent('eventType', { view: document }).view is null29 PASS new WheelEvent('eventType', { view: testObject }).view threw exception TypeError: Dictionary member is not of type Window. 30 PASS new WheelEvent('eventType', { view: document }).view threw exception TypeError: Dictionary member is not of type Window. 31 31 PASS new WheelEvent('eventType', { view: undefined }).view is null 32 32 PASS new WheelEvent('eventType', { view: null }).view is null 33 PASS new WheelEvent('eventType', { view: false }).view is null34 PASS new WheelEvent('eventType', { view: true }).view is null35 PASS new WheelEvent('eventType', { view: '' }).view is null36 PASS new WheelEvent('eventType', { view: 'chocolate' }).view is null37 PASS new WheelEvent('eventType', { view: 12345 }).view is null38 PASS new WheelEvent('eventType', { view: 18446744073709551615 }).view is null39 PASS new WheelEvent('eventType', { view: NaN }).view is null40 PASS new WheelEvent('eventType', { view: {valueOf: function () { return window; } } }).view == window is false41 PASS new WheelEvent('eventType', { get view() { return 123; } }).view is null33 PASS new WheelEvent('eventType', { view: false }).view threw exception TypeError: Dictionary member is not of type Window. 34 PASS new WheelEvent('eventType', { view: true }).view threw exception TypeError: Dictionary member is not of type Window. 35 PASS new WheelEvent('eventType', { view: '' }).view threw exception TypeError: Dictionary member is not of type Window. 36 PASS new WheelEvent('eventType', { view: 'chocolate' }).view threw exception TypeError: Dictionary member is not of type Window. 37 PASS new WheelEvent('eventType', { view: 12345 }).view threw exception TypeError: Dictionary member is not of type Window. 38 PASS new WheelEvent('eventType', { view: 18446744073709551615 }).view threw exception TypeError: Dictionary member is not of type Window. 39 PASS new WheelEvent('eventType', { view: NaN }).view threw exception TypeError: Dictionary member is not of type Window. 40 PASS new WheelEvent('eventType', { view: {valueOf: function () { return window; } } }).view threw exception TypeError: Dictionary member is not of type Window. 41 PASS new WheelEvent('eventType', { get view() { return 123; } }).view threw exception TypeError: Dictionary member is not of type Window. 42 42 PASS new WheelEvent('eventType', { get view() { throw 'WheelEvent Error'; } }) threw exception WheelEvent Error. 43 43 PASS new WheelEvent('eventType', { detail: 0 }).detail is 0 -
trunk/LayoutTests/resources/js-test-pre.js
r202609 r203950 616 616 else 617 617 testFailed((_message ? _message : _a) + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was " + _av + "."); 618 } 619 620 function shouldThrowErrorName(_a, _name) 621 { 622 var _exception; 623 try { 624 typeof _a == "function" ? _a() : eval(_a); 625 } catch (e) { 626 _exception = e; 627 } 628 629 if (_exception) { 630 if (_exception.name == _name) 631 testPassed(_a + " threw exception " + _exception + "."); 632 else 633 testFailed(_a + " should throw a " + _name + ". Threw a " + _exception.name + "."); 634 } else 635 testFailed(_a + " should throw a " + _name + ". Did not throw."); 618 636 } 619 637 -
trunk/Source/WebCore/ChangeLog
r203949 r203950 1 2016-07-30 Chris Dumez <cdumez@apple.com> 2 3 Enable strict type checking for Window dictionary members 4 https://bugs.webkit.org/show_bug.cgi?id=160356 5 6 Reviewed by Darin Adler. 7 8 Enable strict type checking for Window dictionary members. Technically, 9 we should do strict type checking of all wrapper types but this patch 10 focuses on Window because it is common to pass a Window dictionary 11 member to Event constructors. 12 13 By strict type checking, I mean that we should throw a TypeError is 14 the value is not null/undefined and does not implement the Window 15 interface: 16 - http://heycam.github.io/webidl/#es-interface 17 18 Firefox and Chrome comply with the specification already. 19 20 No new tests, updated / rebaselined existing tests. 21 22 * bindings/js/JSDictionary.cpp: 23 (WebCore::JSDictionary::convertValue): 24 1 25 2016-07-30 Chris Dumez <cdumez@apple.com> 2 26 -
trunk/Source/WebCore/bindings/js/JSDictionary.cpp
r203065 r203950 179 179 void JSDictionary::convertValue(ExecState* state, JSValue value, RefPtr<DOMWindow>& result) 180 180 { 181 result = JSDOMWindow::toWrapped(*state, value); 181 auto* window = JSDOMWindow::toWrapped(*state, value); 182 if (UNLIKELY(!window) && !value.isUndefinedOrNull()) { 183 throwVMTypeError(state, "Dictionary member is not of type Window"); 184 return; 185 } 186 result = window; 182 187 } 183 188
Note: See TracChangeset
for help on using the changeset viewer.