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

Unified Diff: tools/testing/extensions/chrome/ConsoleCollector/content.js

Issue 11092015: Chrome extension to get console messages upon test failures. Unlike the (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 side-by-side diff with in-line comments
Download patch
Index: tools/testing/extensions/chrome/ConsoleCollector/content.js
===================================================================
--- tools/testing/extensions/chrome/ConsoleCollector/content.js (revision 0)
+++ tools/testing/extensions/chrome/ConsoleCollector/content.js (revision 0)
@@ -0,0 +1,17 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This is the content page script. This runs in the context of the browser
Emily Fortuna 2012/10/09 20:27:24 nit: but in some files you use the /** */ style no
+// page, and communicates with the background page by relaying a getMessages
+// request, and the forwarding the messages back to the browser page as a
+// gotMessages message.
+window.addEventListener("message", function(event) {
+ if (event.source == window && event.data == "getMessages") {
+ // Log a special sentinel message to mark the end of the messages.
+ console.log('getMessages/end');
+ chrome.extension.sendRequest({command: "getMessages"}, function(messages) {
+ window.postMessage({ "type": "gotMessages", "messages" : messages}, "*");
+ });
+ }
+}, false);

Powered by Google App Engine
This is Rietveld 408576698