WebKit-https.git
2 years agoSpeculative build fix.
bdakin@apple.com [Wed, 12 Apr 2017 19:28:05 +0000 (19:28 +0000)]
Speculative build fix.

* UIProcess/API/Cocoa/WKViewPrivate.h:

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

2 years agoREGRESSION: LayoutTest webrtc/negotiatedneeded-event-addStream.html is frequently...
commit-queue@webkit.org [Wed, 12 Apr 2017 19:17:19 +0000 (19:17 +0000)]
REGRESSION: LayoutTest webrtc/negotiatedneeded-event-addStream.html is frequently crashing
https://bugs.webkit.org/show_bug.cgi?id=170754
<rdar://problem/31573169>

Unreviewed.

Patch by Youenn Fablet <youenn@apple.com> on 2017-04-12

* TestExpectations: Marking test as crashing.

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

2 years agoAttempted build fix.
bdakin@apple.com [Wed, 12 Apr 2017 19:12:21 +0000 (19:12 +0000)]
Attempted build fix.

* platform/spi/cocoa/AVKitSPI.h:

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

2 years agoAttempted build fix.
bdakin@apple.com [Wed, 12 Apr 2017 19:02:51 +0000 (19:02 +0000)]
Attempted build fix.

* UIProcess/API/Cocoa/WKWebViewPrivate.h:

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

2 years agoAdopt AVKit name change from AVFunctionBar* to AVTouchBar*
bdakin@apple.com [Wed, 12 Apr 2017 18:38:09 +0000 (18:38 +0000)]
Adopt AVKit name change from AVFunctionBar* to AVTouchBar*
https://bugs.webkit.org/show_bug.cgi?id=170693
-and corresponding-
rdar://problem/31230018

Source/WebCore:

Reviewed by San Weinig.

Since the new names only apply to some versions of macOS, this patch uses typedefs
for the older OS’s. SO:

AVFunctionBarScrubber is now AVTouchBarScrubber

AVFunctionBarPlaybackControlsProvider is now AVTouchBarPlaybackControlsProvider

AVFunctionBarMediaSelectionOption is now AVTouchBarMediaSelectionOption

And the protocol AVFunctionBarPlaybackControlsControlling is now
AVTouchBarPlaybackControlsControlling

* platform/mac/WebPlaybackControlsManager.h:
* platform/mac/WebPlaybackControlsManager.mm:
(-[WebPlaybackControlsManager audioFunctionBarMediaSelectionOptions]):
(-[WebPlaybackControlsManager setAudioFunctionBarMediaSelectionOptions:]):
(-[WebPlaybackControlsManager currentAudioFunctionBarMediaSelectionOption]):
(-[WebPlaybackControlsManager setCurrentAudioFunctionBarMediaSelectionOption:]):
(-[WebPlaybackControlsManager legibleFunctionBarMediaSelectionOptions]):
(-[WebPlaybackControlsManager setLegibleFunctionBarMediaSelectionOptions:]):
(-[WebPlaybackControlsManager currentLegibleFunctionBarMediaSelectionOption]):
(-[WebPlaybackControlsManager setCurrentLegibleFunctionBarMediaSelectionOption:]):
(mediaSelectionOptions):

Here is where the typedefs and #define are declared.
* platform/spi/cocoa/AVKitSPI.h:

Source/WebKit/mac:

Reviewed by Sam Weinig.

Since the new names only apply to some versions of macOS, this patch uses typedefs
for the older OS’s. SO:

AVFunctionBarScrubber is now AVTouchBarScrubber

AVFunctionBarPlaybackControlsProvider is now AVTouchBarPlaybackControlsProvider

AVFunctionBarMediaSelectionOption is now AVTouchBarMediaSelectionOption

And the protocol AVFunctionBarPlaybackControlsControlling is now
AVTouchBarPlaybackControlsControlling

Soft links and allocations cannot use the typedefs.
* WebView/WebView.mm:
(-[WebView updateMediaTouchBar]):
* WebView/WebViewData.h:

Source/WebKit2:

Reviewed by Sam Weinig.

Since the new names only apply to some versions of macOS, this patch uses typedefs
for the older OS’s. SO:

AVFunctionBarScrubber is now AVTouchBarScrubber

AVFunctionBarPlaybackControlsProvider is now AVTouchBarPlaybackControlsProvider

AVFunctionBarMediaSelectionOption is now AVTouchBarMediaSelectionOption

And the protocol AVFunctionBarPlaybackControlsControlling is now
AVTouchBarPlaybackControlsControlling

Use the new name.
* UIProcess/API/Cocoa/WKViewPrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _mediaPlaybackControlsView]):
(-[WKWebView _addMediaPlaybackControlsView:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/mac/WKView.mm:
(-[WKView _mediaPlaybackControlsView]):
(-[WKView _addMediaPlaybackControlsView:]):
* UIProcess/Cocoa/WebViewImpl.h:

Soft links and allocations cannot use the typedefs.
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::mediaPlaybackControlsView):
(WebKit::WebViewImpl::updateMediaTouchBar):

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

2 years ago[MediaStream] Audio source in UI process not identified as capture source
eric.carlson@apple.com [Wed, 12 Apr 2017 18:10:43 +0000 (18:10 +0000)]
[MediaStream] Audio source in UI process not identified as capture source
https://bugs.webkit.org/show_bug.cgi?id=170776

Reviewed by Youenn Fablet.

* WebProcess/cocoa/UserMediaCaptureManager.cpp: Override isCaptureSource.

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

2 years agoImplement Object.isFrozen() and Object.isSealed() per ECMA spec
msaboff@apple.com [Wed, 12 Apr 2017 17:35:31 +0000 (17:35 +0000)]
Implement Object.isFrozen() and Object.isSealed() per ECMA spec
https://bugs.webkit.org/show_bug.cgi?id=170753

Reviewed by Mark Lam.

JSTests:

Added JSC baseline and enabled defineIndexProperty test.

Note that JSC differs from Chakra in that a JSC doesn't use indexed
properties placed on the Array prototype when sorting the indexed
properties of an Object.  This is behavior is considered undefined
in the standard.

* ChakraCore.yaml:
* ChakraCore/test/es5/defineIndexProperty.baseline-jsc: Added.

Source/JavaScriptCore:

* runtime/ObjectConstructor.cpp:
(JSC::testIntegrityLevel): Added local helper as described in the ECMA standard.

(JSC::objectConstructorSeal):
(JSC::objectConstructorFreeze):
Eliminated incomplete special handling of JSFinalObjects.

(JSC::objectConstructorIsSealed):
(JSC::objectConstructorIsFrozen):
Refactored to use the new testIntegrityLevel() helper.

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

2 years agoAllow iOS to toggle webRTCAPI legacy flag.
commit-queue@webkit.org [Wed, 12 Apr 2017 17:23:09 +0000 (17:23 +0000)]
Allow iOS to toggle webRTCAPI legacy flag.
https://bugs.webkit.org/show_bug.cgi?id=170735

Patch by Andrew Gold <agold@apple.com> on 2017-04-12
Reviewed by Eric Carlson.

* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _webRTCLegacyAPIEnabled]):
(-[WKPreferences _setWebRTCLegacyAPIEnabled:]):
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:

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

2 years agoUse HAVE(MACHINE_CONTEXT) instead of USE(MACHINE_CONTEXT)
utatane.tea@gmail.com [Wed, 12 Apr 2017 17:19:57 +0000 (17:19 +0000)]
Use HAVE(MACHINE_CONTEXT) instead of USE(MACHINE_CONTEXT)
https://bugs.webkit.org/show_bug.cgi?id=170770

Rubber stamped by Mark Lam.

Source/JavaScriptCore:

* heap/MachineStackMarker.cpp:
(JSC::MachineThreads::MachineThread::Registers::framePointer):
(JSC::MachineThreads::MachineThread::Registers::instructionPointer):
(JSC::MachineThreads::MachineThread::Registers::llintPC):
* runtime/MachineContext.h:
(JSC::MachineContext::stackPointer):
(JSC::MachineContext::framePointer):
(JSC::MachineContext::instructionPointer):
(JSC::MachineContext::argumentPointer<1>):
(JSC::MachineContext::llintInstructionPointer):

Source/WTF:

* wtf/Platform.h:
* wtf/PlatformRegisters.h:
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::getRegisters):

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

2 years ago[JSC] Clean up heap/MachineStackMarker by introducing USE(MACHINE_CONTEXT)
utatane.tea@gmail.com [Wed, 12 Apr 2017 16:59:26 +0000 (16:59 +0000)]
[JSC] Clean up heap/MachineStackMarker by introducing USE(MACHINE_CONTEXT)
https://bugs.webkit.org/show_bug.cgi?id=170770

Reviewed by Mark Lam.

Source/JavaScriptCore:

We use USE(MACHINE_CONTEXT) to clean up runtime/MachineContext.h. And
we clean up heap/MachineStackMarker.cpp by using MachineContext functions.

* heap/MachineStackMarker.cpp:
(JSC::MachineThreads::MachineThread::Registers::stackPointer):
(JSC::MachineThreads::MachineThread::Registers::framePointer):
(JSC::MachineThreads::MachineThread::Registers::instructionPointer):
(JSC::MachineThreads::MachineThread::Registers::llintPC):
* heap/MachineStackMarker.h:
* runtime/MachineContext.h:
(JSC::MachineContext::stackPointer):
(JSC::MachineContext::framePointer):
(JSC::MachineContext::instructionPointer):
(JSC::MachineContext::argumentPointer<1>):
(JSC::MachineContext::llintInstructionPointer):

Source/WTF:

We add a new define USE_MACHINE_CONTEXT, which becomes true if mcontext_t exists
and we know the way to retrieve values from mcontext_t.

* wtf/Platform.h:
* wtf/PlatformRegisters.h:
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::getRegisters):

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

2 years agoFix WinCairo build after r215265
achristensen@apple.com [Wed, 12 Apr 2017 15:52:39 +0000 (15:52 +0000)]
Fix WinCairo build after r215265
https://bugs.webkit.org/show_bug.cgi?id=170502

m_threadId was removed in the header but not in the constructor implementation.
Initializer lists are our friends.

* platform/network/curl/CurlDownload.cpp:
(WebCore::CurlDownloadManager::CurlDownloadManager):
(WebCore::CurlDownload::CurlDownload): Deleted.
* platform/network/curl/CurlDownload.h:

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

2 years agoUnreviewed, build fix for Win and GTK
utatane.tea@gmail.com [Wed, 12 Apr 2017 12:33:03 +0000 (12:33 +0000)]
Unreviewed, build fix for Win and GTK
https://bugs.webkit.org/show_bug.cgi?id=170758

* platform/posix/SharedBufferPOSIX.cpp:
(WebCore::SharedBuffer::createFromReadingFile):
* platform/win/SharedBufferWin.cpp:
(WebCore::SharedBuffer::createFromReadingFile):

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

2 years agoUnreviewed, build fix for GTK port after r215262
utatane.tea@gmail.com [Wed, 12 Apr 2017 12:16:24 +0000 (12:16 +0000)]
Unreviewed, build fix for GTK port after r215262
https://bugs.webkit.org/show_bug.cgi?id=170758

* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::didRead):

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

2 years ago[WTF] Introduce Thread class and use RefPtr<Thread> and align Windows Threading imple...
utatane.tea@gmail.com [Wed, 12 Apr 2017 12:08:29 +0000 (12:08 +0000)]
[WTF] Introduce Thread class and use RefPtr<Thread> and align Windows Threading implementation semantics to Pthread one
https://bugs.webkit.org/show_bug.cgi?id=170502

Reviewed by Mark Lam.

Source/JavaScriptCore:

* API/tests/CompareAndSwapTest.cpp:
(testCompareAndSwap):
* JavaScriptCore.xcodeproj/project.pbxproj:
* b3/air/testair.cpp:
* b3/testb3.cpp:
(JSC::B3::run):
* bytecode/SuperSampler.cpp:
(JSC::initializeSuperSampler):
* dfg/DFGWorklist.cpp:
* disassembler/Disassembler.cpp:
* heap/Heap.cpp:
(JSC::Heap::lastChanceToFinalize):
(JSC::Heap::notifyIsSafeToCollect):
* heap/Heap.h:
* heap/MachineStackMarker.cpp:
(JSC::MachineThreads::~MachineThreads):
(JSC::MachineThreads::addCurrentThread):
(JSC::MachineThreads::removeThread):
(JSC::MachineThreads::removeThreadIfFound):
(JSC::MachineThreads::MachineThread::MachineThread):
(JSC::MachineThreads::MachineThread::getRegisters):
(JSC::MachineThreads::MachineThread::Registers::stackPointer):
(JSC::MachineThreads::MachineThread::Registers::framePointer):
(JSC::MachineThreads::MachineThread::Registers::instructionPointer):
(JSC::MachineThreads::MachineThread::Registers::llintPC):
(JSC::MachineThreads::MachineThread::captureStack):
(JSC::MachineThreads::tryCopyOtherThreadStack):
(JSC::MachineThreads::tryCopyOtherThreadStacks):
(pthreadSignalHandlerSuspendResume): Deleted.
(JSC::threadData): Deleted.
(JSC::MachineThreads::Thread::Thread): Deleted.
(JSC::MachineThreads::Thread::createForCurrentThread): Deleted.
(JSC::MachineThreads::Thread::operator==): Deleted.
(JSC::MachineThreads::machineThreadForCurrentThread): Deleted.
(JSC::MachineThreads::ThreadData::ThreadData): Deleted.
(JSC::MachineThreads::ThreadData::~ThreadData): Deleted.
(JSC::MachineThreads::ThreadData::suspend): Deleted.
(JSC::MachineThreads::ThreadData::resume): Deleted.
(JSC::MachineThreads::ThreadData::getRegisters): Deleted.
(JSC::MachineThreads::ThreadData::Registers::stackPointer): Deleted.
(JSC::MachineThreads::ThreadData::Registers::framePointer): Deleted.
(JSC::MachineThreads::ThreadData::Registers::instructionPointer): Deleted.
(JSC::MachineThreads::ThreadData::Registers::llintPC): Deleted.
(JSC::MachineThreads::ThreadData::freeRegisters): Deleted.
(JSC::MachineThreads::ThreadData::captureStack): Deleted.
* heap/MachineStackMarker.h:
(JSC::MachineThreads::MachineThread::suspend):
(JSC::MachineThreads::MachineThread::resume):
(JSC::MachineThreads::MachineThread::threadID):
(JSC::MachineThreads::MachineThread::stackBase):
(JSC::MachineThreads::MachineThread::stackEnd):
(JSC::MachineThreads::threadsListHead):
(JSC::MachineThreads::Thread::operator!=): Deleted.
(JSC::MachineThreads::Thread::suspend): Deleted.
(JSC::MachineThreads::Thread::resume): Deleted.
(JSC::MachineThreads::Thread::getRegisters): Deleted.
(JSC::MachineThreads::Thread::freeRegisters): Deleted.
(JSC::MachineThreads::Thread::captureStack): Deleted.
(JSC::MachineThreads::Thread::platformThread): Deleted.
(JSC::MachineThreads::Thread::stackBase): Deleted.
(JSC::MachineThreads::Thread::stackEnd): Deleted.
* jit/ICStats.cpp:
(JSC::ICStats::ICStats):
(JSC::ICStats::~ICStats):
* jit/ICStats.h:
* jsc.cpp:
(functionDollarAgentStart):
(startTimeoutThreadIfNeeded):
* runtime/JSLock.cpp:
(JSC::JSLock::lock):
* runtime/JSLock.h:
(JSC::JSLock::ownerThread):
(JSC::JSLock::currentThreadIsHoldingLock):
* runtime/SamplingProfiler.cpp:
(JSC::FrameWalker::isValidFramePointer):
(JSC::SamplingProfiler::SamplingProfiler):
(JSC::SamplingProfiler::createThreadIfNecessary):
(JSC::SamplingProfiler::takeSample):
* runtime/SamplingProfiler.h:
* runtime/VM.h:
(JSC::VM::ownerThread):
* runtime/VMTraps.cpp:
(JSC::findActiveVMAndStackBounds):
(JSC::VMTraps::SignalSender::send):
(JSC::VMTraps::fireTrap):

Source/WebCore:

Mechanical change. Use Thread:: APIs.

* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::IDBServer):
* Modules/indexeddb/server/IDBServer.h:
* Modules/webaudio/AsyncAudioDecoder.cpp:
(WebCore::AsyncAudioDecoder::AsyncAudioDecoder):
(WebCore::AsyncAudioDecoder::~AsyncAudioDecoder):
(WebCore::AsyncAudioDecoder::runLoop):
* Modules/webaudio/AsyncAudioDecoder.h:
* Modules/webaudio/OfflineAudioDestinationNode.cpp:
(WebCore::OfflineAudioDestinationNode::OfflineAudioDestinationNode):
(WebCore::OfflineAudioDestinationNode::uninitialize):
(WebCore::OfflineAudioDestinationNode::startRendering):
* Modules/webaudio/OfflineAudioDestinationNode.h:
* Modules/webdatabase/Database.cpp:
(WebCore::Database::securityOrigin):
* Modules/webdatabase/DatabaseThread.cpp:
(WebCore::DatabaseThread::start):
(WebCore::DatabaseThread::databaseThread):
(WebCore::DatabaseThread::recordDatabaseOpen):
(WebCore::DatabaseThread::recordDatabaseClosed):
* Modules/webdatabase/DatabaseThread.h:
(WebCore::DatabaseThread::getThreadID):
* bindings/js/GCController.cpp:
(WebCore::GCController::garbageCollectOnAlternateThreadForDebugging):
* fileapi/AsyncFileStream.cpp:
(WebCore::callOnFileThread):
* loader/icon/IconDatabase.cpp:
(WebCore::IconDatabase::open):
(WebCore::IconDatabase::close):
* loader/icon/IconDatabase.h:
* page/ResourceUsageThread.cpp:
(WebCore::ResourceUsageThread::createThreadIfNeeded):
* page/ResourceUsageThread.h:
* page/scrolling/ScrollingThread.cpp:
(WebCore::ScrollingThread::ScrollingThread):
(WebCore::ScrollingThread::isCurrentThread):
(WebCore::ScrollingThread::createThreadIfNeeded):
(WebCore::ScrollingThread::threadCallback):
* page/scrolling/ScrollingThread.h:
* platform/audio/HRTFDatabaseLoader.cpp:
(WebCore::HRTFDatabaseLoader::HRTFDatabaseLoader):
(WebCore::HRTFDatabaseLoader::loadAsynchronously):
(WebCore::HRTFDatabaseLoader::waitForLoaderThreadCompletion):
* platform/audio/HRTFDatabaseLoader.h:
* platform/audio/ReverbConvolver.cpp:
(WebCore::ReverbConvolver::ReverbConvolver):
(WebCore::ReverbConvolver::~ReverbConvolver):
* platform/audio/ReverbConvolver.h:
* platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
(WebCore::createBusFromAudioFile):
(WebCore::createBusFromInMemoryAudioFile):
* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(ResourceHandleStreamingClient::ResourceHandleStreamingClient):
(ResourceHandleStreamingClient::~ResourceHandleStreamingClient):
* platform/network/cf/LoaderRunLoopCF.cpp:
(WebCore::loaderRunLoop):
* platform/network/curl/CurlDownload.cpp:
(WebCore::CurlDownloadManager::startThreadIfNeeded):
(WebCore::CurlDownloadManager::stopThread):
* platform/network/curl/CurlDownload.h:
* platform/network/curl/SocketStreamHandleImpl.h:
* platform/network/curl/SocketStreamHandleImplCurl.cpp:
(WebCore::SocketStreamHandleImpl::startThread):
(WebCore::SocketStreamHandleImpl::stopThread):
* workers/WorkerThread.cpp:
(WebCore::WorkerThread::WorkerThread):
(WebCore::WorkerThread::start):
(WebCore::WorkerThread::workerThread):
* workers/WorkerThread.h:
(WebCore::WorkerThread::threadID):

Source/WebKit:

Mechanical change. Use Thread:: APIs.

* Storage/StorageThread.cpp:
(WebCore::StorageThread::StorageThread):
(WebCore::StorageThread::~StorageThread):
(WebCore::StorageThread::start):
(WebCore::StorageThread::dispatch):
(WebCore::StorageThread::terminate):
* Storage/StorageThread.h:

Source/WebKit2:

Mechanical change. Use Thread:: APIs.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::initializeNetworkProcess):
* NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:
(WebKit::NetworkCache::IOChannel::readSyncInThread):
* Platform/IPC/Connection.cpp:
(IPC::Connection::processIncomingMessage):
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
(WebKit::XPCServiceInitializer):
* UIProcess/linux/MemoryPressureMonitor.cpp:
(WebKit::MemoryPressureMonitor::MemoryPressureMonitor):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):

Source/WTF:

This patch is refactoring of WTF Threading mechanism to merge JavaScriptCore's threading extension to WTF Threading.
Previously, JavaScriptCore requires richer threading features (such as suspending and resuming threads), and they
are implemented for PlatformThread in JavaScriptCore. But these features should be implemented in WTF Threading side
instead of maintaining JSC's own threading features too. This patch removes these features from JSC and move it to
WTF Threading.

