haikuwebkit/ManualTests/inspector/console-dir.html

32 lines
1.1 KiB
HTML
Raw Permalink Normal View History

Fix a regression that broke dirxml and caused an ASSERT in debug builds. Also simplified the console code and refactored things to have fewer code paths and duplication. Reviewed by Kevin McCullough. Test: manual-tests/inspector/console-dir.html * bindings/js/JSInspectedObjectWrapper.cpp: (WebCore::JSInspectedObjectWrapper::wrap): Use the lexicalGlobalObject instead of dynamicGlobalObject to fix an ASSERT about using a wrapper from the wrong ExecState. * bindings/js/JSQuarantinedObjectWrapper.cpp: (WebCore::JSQuarantinedObjectWrapper::JSQuarantinedObjectWrapper): Ditto. (WebCore::JSQuarantinedObjectWrapper::allowsUnwrappedAccessFrom): Ditto. * inspector/front-end/Console.js: (WebInspector.Console.prototype._format): Remove the inline argument and add forceObjectFormat. When forceObjectFormat is true, the only formatter used is _formatobject. (WebInspector.Console.prototype._formatvalue): Remove the inline argument. (WebInspector.Console.prototype._formatstring): Ditto. (WebInspector.Console.prototype._formatregexp): Ditto. (WebInspector.Console.prototype._formatarray): Ditto. (WebInspector.Console.prototype._formatnode): Remove the inline argument and make a DOM tree instead of an anchor. (WebInspector.Console.prototype._formatobject): Remove the inline argument and always make a property graph. (WebInspector.Console.prototype._formaterror): Remove the inline argument. (WebInspector.ConsoleMessage): Remove the case for MessageLevel.Node and simplify the case for MessageLevel.Object to use the normal _format code path with the %O formatter. (WebInspector.ConsoleMessage.prototype._format.formatForConsole): Don't pass an additional true argument for inline. (WebInspector.ConsoleMessage.prototype._format.formatAsObjectForConsole): Added. Pass a true argument for forceObjectFormat. (WebInspector.ConsoleMessage.prototype._format): Added support for the %O formatter. Use formatForConsole for all arguments. (WebInspector.ConsoleMessage.prototype.toString): Add the other message levels. * inspector/front-end/inspector.css: Tweak styles to look and work correctly. * inspector/front-end/utilities.js: (Object.type): Return "node" for Node objects. (Object.describe): Handle the "node" type. * page/Console.cpp: (WebCore::printMessageSourceAndLevelPrefix): Fix an assert by adding the other message level types. (WebCore::Console::dirxml): Use the standard log fuction since it prints a DOM tree for nodes by default. * page/Console.h: (WebCore::enum MessageLevel): Removed NodeMessageLevel. Added a FIXME. Canonical link: https://commits.webkit.org/33474@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@41404 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2009-03-03 22:24:14 +00:00
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=24329">Bug 24329: REGRESSION: console.dirxml() Console API broken</a>.</p>
<p>To test, open the Inspector's Console and verify that all console messages have the correct output.</p>
</body>
<script>
console.log("Testing console.dir:");
console.dir(undefined);
console.dir(123);
console.dir(null);
console.dir({});
console.dir({test: 1, test1:{apple: "orange"}});
console.dir("Test");
console.dir(document);
console.dir(document.body);
console.log("\nTesting console.dirxml:");
console.dirxml(undefined);
console.dirxml(123);
console.dirxml(null);
console.dirxml({});
console.dirxml({test: 1, test1:{apple: "orange"}});
console.dirxml("Test");
console.dirxml(document);
console.dirxml(document.body);
console.log("\nTesting console.log's %o and %O formatters:");
console.log("%o %O", document.body, document.body);
console.log("%o %O", undefined, undefined);
console.log("%o %O", 123, 123);
console.log("%o %O", null, null);
</script>