Web Inspector: JSContext inspection should report exceptions in the console
https://bugs.webkit.org/show_bug.cgi?id=128776

Source/JavaScriptCore:

Reviewed by Timothy Hatcher.

When JavaScript API functions have an exception, let the inspector
know so it can log the JavaScript and Native backtrace that caused
the exception.

Include some clean up of ConsoleMessage and ScriptCallStack construction.

* API/JSBase.cpp:
(JSEvaluateScript):
(JSCheckScriptSyntax):
* API/JSObjectRef.cpp:
(JSObjectMakeFunction):
(JSObjectMakeArray):
(JSObjectMakeDate):
(JSObjectMakeError):
(JSObjectMakeRegExp):
(JSObjectGetProperty):
(JSObjectSetProperty):
(JSObjectGetPropertyAtIndex):
(JSObjectSetPropertyAtIndex):
(JSObjectDeleteProperty):
(JSObjectCallAsFunction):
(JSObjectCallAsConstructor):
* API/JSValue.mm:
(reportExceptionToInspector):
(valueToArray):
(valueToDictionary):
* API/JSValueRef.cpp:
(JSValueIsEqual):
(JSValueIsInstanceOfConstructor):
(JSValueCreateJSONString):
(JSValueToNumber):
(JSValueToStringCopy):
(JSValueToObject):
When seeing an exception, let the inspector know there was an exception.

* inspector/JSGlobalObjectInspectorController.h:
* inspector/JSGlobalObjectInspectorController.cpp:
(Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController):
(Inspector::JSGlobalObjectInspectorController::appendAPIBacktrace):
(Inspector::JSGlobalObjectInspectorController::reportAPIException):
Log API exceptions by also grabbing the native backtrace.

* inspector/ScriptCallStack.h:
* inspector/ScriptCallStack.cpp:
(Inspector::ScriptCallStack::firstNonNativeCallFrame):
(Inspector::ScriptCallStack::append):
Minor extensions to ScriptCallStack to make it easier to work with.

* inspector/ConsoleMessage.cpp:
(Inspector::ConsoleMessage::ConsoleMessage):
(Inspector::ConsoleMessage::autogenerateMetadata):
Provide better default information if the first call frame was native.

* inspector/ScriptCallStackFactory.cpp:
(Inspector::createScriptCallStack):
(Inspector::extractSourceInformationFromException):
(Inspector::createScriptCallStackFromException):
Perform the handling here of inserting a fake call frame for exceptions
if there was no call stack (e.g. a SyntaxError) or if the first call
frame had no information.

* inspector/ConsoleMessage.cpp:
(Inspector::ConsoleMessage::ConsoleMessage):
(Inspector::ConsoleMessage::autogenerateMetadata):
* inspector/ConsoleMessage.h:
* inspector/ScriptCallStackFactory.cpp:
(Inspector::createScriptCallStack):
(Inspector::createScriptCallStackForConsole):
* inspector/ScriptCallStackFactory.h:
* inspector/agents/InspectorConsoleAgent.cpp:
(Inspector::InspectorConsoleAgent::enable):
(Inspector::InspectorConsoleAgent::addMessageToConsole):
(Inspector::InspectorConsoleAgent::count):
* inspector/agents/JSGlobalObjectDebuggerAgent.cpp:
(Inspector::JSGlobalObjectDebuggerAgent::breakpointActionLog):
ConsoleMessage cleanup.

Source/WebCore:

Include some clean up of ConsoleMessage and ScriptCallStack construction.

Covered by existing tests.

* bindings/js/JSDOMBinding.cpp:
(WebCore::reportException):
Simplify code now that createStackTraceFromException handles it.

* page/ContentSecurityPolicy.cpp:
(WebCore::gatherSecurityPolicyViolationEventData):
(WebCore::ContentSecurityPolicy::reportViolation):
ScriptCallStack can give us the first non-native callframe.

* inspector/InspectorResourceAgent.cpp:
(WebCore::InspectorResourceAgent::buildInitiatorObject):
* inspector/PageDebuggerAgent.cpp:
(WebCore::PageDebuggerAgent::breakpointActionLog):
* inspector/TimelineRecordFactory.cpp:
(WebCore::TimelineRecordFactory::createGenericRecord):
* page/Console.cpp:
(WebCore::internalAddMessage):
(WebCore::Console::profile):
(WebCore::Console::profileEnd):
(WebCore::Console::timeEnd):
* page/ContentSecurityPolicy.cpp:
(WebCore::gatherSecurityPolicyViolationEventData):
(WebCore::ContentSecurityPolicy::reportViolation):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::postMessage):

Source/WebInspectorUI:

Reviewed by Timothy Hatcher.