However, current WTF Threading has one problem: Windows version of WTF Threading has different semantics from Pthreads
one. In Windows WTF Threading, we cannot perform any operation after the target thread is detached: WTF Threading stop
tracking the state of the thread once the thread is detached. But this is not the same to Pthreads one. In Pthreads,
pthread_detach just means that the resource of the thread will be destroyed automatically. While some operations like
pthread_join will be rejected, some operations like pthread_kill will be accepted.

The problem is that detached thread can be suspended and resumed in JSC. For example, in jsc.cpp, we start the worker
thread and detach it immediately. In worker thread, we will create VM and thus concurrent GC will suspend and resume
the detached thread. However, in Windows WTF Threading, we have no reference to the detached thread. Thus we cannot
perform suspend and resume operations onto the detached thread.

To solve the problem, we change Windows Threading mechanism drastically to align it to the Pthread semantics. In the
new Threading, we have RefPtr<Thread> class. It holds a handle to a platform thread. We can perform threading operations
with this class. For example, Thread::suspend is offered. And we use destructor of the thread local variable to release
the resources held by RefPtr<Thread>. In Windows, Thread::detach does nothing because the resource will be destroyed
automatically by RefPtr<Thread>.

To do so, we introduce ThreadHolder for Windows. This is similar to the previous ThreadIdentifierData for Pthreads.
It holds RefPtr<Thread> in the thread local storage (technically, it is Fiber Local Storage in Windows). Thread::current()
will return this reference.

The problematic situation is that the order of the deallocation of the thread local storage is not defined. So we should
not touch thread local storage in the destructor of the thread local storage. To avoid such edge cases, we have
currentThread() / Thread::currentID() APIs. They are safe to be called even in the destructor of the other thread local
storage. And in Windows, in the FLS destructor, we will create the thread_local variable to defer the destruction of
the ThreadHolder. We ensure that this destructor is called after the other FLS destructors are called in Windows 10.

This patch is performance neutral.

* WTF.xcodeproj/project.pbxproj:
* benchmarks/ConditionSpeedTest.cpp:
* benchmarks/LockFairnessTest.cpp:
* benchmarks/LockSpeedTest.cpp:
* wtf/AutomaticThread.cpp:
(WTF::AutomaticThread::start):
* wtf/CMakeLists.txt:
* wtf/MainThread.h:
* wtf/MemoryPressureHandler.h:
* wtf/ParallelJobsGeneric.cpp:
(WTF::ParallelEnvironment::ThreadPrivate::tryLockFor):
(WTF::ParallelEnvironment::ThreadPrivate::workerThread):
* wtf/ParallelJobsGeneric.h:
(WTF::ParallelEnvironment::ThreadPrivate::ThreadPrivate): Deleted.
* wtf/ParkingLot.cpp:
(WTF::ParkingLot::forEachImpl):
* wtf/ParkingLot.h:
(WTF::ParkingLot::forEach):
* wtf/PlatformRegisters.h: Renamed from Source/JavaScriptCore/runtime/PlatformThread.h.
* wtf/RefPtr.h:
(WTF::RefPtr::RefPtr):
* wtf/ThreadFunctionInvocation.h:
(WTF::ThreadFunctionInvocation::ThreadFunctionInvocation):
* wtf/ThreadHolder.cpp: Added.
(WTF::ThreadHolder::~ThreadHolder):
(WTF::ThreadHolder::initialize):
* wtf/ThreadHolder.h: Renamed from Source/WTF/wtf/ThreadIdentifierDataPthreads.h.
(WTF::ThreadHolder::thread):
(WTF::ThreadHolder::ThreadHolder):
* wtf/ThreadHolderPthreads.cpp: Renamed from Source/WTF/wtf/ThreadIdentifierDataPthreads.cpp.
(WTF::ThreadHolder::initializeOnce):
(WTF::ThreadHolder::current):
(WTF::ThreadHolder::destruct):
* wtf/ThreadHolderWin.cpp: Added.
(WTF::threadMapMutex):
(WTF::threadMap):
(WTF::ThreadHolder::initializeOnce):
(WTF::ThreadHolder::current):
(WTF::ThreadHolder::destruct):
* wtf/ThreadSpecific.h:
* wtf/Threading.cpp:
(WTF::Thread::normalizeThreadName):
(WTF::threadEntryPoint):
(WTF::Thread::create):
(WTF::Thread::setCurrentThreadIsUserInteractive):
(WTF::Thread::setCurrentThreadIsUserInitiated):
(WTF::Thread::setGlobalMaxQOSClass):
(WTF::Thread::adjustedQOSClass):
(WTF::Thread::dump):
(WTF::initializeThreading):
(WTF::normalizeThreadName): Deleted.
(WTF::createThread): Deleted.
(WTF::setCurrentThreadIsUserInteractive): Deleted.
(WTF::setCurrentThreadIsUserInitiated): Deleted.
(WTF::setGlobalMaxQOSClass): Deleted.
(WTF::adjustedQOSClass): Deleted.
* wtf/Threading.h:
(WTF::Thread::id):
(WTF::Thread::operator==):
(WTF::Thread::operator!=):
(WTF::Thread::joinableState):
(WTF::Thread::didBecomeDetached):
(WTF::Thread::didJoin):
(WTF::Thread::hasExited):
(WTF::currentThread):
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::Thread):
(WTF::Thread::~Thread):
(WTF::Thread::signalHandlerSuspendResume):
(WTF::Thread::initializePlatformThreading):
(WTF::initializeCurrentThreadEvenIfNonWTFCreated):
(WTF::wtfThreadEntryPoint):
(WTF::Thread::createInternal):
(WTF::Thread::initializeCurrentThreadInternal):
(WTF::Thread::changePriority):
(WTF::Thread::waitForCompletion):
(WTF::Thread::detach):
(WTF::Thread::current):
(WTF::Thread::currentID):
(WTF::Thread::signal):
(WTF::Thread::resume):
(WTF::Thread::getRegisters):
(WTF::Thread::didExit):
(WTF::Thread::establish):
(WTF::PthreadState::PthreadState): Deleted.
(WTF::PthreadState::joinableState): Deleted.
(WTF::PthreadState::pthreadHandle): Deleted.
(WTF::PthreadState::didBecomeDetached): Deleted.
(WTF::PthreadState::didExit): Deleted.
(WTF::PthreadState::didJoin): Deleted.
(WTF::PthreadState::hasExited): Deleted.
(WTF::threadMapMutex): Deleted.
(WTF::initializeThreading): Deleted.
(WTF::threadMap): Deleted.
(WTF::identifierByPthreadHandle): Deleted.
(WTF::establishIdentifierForPthreadHandle): Deleted.
(WTF::pthreadHandleForIdentifierWithLockAlreadyHeld): Deleted.
(WTF::createThreadInternal): Deleted.
(WTF::initializeCurrentThreadInternal): Deleted.
(WTF::changeThreadPriority): Deleted.
(WTF::waitForThreadCompletion): Deleted.
(WTF::detachThread): Deleted.
(WTF::threadDidExit): Deleted.
(WTF::currentThread): Deleted.
(WTF::signalThread): Deleted.
* wtf/ThreadingWin.cpp:
(WTF::Thread::Thread):
(WTF::Thread::~Thread):
(WTF::Thread::initializeCurrentThreadInternal):
(WTF::Thread::initializePlatformThreading):
(WTF::wtfThreadEntryPoint):
(WTF::Thread::createInternal):
(WTF::Thread::changePriority):
(WTF::Thread::waitForCompletion):
(WTF::Thread::detach):
(WTF::Thread::resume):
(WTF::Thread::getRegisters):
(WTF::Thread::current):
(WTF::Thread::currentID):
(WTF::Thread::didExit):
(WTF::Thread::establish):
(WTF::initializeCurrentThreadInternal): Deleted.
(WTF::threadMapMutex): Deleted.
(WTF::initializeThreading): Deleted.
(WTF::threadMap): Deleted.
(WTF::storeThreadHandleByIdentifier): Deleted.
(WTF::threadHandleForIdentifier): Deleted.
(WTF::clearThreadHandleForIdentifier): Deleted.
(WTF::createThreadInternal): Deleted.
(WTF::changeThreadPriority): Deleted.
(WTF::waitForThreadCompletion): Deleted.
(WTF::detachThread): Deleted.
(WTF::currentThread): Deleted.
* wtf/WorkQueue.cpp:
(WTF::WorkQueue::concurrentApply):
* wtf/WorkQueue.h:
* wtf/cocoa/WorkQueueCocoa.cpp:
(WTF::dispatchQOSClass):
* wtf/generic/WorkQueueGeneric.cpp:
(WorkQueue::platformInitialize):
(WorkQueue::platformInvalidate):
* wtf/linux/MemoryPressureHandlerLinux.cpp:
(WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller):
(WTF::MemoryPressureHandler::EventFDPoller::~EventFDPoller):
* wtf/win/MainThreadWin.cpp:
(WTF::initializeMainThreadPlatform):

Tools:

Mechanical change. Use Thread:: APIs.

* DumpRenderTree/JavaScriptThreading.cpp:
(runJavaScriptThread):
(startJavaScriptThreads):
(stopJavaScriptThreads):
* DumpRenderTree/mac/DumpRenderTree.mm:
(testThreadIdentifierMap):
* TestWebKitAPI/Tests/WTF/Condition.cpp:
* TestWebKitAPI/Tests/WTF/Lock.cpp:
(TestWebKitAPI::runLockTest):
* TestWebKitAPI/Tests/WTF/ParkingLot.cpp:

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

2 years ago[css-grid] Replaced elements don't properly resolve percentage heights
rego@igalia.com [Wed, 12 Apr 2017 10:14:30 +0000 (10:14 +0000)]
[css-grid] Replaced elements don't properly resolve percentage heights
https://bugs.webkit.org/show_bug.cgi?id=159670

Reviewed by Darin Adler.

The issue was fixed in r213149 (bug #168657), but the Blink test was not imported.
This patch only adds the test to avoid regressions in the future.

* fast/css-grid-layout/grid-item-with-percent-height-replaced-element-expected.txt: Added.
* fast/css-grid-layout/grid-item-with-percent-height-replaced-element.html: Added.

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

2 years agoCache small media resources in disk cache
antti@apple.com [Wed, 12 Apr 2017 10:09:14 +0000 (10:09 +0000)]
Cache small media resources in disk cache
https://bugs.webkit.org/show_bug.cgi?id=170676
<rdar://problem/31532649>

Reviewed by Andreas Kling.

Source/WebCore:

Test: http/tests/cache/disk-cache/disk-cache-media-small.html

Testing support. Functional changes are in WebKit2.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaPlayerCreateResourceLoader):
(WebCore::HTMLMediaElement::lastMediaResourceLoaderForTesting):
* html/HTMLMediaElement.h:
* loader/MediaResourceLoader.cpp:
(WebCore::MediaResourceLoader::MediaResourceLoader):
(WebCore::MediaResourceLoader::addResponseForTesting):
(WebCore::MediaResource::responseReceived):
* loader/MediaResourceLoader.h:
* platform/network/cocoa/WebCoreNSURLSession.mm:
(-[WebCoreNSURLSessionDataTask resource:receivedResponse:]):

    We can now receive cached responses.

* testing/Internals.cpp:
(WebCore::responseSourceToString):
(WebCore::Internals::xhrResponseSource):
(WebCore::Internals::mediaResponseSources):
(WebCore::Internals::mediaResponseContentRanges):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit2:

* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::makeRetrieveDecision):

    Allow retrieving media resources.

(WebKit::NetworkCache::expectedTotalResourceSizeFromContentRange):
(WebKit::NetworkCache::expectedTotalResourceSize):
(WebKit::NetworkCache::makeStoreDecision):

    Store media resource if we can figure out its total size and it is less than 5MB
    (and it is cacheable by the usual rules).

LayoutTests:

* http/tests/cache/disk-cache/disk-cache-media-small-expected.txt: Added.
* http/tests/cache/disk-cache/disk-cache-media-small.html: Added.

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

2 years agoModernize vector adoption
commit-queue@webkit.org [Wed, 12 Apr 2017 09:25:04 +0000 (09:25 +0000)]
Modernize vector adoption
https://bugs.webkit.org/show_bug.cgi?id=170758

Patch by Alex Christensen <achristensen@webkit.org> on 2017-04-12
Reviewed by Geoffrey Garen.

Source/WebCore:

* Modules/encryptedmedia/InitDataRegistry.cpp:
(WebCore::extractKeyIDsKeyids):
* Modules/indexeddb/IDBGetResult.cpp:
(WebCore::IDBGetResult::dataFromBuffer):
* Modules/indexeddb/IDBKeyData.cpp:
(WebCore::IDBKeyData::decode):
* Modules/indexeddb/server/IDBSerialization.cpp:
(WebCore::serializeIDBKeyData):
(WebCore::decodeKey):
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::getRecord):
(WebCore::IDBServer::SQLiteIDBBackingStore::getAllObjectStoreRecords):
(WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetIndexRecordForOneKey):
* Modules/indexeddb/server/SQLiteIDBCursor.cpp:
(WebCore::IDBServer::SQLiteIDBCursor::internalFetchNextRecord):
* css/CSSFontFaceSource.cpp:
(WebCore::CSSFontFaceSource::font):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadResourceSynchronously):
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::ApplicationCacheStorage::loadCache):
* loader/archive/mhtml/MHTMLParser.cpp:
(WebCore::MHTMLParser::parseNextPart):
* loader/cache/CachedFont.cpp:
(WebCore::CachedFont::createCustomFontData):
* loader/cache/CachedSVGFont.cpp:
(WebCore::CachedSVGFont::ensureCustomFontData):
* platform/SharedBuffer.cpp:
(WebCore::SharedBuffer::create):
(WebCore::utf8Buffer):
(WebCore::SharedBuffer::adoptVector): Deleted.
* platform/SharedBuffer.h:
* platform/ThreadSafeDataBuffer.h:
(WebCore::ThreadSafeDataBufferImpl::ThreadSafeDataBufferImpl):
(WebCore::ThreadSafeDataBuffer::create):
(WebCore::ThreadSafeDataBuffer::ThreadSafeDataBuffer):
(WebCore::ThreadSafeDataBuffer::decode):
(): Deleted.
(WebCore::ThreadSafeDataBuffer::adoptVector): Deleted.
* platform/network/BlobRegistryImpl.cpp:
(WebCore::BlobRegistryImpl::registerBlobURL):
* platform/network/DataURLDecoder.cpp:
(WebCore::DataURLDecoder::decodeBase64):
(WebCore::DataURLDecoder::decodeEscaped):

Source/WebKit2:

* NetworkProcess/capture/NetworkCaptureEvent.cpp:
(WebKit::NetworkCapture::JSONCoder<WebCore::SharedBuffer>::decode):
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::bufferForType):

Tools:

* TestWebKitAPI/Tests/WebCore/SharedBuffer.cpp:
(TestWebKitAPI::TEST_F):

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

2 years agoImplement stroke-color CSS property.
pvollan@apple.com [Wed, 12 Apr 2017 08:01:51 +0000 (08:01 +0000)]
Implement stroke-color CSS property.
https://bugs.webkit.org/show_bug.cgi?id=169352

Reviewed by Jon Lee.

Source/WebCore:

Support setting text stroke color using the CSS property stroke-color, see https://drafts.fxtf.org/paint/.
Text stroke color can currently be set with the -webkit-text-stroke-color property. To make sure this still
works, I added a check to determine if the stroke-color property has been explicitly set. If it has not been
set, we fall back to the value of the -webkit-text-stroke-color property.

Tests: fast/css/stroke-color-fallback.html
       fast/css/stroke-color.html
       fast/css/visited-link-stroke-color.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSProperties.json:
* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderCustom::applyValueStrokeColor):
* css/StyleResolver.cpp:
(WebCore::isValidVisitedLinkProperty):
* css/parser/CSSParserFastPaths.cpp:
(WebCore::isColorPropertyID):
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::parseSingleValue):
* rendering/TextDecorationPainter.cpp:
(WebCore::decorationColor):
* rendering/TextPaintStyle.cpp:
(WebCore::computeTextPaintStyle):
(WebCore::computeTextSelectionPaintStyle):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::changeRequiresRepaintIfTextOrBorderOrOutline):
(WebCore::RenderStyle::colorIncludingFallback):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::strokeColor):
(WebCore::RenderStyle::setStrokeColor):
(WebCore::RenderStyle::setVisitedLinkStrokeColor):
(WebCore::RenderStyle::visitedLinkStrokeColor):
(WebCore::RenderStyle::setHasExplicitlySetStrokeColor):
(WebCore::RenderStyle::hasExplicitlySetStrokeColor):
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator==):
* rendering/style/StyleRareInheritedData.h:

LayoutTests:

* fast/css/stroke-color-expected.html: Added.
* fast/css/stroke-color-fallback-expected.html: Added.
* fast/css/stroke-color-fallback.html: Added.
* fast/css/stroke-color.html: Added.
* fast/css/visited-link-stroke-color-expected.html: Added.
* fast/css/visited-link-stroke-color.html: Added.

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

2 years agoUnreviewed GTK+ debug build fix. Drop an unused debug-only member
zandobersek@gmail.com [Wed, 12 Apr 2017 07:29:33 +0000 (07:29 +0000)]
Unreviewed GTK+ debug build fix. Drop an unused debug-only member
variable in the CompositingRunLoop class.

* Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:

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

2 years ago[GTK] Use the DisplayRefreshMonitor facilities
zandobersek@gmail.com [Wed, 12 Apr 2017 06:50:50 +0000 (06:50 +0000)]
[GTK] Use the DisplayRefreshMonitor facilities
https://bugs.webkit.org/show_bug.cgi?id=170599

Reviewed by Carlos Garcia Campos.

Source/WebCore:

* CMakeLists.txt: Add missing files to the build.
* platform/graphics/DisplayRefreshMonitor.cpp: Build fixes.
(WebCore::DisplayRefreshMonitor::createDefaultDisplayRefreshMonitor):
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::updatePlatformLayer): Mark the
platform layer as updated in the layer's CoordinatedGraphicsState.
* platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:

Source/WebKit2:

ThreadedCompositor gains a DisplayRefreshMonitor member that it can use
to better coordinate display refresh callbacks on the main thread. Still,
because currently the GTK+ port doesn't have a reliable way of notifying
the ThreadedCompositor of a vsync event, a timer targeting 60FPS is used
in order to keep the updates at a reasonable rate. When the timer is fired,
the ThreadedCompositor decides how to proceed based on state changes that
might have occurred during composition or whether there's any display
refresh callbacks that require handling on the main thread.

CompositingRunLoop now stores its state in an atomic variable that's then
inspected whenever a new update is scheduled or completed. When scheduled,
if there's no update in progress, a new update is requested through the
timer. If there's already an update in progress, a new update is marked
as pending after the current one completes. In that case, when the update
is completed, a new update is requested through the timer.

ThreadedDisplayRefreshMonitor is used to coordinate updates between the
main and the composition thread whenever the CoordinatedGraphics state
demands it, or whenever there are clients registered to that monitor that
require an update (e.g. a requestAnimationFrame() callback). After the
update on the composition thread is finished, and the DisplayRefreshMonitor
object requires an update, a callback at the same priority as the layer
flush timer is scheduled on the main thread. In that callback we handle
any clients registered for this DisplayRefreshMonitor before proceeding
to handle any changes to the CoordinatedGraphics scene. In case the
DisplayRefreshMonitor clients or the layer flushes already queued up
any changes to the state, we immediately ask the ThreadedCompositor for
an update.

* PlatformGTK.cmake:
* Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
(WebKit::CoordinatedGraphicsScene::updateViewport):
(WebKit::CoordinatedGraphicsScene::commitSceneState):
* Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
* Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
(WebKit::CompositingRunLoop::CompositingRunLoop):
(WebKit::CompositingRunLoop::isActive):
(WebKit::CompositingRunLoop::scheduleUpdate):
(WebKit::CompositingRunLoop::stopUpdates):
(WebKit::CompositingRunLoop::updateCompleted):
(WebKit::CompositingRunLoop::updateTimerFired):
(WebKit::CompositingRunLoop::isCurrent):
(WebKit::CompositingRunLoop::startUpdateTimer): Deleted.
(WebKit::CompositingRunLoop::stopUpdateTimer): Deleted.
* Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
(): Deleted.
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::m_displayRefreshMonitor):
(WebKit::ThreadedCompositor::invalidate):
(WebKit::ThreadedCompositor::setNativeSurfaceHandleForCompositing):
(WebKit::ThreadedCompositor::updateViewport):
(WebKit::ThreadedCompositor::scheduleDisplayImmediately):
(WebKit::ThreadedCompositor::renderLayerTree):
(WebKit::ThreadedCompositor::sceneUpdateFinished):
(WebKit::ThreadedCompositor::updateSceneState):
(WebKit::ThreadedCompositor::displayRefreshMonitor):
(WebKit::ThreadedCompositor::renderNextFrameIfNeeded):
(WebKit::ThreadedCompositor::completeCoordinatedUpdateIfNeeded):
(WebKit::ThreadedCompositor::coordinateUpdateCompletionWithClient):
(WebKit::ThreadedCompositor::performFrameCompletion):
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp: Added.
(WebKit::ThreadedDisplayRefreshMonitor::ThreadedDisplayRefreshMonitor):
(WebKit::ThreadedDisplayRefreshMonitor::requestRefreshCallback):
(WebKit::ThreadedDisplayRefreshMonitor::requiresDisplayRefreshCallback):
(WebKit::ThreadedDisplayRefreshMonitor::dispatchDisplayRefreshCallback):
(WebKit::ThreadedDisplayRefreshMonitor::invalidate):
(WebKit::ThreadedDisplayRefreshMonitor::displayRefreshCallback):
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h: Copied from Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h.
* WebProcess/WebPage/AcceleratedDrawingArea.cpp:
(WebKit::AcceleratedDrawingArea::createDisplayRefreshMonitor):
* WebProcess/WebPage/AcceleratedDrawingArea.h:
* WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
(WebKit::ThreadedCoordinatedLayerTreeHost::createDisplayRefreshMonitor):
* WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
* WebProcess/WebPage/LayerTreeHost.h:
(WebKit::LayerTreeHost::createDisplayRefreshMonitor):

