Move Source/WebCore/workers/ code to std::unique_ptr
https://bugs.webkit.org/show_bug.cgi?id=132401

Reviewed by Andreas Kling.

Replace uses of OwnPtr and PassOwnPtr in code under Source/WebCore/workers (and related places)
with std::unique_ptr.

* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::setTimeout):
(WebCore::JSDOMWindow::setInterval):
* bindings/js/JSWorkerGlobalScopeCustom.cpp:
(WebCore::JSWorkerGlobalScope::setTimeout):
(WebCore::JSWorkerGlobalScope::setInterval):
* bindings/js/ScheduledAction.cpp:
(WebCore::ScheduledAction::create):
* bindings/js/ScheduledAction.h:
* page/DOMTimer.cpp:
(WebCore::DOMTimer::DOMTimer):
(WebCore::DOMTimer::install):
(WebCore::DOMTimer::fired):
(WebCore::DOMTimer::didStop):
* page/DOMTimer.h:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::setTimeout):
(WebCore::DOMWindow::setInterval):
* page/DOMWindow.h:
* workers/WorkerEventQueue.h:
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::WorkerGlobalScope):
(WebCore::WorkerGlobalScope::setTimeout):
(WebCore::WorkerGlobalScope::setInterval):
* workers/WorkerGlobalScope.h:
(WebCore::WorkerGlobalScope::clearScript):
* workers/WorkerLoaderProxy.h:
* workers/WorkerMessagingProxy.h:
* workers/WorkerRunLoop.cpp:
(WebCore::WorkerRunLoop::WorkerRunLoop):
* workers/WorkerRunLoop.h:
* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::loadSynchronously):
(WebCore::WorkerScriptLoader::loadAsynchronously):
(WebCore::WorkerScriptLoader::createResourceRequest):
* workers/WorkerScriptLoader.h:
* workers/WorkerThread.cpp:
(WebCore::WorkerThread::WorkerThread):
(WebCore::WorkerThread::workerThread):
(WebCore::WorkerThreadStartupData::create): Deleted.
* workers/WorkerThread.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168578 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Block exceptions when trying to convert attributed strings to RTF and RTFD
https://bugs.webkit.org/show_bug.cgi?id=132778
<rdar://problem/16675805>

Reviewed by Darin Adler.

When the iOS WebHTMLConverter was upstreamed, converting some attributed strings to RTF and RTFD
started throwing Objective-C exceptions (see <rdar://problem/16876920>).

In WebKit2, we now crash on unhandled exceptions so work around that crash by adding exception blocking macros.

* editing/ios/EditorIOS.mm:
(WebCore::dataInRTFDFormat):
(WebCore::dataInRTFFormat):
* editing/mac/EditorMac.mm:
(WebCore::dataInRTFDFormat):
(WebCore::dataInRTFFormat):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168579 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION (r166853): fast/preloader/document-write.html is very flaky
https://bugs.webkit.org/show_bug.cgi?id=130942

Reviewed by Anders Carlsson.

Source/WebCore:
* style/StyleResolveTree.cpp:
(WebCore::Style::suspendMemoryCacheClientCalls): Use a RefPtr to the main
frame as a weak pointer to a Page that will work unless the page is destroyed.
The old code tried to do it with a RefPtr to a document, but as the FIXME
points out, that won't work if the document is disassociated with its frame.

LayoutTests:
* platform/mac/TestExpectations: Turned the test back on.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168580 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Make -[WKNavigationResponse frame] SPI and only expose -[WKNavigationResponse isMainFrame]
https://bugs.webkit.org/show_bug.cgi?id=132781
<rdar://problem/16868319>

Reviewed by Darin Adler.

* UIProcess/API/Cocoa/WKNavigationResponse.h:
* UIProcess/API/Cocoa/WKNavigationResponse.mm:
(-[WKNavigationResponse description]):
(-[WKNavigationResponse isMainFrameNavigation]):
(-[WKNavigationResponse _frame]):
(-[WKNavigationResponse frame]): Deleted.
(-[WKNavigationResponse setFrame:]): Deleted.
* UIProcess/API/Cocoa/WKNavigationResponseInternal.h:
* UIProcess/API/Cocoa/WKNavigationResponsePrivate.h: Added.
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::PolicyClient::decidePolicyForResponse):
* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168581 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Follow-up fix.

