diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 77e8f3ff4bd..b0120eac2a6 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -2816,7 +2816,8 @@ function FillInHTMLTooltip(tipElement) tipElement instanceof HTMLTextAreaElement || tipElement instanceof HTMLSelectElement || tipElement instanceof HTMLButtonElement) && - !tipElement.hasAttribute('title')) { + !tipElement.hasAttribute('title') && + (!tipElement.form || !tipElement.form.noValidate)) { // If the element is barred from constraint validation or valid, // the validation message will be the empty string. titleText = tipElement.validationMessage; diff --git a/browser/base/content/test/browser_bug581947.js b/browser/base/content/test/browser_bug581947.js index e392ba726ac..7f2947cb05d 100644 --- a/browser/base/content/test/browser_bug581947.js +++ b/browser/base/content/test/browser_bug581947.js @@ -26,6 +26,12 @@ function check(aElementName, aBarred, aType) { ok (!FillInHTMLTooltip(e), "No tooltip should be shown if the title attribute is set"); + e.removeAttribute('title'); + content.setAttribute('novalidate', ''); + ok (!FillInHTMLTooltip(e), + "No tooltip should be shown if the novalidate attribute is set on the form owner"); + content.removeAttribute('novalidate'); + content.removeChild(e); } @@ -84,6 +90,6 @@ function test () { }, true); content.location = - "data:text/html,
"; + "data:text/html,
"; } diff --git a/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp b/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp index 3168c0e216e..eab54720121 100644 --- a/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp +++ b/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp @@ -1111,7 +1111,17 @@ DefaultTooltipTextProvider::GetNodeText(nsIDOMNode *aNode, PRUnichar **aText, if (cvElement) { nsCOMPtr content = do_QueryInterface(cvElement); nsCOMPtr titleAtom = do_GetAtom("title"); - if (content->HasAttr(kNameSpaceID_None, titleAtom)) { + + nsCOMPtr formControl = do_QueryInterface(content); + PRBool formHasNoValidate = PR_FALSE; + mozilla::dom::Element* form = formControl->GetFormElement(); + if (form) { + nsCOMPtr noValidateAtom = do_GetAtom("novalidate"); + formHasNoValidate = form->HasAttr(kNameSpaceID_None, noValidateAtom); + } + + if (!content->HasAttr(kNameSpaceID_None, titleAtom) && + !formHasNoValidate) { cvElement->GetValidationMessage(outText); found = !outText.IsEmpty(); }