Source/WTF:

* wtf/Platform.h: Enable USE_REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR for the GTK+ port.
* wtf/glib/RunLoopSourcePriority.h: Add the DisplayRefreshMonitorTimer entry that
matches the value of LayerFlushTimer.

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

2 years agoRetrying an A/B testing does not set the repetition count in some cases
rniwa@webkit.org [Wed, 12 Apr 2017 04:37:38 +0000 (04:37 +0000)]
Retrying an A/B testing does not set the repetition count in some cases
https://bugs.webkit.org/show_bug.cgi?id=170695

Reviewed by Joseph Pecoraro.

When selecting an existing A/B test group, the analysis task page automatically sets the repetition count
of its retry to be that of the original test group. However, this information wasn't being passed correctly
to the code that actually created a test group. As a result, the retried test group's repetition count does
not match that of the original group or the number shown to the user on UI.

Fixed the bug by updating this._repetitionCount in setRepetitionCount.

* browser-tests/index.html:
* browser-tests/test-group-form-tests.js: Added. Added tests.
(.createTestGroupFormWithContext): Added.
* public/v3/components/test-group-form.js:
(TestGroupForm.prototype.setRepetitionCount):
(TestGroupForm.formContent):
(TestGroupForm):

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

2 years agoWeb Inspector: checkboxes in Settings screen use inappropriate layout
mattbaker@apple.com [Wed, 12 Apr 2017 03:05:34 +0000 (03:05 +0000)]
Web Inspector: checkboxes in Settings screen use inappropriate layout
https://bugs.webkit.org/show_bug.cgi?id=166993
<rdar://problem/30002272>

Reviewed by Devin Rousso.

* Localizations/en.lproj/localizedStrings.js:
New checkbox setting strings.

* UserInterface/Main.html:
New settings view classes.

* UserInterface/Views/GeneralSettingsView.js: Added.
(WebInspector.GeneralSettingsView):
(WebInspector.GeneralSettingsView.prototype.initialLayout):
Move settings UI creation from SettingsTabContentView.

* UserInterface/Views/SettingEditor.js: Added.
Basic setting editor UI for the following input types: checkbox,
number, and select. In the future it may be useful to include
additional types, such as radio buttons.

(WebInspector.SettingEditor):
(WebInspector.SettingEditor.createForSetting):
(WebInspector.SettingEditor.prototype.get element):
(WebInspector.SettingEditor.prototype.get type):
(WebInspector.SettingEditor.prototype.get label):
(WebInspector.SettingEditor.prototype.get value):
(WebInspector.SettingEditor.prototype.set value):
(WebInspector.SettingEditor.prototype._createEditorElement):

* UserInterface/Views/SettingsGroup.js: Added.
A container holding editors for one or more WebInspector.Settings.
Every editor belongs to a group. SettingsView provides convenience
methods for adding settings and groups, so create instances directly
shouldn't normally be necessary.

(WebInspector.SettingsGroup):
(WebInspector.SettingsGroup.prototype.get element):
(WebInspector.SettingsGroup.prototype.addSetting):
(WebInspector.SettingsGroup.prototype.addCustomSetting):

* UserInterface/Views/SettingsTabContentView.css:
Refactored styles to more closely match Xcode settings UI.
Eliminated redundant use of "setting" from CSS class names.

(.content-view.settings):
(.content-view.settings .navigation-bar .item.radio.button.text-only):
(.content-view.settings .navigation-bar .item.radio.button.text-only.selected):
(.content-view.settings > .settings-view > .separator):
(.content-view.settings > .settings-view > .container):
(.content-view.settings > .settings-view > .container > .title):
(body[dir=ltr] .content-view.settings > .settings-view > .container > .title):
(body[dir=rtl] .content-view.settings > .settings-view > .container > .title):
(.content-view.settings > .settings-view > .container > .editor-group):
(.content-view.settings > .settings-view > .container > .editor-group > .editor input):
(.content-view.settings > .settings-view > .container > .editor-group > .editor input[type="checkbox"]):
(body[dir=ltr] .content-view.settings > .settings-view > .container > .editor-group > .editor input[type="checkbox"]):
(body[dir=rtl] .content-view.settings > .settings-view > .container > .editor-group > .editor input[type="checkbox"]):
(.content-view.settings > .settings-view > .container > .editor-group > .editor select):
(.content-view.settings > .settings-view > .container > .editor-group > .editor input[type="number"]):
(body[dir=ltr] .content-view.settings > .settings-view > .container > .editor-group > .editor input[type="number"]):
(body[dir=rtl] .content-view.settings > .settings-view > .container > .editor-group > .editor input[type="number"]):
(.content-view.settings > .header): Deleted.
(.content-view.settings > .separator): Deleted.
(.content-view.settings > .setting-container): Deleted.
(.content-view.settings > .setting-container.combined): Deleted.
(.content-view.settings > .setting-container > .setting-name): Deleted.
(body[dir=ltr] .content-view.settings > .setting-container > .setting-name): Deleted.
(body[dir=rtl] .content-view.settings > .setting-container > .setting-name): Deleted.
(.content-view.settings > .setting-container > .setting-value-controller): Deleted.
(.content-view.settings > .setting-container > .setting-value-controller input): Deleted.
(.content-view.settings > .setting-container > .setting-value-controller input[type="checkbox"]): Deleted.
(body[dir=ltr] .content-view.settings > .setting-container > .setting-value-controller input[type="checkbox"]): Deleted.
(body[dir=rtl] .content-view.settings > .setting-container > .setting-value-controller input[type="checkbox"]): Deleted.
(.content-view.settings > .setting-container > .setting-value-controller select): Deleted.
(.content-view.settings > .setting-container > .setting-value-controller input[type="number"]): Deleted.
(body[dir=ltr] .content-view.settings > .setting-container > .setting-value-controller input[type="number"]): Deleted.
(body[dir=rtl] .content-view.settings > .setting-container > .setting-value-controller input[type="number"]): Deleted.

* UserInterface/Views/SettingsTabContentView.js:
To better organize the growing number of settings, multiple settings views
are now supported, with a navigation bar for switching between them. For
now there is a single "General" setting view, and and the navigation bar
is hidden. Adding a second view will cause the bar to be shown.

(WebInspector.SettingsTabContentView):
(WebInspector.SettingsTabContentView.prototype.get type):
(WebInspector.SettingsTabContentView.prototype.get selectedSettingsView):
(WebInspector.SettingsTabContentView.prototype.set selectedSettingsView):
(WebInspector.SettingsTabContentView.prototype.addSettingsView):
(WebInspector.SettingsTabContentView.prototype._navigationItemSelected):
(WebInspector.SettingsTabContentView.prototype.layout): Deleted.
No longer needed.

* UserInterface/Views/SettingsView.js: Added.
Base class for displaying editing UI for a collection of related
WebInspector.Setting objects.

(WebInspector.SettingsView):
(WebInspector.SettingsView.prototype.get identifier):
(WebInspector.SettingsView.prototype.get displayName):
A string suitable for display in a NavigationBar showing a list of
SettingsViews (e.g. "General", "Text Editing", "Fonts & Colors", etc).

(WebInspector.SettingsView.prototype.addSetting):
Add UI for a setting, consisting of a title, an editor appropriate for
the setting's value type, and optional label and formatting options.
For example:

    addSetting("Setting 1:", new WebInspector.Setting(…, true), "Item one")
    addSetting("Setting 2:", new WebInspector.Setting(…, 1), "units")

will create a checkbox and number input field:

    Setting 1: [x] Item one
    Setting 2: [  1] units

(WebInspector.SettingsView.prototype.addCustomSetting):
Add UI for a specific editor type, with optional formatting options.
A setting can be updated in response to changes in the editor's value.

(WebInspector.SettingsView.prototype.addGroup):
Add a group, for listing multiple settings under one title. For example:

   group = addGroup("Title:")
   group.addSetting(new WebInspector.Setting(…, true), "Item one")
   group.addSetting(new WebInspector.Setting(…, false), "Item two")

will create two checkboxes under the same title:

   Title: [x] Item one
          [ ] Item two

(WebInspector.SettingsView.prototype.addSeparator):
Add vertical space between two settings or groups.

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

2 years agoModernize and clean up code
achristensen@apple.com [Tue, 11 Apr 2017 23:24:26 +0000 (23:24 +0000)]
Modernize and clean up code
https://bugs.webkit.org/show_bug.cgi?id=170752

Reviewed by Sam Weinig.

* NetworkProcess/NetworkResourceLoader.h:
* Shared/WebPreferencesStore.h:
* UIProcess/API/APIHitTestResult.cpp:
(API::HitTestResult::create):
* UIProcess/API/APIHitTestResult.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesCreate):
(WKPreferencesCreateWithIdentifier):
(WKPreferencesCreateCopy):
* UIProcess/Authentication/AuthenticationChallengeProxy.h:
* UIProcess/WebPreferences.cpp:
(WebKit::WebPreferences::createWithLegacyDefaults):
(WebKit::WebPreferences::copy):
* UIProcess/WebPreferences.h:
* WebProcess/Network/WebLoaderStrategy.h:
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::requestCheckingOfString):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::addTextCheckingRequest):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::rangeForWebSelectionAtPosition):
(WebKit::WebPage::rangeForBlockAtPoint):
(WebKit::WebPage::expandedRangeFromHandle):
(WebKit::WebPage::contractedRangeFromHandle):
(WebKit::WebPage::computeExpandAndShrinkThresholdsForHandle):
(WebKit::WebPage::changeBlockSelection):
(WebKit::WebPage::rangeForGranularityAtPoint):
(WebKit::WebPage::computePagesForPrintingAndDrawToPDF):

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

2 years ago[Modern Media Controls] Allow modern-media-controls to be provided through WebKitAddi...
commit-queue@webkit.org [Tue, 11 Apr 2017 23:03:47 +0000 (23:03 +0000)]
[Modern Media Controls] Allow modern-media-controls to be provided through WebKitAdditions
https://bugs.webkit.org/show_bug.cgi?id=170722
<rdar://problem/31553089>

Patch by Antoine Quint <graouts@apple.com> on 2017-04-11
Reviewed by Dean Jackson.

If modern media controls source files are provided through WebKitAdditions, use these instead
of the sources found in the WebCore module.

* WebCore.xcodeproj/project.pbxproj:

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

2 years agoLayoutTest webrtc/video-mute.html is a flaky failure
commit-queue@webkit.org [Tue, 11 Apr 2017 22:48:16 +0000 (22:48 +0000)]
LayoutTest webrtc/video-mute.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=170704

Patch by Youenn Fablet <youenn@apple.com> on 2017-04-11
Reviewed by Eric Carlson.

* webrtc/video-mute.html: Trying to make it less flaky.

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

2 years ago[WK1] Add captureStream test with webrtc
commit-queue@webkit.org [Tue, 11 Apr 2017 22:47:49 +0000 (22:47 +0000)]
[WK1] Add captureStream test with webrtc
https://bugs.webkit.org/show_bug.cgi?id=170746

Patch by Youenn Fablet <youenn@apple.com> on 2017-04-11
Reviewed by Eric Carlson.

* platform/mac-wk1/TestExpectations: Activating this new test in WK1.
* webrtc/captureCanvas-webrtc-expected.txt: Added.
* webrtc/captureCanvas-webrtc.html: Added.

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

2 years agoMigrating webrtc tests to latest API
commit-queue@webkit.org [Tue, 11 Apr 2017 22:47:26 +0000 (22:47 +0000)]
Migrating webrtc tests to latest API
https://bugs.webkit.org/show_bug.cgi?id=170709

Patch by Youenn Fablet <youenn@apple.com> on 2017-04-11
Reviewed by Eric Carlson.

* webrtc/audio-peer-connection-webaudio.html:
* webrtc/libwebrtc/descriptionGetters.html:
* webrtc/negotiatedneeded-event-addStream.html:
* webrtc/peer-connection-audio-mute.html:
* webrtc/peer-connection-audio-mute2.html:
* webrtc/peer-connection-remote-audio-mute.html:
* webrtc/peer-connection-remote-audio-mute2.html:
* webrtc/release-after-getting-track.html:
* webrtc/video-disabled-black.html:
* webrtc/video-mute.html:
* webrtc/video-remote-mute.html:
* webrtc/video-with-receiver.html:
* webrtc/video.html:

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

2 years agoDisable outdated WritableStream API
dino@apple.com [Tue, 11 Apr 2017 21:30:47 +0000 (21:30 +0000)]
Disable outdated WritableStream API
https://bugs.webkit.org/show_bug.cgi?id=170749
<rdar://problem/31446233>

Reviewed by Tim Horton.

The API we implement is no longer accurate. Disable it until we
are compatible with the new specification

Source/JavaScriptCore:

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

* Configurations/FeatureDefines.xcconfig:

Source/WebCore/PAL:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit/mac:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit2:

* Configurations/FeatureDefines.xcconfig:

Tools:

* TestWebKitAPI/Configurations/FeatureDefines.xcconfig:

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

2 years agoConsider the current document when allowing autoplay quirks.
mrajca@apple.com [Tue, 11 Apr 2017 20:39:51 +0000 (20:39 +0000)]
Consider the current document when allowing autoplay quirks.
https://bugs.webkit.org/show_bug.cgi?id=170744

Reviewed by Eric Carlson.

Added API test.

In addition to checking if the top-level document supports autoplay quirks, we should check
if the current document supports quirks. This allows all embedded YouTube videos (which use
iframes) to play correctly if the client allows autoplay quirks on youtube.com.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::dispatchPlayPauseEventsIfNeedsQuirks):

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

2 years agoUnreviewed, rolling out r215245.
ryanhaddad@apple.com [Tue, 11 Apr 2017 19:51:42 +0000 (19:51 +0000)]
Unreviewed, rolling out r215245.

This change broke internal builds.

Reverted changeset:

"[Modern Media Controls] Allow modern-media-controls to be
provided through WebKitAdditions"
https://bugs.webkit.org/show_bug.cgi?id=170722
http://trac.webkit.org/changeset/215245

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

2 years ago[Cocoa] WebKit unnecessarily soft-links CorePrediction
mitz@apple.com [Tue, 11 Apr 2017 19:13:23 +0000 (19:13 +0000)]
[Cocoa] WebKit unnecessarily soft-links CorePrediction
https://bugs.webkit.org/show_bug.cgi?id=170644

Reviewed by Sam Weinig.

Source/WebKit2:

* Configurations/BaseTarget.xcconfig: Defined HAVE_CORE_PREDICTION and added
  HAVE_CORE_PREDICTION to the preprocessor defintions when the former is YES.

* Configurations/WebKit.xcconfig: Have the linker link against CorePrediction where
  available. On macOS, use weak linking, because CorePrediction is not available in the
  Base System.

* Platform/classifier/cocoa/CorePredictionSoftLink.h: Removed.

* Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp: Guarded with
  #if HAVE(CORE_PREDICTION).
(WebKit::isNullFunctionPointer): Added this helper.
(WebKit::ResourceLoadStatisticsClassifierCocoa::canUseCorePrediction): Replaced
  dlopen()-based runtime check with a null check.

* Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.h: Guarded with #if
  HAVE(CORE_PREDICTION).

* Platform/spi/Cocoa/CorePredictionSPI.h: Added.

* UIProcess/WebResourceLoadStatisticsStore.h: Updated guards to include HAVE(CORE_PREDICTION).

* WebKit2.xcodeproj/project.pbxproj: pdated file references for removal and addition.

WebKitLibraries:

* WebKitPrivateFrameworkStubs/iOS/10/CorePrediction.framework: Added this framework stub.
* WebKitPrivateFrameworkStubs/iOS/10/CorePrediction.framework/CorePrediction.tbd: Added.

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

2 years agoAdd SPI for handling geolocation authorization requests
commit-queue@webkit.org [Tue, 11 Apr 2017 18:43:46 +0000 (18:43 +0000)]
Add SPI for handling geolocation authorization requests
https://bugs.webkit.org/show_bug.cgi?id=170362
rdar://problem/17508627

Patch by David Quesada <david_quesada@apple.com> on 2017-04-11
Reviewed by Alex Christensen.

Source/WebKit2:

Add a new WKUIDelegate method for the WKGeolocationProviderIOS to call when a web page
requests geolocation access. To support testing this change, make it possible to override
the CoreLocation abstraction WKGeolocationProviderIOS uses. There is now a configurable
object on the process pool that implements a protocol for providing location updates for
web views in the process pool. If the client doesn't provide this object,
WKGeolocationProviderIOS falls back to an object that wraps the existing WebKit1
WebGeolocationCoreLocationProvider and conforms to the new protocol.

* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):
* Shared/WebGeolocationPosition.h:
(WebKit::WebGeolocationPosition::create):
* UIProcess/API/C/WKGeolocationPosition.cpp:
(WKGeolocationPositionCreate_b):
* UIProcess/API/Cocoa/WKProcessPool.mm:
(-[WKProcessPool _coreLocationProvider]):
(-[WKProcessPool _setCoreLocationProvider:]):
* UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/API/Cocoa/_WKGeolocationCoreLocationProvider.h: Copied from Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp.
* UIProcess/API/Cocoa/_WKGeolocationPosition.h: Copied from Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp.
* UIProcess/API/Cocoa/_WKGeolocationPosition.mm: Added.
(WebKit::if):
(-[_WKGeolocationPosition dealloc]):
(-[_WKGeolocationPosition _apiObject]):
* UIProcess/API/Cocoa/_WKGeolocationPositionInternal.h: Copied from Source/WebKit2/UIProcess/API/C/WKGeolocationPosition.cpp.
(WebKit::wrapper):
* UIProcess/ios/WKGeolocationProviderIOS.mm:
(kit):
(-[WKGeolocationProviderIOS initWithProcessPool:]):
(-[WKGeolocationProviderIOS geolocationAuthorizationGranted]):
(-[WKGeolocationProviderIOS positionChanged:]):
(-[WKLegacyCoreLocationProvider setListener:]):
(-[WKLegacyCoreLocationProvider requestGeolocationAuthorization]):
(-[WKLegacyCoreLocationProvider start]):
(-[WKLegacyCoreLocationProvider stop]):
(-[WKLegacyCoreLocationProvider setEnableHighAccuracy:]):
(-[WKLegacyCoreLocationProvider geolocationAuthorizationGranted]):
(-[WKLegacyCoreLocationProvider geolocationAuthorizationDenied]):
(-[WKLegacyCoreLocationProvider positionChanged:]):
(-[WKLegacyCoreLocationProvider errorOccurred:]):
(-[WKLegacyCoreLocationProvider resetGeolocation]):
Implement a new class that bridges the currently used WebGeolocationCoreLocationProvider
to conform to the _WKGeolocationCoreLocationProvider protocol that WKGeolocationProviderIOS
expects.
* WebKit2.xcodeproj/project.pbxproj:

Tools:

Add API tests for the new WKUIDelegate SPI for allowing or denying websites permission
to use geolocation. Adopt the new WKProcessPool._coreLocationProvider property to
provide a stub object to simulate the various configurations of geolocation permissions:
1. The app doesn't have permission to use geolocation.
2. The app is allowed to use geolocation, but the UI delegate denies the web view permission.
3. The app is allowed to use geolocation, and the UI delegate allows the web view permission.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/Geolocation.mm: Added.
(-[TestCoreLocationProvider setListener:]):
(-[TestCoreLocationProvider requestGeolocationAuthorization]):
(-[TestCoreLocationProvider start]):
(-[TestCoreLocationProvider stop]):
(-[TestCoreLocationProvider setEnableHighAccuracy:]):
(expectException):
(-[GeolocationTestUIDelegate _webView:requestGeolocationAuthorizationForURL:frame:decisionHandler:]):
(-[GeolocationTestUIDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2Cocoa/GeolocationGetCurrentPositionResult.html: Added.

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

2 years ago[Modern Media Controls] Allow modern-media-controls to be provided through WebKitAddi...
commit-queue@webkit.org [Tue, 11 Apr 2017 18:41:39 +0000 (18:41 +0000)]
[Modern Media Controls] Allow modern-media-controls to be provided through WebKitAdditions
https://bugs.webkit.org/show_bug.cgi?id=170722
<rdar://problem/31553089>

Patch by Antoine Quint <graouts@apple.com> on 2017-04-11
Reviewed by Dean Jackson.

If modern media controls source files are provided through WebKitAdditions, use these instead
of the sources found in the WebCore module.

* WebCore.xcodeproj/project.pbxproj:

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

2 years agoUnreviewed, build fix for CF ports after r215241
utatane.tea@gmail.com [Tue, 11 Apr 2017 18:39:09 +0000 (18:39 +0000)]
Unreviewed, build fix for CF ports after r215241
https://bugs.webkit.org/show_bug.cgi?id=170725

* heap/GCActivityCallback.cpp:
(JSC::GCActivityCallback::nextFireTime):

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

2 years agoChange autoplay state to "prevented" when media is paused due to restrictions.
mrajca@apple.com [Tue, 11 Apr 2017 18:29:03 +0000 (18:29 +0000)]
Change autoplay state to "prevented" when media is paused due to restrictions.
https://bugs.webkit.org/show_bug.cgi?id=170686

Reviewed by Alex Christensen.

Source/WebCore:

Added API tests.

Currently, the autoplay state is set to "prevented" when playback is about to begin without
user interaction and there are restrictions in place. We should also be setting this flag when
autoplay is allowed but due to a change in audio tracks, for example, it gets paused.

This patch also moves some common logic into setPlaybackWithoutUserGesture without changing behavior.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setReadyState):
(WebCore::HTMLMediaElement::play):
(WebCore::HTMLMediaElement::mediaPlayerDidAddAudioTrack):
(WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
(WebCore::HTMLMediaElement::setPlaybackWithoutUserGesture):
(WebCore::HTMLMediaElement::updateShouldPlay):

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/autoplay-muted-with-controls.html: Added test.
* TestWebKitAPI/Tests/WebKit2Cocoa/WebsitePolicies.mm:
(TEST):

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

2 years ago[MediaStream] Set correct audio session category when capturing audio
eric.carlson@apple.com [Tue, 11 Apr 2017 18:27:01 +0000 (18:27 +0000)]
[MediaStream] Set correct audio session category when capturing audio
https://bugs.webkit.org/show_bug.cgi?id=170736
<rdar://problem/31559405>

Reviewed by Jer Noble.

Source/WebCore:

No new tests yet, filed bug 170737.

* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::MediaStream): Initialize m_mediaSession.
(WebCore::MediaStream::statusDidChange): Call canProduceAudioChanged.
(WebCore::MediaStream::mediaType): New. Return MediaStreamCapturingAudio when actively
capturing audio.
(WebCore::MediaStream::presentationType):
(WebCore::MediaStream::characteristics):
(WebCore::MediaStream::mayResumePlayback):
(WebCore::MediaStream::suspendPlayback):
(WebCore::MediaStream::sourceApplicationIdentifier):
(WebCore::MediaStream::canProduceAudio):
* Modules/mediastream/MediaStream.h:

* platform/audio/PlatformMediaSession.h: Add MediaStreamCapturingAudio.
* platform/audio/PlatformMediaSessionManager.cpp:
(WebCore::PlatformMediaSessionManager::has): Adjust assert for MediaStreamCapturingAudio.
(WebCore::PlatformMediaSessionManager::count): Ditto.
* platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
(PlatformMediaSessionManager::updateSessionState): Set small preferred buffer size when
capturing audio. Set audio session category to PlayAndRecord whenever there is a media
stream that is capturing audio.

Source/WebKit2:

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::isPlayingMediaDidChange):

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

2 years ago[WebCore][JSC] ResourceUsageData.{timeOfNextEdenCollection,timeOfNextFullCollection...
utatane.tea@gmail.com [Tue, 11 Apr 2017 18:25:42 +0000 (18:25 +0000)]
[WebCore][JSC] ResourceUsageData.{timeOfNextEdenCollection,timeOfNextFullCollection} should be MonotonicTime
https://bugs.webkit.org/show_bug.cgi?id=170725

Reviewed by Sam Weinig.

Source/JavaScriptCore:

This patch makes GCActivityCallback return MonotonicTime instead of raw double value.

* heap/GCActivityCallback.cpp:
(JSC::GCActivityCallback::nextFireTime):
* heap/GCActivityCallback.h:

Source/WebCore:

Use MonotonicTime instead of raw doubles.
Currently, large part of data structures and helper functions are the same in
ResourceUsageOverlayCocoa.mm and ResourceUsageOverlayLinux.cpp. This should be
unified in a separate patch.

* page/ResourceUsageData.h:
* page/cocoa/ResourceUsageOverlayCocoa.mm:
(WebCore::gcTimerString):
(WebCore::ResourceUsageOverlay::platformDraw):
* page/linux/ResourceUsageOverlayLinux.cpp:
(WebCore::gcTimerString):

Source/WTF:

Make MonotonicTime more constexpr friendly mainly to annotate MonotonicTime::nan() as constexpr.

* wtf/MonotonicTime.h:
(WTF::MonotonicTime::MonotonicTime):
(WTF::MonotonicTime::fromRawSeconds):
(WTF::MonotonicTime::infinity):
(WTF::MonotonicTime::nan):
(WTF::MonotonicTime::secondsSinceEpoch):
(WTF::MonotonicTime::operator bool):
(WTF::MonotonicTime::operator+):
(WTF::MonotonicTime::operator-):
(WTF::MonotonicTime::operator==):
(WTF::MonotonicTime::operator!=):
(WTF::MonotonicTime::operator<):
(WTF::MonotonicTime::operator>):
(WTF::MonotonicTime::operator<=):
(WTF::MonotonicTime::operator>=):

Tools:

* TestWebKitAPI/Tests/WTF/Time.cpp:
(TestWebKitAPI::TEST):

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

2 years ago[iOS] Simple HTML documents should allow non-markup JavaScript
mitz@apple.com [Tue, 11 Apr 2017 17:34:01 +0000 (17:34 +0000)]
[iOS] Simple HTML documents should allow non-markup JavaScript
https://bugs.webkit.org/show_bug.cgi?id=170734

Reviewed by Sam Weinig.

* WebView/WebView.mm:
(-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]): Enabled scripting
  but disabled scripting markup.

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

2 years agoActivate WebRTC data channel tests for WK1
commit-queue@webkit.org [Tue, 11 Apr 2017 17:27:10 +0000 (17:27 +0000)]
Activate WebRTC data channel tests for WK1
https://bugs.webkit.org/show_bug.cgi?id=170710

Patch by Youenn Fablet <youenn@apple.com> on 2017-04-11
Reviewed by Eric Carlson.

Source/WebCore:

Covered by existing and activated tests.

Making LibWebRTCProvider::factory not static.
For that purpose LibWebRTCMediaEndpoint now stores its peer connection factory reference.
Making LibWebRTCProvider use libebrtc networking by default.

Removing some no longer needed checks related to libwebrtc availability.

* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::LibWebRTCMediaEndpoint):
(WebCore::LibWebRTCMediaEndpoint::addTrack):
(WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
(WebCore::LibWebRTCMediaEndpoint::doCreateAnswer):
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
* platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
(WebCore::LibWebRTCProvider::factory):
* platform/mediastream/libwebrtc/LibWebRTCProvider.h:

Source/WebKit2:

* WebProcess/Network/webrtc/LibWebRTCProvider.h: Making sure networking is not done in the Web process.

LayoutTests:

* platform/mac-wk1/TestExpectations:

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

2 years agoMediaStream id should be equal to msid
commit-queue@webkit.org [Tue, 11 Apr 2017 17:06:53 +0000 (17:06 +0000)]
MediaStream id should be equal to msid
https://bugs.webkit.org/show_bug.cgi?id=170712

Patch by Youenn Fablet <youenn@apple.com> on 2017-04-11
Reviewed by Eric Carlson.

LayoutTests/imported/w3c:

* web-platform-tests/webrtc/datachannel-emptystring-expected.txt:
* web-platform-tests/webrtc/no-media-call-expected.txt:
* web-platform-tests/webrtc/promises-call-expected.txt:
* web-platform-tests/webrtc/rtcpeerconnection/setRemoteDescription-expected.txt:

Source/WebCore:

Covered by rebased tests.

Setting MediaStream id to libwebrtc mediastream label.
Refactoring to use more Ref<> in MediaStream code.

Making PeerConnection use the libwebrtc backend by default for layout tests instead of the mock.

* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::create):
(WebCore::createTrackPrivateVector):
(WebCore::MediaStream::MediaStream):
* Modules/mediastream/MediaStream.h:
* Modules/mediastream/MediaStreamRegistry.cpp:
(WebCore::MediaStreamRegistry::lookUp):
* Modules/mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::allow):
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::mediaStreamFromRTCStream):
(WebCore::LibWebRTCMediaEndpoint::addRemoteStream):
(WebCore::LibWebRTCMediaEndpoint::addRemoteTrack):
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::load):
* platform/graphics/MediaPlayer.h:
* platform/mediastream/MediaStreamPrivate.cpp:
(WebCore::MediaStreamPrivate::MediaStreamPrivate):
* platform/mediastream/MediaStreamPrivate.h:
(WebCore::MediaStreamPrivate::create):
* testing/Internals.cpp:
(WebCore::Internals::Internals):

LayoutTests:

Removing no longer needed/Adding needed calls to useMockRTCPeerConnectionFactory.

* fast/mediastream/RTCPeerConnection-inspect-answer.html:
* fast/mediastream/RTCPeerConnection-inspect-offer.html:
* fast/mediastream/RTCPeerConnection-legacy-stream-based-api.html:
* fast/mediastream/RTCPeerConnection-media-setup-single-dialog.html:
* fast/mediastream/RTCPeerConnection-remotely-assigned-transceiver-mid.html:
* fast/mediastream/RTCPeerConnection-setLocalDescription-offer.html:
* fast/mediastream/RTCPeerConnection-setRemoteDescription-offer.html:
* webrtc/audio-peer-connection-webaudio.html:
* webrtc/audio-replace-track.html:
* webrtc/connection-state.html:
* webrtc/datachannel/basic.html:
* webrtc/datachannel/bufferedAmountLowThreshold.html:
* webrtc/datachannel/datachannel-gc.html:
* webrtc/datachannel/datachannel-stats.html:
* webrtc/datachannel/filter-ice-candidate.html:
* webrtc/ephemeral-certificates-and-cnames.html:
* webrtc/libwebrtc/descriptionGetters.html:
* webrtc/negotiatedneeded-event-addStream.html:
* webrtc/no-port-zero-in-upd-candidates.html:
* webrtc/peer-connection-audio-mute.html:
* webrtc/peer-connection-audio-mute2.html:
* webrtc/peer-connection-remote-audio-mute.html:
* webrtc/peer-connection-remote-audio-mute2.html:
* webrtc/release-after-getting-track.html:
* webrtc/video-disabled-black.html:
* webrtc/video-getParameters.html:
* webrtc/video-mediastreamtrack-stats.html:
* webrtc/video-mute.html:
* webrtc/video-remote-mute.html:
* webrtc/video-replace-track-to-null.html:
* webrtc/video-replace-track.html:
* webrtc/video-stats.html:
* webrtc/video-with-receiver.html:
* webrtc/video.html:

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

2 years ago[jsc] Add missing MacroAssemblerMIPS::or32() implementation
commit-queue@webkit.org [Tue, 11 Apr 2017 17:03:59 +0000 (17:03 +0000)]
[jsc] Add missing MacroAssemblerMIPS::or32() implementation
https://bugs.webkit.org/show_bug.cgi?id=169714

Patch by Guillaume Emont <guijemont@igalia.com> on 2017-04-11
Reviewed by Michael Catanzaro.

* assembler/MacroAssemblerMIPS.h:
(JSC::MacroAssemblerMIPS::or32):
Added or32(TrustedImm32, Address).

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

2 years agoAX: Web article navigation does not work (article rotor for Facebook, Twitter, Messag...
cfleizach@apple.com [Tue, 11 Apr 2017 17:00:29 +0000 (17:00 +0000)]
AX: Web article navigation does not work (article rotor for Facebook, Twitter, Messages etc.)
https://bugs.webkit.org/show_bug.cgi?id=170330
<rdar://problem/31366105>

Reviewed by Joanmarie Diggs.

Source/WebCore:

Add a search ability for the "article" role.

Test: accessibility/mac/search-predicate-article.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::isAccessibilityObjectSearchMatchAtIndex):
* accessibility/AccessibilityObject.h:
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper _accessibilityArticleAncestor]):
* accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
(createAccessibilitySearchKeyMap):

LayoutTests:

* accessibility/mac/search-predicate-article-expected.txt:
* accessibility/mac/search-predicate-article.html:

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

2 years agotest262: test262/test/annexB/language/comments/multi-line-html-close.js
commit-queue@webkit.org [Tue, 11 Apr 2017 16:54:49 +0000 (16:54 +0000)]
test262: test262/test/annexB/language/comments/multi-line-html-close.js
https://bugs.webkit.org/show_bug.cgi?id=170648

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-04-11
Reviewed by Keith Miller.

JSTests:

* test262.yaml:

Source/JavaScriptCore:

* parser/Lexer.cpp:
(JSC::Lexer<T>::lex):
A multi-line comment that contains a line terminator is itself treated
like a line terminator. An HTML Close Comment that comes after it can
therefore treat it like it is at the start of a line, because it was
immediately preceeded by the equivalent of a line terminator.

LayoutTests:

* js/parser-xml-close-comment-expected.txt:
* js/script-tests/parser-xml-close-comment.js:
Update test coverage for JavaScript HTML comments.

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

2 years agotest262: test262/test/built-ins/Array/S15.4.3_A2.2.js
commit-queue@webkit.org [Tue, 11 Apr 2017 16:38:43 +0000 (16:38 +0000)]
test262: test262/test/built-ins/Array/S15.4.3_A2.2.js
https://bugs.webkit.org/show_bug.cgi?id=170652

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-04-11
Reviewed by Michael Saboff.

JSTests:

* stress/native-constructors-length.js: Added.
(assertLengthDescriptorAttributes):
Add a quick test for the length properties of all native constructors.

* ChakraCore/test/es5/enumerable.baseline-jsc:
Rebaseline expectations for this test.

* test262.yaml:

Source/JavaScriptCore:

* runtime/ArrayConstructor.cpp:
(JSC::ArrayConstructor::finishCreation):
* runtime/BooleanConstructor.cpp:
(JSC::BooleanConstructor::finishCreation):
* runtime/DateConstructor.cpp:
(JSC::DateConstructor::finishCreation):
* runtime/FunctionConstructor.cpp:
(JSC::FunctionConstructor::finishCreation):
* runtime/JSArrayBufferConstructor.cpp:
(JSC::JSArrayBufferConstructor::finishCreation):
* runtime/NumberConstructor.cpp:
(JSC::NumberConstructor::finishCreation):
* runtime/ObjectConstructor.cpp:
(JSC::ObjectConstructor::finishCreation):
* runtime/RegExpConstructor.cpp:
(JSC::RegExpConstructor::finishCreation):
* runtime/StringConstructor.cpp:
(JSC::StringConstructor::finishCreation):
* runtime/SymbolConstructor.cpp:
(JSC::SymbolConstructor::finishCreation):
Ensure the "length" property on these native constructors is configurable (deletable).

LayoutTests:

* ietestcenter/Javascript/15.2.3.3-4-186-expected.txt:
* ietestcenter/Javascript/15.2.3.3-4-191-expected.txt:
* ietestcenter/Javascript/15.2.3.3-4-194-expected.txt:
* ietestcenter/Javascript/15.2.3.3-4-201-expected.txt:
* ietestcenter/Javascript/15.3.3.2-1-expected.txt:
* sputnik/Conformance/15_Native_Objects/15.4_Array/15.4.3/S15.4.3_A2.2-expected.txt:
* sputnik/Conformance/15_Native_Objects/15.9_Date/15.9.5/15.9.5.1_Date.prototype.constructor/S15.9.5.1_A3_T2-expected.txt:
These tests expected the opposite, they are now out of date.

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

2 years agoAX: PDF plugin needs to support PDF-DOM Mode
cfleizach@apple.com [Tue, 11 Apr 2017 16:26:21 +0000 (16:26 +0000)]
AX: PDF plugin needs to support PDF-DOM Mode
https://bugs.webkit.org/show_bug.cgi?id=170589

Reviewed by Tim Horton.

Source/WebCore:

Provide WebCore support for accessibility connect to PDF document.
This includes the ability to connect a PDF annotation created node within WebKit to
 its PDFAnnotation parent (through use of shadowPluginParent).

* accessibility/AXObjectCache.h:
* accessibility/mac/AXObjectCacheMac.mm:
(WebCore::AXPostNotificationWithUserInfo):
* accessibility/mac/WebAccessibilityObjectWrapperMac.h:
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper shadowPluginParent]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
* html/HTMLAttributeNames.in:
* plugins/PluginViewBase.h:
(WebCore::PluginViewBase::accessibilityShadowPluginParentForElement):

Source/WebKit2:

Provide access to DOM objects with PDF document. This mean:
   1) Support a different set of attributes for WKPDFPluginAccessibilityObject.
        WKPDFPluginAccessibilityObject is now a group instead of forwarding attribute calls to the pdf layer.
   2) Connect the focused UI element to the active annotation if possible.
   3) Mark the PDF associated nodes with an attribute so they can be identified later so their correct parent can be found.

* WebProcess/Plugins/PDF/PDFLayerControllerSPI.h:
* WebProcess/Plugins/PDF/PDFPlugin.h:
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(-[WKPDFPluginAccessibilityObject pdfLayerController]):
(-[WKPDFPluginAccessibilityObject setPdfLayerController:]):
(-[WKPDFPluginAccessibilityObject convertRectToScreenSpace:]):
(-[WKPDFPluginAccessibilityObject accessibilityAttributeValue:]):
(-[WKPDFPluginAccessibilityObject accessibilityAttributeNames]):
(-[WKPDFPluginAccessibilityObject accessibilityActionNames]):
(-[WKPDFPluginAccessibilityObject accessibilityParameterizedAttributeNames]):
(-[WKPDFPluginAccessibilityObject accessibilityFocusedUIElement]):
(-[WKPDFPluginAccessibilityObject accessibilityAssociatedControlForAnnotation:]):
(-[WKPDFPluginAccessibilityObject accessibilityHitTest:]):
(WebKit::PDFPlugin::convertFromRootViewToPDFView):
(WebKit::PDFPlugin::convertFromPDFViewToScreen):
(WebKit::PDFPlugin::pluginHandlesContentOffsetForAccessibilityHitTest):
(WebKit::PDFPlugin::axObjectCache):
(WebKit::PDFPlugin::accessibilityShadowPluginParentForElement):
* WebProcess/Plugins/PDF/PDFPluginAnnotation.mm:
(WebKit::PDFPluginAnnotation::attach):
* WebProcess/Plugins/Plugin.h:
(WebKit::Plugin::accessibilityShadowPluginParentForElement):
(WebKit::Plugin::pluginHandlesContentOffsetForAccessibilityHitTest):
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::accessibilityShadowPluginParentForElement):
* WebProcess/Plugins/PluginView.h:
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
(-[WKAccessibilityWebPageObject accessibilityHitTest:]):

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

2 years agoUnreviewed, build fix for Windows after r215228 part 2
utatane.tea@gmail.com [Tue, 11 Apr 2017 15:59:47 +0000 (15:59 +0000)]
Unreviewed, build fix for Windows after r215228 part 2
https://bugs.webkit.org/show_bug.cgi?id=170723

Since GCActivityCallback class is annotated exported, we do not need to annotate each member.

* heap/GCActivityCallback.h:

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

2 years agoREGRESSION(r215153): Request Animation Frame broken when building without REQUEST_ANI...
commit-queue@webkit.org [Tue, 11 Apr 2017 15:51:58 +0000 (15:51 +0000)]
REGRESSION(r215153): Request Animation Frame broken when building without REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR
https://bugs.webkit.org/show_bug.cgi?id=170719

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2017-04-11
Reviewed by Žan Doberšek.

This is because when not using the display refresh monitor, the timer is always used, not only when throttling,
but since r215153 the rAF timer is always aligned to 30ms.

Fixes: fast/animation/request-animation-frame-too-rapid.html

* dom/ScriptedAnimationController.cpp:
(WebCore::ScriptedAnimationController::scheduleAnimation): Only do the timer alignment when throttling.

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

2 years agoUnreviewed, build fix for Windows port after r215228
utatane.tea@gmail.com [Tue, 11 Apr 2017 15:47:56 +0000 (15:47 +0000)]
Unreviewed, build fix for Windows port after r215228
https://bugs.webkit.org/show_bug.cgi?id=170723

* wtf/win/RunLoopWin.cpp:
(WTF::RunLoop::TimerBase::timerFired):

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

2 years ago[link preload] Double downloads of preloaded content when it's in MemoryCache
yoav@yoav.ws [Tue, 11 Apr 2017 15:10:10 +0000 (15:10 +0000)]
[link preload] Double downloads of preloaded content when it's in MemoryCache
https://bugs.webkit.org/show_bug.cgi?id=170122

Reviewed by Antti Koivisto.

Source/WebCore:

No new tests, but unflaked http/tests/preload/single_download_preload_headers_charset.html.

The test was flaky because it appears as if MemoryCache is not being evicted between runs,
and running multiple iterations of the test resulted in preloaded being taken out of MemoryCache
and not having the unknown encoding flag. In those cases, the result was a double download and
a failed test.

* loader/TextResourceDecoder.cpp:
(WebCore::TextResourceDecoder::setEncoding): Set the m_encodingSet flag.
* loader/TextResourceDecoder.h: Added an m_encodingSet flag initialized to false.
* loader/cache/CachedCSSStyleSheet.cpp:
(WebCore::CachedCSSStyleSheet::setEncoding): Assert that stylesheets don't maintain decoded text.
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::CachedResource): Remove initialization of hasUnknownEncoding flag.
* loader/cache/CachedResource.h:
(WebCore::CachedResource::hasUnknownEncoding): Remove.
(WebCore::CachedResource::setHasUnknownEncoding): Remove.
(WebCore::CachedResource::CachedResource): Remove initialization of hasUnknownEncoding flag.
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::determineRevalidationPolicy): Set the encoding in case it changed.