Reviewed by Darin Adler.

* UIProcess/API/Cocoa/WKNavigationResponse.h:
* UIProcess/API/Cocoa/WKNavigationResponse.mm:
(-[WKNavigationResponse isForMainFrame]):
Use a slightly better name.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168582 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Simplify createDataAvailableSource
https://bugs.webkit.org/show_bug.cgi?id=132782
<rdar://problem/16815202>

Reviewed by Sam Weinig.

* Platform/IPC/mac/ConnectionMac.mm: Renamed from Source/WebKit2/Platform/IPC/mac/ConnectionMac.cpp.
Rename to make this Objective-C++ so we get the lambda-to-block conversion.

(IPC::createDataAvailableSource):
Make this a function template and just pass the function directly to dispatch_source_set_event_handler.

(IPC::Connection::open):
Use lambdas instead of WTF::bind, so we'll make sure the connection is kept alive.

* WebKit2.xcodeproj/project.pbxproj:
Update for ConnectionMac.cpp to ConnectionMac.mm rename.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168583 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebKit2 is leaking an xpc_connection per web process it creates
https://bugs.webkit.org/show_bug.cgi?id=132785
<rdar://problem/14912160>

Reviewed by Sam Weinig.

Introduce an IPC::XPCPtr smart pointer class and use it for XPC connections inside Connection::Identifier and Connection itself.

Make sure we always adopt any connections that are created.

* DatabaseProcess/EntryPoint/mac/XPCService/DatabaseServiceEntryPoint.mm:
(DatabaseServiceInitializer):
* NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm:
(WebKit::NetworkServiceInitializerDelegate::NetworkServiceInitializerDelegate):
(NetworkServiceInitializer):
* Platform/IPC/Connection.h:
(IPC::Connection::Identifier::Identifier):
(IPC::Connection::xpcConnection):
* Platform/IPC/mac/ConnectionMac.mm:
(IPC::Connection::platformInvalidate):
(IPC::Connection::platformInitialize):
(IPC::Connection::getAuditToken):
* Platform/IPC/mac/XPCPtr.h: Added.
(IPC::XPCPtr::XPCPtr):
(IPC::XPCPtr::~XPCPtr):
(IPC::XPCPtr::get):
(IPC::XPCPtr::operator!):
(IPC::XPCPtr::operator=):
(IPC::adoptXPC):
* PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm:
(WebKit::PluginServiceInitializerDelegate::PluginServiceInitializerDelegate):
(PluginServiceInitializer):
* Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessMain.mm:
(WebKit::BootstrapMain):
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
(WebKit::XPCServiceInitializerDelegate::XPCServiceInitializerDelegate):
(WebKit::XPCServiceInitializer):
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
(WebKit::XPCServiceInitializerDelegate::hasEntitlement):
(WebKit::XPCServiceInitializerDelegate::isClientSandboxed):
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.Development.mm:
(WebKit::XPCServiceEventHandler):
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
(WebKit::XPCServiceEventHandler):
* UIProcess/Launcher/ProcessLauncher.cpp:
(WebKit::ProcessLauncher::didFinishLaunchingProcess):
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::connectToService):
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm:
(WebContentServiceInitializer):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168584 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Use xpc_connection_kill for killing child processes where appropriate
https://bugs.webkit.org/show_bug.cgi?id=132788
<rdar://problem/16664185>

Reviewed by Sam Weinig.

