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

Side by Side Diff: tools/testing/extensions/firefox/ConsoleCollector/chrome/content/console.js

Issue 11028067: Fixed the issue with the ConsoleCollector extension causing FF to hang if run from WebDriver. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // This Firefox add-on exposes the Javascript console contents to Javascript 5 // This Firefox add-on exposes the Javascript console contents to Javascript
6 // running in the browser. Once this is installed there will be a new 6 // running in the browser. Once this is installed there will be a new
7 // window.ConsoleCollector object with read() and clear() functions. 7 // window.ConsoleCollector object with read() and clear() functions.
8 8
9 var ConsoleCollector = {}; 9 var ConsoleCollector = {};
10 10
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 }; 66 };
67 67
68 // Start collecting console messages. 68 // Start collecting console messages.
69 function initialize(event) { 69 function initialize(event) {
70 consoleService = Components.classes['@mozilla.org/consoleservice;1'] 70 consoleService = Components.classes['@mozilla.org/consoleservice;1']
71 .getService(Components.interfaces.nsIConsoleService); 71 .getService(Components.interfaces.nsIConsoleService);
72 if (consoleService) { 72 if (consoleService) {
73 consoleService.registerListener(consoleListener); 73 consoleService.registerListener(consoleListener);
74 } 74 }
75 // Add the handler for hooking in to each page's DOM. This handler
76 // is for each "gBrowser", representing a tab/window.
77 window.getBrowser().addEventListener("load", onPageLoad, true);
75 } 78 }
76 79
77 // Stop collecting console messages. 80 // Stop collecting console messages.
78 function shutdown(event) { 81 function shutdown(event) {
82 window.getBrowser().removeEventListener("load", onPageLoad);
79 consoleService.unregisterListener(consoleListener); 83 consoleService.unregisterListener(consoleListener);
84 ConsoleCollector.clear();
80 } 85 }
81 86
82 // Hook the ConsoleCollector into the DOM as window.ConsoleCollector. 87 // Hook the ConsoleCollector into the DOM as window.ConsoleCollector.
83 var onPageLoad = function(e) { 88 var onPageLoad = function(e) {
84 var win = e.originalTarget.defaultView; 89 var win = e.originalTarget.defaultView;
85 if (win) { 90 if (win) {
86 win.wrappedJSObject.ConsoleCollector = ConsoleCollector; 91 win.wrappedJSObject.ConsoleCollector = ConsoleCollector;
87 } 92 }
88 }; 93 };
89 94
90 // Add the handler for hooking in to each page's DOM. This handler
91 // is for each "gBrowser", representing a tab/window.
92 window.getBrowser().addEventListener("load", onPageLoad, true);
93 // Add the handlers to initialize the add-on and shut it down. 95 // Add the handlers to initialize the add-on and shut it down.
94 // These handlers are for the application as a whole. 96 // These handlers are for the application as a whole.
95 window.addEventListener('load', initialize, false); 97 window.addEventListener('load', initialize, false);
96 window.addEventListener('unload', shutdown, false); 98 window.addEventListener('unload', shutdown, false);
97 }()); 99 }());
98 100
99 101
100 102
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698