LayoutTests:

* TestExpectations: Removed flakiness label from the header preload charset test.
* fast/loader/cache-encoding-expected.txt: Changed expectation.
* fast/loader/cache-encoding.html: Modified behavior to stick with the first decoded string.
* http/tests/preload/preload-encoding-expected.txt: Changed expectation.
* http/tests/preload/preload-encoding.html: Modified behavior to stick with the first decoded string.
* imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/script-charset-01-expected.txt: This test refers to the same file
twice and expects different decoding for it each time. This is the behavior that we modified, and therefore the test expectation is changed as well.

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

2 years ago[JSC][GTK] Use RunLoop::Timer in GTK port
utatane.tea@gmail.com [Tue, 11 Apr 2017 14:56:21 +0000 (14:56 +0000)]
[JSC][GTK] Use RunLoop::Timer in GTK port
https://bugs.webkit.org/show_bug.cgi?id=170723

Reviewed by Carlos Garcia Campos.

Source/JavaScriptCore:

This patch makes GTK port use RunLoop::Timer for JSRunLoopTimer.
Only Cocoa-based ports use platform-specific Timer because it
has additional feature that changes RunLoop to the WebThread one.

And we enable Heap timers in all the ports including JSCOnly port.

* heap/EdenGCActivityCallback.cpp:
(JSC::EdenGCActivityCallback::lastGCLength):
* heap/EdenGCActivityCallback.h:
* heap/FullGCActivityCallback.cpp:
(JSC::FullGCActivityCallback::lastGCLength):
* heap/FullGCActivityCallback.h:
* heap/GCActivityCallback.cpp:
(JSC::GCActivityCallback::GCActivityCallback):
(JSC::GCActivityCallback::doWork):
(JSC::GCActivityCallback::scheduleTimer):
(JSC::GCActivityCallback::cancelTimer):
(JSC::GCActivityCallback::nextFireTime):
(JSC::GCActivityCallback::didAllocate):
* heap/GCActivityCallback.h:
* heap/IncrementalSweeper.cpp:
(JSC::IncrementalSweeper::doWork):
(JSC::IncrementalSweeper::doSweep):
* heap/IncrementalSweeper.h:
* heap/StopIfNecessaryTimer.cpp:
(JSC::StopIfNecessaryTimer::scheduleSoon):
* runtime/JSRunLoopTimer.cpp:
(JSC::JSRunLoopTimer::setRunLoop):
(JSC::JSRunLoopTimer::scheduleTimer):
(JSC::JSRunLoopTimer::cancelTimer):
(JSC::JSRunLoopTimer::JSRunLoopTimer):
(JSC::JSRunLoopTimer::~JSRunLoopTimer):
(JSC::JSRunLoopTimer::timerDidFireCallback):
* runtime/JSRunLoopTimer.h:
* runtime/PromiseDeferredTimer.cpp:
(JSC::PromiseDeferredTimer::scheduleWorkSoon):

Source/WTF:

Add secondsUntilFire method. And add setName and setPriority
for GTK RunLoop::Timer.

* wtf/RunLoop.h:
* wtf/cf/RunLoopCF.cpp:
(WTF::RunLoop::TimerBase::secondsUntilFire):
* wtf/generic/RunLoopGeneric.cpp:
(WTF::RunLoop::TimerBase::secondsUntilFire):
* wtf/glib/RunLoopGLib.cpp:
(WTF::RunLoop::TimerBase::setName):
(WTF::RunLoop::TimerBase::secondsUntilFire):
* wtf/win/RunLoopWin.cpp:
(WTF::RunLoop::TimerBase::timerFired):
(WTF::RunLoop::TimerBase::start):
(WTF::RunLoop::TimerBase::isActive):
(WTF::RunLoop::TimerBase::secondsUntilFire):

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

2 years agoREGRESSION(r215211): [GTK] Lots of image related tests are timing out, causing the...
magomez@igalia.com [Tue, 11 Apr 2017 13:19:21 +0000 (13:19 +0000)]
REGRESSION(r215211): [GTK] Lots of image related tests are timing out, causing the test bot to exit early
https://bugs.webkit.org/show_bug.cgi?id=170727

Reviewed by Carlos Garcia Campos.

Since r215211 ImageDecoder::isSizeAvailable() calls encodedDataStatus() in the different decoder implementations,
and those implementations force a partial decoding of the image if the size is not available yet. But
ImageDecoder::isSizeAvailable() was already being used inside the decoders assuming that it wasn't going to
force this partial decoding. Due to this, there are some situations where the partial decoding is not
desired but it's happening anyway. For example, the check in setSize(), which causes the partial decoding
to happen again and again because no value is actually set to the animation size (which causes the timouts
in the test bot).

To avoid this, replace all the calls to ImageDecoder::isSizeAvailable() inside the decoders with calls to
ImageDecoder::encodedDataStatus(), which doesn't force the partial decoding.

Covered by existent tests.

* platform/image-decoders/gif/GIFImageDecoder.cpp:
(WebCore::GIFImageDecoder::setSize):
* platform/image-decoders/ico/ICOImageDecoder.cpp:
(WebCore::ICOImageDecoder::decodeAtIndex):
* platform/image-decoders/jpeg/JPEGImageDecoder.h:
* platform/image-decoders/png/PNGImageDecoder.cpp:
(WebCore::PNGImageReader::decode):
(WebCore::PNGImageDecoder::frameBufferAtIndex):
* platform/image-decoders/webp/WEBPImageDecoder.cpp:
(WebCore::WEBPImageDecoder::decode):

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

2 years ago[jsc][mips] Add missing MacroAssembler functions after r214187
commit-queue@webkit.org [Tue, 11 Apr 2017 12:44:47 +0000 (12:44 +0000)]
[jsc][mips] Add missing MacroAssembler functions after r214187
https://bugs.webkit.org/show_bug.cgi?id=170089

Patch by Guillaume Emont <guijemont@igalia.com> on 2017-04-11
Reviewed by Yusuke Suzuki.

* assembler/MacroAssemblerMIPS.h:
(JSC::MacroAssemblerMIPS::loadFloat): Added.
(JSC::MacroAssemblerMIPS::storeFloat): Added.

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

2 years ago[GTK] Attach popup menu to web view widget
commit-queue@webkit.org [Tue, 11 Apr 2017 11:19:54 +0000 (11:19 +0000)]
[GTK] Attach popup menu to web view widget
https://bugs.webkit.org/show_bug.cgi?id=145866

Use gtk_menu_attach_to_widget() to let GTK+ know that popup menus belong to a certain web view.
This improves the positioning choices that the toolkit can do, and solves a long-standing issue
that caused long popup menus to hang outside of the available display area under Wayland.

Based on a patch by Jonas Ådahl <jadahl@gmail.com>.

Patch by Adrian Perez de Castro <aperez@igalia.com> on 2017-04-11
Reviewed by Carlos Garcia Campos.

* UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
(WebKit::WebPopupMenuProxyGtk::showPopupMenu):

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

2 years agoREGRESSION(r215211): [GTK] Lots of image related tests are crashing, causing the...
magomez@igalia.com [Tue, 11 Apr 2017 10:22:02 +0000 (10:22 +0000)]
REGRESSION(r215211): [GTK] Lots of image related tests are crashing, causing the test bot to exit early
https://bugs.webkit.org/show_bug.cgi?id=170721

Reviewed by Carlos Garcia Campos.

r215211 caused an infinite loop because of calls between ImageDecoder::isSizeAvailable() and the specializations of
ImageDecoder::encodedDataStatus(). Change the different decoders so ImageDecoder::encodedDataStatus doesn't call
ImageDecoder::isSizeAvailable().

Covered by existent tests.

* platform/image-decoders/bmp/BMPImageDecoder.cpp:
(WebCore::BMPImageDecoder::encodedDataStatus):
* platform/image-decoders/gif/GIFImageDecoder.cpp:
(WebCore::GIFImageDecoder::encodedDataStatus):
* platform/image-decoders/ico/ICOImageDecoder.cpp:
(WebCore::ICOImageDecoder::encodedDataStatus):
* platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
(WebCore::JPEGImageDecoder::encodedDataStatus):
* platform/image-decoders/png/PNGImageDecoder.cpp:
(WebCore::PNGImageDecoder::encodedDataStatus):
* platform/image-decoders/webp/WEBPImageDecoder.cpp:
(WebCore::WEBPImageDecoder::encodedDataStatus):

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

2 years ago[JSC] Enable JSRunLoopTimer for JSCOnly and Windows
utatane.tea@gmail.com [Tue, 11 Apr 2017 09:34:36 +0000 (09:34 +0000)]
[JSC] Enable JSRunLoopTimer for JSCOnly and Windows
https://bugs.webkit.org/show_bug.cgi?id=170655

Reviewed by Carlos Garcia Campos.

Source/JavaScriptCore:

* runtime/JSRunLoopTimer.cpp:
(JSC::JSRunLoopTimer::JSRunLoopTimer):
(JSC::JSRunLoopTimer::scheduleTimer):
(JSC::JSRunLoopTimer::cancelTimer):
* runtime/JSRunLoopTimer.h:

Source/WTF:

This patch makes RunLoop::Timer in Generic and Windows thread-safe to use it
in JSC's JSRunLoopTimer. Eventually, we would like to replace JSRunLoopTimer's
platform-dependent implementation to WTF::RunLoop::Timer.

* wtf/RunLoop.h:
* wtf/cf/RunLoopCF.cpp:
(WTF::RunLoop::TimerBase::start):
* wtf/generic/RunLoopGeneric.cpp:
(WTF::RunLoop::TimerBase::ScheduledTask::EarliestSchedule::operator()):
(WTF::RunLoop::populateTasks):
(WTF::RunLoop::runImpl):
(WTF::RunLoop::schedule):
(WTF::RunLoop::scheduleAndWakeUp):
(WTF::RunLoop::TimerBase::~TimerBase):
(WTF::RunLoop::TimerBase::start):
(WTF::RunLoop::TimerBase::stop):
(WTF::RunLoop::TimerBase::isActive):
* wtf/glib/RunLoopGLib.cpp:
(WTF::RunLoop::TimerBase::TimerBase):
* wtf/win/RunLoopWin.cpp:
(WTF::RunLoop::TimerBase::timerFired):
(WTF::RunLoop::TimerBase::start):
(WTF::RunLoop::TimerBase::stop):
(WTF::RunLoop::TimerBase::isActive):

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

2 years ago[css-grid] Fix fast/css-grid-layout/grid-simplified-layout-positioned.html
rego@igalia.com [Tue, 11 Apr 2017 09:20:16 +0000 (09:20 +0000)]
[css-grid] Fix fast/css-grid-layout/grid-simplified-layout-positioned.html
https://bugs.webkit.org/show_bug.cgi?id=167538

Reviewed by Darin Adler.

fast/css-grid-layout/grid-simplified-layout-positioned.html was flacky
as the caret was not always painted in the test runner.
The test was checking for a crash in simplified layout (see bug #163450)
and has nothing to do with the caret or "autofocus" behavior.
"autofocus" was needed to get the crash, so this change modifies
the test to blur the element, so the caret is not painted anymore.

* fast/css-grid-layout/grid-simplified-layout-positioned-expected.html:
Don't focus the input element.
* fast/css-grid-layout/grid-simplified-layout-positioned.html: Blur
the input element to avoid showing the caret.
* platform/mac-wk2/TestExpectations: Remove file from expectations.

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

2 years ago[CMake] OpenWebRTC libraries path isn't properly deduced
zandobersek@gmail.com [Tue, 11 Apr 2017 08:29:43 +0000 (08:29 +0000)]
[CMake] OpenWebRTC libraries path isn't properly deduced
https://bugs.webkit.org/show_bug.cgi?id=170670

Reviewed by Carlos Garcia Campos.

When using OpenWebRTC installation that's outside of the usual Jhbuild
installation directories, the library paths are ignored because the
dependency libraries are simply gathered from the pkg-config file.

Instead, the pkg-config data should be used to search for the correct
paths to the header and library locations. Both libopenwebrtc and
libopenwebrtc_gst libraries are needed, so the two library paths are
concatenated into the OPENWEBRTC_LIBRARIES variable.

* Source/cmake/FindOpenWebRTC.cmake:

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

2 years agoREGRESSION(r213645): It made JSC tests super slow and timeout on AArch64 Linux
zandobersek@gmail.com [Tue, 11 Apr 2017 08:27:28 +0000 (08:27 +0000)]
REGRESSION(r213645): It made JSC tests super slow and timeout on AArch64 Linux
https://bugs.webkit.org/show_bug.cgi?id=169510

Reviewed by Saam Barati.

Add the `volatile` qualifiers for ASM statements that set up ldxr and stxr
instruction calls when HAVE(LL_SC) is enabled for aarch64 platforms.

This avoids indefinite execution when running GCC-compiled JSC on Linux.
Specific bug or expected behavior that differs from Clang wasn't determined.

HAVE(LL_SC) is re-enabled on non-Darwin aarch64 platforms.

* wtf/Atomics.h:
* wtf/Platform.h:

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

2 years agoRevert r215217
achristensen@apple.com [Tue, 11 Apr 2017 06:18:55 +0000 (06:18 +0000)]
Revert r215217
https://bugs.webkit.org/show_bug.cgi?id=170703

Source/JavaScriptCore:

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

* Configurations/FeatureDefines.xcconfig:

Source/WebCore/PAL:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit/mac:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit2:

* Configurations/FeatureDefines.xcconfig:

Tools:

* TestWebKitAPI/Configurations/FeatureDefines.xcconfig:

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

2 years agoFix bad change in r215167.
cdumez@apple.com [Tue, 11 Apr 2017 05:46:34 +0000 (05:46 +0000)]
Fix bad change in r215167.
https://bugs.webkit.org/show_bug.cgi?id=170656

Reviewed by Yusuke Suzuki.

Revert mistake made in r215167.

* rendering/RenderThemeGtk.cpp:
(WebCore::RenderThemeGtk::caretBlinkInterval):

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

2 years agoContinue enabling WebRTC
achristensen@apple.com [Tue, 11 Apr 2017 05:05:33 +0000 (05:05 +0000)]
Continue enabling WebRTC
https://bugs.webkit.org/show_bug.cgi?id=170703

Reviewed by Youenn Fablet.

Source/JavaScriptCore:

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

* Configurations/FeatureDefines.xcconfig:

Source/WebCore/PAL:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit/mac:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit2:

* Configurations/FeatureDefines.xcconfig:

Tools:

* TestWebKitAPI/Configurations/FeatureDefines.xcconfig:

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

2 years agoPlayerLayerView +layerClass methods should use return type Class.
commit-queue@webkit.org [Tue, 11 Apr 2017 04:57:59 +0000 (04:57 +0000)]
PlayerLayerView +layerClass methods should use return type Class.
https://bugs.webkit.org/show_bug.cgi?id=165406

Patch by Jeremy Jones <jeremyj@apple.com> on 2017-04-10
Reviewed by Sam Weinig.

No new tests because not behavior change.

* platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
(WebAVPictureInPicturePlayerLayerView_layerClass):
(WebAVPlayerLayerView_layerClass):

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

2 years agoHave parseRevisionProperty use default repo name as the Buildbot key.
commit-queue@webkit.org [Tue, 11 Apr 2017 03:33:56 +0000 (03:33 +0000)]
Have parseRevisionProperty use default repo name as the Buildbot key.
https://bugs.webkit.org/show_bug.cgi?id=170696

Patch by Kocsen Chung <kocsen_chung@apple.com> on 2017-04-10
Reviewed by Daniel Bates.

Previously, we needed to set a key and a fallbackKey when addressing
Buildbot data for Internal. That is no longer necessary as we can make a safe assumption
that the repo name maps exactly to that key for every repository other
than WebKit.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotIteration.js:
Set `key = repositoryName` and only use fallback keys when dealing with WebKit.

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

2 years agoAdd test262 JavaScriptCore tests to dashboard
aakash_jain@apple.com [Tue, 11 Apr 2017 02:49:59 +0000 (02:49 +0000)]
Add test262 JavaScriptCore tests to dashboard
https://bugs.webkit.org/show_bug.cgi?id=170711

Rubber-stamped by Joseph Pecoraro.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/WebKitBuildbot.js:
(WebKitBuildbot): Added test262 JSC tests to dashboard.

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

2 years agoUnreviewed, test expectations update
jiewen_tan@apple.com [Tue, 11 Apr 2017 01:14:15 +0000 (01:14 +0000)]
Unreviewed, test expectations update

* platform/wk2/TestExpectations:

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

2 years agoREGRESSION(r195479) First main resource load in new WebProcess bypasses content exten...
commit-queue@webkit.org [Tue, 11 Apr 2017 00:40:00 +0000 (00:40 +0000)]
REGRESSION(r195479) First main resource load in new WebProcess bypasses content extensions
https://bugs.webkit.org/show_bug.cgi?id=170707
<rdar://problem/27788755>

Patch by Alex Christensen <achristensen@webkit.org> on 2017-04-10
Reviewed by Tim Horton.

Source/WebKit2:

We fix this by sending the UserContentController with the WebPageCreationParameters
instead of in a IPC message immediately following creation.  By the time the WebPage
receives its second message, it has already started loading the first main resource.

I also changed all instances of calling ChildProcessProxy::connection() to send a message
in favor of calling ChildProcessProxy::send, which does the same thing except if a child
process has not started, it will put the message in a queue and send it when the process
is finished launching.  This was necessary because the UserContentController is now connected
to the process sooner, so there were some API tests that would try to send messages between
initiating a process launch and finishing a process launch, and this change preserves the
existing behavior in those cases.

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* UIProcess/Databases/DatabaseProcessProxy.cpp:
(WebKit::DatabaseProcessProxy::getDatabaseProcessConnection):
(WebKit::DatabaseProcessProxy::didFinishLaunching):
* UIProcess/Downloads/DownloadProxy.cpp:
(WebKit::DownloadProxy::cancel):
(WebKit::DownloadProxy::canAuthenticateAgainstProtectionSpace):
(WebKit::DownloadProxy::willSendRequest):
(WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync):
* UIProcess/UserContent/WebUserContentControllerProxy.cpp:
(WebKit::WebUserContentControllerProxy::addProcess):
(WebKit::WebUserContentControllerProxy::addUserContentWorldUse):
(WebKit::WebUserContentControllerProxy::removeUserContentWorldUses):
(WebKit::WebUserContentControllerProxy::addUserScript):
(WebKit::WebUserContentControllerProxy::removeUserScript):
(WebKit::WebUserContentControllerProxy::removeAllUserScripts):
(WebKit::WebUserContentControllerProxy::addUserStyleSheet):
(WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
(WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
(WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler):
(WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName):
(WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
(WebKit::WebUserContentControllerProxy::addContentExtension):
(WebKit::WebUserContentControllerProxy::removeContentExtension):
(WebKit::WebUserContentControllerProxy::removeAllContentExtensions):
* UIProcess/UserContent/WebUserContentControllerProxy.h:
* UIProcess/VisitedLinkStore.cpp:
(WebKit::VisitedLinkStore::removeAll):
(WebKit::VisitedLinkStore::pendingVisitedLinksTimerFired):
(WebKit::VisitedLinkStore::sendTable):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::finishInitializingWebPageAfterProcessLaunch):
(WebKit::WebPageProxy::creationParameters):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::addWebUserContentControllerProxy):
* UIProcess/WebProcessProxy.h:
* WebProcess/UserContent/WebUserContentController.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_backgroundCPULimit):

Tools:

* TestWebKitAPI/Tests/WebKit2Cocoa/WKUserContentExtensionStore.mm:
(-[ContentExtensionDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]):
(TEST_F):
* TestWebKitAPI/Tests/WebKit2Cocoa/WebsitePolicies.mm:
(-[ContentBlockingWebsitePoliciesDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]):
(-[ContentBlockingWebsitePoliciesDelegate _webView:decidePolicyForNavigationAction:decisionHandler:]):
(TEST):

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

2 years agoCachedImage should stop decoding images when unknown type is detected
commit-queue@webkit.org [Tue, 11 Apr 2017 00:24:17 +0000 (00:24 +0000)]
CachedImage should stop decoding images when unknown type is detected
https://bugs.webkit.org/show_bug.cgi?id=170530

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2017-04-10
Reviewed by Tim Horton.

If the status of the encoded data is "unknown type", WebKit should stop
decoding the rest of the data. Ideally WebKit should also cancel loading
the rest of the encoded data.

To do that we need to add a function to the ImageDecoder to return the
encodedDataStatus(). We also need to change the return type of Image::setData()
and Image::dataChanged() form bool to EncodedDataStatus.

* WebCore.xcodeproj/project.pbxproj: Add ImageTypes.h to the WebCore project.
* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::addIncrementalDataBuffer): Replace checking !sizeAvailable
by checking if encodedDataStatus isn't an error but it has not reached
sizeAvailable state
* loader/cache/CachedResourceClientWalker.h:
(WebCore::CachedResourceClientWalker::CachedResourceClientWalker): Unrelated clean-up.
(WebCore::CachedResourceClientWalker::next): Ditto.
* loader/icon/IconRecord.cpp:
(WebCore::IconRecord::setImageData): Image::setData() used to return a bool. Now it returns
an EncodedDataStatus. !setData() now means setData() < EncodedDataStatus::SizeAvailable.
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::dataChanged): Replace the return of dataChanged() from bool
by EncodedDataStatus.
* platform/graphics/BitmapImage.h: Replace isSizeAvailable() by a new function
named encodedDataStatus().
* platform/graphics/Image.cpp:
(WebCore::Image::setData): Code clean-up and adding a clarification comment.
* platform/graphics/Image.h: Change the return of setData() and dataChanged() to be
EncodedDataStatus.
(WebCore::Image::dataChanged): Return EncodedDataStatus::Unknown as an indication
the size is not available but we do not have an error.
* platform/graphics/ImageTypes.h: Added.
Image definitions which are shared among Image, ImageDecoder, ImageSource,
ImageFrameCache and ImageFrame used to be added to ImageFrame.h. This has
been annoying since these definitions aren't related to ImageFrame only.
A new header file named ImageTypes.h is to the to include such definitions.
(WebCore::operator++):
* platform/graphics/ImageFrame.h:
(WebCore::operator++): Deleted.
* platform/graphics/ImageFrameCache.cpp:
(WebCore::ImageFrameCache::ImageFrameCache): This is the case of a BitmapImage without
a decoder but with a NativeImage. The status has to be EncodedDataStatus::Complete.
(WebCore::ImageFrameCache::growFrames): Replace if (isSizeAvailable()) by
if (encodedDataStatus() >= EncodedDataStatus::SizeAvailable).
(WebCore::ImageFrameCache::metadata): Ditto.
(WebCore::ImageFrameCache::encodedDataStatus): This is a replacement for isSizeAvailable().
Don't cache the EncodedDataStatus until it is Complete. Don't call didDecodeProperties()
until the status >= EncodedDataStatus::SizeAvailable.
(WebCore::ImageFrameCache::isSizeAvailable): Deleted.
* platform/graphics/ImageFrameCache.h: Replace isSizeAvailable() by encodedDataStatus().
* platform/graphics/ImageSource.cpp:
(WebCore::ImageSource::dataChanged): Make return an EncodedDataStatus instead of returning
a bool for isSizeAvailable.
* platform/graphics/ImageSource.h:
(WebCore::ImageSource::encodedDataStatus): Replace isSizeAvailable() by encodedDataStatus().
(WebCore::ImageSource::isSizeAvailable): Deleted.
* platform/graphics/cg/ImageDecoderCG.cpp:
(WebCore::ImageDecoder::encodedDataStatus): Replace isSizeAvailable() by encodedDataStatus().
The logic of this function is the following:
    -- CGImageSourceGetStatus() can return kCGImageStatusUnexpectedEOF, kCGImageStatusInvalidData
    or kCGImageStatusReadingHeader even if CG will end up recovering form the error and drawing
    the image. Actually CG initializes the status of CGImageSource before receiving any data
    with kCGImageStatusInvalidData. So the status will be considered an error only if all the
    data is received but CG does not move the status of this CGImageSource to Complete.
    -- If CGImageSourceGetStatus() returns Incomplete, this means CG already created the image
    reader and therefore the image type is known.
    -- If CGImageSourceGetStatus() returns UnknownType, this means CG could not create the
    image reader and this should be considered an error.
