Open OzairP opened 5 years ago
This module was removed since binding methods to the console
object broke a stack trace. For example, console.log
should indicate the line where it was shown, console.error
also a stack trace of the error, but with this polyfill you will see the line where it's defined in core-js
. See #14. I don't remember why it was completely removed, even with caps for cases when it was missed completely.
I saw that issue but did not put two and two together, that makes sense now. I see the old implementation creates it's own console object. Monkey patching the existing console object for non-existent methods will resolve this issue. Browsers with compliant Console API will use the native function. IE where log/etc is disabled has a no op function. When the debugger is opened the console methods will be re-assigned to native functions. I believe something like this will work?
I can PR this and test it if you think it'll work.
var $ = require('../internals/export');
$({ static: true, target: 'console'}, {
log: function(){},
// ...
});
After #14 it was splitted to 2 modules, with binding methods and just a cap. A cap was removed from 0.6
- "creates too many problems". Need to remember why. I'll think about it.
When "Disable Script Debugging" is enabled on IE11 and the console is closed, IE11 will only provide
console.error
whilst other methods which are declared Non-Nullable in WHATWG Console Specification IDL do not exist. In IE8 & 9 the Console API is not defined given the same conditions. I have personally reproduced this on IE11, but not IE8&9 behavior due to lack of IE8&9 but this behavior has been reported many times [1] [2] [3]This introduces a major inconsistency with the WHATWG Spec since developers expect the Console API to be provided and depend on logging even in production. Even worse the bug disappears when the console is opened so it may be hard to trace.
This leads to developer-consumers having to add their own polyfill which defeats the purpose of CoreJS having standard polyfills.
CoreJS correctly supported this polyfill via
core.log
but it was removed in CoreJS 2.0.0 via https://github.com/zloirock/core-js/commit/28ceca3e5425ff6c9e7fbd7bf22df2810b33dce7 (changelog).I cannot find any information as to why
core.log
was removed but I believe it should be re-introduced for IE targets.