- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / docs / examples / api / devtools / network / chrome-firephp / background.js
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 const tab_log = function(json_args) {
6   var args = JSON.parse(unescape(json_args));
7   console[args[0]].apply(console, Array.prototype.slice.call(args, 1));
8 }
9
10 chrome.extension.onRequest.addListener(function(request) {
11   if (request.command !== 'sendToConsole')
12     return;
13   chrome.tabs.executeScript(request.tabId, {
14       code: "("+ tab_log + ")('" + request.args + "');",
15   });
16 });