(WebCore::ImageDecoder::isSizeAvailable): Deleted.
* platform/graphics/cg/ImageDecoderCG.h: Replace isSizeAvailable() by encodedDataStatus().
* platform/graphics/cg/PDFDocumentImage.cpp:
(WebCore::PDFDocumentImage::dataChanged): The PDFDocument is created only when allDataReceived.
* platform/graphics/cg/PDFDocumentImage.h: Change the return type from bool to EncodedDataStatus.
* platform/image-decoders/ImageDecoder.h:
(WebCore::ImageDecoder::encodedDataStatus): Add a new function encodedDataStatus(). Deduce the
status of the encoded data from the flags m_failed, m_isAllDataReceived and m_sizeAvailable in
this order.
(WebCore::ImageDecoder::isSizeAvailable): Make this function uses encodedDataStatus().
* platform/image-decoders/bmp/BMPImageDecoder.cpp:
(WebCore::BMPImageDecoder::encodedDataStatus): Replace isSizeAvailable() by encodedDataStatus().
(WebCore::BMPImageDecoder::isSizeAvailable): Deleted.
* platform/image-decoders/bmp/BMPImageDecoder.h:
* platform/image-decoders/gif/GIFImageDecoder.cpp:
(WebCore::GIFImageDecoder::encodedDataStatus): Ditto.
(WebCore::GIFImageDecoder::isSizeAvailable): Deleted.
* platform/image-decoders/gif/GIFImageDecoder.h:
* platform/image-decoders/ico/ICOImageDecoder.cpp:
(WebCore::ICOImageDecoder::encodedDataStatus): Ditto.
(WebCore::ICOImageDecoder::isSizeAvailable): Deleted.
* platform/image-decoders/ico/ICOImageDecoder.h:
* platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
(WebCore::JPEGImageDecoder::encodedDataStatus): Ditto.
(WebCore::JPEGImageDecoder::isSizeAvailable): Deleted.
* platform/image-decoders/jpeg/JPEGImageDecoder.h:
* platform/image-decoders/png/PNGImageDecoder.cpp:
(WebCore::PNGImageDecoder::encodedDataStatus): Ditto.
(WebCore::PNGImageDecoder::isSizeAvailable): Deleted.
* platform/image-decoders/png/PNGImageDecoder.h:
* platform/image-decoders/webp/WEBPImageDecoder.cpp:
(WebCore::WEBPImageDecoder::encodedDataStatus): Ditto.
(WebCore::WEBPImageDecoder::isSizeAvailable): Deleted.
* platform/image-decoders/webp/WEBPImageDecoder.h:
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::dataChanged): m_page is created only when allDataReceived is true.
* svg/graphics/SVGImage.h:

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

2 years agoMark two newly imported web-platform-tests as failing.
ryanhaddad@apple.com [Tue, 11 Apr 2017 00:23:03 +0000 (00:23 +0000)]
Mark two newly imported web-platform-tests as failing.

Unreviewed test gardening.

* TestExpectations:

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

2 years agoAdd API to get available content extension identifiers in a WKContentExtensionStore
achristensen@apple.com [Tue, 11 Apr 2017 00:11:15 +0000 (00:11 +0000)]
Add API to get available content extension identifiers in a WKContentExtensionStore
https://bugs.webkit.org/show_bug.cgi?id=170093

Reviewed by Geoffrey Garen.

Source/WebKit2:

* UIProcess/API/APIContentExtensionStore.cpp:
(API::constructedPathPrefix):
(API::constructedPathFilter):
(API::constructedPath):
(API::ContentExtensionStore::getAvailableContentExtensionIdentifiers):
* UIProcess/API/APIContentExtensionStore.h:
* UIProcess/API/Cocoa/WKContentExtensionStore.h:
* UIProcess/API/Cocoa/WKContentExtensionStore.mm:
(-[WKContentExtensionStore _compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:releasesArgument:]):
(-[WKContentExtensionStore lookUpContentExtensionForIdentifier:completionHandler:]):
(-[WKContentExtensionStore getAvailableContentExtensionIdentifiers:]):
(-[WKContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]):

Tools:

* TestWebKitAPI/Tests/WebKit2Cocoa/WKUserContentExtensionStore.mm:
(TEST_F):

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

2 years agoMark SVG-Within-OpenType as "Under Consideration"
mmaxfield@apple.com [Mon, 10 Apr 2017 23:59:41 +0000 (23:59 +0000)]
Mark SVG-Within-OpenType as "Under Consideration"
https://bugs.webkit.org/show_bug.cgi?id=170706

Reviewed by Brady Eidson.

* features.json:

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

2 years agoRefactor DataInteractionTests.UnresponsivePageDoesNotHangUI to not check against...
wenson_hsieh@apple.com [Mon, 10 Apr 2017 22:22:39 +0000 (22:22 +0000)]
Refactor DataInteractionTests.UnresponsivePageDoesNotHangUI to not check against a fixed time interval
https://bugs.webkit.org/show_bug.cgi?id=170658

Reviewed by Tim Horton.

Uses ignoreSynchronousMessagingTimeoutsForTesting to ensure that this test times out if data interaction
preparation is synchronous, or passes if it is asynchronous.

* TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/cocoa/TestWKWebView.h:
* TestWebKitAPI/cocoa/TestWKWebView.mm:
(-[TestWKWebView initWithFrame:]):
(-[TestWKWebView initWithFrame:configuration:processPoolConfiguration:]):
(-[TestWKWebView _setUpTestWindow:]):

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

2 years agoWeb Inspector: WebSockets: Don't clip data in the data grid
nvasilyev@apple.com [Mon, 10 Apr 2017 21:46:04 +0000 (21:46 +0000)]
Web Inspector: WebSockets: Don't clip data in the data grid
https://bugs.webkit.org/show_bug.cgi?id=170559

Reviewed by Timothy Hatcher.

Long lines without spaces should be broken down into several lines instead of being ellipsized.

* UserInterface/Views/WebSocketContentView.css:
(.web-socket.content-view > .data-grid td.data-column,):

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

2 years agoAdd the UI for scheduling a A/B testing with a custom root
rniwa@webkit.org [Mon, 10 Apr 2017 21:45:11 +0000 (21:45 +0000)]
Add the UI for scheduling a A/B testing with a custom root
https://bugs.webkit.org/show_bug.cgi?id=170622

Reviewed by Anders Carlsson.

This patch adds the support for creating a new analysis task with a custom darwinup roots. A follow up patch
would update the syncing script to schedule such an A/B testing job to a buildbot instance.

* ReadMe.md: Updated instructions for backing up and restoring the database so that it's easier to replace
the file path for the backup.

* init-database.sql: Make task_platform and task_metric optional in each analysis task. Also added a column
to store the root file in commit_set_relationships.

* public/api/build-requests.php:
(main): Include the uploaded files.

* public/api/commits.php:
(main): Added the support for querying the latest commits for a given platform. This is used in a new page
to create a custom analysis task to autofill the latest revisions for a given platform.

* public/api/test-groups.php:
(main): Include the uploaded files.

* public/include/build-requests-fetcher.php:
(BuildRequestsFetcher::__construct): Added a list of uploaded_files and a map from its id.
(BuildRequestsFetcher::uploaded_files): Added.
(BuildRequestsFetcher::fetch_commits_for_set_if_needed): Added the support for including custom roots' id in
each commit set, and inserting its meta data in the list of uplaoded files.

* public/include/commit-log-fetcher.php:
(CommitLogFetcher::fetch_latest_for_platform): Added. Finds the latest commit for a given platform. Ideally,
we should be finding the latest commit for a given platform, but this is very slow so instead find the commit
of the latest build for a given platform.

* public/privileged-api/create-test-group.php:
(main): Added the support for creating an analysis task along with a group.
(commit_sets_from_revision_sets): Added the support for custom roots. Verify the specified uploaded file exists
and include it in commit_set_relationships. Because commits and upload files are stored in a different column
in commit_set_relationships, this function now stores the information for each row of commit_set_relationships
except the commit set ID, which is unknown until the set is created, instead of a commit ID.
(ensure_commit_sets): Made the each entry in a commit set a row instead of a commit ID as done. As this format
is only by v2 UI and detect-changes.js, we don't add the support for specifying custom roots here.

* public/privileged-api/upload-file.php:
(main): Fixed a typo. Also added one more error check.

* public/v3/components/custom-analysis-task-configurator.js: Added. The UI for selecting a test, a platform,
and a set of revisions, as well as custom roots for a custom A/B testing job. The first set of revision with
custom roots is referred as "baseline", and the second configuration is referred as "comparison" in this class.
(CustomAnalysisTaskConfigurator):
(CustomAnalysisTaskConfigurator.prototype.tests): Added.
(CustomAnalysisTaskConfigurator.prototype.platform): Added.
(CustomAnalysisTaskConfigurator.prototype.commitSets): Added. Returns a pair of baseline and comparsion if both
have been configured by the user.
(CustomAnalysisTaskConfigurator.prototype.didConstructShadowTree): Added.
(CustomAnalysisTaskConfigurator.prototype._configureComparison): Added. Called when the user is to configu the
"comparison" configuration.
(CustomAnalysisTaskConfigurator.prototype.render): Added.
(CustomAnalysisTaskConfigurator.prototype._renderTriggerableTests): Added. Renders the list of top-level tests
that can be scheduled by a triggerable.
(CustomAnalysisTaskConfigurator.prototype._renderTriggerablePlatforms): Added. Renders the list of platforms
that can be schedule with the currently selected list of tests by a triggerable. Note that the current UI only
lets the user select a single test but the intent is to allow multiple tests to be selected in the near future.
(CustomAnalysisTaskConfigurator.prototype._buildCheckboxList): Added. Creates a list of radio boxes to select
an item with a callback for each. It automatically sets "selected" class on the selected item. It's used to
render both the list of tests and platforms.
(CustomAnalysisTaskConfigurator.prototype._updateTriggerable): Added. Finds the triggerable for a given list of
tests and platforms. Returns an error when some tests belong to another triggearalbe.
(CustomAnalysisTaskConfigurator.prototype._updateRepositoryGroups): Added. Finds a repository group to use when
the current triggerable has changed. We try to use the repository group of the same name if there is any, and
defaults to the first repository group if there is none. This allows the set of repositories to be specified to
more or less persist across different triggerables. For example, if iOS platforms and Mac platforms use two
distinct triggerables , and both triggerables have two repository groups: one that only specify the OS and the
other that specifies both teh OS and WebKit revision, then this code allows the choice the user had made to
specify either just the OS or the OS and WebKit will be preserved when the user switches from an iOS platform
to a Mac platform.
(CustomAnalysisTaskConfigurator.prototype._updateCommitSetMap): Added. Create a commit set map, the format that
TestGroup.createWithTask accepts given "baseline" and "comparison" commit sets. Pretend "comparison" is not set
if two sets are identical since it makes no sense to schedule an A/B testing job when A and B are identical.
(CustomAnalysisTaskConfigurator.prototype._computeCommitSet): Added. Creates a commit set using the revisions
and the csutom roots the user had specified.
(CustomAnalysisTaskConfigurator.prototype._renderRepositoryPanes): Added. Renders the pane to specify revisions
and custom roots for "baseline" and "comparison".
(CustomAnalysisTaskConfigurator.prototype._renderBaselineRevisionTable): Added.
(CustomAnalysisTaskConfigurator.prototype._renderComparisonRevisionTable): Added.
(CustomAnalysisTaskConfigurator.prototype._optionalRepositoryList): Added.
(CustomAnalysisTaskConfigurator.prototype._buildRevisionTable): Added. Creates a table for specifying revisions
and custom roots along with a list of repository groups to pick. The set of repositories and custom roots are
shown at the all if all repository groups require them. Otherwise, they are grouped at the bottom as optional.
(CustomAnalysisTaskConfigurator.prototype._buildRepositoryGroupList): Added.
(CustomAnalysisTaskConfigurator.prototype._selectRepositoryGroup): Added.
(CustomAnalysisTaskConfigurator.prototype._buildRevisionInput): Added. Creates an input element to specify
a revision for a given repository. Autofills it with the latest commit for the currently selected platform if
the user had not modified the field by the time the revisions are fetched.
(CustomAnalysisTaskConfigurator.htmlTemplate): Added.
(CustomAnalysisTaskConfigurator.cssTemplate): Added.

* public/v3/components/instant-file-uploader.js: Added. A form to upload a custom darwinup root in "baseline"
or "comparison" configurations of CustomAnalysisTaskConfigurator. It's "instant" because it auto-detects when a
file to be uploaded had already been uploaded elsewhere by checking its SHA-256 hash.
(InstantFileUploader):
(InstantFileUploader.prototype.hasFileToUpload): Added.
(InstantFileUploader.prototype.uploadedFiles): Added.
(InstantFileUploader.prototype.addUploadedFile): Added. It's called on the uploader for "comparison"
configuration when the uploader for "baseline" configuration dipsatches "uploadedFile" action to automatically
mirror the newly uploaded custom root to "comparision" configuration.
(InstantFileUploader.prototype.didConstructShadowTree): Added.
(InstantFileUploader.prototype.render): Added.
(InstantFileUploader.prototype._renderUploadedFiles): Added. Renders the list of the uploaded files.
(InstantFileUploader.prototype._renderPreuploadFiles): Added. Renders the list of the files to be uploaded with
a progress bar.
(InstantFileUploader.prototype._updateUploadStatus): Added. Updates the progress bar for uploading the file.
(InstantFileUploader.prototype._formatUploadError): Added.
(InstantFileUploader.prototype._didFileInputChange): Added. Called when the user picks a file to uploaded on
the input element. Fetch the meta data for the uploaded file with the same SHA-256 hash if there is any, and
start uploading the file if there isn't one.
(InstantFileUploader.prototype._removeUploadedFile): Added.
(InstantFileUploader.prototype._didUploadFile): Added. Move a file from the list of files to be uploaded to
the list of uploaded files.
(InstantFileUploader.htmlTemplate): Added.
(InstantFileUploader.cssTemplate): Added.

* public/v3/index.html:

* public/v3/models/analysis-task.js:
(AnalysisTask): Made platform and metric optional as it is now.
(AnalysisTask.findByPlatformAndMetric): Skip analysis tasks without a platform or a metric.
(AnalysisTask.prototype.isCustom): Added. Returns true for a custom analysis task.
(AnalysisTask.fetchRelatedTasks): Skip custom analysis tasks.
(AnalysisTask._constructAnalysisTasksFromRawData): Construct analysis tasks even if they were missing a metric
or a platform instead of silently skipping them.

* public/v3/models/build-request.js:
(BuildRequest.constructBuildRequestsFromData): Construct uploaded file objects returned by /api/build-requests.

* public/v3/models/commit-log.js:
(CommitLog.fetchLatestCommitForPlatform): Added.

* public/v3/models/commit-set.js:
(CommitSet): Added this._customRoots.
(CommitSet.prototype.customRoots): Returns this._customRoots.
(CommitSet.prototype.equals): Returns false when the set of custom roots are not equal.
(CommitSet.areCustomRootsEqual): Added.
(CustomCommitSet):
(CustomCommitSet.prototype.equals): Added.
(CustomCommitSet.prototype.customRoots): Added.
(CustomCommitSet.prototype.addCustomRoot): Added.

* public/v3/models/manifest.js:
(Manifest._didFetchManifest): Store fileUploadSizeLimit in the manifest as UploadedFile.fileUploadSizeLimit.
This allows a file size check in the client size instead of uploading it to the server and receiving an error.

* public/v3/models/metric.js:
(Metric.formatTime): Moved from ChartPaneStatusView to be also used by InstantFileUploader._renderUploadedFiles.

* public/v3/models/test-group.js:
(TestGroup.prototype.createWithTask): Added.
(TestGroup.prototype.createAndRefetchTestGroups):
(TestGroup.prototype._revisionSetsFromCommitSets): Added. Extracted from createAndRefetchTestGroups.
(TestGroup.prototype._fetchTestGroupsForTask): Added. Extracted from createAndRefetchTestGroups.

* public/v3/models/triggerable.js:
(Triggerable.triggerablePlatformsForTests): Added.
(Triggerable.sortByNamePreferringSmallerRepositories): Added.

* public/v3/models/uploaded-file.js:
(UploadedFile.prototype.createdAt): Added.
(UploadedFile.prototype.filename): Added.
(UploadedFile.prototype.author): Added.
(UploadedFile.prototype.size): Added.
(UploadedFile.uploadFile): Added a client-side check for the file size using UploadedFile.fileUploadSizeLimit.
(UploadedFile.fetchUnloadedFileWithIdenticalHash): Ditto. Also fixed a bug that 404 was resulting in a rejected
promise instead of a resolved promise with null.

* public/v3/pages/analysis-category-page.js:
(AnalysisCategoryPage.prototype._reconstructTaskList): Modernized the code. Added the support for platform and
metric being null for some analysis tasks.

* public/v3/pages/analysis-task-page.js:
(AnalysisTaskPage.prototype._didFetchTask): Don't fetch the measurement set or create a chart for custom tasks.
(AnalysisTaskPage.prototype.render): Don't display the charts or the stacking table for custom tasks.
(AnalysisTaskPage.prototype._renderTaskNameAndStatus): Don't try to show the full test name for custom tasks
since it's not associated with exactly one pair.

* public/v3/pages/chart-pane-status-view.js:
(ChartPaneStatusView.prototype._renderBuildRevisionTable):
(ChartPaneStatusView.prototype._formatTime): Moved to Metric.formatTime.

* public/v3/pages/chart-pane.js:
(ChartPane.prototype._analyzeRange): Set inProgress to true to hide CustomAnalysisTaskConfigurator in
CreateAnalysisTaskPage when creating a non-custom analysis task for a specific range.

