IDB: storage/indexeddb/mozilla/object-store-remove-values.html fails
<rdar://problem/16029319> and https://bugs.webkit.org/show_bug.cgi?id=128487

Reviewed by Tim Horton.

Source/WebKit2:

* DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.cpp:
(WebKit::DatabaseProcessIDBConnection::disconnectedFromWebProcess):
(WebKit::DatabaseProcessIDBConnection::getOrEstablishIDBDatabaseMetadata): Update logging.
(WebKit::DatabaseProcessIDBConnection::deleteDatabase): If deleteDatabase succeeds,
  also disconnect from the UniqueIDBDatabase so it can be cleaned up properly.
(WebKit::DatabaseProcessIDBConnection::close): New message from the WebProcess to handle
  clean closures.
* DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.h:
* DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.messages.in:

* DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:
(WebKit::UniqueIDBDatabase::shutdown): Move most of the cleanup to didShutdownBackingStore.
(WebKit::UniqueIDBDatabase::didShutdownBackingStore): Execute all remaining mainThreadTasks
  (as they represent real results from the backing store thread).
(WebKit::UniqueIDBDatabase::deleteDatabase): Add an ASSERT.
(WebKit::UniqueIDBDatabase::performNextMainThreadTask): Call through to performNextMainThreadTaskWithoutAdoptRef.
(WebKit::UniqueIDBDatabase::performNextMainThreadTaskWithoutAdoptRef): Execute a task,
  returning true if there are more tasks left to execute.
* DatabaseProcess/IndexedDB/UniqueIDBDatabase.h:

* DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp:
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::~UniqueIDBDatabaseBackingStoreSQLite): Properly
  handle JSC cleanup.

* WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp:
(WebKit::WebIDBServerConnection::close): Implement this.

LayoutTests:

* platform/mac-wk2/TestExpectations: Add the now-passing test (skipped because of
  unrelated flakiness in IDB tests)

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163817 268f45cc-cd09-0410-ab3c-d52691b4dbfc
IDB: storage/indexeddb/mozilla/object-store-remove-values.html fails
<rdar://problem/16029319> and https://bugs.webkit.org/show_bug.cgi?id=128487

Missed one piece of review feedback before landing.

* DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp:
(WebKit::UniqueIDBDatabaseBackingStoreSQLite::~UniqueIDBDatabaseBackingStoreSQLite):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163818 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Flaky Test: animations/play-state-suspend.html
https://bugs.webkit.org/show_bug.cgi?id=50959

* platform/mac/TestExpectations: Marked it as such.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163819 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Change JSLock::dropAllLocks() and friends to use lock() and unlock().
<https://webkit.org/b/128451>

Reviewed by Geoffrey Garen.

Currently, JSLock's dropAllLocks(), dropAllLocksUnconditionally(), and
grabAllLocks() implement locking / unlocking by duplicating the code from
lock() and unlock(). Instead, they should just call lock() and unlock().

* runtime/JSLock.cpp:
(JSC::JSLock::lock):
(JSC::JSLock::unlock):
- Modified lock() and unlock() into a version that takes an entry count
  to lock / unlock. The previous lock() and unlock() now calls these
  new versions with an entry count of 1.

(JSC::JSLock::dropAllLocks):
(JSC::JSLock::dropAllLocksUnconditionally):
(JSC::JSLock::grabAllLocks):
- Delegate to unlock() and lock() instead of duplicating the lock / unlock
  code.
- There a some differences with calling lock() instead of duplicating its
  code in grabAllLock() i.e. lock() does the following additional work:

  1. lock() does a re-entry check that is not needed by grabAllLocks().
     However, this is effectively a no-op since we never own the JSLock
     before calling grabAllLocks().

  2. set VM stackPointerAtVMEntry.
  3. update VM stackLimit and reservedZoneSize.
  4. set VM lastStackTop.
     These 3 steps are just busy work which are also effective no-ops
     because immediately after lock() returns, grabAllLocks() will write
     over those values with their saved versions in the threadData.

* runtime/JSLock.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163820 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove WKPageSetVisibilityState
https://bugs.webkit.org/show_bug.cgi?id=128551

Reviewed by Anders Carlsson.

Source/WebKit2: 

Made prerender state automatic. We should move this further
up into WebCore, but this requires refactoring for the Page
construction order.

