Skip to content

Commit

Permalink
Bug 1001120 - Introduce a test for slow subframe loads invalidating S…
Browse files Browse the repository at this point in the history
…ession History. r=ttaubert
  • Loading branch information
rmottola committed Nov 17, 2019
1 parent b9d6955 commit 229b444
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
Expand Up @@ -216,11 +216,9 @@ let SyncHandler = {
*/
let SessionHistoryListener = {
init: function () {
// The frame tree observer is needed to handle navigating away from
// an about page. Currently nsISHistoryListener does not have
// OnHistoryNewEntry() called for about pages because the history entry is
// modified to point at the new page. Once Bug 981900 lands the frame tree
// observer can be removed.
// The frame tree observer is needed to handle initial subframe loads.
// It will redundantly invalidate with the SHistoryListener in some cases
// but these invalidations are very cheap.
gFrameTree.addObserver(this);

// By adding the SHistoryListener immediately, we will unfortunately be
Expand Down
@@ -0,0 +1,21 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */

const Cc = Components.classes;
const Ci = Components.interfaces;

const DELAY_MS = "2000";

let timer;

function handleRequest(req, resp) {
resp.processAsync();
resp.setHeader("Cache-Control", "no-cache", false);
resp.setHeader("Content-Type", "text/html;charset=utf-8", false);

timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
timer.init(() => {
resp.write("hi");
resp.finish();
}, DELAY_MS, Ci.nsITimer.TYPE_ONE_SHOT);
}

0 comments on commit 229b444

Please sign in to comment.