JavaScriptCore: Enable -Wimplicit-fallthrough and add FALLTHROUGH annotation where needed
https://bugs.webkit.org/show_bug.cgi?id=127647

Reviewed by Anders Carlsson.

Explicitly annotate switch case fallthroughs in JavaScriptCore and
enable warnings for unannotated fallthroughs.

* dfg/DFGArithMode.h:
(doesOverflow):
Only insert FALLTHROUGH in release builds. In debug builds, the
FALLTHROUGH would be unreachable (due to the ASSERT_NOT_REACHED)
and would through a warning.

* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::fillSpeculateInt32Internal):
(JSC::DFG::SpeculativeJIT::fillSpeculateInt52):
Due to the templatized nature of this function, a fallthrough
in one of the template expansions would be unreachable. Disable
the warning for this function.

* Configurations/Base.xcconfig:
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::CodeBlock):
* dfg/DFGCFGSimplificationPhase.cpp:
(JSC::DFG::CFGSimplificationPhase::run):
* dfg/DFGValidate.cpp:
(JSC::DFG::Validate::validateCPS):
* parser/Lexer.cpp:
(JSC::Lexer<T>::lex):
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseStatement):
(JSC::Parser<LexerType>::parseProperty):
* runtime/JSArray.cpp:
(JSC::JSArray::push):
* runtime/JSONObject.cpp:
(JSC::Walker::walk):
* runtime/JSObject.cpp:
(JSC::JSObject::putByIndex):
(JSC::JSObject::putByIndexBeyondVectorLength):
* runtime/JSObject.h:
(JSC::JSObject::setIndexQuickly):
(JSC::JSObject::initializeIndex):
* runtime/LiteralParser.cpp:
(JSC::LiteralParser<CharType>::parse):
* yarr/YarrInterpreter.cpp:
(JSC::Yarr::Interpreter::backtrackParenthesesOnceBegin):
(JSC::Yarr::Interpreter::backtrackParenthesesOnceEnd):
* yarr/YarrParser.h:
(JSC::Yarr::Parser::CharacterClassParserDelegate::atomPatternCharacter):
(JSC::Yarr::Parser::CharacterClassParserDelegate::atomBuiltInCharacterClass):
(JSC::Yarr::Parser::parseEscape):
(JSC::Yarr::Parser::parseTokens):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162906 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebCore: Enable -Wimplicit-fallthrough and add FALLTHROUGH annotation where needed
https://bugs.webkit.org/show_bug.cgi?id=127671

Source/WebCore:

Reviewed by Ryosuke Niwa.

* Configurations/Base.xcconfig:
Enable the warning.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::applyProperty):
Caught a bug. CSSPropertyWebkitAlt could fall through to CSSPropertyQuotes.

* css/SVGCSSParser.cpp:
(WebCore::CSSParser::parseSVGValue):
Caught a bug. CSSPropertyWebkitSvgShadow could fall through to CSSPropertyMaskType.

* platform/Decimal.cpp:
(WebCore::Decimal::fromString):
Possible bug. Implementation doesn't seem to match its documentation.
Filed an issue to follow-up on this unclear function.

* css/makeprop.pl:
* css/makevalues.pl:
* platform/ColorData.gperf:
Ignore implicit fallthrough warnings in generated code. gperf outputs
a "/*FALLTHROUGH*/" comment, but is not easily customizable to change
this output. Easiest to just ignore the warning for now.