* Shared/API/c/WKDeprecatedFunctions.cpp:
(WKPageSetVisibilityState):
    - deprecated.
* UIProcess/API/C/WKPage.cpp:
    - removed WKPageSetVisibilityState.
* UIProcess/API/C/WKPage.h:
    - removed WKPageSetVisibilityState.
* UIProcess/WebPageProxy.cpp:
    - removed setVisibilityStatePrerender.
* UIProcess/WebPageProxy.h:
    - removed setVisibilityStatePrerender.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
    - removed setVisibilityStatePrerender.
    - When creating a Page, automatically set the prerender state.
* WebProcess/WebPage/WebPage.h:
    - removed setVisibilityStatePrerender.
* WebProcess/WebPage/WebPage.messages.in:
    - removed SetVisibilityStatePrerender.

Tools: 

* TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.mm:
(TestWebKitAPI::PageVisibilityStateWithWindowChanges::initializeView):
(TestWebKitAPI::PageVisibilityStateWithWindowChanges::runTest):
    - visibilityState of offs-creen WKView is automatically prerender.
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::setHidden):
* WebKitTestRunner/InjectedBundle/InjectedBundle.h:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setPageVisibility):
(WTR::TestRunner::resetPageVisibility):
* WebKitTestRunner/TestController.cpp:
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
    - removed calls to WKPageSetVisibilityState.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163821 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Move animation tests that have similar failing behavior in debug builds together,
and mark them as passing in release.

* platform/mac/TestExpectations:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163822 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Disable access to application cache when in private browsing
https://bugs.webkit.org/show_bug.cgi?id=128426

Reviewed by Alexey Proskuryakov.

Source/WebCore:

Tests: http/tests/security/appcache-in-private-browsing.html
       http/tests/security/appcache-switching-private-browsing.html

* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::cacheForMainRequest):
(WebCore::ApplicationCacheGroup::selectCache):
(WebCore::ApplicationCacheGroup::selectCacheWithoutManifestURL):
(WebCore::ApplicationCacheGroup::update):
* loader/appcache/ApplicationCacheHost.cpp:
(WebCore::ApplicationCacheHost::isApplicationCacheEnabled):

LayoutTests:

* http/tests/security/appcache-in-private-browsing-expected.txt: Added.
* http/tests/security/appcache-in-private-browsing.html: Added.
* http/tests/security/appcache-switching-private-browsing-expected.txt: Added.
* http/tests/security/appcache-switching-private-browsing.html: Added.
* http/tests/security/resources/frame-for-appcache-in-private-browsing.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163823 268f45cc-cd09-0410-ab3c-d52691b4dbfc
svg/text/text-overflow-ellipsis-svgfont-kerning-ligatures.html frequently asserts
in ComplexTextController::offsetForPosition
https://bugs.webkit.org/show_bug.cgi?id=119747

* platform/mac/TestExpectations: Skipped it in debug builds.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163824 268f45cc-cd09-0410-ab3c-d52691b4dbfc
HTMLTextFormControlElement::setSelectionRange shouldn't use VisiblePosition
https://bugs.webkit.org/show_bug.cgi?id=128478

Reviewed by Darin Adler.

Added positionForIndex to compute Position given a selection index. This function doesn't
synchronously trigger like visiblePositionForIndex.

Also added assertions in visiblePositionForIndex and visiblePositionForIndex to make sure
they are inverse of one another.

* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::setSelectionRange): Use positionForIndex. Also removed
the now tautological assertions since we would never create a position outside the inner text
element.

(WebCore::HTMLTextFormControlElement::indexForVisiblePosition): Fixed the bug where this
function could return a selection index beyond innerTextElement in some types of input
elements such as search fields. fast/forms/search-disabled-readonly.html hits the newly
added assertion without this change. Note we can't use visiblePositionForIndex here as that
would result in a mutual recursion with the assertion in visiblePositionForIndex.

(WebCore::HTMLTextFormControlElement::visiblePositionForIndex): Added an assertion.

(WebCore::positionForIndex): Added. It's here with prototype at the beginning of the file
so that it's right next to HTMLTextFormControlElement::innerText() where we do a similar
DOM traversal to obtain the inner text value.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163825 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed EFL WebKit2 build fix after r163816.

* CMakeLists.txt: Remove HTMLMediaSource.cpp

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163826 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed GTK build fix after r163816.