* UserInterface/ConsoleMessageImpl.js:
(WebInspector.ConsoleMessageImpl.prototype._formatMessage):
(WebInspector.ConsoleMessageImpl.prototype._shouldHideURL):
(WebInspector.ConsoleMessageImpl.prototype._firstNonNativeCallFrame):
(WebInspector.ConsoleMessageImpl.prototype._populateStackTraceTreeElement):
Provide better handling for "[native code]" and legacy "undefined"
call frame URLs. Never linkify these. Also, when showing a link
for an exception, always use the first non-native call frame as
the link location.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164486 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: update check-webkit-style to flag single quotes in WebInspectorUI projects
https://bugs.webkit.org/show_bug.cgi?id=128422

Patch by Diego Pino García <dpino@igalia.com> on 2014-02-21
Reviewed by Joseph Pecoraro.

* Scripts/webkitpy/style/checkers/js.py:
(JSChecker.__init__):
(JSChecker.check):
(SingleQuoteChecker):
(SingleQuoteChecker.__init__):
(SingleQuoteChecker.check):
* Scripts/webkitpy/style/checkers/js_unittest.py:
(JSTestCase.assertError.error_for_test):
(JSTestCase.assertError):
(JSTestCase.test_no_error):
(JSTestCase.test_error):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164487 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Make sure to invoke the completion handler for JS alerts
https://bugs.webkit.org/show_bug.cgi?id=129158

Reviewed by Alexey Proskuryakov.

* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageUIClient):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164488 268f45cc-cd09-0410-ab3c-d52691b4dbfc
StyleResolver::loadPendingImage() should take a reference to StylePendingImage
<http://webkit.org/b/129021>

Reviewed by Brent Fulgham.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::loadPendingImage): Change pendingImage
parameter to a reference.
(WebCore::StyleResolver::loadPendingShapeImage): Update to use
references.
(WebCore::StyleResolver::loadPendingImages): Ditto.
* css/StyleResolver.h:
(WebCore::StyleResolver::loadPendingImage): Change pendingImage
parameter to a reference.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164489 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Revive SABI (aka shouldAlwaysBeInlined)
https://bugs.webkit.org/show_bug.cgi?id=129159

Reviewed by Mark Hahnenberg.
        
This is a small Octane speed-up.

* jit/Repatch.cpp:
(JSC::linkFor): This code was assuming that if it's invoked then the caller is a DFG code block. That's wrong, since it's now used by all of the JITs.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164490 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Revert r164486, causing a number of test failures.

Source/JavaScriptCore:

Unreviewed rollout.

Source/WebCore:

Unreviewed rollout.

Source/WebInspectorUI:

Unreviewed rollout.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164491 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Crash reloading page with position: fixed content
https://bugs.webkit.org/show_bug.cgi?id=129119
<rdar://problem/16127090>

Reviewed by Brent Fulgham.

Source/WebCore:

Test: platform/mac-wk2/tiled-drawing/crash-reloading-with-position-fixed-content.html

* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::removeDestroyedNodes):
Check the node's ID against the latched node's ID before the node is
removed from the tree.

LayoutTests:

* platform/mac-wk2/tiled-drawing/crash-reloading-with-position-fixed-content-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/crash-reloading-with-position-fixed-content.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164492 268f45cc-cd09-0410-ab3c-d52691b4dbfc
DFG write barriers should do more speculations
https://bugs.webkit.org/show_bug.cgi?id=129160

Reviewed by Mark Hahnenberg.
        
Replace ConditionalStoreBarrier with the cheapest speculation that you could do
instead.
        
Miniscule speed-up on some things. It's a decent difference in code size, though.

* bytecode/SpeculatedType.cpp:
(JSC::speculationToAbbreviatedString):
* bytecode/SpeculatedType.h:
(JSC::isNotCellSpeculation):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
(JSC::DFG::FixupPhase::insertStoreBarrier):
(JSC::DFG::FixupPhase::insertPhantomCheck):
* dfg/DFGNode.h:
(JSC::DFG::Node::shouldSpeculateOther):
(JSC::DFG::Node::shouldSpeculateNotCell):
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compareEqObjectOrOtherToObject):
(JSC::FTL::LowerDFGToLLVM::equalNullOrUndefined):
(JSC::FTL::LowerDFGToLLVM::isNotOther):
(JSC::FTL::LowerDFGToLLVM::isOther):
(JSC::FTL::LowerDFGToLLVM::speculate):
(JSC::FTL::LowerDFGToLLVM::speculateObjectOrOther):
(JSC::FTL::LowerDFGToLLVM::speculateOther):
(JSC::FTL::LowerDFGToLLVM::speculateNotCell):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164493 268f45cc-cd09-0410-ab3c-d52691b4dbfc