* rendering/AutoTableLayout.cpp:
(WebCore::AutoTableLayout::recalcColumn):
(WebCore::AutoTableLayout::calcEffectiveLogicalWidth):
(WebCore::AutoTableLayout::layout):
There has been a "fall through" comment immediately followed by a break
since its introduction in 2003. Removing the inaccurate comment.

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::canHaveChildren):
(WebCore::AccessibilityNodeObject::visibleText):
(WebCore::AccessibilityNodeObject::title):
* accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
(-[WebAccessibilityObjectWrapperBase accessibilityDescription]):
(-[WebAccessibilityObjectWrapperBase accessibilityHelpText]):
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::serialize):
(WebCore::CloneDeserializer::deserialize):
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseContent):
(WebCore::CSSParser::realLex):
* css/CSSSelector.cpp:
(WebCore::CSSSelector::extractPseudoType):
(WebCore::CSSSelector::selectorText):
* css/StyleProperties.cpp:
(WebCore::StyleProperties::asText):
* css/StyleSheetContents.cpp:
(WebCore::childRulesHaveFailedOrCanceledSubresources):
* dom/Node.cpp:
(WebCore::appendTextContent):
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::processStartTag):
(WebCore::HTMLTreeBuilder::processEndTag):
(WebCore::HTMLTreeBuilder::processCharacterBuffer):
(WebCore::HTMLTreeBuilder::processEndOfFile):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):
* page/EventSource.cpp:
(WebCore::EventSource::parseEventStream):
* platform/DateComponents.cpp:
(WebCore::DateComponents::toStringForTime):
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::updateStates):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::platformInit):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::totalBytes):
* platform/graphics/win/FullScreenController.cpp:
(FullScreenController::Private::fullscreenClientWndProc):
* platform/text/BidiResolver.h:
(WebCore::Run>::updateStatusLastFromCurrentDirection):
(WebCore::Run>::createBidiRunsForLine):
* platform/text/win/LocaleWin.cpp:
(WebCore::LocaleWin::initializeLocaleData):
* rendering/PointerEventsHitRules.cpp:
(WebCore::PointerEventsHitRules::PointerEventsHitRules):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::newLine):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::updateLogicalWidthForAlignment):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeReplacedLogicalWidthUsing):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::calculateFillTileSize):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::drawLineForBoxSide):
* rendering/RenderQuote.cpp:
(WebCore::RenderQuote::originalText):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::replacedContentRect):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::addChild):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::adjustStyle):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::setWordSpacing):
* rendering/svg/RenderSVGResource.cpp:
(WebCore::requestPaintingResource):
* rendering/svg/SVGMarkerData.h:
(WebCore::SVGMarkerData::updateMarkerDataForPathElement):
* svg/SVGPathParser.cpp:
(WebCore::SVGPathParser::parsePathDataFromSource):
* svg/SVGTransformDistance.cpp:
(WebCore::SVGTransformDistance::SVGTransformDistance):
(WebCore::SVGTransformDistance::scaledDistance):
(WebCore::SVGTransformDistance::addSVGTransforms):
(WebCore::SVGTransformDistance::addToSVGTransform):
(WebCore::SVGTransformDistance::distance):
Add annotation or break before falling into a default:break;

Source/WTF:

Reviewed by Ryosuke Niwa.

* wtf/text/WTFString.h:
(WTF::appendNumber):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162907 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebKit1: Enable -Wimplicit-fallthrough and add FALLTHROUGH annotation where needed
https://bugs.webkit.org/show_bug.cgi?id=127664

Reviewed by Darin Adler.

* Configurations/Base.xcconfig:
* History/BinaryPropertyList.cpp:
(BinaryPropertyListSerializer::appendObjectReference):
(BinaryPropertyListSerializer::startObject):
(BinaryPropertyListSerializer::addAggregateObjectReference):
* WebView/WebPDFView.mm:
(-[WebPDFView PDFViewWillClickOnLink:withURL:]):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162908 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebKit2: Enable -Wimplicit-fallthrough and add FALLTHROUGH annotation where needed
https://bugs.webkit.org/show_bug.cgi?id=127665

Reviewed by Anders Carlsson.

* Shared/UserData.cpp:
(WebKit::UserData::encode):
These look like they should not have fallen through!

* Configurations/Base.xcconfig:
* Shared/mac/ObjCObjectGraphCoders.mm:
(WebKit::InjectedBundleObjCObjectGraphEncoderImpl::encode):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162909 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: CRASH when debugger closes remote inspecting JSContext
https://bugs.webkit.org/show_bug.cgi?id=127738

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2014-01-27
Reviewed by Timothy Hatcher.

RemoteInspectorXPCConnection could be accessed in a background dispatch
queue, while being deallocated on the main thread when a connection
was suddenly terminated.

Make RemoteInspectorXPCConnection a ThreadSafeRefCounted object. Always
keep the connection object ref'd until the main thread calls close()
and removes its reference. At that point we can close the connection,
queue, and deref safely on the background queue.