* GNUmakefile.list.am: Remove HTMLMediaSource.h and HTMLMediaSource.cpp

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163828 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION(r163660-r163664): js/dom/stack-trace.html fails.
<https://webkit.org/b/128544>

Reviewed by Alexey Proskuryakov.

The failing test is fragile. The test intends to test a recursion pattern
i.e. the top of the stack trace should show a repeated cycle of certain
function calls. However, the test makes a faulty assumption about which
function in that recursion pattern will be the one that overflows the
stack.

The fix is to make the test check for repetition of that recursion pattern
instead of making a specific assumption as to which function within that
recursion pattern will overflow the stack.

* TestExpectations: reverted skipped test.
* js/dom/script-tests/stack-trace.js:
(stackTraceLineFor):
- refactored this code to generated the stack trace line out of printStack.
(printStack):
- updated to use stackTraceLineFor.
(dumpPattern):
- utility function to dump the recursion pattern being matched.
(matchesPatternAtLine):
(matchPattern):
(checkStackForPattern):
- utility functions for testing if the stack trace matches the expected
  recursion pattern. The pattern is an array of stack trace lines that
  we should see repeated in the stack trace starting from the top.

  The top line of the stack trace may match any line in the pattern.
  Thereafter, subsequent lines much patch lines in the pattern starting
  with the line after the first match. When we run out of pattern lines,
  we'll go back to the first pattern line and continue the matching test
  until we run out of stack trace lines to match.

  If any mismatch is found, the test fails.

* js/dom/stack-trace-expected.txt:
- updates baseline for expected results.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163829 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Shapes] Add initial performance tests for polygon shape
https://bugs.webkit.org/show_bug.cgi?id=128554

Reviewed by Ryosuke Niwa.

This patch adds performance testing for simple polygon shape-outside.
The Shapes performance tests directory is skipped by default.

* Layout/Shapes/ShapeOutsideSimplePolygon.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163834 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Put a delegatesScrolling flag on WebPageProxy so that the UI process knows when scrolling is delegated
https://bugs.webkit.org/show_bug.cgi?id=128429

Reviewed by Sam Weinig.

Add delegatesScrolling() which defaults to false, but is set to true for iOS
by WKContentView.

* UIProcess/API/ios/WKContentView.mm:
(-[WKContentView initWithFrame:configuration:]):
(-[WKContentView _commonInitializationWithContextRef:pageGroupRef:relatedToPage:]):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::setDelegatesScrolling):
(WebKit::WebPageProxy::delegatesScrolling):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163836 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Show a debug tile map indicator for UI-side compositing
https://bugs.webkit.org/show_bug.cgi?id=128553

Reviewed by Tim Horton.

Implement a tiled scrolling indicator for UI-side compositing.

The indicator is created by making another RemoteLayerTreeHost,
and decoding the transaction in it a second time to create a cloned
layer tree. In that clone commit, we modify some layer properties to
make things easier to see.

The cloned layer tree is hosted in the root layer of the main
RemoteLayerTreeHost.

RemoteLayerTreeHost was changed to not need a pointer to the WebPageProxy,
which it only used in the "root layer changed" case; instead, it now just
returns a bool from updateLayerTree() in that situation.

* UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp: Explanatory comment.
* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
(WebKit::RemoteLayerTreeDrawingAreaProxy::setExposedRect):
(WebKit::RemoteLayerTreeDrawingAreaProxy::indicatorLocation):
(WebKit::RemoteLayerTreeDrawingAreaProxy::updateDebugIndicatorPosition):
(WebKit::RemoteLayerTreeDrawingAreaProxy::indicatorScale):
(WebKit::RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator):
(WebKit::RemoteLayerTreeDrawingAreaProxy::showDebugIndicator):
* UIProcess/mac/RemoteLayerTreeHost.h:
(WebKit::RemoteLayerTreeHost::rootLayer):
(WebKit::RemoteLayerTreeHost::setIsDebugLayerTreeHost):
(WebKit::RemoteLayerTreeHost::isDebugLayerTreeHost):
* UIProcess/mac/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::RemoteLayerTreeHost):
(WebKit::RemoteLayerTreeHost::updateLayerTree):
(WebKit::RemoteLayerTreeHost::createLayer):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163837 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fail FTL compilation if the required stack is too big
https://bugs.webkit.org/show_bug.cgi?id=128560

