WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-100557-20121101200531.patch (text/plain), 20.85 KB, created by
Dan Beam
on 2012-11-01 20:07:10 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Dan Beam
Created:
2012-11-01 20:07:10 PDT
Size:
20.85 KB
patch
obsolete
>Subversion Revision: 133184 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 25fb10bf27babe0ffa3f48aff5d2ada3268c9936..6f759f96849cc7f9dee905774ed3c0ef721c083d 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,44 @@ >+2012-11-01 Dan Beam <dbeam@chromium.org> >+ >+ Implement HTMLFormElement#requestAutocomplete and associated events >+ https://bugs.webkit.org/show_bug.cgi?id=100557 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Implements an initial version of the proposal for interactive autocomplete outlined in this email: >+ http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-October/037711.html >+ >+ The goal of this patch is allow web authors to call formElement.requestAutocomplete(); after subscribing for >+ autocomplete/autocompleteerror events on formElement. If the form's [autocomplete] attribute is "off" an >+ error will be sent. Otherwise, a request will be issued to the FrameLoaderClient. At the moment, the >+ implementation in Chrome (https://codereview.chromium.org/11270018/) will simply dispatch an error until the >+ UI on Chrome's side is built. >+ >+ Currently this is behind the feature flag REQUEST_AUTOCOMPLETE, which is disabled. >+ >+ Test: fast/forms/request-autocomplete.html >+ >+ * dom/EventNames.h: >+ (WebCore): >+ * html/HTMLAttributeNames.in: >+ * html/HTMLFormElement.cpp: >+ (WebCore::HTMLFormElement::HTMLFormElement): >+ (WebCore): >+ (WebCore::HTMLFormElement::requestAutocomplete): >+ (WebCore::HTMLFormElement::finishRequestAutocomplete): >+ (WebCore::HTMLFormElement::requestAutocompleteTimerFired): >+ (WebCore::HTMLFormElement::parseAttribute): >+ * html/HTMLFormElement.h: >+ (HTMLFormElement): >+ * html/HTMLFormElement.idl: >+ * loader/EmptyClients.cpp: >+ (WebCore): >+ (WebCore::EmptyFrameLoaderClient::didRequestAutocomplete): >+ * loader/EmptyClients.h: >+ (EmptyFrameLoaderClient): >+ * loader/FrameLoaderClient.h: >+ (FrameLoaderClient): >+ > 2012-11-01 Adam Barth <abarth@webkit.org> > > Unreviewed. Build fix. >diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog >index 0fa7e11ac1496be4de48eb5884c95eedb3781048..bc0c985be4dc7dd5d3694f0167fc52df3599127b 100644 >--- a/Source/WebKit/chromium/ChangeLog >+++ b/Source/WebKit/chromium/ChangeLog >@@ -1,3 +1,27 @@ >+2012-11-01 Dan Beam <dbeam@chromium.org> >+ >+ Implement HTMLFormElement#requestAutocomplete and associated events >+ https://bugs.webkit.org/show_bug.cgi?id=100557 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Additional information of the change such as approach, rationale. Please add per-function descriptions below (OOPS!). >+ >+ * public/WebAutofillClient.h: >+ (WebKit): >+ (WebAutofillClient): >+ (WebKit::WebAutofillClient::didRequestAutocomplete): >+ * public/WebFormElement.h: >+ * src/AssertMatchingEnums.cpp: >+ * src/FrameLoaderClientImpl.cpp: >+ (WebKit): >+ (WebKit::FrameLoaderClientImpl::didRequestAutocomplete): >+ * src/FrameLoaderClientImpl.h: >+ (FrameLoaderClientImpl): >+ * src/WebFormElement.cpp: >+ (WebKit::WebFormElement::finishRequestAutocomplete): >+ (WebKit): >+ > 2012-11-01 James Robinson <jamesr@chromium.org> > > [chromium] Avoid attempting to defer commits when they are already deferred >diff --git a/Source/WebCore/dom/EventNames.h b/Source/WebCore/dom/EventNames.h >index 7a0552a4a70da93d420117fd202e9209c3b4721a..09b9ae766fb5db42f702c059119d96071c426efa 100644 >--- a/Source/WebCore/dom/EventNames.h >+++ b/Source/WebCore/dom/EventNames.h >@@ -243,6 +243,9 @@ namespace WebCore { > \ > macro(webkitdeviceproximity) \ > \ >+ macro(autocomplete) \ >+ macro(autocompleteerror) \ >+ \ > > // end of DOM_EVENT_NAMES_FOR_EACH > >diff --git a/Source/WebCore/html/HTMLAttributeNames.in b/Source/WebCore/html/HTMLAttributeNames.in >index 459078f64c08be2be431b00888dcf39bdb30b869..edea1595777cbddb1e329e9fda3c2a588ff795d9 100644 >--- a/Source/WebCore/html/HTMLAttributeNames.in >+++ b/Source/WebCore/html/HTMLAttributeNames.in >@@ -165,6 +165,8 @@ novalidate > nowrap > object > onabort >+onautocomplete >+onautocompleteerror > onbeforecopy > onbeforecut > onbeforeload >diff --git a/Source/WebCore/html/HTMLFormElement.cpp b/Source/WebCore/html/HTMLFormElement.cpp >index dde5ffa3163bd0cede2cd88457631f80b0935b5e..8c2a0458da2bcd0acc5bd66a1d04fa9ed1d93b68 100644 >--- a/Source/WebCore/html/HTMLFormElement.cpp >+++ b/Source/WebCore/html/HTMLFormElement.cpp >@@ -74,6 +74,9 @@ HTMLFormElement::HTMLFormElement(const QualifiedName& tagName, Document* documen > , m_shouldSubmit(false) > , m_isInResetFunction(false) > , m_wasDemoted(false) >+#if ENABLE(REQUEST_AUTOCOMPLETE) >+ , m_requestAutocompleteDelayTimer(this, &HTMLFormElement::requestAutocompleteTimerFired) >+#endif > { > ASSERT(hasTagName(formTag)); > } >@@ -387,6 +390,43 @@ void HTMLFormElement::reset() > m_isInResetFunction = false; > } > >+#if ENABLE(REQUEST_AUTOCOMPLETE) >+void HTMLFormElement::requestAutocomplete() >+{ >+ Frame* frame = document()->frame(); >+ if (!frame) >+ return; >+ >+ if (!shouldAutocomplete()) { >+ finishRequestAutocomplete(AutocompleteResultError); >+ return; >+ } >+ >+ StringPairVector controlNamesAndValues; >+ getTextFieldValues(controlNamesAndValues); >+ RefPtr<FormState> formState = FormState::create(this, controlNamesAndValues, document(), SubmittedByJavaScript); >+ frame->loader()->client()->didRequestAutocomplete(formState.release()); >+} >+ >+void HTMLFormElement::finishRequestAutocomplete(AutocompleteResult result) >+{ >+ RefPtr<Event> event(Event::create(result == AutocompleteResultSuccess ? eventNames().autocompleteEvent : eventNames().autocompleteerrorEvent, false, false)); >+ event->setTarget(this); >+ m_pendingAutocompleteEvents.append(event.release()); >+ if (!m_requestAutocompleteDelayTimer.isActive()) >+ m_requestAutocompleteDelayTimer.startOneShot(0); >+} >+ >+void HTMLFormElement::requestAutocompleteTimerFired(Timer<HTMLFormElement>*) >+{ >+ Vector<RefPtr<Event> > pendingEvents; >+ m_pendingAutocompleteEvents.swap(pendingEvents); >+ >+ for (size_t index = 0; index < pendingEvents.size(); ++index) >+ dispatchEvent(pendingEvents[index].release()); >+} >+#endif >+ > void HTMLFormElement::parseAttribute(const Attribute& attribute) > { > if (attribute.name() == actionAttr) >@@ -408,6 +448,12 @@ void HTMLFormElement::parseAttribute(const Attribute& attribute) > setAttributeEventListener(eventNames().submitEvent, createAttributeEventListener(this, attribute)); > else if (attribute.name() == onresetAttr) > setAttributeEventListener(eventNames().resetEvent, createAttributeEventListener(this, attribute)); >+#if ENABLE(REQUEST_AUTOCOMPLETE) >+ else if (attribute.name() == onautocompleteAttr) >+ setAttributeEventListener(eventNames().autocompleteEvent, createAttributeEventListener(this, attribute)); >+ else if (attribute.name() == onautocompleteerrorAttr) >+ setAttributeEventListener(eventNames().autocompleteerrorEvent, createAttributeEventListener(this, attribute)); >+#endif > else > HTMLElement::parseAttribute(attribute); > } >diff --git a/Source/WebCore/html/HTMLFormElement.h b/Source/WebCore/html/HTMLFormElement.h >index bf28cca3fb2c6af5857951b62cbf02320e4a96da..8fc19865b20e87e19a28d785f60c20e2f09e623b 100644 >--- a/Source/WebCore/html/HTMLFormElement.h >+++ b/Source/WebCore/html/HTMLFormElement.h >@@ -99,6 +99,17 @@ public: > > bool checkValidity(); > >+#if ENABLE(REQUEST_AUTOCOMPLETE) >+ enum AutocompleteResult { AutocompleteResultSuccess, AutocompleteResultError }; >+ >+ void requestAutocomplete(); >+ void finishRequestAutocomplete(AutocompleteResult); >+ void requestAutocompleteTimerFired(Timer<HTMLFormElement>*); >+ >+ DEFINE_ATTRIBUTE_EVENT_LISTENER(autocomplete); >+ DEFINE_ATTRIBUTE_EVENT_LISTENER(autocompleteerror); >+#endif >+ > HTMLFormControlElement* elementForAlias(const AtomicString&); > void addElementAlias(HTMLFormControlElement*, const AtomicString& alias); > >@@ -162,6 +173,11 @@ private: > bool m_isInResetFunction; > > bool m_wasDemoted; >+ >+#if ENABLE(REQUEST_AUTOCOMPLETE) >+ Vector<RefPtr<Event> > m_pendingAutocompleteEvents; >+ Timer<HTMLFormElement> m_requestAutocompleteDelayTimer; >+#endif > }; > > } // namespace WebCore >diff --git a/Source/WebCore/html/HTMLFormElement.idl b/Source/WebCore/html/HTMLFormElement.idl >index 86a6f74c63fdfd2dae0dfc02fd7cd72f8feb5188..d30de479295654ac7a57f40acba5fe3dd6f87825 100644 >--- a/Source/WebCore/html/HTMLFormElement.idl >+++ b/Source/WebCore/html/HTMLFormElement.idl >@@ -42,4 +42,8 @@ > #endif > void reset(); > boolean checkValidity(); >+ >+ [Conditional=REQUEST_AUTOCOMPLETE] void requestAutocomplete(); >+ [NotEnumerable, Conditional=REQUEST_AUTOCOMPLETE] attribute EventListener onautocomplete; >+ [NotEnumerable, Conditional=REQUEST_AUTOCOMPLETE] attribute EventListener onautocompleteerror; > }; >diff --git a/Source/WebCore/loader/EmptyClients.cpp b/Source/WebCore/loader/EmptyClients.cpp >index d60bd301ce5f7a711fef53101925d3b221a22b48..3502bebb952e7d3e791a5b29442082458584d9a7 100644 >--- a/Source/WebCore/loader/EmptyClients.cpp >+++ b/Source/WebCore/loader/EmptyClients.cpp >@@ -194,4 +194,10 @@ PassOwnPtr<ContextMenu> EmptyContextMenuClient::customizeMenu(PassOwnPtr<Context > #endif > #endif > >+#if ENABLE(REQUEST_AUTOCOMPLETE) >+void EmptyFrameLoaderClient::didRequestAutocomplete(PassRefPtr<FormState>) >+{ >+} >+#endif >+ > } >diff --git a/Source/WebCore/loader/EmptyClients.h b/Source/WebCore/loader/EmptyClients.h >index 73c98193415767024fb4600259ae5ee93a9aec40..a07ec152b3f79924b735746653f5329f0335b57a 100644 >--- a/Source/WebCore/loader/EmptyClients.h >+++ b/Source/WebCore/loader/EmptyClients.h >@@ -384,6 +384,10 @@ public: > #if ENABLE(WEB_INTENTS) > virtual void dispatchIntent(PassRefPtr<IntentRequest>) OVERRIDE; > #endif >+ >+#if ENABLE(REQUEST_AUTOCOMPLETE) >+ virtual void didRequestAutocomplete(PassRefPtr<FormState>) OVERRIDE; >+#endif > }; > > class EmptyTextCheckerClient : public TextCheckerClient { >diff --git a/Source/WebCore/loader/FrameLoaderClient.h b/Source/WebCore/loader/FrameLoaderClient.h >index 4f2388af5fbb4c5d65c30bff8884554c7c8b9c0d..b4abf88f359961b89aef876055a497856cf13c5f 100644 >--- a/Source/WebCore/loader/FrameLoaderClient.h >+++ b/Source/WebCore/loader/FrameLoaderClient.h >@@ -349,6 +349,10 @@ namespace WebCore { > #if ENABLE(MEDIA_STREAM) > virtual void dispatchWillStartUsingPeerConnectionHandler(RTCPeerConnectionHandler*) { } > #endif >+ >+#if ENABLE(REQUEST_AUTOCOMPLETE) >+ virtual void didRequestAutocomplete(PassRefPtr<FormState>) = 0; >+#endif > }; > > } // namespace WebCore >diff --git a/Source/WebKit/chromium/public/WebAutofillClient.h b/Source/WebKit/chromium/public/WebAutofillClient.h >index 7b48f57dbe46ea37ef6f4994c513cb2f93d687fc..7424c3fecdba9ffa7286e1b7eef3df8c960bfd5d 100644 >--- a/Source/WebKit/chromium/public/WebAutofillClient.h >+++ b/Source/WebKit/chromium/public/WebAutofillClient.h >@@ -33,6 +33,8 @@ > > namespace WebKit { > >+class WebFormElement; >+class WebFrame; > class WebInputElement; > class WebKeyboardEvent; > class WebNode; >@@ -75,6 +77,9 @@ public: > // keys to navigate outside the range of possible selections. > virtual void didClearAutofillSelection(const WebNode&) { } > >+ // Informs the browser an interactive autocomplete has been requested. >+ virtual void didRequestAutocomplete(WebFrame*, const WebFormElement&) { } >+ > // Instructs the browser to remove the Autocomplete entry specified from > // its DB. > virtual void removeAutocompleteSuggestion(const WebString& name, >diff --git a/Source/WebKit/chromium/public/WebFormElement.h b/Source/WebKit/chromium/public/WebFormElement.h >index 1ef431fa3656f5c278dc2e4d356124d11b767d51..27c99d3a17192f7d0808c87e72ca5da8a63b6c18 100644 >--- a/Source/WebKit/chromium/public/WebFormElement.h >+++ b/Source/WebKit/chromium/public/WebFormElement.h >@@ -69,6 +69,9 @@ namespace WebKit { > WEBKIT_EXPORT void getNamedElements(const WebString&, WebVector<WebNode>&); > WEBKIT_EXPORT void getFormControlElements(WebVector<WebFormControlElement>&) const; > >+ enum AutocompleteResult { AutocompleteResultSuccess, AutocompleteResultError }; >+ WEBKIT_EXPORT void finishRequestAutocomplete(WebFormElement::AutocompleteResult); >+ > #if WEBKIT_IMPLEMENTATION > WebFormElement(const WTF::PassRefPtr<WebCore::HTMLFormElement>&); > WebFormElement& operator=(const WTF::PassRefPtr<WebCore::HTMLFormElement>&); >diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp >index 538d9f198525dfa74210ad12c6cd22fb76645a7b..f3e7859eeb9850651dbcfe4184745230ecc4756e 100644 >--- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp >+++ b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp >@@ -48,6 +48,9 @@ > #include "FontSmoothingMode.h" > #include "GeolocationError.h" > #include "GeolocationPosition.h" >+#if ENABLE(REQUEST_AUTOCOMPLETE) >+#include "HTMLFormElement.h" >+#endif > #include "HTMLInputElement.h" > #include "IDBCursor.h" > #include "IDBDatabaseException.h" >@@ -86,6 +89,9 @@ > #include "WebFileError.h" > #include "WebFileInfo.h" > #include "WebFontDescription.h" >+#if ENABLE(REQUEST_AUTOCOMPLETE) >+#include "WebFormElement.h" >+#endif > #include "WebGeolocationError.h" > #include "WebGeolocationPosition.h" > #include "WebIDBCursor.h" >@@ -633,3 +639,8 @@ COMPILE_ASSERT_MATCHING_ENUM(WebURLResponse::HTTP_1_1, ResourceResponse::HTTP_1_ > COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::CORSModeUnspecified, MediaPlayerClient::Unspecified); > COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::CORSModeAnonymous, MediaPlayerClient::Anonymous); > COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::CORSModeUseCredentials, MediaPlayerClient::UseCredentials); >+ >+#if ENABLE(REQUEST_AUTOCOMPLETE) >+COMPILE_ASSERT_MATCHING_ENUM(WebFormElement::AutocompleteResultSuccess, HTMLFormElement::AutocompleteResultSuccess); >+COMPILE_ASSERT_MATCHING_ENUM(WebFormElement::AutocompleteResultError, HTMLFormElement::AutocompleteResultError); >+#endif >diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp >index 11c726a328a9a1c6078ec1948fb26e45f3104176..7ffe94339ec1c482297a272659e86662a3ed77ac 100644 >--- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp >+++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp >@@ -62,6 +62,9 @@ > #endif > #include "Settings.h" > #include "SocketStreamHandleInternal.h" >+#if ENABLE(REQUEST_AUTOCOMPLETE) >+#include "WebAutofillClient.h" >+#endif > #include "WebDOMEvent.h" > #include "WebDataSourceImpl.h" > #include "WebDevToolsAgentPrivate.h" >@@ -1651,5 +1654,12 @@ void FrameLoaderClientImpl::dispatchWillStartUsingPeerConnectionHandler(RTCPeerC > } > #endif > >+#if ENABLE(REQUEST_AUTOCOMPLETE) >+void FrameLoaderClientImpl::didRequestAutocomplete(PassRefPtr<FormState> formState) >+{ >+ if (m_webFrame->viewImpl() && m_webFrame->viewImpl()->autofillClient()) >+ m_webFrame->viewImpl()->autofillClient()->didRequestAutocomplete(m_webFrame, WebFormElement(formState->form())); >+} >+#endif > > } // namespace WebKit >diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h >index 12a76feee352605b905750a84e6c5fb3bdb1a3bc..6589c37bb79e5641df03a2aedc4bfbd0faa8ae00 100644 >--- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h >+++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h >@@ -225,6 +225,10 @@ public: > virtual void dispatchWillStartUsingPeerConnectionHandler(WebCore::RTCPeerConnectionHandler*) OVERRIDE; > #endif > >+#if ENABLE(REQUEST_AUTOCOMPLETE) >+ virtual void didRequestAutocomplete(PassRefPtr<WebCore::FormState>) OVERRIDE; >+#endif >+ > private: > void makeDocumentView(); > >diff --git a/Source/WebKit/chromium/src/WebFormElement.cpp b/Source/WebKit/chromium/src/WebFormElement.cpp >index cdae6620e8b35e596e5343531a755381e5fe7e4e..f6a9a67f06b33adf7307d440cff8853d32ee24a3 100644 >--- a/Source/WebKit/chromium/src/WebFormElement.cpp >+++ b/Source/WebKit/chromium/src/WebFormElement.cpp >@@ -102,6 +102,13 @@ void WebFormElement::getFormControlElements(WebVector<WebFormControlElement>& re > result.assign(tempVector); > } > >+void WebFormElement::finishRequestAutocomplete(WebFormElement::AutocompleteResult result) >+{ >+#if ENABLE(REQUEST_AUTOCOMPLETE) >+ unwrap<HTMLFormElement>()->finishRequestAutocomplete(static_cast<HTMLFormElement::AutocompleteResult>(result)); >+#endif >+} >+ > WebFormElement::WebFormElement(const PassRefPtr<HTMLFormElement>& e) > : WebElement(e) > { >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 9378c32f7835d87fc099fe7fd74ff3117d2cb317..26c73ee5e4960353fae4326fee3b05b8d7bcc619 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,24 @@ >+2012-11-01 Dan Beam <dbeam@chromium.org> >+ >+ Implement HTMLFormElement#requestAutocomplete and associated events >+ https://bugs.webkit.org/show_bug.cgi?id=100557 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Implements an initial version of the proposal for interactive autocomplete outlined in this email: >+ http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-October/037711.html >+ >+ The goal of this patch is allow web authors to call formElement.requestAutocomplete(); after subscribing for >+ autocomplete/autocompleteerror events on formElement. If the form's [autocomplete] attribute is "off" an >+ error will be sent. Otherwise, a request will be issued to the FrameLoaderClient. At the moment, the >+ implementation in Chrome (https://codereview.chromium.org/11270018/) will simply dispatch an error until the >+ UI on Chrome's side is built. >+ >+ Currently this is behind the feature flag REQUEST_AUTOCOMPLETE, which is disabled. >+ >+ * fast/forms/request-autocomplete-expected.txt: Added. >+ * fast/forms/request-autocomplete.html: Added. >+ > 2012-11-01 Emil A Eklund <eae@chromium.org> > > Unreviewed chromium windows rebaseline. >diff --git a/LayoutTests/fast/forms/request-autocomplete-expected.txt b/LayoutTests/fast/forms/request-autocomplete-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..c37acc07854033b5b4c24b73ea93aadcf0dab587 >--- /dev/null >+++ b/LayoutTests/fast/forms/request-autocomplete-expected.txt >@@ -0,0 +1,7 @@ >+Bug 100557: Implement HTMLFormElement#requestAutocomplete and associated events >+ >+For this test to pass, you should see all PASSED below. >+ >+FAILED: no requestAutocomplete function >+ >+ >diff --git a/LayoutTests/fast/forms/request-autocomplete.html b/LayoutTests/fast/forms/request-autocomplete.html >new file mode 100644 >index 0000000000000000000000000000000000000000..35e9b856ed13599ff9ec7fa07e3f85e4ffb0bc91 >--- /dev/null >+++ b/LayoutTests/fast/forms/request-autocomplete.html >@@ -0,0 +1,86 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script> >+if (window.testRunner) >+ testRunner.dumpAsText(); >+ >+function log(message) >+{ >+ var console = document.getElementById('console'); >+ console.appendChild(document.createTextNode(message)); >+ console.appendChild(document.createElement('br')); >+} >+ >+var numErrors = 0; >+var numErrorsExpected = 0; >+ >+function runTests() >+{ >+ if (typeof HTMLFormElement.prototype.requestAutocomplete != 'function') { >+ log('FAILED: no requestAutocomplete function'); >+ return; >+ } >+ >+ checkDynamicAttributes(); >+ checkParsedAttributes(); >+} >+ >+function checkForEnumerableProperties(form) >+{ >+ var enumerated = false; >+ for (var field in form) { >+ if (/onautocomplete/.test(field)) >+ log('FAILED: enumerable form attribute found on HTMLFormElement: ' + field); >+ enumerated = true; >+ } >+ log(enumerated ? 'PASSED: no enumerable properties on HTMLFormElement' : 'FAILED: to enumerate HTMLFormElement properties'); >+} >+ >+function checkParsedAttributes() >+{ >+ numErrorsExpected += 1; >+ >+ var form = document.forms[0]; >+ checkForEnumerableProperties(form); >+ form.requestAutocomplete(); >+} >+ >+function checkDynamicAttributes() >+{ >+ numErrorsExpected += 1; >+ >+ var form = document.createElement('form'); >+ checkForEnumerableProperties(form); >+ >+ form.autocomplete = 'off'; >+ form.onautocompleteerror = onError; >+ form.requestAutocomplete(); >+} >+ >+function onError() >+{ >+ numErrors += 1; >+ if (numErrors > numErrorsExpected) >+ log('FAILED: too many error events'); >+ else if (numErrors == numErrorsExpected) >+ doneTesting(); >+} >+ >+function doneTesting() >+{ >+ log('PASSED: got expected number of error events (' + numErrorsExpected + ')'); >+ if (window.notifyDone) >+ notifyDone(); >+} >+ >+window.addEventListener('load', runTests, true); >+</script> >+</head> >+<body> >+<p> Bug <a href="http://bugs.webkit.org/show_bug.cgi?id=100557">100557</a>: Implement HTMLFormElement#requestAutocomplete and associated events </p> >+<p> For this test to pass, you should see all PASSED below. </p> >+<form autocomplete="off" onautocompleteerror="onError();"></form> >+<p id="console"></p> >+<p class="block"></p> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 100557
:
170996
|
171054
|
171072
|
171356
|
171952
|
171979
|
172124
|
172139
|
172140