* inspector/remote/RemoteInspector.h:
* inspector/remote/RemoteInspector.mm:
(Inspector::RemoteInspector::setupXPCConnectionIfNeeded):
(Inspector::RemoteInspector::xpcConnectionFailed):
For simplicity RemoteInspectorXPCConnections's don't have any threading
primatives to prevent client callbacks after they are closed. RemoteInspector
does, so it just ignores possible callbacks from connections it no longer
cares about.

* inspector/remote/RemoteInspectorXPCConnection.h:
* inspector/remote/RemoteInspectorXPCConnection.mm:
(Inspector::RemoteInspectorXPCConnection::RemoteInspectorXPCConnection):
(Inspector::RemoteInspectorXPCConnection::~RemoteInspectorXPCConnection):
(Inspector::RemoteInspectorXPCConnection::close):
Keep the connection alive as long as the queue it can be used on
is alive. Clean up everything on the queue when close() is called.

(Inspector::RemoteInspectorXPCConnection::handleEvent):
Checking if closed here is not thread safe so it is meaningless.
Remove the check.

(Inspector::RemoteInspectorXPCConnection::sendMessage):
Bail based on the m_closed state.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162910 268f45cc-cd09-0410-ab3c-d52691b4dbfc
IDB: Cursor support - Messaging, IPC, Threading plumbing
https://bugs.webkit.org/show_bug.cgi?id=127736

Reviewed by Sam Weinig.

Source/WebCore:

* Modules/indexeddb/IDBCursorBackendOperations.h:
(WebCore::CursorIterationOperation::cursorID):
(WebCore::CursorAdvanceOperation::cursorID):

* Modules/indexeddb/IDBTransactionBackendOperations.h:
(WebCore::OpenCursorOperation::transactionID):

* WebCore.exp.in:

Source/WebKit2:

Pipe three cursor-related calls to the DatabaseProcess, and handle messages
from the database process when it is done handling them:
* WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp:
(WebKit::WebIDBServerConnection::didOpenCursor):
(WebKit::WebIDBServerConnection::didAdvanceCursor):
(WebKit::WebIDBServerConnection::didIterateCursor):
(WebKit::WebIDBServerConnection::openCursor):
(WebKit::WebIDBServerConnection::cursorAdvance):
(WebKit::WebIDBServerConnection::cursorIterate):
* WebProcess/Databases/IndexedDB/WebIDBServerConnection.h:
* WebProcess/Databases/IndexedDB/WebIDBServerConnection.messages.in:

Pipe the calls through to the appropriate UniqueIDBDatabase:
* DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.cpp:
(WebKit::DatabaseProcessIDBConnection::openCursor):
(WebKit::DatabaseProcessIDBConnection::cursorAdvance):
(WebKit::DatabaseProcessIDBConnection::cursorIterate):
* DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.h:
* DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.messages.in:

Pass the calls to the backing store thread, then message back to the WebProcess
when the requests are complete.
* DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:
(WebKit::UniqueIDBDatabase::openCursor):
(WebKit::UniqueIDBDatabase::cursorAdvance):
(WebKit::UniqueIDBDatabase::cursorIterate):
(WebKit::UniqueIDBDatabase::openCursorInBackingStore):
(WebKit::UniqueIDBDatabase::didOpenCursorInBackingStore):
(WebKit::UniqueIDBDatabase::advanceCursorInBackingStore):
(WebKit::UniqueIDBDatabase::didAdvanceCursorInBackingStore):
(WebKit::UniqueIDBDatabase::iterateCursorInBackingStore):
(WebKit::UniqueIDBDatabase::didIterateCursorInBackingStore):
* DatabaseProcess/IndexedDB/UniqueIDBDatabase.h:

* Shared/WebCrossThreadCopier.cpp:
(WebCore::Vector<char>>::copy):
* Shared/WebCrossThreadCopier.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162911 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebGLLoadPolicy::WebGLAsk is an unnecessary value.
https://bugs.webkit.org/show_bug.cgi?id=127755

Reviewed by Anders Carlsson.

* UIProcess/API/C/WKAPICast.h:
(WebKit::toWebGLLoadPolicy):
* UIProcess/API/C/WKPageLoaderClient.h:
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::getContext):
* loader/FrameLoaderTypes.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162912 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed iOS build fix. FALLTHROUGHs for iOS.

Source/WebCore:

* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityTraits]):
(-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):

Source/WebKit/ios:

* Misc/WebNSStringDrawing.mm:
(needsBidiLayout):

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