* Platform/IPC/Connection.h:
* Platform/IPC/mac/ConnectionMac.mm:
(IPC::Connection::kill):
* Platform/IPC/mac/XPCPtr.h:
(IPC::XPCPtr::operator bool):
* Shared/ChildProcessProxy.cpp:
(WebKit::ChildProcessProxy::terminate):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168585 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r168578.
https://bugs.webkit.org/show_bug.cgi?id=132789

Speculative rollout since this appears to break PLT3.
(Requested by kling on #webkit).

Reverted changeset:

"Move Source/WebCore/workers/ code to std::unique_ptr"
https://bugs.webkit.org/show_bug.cgi?id=132401
http://trac.webkit.org/changeset/168578

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Multiple svg-in-object-placeholder-height tests fail
https://bugs.webkit.org/show_bug.cgi?id=132791

* TestExpectations: Skipped them, the tests take a long time before they fail.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168587 268f45cc-cd09-0410-ab3c-d52691b4dbfc
ASSERTION FAILED: !m_connection under RunJavaScriptAlert
https://bugs.webkit.org/show_bug.cgi?id=132792
<rdar://problem/16691138>

Reviewed by Dan Bernstein.

Detect if someone implementing a UI delegate method with a completion handler never calls the completion
handler and raise an exception instead of asserting.

* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::CompletionHandlerCallChecker::create):
(WebKit::CompletionHandlerCallChecker::~CompletionHandlerCallChecker):
(WebKit::CompletionHandlerCallChecker::didCallCompletionHandler):
(WebKit::CompletionHandlerCallChecker::CompletionHandlerCallChecker):
(WebKit::CompletionHandlerCallChecker::classImplementingDelegateMethod):
(WebKit::UIDelegate::UIClient::runJavaScriptAlert):
(WebKit::UIDelegate::UIClient::runJavaScriptConfirm):
(WebKit::UIDelegate::UIClient::runJavaScriptPrompt):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168588 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS WebKit2] REGRESSION (r168493): Canvasmark 2013 benchmark always hits the RELEASE_ASSERT in RemoteLayerTreeDrawingArea::flushLayers()
https://bugs.webkit.org/show_bug.cgi?id=132783
<rdar://problem/16877326>

Reviewed by Anders Carlsson.

* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::BackingStoreFlusher::flush):
There's a race window between the BackingStoreFlusher sending the new
layer tree to the UI process and updating m_hasFlushed where we can
get a reply back in (on the Web process main thread) from the UI process
that we committed the new layer tree (didUpdate).
This will cause the RELEASE_ASSERT in flushLayers() to fire incorrectly.
Since the RELEASE_ASSERT is there only to avoid painting garbage, move
our code to set m_hasFlushed=true to after we finish calling CGContextFlush
on all of the contexts, instead of after we send the layer tree commit message,
which will remove the race entirely.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168589 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL][WK2] Move the ownership of EwkSettings from EwkView to EwkPageGroup
https://bugs.webkit.org/show_bug.cgi?id=132771

Reviewed by Gyuyoung Kim.

Moved ownership of EwkSettings from EwkView to EwkPageGroup.

* UIProcess/API/efl/EwkView.cpp:
(EwkView::EwkView):
* UIProcess/API/efl/EwkView.h:
(EwkView::settings): Deleted.
* UIProcess/API/efl/ewk_page_group.cpp:
(EwkPageGroup::EwkPageGroup):
* UIProcess/API/efl/ewk_page_group_private.h:
(EwkPageGroup::settings):
* UIProcess/API/efl/ewk_settings_private.h:
* UIProcess/API/efl/ewk_view.cpp:
(ewk_view_settings_get):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168590 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK][CMake] Unable to do make install
https://bugs.webkit.org/show_bug.cgi?id=130188

Reviewed by Carlos Garcia Campos.

Only try to install the HTML documentation if the build is configured to generate it via
the new ENABLE_GTKDOC option. We cannot conditionally install something, so this allows us
to keep the HTML documentation directory as an installation source.

