Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(941)

Side by Side Diff: third_party/WebKit/LayoutTests/resources/testharnessreport.js

Issue 2643613003: Revert "binding: Makes window/frames/self attributes return itself." (Closed)
Patch Set: whack-a-mole Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * THIS FILE INTENTIONALLY LEFT BLANK 2 * THIS FILE INTENTIONALLY LEFT BLANK
3 * 3 *
4 * More specifically, this file is intended for vendors to implement 4 * More specifically, this file is intended for vendors to implement
5 * code needed to integrate testharness.js tests with their own test systems. 5 * code needed to integrate testharness.js tests with their own test systems.
6 * 6 *
7 * Typically such integration will attach callbacks when each test is 7 * Typically such integration will attach callbacks when each test is
8 * has run, using add_result_callback(callback(test)), or when the whole test fi le has 8 * has run, using add_result_callback(callback(test)), or when the whole test fi le has
9 * completed, using add_completion_callback(callback(tests, harness_status)). 9 * completed, using add_completion_callback(callback(tests, harness_status)).
10 * 10 *
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 sanitize(tests[i].message) + "\n"; 206 sanitize(tests[i].message) + "\n";
207 } 207 }
208 } 208 }
209 209
210 resultStr += "Harness: the test ran to completion.\n"; 210 resultStr += "Harness: the test ran to completion.\n";
211 211
212 // Set results element's textContent to the results string. 212 // Set results element's textContent to the results string.
213 results.textContent = resultStr; 213 results.textContent = resultStr;
214 214
215 function done() { 215 function done() {
216 if (self.testRunner) { 216 // A temporary workaround since |window.self| property lookup starts
217 // failing if the frame is detached. |output_document| may be an
218 // ancestor of |self| so clearing |textContent| may detach |self|.
219 // To get around this, cache window.self now and use the cached
220 // value.
221 // TODO(dcheng): Remove this hack after fixing window/self/frames
222 // lookup in https://crbug.com/618672
223 var cachedSelf = window.self;
224 if (cachedSelf.testRunner) {
217 // The following DOM operations may show console messages. We 225 // The following DOM operations may show console messages. We
218 // suppress them because they are not related to the running 226 // suppress them because they are not related to the running
219 // test. 227 // test.
220 testRunner.setDumpConsoleMessages(false); 228 testRunner.setDumpConsoleMessages(false);
221 229
222 if (isCSSWGTest() || isJSTest()) { 230 if (isCSSWGTest() || isJSTest()) {
223 // Anything isn't material to the testrunner output, so 231 // Anything isn't material to the testrunner output, so
224 // should be hidden from the text dump. 232 // should be hidden from the text dump.
225 if (output_document.body && output_document.body.tagName == 'BODY') 233 if (output_document.body && output_document.body.tagName == 'BODY')
226 output_document.body.textContent = ''; 234 output_document.body.textContent = '';
227 } 235 }
228 } 236 }
229 237
230 // Add results element to output_document. 238 // Add results element to output_document.
231 if (!output_document.body || output_document.body.tagName != 'BODY') { 239 if (!output_document.body || output_document.body.tagName != 'BODY') {
232 if (!output_document.documentElement) 240 if (!output_document.documentElement)
233 output_document.appendChild(output_document.createElement('h tml')); 241 output_document.appendChild(output_document.createElement('h tml'));
234 else if (output_document.body) // output_document.body is <frame set>. 242 else if (output_document.body) // output_document.body is <frame set>.
235 output_document.body.remove(); 243 output_document.body.remove();
236 output_document.documentElement.appendChild(output_document.crea teElement("body")); 244 output_document.documentElement.appendChild(output_document.crea teElement("body"));
237 } 245 }
238 output_document.body.appendChild(results); 246 output_document.body.appendChild(results);
239 247
240 if (self.testRunner) 248 if (cachedSelf.testRunner)
241 testRunner.notifyDone(); 249 testRunner.notifyDone();
242 } 250 }
243 251
244 if (didDispatchLoadEvent || output_document.readyState != 'loading') { 252 if (didDispatchLoadEvent || output_document.readyState != 'loading') {
245 // This function might not be the last 'completion callback', and 253 // This function might not be the last 'completion callback', and
246 // another completion callback might generate more results. So, we 254 // another completion callback might generate more results. So, we
247 // don't dump the results immediately. 255 // don't dump the results immediately.
248 setTimeout(done, 0); 256 setTimeout(done, 0);
249 } else { 257 } else {
250 // Parsing the test HTML isn't finished yet. 258 // Parsing the test HTML isn't finished yet.
251 window.addEventListener('load', done); 259 window.addEventListener('load', done);
252 } 260 }
253 }); 261 });
254 262
255 })(); 263 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698