michael@0: var gInvalidFormPopup = document.getElementById('invalid-form-popup'); michael@0: ok(gInvalidFormPopup, michael@0: "The browser should have a popup to show when a form is invalid"); michael@0: michael@0: /** michael@0: * Make sure that the form validation error message shows even if the form is in an iframe. michael@0: */ michael@0: function test() michael@0: { michael@0: waitForExplicitFinish(); michael@0: michael@0: let uri = "data:text/html,
\""; michael@0: let tab = gBrowser.addTab(); michael@0: michael@0: gInvalidFormPopup.addEventListener("popupshown", function() { michael@0: gInvalidFormPopup.removeEventListener("popupshown", arguments.callee, false); michael@0: michael@0: let doc = gBrowser.contentDocument.getElementsByTagName('iframe')[0].contentDocument; michael@0: is(doc.activeElement, doc.getElementById('i'), michael@0: "First invalid element should be focused"); michael@0: michael@0: ok(gInvalidFormPopup.state == 'showing' || gInvalidFormPopup.state == 'open', michael@0: "The invalid form popup should be shown"); michael@0: michael@0: // Clean-up and next test. michael@0: gBrowser.removeTab(gBrowser.selectedTab, {animate: false}); michael@0: executeSoon(finish); michael@0: }, false); michael@0: michael@0: tab.linkedBrowser.addEventListener("load", function(aEvent) { michael@0: tab.linkedBrowser.removeEventListener("load", arguments.callee, true); michael@0: michael@0: gBrowser.contentDocument.getElementsByTagName('iframe')[0].contentDocument michael@0: .getElementById('s').click(); michael@0: }, true); michael@0: michael@0: gBrowser.selectedTab = tab; michael@0: gBrowser.selectedTab.linkedBrowser.loadURI(uri); michael@0: }