summaryrefslogtreecommitdiffstats
path: root/dom/browser-element/mochitest/priority/test_MultipleFrames.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/browser-element/mochitest/priority/test_MultipleFrames.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/browser-element/mochitest/priority/test_MultipleFrames.html')
-rw-r--r--dom/browser-element/mochitest/priority/test_MultipleFrames.html58
1 files changed, 58 insertions, 0 deletions
diff --git a/dom/browser-element/mochitest/priority/test_MultipleFrames.html b/dom/browser-element/mochitest/priority/test_MultipleFrames.html
new file mode 100644
index 000000000..57d9563e7
--- /dev/null
+++ b/dom/browser-element/mochitest/priority/test_MultipleFrames.html
@@ -0,0 +1,58 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+Test that when we remove one of a process's frames from the DOM, the process's
+priority is recomputed.
+-->
+<head>
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" src="../browserElementTestHelpers.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+</head>
+<body>
+
+<script type="application/javascript;version=1.7">
+"use strict";
+
+SimpleTest.waitForExplicitFinish();
+browserElementTestHelpers.setEnabledPref(true);
+browserElementTestHelpers.enableProcessPriorityManager();
+
+function runTest() {
+ var iframe = document.createElement('iframe');
+ iframe.setAttribute('mozbrowser', true);
+ iframe.src = 'file_MultipleFrames.html';
+
+ var childID = null;
+ var iframe2;
+ Promise.all([
+ expectProcessCreated('FOREGROUND').then(function(chid) {
+ childID = chid;
+ }),
+ new Promise(function(resolve, reject) {
+ iframe.addEventListener('mozbrowseropenwindow', function(e) {
+ iframe2 = e.detail.frameElement;
+ var p = expectMozbrowserEvent(iframe2, 'loadend');
+ document.body.appendChild(iframe2);
+ resolve(p);
+ });
+ })
+ ]).then(function() {
+ // At this point, the child process has been set to FOREGROUND, and the popup
+ // opened by file_MultipleFrames has finished loading.
+ //
+ // Now setVisible(false) the popup frame and remove the popup frame from the
+ // DOM. This should cause the process to take on BACKGROUND priority.
+ var p = expectPriorityChange(childID, 'BACKGROUND');
+ iframe.setVisible(false);
+ document.body.removeChild(iframe2);
+ return p;
+ }).then(SimpleTest.finish);
+
+ document.body.appendChild(iframe);
+}
+
+addEventListener('testready', runTest);
+</script>
+</body>
+</html>