diff -r 000000000000 -r 6474c204b198 browser/base/content/test/general/browser_bug595507.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/base/content/test/general/browser_bug595507.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,39 @@ +var gInvalidFormPopup = document.getElementById('invalid-form-popup'); +ok(gInvalidFormPopup, + "The browser should have a popup to show when a form is invalid"); + +/** + * Make sure that the form validation error message shows even if the form is in an iframe. + */ +function test() +{ + waitForExplicitFinish(); + + let uri = "data:text/html,
\""; + let tab = gBrowser.addTab(); + + gInvalidFormPopup.addEventListener("popupshown", function() { + gInvalidFormPopup.removeEventListener("popupshown", arguments.callee, false); + + let doc = gBrowser.contentDocument.getElementsByTagName('iframe')[0].contentDocument; + is(doc.activeElement, doc.getElementById('i'), + "First invalid element should be focused"); + + ok(gInvalidFormPopup.state == 'showing' || gInvalidFormPopup.state == 'open', + "The invalid form popup should be shown"); + + // Clean-up and next test. + gBrowser.removeTab(gBrowser.selectedTab, {animate: false}); + executeSoon(finish); + }, false); + + tab.linkedBrowser.addEventListener("load", function(aEvent) { + tab.linkedBrowser.removeEventListener("load", arguments.callee, true); + + gBrowser.contentDocument.getElementsByTagName('iframe')[0].contentDocument + .getElementById('s').click(); + }, true); + + gBrowser.selectedTab = tab; + gBrowser.selectedTab.linkedBrowser.loadURI(uri); +}