Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: chrome/content/tests/performance/page_load_overhead.html

Issue 6423769060999168: Issue 301 - adblockplustests: Use for (.. of ..) (Closed)
Patch Set: Created April 12, 2014, 1:48 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/content/tests/performance/matching.html ('k') | chrome/content/tests/popupBlocker.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE HTML> 1 <!DOCTYPE HTML>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Page load overhead measurement (no filters)</title> 4 <title>Page load overhead measurement (no filters)</title>
5 <script type="application/x-javascript;version=1.7" src="../../httpd.js"></scr ipt> 5 <script type="application/x-javascript;version=1.7" src="../../httpd.js"></scr ipt>
6 <script type="application/x-javascript;version=1.7" src="common.js"></script> 6 <script type="application/x-javascript;version=1.7" src="common.js"></script>
7 <script type="application/x-javascript;version=1.7" src="../common.js"></scrip t> 7 <script type="application/x-javascript;version=1.7" src="../common.js"></scrip t>
8 </head> 8 </head>
9 <body> 9 <body>
10 <p> 10 <p>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 document.getElementById("startButton").disabled = true; 64 document.getElementById("startButton").disabled = true;
65 document.getElementById("result").textContent = ""; 65 document.getElementById("result").textContent = "";
66 document.getElementById("progress").style.display = ""; 66 document.getElementById("progress").style.display = "";
67 67
68 if (document.getElementById("enableABP").checked) 68 if (document.getElementById("enableABP").checked)
69 { 69 {
70 let filters = document.getElementById("filters").value.replace(/^[\r\n]+ /, "") 70 let filters = document.getElementById("filters").value.replace(/^[\r\n]+ /, "")
71 .replace(/[\r\n]+$ /, "") 71 .replace(/[\r\n]+$ /, "")
72 .split(/[\r\n]+/) 72 .split(/[\r\n]+/)
73 .map(function(text ) Filter.fromText(text)); 73 .map(function(text ) Filter.fromText(text));
74 for each (let filter in filters) 74 for (let filter of filters)
75 { 75 {
76 if (filter instanceof RegExpFilter) 76 if (filter instanceof RegExpFilter)
77 defaultMatcher.add(filter); 77 defaultMatcher.add(filter);
78 else if (filter instanceof ElemHideFilter) 78 else if (filter instanceof ElemHideFilter)
79 ElemHide.add(filter); 79 ElemHide.add(filter);
80 } 80 }
81 ElemHide.apply(); 81 ElemHide.apply();
82 } 82 }
83 else 83 else
84 { 84 {
85 for each (let category in PolicyPrivate.xpcom_categories) 85 for (let category of PolicyPrivate.xpcom_categories)
86 Utils.categoryManager.deleteCategoryEntry(category, PolicyPrivate.clas sDescription, false); 86 Utils.categoryManager.deleteCategoryEntry(category, PolicyPrivate.clas sDescription, false);
87 } 87 }
88 88
89 server.start(1234); 89 server.start(1234);
90 90
91 runTests(runTest, null, finalize); 91 runTests(runTest, null, finalize);
92 } 92 }
93 93
94 function runTest() 94 function runTest()
95 { 95 {
96 let frame = document.getElementById("frame"); 96 let frame = document.getElementById("frame");
97 97
98 let loaded; 98 let loaded;
99 let eventListener = function() {loaded = true;}; 99 let eventListener = function() {loaded = true;};
100 frame.addEventListener("load", eventListener, false); 100 frame.addEventListener("load", eventListener, false);
101 101
102 for each (let url in urls) 102 for (let url of urls)
103 { 103 {
104 loaded = false; 104 loaded = false;
105 frame.src = url; 105 frame.src = url;
106 while (!loaded) 106 while (!loaded)
107 thread.processNextEvent(true); 107 thread.processNextEvent(true);
108 } 108 }
109 109
110 frame.removeEventListener("load", eventListener, false); 110 frame.removeEventListener("load", eventListener, false);
111 } 111 }
112 112
113 function finalize() 113 function finalize()
114 { 114 {
115 defaultMatcher.clear(); 115 defaultMatcher.clear();
116 ElemHide.clear(); 116 ElemHide.clear();
117 117
118 server.stop(); 118 server.stop();
119 119
120 for each (let category in PolicyPrivate.xpcom_categories) 120 for (let category of PolicyPrivate.xpcom_categories)
121 Utils.categoryManager.addCategoryEntry(category, PolicyPrivate.classDesc ription, PolicyPrivate.contractID, false, true); 121 Utils.categoryManager.addCategoryEntry(category, PolicyPrivate.classDesc ription, PolicyPrivate.contractID, false, true);
122 122
123 document.getElementById("progress").style.display = "none"; 123 document.getElementById("progress").style.display = "none";
124 document.getElementById("enableABP").disabled = false; 124 document.getElementById("enableABP").disabled = false;
125 document.getElementById("filters").disabled = !document.getElementById("en ableABP").checked; 125 document.getElementById("filters").disabled = !document.getElementById("en ableABP").checked;
126 document.getElementById("startButton").disabled = false; 126 document.getElementById("startButton").disabled = false;
127 } 127 }
128 </script> 128 </script>
129 129
130 <iframe id="frame" src="about:blank" style="visibility: hidden"></iframe> 130 <iframe id="frame" src="about:blank" style="visibility: hidden"></iframe>
131 131
132 </body> 132 </body>
133 </html> 133 </html>
OLDNEW
« no previous file with comments | « chrome/content/tests/performance/matching.html ('k') | chrome/content/tests/popupBlocker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld