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.

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

mercurial