<html>
<head>
<script>
var childFrame;
var pages;
var currentPage;
var result = {};
function init() {
if (!window.layoutTestController) {
alert("window.layoutTestController not defined.");
return;
}
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
pages = window.location.search.substring(1).split(",");
if (!pages.length) {
alert("please specify which pages to generate via " +
"?<page> ... ie. generator.html?tabs,bookmarks,cookies,...");
}
childFrame = document.createElement('iframe');
childFrame.style.display = "none";
document.body.appendChild(childFrame);
next();
}
function next() {
currentPage = pages.shift();
childFrame.src = "../" + currentPage + ".html?regenerate";
}
var count = 0;
function done() {
result[currentPage] = childFrame.contentWindow.serializePage();
if (pages.length) {
next();
} else {
var preNode = document.createElement("pre");
var textNode = document.createTextNode(
"#BEGIN" + JSON.stringify(result) + "#END");
preNode.appendChild(textNode);
document.getElementsByTagName("body")[0].appendChild(preNode);
layoutTestController.notifyDone();
}
}
</script>
</head>
<body onload="init();">
</body>
</html>