Changeset 139372 in webkit
- Timestamp:
- Jan 10, 2013 2:40:15 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r139370 r139372 1 2013-01-10 Dan Beam <dbeam@chromium.org> 2 3 Implement AutocompleteErrorEvent#reason 4 https://bugs.webkit.org/show_bug.cgi?id=105568 5 6 Added tests to verify event creation and global event constructor existence of AutocompleteErrorEvent 7 and updated the existing tests to make sure errors received are of the right type and have the right reason. 8 9 Reviewed by Adam Barth. 10 11 * fast/events/constructors/autocomplete-error-event-constructor-expected.txt: Added. 12 * fast/events/constructors/autocomplete-error-event-constructor.html: Added. 13 * fast/events/event-creation.html: Added new AutocompleteErrorEvent() test case. 14 * fast/forms/form-request-autocomplete.html: Updated 'autocompleteerror' listeners to check event.reason. 15 * fast/js/constructor-length.html: Added AutocompleteErrorEvent to list. 16 * fast/js/script-tests/global-constructors.js: Added AutocompleteErrorEvent to list. 17 * platform/blackberry/fast/js/constructor-length-expected.txt: Added expected ReferenceError. 18 * platform/chromium/fast/events/constructors/autocomplete-error-event-constructor-expected.txt: Added. 19 * platform/chromium/fast/forms/form-request-autocomplete-expected.txt: Updated passing expectations. 20 * platform/chromium/fast/js/constructor-length-expected.txt: Added expected 0 length result. 21 * platform/gtk/fast/js/constructor-length-expected.txt: Added expected ReferenceError. 22 * platform/mac/fast/js/constructor-length-expected.txt: Added expected ReferenceError. 23 * platform/qt/fast/js/constructor-length-expected.txt: Added expected ReferenceError. 24 1 25 2013-01-10 Roger Fong <roger_fong@apple.com> 2 26 -
trunk/LayoutTests/fast/events/event-creation.html
r121234 r139372 223 223 // shouldBeTrue("document.createEvent('OrientationEvent') instanceof window.Event"); 224 224 // shouldBeTrue("document.createEvent('OrientationEvent').constructor === window.Event"); 225 226 // #if ENABLE(REQUEST_AUTOCOMPLETE) 227 // AutocompleteErrorEvent 228 // shouldBeTrue("document.createEvent('AutocompleteErrorEvent') instanceof window.AutocompleteErrorEvent"); 229 // shouldBeTrue("document.createEvent('AutocompleteErrorEvent') instanceof window.Event"); 230 // shouldBeTrue("document.createEvent('AutocompleteErrorEvent').constructor === window.AutocompleteErrorEvent"); 225 231 226 232 -
trunk/LayoutTests/fast/forms/form-request-autocomplete.html
r136800 r139372 19 19 checkDynamicAttributes(); 20 20 checkParsedAttributes(); 21 checkNonUserGesture(); 21 22 } 22 23 … … 41 42 var form = document.forms[0]; 42 43 checkForEnumerableProperties(form); 44 45 // Currently Chrome just immediately dispatches an error. 46 form.onautocompleteerror = errorWithReason('disabled'); 43 47 form.requestAutocomplete(); 44 48 } … … 52 56 53 57 form.autocomplete = 'off'; 54 form.onautocompleteerror = onError;58 form.onautocompleteerror = errorWithReason('disabled'); 55 59 form.requestAutocomplete(); 56 60 } … … 62 66 var form = document.createElement('form'); 63 67 checkForEnumerableProperties(form); 64 form.onautocompleteerror = onError;68 form.onautocompleteerror = errorWithReason('disabled'); 65 69 66 70 setTimeout(function() … … 68 72 form.requestAutocomplete(); 69 73 }, 0); 74 } 75 76 function errorWithReason(reason) 77 { 78 return function(event) { 79 if (event instanceof AutocompleteErrorEvent) 80 testPassed('event is an AutocompleteErrorEvent'); 81 else 82 testFailed('expected an AutocompleteErrorEvent'); 83 84 if (event.reason == reason) 85 testPassed('got expected reason: ' + reason); 86 else 87 testFailed('wrong reason, expected: ' + reason + ', got: ' + event.reason); 88 89 onError(); 90 }; 70 91 } 71 92 -
trunk/LayoutTests/fast/js/constructor-length.html
r138354 r139372 10 10 shouldBe('ArrayBuffer.length', '1'); 11 11 shouldBe('AudioContext.length', '0'); 12 shouldBe('AutocompleteErrorEvent.length', '2'); 12 13 shouldBe('BeforeLoadEvent.length', '2'); 13 14 shouldBe('Blob.length', '2'); -
trunk/LayoutTests/fast/js/script-tests/global-constructors.js
r130343 r139372 40 40 name == "Float64Array" || 41 41 name == "FileError" || 42 name == "FileReader") 42 name == "FileReader" || 43 name == "AutocompleteErrorEvent") 43 44 continue; 44 45 -
trunk/LayoutTests/platform/blackberry/fast/js/constructor-length-expected.txt
r138354 r139372 6 6 PASS ArrayBuffer.length is 1 7 7 FAIL AudioContext.length should be 0. Threw exception ReferenceError: Can't find variable: AudioContext 8 FAIL AutocompleteErrorEvent.length should be 2. Threw exception ReferenceError: Can't find variable: AutocompleteErrorEvent 8 9 PASS BeforeLoadEvent.length is 2 9 10 PASS Blob.length is 2 -
trunk/LayoutTests/platform/chromium/fast/forms/form-request-autocomplete-expected.txt
r133720 r139372 5 5 PASS no enumerable properties on HTMLFormElement 6 6 PASS no enumerable properties on HTMLFormElement 7 PASS got expected number of error events (2) 7 PASS no enumerable properties on HTMLFormElement 8 PASS event is an AutocompleteErrorEvent 9 PASS got expected reason: disabled 10 PASS event is an AutocompleteErrorEvent 11 PASS got expected reason: disabled 12 PASS event is an AutocompleteErrorEvent 13 PASS got expected reason: disabled 14 PASS got expected number of error events (3) 8 15 PASS successfullyParsed is true 9 16 -
trunk/LayoutTests/platform/chromium/fast/js/constructor-length-expected.txt
r138354 r139372 6 6 FAIL ArrayBuffer.length should be 1. Was 0. 7 7 FAIL AudioContext.length should be 0. Threw exception ReferenceError: AudioContext is not defined 8 FAIL AutocompleteErrorEvent.length should be 2. Was 0. 8 9 FAIL BeforeLoadEvent.length should be 2. Was 0. 9 10 FAIL Blob.length should be 2. Was 0. -
trunk/LayoutTests/platform/gtk/fast/js/constructor-length-expected.txt
r138354 r139372 6 6 PASS ArrayBuffer.length is 1 7 7 FAIL AudioContext.length should be 0. Threw exception ReferenceError: Can't find variable: AudioContext 8 FAIL AutocompleteErrorEvent.length should be 2. Threw exception ReferenceError: Can't find variable: AutocompleteErrorEvent 8 9 PASS BeforeLoadEvent.length is 2 9 10 PASS Blob.length is 2 -
trunk/LayoutTests/platform/mac/fast/js/constructor-length-expected.txt
r138354 r139372 6 6 PASS ArrayBuffer.length is 1 7 7 FAIL AudioContext.length should be 0. Threw exception ReferenceError: Can't find variable: AudioContext 8 FAIL AutocompleteErrorEvent.length should be 2. Threw exception ReferenceError: Can't find variable: AutocompleteErrorEvent 8 9 PASS BeforeLoadEvent.length is 2 9 10 PASS Blob.length is 2 -
trunk/LayoutTests/platform/qt/fast/js/constructor-length-expected.txt
r138354 r139372 6 6 PASS ArrayBuffer.length is 1 7 7 FAIL AudioContext.length should be 0. Threw exception ReferenceError: Can't find variable: AudioContext 8 FAIL AutocompleteErrorEvent.length should be 2. Threw exception ReferenceError: Can't find variable: AutocompleteErrorEvent 8 9 PASS BeforeLoadEvent.length is 2 9 10 PASS Blob.length is 2 -
trunk/Source/WebCore/ChangeLog
r139371 r139372 1 2013-01-10 Dan Beam <dbeam@chromium.org> 2 3 Implement AutocompleteErrorEvent#reason 4 https://bugs.webkit.org/show_bug.cgi?id=105568 5 6 Reviewed by Adam Barth. 7 8 Test: fast/events/constructors/autocomplete-error-event-constructor.html 9 10 * WebCore.gypi: Added AutocompleteErrorEvent.idl and AutocompleteErrorEvent.h for chromium port's build. 11 * dom/AutocompleteErrorEvent.h: Added. 12 (WebCore): Added new type of error named AutocompleteErrorEvent. 13 (AutocompleteErrorEventInit): Added init params for AutocompleteErrorEvents (so initEvent() can be used). 14 (AutocompleteErrorEvent): Added a new error event that inherits from Event but also has a reason for failure. 15 (WebCore::AutocompleteErrorEvent::create): Factory function to create AutocompleteErrorEvents. 16 (WebCore::AutocompleteErrorEvent::reason): The reason why a requestAutocomplete() invocation failed. Can be 17 "disabled", "cancel", or "invalid". 18 (WebCore::AutocompleteErrorEvent::interfaceName): The name of the event's interface (for event.toString()). 19 (WebCore::AutocompleteErrorEvent::AutocompleteErrorEvent): Various ways of constructing the error event. 20 * dom/AutocompleteErrorEvent.idl: Added. 21 * dom/EventNames.in: Added AutocompleteError to this list, based on REQUEST_AUTOCOMPLETE conditional. 22 * html/HTMLFormElement.cpp: Updated form elements to dispatch AutocompleteErrorEvents on errors and to give 23 more details (event.reason) when the request fails. 24 (WebCore::HTMLFormElement::requestAutocomplete): Changed to newly added failure type "disabled". 25 (WebCore::HTMLFormElement::finishRequestAutocomplete): Changed 26 * html/HTMLFormElement.h: Added new results (ErrorDisabled, ErrorCancel, ErrorInvalid). 27 * page/DOMWindow.idl: Added global event constructor for new AutocompleteErrorEvent() style event creation. 28 1 29 2013-01-10 Yong Li <yoli@rim.com> 2 30 -
trunk/Source/WebCore/WebCore.gypi
r139325 r139372 191 191 'css/WebKitCSSViewportRule.idl', 192 192 'dom/Attr.idl', 193 'dom/AutocompleteErrorEvent.idl', 193 194 'dom/BeforeLoadEvent.idl', 194 195 'dom/CDATASection.idl', … … 2708 2709 'dom/AncestorChainWalker.h', 2709 2710 'dom/Attr.cpp', 2711 'dom/AutocompleteErrorEvent.h', 2710 2712 'dom/BeforeLoadEvent.h', 2711 2713 'dom/BeforeTextInsertedEvent.cpp', … … 6079 6081 '<(PRODUCT_DIR)/DerivedSources/WebCore/JSAudioBufferSourceNode.cpp', 6080 6082 '<(PRODUCT_DIR)/DerivedSources/WebCore/JSAudioBufferSourceNode.h', 6083 '<(PRODUCT_DIR)/DerivedSources/WebCore/JSAutocompleteErrorEvent.cpp', 6084 '<(PRODUCT_DIR)/DerivedSources/WebCore/JSAutocompleteErrorEvent.h', 6081 6085 '<(PRODUCT_DIR)/DerivedSources/WebCore/JSChannelMergerNode.cpp', 6082 6086 '<(PRODUCT_DIR)/DerivedSources/WebCore/JSChannelMergerNode.h', -
trunk/Source/WebCore/dom/EventNames.in
r131372 r139372 51 51 MediaKeyEvent conditional=ENCRYPTED_MEDIA 52 52 TrackEvent conditional=VIDEO_TRACK 53 AutocompleteErrorEvent conditional=REQUEST_AUTOCOMPLETE -
trunk/Source/WebCore/html/HTMLFormElement.cpp
r137406 r139372 27 27 28 28 #include "Attribute.h" 29 #include "AutocompleteErrorEvent.h" 29 30 #include "DOMFormData.h" 30 31 #include "DOMWindow.h" … … 400 401 401 402 if (!shouldAutocomplete() || !ScriptController::processingUserGesture()) { 402 finishRequestAutocomplete(AutocompleteResultError );403 finishRequestAutocomplete(AutocompleteResultErrorDisabled); 403 404 return; 404 405 } … … 412 413 void HTMLFormElement::finishRequestAutocomplete(AutocompleteResult result) 413 414 { 414 RefPtr<Event> event(Event::create(result == AutocompleteResultSuccess ? eventNames().autocompleteEvent : eventNames().autocompleteerrorEvent, false, false)); 415 RefPtr<Event> event; 416 if (result == AutocompleteResultSuccess) 417 event = Event::create(eventNames().autocompleteEvent, false, false); 418 else if (result == AutocompleteResultError) // FIXME: Remove when no longer used. 419 event = Event::create(eventNames().autocompleteerrorEvent, false, false); 420 else if (result == AutocompleteResultErrorDisabled) 421 event = AutocompleteErrorEvent::create("disabled"); 422 else if (result == AutocompleteResultErrorCancel) 423 event = AutocompleteErrorEvent::create("cancel"); 424 else if (result == AutocompleteResultErrorInvalid) 425 event = AutocompleteErrorEvent::create("invalid"); 426 415 427 event->setTarget(this); 416 428 m_pendingAutocompleteEvents.append(event.release()); -
trunk/Source/WebCore/html/HTMLFormElement.h
r135093 r139372 100 100 101 101 #if ENABLE(REQUEST_AUTOCOMPLETE) 102 enum AutocompleteResult { AutocompleteResultSuccess, AutocompleteResultError }; 102 enum AutocompleteResult { 103 AutocompleteResultSuccess, 104 AutocompleteResultError, // FIXME: Remove when no longer used. 105 AutocompleteResultErrorDisabled, 106 AutocompleteResultErrorCancel, 107 AutocompleteResultErrorInvalid, 108 }; 103 109 104 110 void requestAutocomplete(); -
trunk/Source/WebCore/page/DOMWindow.idl
r138843 r139372 564 564 [Conditional=WEBGL] attribute WebGLContextEventConstructor WebGLContextEvent; 565 565 [Conditional=PROXIMITY_EVENTS] attribute DeviceProximityEventConstructor DeviceProximityEvent; 566 [Conditional=REQUEST_AUTOCOMPLETE] attribute AutocompleteErrorEventConstructor AutocompleteErrorEvent; 566 567 567 568 attribute EventExceptionConstructor EventException; -
trunk/Source/WebKit/chromium/ChangeLog
r139367 r139372 1 2013-01-10 Dan Beam <dbeam@chromium.org> 2 3 Implement AutocompleteErrorEvent#reason 4 https://bugs.webkit.org/show_bug.cgi?id=105568 5 6 Reviewed by Adam Barth. 7 8 * public/WebFormElement.h: Added matching enum values for public chromium WebKit API. 9 * src/AssertMatchingEnums.cpp: Updated compile assert that WebKit and WebCore enums match. 10 1 11 2013-01-10 Adam Barth <abarth@webkit.org> 2 12 -
trunk/Source/WebKit/chromium/public/WebFormElement.h
r139323 r139372 70 70 WEBKIT_EXPORT void getFormControlElements(WebVector<WebFormControlElement>&) const; 71 71 72 enum AutocompleteResult { AutocompleteResultSuccess, AutocompleteResultError }; 72 enum AutocompleteResult { 73 AutocompleteResultSuccess, 74 AutocompleteResultError, // FIXME: Remove when not used any more. 75 AutocompleteResultErrorDisabled, 76 AutocompleteResultErrorCancel, 77 AutocompleteResultErrorInvalid, 78 }; 73 79 WEBKIT_EXPORT void finishRequestAutocomplete(WebFormElement::AutocompleteResult); 74 80 -
trunk/Source/WebKit/chromium/src/AssertMatchingEnums.cpp
r138738 r139372 629 629 COMPILE_ASSERT_MATCHING_ENUM(WebFormElement::AutocompleteResultSuccess, HTMLFormElement::AutocompleteResultSuccess); 630 630 COMPILE_ASSERT_MATCHING_ENUM(WebFormElement::AutocompleteResultError, HTMLFormElement::AutocompleteResultError); 631 #endif 631 COMPILE_ASSERT_MATCHING_ENUM(WebFormElement::AutocompleteResultErrorDisabled, HTMLFormElement::AutocompleteResultErrorDisabled); 632 COMPILE_ASSERT_MATCHING_ENUM(WebFormElement::AutocompleteResultErrorCancel, HTMLFormElement::AutocompleteResultErrorCancel); 633 COMPILE_ASSERT_MATCHING_ENUM(WebFormElement::AutocompleteResultErrorInvalid, HTMLFormElement::AutocompleteResultErrorInvalid); 634 #endif
Note: See TracChangeset
for help on using the changeset viewer.