dom/browser-element/mochitest/priority/test_Background.html

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 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 Test that calling setVisible('false') on an iframe causes its visibility to
     5 change.
     6 -->
     7 <head>
     8   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <script type="application/javascript" src="../browserElementTestHelpers.js"></script>
    10   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    11 </head>
    12 <body>
    14 <script type="application/javascript;version=1.7">
    15 "use strict";
    17 SimpleTest.waitForExplicitFinish();
    18 browserElementTestHelpers.setEnabledPref(true);
    19 browserElementTestHelpers.addPermission();
    20 browserElementTestHelpers.enableProcessPriorityManager();
    22 function runTest() {
    23   var iframe = document.createElement('iframe');
    24   iframe.setAttribute('mozbrowser', true);
    26   iframe.src = browserElementTestHelpers.emptyPage1;
    28   var childID = null;
    29   expectOnlyOneProcessCreated().then(function(chid) {
    30     childID = chid;
    31   }).then(function() {
    32     return expectPriorityChange(childID, 'FOREGROUND');
    33   }).then(function() {
    34     return expectMozbrowserEvent(iframe, 'loadend');
    35   }).then(function() {
    36     var p = expectPriorityChange(childID, 'BACKGROUND');
    38     // We wait until mozbrowserloadend before calling setVisible, because
    39     // setVisible isn't available until mozbrowser has loaded.  In practice, that
    40     // means we can call setVisible once we've gotten /any/ mozbrowser event.
    41     iframe.setVisible(false);
    42     return p;
    43   }).then(function() {
    44     var p = expectPriorityChange(childID, 'FOREGROUND');
    45     iframe.setVisible(true);
    46   }).then(SimpleTest.finish);
    48   document.body.appendChild(iframe);
    49 }
    51 addEventListener('testready', runTest);
    53 </script>
    54 </body>
    55 </html>

mercurial