dom/plugins/test/mochitest/test_idle_hang.xul

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 <?xml version="1.0"?>
     2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
     4                  type="text/css"?>
     5 <window title="Basic Plugin Tests"
     6   xmlns:html="http://www.w3.org/1999/xhtml"
     7   xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
     8   <title>Plugin Idle Hang Test</title>
     9   <script type="application/javascript"
    10           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
    11   <script type="application/javascript"
    12           src="http://mochi.test:8888/chrome/dom/plugins/test/mochitest/hang_test.js" />
    13   <script type="application/javascript" src="utils.js"></script>
    14   <script type="application/javascript">
    15     getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_ENABLED;
    16   </script>
    17 <body xmlns="http://www.w3.org/1999/xhtml" onload="runTests()">
    18 <embed id="plugin1" type="application/x-test" width="200" height="200"></embed>
    19 </body>
    20 <script class="testbody" type="application/javascript">
    21 <![CDATA[
    22 SimpleTest.waitForExplicitFinish();
    24 function runTests() {
    25   if (!SimpleTest.testPluginIsOOP()) {
    26     ok(true, "Skipping this test when test plugin is not OOP.");
    27     SimpleTest.finish();
    28     return;
    29   }
    31   // Default plugin hang timeout is too high for mochitests
    32   var prefs = Cc["@mozilla.org/preferences-service;1"]
    33                     .getService(Ci.nsIPrefBranch);
    34   var timeoutPref = "dom.ipc.plugins.timeoutSecs";
    35   prefs.setIntPref(timeoutPref, 5);
    37   var os = Cc["@mozilla.org/observer-service;1"].
    38            getService(Ci.nsIObserverService);
    39   os.addObserver(testObserver, "plugin-crashed", true);
    41   testObserver.idleHang = true;
    42   document.addEventListener("PluginCrashed", onPluginCrashed, false);
    44   var pluginElement = document.getElementById("plugin1");
    45   try {
    46     pluginElement.hang(false);
    47   } catch (e) {
    48   }
    49 }
    50 ]]>
    51 </script>
    52 </window>

mercurial