Files
sdk/tools/testing/extensions/chrome/ConsoleCollector/content.js
T
gram@google.com ee34ca9e60 Chrome extension to get console messages upon test failures. Unlike the
prior one which used chrome.experimental.console APIs, which aren't accessible
to non-devtool extensions, this one uses remote debugging APIs, which are.
Review URL: https://codereview.chromium.org//11092015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13442 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-09 21:09:22 +00:00

20 lines
882 B
JavaScript

// 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
* 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);