summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/docs/build/generator.html
blob: 0700d49f5aadde45e18894921cd17f3ba1f7f1d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<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>