Home | History | Annotate | Download | only in build
      1 <html>
      2   <head>
      3     <script>
      4 var childFrame;
      5 var pages;
      6 var currentPage;
      7 var result = {};
      8 
      9 function init() {
     10   if (!window.layoutTestController) {
     11     alert("window.layoutTestController not defined.");
     12     return;
     13   }
     14   
     15   layoutTestController.dumpAsText();
     16   layoutTestController.waitUntilDone();
     17 
     18   pages = window.location.search.substring(1).split(",");
     19   if (!pages.length) {
     20     alert("please specify which pages to generate via " +
     21           "?<page> ... ie. generator.html?tabs,bookmarks,cookies,...");
     22   }
     23 
     24   childFrame = document.createElement('iframe');
     25   childFrame.style.display = "none";
     26   document.body.appendChild(childFrame);
     27  
     28   next();
     29 }
     30 
     31 function next() {
     32   currentPage = pages.shift();
     33   childFrame.src = "../" + currentPage + ".html?regenerate";
     34 }
     35 
     36 var count = 0;
     37 function done() {
     38   result[currentPage] = childFrame.contentWindow.serializePage();
     39 
     40   if (pages.length) {
     41     next();
     42   } else {
     43     var preNode = document.createElement("pre");
     44     var textNode = document.createTextNode(
     45         "#BEGIN" + JSON.stringify(result) + "#END");
     46     preNode.appendChild(textNode);
     47     document.getElementsByTagName("body")[0].appendChild(preNode);
     48     layoutTestController.notifyDone();
     49   }
     50 }
     51     </script>
     52   </head>
     53   <body onload="init();">
     54   </body>
     55 </html>
     56