* public/v3/pages/create-analysis-task-page.js:
(CreateAnalysisTaskPage): This page now shows CustomAnalysisTaskConfigurator by default, and lets a user create
a custom analysis task by picking a test, a platform, and a set of revisions and custom darwinup roots.
(CreateAnalysisTaskPage.prototype.updateFromSerializedState): Show a message when inProgress is set. This is
the old behavior of this page.
(CreateAnalysisTaskPage.prototype.didConstructShadowTree): Added.
(CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): Added.
(CreateAnalysisTaskPage.prototype.render):
(CreateAnalysisTaskPage.prototype._renderMessage): Added. Hides CustomAnalysisTaskConfigurator and the select
element to specify the numebr of iterations when a message is set.
(CreateAnalysisTaskPage.htmlTemplate):
(CreateAnalysisTaskPage.cssTemplate):

* public/v3/pages/page-router.js:
(PageRouter.prototype.route): Always enqueue the page to re-render when the route has changed.

* server-tests/api-build-requests-tests.js: Updated test cases now that the response contains a list of
uploaded files associated with build requests.

* server-tests/privileged-api-create-test-group-tests.js: Added test cases for creating a custom analysis task
and a test group with custom roots.

* server-tests/resources/mock-data.js:
(MockData.addMockData): Updated the mock data to satisfy new constraint on analysis-tasks table.

* tools/js/remote.js: Include global.FormData from form-data.js.

* unit-tests/build-request-tests.js:
(sampleBuildRequestData): Updated the mock response.
* unit-tests/buildbot-syncer-tests.js:
(createSampleBuildRequest): Ditto.
* unit-tests/test-groups-tests.js:
(sampleTestGroup): Ditto.

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

2 years agoRemove call to WKShowKeyAndMain
andersca@apple.com [Mon, 10 Apr 2017 21:44:20 +0000 (21:44 +0000)]
Remove call to WKShowKeyAndMain
https://bugs.webkit.org/show_bug.cgi?id=170691
rdar://problem/31050032

Reviewed by Beth Dakin.

* Carbon/CarbonWindowAdapter.mm:
(-[CarbonWindowAdapter makeKeyWindow]):

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

2 years ago.:
rniwa@webkit.org [Mon, 10 Apr 2017 21:43:11 +0000 (21:43 +0000)]
.:
Elftoolchain ar doesn't support response files
https://bugs.webkit.org/show_bug.cgi?id=170105

Patch by Ting-Wei Lan <lantw44@gmail.com> on 2017-04-08
Reviewed by Michael Catanzaro.

WebKit enables the use of response files when cmake and ninja is used.
However, the default implementation of ar command used in FreeBSD, which
is part of elftoolchain project, doesn't support reading arguments from
response files. To avoid causing undefined reference error on FreeBSD,
we disable the use of response files when elftoolchain ar is detected.

* Source/cmake/OptionsCommon.cmake:

Websites/perf.webkit.org:
Unreviewed, rolling out r215202.
https://bugs.webkit.org/show_bug.cgi?id=170694

Committed incorrectly (Requested by rniwa on #webkit).

Reverted changeset:

"Add the UI for scheduling a A/B testing with a custom root"
https://bugs.webkit.org/show_bug.cgi?id=170622
http://trac.webkit.org/changeset/215202

Patch by Commit Queue <commit-queue@webkit.org> on 2017-04-10

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

2 years agoAdd the UI for scheduling a A/B testing with a custom root
rniwa@webkit.org [Mon, 10 Apr 2017 21:38:04 +0000 (21:38 +0000)]
Add the UI for scheduling a A/B testing with a custom root
https://bugs.webkit.org/show_bug.cgi?id=170622

Reviewed by Anders Carlsson.

This patch adds the support for creating a new analysis task with a custom darwinup roots. A follow up patch
would update the syncing script to schedule such an A/B testing job to a buildbot instance.

* ReadMe.md: Updated instructions for backing up and restoring the database so that it's easier to replace
the file path for the backup.

* init-database.sql: Make task_platform and task_metric optional in each analysis task. Also added a column
to store the root file in commit_set_relationships.

* public/api/build-requests.php:
(main): Include the uploaded files.

* public/api/commits.php:
(main): Added the support for querying the latest commits for a given platform. This is used in a new page
to create a custom analysis task to autofill the latest revisions for a given platform.

* public/api/test-groups.php:
(main): Include the uploaded files.

* public/include/build-requests-fetcher.php:
(BuildRequestsFetcher::__construct): Added a list of uploaded_files and a map from its id.
(BuildRequestsFetcher::uploaded_files): Added.
(BuildRequestsFetcher::fetch_commits_for_set_if_needed): Added the support for including custom roots' id in
each commit set, and inserting its meta data in the list of uplaoded files.

* public/include/commit-log-fetcher.php:
(CommitLogFetcher::fetch_latest_for_platform): Added. Finds the latest commit for a given platform. Ideally,
we should be finding the latest commit for a given platform, but this is very slow so instead find the commit
of the latest build for a given platform.

* public/privileged-api/create-test-group.php:
(main): Added the support for creating an analysis task along with a group.
(commit_sets_from_revision_sets): Added the support for custom roots. Verify the specified uploaded file exists
and include it in commit_set_relationships. Because commits and upload files are stored in a different column
in commit_set_relationships, this function now stores the information for each row of commit_set_relationships
except the commit set ID, which is unknown until the set is created, instead of a commit ID.
(ensure_commit_sets): Made the each entry in a commit set a row instead of a commit ID as done. As this format
is only by v2 UI and detect-changes.js, we don't add the support for specifying custom roots here.

* public/privileged-api/upload-file.php:
(main): Fixed a typo. Also added one more error check.

* public/v3/components/custom-analysis-task-configurator.js: Added. The UI for selecting a test, a platform,
and a set of revisions, as well as custom roots for a custom A/B testing job. The first set of revision with
custom roots is referred as "baseline", and the second configuration is referred as "comparison" in this class.
(CustomAnalysisTaskConfigurator):
(CustomAnalysisTaskConfigurator.prototype.tests): Added.
(CustomAnalysisTaskConfigurator.prototype.platform): Added.
(CustomAnalysisTaskConfigurator.prototype.commitSets): Added. Returns a pair of baseline and comparsion if both
have been configured by the user.
(CustomAnalysisTaskConfigurator.prototype.didConstructShadowTree): Added.
(CustomAnalysisTaskConfigurator.prototype._configureComparison): Added. Called when the user is to configu the
"comparison" configuration.
(CustomAnalysisTaskConfigurator.prototype.render): Added.
(CustomAnalysisTaskConfigurator.prototype._renderTriggerableTests): Added. Renders the list of top-level tests
that can be scheduled by a triggerable.
(CustomAnalysisTaskConfigurator.prototype._renderTriggerablePlatforms): Added. Renders the list of platforms
that can be schedule with the currently selected list of tests by a triggerable. Note that the current UI only
lets the user select a single test but the intent is to allow multiple tests to be selected in the near future.
(CustomAnalysisTaskConfigurator.prototype._buildCheckboxList): Added. Creates a list of radio boxes to select
an item with a callback for each. It automatically sets "selected" class on the selected item. It's used to
render both the list of tests and platforms.
(CustomAnalysisTaskConfigurator.prototype._updateTriggerable): Added. Finds the triggerable for a given list of
tests and platforms. Returns an error when some tests belong to another triggearalbe.
(CustomAnalysisTaskConfigurator.prototype._updateRepositoryGroups): Added. Finds a repository group to use when
the current triggerable has changed. We try to use the repository group of the same name if there is any, and
defaults to the first repository group if there is none. This allows the set of repositories to be specified to
more or less persist across different triggerables. For example, if iOS platforms and Mac platforms use two
distinct triggerables , and both triggerables have two repository groups: one that only specify the OS and the
other that specifies both teh OS and WebKit revision, then this code allows the choice the user had made to
specify either just the OS or the OS and WebKit will be preserved when the user switches from an iOS platform
to a Mac platform.
(CustomAnalysisTaskConfigurator.prototype._updateCommitSetMap): Added. Create a commit set map, the format that
TestGroup.createWithTask accepts given "baseline" and "comparison" commit sets. Pretend "comparison" is not set
if two sets are identical since it makes no sense to schedule an A/B testing job when A and B are identical.
(CustomAnalysisTaskConfigurator.prototype._computeCommitSet): Added. Creates a commit set using the revisions
and the csutom roots the user had specified.
(CustomAnalysisTaskConfigurator.prototype._renderRepositoryPanes): Added. Renders the pane to specify revisions
and custom roots for "baseline" and "comparison".
(CustomAnalysisTaskConfigurator.prototype._renderBaselineRevisionTable): Added.
(CustomAnalysisTaskConfigurator.prototype._renderComparisonRevisionTable): Added.
(CustomAnalysisTaskConfigurator.prototype._optionalRepositoryList): Added.
(CustomAnalysisTaskConfigurator.prototype._buildRevisionTable): Added. Creates a table for specifying revisions
and custom roots along with a list of repository groups to pick. The set of repositories and custom roots are
shown at the all if all repository groups require them. Otherwise, they are grouped at the bottom as optional.
(CustomAnalysisTaskConfigurator.prototype._buildRepositoryGroupList): Added.
(CustomAnalysisTaskConfigurator.prototype._selectRepositoryGroup): Added.
(CustomAnalysisTaskConfigurator.prototype._buildRevisionInput): Added. Creates an input element to specify
a revision for a given repository. Autofills it with the latest commit for the currently selected platform if
the user had not modified the field by the time the revisions are fetched.
(CustomAnalysisTaskConfigurator.htmlTemplate): Added.
(CustomAnalysisTaskConfigurator.cssTemplate): Added.

* public/v3/components/instant-file-uploader.js: Added. A form to upload a custom darwinup root in "baseline"
or "comparison" configurations of CustomAnalysisTaskConfigurator. It's "instant" because it auto-detects when a
file to be uploaded had already been uploaded elsewhere by checking its SHA-256 hash.
(InstantFileUploader):
(InstantFileUploader.prototype.hasFileToUpload): Added.
(InstantFileUploader.prototype.uploadedFiles): Added.
(InstantFileUploader.prototype.addUploadedFile): Added. It's called on the uploader for "comparison"
configuration when the uploader for "baseline" configuration dipsatches "uploadedFile" action to automatically
mirror the newly uploaded custom root to "comparision" configuration.
(InstantFileUploader.prototype.didConstructShadowTree): Added.
(InstantFileUploader.prototype.render): Added.
(InstantFileUploader.prototype._renderUploadedFiles): Added. Renders the list of the uploaded files.
(InstantFileUploader.prototype._renderPreuploadFiles): Added. Renders the list of the files to be uploaded with
a progress bar.
(InstantFileUploader.prototype._updateUploadStatus): Added. Updates the progress bar for uploading the file.
(InstantFileUploader.prototype._formatUploadError): Added.
(InstantFileUploader.prototype._didFileInputChange): Added. Called when the user picks a file to uploaded on
the input element. Fetch the meta data for the uploaded file with the same SHA-256 hash if there is any, and
start uploading the file if there isn't one.
(InstantFileUploader.prototype._removeUploadedFile): Added.
(InstantFileUploader.prototype._didUploadFile): Added. Move a file from the list of files to be uploaded to
the list of uploaded files.
(InstantFileUploader.htmlTemplate): Added.
(InstantFileUploader.cssTemplate): Added.

* public/v3/index.html:

* public/v3/models/analysis-task.js:
(AnalysisTask): Made platform and metric optional as it is now.
(AnalysisTask.findByPlatformAndMetric): Skip analysis tasks without a platform or a metric.
(AnalysisTask.prototype.isCustom): Added. Returns true for a custom analysis task.
(AnalysisTask.fetchRelatedTasks): Skip custom analysis tasks.
(AnalysisTask._constructAnalysisTasksFromRawData): Construct analysis tasks even if they were missing a metric
or a platform instead of silently skipping them.

* public/v3/models/build-request.js:
(BuildRequest.constructBuildRequestsFromData): Construct uploaded file objects returned by /api/build-requests.

* public/v3/models/commit-log.js:
(CommitLog.fetchLatestCommitForPlatform): Added.

* public/v3/models/commit-set.js:
(CommitSet): Added this._customRoots.
(CommitSet.prototype.customRoots): Returns this._customRoots.
(CommitSet.prototype.equals): Returns false when the set of custom roots are not equal.
(CommitSet.areCustomRootsEqual): Added.
(CustomCommitSet):
(CustomCommitSet.prototype.equals): Added.
(CustomCommitSet.prototype.customRoots): Added.
(CustomCommitSet.prototype.addCustomRoot): Added.

* public/v3/models/manifest.js:
(Manifest._didFetchManifest): Store fileUploadSizeLimit in the manifest as UploadedFile.fileUploadSizeLimit.
This allows a file size check in the client size instead of uploading it to the server and receiving an error.

* public/v3/models/metric.js:
(Metric.formatTime): Moved from ChartPaneStatusView to be also used by InstantFileUploader._renderUploadedFiles.

* public/v3/models/test-group.js:
(TestGroup.prototype.createWithTask): Added.
(TestGroup.prototype.createAndRefetchTestGroups):
(TestGroup.prototype._revisionSetsFromCommitSets): Added. Extracted from createAndRefetchTestGroups.
(TestGroup.prototype._fetchTestGroupsForTask): Added. Extracted from createAndRefetchTestGroups.

* public/v3/models/triggerable.js:
(Triggerable.triggerablePlatformsForTests): Added.
(Triggerable.sortByNamePreferringSmallerRepositories): Added.

* public/v3/models/uploaded-file.js:
(UploadedFile.prototype.createdAt): Added.
(UploadedFile.prototype.filename): Added.
(UploadedFile.prototype.author): Added.
(UploadedFile.prototype.size): Added.
(UploadedFile.uploadFile): Added a client-side check for the file size using UploadedFile.fileUploadSizeLimit.
(UploadedFile.fetchUnloadedFileWithIdenticalHash): Ditto. Also fixed a bug that 404 was resulting in a rejected
promise instead of a resolved promise with null.

* public/v3/pages/analysis-category-page.js:
(AnalysisCategoryPage.prototype._reconstructTaskList): Modernized the code. Added the support for platform and
metric being null for some analysis tasks.

* public/v3/pages/analysis-task-page.js:
(AnalysisTaskPage.prototype._didFetchTask): Don't fetch the measurement set or create a chart for custom tasks.
(AnalysisTaskPage.prototype.render): Don't display the charts or the stacking table for custom tasks.
(AnalysisTaskPage.prototype._renderTaskNameAndStatus): Don't try to show the full test name for custom tasks
since it's not associated with exactly one pair.

* public/v3/pages/chart-pane-status-view.js:
(ChartPaneStatusView.prototype._renderBuildRevisionTable):
(ChartPaneStatusView.prototype._formatTime): Moved to Metric.formatTime.

* public/v3/pages/chart-pane.js:
(ChartPane.prototype._analyzeRange): Set inProgress to true to hide CustomAnalysisTaskConfigurator in
CreateAnalysisTaskPage when creating a non-custom analysis task for a specific range.

* public/v3/pages/create-analysis-task-page.js:
(CreateAnalysisTaskPage): This page now shows CustomAnalysisTaskConfigurator by default, and lets a user create
a custom analysis task by picking a test, a platform, and a set of revisions and custom darwinup roots.
(CreateAnalysisTaskPage.prototype.updateFromSerializedState): Show a message when inProgress is set. This is
the old behavior of this page.
(CreateAnalysisTaskPage.prototype.didConstructShadowTree): Added.
(CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): Added.
(CreateAnalysisTaskPage.prototype.render):
(CreateAnalysisTaskPage.prototype._renderMessage): Added. Hides CustomAnalysisTaskConfigurator and the select
element to specify the numebr of iterations when a message is set.
(CreateAnalysisTaskPage.htmlTemplate):
(CreateAnalysisTaskPage.cssTemplate):

* public/v3/pages/page-router.js:
(PageRouter.prototype.route): Always enqueue the page to re-render when the route has changed.

* server-tests/api-build-requests-tests.js: Updated test cases now that the response contains a list of
uploaded files associated with build requests.
*server-tests/api-commits-tests.js: Added a test case for /api/commits/<repository-name>/latest?platform=X.
* server-tests/privileged-api-create-test-group-tests.js: Added test cases for creating a custom analysis task
and a test group with custom roots.
* server-tests/resources/mock-data.js:
(MockData.addMockData): Updated the mock data to satisfy new constraint on analysis-tasks table. Also inserted
more commits, builds, and build_commits rows for testing /api/commits/<repository-name>/latest?platform=X.

* tools/js/remote.js: Include global.FormData from form-data.js.

* unit-tests/analysis-task-tests.js: Added a test for calling findByPlatformAndMetric when there is a custom
analysis task.
(sampleAnalysisTask): Removed the category since /api/analysis-tasks/ no longer generate this property.
(sampleCustomAnalysisTask): Added.
* unit-tests/build-request-tests.js:
(sampleBuildRequestData): Updated the mock response. Added a test case for fetcing custom roots.
* unit-tests/buildbot-syncer-tests.js:
(createSampleBuildRequest): Ditto.
* unit-tests/test-groups-tests.js:
(sampleTestGroup): Ditto.

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

2 years agoAdd CoreAudioCaptureSource.
commit-queue@webkit.org [Mon, 10 Apr 2017 21:24:13 +0000 (21:24 +0000)]
Add CoreAudioCaptureSource.
https://bugs.webkit.org/show_bug.cgi?id=170112
rdar://problem/30293338

Patch by Jeremy Jones <jeremyj@apple.com> on 2017-04-10
Source/WebCore:

Reviewed by Eric Carlson.

No new tests because this provides the same funcitonality as AVAudioCaptureSource.
Funcionality is covered by existing test cases.

Add CoreAudioCaptureSource for audio capture. And use it by default in AVCaptureDeviceManager.
Add UseAVFoundationAudioCapture setting to switch back to AVFoundation for audio capture.

* WebCore.xcodeproj/project.pbxproj:
* page/Settings.cpp:
(WebCore::Settings::useAVFoundationAudioCapture):
(WebCore::Settings::setUseAVFoundationAudioCapture):
* page/Settings.h:
* platform/mediastream/mac/AVCaptureDeviceManager.h:
* platform/mediastream/mac/AVCaptureDeviceManager.mm:
(WebCore::AVCaptureDeviceManager::setUseAVFoundationAudioCapture):
* platform/mediastream/mac/CoreAudioCaptureSource.cpp: Added.
(WebCore::CoreAudioCaptureSource::create):
(WebCore::CoreAudioCaptureSource::factory):
(WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
(WebCore::CoreAudioCaptureSource::~CoreAudioCaptureSource):
(WebCore::CoreAudioCaptureSource::preferredSampleRate):
(WebCore::CoreAudioCaptureSource::preferredIOBufferDuration):
(WebCore::CoreAudioCaptureSource::configureMicrophoneProc):
(WebCore::CoreAudioCaptureSource::configureSpeakerProc):
(WebCore::CoreAudioCaptureSource::addMicrophoneDataConsumer):
(WebCore::CoreAudioCaptureSource::removeMicrophoneDataConsumer):
(WebCore::CoreAudioCaptureSource::addEchoCancellationSource):
(WebCore::CoreAudioCaptureSource::removeEchoCancellationSource):
(WebCore::CoreAudioCaptureSource::checkTimestamps):
(WebCore::CoreAudioCaptureSource::provideSpeakerData):
(WebCore::CoreAudioCaptureSource::speakerCallback):
(WebCore::CoreAudioCaptureSource::processMicrophoneSamples):
(WebCore::CoreAudioCaptureSource::microphoneCallback):
(WebCore::CoreAudioCaptureSource::defaultOutputDevice):
(WebCore::CoreAudioCaptureSource::defaultInputDevice):
(WebCore::CoreAudioCaptureSource::setupAudioUnits):
(WebCore::CoreAudioCaptureSource::startProducingData):
(WebCore::CoreAudioCaptureSource::stopProducingData):
(WebCore::CoreAudioCaptureSource::suspend):
(WebCore::CoreAudioCaptureSource::resume):
(WebCore::CoreAudioCaptureSource::capabilities):
(WebCore::CoreAudioCaptureSource::settings):
* platform/mediastream/mac/CoreAudioCaptureSource.h: Added.
* platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
(WebCore::RealtimeMediaSourceCenterMac::RealtimeMediaSourceCenterMac):
(WebCore::RealtimeMediaSourceCenterMac::defaultAudioFactory):

Source/WebKit/mac:

Reviewed by Eric Carlson.

Add UseAVFoundationAudioCapture preference to switch back from the new default of CoreAudio.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences useAVFoundationAudioCapture]):
(-[WebPreferences setUseAVFoundationAudioCapture:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit2:

Reviewed by Tim Horton.

Add UseAVFoundationAudioCapture preference to switch back from the new default of CoreAudio.

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetUseAVFoundationAudioCapture):
(WKPreferencesGetUseAVFoundationAudioCapture):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
(WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::syncWithWebCorePrefs):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

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

2 years agoWrap legacy MediaStream API in runtime flag
commit-queue@webkit.org [Mon, 10 Apr 2017 21:02:16 +0000 (21:02 +0000)]
Wrap legacy MediaStream API in runtime flag
https://bugs.webkit.org/show_bug.cgi?id=169877

Patch by Youenn Fablet <youenn@apple.com> on 2017-04-10
Reviewed by Alex Christensen.

Covered by binding tests.

Marking navigator.getUserMedia and MediaStreamEvent as runtime enabled if mediastream and webrtclegacy api flags
are on.
Updated binding generator to support multiple runtime flags.

* Modules/mediastream/MediaStreamEvent.idl:
* Modules/mediastream/NavigatorUserMedia.idl:
* bindings/scripts/CodeGeneratorJS.pm:
(GetRuntimeEnableFunctionName):
(GenerateImplementation):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSTestObjPrototype::finishCreation):
* bindings/scripts/test/TestObj.idl:

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

