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