Reviewed by Filip Pizlo.

Added StackSize struct to FTLStackMaps and populated it.  Added and updated
related dump functions.  Use the stack size found at the end of the compilation
to compare against the value of a new option, llvmMaxStackSize.  We fail the
compile if the function's stack size is greater than llvmMaxStackSize.

* dfg/DFGPlan.cpp:
(JSC::DFG::Plan::compileInThreadImpl):
* ftl/FTLStackMaps.cpp:
(JSC::FTL::StackMaps::StackSize::parse):
(JSC::FTL::StackMaps::StackSize::dump):
(JSC::FTL::StackMaps::parse):
(JSC::FTL::StackMaps::dump):
(JSC::FTL::StackMaps::dumpMultiline):
(JSC::FTL::StackMaps::getStackSize):
* ftl/FTLStackMaps.h:
* runtime/Options.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163838 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WK2] Add support for image document viewport configuration
https://bugs.webkit.org/show_bug.cgi?id=128565

Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-02-10
Reviewed by Simon Fraser.

Source/WebCore: 

Add proper default settings for displaying images.

* WebCore.exp.in:
* page/ViewportConfiguration.cpp:
(WebCore::ViewportConfiguration::imageDocumentParameters):
(WebCore::ViewportConfiguration::textDocumentParameters):
* page/ViewportConfiguration.h:

Source/WebKit2: 

* UIProcess/API/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::screenToWindow):
(WebKit::PageClientImpl::windowToScreen):
Add the implementation for ImageDocument.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didCommitLoad):
Use the right default settings when dealing with image documents.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163839 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Update aspect-ratio property to have constraining keywords
https://bugs.webkit.org/show_bug.cgi?id=128262

Reviewed by Simon Fraser.

Source/WebCore:

Add support for "from-dimensions" and "from-intrinsic"
property values to "-webkit-aspect-ratio". I also changed
the default value from "none" to "auto", because "none" doesn't
make sense any more.

Covered by enhancing existing tests.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue): New keywords.
* css/CSSParser.cpp:
(WebCore::CSSParser::parseAspectRatio): Support new keywords.
* css/CSSValueKeywords.in: Add from-dimensions and from-intrinsic.
* css/DeprecatedStyleBuilder.cpp: This now has to handle the new
values. I also changed "none" to "auto".
(WebCore::ApplyPropertyAspectRatio::applyInheritValue):
(WebCore::ApplyPropertyAspectRatio::applyInitialValue):
(WebCore::ApplyPropertyAspectRatio::applyValue):
* rendering/style/RenderStyle.h: hasAspectRatio is now aspectRatioType
and indicates one of the three keywords, or a specified number.
* rendering/style/RenderStyleConstants.h: New enum.
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator==):
* rendering/style/StyleRareNonInheritedData.h:

LayoutTests:

Add tests for new from-intrinsic and from-dimensions
property values.

* fast/css/aspect-ratio-inheritance-expected.txt:
* fast/css/aspect-ratio-inheritance.html:
* fast/css/aspect-ratio-parsing-tests-expected.txt:
* fast/css/aspect-ratio-parsing-tests.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163840 268f45cc-cd09-0410-ab3c-d52691b4dbfc
ReallocatePropertyStorage in FTL
https://bugs.webkit.org/show_bug.cgi?id=128352

Patch by Matthew Mirman <mmirman@apple.com> on 2014-02-10
Reviewed by Filip Pizlo.

* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLIntrinsicRepository.h:
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::compileReallocatePropertyStorage):
* tests/stress/ftl-reallocatepropertystorage.js: Added.
(foo):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163841 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Rename getRecordMap to computeRecordMap.

Rubber stamped by Michael Saboff.
        
"get" is such a weird prefix. It implies a getter. We don't prefix our getters with
anything in WebKit. Also, this isn't a getter. It actually does work to transform
the stackmaps into a hashmap. So, computeRecordMap is a much better name.

* ftl/FTLCompile.cpp:
(JSC::FTL::compile):
* ftl/FTLJITFinalizer.cpp:
(JSC::FTL::JITFinalizer::finalizeFunction):
* ftl/FTLStackMaps.cpp:
(JSC::FTL::StackMaps::computeRecordMap):
* ftl/FTLStackMaps.h:



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