2 years agoMark media/modern-media-controls/volume-slider/volume-slider-value.html as flaky.
ryanhaddad@apple.com [Mon, 10 Apr 2017 20:00:55 +0000 (20:00 +0000)]
Mark media/modern-media-controls/volume-slider/volume-slider-value.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=167475

Unreviewed test gardening.

* platform/mac-wk1/TestExpectations:

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

2 years agoRemove deprecated parts of media stream spec
commit-queue@webkit.org [Mon, 10 Apr 2017 19:59:26 +0000 (19:59 +0000)]
Remove deprecated parts of media stream spec
https://bugs.webkit.org/show_bug.cgi?id=169879

Patch by Youenn Fablet <youenn@apple.com> on 2017-04-10
Reviewed by Jon Lee.

Removing MediaStreamTrackState 'new' value which was unused.
Removing MediaStreamTrack _readonly attribute which was unused.

* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::readonly): Deleted.
* Modules/mediastream/MediaStreamTrack.h:
* Modules/mediastream/MediaStreamTrack.idl:
* platform/mediastream/MediaStreamTrackPrivate.cpp:
(WebCore::MediaStreamTrackPrivate::readonly): Deleted.
* platform/mediastream/MediaStreamTrackPrivate.h:
* platform/mediastream/RealtimeMediaSource.h:

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

2 years ago[WK2][macOS] Block access to Apple Events before launch.
bfulgham@apple.com [Mon, 10 Apr 2017 19:53:49 +0000 (19:53 +0000)]
[WK2][macOS] Block access to Apple Events before launch.
https://bugs.webkit.org/show_bug.cgi?id=170626
<rdar://problem/16079334>

Reviewed by Alexey Proskuryakov.

Source/WebKit2:

Clear the environment of the AppleEvent server name before initializing
AppKit so we never bother connecting.

* Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
(main):

Tools:

Add a new TestWebKitAPI test that fails if Apple Events are sent.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Add new files.
* TestWebKitAPI/Tests/WebKit2/mac/InjectedBundleAppleEvent.cpp: Added.
(TestWebKitAPI::didReceiveMessageFromInjectedBundle):
(TestWebKitAPI::didFinishLoadForFrame):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2/mac/InjectedBundleAppleEvent_Bundle.cpp: Added.
(TestWebKitAPI::InjectedBundleAppleEventTest::InjectedBundleAppleEventTest):
(TestWebKitAPI::InjectedBundleAppleEventTest::didCreatePage):

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

2 years agoMove ProbeContext and ProbeFunction out of AbstractMacroAssembler.
mark.lam@apple.com [Mon, 10 Apr 2017 19:38:44 +0000 (19:38 +0000)]
Move ProbeContext and ProbeFunction out of AbstractMacroAssembler.
https://bugs.webkit.org/show_bug.cgi?id=170681

Reviewed by Michael Saboff.

This is a refactoring step towards enabling custom probe printers the way printInternal() works for dataLog.

* assembler/AbstractMacroAssembler.h:
(JSC::AbstractMacroAssembler::ProbeContext::gpr): Deleted.
(JSC::AbstractMacroAssembler::ProbeContext::fpr): Deleted.
(JSC::AbstractMacroAssembler::ProbeContext::gprName): Deleted.
(JSC::AbstractMacroAssembler::ProbeContext::fprName): Deleted.
* assembler/MacroAssembler.cpp:
(JSC::stdFunctionCallback):
(JSC::MacroAssembler::probe):
* assembler/MacroAssembler.h:
(JSC::ProbeContext::gpr):
(JSC::ProbeContext::fpr):
(JSC::ProbeContext::gprName):
(JSC::ProbeContext::fprName):
* assembler/MacroAssemblerARM.cpp:
(JSC::MacroAssemblerARM::probe):
* assembler/MacroAssemblerARM64.cpp:
(JSC::arm64ProbeTrampoline):
(JSC::MacroAssemblerARM64::probe):
* assembler/MacroAssemblerARMv7.cpp:
(JSC::MacroAssemblerARMv7::probe):
* assembler/MacroAssemblerPrinter.cpp:
* assembler/MacroAssemblerPrinter.h:
* assembler/MacroAssemblerX86Common.cpp:
(JSC::MacroAssemblerX86Common::probe):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::abstractStructure):
(JSC::FTL::DFG::LowerDFGToB3::probe): Deleted.
- Deleted because this became a useless place-holder after the transition to B3.

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

2 years ago[JSC] Do not run FTL stress tests on MIPS
commit-queue@webkit.org [Mon, 10 Apr 2017 19:01:57 +0000 (19:01 +0000)]
[JSC] Do not run FTL stress tests on MIPS
https://bugs.webkit.org/show_bug.cgi?id=170684

Patch by Guillaume Emont <guijemont@igalia.com> on 2017-04-10
Reviewed by Carlos Alberto Lopez Perez.

run-jsc-stress-tests does not correctly detect MIPS platforms, and its
logic to detect if the platform supports FTL ignores that MIPS does
not support FTL. This adds detection of MIPS (with the magic number
determined empirically) and fixes the determination of whether we
support FTL.

* Scripts/run-jsc-stress-tests:

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

2 years agoWebAssembly: Update spec tests
keith_miller@apple.com [Mon, 10 Apr 2017 18:34:53 +0000 (18:34 +0000)]
WebAssembly: Update spec tests
https://bugs.webkit.org/show_bug.cgi?id=170683

Rubber-stamped by JF Bastien.

* wasm.yaml:
* wasm/spec-tests/br_table.wast.js:
* wasm/spec-tests/conversions.wast.js: Removed.
* wasm/spec-tests/f32_bitwise.wast.js: Added.
* wasm/spec-tests/f32_cmp.wast.js:
* wasm/spec-tests/f64_bitwise.wast.js: Added.
* wasm/spec-tests/f64_cmp.wast.js:
* wasm/spec-tests/i32.wast.js:
* wasm/spec-tests/i64.wast.js:
* wasm/spec-tests/int_exprs.wast.js:
* wasm/spec-tests/memory.wast.js:

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

2 years agoWebAssembly: Fix B3IRGenerator for BrTable
keith_miller@apple.com [Mon, 10 Apr 2017 18:31:22 +0000 (18:31 +0000)]
WebAssembly: Fix B3IRGenerator for BrTable
https://bugs.webkit.org/show_bug.cgi?id=170685

Reviewed by JF Bastien.

For some reason this didn't get included in r215141.

This fixes an issue with BrTable and loops where we would use the loop's return type
as the branch target type.

* wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::ControlData::resultForBranch):
(JSC::Wasm::B3IRGenerator::unifyValuesWithBlock):

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

2 years agoWeb Inspector: Placeholder text is clipped in the 'Enter Class Name' field at the...
nvasilyev@apple.com [Mon, 10 Apr 2017 18:11:59 +0000 (18:11 +0000)]
Web Inspector: Placeholder text is clipped in the 'Enter Class Name' field at the bottom of Rules style sidebar in some localizations
https://bugs.webkit.org/show_bug.cgi?id=167641
<rdar://problem/26541953>

Reviewed by Joseph Pecoraro.

Make the "Enter Class Name" text field span the entire width of the Styles sidebar.

* UserInterface/Views/CSSStyleDetailsSidebarPanel.css:
(.sidebar > .panel.details.css-style > .content ~ .class-list-container > .new-class):
(.sidebar > .panel.details.css-style > .content ~ .class-list-container > .new-class > .class-name-input):
(.sidebar > .panel.details.css-style > .content ~ .class-list-container > .new-class > input[type="checkbox"]): Deleted.
(.sidebar > .panel.details.css-style > .content ~ .class-list-container > .new-class > .add-class-icon): Deleted.
(.sidebar > .panel.details.css-style > .content ~ .class-list-container > .new-class.active > .add-class-icon,): Deleted.
* UserInterface/Views/CSSStyleDetailsSidebarPanel.js:
(WebInspector.CSSStyleDetailsSidebarPanel.prototype.initialLayout):
Remove the checkbox, which didn't do anything, and the plus icon. Make the "Enter Class Name" text field visible by default.

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

2 years agowebkitpy: Increase estimate for processes run by iOS Simulators
jbedard@apple.com [Mon, 10 Apr 2017 18:11:55 +0000 (18:11 +0000)]
webkitpy: Increase estimate for processes run by iOS Simulators
https://bugs.webkit.org/show_bug.cgi?id=170678
<rdar://problem/31534061>

Reviewed by Aakash Jain.

Previously, it was estimated that each simulated iOS device would run about 100
processes.  With newer versions of iOS, this is closer to 125.

* Scripts/webkitpy/port/ios_simulator.py:
(IOSSimulatorPort): Increase process estimate from 100 to 125.

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

2 years ago[GTK] Misplaced right click menu on web page due to deprecated gtk_menu_popup()
commit-queue@webkit.org [Mon, 10 Apr 2017 18:06:32 +0000 (18:06 +0000)]
[GTK] Misplaced right click menu on web page due to deprecated gtk_menu_popup()
https://bugs.webkit.org/show_bug.cgi?id=170553

Patch by Adrian Perez de Castro <aperez@igalia.com> on 2017-04-10
Reviewed by Michael Catanzaro.

Source/WebKit2:

Use gtk_menu_popup_at_pointer() and gtk_menu_popup_at_rect() when building with GTK+ 3.22 or
newer. This allows the Wayland GTK+ backend to properly position popup menus, and also avoids
using functions which were deprecated starting at that GTK+ release.

* UIProcess/gtk/WebContextMenuProxyGtk.cpp:
(WebKit::WebContextMenuProxyGtk::show): Use gtk_menu_popup_at_pointer() as there is always a
pointer event that can be passed to it.
* UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
(WebKit::WebPopupMenuProxyGtk::showPopupMenu): Use gtk_menu_popup_at_rect(), using the coordinates
of the control passed as reference rectangle. Some conditional code is needed because with newer
GTK+ versions a relative offset instead of an absolute position is needed.

Tools:

Use gtk_menu_popup_at_pointer() and gtk_menu_popup_at_rect() when
building with GTK+ 3.22 or newer. This allows the Wayland GTK+ backend
to properly position popup menus, and also avoids using functions
which were deprecated starting at that GTK+ release.

* MiniBrowser/gtk/BrowserSearchBar.c:
(searchEntryMenuIconPressedCallback):
Update MiniBrowser to use gtk_menu_popup_at_pointer().

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

2 years agoREGRESSION (r214403): fast/events/drag-to-navigate.html and fast/events/only-valid...
wenson_hsieh@apple.com [Mon, 10 Apr 2017 17:58:58 +0000 (17:58 +0000)]
REGRESSION (r214403): fast/events/drag-to-navigate.html and fast/events/only-valid-drop-targets-receive-file-drop.html failing
https://bugs.webkit.org/show_bug.cgi?id=170677
<rdar://problem/31512633>

Reviewed by Tim Horton.

Tools:

Fixes two drag and drop LayoutTests by introducing and enabling a TestOptions switch (enableDragDestinationActionLoad)
to allow dropping URLs to trigger page navigation.

* DumpRenderTree/TestOptions.h:
* DumpRenderTree/TestOptions.mm:
(TestOptions::TestOptions):
* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebViewToConsistentStateBeforeTesting):
* DumpRenderTree/mac/UIDelegate.h:
* DumpRenderTree/mac/UIDelegate.mm:
(-[UIDelegate resetToConsistentStateBeforeTesting:]):
(-[UIDelegate webView:dragDestinationActionMaskForDraggingInfo:]):

LayoutTests:

Turn enableDragDestinationActionLoad on in these two LayoutTests via WKTR options.

* fast/events/drag-to-navigate.html:
* fast/events/only-valid-drop-targets-receive-file-drop.html:

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

2 years ago[GTK] Opening a popup menu does not pre-select the active item
commit-queue@webkit.org [Mon, 10 Apr 2017 17:55:50 +0000 (17:55 +0000)]
[GTK] Opening a popup menu does not pre-select the active item
https://bugs.webkit.org/show_bug.cgi?id=170680

Patch by Adrian Perez de Castro <aperez@igalia.com> on 2017-04-10
Reviewed by Michael Catanzaro.

* UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
(WebKit::WebPopupMenuProxyGtk::showPopupMenu): Use gtk_menu_shell_select_item() to
ensure that the active item appears selected right after popping up the menu.

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

2 years agoMark media/modern-media-controls/volume-up-support/volume-up-support.html as flaky.
ryanhaddad@apple.com [Mon, 10 Apr 2017 17:54:49 +0000 (17:54 +0000)]
Mark media/modern-media-controls/volume-up-support/volume-up-support.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=170682

Unreviewed test gardening.

* platform/mac-wk1/TestExpectations:

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

2 years agoupdate-webkit-dependency should report $response->message for diagnose
commit-queue@webkit.org [Mon, 10 Apr 2017 17:35:20 +0000 (17:35 +0000)]
update-webkit-dependency should report $response->message for diagnose
https://bugs.webkit.org/show_bug.cgi?id=170666

Patch by Fujii Hironori <Hironori.Fujii@sony.com> on 2017-04-10
Reviewed by Alex Christensen.

* Scripts/update-webkit-dependency: Print $response->message to STDERR if an error happens.

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

2 years agoUnreviewed, rolling out r215175.
ryanhaddad@apple.com [Mon, 10 Apr 2017 17:28:02 +0000 (17:28 +0000)]
Unreviewed, rolling out r215175.

This change caused a flaky crash in existing media tests.

Reverted changeset:

"Add fallback fonts to video captions stylesheet."
https://bugs.webkit.org/show_bug.cgi?id=170495
http://trac.webkit.org/changeset/215175

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

2 years agoData interaction on an image enclosed by an anchor should vend the anchor's URL
wenson_hsieh@apple.com [Mon, 10 Apr 2017 17:07:44 +0000 (17:07 +0000)]
Data interaction on an image enclosed by an anchor should vend the anchor's URL
https://bugs.webkit.org/show_bug.cgi?id=170660
<rdar://problem/31043220>

Reviewed by Tim Horton.

Source/WebCore:

When writing an image embedded inside an anchor to the pasteboard, actually use the enclosing anchor's href if
it exists. Previously, we were simply dropping this argument on the floor.

Covered by 2 new DataInteractionTests: ImageInLinkToInput and ImageInLinkWithoutHREFToInput.

* editing/ios/EditorIOS.mm:
(WebCore::Editor::writeImageToPasteboard):

Tools:

Adds two new unit tests covering cases where data interaction is triggered from an image nested underneath an
anchor. In one of the tests, the link has an href, and in the other, its href is missing, in which case we
should fall back to the image URL instead. Also fixes a related unit test that was trying to check selection
rects, but should not be.

See WebCore ChangeLog for more details.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/image-in-link-and-input.html: Added.
* TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
(TestWebKitAPI::TEST):

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

2 years agoRebaseline js/dom/global-constructors-attributes.html after r215131.
ryanhaddad@apple.com [Mon, 10 Apr 2017 16:44:01 +0000 (16:44 +0000)]
Rebaseline js/dom/global-constructors-attributes.html after r215131.

Unreviewed test gardening.

* platform/mac-elcapitan/js/dom/global-constructors-attributes-expected.txt:
* platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt:
* platform/mac/js/dom/global-constructors-attributes-expected.txt:

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

2 years agoUpdate localizable strings to "full screen" from "fullscreen"
jonlee@apple.com [Mon, 10 Apr 2017 16:05:16 +0000 (16:05 +0000)]
Update localizable strings to "full screen" from "fullscreen"
https://bugs.webkit.org/show_bug.cgi?id=170675
rdar://problem/28207034

Reviewed by Antoine Quint.

Source/WebCore:

For localizable strings, it should consistently be "full screen" instead of "fullscreen".

* English.lproj/Localizable.strings:
* English.lproj/modern-media-controls-localized-strings.js:
* platform/LocalizedStrings.cpp:
(WebCore::contextMenuItemTagExitVideoFullscreen):
(WebCore::localizedMediaControlElementString):
* platform/cocoa/LocalizedStringsCocoa.mm:
(WebCore::exitFullScreenButtonAccessibilityTitle):

Source/WebInspectorUI:

* UserInterface/Models/ScriptTimelineRecord.js:
(WebInspector.ScriptTimelineRecord.EventType.displayName): For localizable strings, it should consistently be
"full screen" instead of "fullscreen".

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

2 years agoDon't generate extra scrolling tiles for non-visible pages.
akling@apple.com [Mon, 10 Apr 2017 13:49:18 +0000 (13:49 +0000)]
Don't generate extra scrolling tiles for non-visible pages.
https://bugs.webkit.org/show_bug.cgi?id=167213
<rdar://problem/30105774>

Reviewed by Antti Koivisto.

Source/WebCore:

Reduce the tiling coverage to a minimum when the page is non-visible.
On macOS, this means that fully occluded web views can maintain a smaller set of tiles
in non-volatile surfaces, reducing net footprint.

Test: compositing/tiling/non-visible-window-tile-coverage.html

* rendering/RenderLayerBacking.cpp:
(WebCore::computePageTiledBackingCoverage): If the page's activity state is non-visible, use minimal tile coverage.
* platform/ScrollView.h:
* page/FrameView.h:
* page/FrameView.cpp:
(WebCore::FrameView::hide): Call adjustTiledBackingCoverage() in hide() since it now takes page visibility into account.

(WebCore::FrameView::enableSpeculativeTilingIfNeeded):
* testing/Internals.cpp:
(WebCore::Internals::setSpeculativeTilingDelayDisabledForTesting):
* testing/Internals.h:
* testing/Internals.idl: Add an internals API for disabling the 500ms delay before speculative tiling begins after
the main frame load finishes. This is needed for reliably testing this change.

LayoutTests:

* TestExpectations:
* compositing/tiling/non-visible-window-tile-coverage-expected.txt: Added.
* compositing/tiling/non-visible-window-tile-coverage.html: Added.
* platform/mac-wk2/TestExpectations:

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

2 years ago[GTK] Fix x32 build
berto@igalia.com [Mon, 10 Apr 2017 12:55:07 +0000 (12:55 +0000)]
[GTK] Fix x32 build
https://bugs.webkit.org/show_bug.cgi?id=170673

Patch by Thorsten Glaser <tg@mirbsd.de> on 2017-04-10
Reviewed by Carlos Alberto Lopez Perez.

* wtf/Platform.h:

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

2 years ago[GTK] Remove the GDK dependency from ImageDiff
carlosgc@webkit.org [Mon, 10 Apr 2017 11:48:22 +0000 (11:48 +0000)]
[GTK] Remove the GDK dependency from ImageDiff
https://bugs.webkit.org/show_bug.cgi?id=85299

Reviewed by Žan Doberšek.

Add a cairo only implementation of ImageDiff. We currently have 3 different implementations of ImageDiff: the
Gdk based one used by GTK+ port, the cairo based one used by WinCairo and the CG based one. Most of the code is
actually common in all of them, but it's duplicated. So, I've taken advantage of this patch to refactor the
ImageDiff code to share the common implementation. This patch adds the cross-platform code, and the cairo
implementation and enables it in the GTK+ port. In follow up patches we can move WinCairo to this implementation
and also add CG implementation.

* ImageDiff/CMakeLists.txt:
* ImageDiff/Cairo.cmake: Added.
* ImageDiff/ImageDiff.cpp: Added.
(main):
* ImageDiff/PlatformGTK.cmake:
* ImageDiff/PlatformImage.cpp: Added.
(ImageDiff::PlatformImage::isCompatible):
(ImageDiff::PlatformImage::difference):
* ImageDiff/PlatformImage.h: Added.
* ImageDiff/cairo/PlatformImageCairo.cpp: Added.
(ImageDiff::PlatformImage::createFromStdin):
(ImageDiff::PlatformImage::createFromDiffData):
(ImageDiff::PlatformImage::PlatformImage):
(ImageDiff::PlatformImage::~PlatformImage):
(ImageDiff::PlatformImage::width):
(ImageDiff::PlatformImage::height):
(ImageDiff::PlatformImage::rowBytes):
(ImageDiff::PlatformImage::hasAlpha):
(ImageDiff::PlatformImage::pixels):
(ImageDiff::PlatformImage::writeAsPNGToStdout):
* ImageDiff/gtk/ImageDiff.cpp: Removed.

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

2 years agoREGRESSION(r214426): [GTK] Test media/video-click-dblckick-standalone.html started...
carlosgc@webkit.org [Mon, 10 Apr 2017 11:44:21 +0000 (11:44 +0000)]
REGRESSION(r214426): [GTK] Test media/video-click-dblckick-standalone.html started to fail in the bots after r214426
https://bugs.webkit.org/show_bug.cgi?id=170667

Reviewed by Žan Doberšek.

Tools:

In r214666 we disabled modern media controls runtime feature for the GTK+ port, but layout tests still override
that value.

* WebKitTestRunner/gtk/TestControllerGtk.cpp:
(WTR::TestController::updatePlatformSpecificTestOptionsForTest): Disable modern media controls.

LayoutTests:

Unskip then test that is passing now.

* platform/gtk/TestExpectations:

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