auto merge of #1666 : ozten/servo/issue-506-add-basic-console, r=Ms2ger

Here is an attempt to fix Issue#506.

I couldn't figure out how to do variadic arguments to `console.log`, but I did test calling `console.log('foo', 'bar', 'baz')` and it prints the first argument and doesn't error out, which is nice.

window.console is not a web standards. I did the popular functions, but not some of the newer ones documented [on MDN](https://developer.mozilla.org/en-US/docs/Web/API/console).

This PR will allow more pages to load properly, where developers have left in window.console calls.
This commit is contained in:
bors-servo 2014-02-11 13:01:50 -05:00
commit 1662e7a02f
7 changed files with 102 additions and 0 deletions

View file

@ -0,0 +1,20 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* References:
* MDN Docs - https://developer.mozilla.org/en-US/docs/Web/API/console
* Draft Spec - http://sideshowbarker.github.io/console-spec/
*
* © Copyright 2014 Mozilla Foundation.
*/
interface Console {
// These should be DOMString message, DOMString message2, ...
void log(DOMString message);
void debug(DOMString message);
void info(DOMString message);
void warn(DOMString message);
void error(DOMString message);
};

View file

@ -55,6 +55,13 @@
};
// Not part of any spec
partial interface Window {
// web developer niceties
readonly attribute Console console;
};
/*Window implements GlobalEventHandlers;
Window implements WindowEventHandlers;*/