browser/base/content/test/general/browser_bug595507.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 var gInvalidFormPopup = document.getElementById('invalid-form-popup');
michael@0 2 ok(gInvalidFormPopup,
michael@0 3 "The browser should have a popup to show when a form is invalid");
michael@0 4
michael@0 5 /**
michael@0 6 * Make sure that the form validation error message shows even if the form is in an iframe.
michael@0 7 */
michael@0 8 function test()
michael@0 9 {
michael@0 10 waitForExplicitFinish();
michael@0 11
michael@0 12 let uri = "data:text/html,<iframe src=\"data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input required id='i'><input id='s' type='submit'></form>\"</iframe>";
michael@0 13 let tab = gBrowser.addTab();
michael@0 14
michael@0 15 gInvalidFormPopup.addEventListener("popupshown", function() {
michael@0 16 gInvalidFormPopup.removeEventListener("popupshown", arguments.callee, false);
michael@0 17
michael@0 18 let doc = gBrowser.contentDocument.getElementsByTagName('iframe')[0].contentDocument;
michael@0 19 is(doc.activeElement, doc.getElementById('i'),
michael@0 20 "First invalid element should be focused");
michael@0 21
michael@0 22 ok(gInvalidFormPopup.state == 'showing' || gInvalidFormPopup.state == 'open',
michael@0 23 "The invalid form popup should be shown");
michael@0 24
michael@0 25 // Clean-up and next test.
michael@0 26 gBrowser.removeTab(gBrowser.selectedTab, {animate: false});
michael@0 27 executeSoon(finish);
michael@0 28 }, false);
michael@0 29
michael@0 30 tab.linkedBrowser.addEventListener("load", function(aEvent) {
michael@0 31 tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
michael@0 32
michael@0 33 gBrowser.contentDocument.getElementsByTagName('iframe')[0].contentDocument
michael@0 34 .getElementById('s').click();
michael@0 35 }, true);
michael@0 36
michael@0 37 gBrowser.selectedTab = tab;
michael@0 38 gBrowser.selectedTab.linkedBrowser.loadURI(uri);
michael@0 39 }

mercurial