* Source/PlatformGTK.cmake: The gtkdoc target now always builds HTML documentation, but
is only added to the default target when ENABLE_GTKDOC is turned on. gtkdoc-no-html is
now only added to the default target when DEVELOPER_MODE is true and ENABLE_GTKDOC is
false. When both ENABLE_GTKDOC and DEVELOPER_MODE are false, documentation isn't built at all.
* Source/cmake/OptionsGTK.cmake: Add an ENABLE_GTKDOC option to the build.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168591 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Mac] Some targets that link or soft-link WebKit.framework don't depend on it
https://bugs.webkit.org/show_bug.cgi?id=132776

Reviewed by Darin Adler.

* WebKit2.xcodeproj/project.pbxproj:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Implement -forwardingTargetForSelector on WKScrollViewDelegateForwarder
https://bugs.webkit.org/show_bug.cgi?id=132790
<rdar://problem/16877802>

Reviewed by Dan Bernstein.

* UIProcess/ios/WKScrollView.mm:
(-[WKScrollViewDelegateForwarder forwardingTargetForSelector:]):
If only one of the delegates will respond to a selector,
we can return it from forwardingTargetForSelector: to avoid
NSInvocation overhead.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168593 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WKWebView _updateScrollViewBackground] churns UI-and-CGColors while repainting
https://bugs.webkit.org/show_bug.cgi?id=132793
<rdar://problem/16877870>

Reviewed by Dan Bernstein.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _updateScrollViewBackground]):
Don't bypass the cache and make a copy of the CGColor just to set its alpha.
Cache the last color and don't bother creating a UIColor nor updating the
color on our views if it hasn't changed.

* WebCore.exp.in:
Export a Color convenience function.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168594 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WK2] URTBF after r168585.

* Platform/IPC/Connection.h:
* Shared/ChildProcessProxy.cpp:
(WebKit::ChildProcessProxy::terminate):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168595 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WinCairo crashes on acid3 test
https://bugs.webkit.org/show_bug.cgi?id=131364

Patch by peavo@outlook.com <peavo@outlook.com> on 2014-05-11
Reviewed by Brent Fulgham.

When the 304 (Not-modified) response is received, the Curl backend should look up the cached response,
and call the client method didReceiveResponse with the cached response, instead of the 304 response.
Otherwise the response will contain an empty MIME type, which causes the request to be cancelled, and the client deleted.
When the Curl cache manager then accesses the client afterwards, it is deleted, and we crash.

* platform/network/curl/CurlCacheManager.cpp:
(WebCore::CurlCacheManager::didReceiveResponse): Return early if request is cancelled.
(WebCore::CurlCacheManager::getCachedResponse): Added method to get cached response.
* platform/network/curl/CurlCacheManager.h: Ditto.
* platform/network/curl/ResourceHandleManager.cpp:
(WebCore::headerCallback): When 304 response is received, look up cached response, and use it.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168596 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Text with simple line layout not getting pushed below float when there is not enough space for it
https://bugs.webkit.org/show_bug.cgi?id=126991

Reviewed by Andreas Kling.


Source/WebCore: 
Tests: fast/text/simple-lines-intruding-wide-float-dynamic.html
       fast/text/simple-lines-intruding-wide-float.html

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::markLinesDirtyInBlockRange):
        
    Invalidate the line layout path when floats change. We need to check SimpleLineLayout::canUseFor again as
    intruding floats may make this flow ineligible to use the path.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::floatingObjectSet):
* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::canUseFor):
        
    Test the top positions of all floats for case that would push text below the float instead of just testing 
    the first line. We may have floats in the middle of the paragraph too.

LayoutTests: 
* fast/text/simple-lines-intruding-wide-float-dynamic-expected.html: Added.
* fast/text/simple-lines-intruding-wide-float-dynamic.html: Added.
* fast/text/simple-lines-intruding-wide-float-expected.html: Added.
* fast/text/simple-lines-intruding-wide-float.html: Added.



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