WebKit-https.git
2 years agoCleanup lifetime issues of UniqueIDBDatabase and IDBBackingStore.
beidson@apple.com [Mon, 10 Jul 2017 17:43:38 +0000 (17:43 +0000)]
Cleanup lifetime issues of UniqueIDBDatabase and IDBBackingStore.
<rdar://problem/32908525> and https://bugs.webkit.org/show_bug.cgi?id=174244

Reviewed by David Kilzer and Alex Christensen.

Source/WebCore:

No targeted test possible, implicitly covered by all IDB tests.

The original idea behind UniqueIDBDatabase lifetime was that they are ThreadSafeRefCounted and
we take protector Refs when any operation that needs it alive is in flight.

This added variability to their lifetime which made it difficult to enforce a few different
design invariants, namely:
    - UniqueIBDDatabase objects are always created and destroyed only on the main thread.
    - IDBBackingStore objects are always created and destroyed only on the database thread.

This patch removes the ref counting and instead ties UniqueIDBDatabase lifetime to a
std::unique_ptr that is owned by the IDBServer.

Whenever any operations on the UniqueIDBDatabase are in flight it is kept alive by virtue
of that unique_ptr in the IDBServer. Once a UniqueIDBDatabase is completely done with all of
its work, the following happens:
    - On the main thread the IDBServer removes the unique_ptr owning the UniqueIDBDatabase
      from its map.
    - It hands the unique_ptr to the UniqueIDBDatabase itself, which schedules one final
      database thread task.
    - That database thread task is to destroy the IDBBackingStore, kill its message queues,
      and then message back to the main thread for one final task.
    - That main thread task is to release the unique_ptr, resulting in destruction of the
      UniqueIDBDatabase object.

This is safe, predictable, solves the lifetime issues that r218516 originally tried to solve,
and solves the lifetime issues that r218516 introduced.

(This patch also adds many more assertions to cover various design invariants throughout the
lifecycle of a particular UniqueIDBDatabase)

ASSERT that IDBBackingStores are only ever created and destroyed on the background thread:
* Modules/indexeddb/server/IDBBackingStore.h:
(WebCore::IDBServer::IDBBackingStore::~IDBBackingStore):
(WebCore::IDBServer::IDBBackingStore::IDBBackingStore):

Transition UniqueIDBDatabase ownership from a RefPtr to a std::unique_ptr:
* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::getOrCreateUniqueIDBDatabase):
(WebCore::IDBServer::IDBServer::closeAndTakeUniqueIDBDatabase):
(WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesModifiedSince):
(WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesForOrigins):
(WebCore::IDBServer::IDBServer::closeUniqueIDBDatabase): Deleted.
* Modules/indexeddb/server/IDBServer.h:

Make all the other changes mentioned above:
* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::~UniqueIDBDatabase): Bulk up on ASSERTs
(WebCore::IDBServer::UniqueIDBDatabase::openDatabaseConnection):
(WebCore::IDBServer::UniqueIDBDatabase::performUnconditionalDeleteBackingStore):
(WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose):
(WebCore::IDBServer::UniqueIDBDatabase::shutdownForClose):
(WebCore::IDBServer::UniqueIDBDatabase::didShutdownForClose):
(WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore):
(WebCore::IDBServer::UniqueIDBDatabase::handleCurrentOperation):
(WebCore::IDBServer::UniqueIDBDatabase::performIterateCursor):
(WebCore::IDBServer::UniqueIDBDatabase::performPrefetchCursor):
(WebCore::IDBServer::UniqueIDBDatabase::operationAndTransactionTimerFired):
(WebCore::IDBServer::UniqueIDBDatabase::activateTransactionInBackingStore):
(WebCore::IDBServer::UniqueIDBDatabase::transactionCompleted):
(WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTask):
(WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTaskReply):
(WebCore::IDBServer::UniqueIDBDatabase::executeNextDatabaseTask):
(WebCore::IDBServer::UniqueIDBDatabase::executeNextDatabaseTaskReply):
(WebCore::IDBServer::UniqueIDBDatabase::maybeFinishHardClose):
(WebCore::IDBServer::UniqueIDBDatabase::isDoneWithHardClose):
(WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete):
(WebCore::IDBServer::UniqueIDBDatabase::didPerformUnconditionalDeleteBackingStore): Deleted.
* Modules/indexeddb/server/UniqueIDBDatabase.h:
(WebCore::IDBServer::UniqueIDBDatabase::create): Deleted.

Source/WTF:

Add proper "kill" support to CrossThreadQueue, as well as isEmpty() support.

* wtf/CrossThreadQueue.h:
(WTF::CrossThreadQueue<DataType>::append):
(WTF::CrossThreadQueue<DataType>::kill):
(WTF::CrossThreadQueue<DataType>::isKilled):
(WTF::CrossThreadQueue<DataType>::isEmpty):
(WTF::CrossThreadQueue::isKilled): Deleted.

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

2 years agoFurther WebResourceLoadStatisticsStore / ResourceLoadStatisticsStore clean up
cdumez@apple.com [Mon, 10 Jul 2017 17:09:38 +0000 (17:09 +0000)]
Further WebResourceLoadStatisticsStore / ResourceLoadStatisticsStore clean up
https://bugs.webkit.org/show_bug.cgi?id=174301

Reviewed by Brent Fulgham.

Source/WebCore:

Moved some generic file system utility functions down to platform's FileSystem.h.

* platform/FileSystem.cpp:
(WebCore::openAndLockFile):
(WebCore::unlockAndCloseFile):
* platform/FileSystem.h:

Source/WebKit2:

General clean up and various simplifications / optimizations to WebResourceLoadStatisticsStore
and ResourceLoadStatisticsStore classes.

* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _resourceLoadStatisticsUpdateCookiePartitioning]):
(-[WKWebsiteDataStore _resourceLoadStatisticsSetShouldPartitionCookies:forHost:]):
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
* UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
(WebKit::ResourceLoadStatisticsStore::create):
(WebKit::ResourceLoadStatisticsStore::ResourceLoadStatisticsStore):
(WebKit::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
(WebKit::ResourceLoadStatisticsStore::createEncoderFromData):
(WebKit::ResourceLoadStatisticsStore::populateFromDecoder):
(WebKit::ResourceLoadStatisticsStore::clearInMemory):
(WebKit::ResourceLoadStatisticsStore::mergeStatistics):
(WebKit::ResourceLoadStatisticsStore::updateCookiePartitioning):
(WebKit::ResourceLoadStatisticsStore::updateCookiePartitioningForDomains):
(WebKit::ResourceLoadStatisticsStore::processStatistics):
(WebKit::ResourceLoadStatisticsStore::hasHadUnexpiredRecentUserInteraction):
(WebKit::ResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
* UIProcess/Storage/ResourceLoadStatisticsStore.h:
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
(WebKit::WebResourceLoadStatisticsStore::~WebResourceLoadStatisticsStore):
(WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
(WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
(WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
(WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
(WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded):
(WebKit::WebResourceLoadStatisticsStore::refreshFromDisk):
(WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate):
(WebKit::WebResourceLoadStatisticsStore::resourceLogFilePath):
(WebKit::WebResourceLoadStatisticsStore::writeStoreToDisk):
(WebKit::WebResourceLoadStatisticsStore::scheduleOrWriteStoreToDisk):
(WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk):
(WebKit::WebResourceLoadStatisticsStore::startMonitoringStatisticsStorage):
(WebKit::WebResourceLoadStatisticsStore::platformExcludeFromBackup):
(WebKit::WebResourceLoadStatisticsStore::createDecoderFromDisk):
(WebKit::WebResourceLoadStatisticsStore::performDailyTasks):
(WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
(WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
(WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):
(WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains):
(WebKit::WebResourceLoadStatisticsStore::clearInMemory):
(WebKit::WebResourceLoadStatisticsStore::clearInMemoryAndPersistent):
(WebKit::WebResourceLoadStatisticsStore::shouldRemoveDataRecords):
(WebKit::WebResourceLoadStatisticsStore::setDataRecordsBeingRemoved):
* UIProcess/WebResourceLoadStatisticsStore.h:
* UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
(WebKit::sortedPrevalentResourceTelemetry):
(WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::updateCookiePartitioningForTopPrivatelyOwnedDomains):
(WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
* UIProcess/WebsiteData/WebsiteDataStore.h:

Tools:

Rename some of the testRunner API for clarity and to better match what it calls
internally.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::statisticsUpdateCookiePartitioning):
(WTR::TestRunner::statisticsSetShouldPartitionCookiesForHost):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::statisticsUpdateCookiePartitioning):
(WTR::TestController::statisticsSetShouldPartitionCookiesForHost):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::statisticsUpdateCookiePartitioning):
(WTR::TestController::statisticsSetShouldPartitionCookiesForHost):

LayoutTests:

Update existing layout tests to reflect testRunner API changes.

* http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html:
* http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html:
* http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html:

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

2 years agoREGRESSION(r210226): Keyboard-focused element not preserved when navigating back...
akling@apple.com [Mon, 10 Jul 2017 17:03:14 +0000 (17:03 +0000)]
REGRESSION(r210226): Keyboard-focused element not preserved when navigating back through page cache, causing multiple elements to have focus
https://bugs.webkit.org/show_bug.cgi?id=174302
<rdar://problem/33204273>

Reviewed by Antti Koivisto.

Source/WebCore:

Don't clear the active/hovered/focused elements when destroying the render tree,
since we might need to reconstruct it later, and would like to remember which
elements those were.

Only the focused state actually stuck when going in and out of the page cache,
but this patch removes all the element pointer clearing for consistency.

Test: fast/history/page-cache-element-state-focused.html

* dom/Document.cpp:
(WebCore::Document::destroyRenderTree):

LayoutTests:

* fast/history/page-cache-element-state-focused-expected.html: Added.
* fast/history/page-cache-element-state-focused.html: Added.

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

2 years ago[SOUP] Remove WebKitSoupCookieJarSqlite
mcatanzaro@igalia.com [Mon, 10 Jul 2017 16:23:19 +0000 (16:23 +0000)]
[SOUP] Remove WebKitSoupCookieJarSqlite
https://bugs.webkit.org/show_bug.cgi?id=174310

Reviewed by Carlos Garcia Campos.

It seems WebKitSoupCookieJarSqlite uses exactly the same database format as the upstream
SoupCookieJarDb class. WebKitSoupCookieJarSqlite is a copy of SoupCookieJarSqlite that uses
WebCore's SQLite wrapper and WTF stuff. WebKitSoupCookieJarSqlite exists only because
SoupCookieJarDb is relatively new, and the older SoupCookieJarSqlite class existed only in
libsoup-gnome rather than libsoup proper. The advantage of continuing to use our
WebKitSoupCookieJarSqlite class, besides that we already know it works, is that it utilizes
the same SQLiteDatabase class that is used elsewhere in WebKit. But that's not really any
reason to keep the class around, when SoupCookieJarDb does exactly the same thing. It was
introduced in libsoup 2.42 and that is already our minimum required version, so we can
switch now.

This passes a quick sanity-check of Epiphany's cookies dialog and also TestCookieManager.

* PlatformGTK.cmake:
* PlatformWPE.cmake:
* WebProcess/Cookies/soup/WebCookieManagerSoup.cpp:
(WebKit::WebCookieManager::setCookiePersistentStorage):
* WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.cpp: Removed.
* WebProcess/Cookies/soup/WebKitSoupCookieJarSqlite.h: Removed.

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

2 years agoREGRESSION (r218616): Cannot build WebCore for macOS 10.12 with macOS 10.13 SDK
dbates@webkit.org [Mon, 10 Jul 2017 16:21:41 +0000 (16:21 +0000)]
REGRESSION (r218616): Cannot build WebCore for macOS 10.12 with macOS 10.13 SDK
https://bugs.webkit.org/show_bug.cgi?id=173939

Reviewed by Dan Bernstein.

(The code in this change was either suggested or written by Dan Bernstein with a very
minor adjustment to get it to build).

Allow WebCore to link even though CTFontCreatePhysicalFontForCharactersWithLanguage() is
undefined when building against the macOS 10.13 SDK targeting macOS 10.12. Let the dynamic
linker resolve the undefined symbol.

For completeness the SPI CTFontCreatePhysicalFontForCharactersWithLanguage() was removed
from the macOS 10.13 SDK.

* Configurations/WebCore.xcconfig: Tell the linker that CTFontCreatePhysicalFontForCharactersWithLanguage()
can be undefined when building against macOS 10.13 or later SDK.
* platform/spi/cocoa/CoreTextSPI.h: Annotate CTFontCreatePhysicalFontForCharactersWithLanguage()
with its availability information.

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

2 years agoREGRESSION(r213590): UI process updates the visible content rects more often than...
mmaxfield@apple.com [Mon, 10 Jul 2017 16:17:00 +0000 (16:17 +0000)]
REGRESSION(r213590): UI process updates the visible content rects more often than it did in iOS 10
https://bugs.webkit.org/show_bug.cgi?id=174282
<rdar://problem/33144344>

Reviewed by Simon Fraser.

In r213590, we accidentally refactored -[WKWebView _didCommitLayerTree:] to call _scheduleVisibleContentRectUpdate
more often. Instead, this should be triggered from inside the "if" statements.

No tests because there is no behavior change. Performance change is tested in MotionMark.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _isShowingVideoPictureInPicture]):
(-[WKWebView _initializeWithConfiguration:]):
(-[WKWebView goBack]):
(-[WKWebView _didCommitLayerTree:]):
(-[WKWebView _restorePageStateToUnobscuredCenter:scale:]):
(-[WKWebView _zoomToRect:withOrigin:fitEntireRect:minimumScale:maximumScale:minimumScrollDistance:]):
(-[WKWebView scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
(-[WKWebView scrollViewDidScroll:]):
(-[WKWebView _visibleContentRect]):
(-[WKWebView _frameOrBoundsChanged]):
(-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]):
(-[WKWebView _updateVisibleContentRects]):
(-[WKWebView _navigationGestureDidBegin]):
(-[WKWebView _reloadWithoutContentBlockers]):
(-[WKWebView _reloadExpiredOnly]):
(-[WKWebView _setObscuredInsets:]):
(-[WKWebView _setUnobscuredSafeAreaInsets:]):
(-[WKWebView _endAnimatedResize]):
(-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
(-[WKWebView _clearOverrideLayoutParameters]):
(-[WKWebView _requestActivatedElementAtPosition:completionBlock:]):
(-[WKWebView _propertiesOfLayerWithID:]):

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

2 years ago[GStreamer] Live twitch.tv videos do not play
commit-queue@webkit.org [Mon, 10 Jul 2017 16:10:18 +0000 (16:10 +0000)]
[GStreamer] Live twitch.tv videos do not play
https://bugs.webkit.org/show_bug.cgi?id=174222

Patch by Charlie Turner <cturner@igalia.com> on 2017-07-10
Reviewed by Michael Catanzaro.

Upgrade GStreamer to 1.10.5. It contains a change to typefind that
fixes videos not playing on twitch.tv.

* gtk/jhbuild.modules:

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

2 years agoBlock of text is missing in iBooks sample books.
zalan@apple.com [Mon, 10 Jul 2017 16:03:03 +0000 (16:03 +0000)]
Block of text is missing in iBooks sample books.
https://bugs.webkit.org/show_bug.cgi?id=174295
<rdar://problem/32955620>

Reviewed by Antti Koivisto.

Source/WebCore:

In the simple line layout context, translating y coordinate to a line index is
normally just a (y / line height) operation. However in case of strut offsets (pagination)
we need to take these extra paddings into account while resolving the line index.
This patch fixes the boundary checking for a given line by using the font size only
when the font is taller than the line.

* rendering/SimpleLineLayoutResolver.cpp:
(WebCore::SimpleLineLayout::RunResolver::adjustLineIndexForStruts):

LayoutTests:

* fast/multicol/simple-line-layout-line-index-after-strut-2-expected.html: Added.
* fast/multicol/simple-line-layout-line-index-after-strut-2.html: Added.

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

2 years ago[SOUP] SoupCookieJar is never released (resulting in sqlite temp files lying around)
carlosgc@webkit.org [Mon, 10 Jul 2017 13:21:35 +0000 (13:21 +0000)]
[SOUP] SoupCookieJar is never released (resulting in sqlite temp files lying around)
https://bugs.webkit.org/show_bug.cgi?id=166029

Reviewed by Michael Catanzaro.

Source/WebCore:

Add clearSoupNetworkSessionAndCookieStorage() to clear the SoupNetworkSession and cookie storage of the main
network session, ensuring the cookies database is properly closed.

* platform/network/NetworkStorageSession.h:
* platform/network/soup/NetworkStorageSessionSoup.cpp:
(WebCore::NetworkStorageSession::clearSoupNetworkSessionAndCookieStorage):

Source/WebKit2:

Clear the SoupNetworkSession and cookie storage after the main loop quits.

* NetworkProcess/soup/NetworkProcessMainSoup.cpp:
(WebKit::NetworkProcessMainUnix):

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

2 years agoMove make-js-file-arrays.py from WebCore to JavaScriptCore
carlosgc@webkit.org [Mon, 10 Jul 2017 13:19:55 +0000 (13:19 +0000)]
Move make-js-file-arrays.py from WebCore to JavaScriptCore
https://bugs.webkit.org/show_bug.cgi?id=174024

Reviewed by Michael Catanzaro.

.:

Make MAKE_JS_FILE_ARRAYS independent of WebCore and update it to use make-js-file-arrays.py from
JavaScriptCore. It's no longer needed to set PYTHON_PATH to find jsmin.py.

* Source/cmake/WebKitMacros.cmake:

Source/JavaScriptCore:

It's currently used only by WebCore, but it depends on other JavaScriptCore scripts and it's not WebCore
specific at all. I plan to use it to compile the JavaScript atoms used by the WebDriver implementation.
Added command line option to pass the namespace to use instead of using WebCore.

* JavaScriptCore.xcodeproj/project.pbxproj:
* Scripts/make-js-file-arrays.py: Renamed from Source/WebCore/Scripts/make-js-file-arrays.py.
(main):

Source/WebCore:

* CMakeLists.txt: Explicitly add files generated by MAKE_JS_FILE_ARRAYS to the build, since the macro no longer
does it.
* DerivedSources.make: Updated to use make-js-file-arrays.py from JavaScriptCore. It's no longer needed to set
PYTHON_PATH to find jsmin.py.

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

2 years ago[GTK] http/tests/media/video-redirect.html is failing
commit-queue@webkit.org [Mon, 10 Jul 2017 10:13:47 +0000 (10:13 +0000)]
[GTK] http/tests/media/video-redirect.html is failing
https://bugs.webkit.org/show_bug.cgi?id=174260

Patch by Charlie Turner <cturner@igalia.com> on 2017-07-10
Reviewed by Carlos Garcia Campos.

Make sure we're testing new URLs within the same security origin.

Covered by existing tests.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::convertToInternalProtocol): Factor out setting our
internal URL schema.
(WebCore::MediaPlayerPrivateGStreamer::setPlaybinURL): Use the
refactored helper.
(WebCore::MediaPlayerPrivateGStreamer::loadNextLocation): Use
refactored helper to ensure both URLs have the same origin.

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

2 years ago[WK2] Action sheets for links fail to present in WebKit2 PDF view
wenson_hsieh@apple.com [Mon, 10 Jul 2017 10:04:53 +0000 (10:04 +0000)]
[WK2] Action sheets for links fail to present in WebKit2 PDF view
https://bugs.webkit.org/show_bug.cgi?id=174307
<rdar://problem/31412128>

Reviewed by Tim Horton.

Currently, presenting an action sheet for a link always uses the WKActionSheetPresentAtClosestIndicatorRect
codepath, which requires text indicator data for the link. However, when showing an action sheet for a link via
WKPDFView, a text indicator for the link is not included, so the popover rect ends up being an empty rect at the
origin, which causes us to bail from presenting the popover.

To address this, we tweak our heuristic for determining which action sheet presentation style to use, so that we
only use the closest indicator rect for a link if the text indicator data is also present (otherwise, we fall
back to using the element rect). All other behavior is the same.

* UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant showImageSheet]):
(presentationStyleForView):

Refactor _shouldPresentAtTouchLocationForElementRect into presentationStyleForView, a static function that
returns a WKActionSheetPresentationStyle.

(-[WKActionSheetAssistant showLinkSheet]):
(-[WKActionSheetAssistant _shouldPresentAtTouchLocationForElementRect:]): Deleted.

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

2 years agoAdd WebGL2 configuration option to build-webkit
zandobersek@gmail.com [Mon, 10 Jul 2017 05:58:57 +0000 (05:58 +0000)]
Add WebGL2 configuration option to build-webkit
https://bugs.webkit.org/show_bug.cgi?id=174251

Reviewed by Michael Catanzaro.

* Scripts/webkitperl/FeatureList.pm: Add the 'webgl2' option, making it possible
to enable the ENABLE_WEBGL2 flag through the build-webkit script. The feature
is marked as enabled for the Apple Cocoa ports.

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

2 years ago[JSC] Drop LineNumberAdder since we no longer treat <LF><CR> (not <CR><LF>) as one...
utatane.tea@gmail.com [Mon, 10 Jul 2017 02:34:55 +0000 (02:34 +0000)]
[JSC] Drop LineNumberAdder since we no longer treat <LF><CR> (not <CR><LF>) as one line terminator
https://bugs.webkit.org/show_bug.cgi?id=174296

Reviewed by Mark Lam.

Previously, we treat <LF><CR> as one line terminator. So we increase line number by one.
It caused a problem in scanning template literals. While template literals normalize
<LF><CR> to <LF><LF>, we still needed to increase line number by only one.
To handle it correctly, LineNumberAdder is introduced.

As of r219263, <LF><CR> is counted as two line terminators. So we do not need to have
LineNumberAdder. Let's just use shiftLineTerminator() instead.

* parser/Lexer.cpp:
(JSC::Lexer<T>::parseTemplateLiteral):
(JSC::LineNumberAdder::LineNumberAdder): Deleted.
(JSC::LineNumberAdder::clear): Deleted.
(JSC::LineNumberAdder::add): Deleted.

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

2 years agoResource Load Statistics: User interaction should always go to top document
bfulgham@apple.com [Mon, 10 Jul 2017 02:18:56 +0000 (02:18 +0000)]
Resource Load Statistics: User interaction should always go to top document
https://bugs.webkit.org/show_bug.cgi?id=174120
<rdar://problem/33117899>

Patch by John Wilander <wilander@apple.com> on 2017-07-08
Reviewed by Chris Dumez.

Source/WebCore:

Test: http/tests/loading/resourceLoadStatistics/user-interaction-in-cross-origin-sub-frame.html

* dom/UserGestureIndicator.cpp:
(WebCore::UserGestureIndicator::UserGestureIndicator):
    Now logs user interaction for the top document.
* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::setThrottledObserverNotifications):
    Test infrastructure.
(WebCore::ResourceLoadObserver::setNotificationCallback):
    Callback now takes a ResourceLoadObserver::NotificationType.
(WebCore::ResourceLoadObserver::logFrameNavigation):
    Submits the configured ResourceLoadObserver::NotificationType.
(WebCore::ResourceLoadObserver::logSubresourceLoading):
    Submits the configured ResourceLoadObserver::NotificationType.
(WebCore::ResourceLoadObserver::logWebSocketLoading):
    Submits the configured ResourceLoadObserver::NotificationType.
(WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
    Submits the configured ResourceLoadObserver::NotificationType.
* loader/ResourceLoadObserver.h:
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
    Resets to throttled notifications.
(WebCore::Internals::setResourceLoadStatisticsThrottledObserverNotifications):
    Test infrastructure.
* testing/Internals.h:
* testing/Internals.idl:
    Added internals.setResourceLoadStatisticsThrottledObserverNotifications().

LayoutTests:

* http/tests/loading/resourceLoadStatistics/resources/dummy.html: Added.
* http/tests/loading/resourceLoadStatistics/user-interaction-in-cross-origin-sub-frame-expected.txt: Added.
* http/tests/loading/resourceLoadStatistics/user-interaction-in-cross-origin-sub-frame.html: Added.
* platform/mac-wk2/TestExpectations:
    Added as [ Pass ].

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

2 years agoRemove some obsolete WebKitVersionChecks.
beidson@apple.com [Sun, 9 Jul 2017 21:26:15 +0000 (21:26 +0000)]
Remove some obsolete WebKitVersionChecks.
https://bugs.webkit.org/show_bug.cgi?id=174294

Reviewed by Dan Bernstein.

Source/WebCore:

No new tests (No change to testable behavior)

* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::dispatchErrorEvent):

* page/Settings.in:

* platform/RuntimeApplicationChecks.h:
* platform/cocoa/RuntimeApplicationChecksCocoa.mm:
(WebCore::IOSApplication::isOkCupid): Deleted.
(WebCore::IOSApplication::isFacebook): Deleted.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::layoutOverflowRectForPropagation):

Source/WebKit/ios:

* WebView/WebPDFViewIOS.mm:
(-[WebPDFView drawPage:]):

Source/WebKit/mac:

* Misc/WebKitVersionChecks.h:

* WebView/WebHTMLView.mm:
(-[WebHTMLView hitTest:]):

* WebView/WebView.mm:
(shouldRespectPriorityInCSSAttributeSetters):
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView _preferencesChanged:]):
(shouldTransformsAffectOverflow): Deleted.
(shouldDispatchJavaScriptWindowOnErrorEvents): Deleted.

Source/WebKit2:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

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

2 years ago[Xcode] ICU headers aren’t treated as system headers after r219155
mitz@apple.com [Sun, 9 Jul 2017 20:19:47 +0000 (20:19 +0000)]
[Xcode] ICU headers aren’t treated as system headers after r219155
https://bugs.webkit.org/show_bug.cgi?id=174299

Reviewed by Sam Weinig.

* Configurations/JavaScriptCore.xcconfig: Pass --system-header-prefix=unicode/ to the C and
  C++ compilers.

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

2 years ago[JSC] Use fastMalloc / fastFree for STL containers
utatane.tea@gmail.com [Sun, 9 Jul 2017 12:22:58 +0000 (12:22 +0000)]
[JSC] Use fastMalloc / fastFree for STL containers
https://bugs.webkit.org/show_bug.cgi?id=174297

Reviewed by Sam Weinig.

Source/JavaScriptCore:

In some places, we intentionally use STL containers over WTF containers.
For example, we sometimes use std::unordered_{set,map} instead of WTF::Hash{Set,Map}
because we do not have effective empty / deleted representations in the space of key's value.
But just using STL container means using libc's malloc instead of our fast malloc (bmalloc if it is enabled).

We introduce WTF::FastAllocator. This is C++ allocator implementation using fastMalloc and fastFree.
We specify this allocator to STL containers' template parameter to allocate memory from fastMalloc.

This WTF::FastAllocator gives us a chance to use STL containers if it is necessary
without compromising memory allocation throughput.

* dfg/DFGGraph.h:
* dfg/DFGIntegerCheckCombiningPhase.cpp:
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::switchStringSlow):
* runtime/FunctionHasExecutedCache.h:
* runtime/TypeLocationCache.h:

Source/WTF:

* wtf/FastMalloc.h:
(WTF::FastAllocator::FastAllocator):
(WTF::FastAllocator::allocate):
(WTF::FastAllocator::deallocate):
(WTF::FastAllocator::operator==):
(WTF::FastAllocator::operator!=):

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

2 years agoRemove some obsolete RuntimeApplicationChecks.
beidson@apple.com [Sun, 9 Jul 2017 05:05:41 +0000 (05:05 +0000)]
Remove some obsolete RuntimeApplicationChecks.
https://bugs.webkit.org/show_bug.cgi?id=174293

Reviewed by Dan Bernstein.

Source/WebCore:

No new tests (No change to testable behavior)

* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::parametersForPlugin):
(WebCore::shouldNotPerformURLAdjustment): Deleted.

* platform/RuntimeApplicationChecks.h:
* platform/cocoa/RuntimeApplicationChecksCocoa.mm:
(WebCore::IOSApplication::isDaijisenDictionary): Deleted.
(WebCore::IOSApplication::isNASAHD): Deleted.
(WebCore::IOSApplication::isTheEconomistOnIphone): Deleted.

* platform/ios/wak/WebCoreThread.h:
* platform/ios/wak/WebCoreThread.mm:
(StartWebThread):
(WebThreadSetDelegateSourceRunLoopMode): Deleted.

Source/WebKit/mac:

* Misc/WebKitVersionChecks.h:
* WebView/WebView.mm:
(+[WebView enableWebThread]):
(-[WebView _needsPreHTML5ParserQuirks]):

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

2 years ago[Curl] Safe access and life cycle management of bare Curl handle
commit-queue@webkit.org [Sun, 9 Jul 2017 02:58:36 +0000 (02:58 +0000)]
[Curl] Safe access and life cycle management of bare Curl handle
by wrapping with C++ class
https://bugs.webkit.org/show_bug.cgi?id=174002

Patch by Basuke Suzuki <Basuke.Suzuki@sony.com> on 2017-07-08
Reviewed by Alex Christensen.

* platform/network/ResourceHandle.h:
* platform/network/ResourceHandleInternal.h:
* platform/network/curl/CookieJarCurl.cpp:
(WebCore::setCookiesFromDOM):
(WebCore::cookiesForSession):
* platform/network/curl/CurlContext.cpp:
(WebCore::CurlContext::CurlContext):
(WebCore::CurlContext::~CurlContext):
(WebCore::CurlContext::initCookieSession):
(WebCore::CurlShareHandle::CurlShareHandle):
(WebCore::CurlShareHandle::~CurlShareHandle):
(WebCore::CurlShareHandle::lockCallback):
(WebCore::CurlShareHandle::unlockCallback):
(WebCore::CurlShareHandle::mutexFor):
(WebCore::CurlMultiHandle::CurlMultiHandle):
(WebCore::CurlMultiHandle::~CurlMultiHandle):
(WebCore::CurlMultiHandle::addHandle):
(WebCore::CurlMultiHandle::removeHandle):
(WebCore::CurlMultiHandle::getFdSet):
(WebCore::CurlMultiHandle::perform):
(WebCore::CurlMultiHandle::readInfo):
(WebCore::CurlHandle::CurlHandle):
(WebCore::CurlHandle::~CurlHandle):
(WebCore::CurlHandle::perform):
(WebCore::CurlHandle::pause):
(WebCore::CurlHandle::enableShareHandle):
(WebCore::CurlHandle::setPrivateData):
(WebCore::CurlHandle::setUrl):
(WebCore::CurlHandle::clearUrl):
(WebCore::CurlHandle::clearRequestHeaders):
(WebCore::CurlHandle::appendRequestHeader):
(WebCore::CurlHandle::enableRequestHeaders):
(WebCore::CurlHandle::enableHttpGetRequest):
(WebCore::CurlHandle::enableHttpHeadRequest):
(WebCore::CurlHandle::enableHttpPostRequest):
(WebCore::CurlHandle::setPostFields):
(WebCore::CurlHandle::setPostFieldLarge):
(WebCore::CurlHandle::enableHttpPutRequest):
(WebCore::CurlHandle::setInFileSizeLarge):
(WebCore::CurlHandle::setHttpCustomRequest):
(WebCore::CurlHandle::enableAcceptEncoding):
(WebCore::CurlHandle::enableAllowedProtocols):
(WebCore::CurlHandle::enableFollowLocation):
(WebCore::CurlHandle::enableAutoReferer):
(WebCore::CurlHandle::enableHttpAuthentication):
(WebCore::CurlHandle::setHttpAuthUserPass):
(WebCore::CurlHandle::enableCAInfoIfExists):
(WebCore::CurlHandle::setSslVerifyPeer):
(WebCore::CurlHandle::setSslVerifyHost):
(WebCore::CurlHandle::setSslCert):
(WebCore::CurlHandle::setSslCertType):
(WebCore::CurlHandle::setSslKeyPassword):
(WebCore::CurlHandle::enableCookieJarIfExists):
(WebCore::CurlHandle::setCookieList):
(WebCore::CurlHandle::getCookieList):
(WebCore::CurlHandle::clearCookieList):
(WebCore::CurlHandle::enableProxyIfExists):
(WebCore::CurlHandle::enableTimeout):
(WebCore::CurlHandle::setHeaderCallbackFunction):
(WebCore::CurlHandle::setWriteCallbackFunction):
(WebCore::CurlHandle::setReadCallbackFunction):
(WebCore::CurlHandle::setSslCtxCallbackFunction):
(WebCore::CurlHandle::getEffectiveURL):
(WebCore::CurlHandle::getPrimaryPort):
(WebCore::CurlHandle::getResponseCode):
(WebCore::CurlHandle::getContentLenghtDownload):
(WebCore::CurlHandle::getHttpAuthAvail):
(WebCore::CurlHandle::getTimes):
(WebCore::CurlHandle::maxCurlOffT):
(WebCore::CurlHandle::expectedSizeOfCurlOffT):
(WebCore::CurlHandle::enableVerboseIfUsed):
(WebCore::CurlHandle::enableStdErrIfUsed):
(WebCore::CurlContext::getEffectiveURL): Deleted.
(WebCore::CurlContext::createMultiHandle): Deleted.
(WebCore::CurlContext::mutexFor): Deleted.
(WebCore::CurlContext::lock): Deleted.
(WebCore::CurlContext::unlock): Deleted.
* platform/network/curl/CurlContext.h:
(WebCore::CurlGlobal::CurlGlobal):
(WebCore::CurlGlobal::~CurlGlobal):
(WebCore::CurlShareHandle::handle):
(WebCore::CurlContext::shareHandle):
(WebCore::CurlHandle::handle):
(WebCore::CurlHandle::url):
(WebCore::CurlContext::curlShareHandle): Deleted.
* platform/network/curl/CurlDownload.cpp:
(WebCore::CurlDownload::~CurlDownload):
(WebCore::CurlDownload::init):
(WebCore::CurlDownload::start):
(WebCore::CurlDownload::cancel):
(WebCore::CurlDownload::getUrl):
(WebCore::CurlDownload::addHeaders):
(WebCore::CurlDownload::didReceiveHeader):
(WebCore::CurlDownload::writeCallback):
* platform/network/curl/CurlDownload.h:
* platform/network/curl/CurlJobManager.cpp:
(WebCore::CurlJobManager::CurlJobManager):
(WebCore::CurlJobManager::~CurlJobManager):
(WebCore::CurlJobManager::addToCurl):
(WebCore::CurlJobManager::removeFromCurl):
(WebCore::CurlJobManager::workerThread):
* platform/network/curl/CurlJobManager.h:
(WebCore::CurlJobManager::getMultiHandle): Deleted.
* platform/network/curl/ResourceHandleCurl.cpp:
(WebCore::ResourceHandleInternal::~ResourceHandleInternal):
(WebCore::ResourceHandle::platformSetDefersLoading):
(WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
(WebCore::ResourceHandle::receivedCredential):
(WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
(WebCore::calculateWebTimingInformations):
(WebCore::handleLocalReceiveResponse):
(WebCore::writeCallback):
(WebCore::getProtectionSpace):
(WebCore::headerCallback):
(WebCore::readCallback):
(WebCore::setupFormData):
(WebCore::ResourceHandle::setupPUT):
(WebCore::ResourceHandle::setupPOST):
(WebCore::ResourceHandle::dispatchSynchronousJob):
(WebCore::ResourceHandle::applyAuthentication):
(WebCore::ResourceHandle::initialize):
(WebCore::ResourceHandle::handleCurlMsg):
* platform/network/curl/ResourceHandleManager.cpp:
(WebCore::ResourceHandleManager::ResourceHandleManager):
(WebCore::ResourceHandleManager::~ResourceHandleManager):
(WebCore::ResourceHandleManager::downloadTimerCallback):
(WebCore::ResourceHandleManager::removeFromCurl):
(WebCore::ResourceHandleManager::startJob):
* platform/network/curl/ResourceHandleManager.h:
* platform/network/curl/SSLHandle.cpp:
(WebCore::setSSLClientCertificate):
(WebCore::certVerifyCallback):
(WebCore::setSSLVerifyOptions):

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

2 years agoREGRESSION: "visibility:hidden" does not hide play button for video elements
commit-queue@webkit.org [Sat, 8 Jul 2017 23:59:04 +0000 (23:59 +0000)]
REGRESSION: "visibility:hidden" does not hide play button for video elements
https://bugs.webkit.org/show_bug.cgi?id=174258
<rdar://problem/33181452>

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

Source/WebCore:

In order to not have most styles from the page affect the shadow root, we set "all: initial" on the
media controls container. However, we need to still make the "visibility" property inherit from its
host such that "visibility: hidden" on the host won't be overridden by setting the property back to
its initial value, which is "visible".

Test: media/modern-media-controls/css/visibility-hidden.html

* Modules/modern-media-controls/controls/media-controls.css:
(.media-controls-container):

LayoutTests:

Add a test that checks that <video controls style="visibility:hidden"> does not render anything.

* media/modern-media-controls/css/visibility-hidden-expected.html: Added.
* media/modern-media-controls/css/visibility-hidden.html: Added.
* platform/ios-simulator/TestExpectations:
* platform/mac/TestExpectations:

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

2 years agoSimplify WebResourceLoadStatisticsStore / ResourceLoadStatisticsStore
cdumez@apple.com [Sat, 8 Jul 2017 23:11:16 +0000 (23:11 +0000)]
Simplify WebResourceLoadStatisticsStore / ResourceLoadStatisticsStore
https://bugs.webkit.org/show_bug.cgi?id=174290

Reviewed by Brent Fulgham.

Source/WebKit2:

* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _resourceLoadStatisticsProcessStatisticsAndDataRecords]):
(-[WKWebsiteDataStore _resourceLoadStatisticsSubmitTelemetry]):
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
Rename a couple of functions in the Cocoa SPI for clarity and to match the name
of their internal implementation.

* UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
(WebKit::ResourceLoadStatisticsStore::create):
(WebKit::ResourceLoadStatisticsStore::ensureResourceStatisticsForPrimaryDomain):
Stylistic changes.

(WebKit::ResourceLoadStatisticsStore::createEncoderFromData):
Make const.

(WebKit::ResourceLoadStatisticsStore::readDataFromDecoder):
Use HashMap::add() instead of HashMap::set(). There is not supposed to have any duplicate
keys so add() is sufficient and more efficient.

(WebKit::ResourceLoadStatisticsStore::clearInMemoryAndPersistent): Removed.
clearInMemoryAndPersistent() was only called from WebResourceLoadStatisticsStore and
the m_deletePersistentStoreHandler / m_grandfatherExistingWebsiteDataHandler were both
set by the WebResourceLoadStatisticsStore as well. Therefore, we don't really need this
function, WebResourceLoadStatisticsStore now calls ResourceLoadStatisticsStore::clearInMemory()
instead and takes care of doing what the m_deletePersistentStoreHandler /
m_grandfatherExistingWebsiteDataHandler handlers were doing on its side.

(WebKit::ResourceLoadStatisticsStore::mergeStatistics):
Pass Vector as rvalue reference, as a preparation for a future optimization. Added FIXME
comment about the optimization.

(WebKit::ResourceLoadStatisticsStore::setNotificationCallback): Removed.
(WebKit::ResourceLoadStatisticsStore::setGrandfatherExistingWebsiteDataCallback): Removed.
(WebKit::ResourceLoadStatisticsStore::setDeletePersistentStoreCallback): Removed.
(WebKit::ResourceLoadStatisticsStore::setFireTelemetryCallback): Removed.
Drop those callback setters. WebResourceLoadStatisticsStore is the only client of
ResourceLoadStatisticsStore and those callbacks were always called as a result of
an operation requested by the WebResourceLoadStatisticsStore. Therefore, those are
not needed. WebResourceLoadStatisticsStore can take care of doing what those
callbacks were doing on its side.

(WebKit::ResourceLoadStatisticsStore::processStatistics):
Pass parameter by const reference since we clearly do not intend to transfer ownership of it.

(WebKit::ResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
(WebKit::ResourceLoadStatisticsStore::updateStatisticsForRemovedDataRecords):
(WebKit::ResourceLoadStatisticsStore::handleFreshStartWithEmptyOrNoStore):
Stylistic changes.

(WebKit::ResourceLoadStatisticsStore::shouldRemoveDataRecords): Removed.
(WebKit::ResourceLoadStatisticsStore::dataRecordsBeingRemoved): Removed.
(WebKit::ResourceLoadStatisticsStore::dataRecordsWereRemoved): Removed.
Those were moved to WebResourceLoadStatisticsStore since they do not require
any access to the statistics, and are only used by WebResourceLoadStatisticsStore.

* UIProcess/Storage/ResourceLoadStatisticsStore.h:

* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
Store registering most callbacks on the coreStore. Instead, the logic of those
callbacks is now inlined in the few methods in WebResourceLoadStatisticsStore
that were causing these callbacks to be called.

(WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
Access some methods on WebResourceLoadStatisticsStore instead of the coreStore
since those were moved.

(WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
Drop unnecessary mutable for lambda.

(WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
Pass parameter as rvalue reference as a preparation for a future optimization.

(WebKit::WebResourceLoadStatisticsStore::hasStatisticsFileChangedSinceLastSync):
Make const.

(WebKit::WebResourceLoadStatisticsStore::submitTelemetry):
Add assertion to make sure this is called on the main thread.

(WebKit::WebResourceLoadStatisticsStore::fireDataModificationHandler): Removed.
This was dispatching to a background queue to call fireDataModificationHandler()
on the ResourceLoadStatisticsStore. The coreStore would then dispatch back on the
main thread to call the WebResourceLoadStatisticsStore's modification handler.
This modification handler was merely calling processStatisticsAndDataRecords().
Therefore, callers of WebResourceLoadStatisticsStore::fireDataModificationHandler()
can call WebResourceLoadStatisticsStore::processStatisticsAndDataRecords() directly
instead.

(WebKit::WebResourceLoadStatisticsStore::fireTelemetryHandler): Removed.
This was calling ResourceLoadStatisticsStore::fireTelemetryHandler(), which was
calling back WebResourceLoadStatisticsStore's fireTelemetryHandler. The handler
in question was merely calling submitTelemetry(). Therefore, callers of
WebResourceLoadStatisticsStore::fireTelemetryHandler() can call
WebResourceLoadStatisticsStore::submitTelemetry() directly instead.

(WebKit::WebResourceLoadStatisticsStore::clearInMemoryAndPersistent):
Call ResourceLoadStatisticsStore::clearInMemory() instead of clearInMemoryAndPersistent(),
which was removed. ResourceLoadStatisticsStore::clearInMemoryAndPersistent() was calling
clearInMemory() and then 2 of WebResourceLoadStatisticsStore's handlers. Instead, we now
call the functions that those handlers were calling directly, thus eliminating the need
for those handlers.

(WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
Set m_minimumTimeBetweenDataRecordsRemoval directly as it is now store on this class
instead of the coreStore.

(WebKit::WebResourceLoadStatisticsStore::shouldRemoveDataRecords):
(WebKit::WebResourceLoadStatisticsStore::dataRecordsBeingRemoved):
(WebKit::WebResourceLoadStatisticsStore::dataRecordsWereRemoved):
Those were merely moved from the ResourceLoadStatisticsStore.

* UIProcess/WebResourceLoadStatisticsStore.h:

* UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
(WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
Check for sortedPrevalentResources.isEmpty() instead of checking if the size
if less than minimumPrevalentResourcesForTelemetry.
ResourceLoadStatisticsStore::sortedPrevalentResourceTelemetry() either returns
an empty vector or a vector with more than minimumPrevalentResourcesForTelemetry
items. Therefore, there is no need to expose minimumPrevalentResourcesForTelemetry.

Tools:

Rename testRunner API to match the new internal API names.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::statisticsProcessStatisticsAndDataRecords):
(WTR::TestRunner::statisticsSubmitTelemetry):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::statisticsProcessStatisticsAndDataRecords):
(WTR::TestController::statisticsSubmitTelemetry):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::statisticsProcessStatisticsAndDataRecords):
(WTR::TestController::statisticsSubmitTelemetry):

LayoutTests:

Update layout tests to reflect changes to the testRunner API naming.

* http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics.html:
* http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-sub-frame-under-top-frame-origins.html:
* http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-under-top-frame-origins.html:
* http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-subresource-unique-redirects-to.html:
* http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-mixed-statistics.html:
* http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under-top-frame-origins.html:
* http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins.html:
* http/tests/loading/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to.html:
* http/tests/loading/resourceLoadStatistics/clear-in-memory-and-persistent-store-one-hour.html:
* http/tests/loading/resourceLoadStatistics/clear-in-memory-and-persistent-store.html:
* http/tests/loading/resourceLoadStatistics/grandfathering.html:
* http/tests/loading/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html:
* http/tests/loading/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html:
* http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html:
* http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html:
* http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html:
* http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html:
* http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction.html:
* http/tests/loading/resourceLoadStatistics/prevalent-resource-without-user-interaction.html:
* http/tests/loading/resourceLoadStatistics/telemetry-generation.html:

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

2 years agoDrop NOSNIFF compile flag
utatane.tea@gmail.com [Sat, 8 Jul 2017 15:58:16 +0000 (15:58 +0000)]
Drop NOSNIFF compile flag
https://bugs.webkit.org/show_bug.cgi?id=174289

Reviewed by Michael Catanzaro.

.:

* Source/cmake/WebKitFeatures.cmake:

Source/JavaScriptCore:

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

* Configurations/FeatureDefines.xcconfig:
* css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::parseAuthorStyleSheet):
(WebCore::StyleSheetContents::notifyLoadedSheet):
* dom/LoadableClassicScript.cpp:
(WebCore::LoadableClassicScript::notifyFinished):
* loader/cache/CachedCSSStyleSheet.cpp:
(WebCore::CachedCSSStyleSheet::mimeTypeAllowedByNosniff):
(WebCore::CachedCSSStyleSheet::canUseSheet):
* loader/cache/CachedCSSStyleSheet.h:
* platform/network/HTTPParsers.cpp:
(WebCore::parseContentTypeOptionsHeader):
* platform/network/HTTPParsers.h:
* platform/network/ResourceResponseBase.cpp:
(WebCore::isScriptAllowedByNosniff):
* platform/network/ResourceResponseBase.h:
* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::didReceiveResponse):

Source/WebCore/PAL:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit/mac:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit2:

* Configurations/FeatureDefines.xcconfig:

Tools:

* Scripts/webkitperl/FeatureList.pm:
* TestWebKitAPI/Configurations/FeatureDefines.xcconfig:

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

2 years ago[WK2] Use a rolling 30-day uptime for processing statistics
cdumez@apple.com [Sat, 8 Jul 2017 05:09:55 +0000 (05:09 +0000)]
[WK2] Use a rolling 30-day uptime for processing statistics
https://bugs.webkit.org/show_bug.cgi?id=174235
<rdar://problem/33164381>

Reviewed by Brent Fulgham.

Follow-up fix for r219274 because it caused this test to time out:
http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html

The test sets TimeToLiveUserInteraction to 0 so our implementation cannot use
0 as magic value to see if it was set. Instead, use std::optional.

* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _resourceLoadStatisticsResetToConsistentState]):
* UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
(WebKit::ResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
(WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired):
* UIProcess/Storage/ResourceLoadStatisticsStore.h:
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
* UIProcess/WebResourceLoadStatisticsStore.h:

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

2 years ago[WK2] Use a rolling 30-day uptime for processing statistics
bfulgham@apple.com [Sat, 8 Jul 2017 00:07:13 +0000 (00:07 +0000)]
[WK2] Use a rolling 30-day uptime for processing statistics
https://bugs.webkit.org/show_bug.cgi?id=174235
<rdar://problem/33164381>

Reviewed by Chris Dumez.

Source/WebCore:

Add a KeyedDecoder specialization for Deque.

* platform/KeyedCoding.h:
(WebCore::KeyedDecoder::decodeObjects):

Source/WebKit2:

* UIProcess/API/Cocoa/WKWebsiteDataStore.cpp:
(WebKit::WKWebsiteDataStore::_resourceLoadStatisticsResetToConsistentState): Initialize time-to-live to zero by default.
* UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
(WebKit::ResourceLoadStatisticsStore::createEncoderFromData): Write out vector
of operating dates.
(WebKit::ResourceLoadStatisticsStore::readDataFromDecoder): Read in vector of
operating dates.
(WebKit::ResourceLoadStatisticsStore::hasHadRecentUserInteraction): Check new
convenience method.
(WebKit::ResourceLoadStatisticsStore::markTodayAsOperatingDate): Added.
(WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired): Added.
* UIProcess/Storage/ResourceLoadStatisticsStore.h:
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded): When reading
a new data file, update the current operating date (if needed).
(WebKit::WebResourceLoadStatisticsStore::handleDailyTasks): Roll uptime dates as
needed, then handle telemetry.
* UIProcess/WebResourceLoadStatisticsStore.h:

Source/WTF:

Modify Deque to allow it to be used in a template specialization in KeyedDecoder.

* wtf/Deque.h:

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

2 years agoLower the max_protection for the separated heap
commit-queue@webkit.org [Sat, 8 Jul 2017 00:03:27 +0000 (00:03 +0000)]
Lower the max_protection for the separated heap
https://bugs.webkit.org/show_bug.cgi?id=174281

Patch by AJ Ringer <aringer@apple.com> on 2017-07-07
Reviewed by Oliver Hunt.

Switch to vm_protect so we can set maximum page protection.

* jit/ExecutableAllocator.cpp:
(JSC::FixedVMPoolExecutableAllocator::initializeSeparatedWXHeaps):
(JSC::ExecutableAllocator::allocate):

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

2 years ago[AppCache] Ignore fallback entries whose namespace is not prefixed with manifest...
dbates@webkit.org [Fri, 7 Jul 2017 22:02:46 +0000 (22:02 +0000)]
[AppCache] Ignore fallback entries whose namespace is not prefixed with manifest path
https://bugs.webkit.org/show_bug.cgi?id=174273
<rdar://problem/33011682>

Reviewed by Brent Fulgham.

Source/WebCore:

As per <https://html.spec.whatwg.org/multipage/offline.html#parsing-cache-manifests> (07/06/2017)
we should ignore fallback entires whose fallback namespace URL is not prefixed with
the manifest path. For now we only apply this policy when the manifest is served with
a non-standard Content-Type to minimize web compatibility risk.

Test: http/tests/appcache/fallback-namespace-outside-manifest-path.html

* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::didFinishLoadingManifest): Pass the MIME type of the manifest.
* loader/appcache/ManifestParser.cpp:
(WebCore::manifestPath): Computes the manifest path from a manifest URL.
(WebCore::parseManifest): Modified to take the MIME type of the manifest. If the MIME type is
non-standard (i.e. not text/cached-manifest) then skip fallback entries whose namespace is not
prefixed with the manifest path. Otherwise, process fallback entries as we do now. Also cleaned
up the code a bit while I was here, including renaming a local variable to be more descriptive
and using a const character array for the manifest signature to avoid the need to document the
length of the manifest signature in a comment.
* loader/appcache/ManifestParser.h:

LayoutTests:

* http/tests/appcache/fallback-namespace-outside-manifest-path-expected.txt: Added.
* http/tests/appcache/fallback-namespace-outside-manifest-path.html: Added.
* http/tests/appcache/resources/fallback-namespace-outside-manifest-path.txt: Added.

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

2 years ago[iOS DnD] For cross-app drags, 'drop' event handlers are never invoked if dataTransfe...
wenson_hsieh@apple.com [Fri, 7 Jul 2017 21:59:25 +0000 (21:59 +0000)]
[iOS DnD] For cross-app drags, 'drop' event handlers are never invoked if dataTransfer.dropEffect is not set while dragging
https://bugs.webkit.org/show_bug.cgi?id=174219
<rdar://problem/32083177>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Currently, in DragController.cpp, defaultOperationForDrag maps a drag source operation mask of
DragOperationGeneric to DragOperationMove across all platforms. However, on iOS, where cross-app drag moves do
not trigger a drop, this means drop handlers won't fire unless the dropEffect is explicitly set to copy.

To fix this, we introduce DragController::platformGenericDragOperation(), which returns DragOperationCopy on iOS
and DragOperationMove (the existing behavior) elsewhere. defaultOperationForDrag then maps a drag source
operation mask of DragOperationGeneric to platformGenericDragOperation().

Tests:  DataInteractionTests.ExternalSourceHTMLToUploadArea
        DataInteractionTests.ExternalSourceImageAndHTMLToUploadArea
        DataInteractionTests.ExternalSourceMoveOperationNotAllowed

* page/DragController.cpp:
(WebCore::DragController::platformGenericDragOperation):
(WebCore::defaultOperationForDrag):
* page/DragController.h:
* page/mac/DragControllerMac.mm:
(WebCore::DragController::platformGenericDragOperation):

Source/WebKit2:

Tweak some testing SPI to return a drop operation flag instead of whether or not the drop operation was not
UIDropOperationCancel.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _simulateDataInteractionUpdated:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _simulateDataInteractionUpdated:]):

Tools:

Add plumbing and support to mock the value of -allowsMoveOperation on the simulated UIDragDropSession objects.
Setting the DataInteractionSimulator's shouldAllowMoveOperation property to NO simulates a drag operation coming
in from another app out-of-process, for which move operations won't cause a drop to be performed in the first
place.

Also tweaks 2 existing unit tests regarding file uploads via JavaScript to simulate items coming in from a
different application, and adds a new test to check that if a drop area specifically requests a MOVE operation,
no action is taken when dropping.

* TestWebKitAPI/Tests/WebKit2Cocoa/file-uploading.html:
* TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/ios/DataInteractionSimulator.h:
* TestWebKitAPI/ios/DataInteractionSimulator.mm:
(-[MockDragDropSession initWithItems:location:window:allowMove:]):
(-[MockDragDropSession allowsMoveOperation]):
(-[MockDataOperationSession initWithProviders:location:window:allowMove:]):
(-[MockDataInteractionSession initWithWindow:allowMove:]):
(-[DataInteractionSimulator initWithWebView:]):
(-[DataInteractionSimulator runFrom:to:]):
(-[DataInteractionSimulator _advanceProgress]):
(-[MockDragDropSession initWithItems:location:window:]): Deleted.
(-[MockDataOperationSession initWithProviders:location:window:]): Deleted.
(-[MockDataInteractionSession initWithWindow:]): Deleted.

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

2 years agoWeb Inspector: Resources are sometimes missing from the tree outline right before...
drousso@apple.com [Fri, 7 Jul 2017 21:44:18 +0000 (21:44 +0000)]
Web Inspector: Resources are sometimes missing from the tree outline right before folderizing
https://bugs.webkit.org/show_bug.cgi?id=174277

Reviewed by Joseph Pecoraro.

* UserInterface/Views/TreeElement.js:
(WebInspector.TreeElement.prototype.expand):

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

2 years agoWeb Inspector: REGRESSION(r217258): WebSocket resource tree elements don't show the...
drousso@apple.com [Fri, 7 Jul 2017 21:33:26 +0000 (21:33 +0000)]
Web Inspector: REGRESSION(r217258): WebSocket resource tree elements don't show the connection status
https://bugs.webkit.org/show_bug.cgi?id=174274

Reviewed by Brian Burg.

* UserInterface/Views/FrameTreeElement.js:
(WebInspector.FrameTreeElement):
* UserInterface/Views/ResourceTreeElement.js:
(WebInspector.ResourceTreeElement.prototype.populateContextMenu):
* UserInterface/Views/WebSocketResourceTreeElement.js:
(WebInspector.WebSocketResourceTreeElement.prototype.populateContextMenu):
Move "Log WebSocket" context menu item to WebSocketResourceTreeElement.

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

2 years agoWeb Inspector: Show all elements currently using a given CSS Canvas
drousso@apple.com [Fri, 7 Jul 2017 21:30:47 +0000 (21:30 +0000)]
Web Inspector: Show all elements currently using a given CSS Canvas
https://bugs.webkit.org/show_bug.cgi?id=173965

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

* inspector/protocol/Canvas.json:
 - Add `requestCSSCanvasClientNodes` command for getting the node IDs all nodes using this
   canvas via -webkit-canvas.
 - Add `cssCanvasClientNodesChanged` event that is dispatched whenever a node is
   added/removed from the list of -webkit-canvas clients.

Source/WebCore:

Test: inspector/canvas/css-canvas-clients.html

* css/CSSImageGeneratorValue.cpp:
(WebCore::CSSImageGeneratorValue::addClient):
(WebCore::CSSImageGeneratorValue::removeClient):
* css/CSSImageGeneratorValue.h:
(WebCore::CSSImageGeneratorValue::clients):
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::addObserver):
(WebCore::HTMLCanvasElement::removeObserver):
(WebCore::HTMLCanvasElement::cssCanvasClients):
Each time an observer is added/removed for a given HTMLCanvasElement, send an event to the
inspector frontend that the CSS canvas client nodes have changed. Additionally, anytime a
client/use is added/removed from one of the observing CSSCanvasValue, fire the same event.

* css/CSSCanvasValue.h:
(isType):
* html/HTMLCanvasElement.h:
(WebCore::CanvasObserver::isCSSCanvasValueObserver):
Allows type traits to distinguish CanvasObserver from CSSCanvasValue::CanvasObserverProxy.

* inspector/InspectorCanvasAgent.h:
* inspector/InspectorCanvasAgent.cpp:
(WebCore::InspectorCanvasAgent::requestCSSCanvasClientNodes):
(WebCore::InspectorCanvasAgent::didChangeCSSCanvasClientNodes):
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodes):
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodesImpl):
Notify the frontend that the list of client nodes has changed for the given canvas. Let the
frontend request the actual list of node IDs when it needs, possibly at a later time.

Source/WebInspectorUI:

* UserInterface/Controllers/CanvasManager.js:
(WebInspector.CanvasManager.prototype.cssCanvasClientNodesChanged):
* UserInterface/Models/Canvas.js:
(WebInspector.Canvas.prototype.requestCSSCanvasClientNodes):
(WebInspector.Canvas.prototype.cssCanvasClientNodesChanged):
* UserInterface/Protocol/CanvasObserver.js:
(WebInspector.CanvasObserver.prototype.cssCanvasClientNodesChanged):

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Views/CanvasDetailsSidebarPanel.js:
(WebInspector.CanvasDetailsSidebarPanel):
(WebInspector.CanvasDetailsSidebarPanel.prototype.set canvas):
(WebInspector.CanvasDetailsSidebarPanel.prototype.initialLayout):
(WebInspector.CanvasDetailsSidebarPanel.prototype.layout):
(WebInspector.CanvasDetailsSidebarPanel.prototype._refreshCSSCanvasSection):
(WebInspector.CanvasDetailsSidebarPanel.prototype._formatMemoryRow):
Add CSS section for CSS canvases. Currently displays a list of node links, each of which is
using the selected canvas via -webkit-canvas.

* UserInterface/Main.html:
* UserInterface/Views/CanvasDetailsSidebarPanel.css: Added.
(.sidebar > .panel.details.canvas .details-section > .content .row.simple > .value > .node-link):

* UserInterface/Controllers/DOMTreeManager.js:
(WebInspector.DOMTreeManager.prototype.ensureDocument):
* UserInterface/Models/Canvas.js:
(WebInspector.Canvas.prototype.requestNode):
* UserInterface/Views/SearchSidebarPanel.js:
(WebInspector.SearchSidebarPanel.prototype.performSearch):
Add convenience function that will call DOMAgent.getDocument with an empty function. Should
be used when it is necessary that the document has been sent to the frontend, but the
document node itself is not needed.

LayoutTests:

* inspector/canvas/css-canvas-clients-expected.txt: Added.
* inspector/canvas/css-canvas-clients.html: Added.
* platform/mac/TestExpectations:

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

2 years agoAdjusted test expectations for webrtc/video-replace-muted-track.html.
jlewis3@apple.com [Fri, 7 Jul 2017 20:38:33 +0000 (20:38 +0000)]
Adjusted test expectations for webrtc/video-replace-muted-track.html.
https://bugs.webkit.org/show_bug.cgi?id=173608

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations:

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

2 years agoAVPlayer can continue to be active after released by MediaPlayerPrivateAVFoundationObjC.
jer.noble@apple.com [Fri, 7 Jul 2017 20:24:35 +0000 (20:24 +0000)]
AVPlayer can continue to be active after released by MediaPlayerPrivateAVFoundationObjC.
https://bugs.webkit.org/show_bug.cgi?id=174264

Reviewed by Eric Carlson.

If the AVPlayer is retained (by an autorelease pool, or internally by other objects in
AVFoundation), releasing the AVPlayer is not enough to cancel loading or playback. So before
releasing the AVPlayer, make sure to disassociate the current AVPlayerItem, which should
cancel all activity in the AVPlayer.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::cancelLoad):

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

2 years ago[Curl] Remove data url handler for async load
commit-queue@webkit.org [Fri, 7 Jul 2017 20:20:24 +0000 (20:20 +0000)]
[Curl] Remove data url handler for async load
https://bugs.webkit.org/show_bug.cgi?id=174263

data url is handled by ResourceLoader. No need for specific handling
in platform dependent layer.

Patch by Basuke Suzuki <Basuke.Suzuki@sony.com> on 2017-07-07
Reviewed by Alex Christensen.

* platform/network/curl/ResourceHandleManager.cpp:
(WebCore::ResourceHandleManager::startJob):

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

2 years agoUnreviewed, rolling out r219257.
jlewis3@apple.com [Fri, 7 Jul 2017 20:05:27 +0000 (20:05 +0000)]
Unreviewed, rolling out r219257.

The test added in the revision was still extreamly flaky on
all testers.

Reverted changeset:

"[SVG] Leak in SVGAnimatedListPropertyTearOff"
https://bugs.webkit.org/show_bug.cgi?id=172545
http://trac.webkit.org/changeset/219257

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

2 years ago\n\r is not the same as \r\n.
mark.lam@apple.com [Fri, 7 Jul 2017 19:50:00 +0000 (19:50 +0000)]
\n\r is not the same as \r\n.
https://bugs.webkit.org/show_bug.cgi?id=173053

Reviewed by Keith Miller.

JSTests:

* stress/regress-173053.js: Added.
* stress/template-literal-line-terminators.js:

Source/JavaScriptCore:

* parser/Lexer.cpp:
(JSC::Lexer<T>::shiftLineTerminator):
(JSC::LineNumberAdder::add):

LayoutTests:

* js/parse-backslash-before-newline-expected.txt:
* js/script-tests/parse-backslash-before-newline.js:

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

2 years agoUnreviewed, rolling out r219256.
jlewis3@apple.com [Fri, 7 Jul 2017 19:36:08 +0000 (19:36 +0000)]
Unreviewed, rolling out r219256.

Previous change to Test Expectations broke the tests

Reverted changeset:

"[WPE] Unreviewed gardening"
http://trac.webkit.org/changeset/219256

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

2 years agoUnreviewed, rolling out r219258.
jlewis3@apple.com [Fri, 7 Jul 2017 19:35:38 +0000 (19:35 +0000)]
Unreviewed, rolling out r219258.

Previous change to Test Expectations broke the tests

Reverted changeset:

"Unreviewed gardening, fix WK2 expectations after my previous
commit"
http://trac.webkit.org/changeset/219258

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

2 years agoUnreviewed, rolling out r219238, r219239, and r219241.
commit-queue@webkit.org [Fri, 7 Jul 2017 18:30:09 +0000 (18:30 +0000)]
Unreviewed, rolling out r219238, r219239, and r219241.
https://bugs.webkit.org/show_bug.cgi?id=174265

"fast/workers/dedicated-worker-lifecycle.html is flaky"
(Requested by yusukesuzuki on #webkit).

Reverted changesets:

"[WTF] Implement WTF::ThreadGroup"
https://bugs.webkit.org/show_bug.cgi?id=174081
http://trac.webkit.org/changeset/219238

"Unreviewed, build fix after r219238"
https://bugs.webkit.org/show_bug.cgi?id=174081
http://trac.webkit.org/changeset/219239

"Unreviewed, CLoop build fix after r219238"
https://bugs.webkit.org/show_bug.cgi?id=174081
http://trac.webkit.org/changeset/219241

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

2 years agoWeb Inspector: Clean up some unnecessary constructors
commit-queue@webkit.org [Fri, 7 Jul 2017 17:20:31 +0000 (17:20 +0000)]
Web Inspector: Clean up some unnecessary constructors
https://bugs.webkit.org/show_bug.cgi?id=174236

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-07-07
Reviewed by Brian Burg.

* UserInterface/Controllers/CodeMirrorBezierEditingController.js:
* UserInterface/Controllers/CodeMirrorColorEditingController.js:
* UserInterface/Controllers/CodeMirrorGradientEditingController.js:
* UserInterface/Views/DividerNavigationItem.js:
* UserInterface/Views/FlexibleSpaceNavigationItem.js:
* UserInterface/Views/IdleTreeElement.js:

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

2 years agoUnreviewed gardening, fix WK2 expectations after my previous commit
mcatanzaro@igalia.com [Fri, 7 Jul 2017 16:43:34 +0000 (16:43 +0000)]
Unreviewed gardening, fix WK2 expectations after my previous commit

* platform/wk2/TestExpectations:

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

2 years ago[SVG] Leak in SVGAnimatedListPropertyTearOff
svillar@igalia.com [Fri, 7 Jul 2017 16:42:32 +0000 (16:42 +0000)]
[SVG] Leak in SVGAnimatedListPropertyTearOff
https://bugs.webkit.org/show_bug.cgi?id=172545

Reviewed by Said Abou-Hallawa.

SVGAnimatedListPropertyTearOff maintains a vector m_wrappers with references to
SVGPropertyTraits<PropertyType>::ListItemTearOff. Apart from that SVGPropertyTearOff has a
reference to SVGAnimatedProperty.

When SVGListProperty::getItemValuesAndWrappers() is called, it creates a
SVGPropertyTraits<PropertyType>::ListItemTearOff pointing to the same SVGAnimatedProperty (a
SVGAnimatedListPropertyTearOff) which stores the m_wrappers vector where the ListItemTearOff
is going to be added to. This effectively creates a reference cycle between the
SVGAnimatedListPropertyTearOff and all the ListItemTearOff it stores in m_wrappers.

We should detach those wrappers in propertyWillBeDeleted() in order to break the cycle.

* svg/properties/SVGAnimatedListPropertyTearOff.h:

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

2 years ago[WPE] Unreviewed gardening
mcatanzaro@igalia.com [Fri, 7 Jul 2017 15:41:40 +0000 (15:41 +0000)]
[WPE] Unreviewed gardening

* platform/wk2/TestExpectations: Do not mark individual resourceLoadStatistics tests as
passing. Instead, mark the entire directory, so we don't have to override the expectations
for every single test individually in the WPE expectations file.
* platform/wpe/TestExpectations: Update resourceLoadStatistics expectations.

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

2 years ago[GTK][WPE] Enable X-Content-Type-Options: nosniff
utatane.tea@gmail.com [Fri, 7 Jul 2017 12:45:18 +0000 (12:45 +0000)]
[GTK][WPE] Enable X-Content-Type-Options: nosniff
https://bugs.webkit.org/show_bug.cgi?id=174250

Reviewed by Carlos Alberto Lopez Perez.

.:

Make nosniff enabled by default in all the ports.

* Source/cmake/OptionsMac.cmake:
* Source/cmake/OptionsWin.cmake:
* Source/cmake/WebKitFeatures.cmake:

Tools:

* Scripts/webkitperl/FeatureList.pm:

LayoutTests:

* platform/gtk/TestExpectations:
* platform/gtk/imported/w3c/web-platform-tests/fetch/nosniff/stylesheet-expected.txt: Removed.

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

2 years ago[WPE] New baseline after r218740
csaavedra@igalia.com [Fri, 7 Jul 2017 11:48:25 +0000 (11:48 +0000)]
[WPE] New baseline after r218740

Unreviewed gardening.
* platform/wpe/js/dom/global-constructors-attributes-expected.txt:

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

2 years ago[WPE] Unreviewed gardening
csaavedra@igalia.com [Fri, 7 Jul 2017 10:44:02 +0000 (10:44 +0000)]
[WPE] Unreviewed gardening

resourceLoadingStatistics tests are timing out and failing.
* platform/wpe/TestExpectations:

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

2 years ago[GStreamer] vid.me videos do not play
commit-queue@webkit.org [Fri, 7 Jul 2017 10:32:36 +0000 (10:32 +0000)]
[GStreamer] vid.me videos do not play
https://bugs.webkit.org/show_bug.cgi?id=172240

Patch by Charlie Turner <cturner@igalia.com> on 2017-07-07
Reviewed by Xabier Rodriguez-Calvar.

Source/WebCore:

In r142251, code to hide the WK HTTP source elements from elsewhere in
the pipeline was removed. This has the nasty side-effect of
auto-plugging the WK HTTP source into things it really should not be
used in, especially the adaptive streaming demuxers. The reasons this
is bad are documented in several places on Bugzilla, see the parent
bug report for more details. The high-level issue is that the WK HTTP
source and its use of WebCore is not thread-safe. Although work has
been recently done to improve this situation, it's still not perfect.

Another issue is the interface hlsdemux expects its HTTP source to
implement, specifically seeking in READY.

This does rely on HTTP context sharing being available in GStreamer,
upstream bug is here:
https://bugzilla.gnome.org/show_bug.cgi?id=761099. The failing case
can be demonstrated with
https://github.com/thiagoss/adaptive-test-server but manual testing on
popular video hosting sites, including vid.me, shows that this doesn't
bite us at the moment, just something else to fix in the future.

There are some QoS issues with the adaptive streaming code in
GStreamer, but it seems much better to offer a below par QoS in lieu
of crashing/livelocking when playing certain streams, and issues can be
raised upstream when they arise.

This patch does take us further away from the future goal of having all
networking operations go through the network process, but in return it
solves some nasty crashes and livelocks that have been irritating
users for some time. With the pressure off on this issue, work can be
planned to consider how to make the WK HTTP source a better citizen
inside the GStreamer pipeline when we migrate the netcode to go
through the network process.

A new test is added to check that the single file HLS playlists
(new in version 4) can be played, which was the primary cause of
this bug report.

Test: http/tests/media/hls/range-request.html

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::setPlaybinURL): Perform
some trickery to make sure that we only ever fetch URLs handed to
us by WebCore. Any further URLs discovered inside the pipeline
will not get WKWS auto-plugged, since they'll be plain https?
schemas.
(WebCore::MediaPlayerPrivateGStreamer::load): Refactor to use the
setPlaybinURL helper method.
(WebCore::MediaPlayerPrivateGStreamer::loadNextLocation): Ditto.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Add
the setPlaybinURL helper method.
* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(webKitWebSrcGetProtocols): Only advertise webkit+https?, this
ensures we won't get auto-plugged by pipeline elements asking for
an element to fetch https? resources (like adaptive demuxers).
(convertPlaybinURI): Undo the trick when another element asks us
for our URI.

Tools:

Build httpsoupsrc again for use in adaptive streaming pipelines, and
have the existing libsoup build against GNOME to avoid header drift
against GStreamer's linked Soup library.

* gtk/jhbuild.modules:

LayoutTests:

Add a test for single output file HLS playlists that require HTTP
range requests to playback. This failed using the WK http source
for reasons documented in the linked bug.

Generated with mp4hls --segment-duration 3 --output-single-file

* Http/tests/media/hls/range-request-expected.txt: Added.
* http/tests/media/hls/range-request.html: Added.
* http/tests/media/resources/hls/range-request-playlist.m3u8: Added.
* http/tests/media/resources/hls/range-request-playlists/iframes.m3u8: Added.
* http/tests/media/resources/hls/range-request-playlists/media.ts: Added.
* http/tests/media/resources/hls/range-request-playlists/stream.m3u8: Added.

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

2 years agoSpeedometer 2.0: Fix vanilla JS example
commit-queue@webkit.org [Fri, 7 Jul 2017 10:25:00 +0000 (10:25 +0000)]
Speedometer 2.0: Fix vanilla JS example
https://bugs.webkit.org/show_bug.cgi?id=174246

Patch by Mathias Bynens <mathias@qiwi.be> on 2017-07-07
Reviewed by Ryosuke Niwa.

Previously, all TODO items were assigned an ID of `null`. This patch
fixes that bug. Manually deleting items now works again.

* Speedometer/resources/todomvc/vanilla-examples/vanillajs/index.html: Made title consistent.
* Speedometer/resources/todomvc/vanilla-examples/vanillajs/js/store.js: Fixed bug with deleting items.
* Speedometer/resources/todomvc/vanilla-examples/vanillajs/readme.md: Added docs.

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

2 years agoUnreviewed, Windows build fix after r219233 part 4
utatane.tea@gmail.com [Fri, 7 Jul 2017 08:30:08 +0000 (08:30 +0000)]
Unreviewed, Windows build fix after r219233 part 4
https://bugs.webkit.org/show_bug.cgi?id=174231

* wtf/Assertions.h:

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

2 years agoWKWebSiteDataStore.removeDataOfTypes should wait until disk cache files are actually...
antti@apple.com [Fri, 7 Jul 2017 07:22:12 +0000 (07:22 +0000)]
WKWebSiteDataStore.removeDataOfTypes should wait until disk cache files are actually removed before invoking completion handler
https://bugs.webkit.org/show_bug.cgi?id=174224
<rdar://problem/33067545>

Reviewed by Sam Weinig.

Currently we dispatch file deletion operations to a background queue and call the completion
handler without waiting for the I/O to complete.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::clearDiskCacheEntries):

    Call a new version of NetworkCache::remove() for bulk deletion.
    Note that it is fine to call this with an empty vector.

* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::Cache::remove):

    Bulk deletion with a completion handler.

(WebKit::NetworkCache::Cache::deleteFiles): Added.

    Factor to a helper function.

* NetworkProcess/cache/NetworkCache.h:
* NetworkProcess/cache/NetworkCacheStorage.cpp:
(WebKit::NetworkCache::Storage::remove):

    Remove files for all the provided keys in a queue and invoke the completion handler in the main thread when done.

* NetworkProcess/cache/NetworkCacheStorage.h:

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

2 years agoUnreviewed, Windows build fix after r219233 part 3
utatane.tea@gmail.com [Fri, 7 Jul 2017 06:08:02 +0000 (06:08 +0000)]
Unreviewed, Windows build fix after r219233 part 3
https://bugs.webkit.org/show_bug.cgi?id=174231

* wtf/Assertions.h:
(compilerFenceForCrash):

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

2 years agoUnreviewed, Windows build fix after r219233 part 2
utatane.tea@gmail.com [Fri, 7 Jul 2017 06:04:02 +0000 (06:04 +0000)]
Unreviewed, Windows build fix after r219233 part 2
https://bugs.webkit.org/show_bug.cgi?id=174231

* wtf/Assertions.h:

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

2 years agoWrite a support script to enable buildbot to upload to S3
lforschler@apple.com [Fri, 7 Jul 2017 05:57:34 +0000 (05:57 +0000)]
Write a support script to enable buildbot to upload to S3
https://bugs.webkit.org/show_bug.cgi?id=174196

Reviewed by Stephanie Lewis.

* BuildSlaveSupport/build.webkit.org-config/transfer-archive-to-s3: Added.
(uploadToS3):
(archiveExists):

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

2 years agoUnreviewed GTK and WPE test gardening
mcatanzaro@igalia.com [Fri, 7 Jul 2017 05:53:39 +0000 (05:53 +0000)]
Unreviewed GTK and WPE test gardening

* platform/gtk/TestExpectations:
* platform/gtk/imported/w3c/web-platform-tests/WebCryptoAPI/derive_bits_keys/hkdf.worker-expected.txt:
* platform/gtk/imported/w3c/web-platform-tests/WebCryptoAPI/derive_bits_keys/test_hkdf.https-expected.txt:
* platform/wpe/TestExpectations:
* platform/wpe/imported/w3c/web-platform-tests/WebCryptoAPI/derive_bits_keys/hkdf.worker-expected.txt:
* platform/wpe/imported/w3c/web-platform-tests/WebCryptoAPI/derive_bits_keys/test_hkdf.https-expected.txt:

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

2 years agoUnreviewed, Windows build fix after r219233
utatane.tea@gmail.com [Fri, 7 Jul 2017 05:33:40 +0000 (05:33 +0000)]
Unreviewed, Windows build fix after r219233
https://bugs.webkit.org/show_bug.cgi?id=174231

* wtf/Compiler.h:

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

2 years agoFollow-up to "REGRESSION(r209495): materiauxlaverdure.com fails to load"
mcatanzaro@igalia.com [Fri, 7 Jul 2017 05:22:36 +0000 (05:22 +0000)]
Follow-up to "REGRESSION(r209495): materiauxlaverdure.com fails to load"
https://bugs.webkit.org/show_bug.cgi?id=173301
<rdar://problem/32624850>

Unreviewed gardening. Attempt to fix this test by updating it to expect double quotes. It
was missed because it is marked as flaky on Mac, so no way to automatically detect the
failure there.

This doesn't actually fix the test for me due to some floating point issues, but it's a step
in the right direction, and I speculate this will fix the test on the GTK and WPE bots.

* transitions/clip-path-path-transitions.html:

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

2 years agoFix bad usage of static variables in ResourceLoadStatisticsStore
cdumez@apple.com [Fri, 7 Jul 2017 05:19:14 +0000 (05:19 +0000)]
Fix bad usage of static variables in ResourceLoadStatisticsStore
https://bugs.webkit.org/show_bug.cgi?id=174237

Reviewed by Brent Fulgham.

Fix bad usage of static variables in ResourceLoadStatisticsStore. Those can be set via
member functions on ResourceLoadStatisticsStore so they should be data members. The
API to set them is associated to a particular store and there can in theory be several
stores.

* UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
(WebKit::ResourceLoadStatisticsStore::shouldPartitionCookies):
(WebKit::ResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
(WebKit::ResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree):
(WebKit::ResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
(WebKit::ResourceLoadStatisticsStore::setGrandfatheringTime):
(WebKit::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
(WebKit::ResourceLoadStatisticsStore::handleFreshStartWithEmptyOrNoStore):
(WebKit::ResourceLoadStatisticsStore::shouldRemoveDataRecords):
(WebKit::shouldPartitionCookies): Deleted.
* UIProcess/Storage/ResourceLoadStatisticsStore.h:

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

2 years agoUnreviewed, CLoop build fix after r219238
utatane.tea@gmail.com [Fri, 7 Jul 2017 05:18:57 +0000 (05:18 +0000)]
Unreviewed, CLoop build fix after r219238
https://bugs.webkit.org/show_bug.cgi?id=174081

* heap/MachineStackMarker.cpp:

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

2 years agoEnabling uploading archives to S3.
lforschler@apple.com [Fri, 7 Jul 2017 05:10:38 +0000 (05:10 +0000)]
Enabling uploading archives to S3.
https://bugs.webkit.org/show_bug.cgi?id=174198

Reviewed by Stephanie Lewis.

* BuildSlaveSupport/build.webkit.org-config/master.cfg:
(ArchiveMinifiedBuiltProduct): Create a minified archive from a full archive
(UploadMinifiedBuiltProduct): Upload minified archive to build master
(TransferToS3): Transfer full and minified archives to S3

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

2 years agoUnreviewed, build fix after r219238
utatane.tea@gmail.com [Fri, 7 Jul 2017 05:08:22 +0000 (05:08 +0000)]
Unreviewed, build fix after r219238
https://bugs.webkit.org/show_bug.cgi?id=174081

* wtf/Threading.cpp:
(WTF::Thread::addToThreadGroup):

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

2 years ago[WTF] Implement WTF::ThreadGroup
utatane.tea@gmail.com [Fri, 7 Jul 2017 04:56:23 +0000 (04:56 +0000)]
[WTF] Implement WTF::ThreadGroup
https://bugs.webkit.org/show_bug.cgi?id=174081

Reviewed by Mark Lam.

Source/JavaScriptCore:

Large part of MachineThreads are now removed and replaced with WTF::ThreadGroup.
And SamplingProfiler and others interact with WTF::Thread directly.

* API/tests/ExecutionTimeLimitTest.cpp:
* heap/MachineStackMarker.cpp:
(JSC::MachineThreads::MachineThreads):
(JSC::captureStack):
(JSC::MachineThreads::tryCopyOtherThreadStack):
(JSC::MachineThreads::tryCopyOtherThreadStacks):
(JSC::MachineThreads::gatherConservativeRoots):
(JSC::ActiveMachineThreadsManager::Locker::Locker): Deleted.
(JSC::ActiveMachineThreadsManager::add): Deleted.
(JSC::ActiveMachineThreadsManager::remove): Deleted.
(JSC::ActiveMachineThreadsManager::contains): Deleted.
(JSC::ActiveMachineThreadsManager::ActiveMachineThreadsManager): Deleted.
(JSC::activeMachineThreadsManager): Deleted.
(JSC::MachineThreads::~MachineThreads): Deleted.
(JSC::MachineThreads::addCurrentThread): Deleted.
(): Deleted.
(JSC::MachineThreads::removeThread): Deleted.
(JSC::MachineThreads::removeThreadIfFound): Deleted.
(JSC::MachineThreads::MachineThread::MachineThread): Deleted.
(JSC::MachineThreads::MachineThread::getRegisters): Deleted.
(JSC::MachineThreads::MachineThread::Registers::stackPointer): Deleted.
(JSC::MachineThreads::MachineThread::Registers::framePointer): Deleted.
(JSC::MachineThreads::MachineThread::Registers::instructionPointer): Deleted.
(JSC::MachineThreads::MachineThread::Registers::llintPC): Deleted.
(JSC::MachineThreads::MachineThread::captureStack): Deleted.
* heap/MachineStackMarker.h:
(JSC::MachineThreads::addCurrentThread):
(JSC::MachineThreads::getLock):
(JSC::MachineThreads::threads):
(JSC::MachineThreads::MachineThread::suspend): Deleted.
(JSC::MachineThreads::MachineThread::resume): Deleted.
(JSC::MachineThreads::MachineThread::threadID): Deleted.
(JSC::MachineThreads::MachineThread::stackBase): Deleted.
(JSC::MachineThreads::MachineThread::stackEnd): Deleted.
(JSC::MachineThreads::threadsListHead): Deleted.
* runtime/SamplingProfiler.cpp:
(JSC::FrameWalker::isValidFramePointer):
(JSC::SamplingProfiler::SamplingProfiler):
(JSC::SamplingProfiler::takeSample):
(JSC::SamplingProfiler::noticeCurrentThreadAsJSCExecutionThread):
* runtime/SamplingProfiler.h:
* wasm/WasmMachineThreads.cpp:
(JSC::Wasm::resetInstructionCacheOnAllThreads):

Source/WebCore:

* page/ResourceUsageThread.h:

Source/WebKit2:

* Shared/AsyncRequest.h:
* UIProcess/Storage/ResourceLoadStatisticsStore.h:

Source/WTF:

This patch implements WTF::ThreadGroup. It implements core of JSC::MachineThreads with more reliable way.
JSC::MachineThreads was complicated because of managing dead threads. Each JSC::MachineThreads has its
own TLS with a registered destructor. And everytime a thread dies, the registered TLS destructor is called.
And this destructor will remove the current dying thread from JSC::MachineThreads.

However the above implementation is tricky. And each JSC::MachineThreads requires own TLS space, which is
not considered in WTF's Windows ThreadSpecific implementation. Current design works well since we only
have small number of MachineThreads right now.

Instead, we use more reliable way. After introducing WTF::Thread, WTF::Thread has WTF::Thread::didExit,
which is called when associated TLS (with WTF::Thread) is destroyed. We leverage this mechanism to remove
WTF::Thread from MachineThreads.

This patch introduces WTF::ThreadGroup. It is tightly integrated with WTF::Thread: WTF::Thread knows
ThreadGroups which includes this thread. And WTF::ThreadGroup of course knows WTF::Threads added to it.
WTF::Thread::didExit carefully remove itself from WTF::ThreadGroups.

The most important part of this patch is locking. WTF::Thread can die. And WTF::ThreadGroup can die.
If we take a design using two fine grain locks in WTF::Thread and WTF::ThreadGroup, we easily encounter
dead lock. Consider the following case.

1. When adding WTF::Thread (TH) to WTF::ThreadGroup (THG), we first hold a lock of THG, and hold a lock of TH (locking order is THG -> TH).
2. When TH dies, TH need to hold a lock of TH to iterate THGs. And we hold a lock of THG to unregister TH from it (locking order is TH -> THG).
3. When suspending and resuming THs in THG, we first hold a lock of THG. And then, we hold a lock of TH to suspend and resume it (locking order is THG -> TH).
4. When destroying THG, we need to hold a lock of TH to unregister THG from TH. We can hold a lock of THG before that (locking order is THG -> TH).

Then, it easily causes dead lock. We cannot swap the locking order of (2) since iterating THG requires a lock of TH.
To solve this problem, we introduce one global lock ThreadGroup::destructionMutex (GL).

1. When adding WTF::Thread (TH) to WTF::ThreadGroup (THG), we first hold GL, and hold a lock of THG. Do not hold a
lock of TH. TH's thread groups information is guarded by GL instead of a lock of TH (locking order is GL -> THG).
2. When TH dies, TH need to hold GL to iterate THGs. And we hold a lock of THG to unregister TH from it (locking order is GL -> THG).
3. When suspending and resuming THs in THG, we first hold a lock of THG. And then, we hold a lock of TH to suspend and resume it (locking order is THG -> TH).
4. When destroying THG, we need to hold GL to unregister THG from TH. We can hold a lock of THG after that (locking order is GL -> THG).

We still have a lock of THG. By separating GL and THG's lock, we can hold a lock of THG while completely unrelated TH is destructed which takes a lock of GL and unrelated THG.

* WTF.xcodeproj/project.pbxproj:
* wtf/AutomaticThread.cpp:
* wtf/CMakeLists.txt:
* wtf/CrossThreadCopier.h:
* wtf/ParkingLot.h:
* wtf/ThreadGroup.cpp: Copied from Source/JavaScriptCore/wasm/WasmMachineThreads.cpp.
(WTF::ThreadGroup::destructionMutex):
(WTF::ThreadGroup::~ThreadGroup):
(WTF::ThreadGroup::add):
(WTF::ThreadGroup::addCurrentThread):
(WTF::ThreadGroup::removeCurrentThread):
* wtf/ThreadGroup.h: Copied from Source/JavaScriptCore/wasm/WasmMachineThreads.cpp.
(WTF::ThreadGroup::create):
(WTF::ThreadGroup::threads):
(WTF::ThreadGroup::getLock):
* wtf/Threading.cpp:
(WTF::Thread::didExit):
(WTF::Thread::addToThreadGroup):
(WTF::Thread::removeFromThreadGroup):
* wtf/Threading.h:
(WTF::Thread::canAddToThreadGroup):

Tools:

Add WTF::ThreadGroup tests.

* TestWebKitAPI/CMakeLists.txt:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/ThreadGroup.cpp: Added.
(TestWebKitAPI::TEST):

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

2 years ago[WTF] Clean up StringStatics.cpp by using LazyNeverDestroyed<> for Atoms
utatane.tea@gmail.com [Fri, 7 Jul 2017 04:42:04 +0000 (04:42 +0000)]
[WTF] Clean up StringStatics.cpp by using LazyNeverDestroyed<> for Atoms
https://bugs.webkit.org/show_bug.cgi?id=174150

Reviewed by Mark Lam.

Source/WebCore:

* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::captionDisplayMode):
* Modules/mediastream/RTCDataChannel.cpp:
(WebCore::RTCDataChannel::binaryType):
* accessibility/AXObjectCache.cpp:
(WebCore::createFromRenderer):
* accessibility/AccessibilityMediaControls.cpp:
(WebCore::AccessibilityMediaControl::controlTypeName):
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::language):
(WebCore::AccessibilityObject::defaultLiveRegionStatusForRole):
(WebCore::AccessibilityObject::actionVerb):
(WebCore::AccessibilityObject::getAttribute):
(WebCore::AccessibilityObject::placeholderValue):
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::accessKey):
(WebCore::AccessibilityObject::ariaLiveRegionRelevant):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::accessKey):
(WebCore::AccessibilityRenderObject::actionVerb):
* bindings/js/JSCustomElementInterface.cpp:
(WebCore::JSCustomElementInterface::constructElementWithFallback):
* bindings/js/JSCustomElementRegistryCustom.cpp:
(WebCore::JSCustomElementRegistry::define):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateDefaultValue):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringBody):
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringIsNullBody):
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringIsEmptyStringBody):
* css/CSSPageRule.cpp:
(WebCore::CSSPageRule::selectorText):
* css/CSSPrimitiveValue.cpp:
(WebCore::valueName):
* css/CSSSelector.cpp:
(WebCore::simpleSelectorSpecificityInternal):
(WebCore::CSSSelector::specificityForPage):
(WebCore::CSSSelector::RareData::RareData):
* css/CSSSelector.h:
(WebCore::CSSSelector::argument):
* css/CSSSelectorList.cpp:
(WebCore::SelectorNeedsNamespaceResolutionFunctor::operator()):
* css/PageRuleCollector.cpp:
(WebCore::checkPageSelectorComponents):
* css/RuleSet.cpp:
(WebCore::computeMatchBasedOnRuleHash):
(WebCore::RuleSet::addRule):
* css/SelectorChecker.cpp:
(WebCore::tagMatches):
* css/SelectorFilter.cpp:
(WebCore::collectDescendantSelectorIdentifierHashes):
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertStringOrAuto):
(WebCore::StyleBuilderConverter::convertStringOrNone):
* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderCustom::applyValueWebkitLocale):
(WebCore::StyleBuilderCustom::applyValueWebkitTextEmphasisStyle):
(WebCore::StyleBuilderCustom::applyValueContent):
(WebCore::StyleBuilderCustom::applyValueAlt):
* css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::StyleSheetContents):
(WebCore::StyleSheetContents::namespaceURIFromPrefix):
* css/makeprop.pl:
* css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::parsePageSelector):
* css/parser/CSSSelectorParser.cpp:
(WebCore::CSSSelectorParser::consumeCompoundSelector):
(WebCore::CSSSelectorParser::consumeName):
(WebCore::CSSSelectorParser::consumeAttribute):
(WebCore::CSSSelectorParser::defaultNamespace):
(WebCore::CSSSelectorParser::determineNamespace):
(WebCore::CSSSelectorParser::prependTypeSelectorIfNeeded):
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::attributeNameTestingRequiresNamespaceRegister):
(WebCore::SelectorCompiler::equalTagNames):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeMatching):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementHasTagName):
* dom/Attr.cpp:
(WebCore::Attr::setPrefix):
(WebCore::Attr::attachToElement):
* dom/Attribute.h:
(WebCore::Attribute::nameMatchesFilter):
* dom/ConstantPropertyMap.cpp:
(WebCore::ConstantPropertyMap::nameForProperty):
* dom/ContainerNode.cpp:
(WebCore::ContainerNode::getElementsByTagName):
(WebCore::ContainerNode::getElementsByTagNameNS):
* dom/CustomElementReactionQueue.cpp:
(WebCore::CustomElementReactionQueue::enqueuePostUpgradeReactions):
* dom/DatasetDOMStringMap.cpp:
(WebCore::convertPropertyNameToAttributeName):
* dom/Document.cpp:
(WebCore::createUpgradeCandidateElement):
(WebCore::Document::createElementForBindings):
(WebCore::Document::importNode):
(WebCore::Document::hasValidNamespaceForElements):
(WebCore::Document::processBaseElement):
(WebCore::Document::dir):
(WebCore::Document::bgColor):
(WebCore::Document::fgColor):
(WebCore::Document::alinkColor):
(WebCore::Document::linkColorForBindings):
(WebCore::Document::vlinkColor):
* dom/Document.h:
* dom/Element.cpp:
(WebCore::Element::setBooleanAttribute):
(WebCore::Element::synchronizeAttribute):
(WebCore::Element::getAttribute):
(WebCore::Element::getAttributeNS):
(WebCore::Element::setAttribute):
(WebCore::Element::parserSetAttributes):
(WebCore::Element::didMoveToNewDocument):
(WebCore::Element::setPrefix):
(WebCore::Element::insertedInto):
(WebCore::Element::removedFrom):
(WebCore::Element::removeAttributeInternal):
(WebCore::Element::addAttributeInternal):
(WebCore::Element::removeAttributeNS):
(WebCore::Element::getAttributeNodeNS):
(WebCore::Element::hasAttributeNS):
(WebCore::Element::computeInheritedLanguage):
(WebCore::Element::updateNameForDocument):
(WebCore::Element::updateIdForDocument):
(WebCore::Element::didAddAttribute):
(WebCore::Element::didRemoveAttribute):
(WebCore::Element::cloneAttributesFromElement):
* dom/Element.h:
(WebCore::Element::attributeWithoutSynchronization):
(WebCore::Element::idForStyleResolution):
(WebCore::Element::getIdAttribute):
(WebCore::Element::getNameAttribute):
* dom/EventTarget.cpp:
(WebCore::legacyType):
* dom/MutationRecord.h:
(WebCore::MutationRecord::attributeName):
(WebCore::MutationRecord::attributeNamespace):
* dom/NamedNodeMap.cpp:
(WebCore::NamedNodeMap::removeNamedItemNS):
* dom/Node.cpp:
(WebCore::Node::prefix):
(WebCore::Node::localName):
(WebCore::Node::namespaceURI):
(WebCore::Node::checkSetPrefix):
(WebCore::locateDefaultNamespace):
(WebCore::Node::isDefaultNamespace):
(WebCore::Node::lookupNamespaceURI):
(WebCore::locateNamespacePrefix):
(WebCore::Node::lookupPrefix):
* dom/NodeRareData.h:
(WebCore::NodeListsNodeData::addCachedTagCollectionNS):
(WebCore::NodeListsNodeData::addCachedCollection):
(WebCore::NodeListsNodeData::cachedCollection):
(WebCore::NodeListsNodeData::removeCacheWithAtomicName):
(WebCore::NodeListsNodeData::removeCachedTagCollectionNS):
(WebCore::NodeListsNodeData::removeCachedCollection):
* dom/PseudoElement.cpp:
(WebCore::pseudoElementTagName):
* dom/QualifiedName.cpp:
(WebCore::QualifiedName::init):
(WebCore::nullQName):
(WebCore::createQualifiedName):
* dom/QualifiedName.h:
(WebCore::QualifiedName::hasPrefix):
* dom/SelectorQuery.cpp:
(WebCore::SelectorDataList::executeSingleTagNameSelectorData):
* dom/SlotAssignment.cpp:
(WebCore::slotNameFromAttributeValue):
* dom/SlotAssignment.h:
(WebCore::SlotAssignment::defaultSlotName):
(WebCore::ShadowRoot::didRemoveAllChildrenOfShadowHost):
(WebCore::ShadowRoot::didChangeDefaultSlot):
* dom/TagCollection.cpp:
(WebCore::TagCollection::TagCollection):
(WebCore::HTMLTagCollection::HTMLTagCollection):
* dom/TagCollection.h:
(WebCore::TagCollectionNS::elementMatches):
* dom/make_names.pl:
(printNamesCppFile):
(printDefinitions):
(printFactoryCppFile):
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::removeNodeAttribute):
* editing/Editing.cpp:
(WebCore::createHTMLElement):
* editing/MarkupAccumulator.cpp:
(WebCore::MarkupAccumulator::serializeNodesWithNamespaces):
(WebCore::MarkupAccumulator::shouldAddNamespaceElement):
(WebCore::MarkupAccumulator::shouldAddNamespaceAttribute):
(WebCore::MarkupAccumulator::appendNamespace):
(WebCore::MarkupAccumulator::appendOpenTag):
(WebCore::MarkupAccumulator::appendAttribute):
* editing/gtk/EditorGtk.cpp:
(WebCore::elementURL):
* editing/markup.cpp:
(WebCore::AttributeChange::AttributeChange):
* html/Autocapitalize.cpp:
(WebCore::stringForAutocapitalizeType):
* html/Autofill.cpp:
(WebCore::AutofillData::createFromHTMLFormControlElement):
* html/DOMTokenList.h:
(WebCore::DOMTokenList::item):
* html/FormAssociatedElement.cpp:
(WebCore::FormAssociatedElement::name):
* html/HTMLButtonElement.cpp:
(WebCore::HTMLButtonElement::formControlType):
* html/HTMLDetailsElement.cpp:
(WebCore::HTMLDetailsElement::toggleOpen):
* html/HTMLDocument.cpp:
(WebCore::HTMLDocument::isCaseSensitiveAttribute):
* html/HTMLElement.cpp:
(WebCore::HTMLElement::eventNameForEventHandlerAttribute):
(WebCore::toValidDirValue):
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::name):
(WebCore::HTMLInputElement::updateType):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::doesHaveAttribute):
* html/HTMLOptionElement.cpp:
(WebCore::HTMLOptionElement::createForJSConstructor):
* html/HTMLParamElement.cpp:
(WebCore::HTMLParamElement::name):
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::setMultiple):
* html/HTMLTableCellElement.cpp:
(WebCore::HTMLTableCellElement::scope):
* html/HTMLTrackElement.cpp:
(WebCore::HTMLTrackElement::mediaElementCrossOriginAttribute):
* html/LabelableElement.cpp:
(WebCore::LabelableElement::labels):
* html/LabelsNodeList.cpp:
(WebCore::LabelsNodeList::~LabelsNodeList):
* html/MediaController.cpp:
(MediaController::playbackState):
(eventNameForReadyState):
* html/MediaDocument.cpp:
(WebCore::MediaDocumentParser::createDocumentStructure):
* html/parser/AtomicHTMLToken.h:
(WebCore::AtomicHTMLToken::initializeAttributes):
* html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::createElement):
(WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):
* html/parser/HTMLParserIdioms.cpp:
(WebCore::stripLeadingAndTrailingHTMLSpaces):
(WebCore::parseHTMLHashNameReference):
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::createForeignAttributesMap):
* html/track/InbandTextTrack.cpp:
(WebCore::InbandTextTrack::InbandTextTrack):
* html/track/LoadableTextTrack.cpp:
(WebCore::LoadableTextTrack::id):
* html/track/TextTrack.cpp:
(WebCore::TextTrack::captionMenuOffItem):
(WebCore::TextTrack::captionMenuAutomaticItem):
* html/track/TrackBase.cpp:
(WebCore::MediaTrackBase::setKindInternal):
* html/track/VTTRegion.cpp:
(WebCore::VTTRegion::scroll):
* html/track/WebVTTElement.cpp:
(WebCore::nodeTypeToTagName):
* html/track/WebVTTElement.h:
* html/track/WebVTTToken.h:
(WebCore::WebVTTToken::StartTag):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::clear):
* loader/FrameLoader.h:
* loader/ImageLoader.cpp:
(WebCore::ImageLoader::clearFailedLoadURL):
* loader/NavigationAction.h:
* loader/PolicyChecker.cpp:
(WebCore::PolicyChecker::checkNavigationPolicy):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::showModalDialog):
* page/EventHandler.cpp:
(WebCore::eventNameForTouchPointState):
* page/FrameTree.cpp:
(WebCore::FrameTree::setName):
(WebCore::FrameTree::clearName):
* page/Page.cpp:
(WebCore::Page::groupName):
* platform/graphics/ComplexTextController.cpp:
(WebCore::ComplexTextController::offsetForPosition):
* platform/graphics/FontCache.cpp:
(WebCore::FontCache::alternateFamilyName):
* platform/graphics/FontDescription.h:
(WebCore::FontCascadeDescription::initialLocale):
* platform/graphics/FontGenericFamilies.cpp:
(WebCore::genericFontFamilyForScript):
* platform/graphics/InbandTextTrackPrivate.h:
(WebCore::InbandTextTrackPrivate::inBandMetadataTrackDispatchType):
* platform/graphics/TrackPrivateBase.h:
(WebCore::TrackPrivateBase::id):
(WebCore::TrackPrivateBase::label):
(WebCore::TrackPrivateBase::language):
* platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm:
(WebCore::AVTrackPrivateAVFObjCImpl::id):
(WebCore::AVTrackPrivateAVFObjCImpl::label):
(WebCore::AVTrackPrivateAVFObjCImpl::language):
* platform/graphics/avfoundation/InbandMetadataTextTrackPrivateAVF.h:
* platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp:
(WebCore::InbandTextTrackPrivateAVCF::label):
(WebCore::InbandTextTrackPrivateAVCF::language):
* platform/graphics/avfoundation/cf/InbandTextTrackPrivateLegacyAVCF.cpp:
(WebCore::InbandTextTrackPrivateLegacyAVCF::label):
(WebCore::InbandTextTrackPrivateLegacyAVCF::language):
* platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm:
(WebCore::InbandTextTrackPrivateAVFObjC::label):
(WebCore::InbandTextTrackPrivateAVFObjC::language):
* platform/graphics/avfoundation/objc/InbandTextTrackPrivateLegacyAVFObjC.mm:
(WebCore::InbandTextTrackPrivateLegacyAVFObjC::label):
(WebCore::InbandTextTrackPrivateLegacyAVFObjC::language):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::metadataType):
(WebCore::MediaPlayerPrivateAVFoundationObjC::metadataDidArrive):
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::FontCache::platformAlternateFamilyName):
* platform/graphics/cocoa/FontDescriptionCocoa.cpp:
(WebCore::FontCascadeDescription::effectiveFamilyAt):
* platform/graphics/freetype/FontCacheFreeType.cpp:
(WebCore::FontCache::platformAlternateFamilyName):
* platform/graphics/gstreamer/InbandMetadataTextTrackPrivateGStreamer.h:
(WebCore::InbandMetadataTextTrackPrivateGStreamer::create):
* platform/graphics/win/FontCacheWin.cpp:
(WebCore::FontCache::platformAlternateFamilyName):
* platform/mediastream/AudioTrackPrivateMediaStream.h:
* platform/mediastream/RealtimeMediaSourceSettings.cpp:
(WebCore::RealtimeMediaSourceSettings::facingMode):
* platform/mediastream/VideoTrackPrivateMediaStream.h:
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::linkSuggestedFilename):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paint):
* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::markerText):
* rendering/RenderText.cpp:
(WebCore::RenderText::previousOffset):
(WebCore::RenderText::nextOffset):
* rendering/RenderTreeAsText.cpp:
(WebCore::RenderTreeAsText::writeRenderObject):
* rendering/TextPainter.cpp:
(WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::textEmphasisMarkString):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::initialHyphenationString):
(WebCore::RenderStyle::initialTextEmphasisCustomMark):
(WebCore::RenderStyle::initialContentAltText):
(WebCore::RenderStyle::initialLineGrid):
(WebCore::RenderStyle::initialFlowThread):
(WebCore::RenderStyle::initialRegionThread):
* style/StyleScope.cpp:
(WebCore::Style::Scope::collectActiveStyleSheets):
* svg/SVGElement.cpp:
(WebCore::SVGElement::getPresentationAttribute):
* svg/SVGElement.h:
(WebCore::SVGAttributeHashTranslator::hash):
* svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::transferSizeAttributesToTargetClone):
* svg/animation/SVGSMILElement.cpp:
(WebCore::SVGSMILElement::constructAttributeName):
* testing/MockCDMFactory.cpp:
(WebCore::MockCDMInstance::requestLicense):
* xml/XMLErrors.cpp:
(WebCore::createXHTMLParserErrorHeader):
* xml/XPathStep.cpp:
(WebCore::XPath::nodeMatchesBasicTest):
(WebCore::XPath::Step::nodesInAxis):
* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::XMLDocumentParser::XMLDocumentParser):
(WebCore::handleNamespaceAttributes):
(WebCore::handleElementAttributes):

Source/WebKit/mac:

* DOM/DOM.mm:
(lookupElementClass):

Source/WTF:

This patch cleans up StringStatics.cpp and remove it from the tree.

1. Move StringImpl methods to appropriate place, "StringImpl.cpp".

StringImpl::hashSlowCase() and StringImpl::concurrentHash() are defined in
StringStatics.cpp. But they should be defined in StringImpl.cpp.
This patch just moves them to StringImpl.cpp.

2. Use LazyNeverDestroyed to initialize AtomicString atoms like emptyAtom.

Previously, we initialized AtomicString atoms like emptyAtom in a hacky way.
We first define them as extern global variables. However, AtomicString has
a non-trivial constructor. Thus, we cannot do this because it requires global
constructor calls. This is why we have StringStatics.cpp. In this file, we
include "StaticConstructors.h". After including this file, all the global
constructor call disabled in Windows. And in GCC environment, we allocate
void* storage for that variable. And we use placement new in AtomicString::init()
to initialize these storage.
However, we already have better way for that: LazyNeverDestroyed. It just allocates
storage like the above. And it does not have any global constructors. Thus
we can just declare it as a global variable. And we initialize them lazily in
AtomicString::init(). This way effectively avoids "StaticConstructors.h" hacky way.
And it makes "StringStatics.cpp" unnecessary.
Then, we just move these variables and AtomicString::init() to AtomicString.cpp.

And we also change emptyAtom to emptyAtom() to get the value from LazyNeverDestroyed<>.

* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/text/AtomicString.cpp:
(WTF::AtomicString::convertASCIICase):
(WTF::AtomicString::fromUTF8Internal):
(WTF::AtomicString::init):
* wtf/text/AtomicString.h:
(WTF::nullAtom):
(WTF::emptyAtom):
(WTF::starAtom):
(WTF::xmlAtom):
(WTF::xmlnsAtom):
(WTF::AtomicString::fromUTF8):
* wtf/text/StringBuilder.h:
(WTF::StringBuilder::toAtomicString):
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::hashSlowCase):
(WTF::StringImpl::concurrentHash):
* wtf/text/StringStatics.cpp: Removed.

Tools:

* TestWebKitAPI/Tests/WTF/StringBuilder.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/TestsController.cpp:
(TestWebKitAPI::TestsController::TestsController):

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

2 years agoDrop unnecessary uses of targetStatistics.dataRecordsRemoved in ResourceLoadObserver
cdumez@apple.com [Fri, 7 Jul 2017 04:15:09 +0000 (04:15 +0000)]
Drop unnecessary uses of targetStatistics.dataRecordsRemoved in ResourceLoadObserver
https://bugs.webkit.org/show_bug.cgi?id=174234

Reviewed by Brent Fulgham.

Drop unnecessary uses of targetStatistics.dataRecordsRemoved in ResourceLoadObserver. It is
always 0 since this member is only initialized later on, in the UIProcess.

* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::logFrameNavigation):
(WebCore::ResourceLoadObserver::logSubresourceLoading):
(WebCore::ResourceLoadObserver::logWebSocketLoading):

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

2 years agoEnabling uploading archives to S3.
lforschler@apple.com [Fri, 7 Jul 2017 04:13:35 +0000 (04:13 +0000)]
Enabling uploading archives to S3.
https://bugs.webkit.org/show_bug.cgi?id=174198

Reviewed by Lucas Forschler.

* BuildSlaveSupport/build.webkit.org-config/master.cfg:
(ArchiveMinifiedBuiltProduct): Create a minified archive from a full archive
(UploadMinifiedBuiltProduct): Upload minified archive to build master
(TransferToS3): Transfer full and minified archives to S3

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

2 years ago[preload] Avoid reflecting "video" and "audio" when they are not supported `as` value
yoav@yoav.ws [Fri, 7 Jul 2017 03:37:17 +0000 (03:37 +0000)]
[preload] Avoid reflecting "video" and "audio" when they are not supported `as` value
https://bugs.webkit.org/show_bug.cgi?id=174199

Reviewed by Youenn Fablet.

No new tests as video/audio is supported in tests. I tested this manually.

* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::as): Make sure "video" and "audio" will not be reflected when they are not supported.

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

2 years agoAdd extra insurance to prevent clang from making crash traces sad
keith_miller@apple.com [Fri, 7 Jul 2017 03:35:27 +0000 (03:35 +0000)]
Add extra insurance to prevent clang from making crash traces sad
https://bugs.webkit.org/show_bug.cgi?id=174231

Reviewed by Saam Barati.

This patch makes it slightly harder for Clang to coalesce our crash calls.
Additionally, it also makes Clang never tail call the WTFCrashWithInfo so
our stack trace should always be "reasonable".

* wtf/Assertions.h:
* wtf/Compiler.h:

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

2 years agoSafari 10.1 fails to upload a patch on perf try bots page
rniwa@webkit.org [Fri, 7 Jul 2017 02:59:11 +0000 (02:59 +0000)]
Safari 10.1 fails to upload a patch on perf try bots page
https://bugs.webkit.org/show_bug.cgi?id=174214

Reviewed by Chris Dumez.

Added the workaround to make the analysis task page work on Safari 10.1

* public/v3/components/instant-file-uploader.js:
(InstantFileUploader.prototype._uploadFiles): Convert files to an array since for-of doesn't work otherwise on Safari 10.1.
* public/v3/models/uploaded-file.js:
(UploadedFile._computeSHA256Hash): Fallback to crypto.webkitSubtle since crypto.subtle isn't available on Safari 10.1 or 11.

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

2 years agoDrop unused ResourceLoadStatistics members
cdumez@apple.com [Fri, 7 Jul 2017 02:44:15 +0000 (02:44 +0000)]
Drop unused ResourceLoadStatistics members
https://bugs.webkit.org/show_bug.cgi?id=174226

Reviewed by Brent Fulgham.

Source/WebCore:

* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::logFrameNavigation):
(WebCore::ResourceLoadObserver::logSubresourceLoading):
(WebCore::ResourceLoadObserver::logWebSocketLoading):
(WebCore::ResourceLoadObserver::isPrevalentResource): Deleted.
* loader/ResourceLoadObserver.h:
* loader/ResourceLoadStatistics.cpp:
(WebCore::ResourceLoadStatistics::encode):
(WebCore::ResourceLoadStatistics::decode):
(WebCore::ResourceLoadStatistics::toString):
(WebCore::ResourceLoadStatistics::merge):
* loader/ResourceLoadStatistics.h:

Source/WebKit2:

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
(IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
* UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
(WebKit::ResourceLoadStatisticsStore::readDataFromDecoder):

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

2 years agoRendering of WebRTC audio in AudioSampleDataSource may trigger crackles
commit-queue@webkit.org [Fri, 7 Jul 2017 01:56:42 +0000 (01:56 +0000)]
Rendering of WebRTC audio in AudioSampleDataSource may trigger crackles
https://bugs.webkit.org/show_bug.cgi?id=174223

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

We try reading too quickly and need to back off a little bit if we do not enough data.
This only affects real audio and not web audio, hence validated through manual testing only.

* platform/audio/mac/AudioSampleDataSource.mm:
(WebCore::AudioSampleDataSource::pullSamplesInternal):

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

2 years ago[WebIDL] Remove custom bindings for WebGL code dealing with WebGL extensions
commit-queue@webkit.org [Fri, 7 Jul 2017 01:16:06 +0000 (01:16 +0000)]
[WebIDL] Remove custom bindings for WebGL code dealing with WebGL extensions
https://bugs.webkit.org/show_bug.cgi?id=174186

Patch by Sam Weinig <sam@webkit.org> on 2017-07-06
Reviewed by Alex Christensen.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
Update files. Categorize some of the remaining custom bindings into groups.

* bindings/IDLTypes.h:
Add a IDLWebGLExtension type, to model the special WebGLExtension type. In
the future, WebGLExtension can probably be replaced by a Variant.

* bindings/js/JSDOMConvertWebGL.cpp: Added.
Move WebGLAny's convertToJSValue and add a convertToJSValue for WebGLExtension.

* bindings/js/JSDOMConvertWebGL.h:
(WebCore::convertToJSValue):
Since WebGLExtension is a wrapper type, we need both a pointer and reference variant
of the conversion.

(WebCore::JSConverter<IDLWebGLExtension>::convert):
Added.

* bindings/js/JSWebGL2RenderingContextCustom.cpp:
(WebCore::toJS): Deleted.
(WebCore::JSWebGL2RenderingContext::getExtension): Deleted.
Remove custom operation and converter.

* bindings/js/JSWebGLRenderingContextCustom.cpp:
(WebCore::toJS): Deleted.
(WebCore::JSWebGLRenderingContext::getExtension): Deleted.
Remove custom operation and converter.

* bindings/scripts/CodeGeneratorJS.pm:
(AddToIncludesForIDLType):
(NativeToJSValueDOMConvertNeedsState):
(NativeToJSValueDOMConvertNeedsGlobalObject):
Add support for IDLWebGLExtension.

* html/canvas/WebGLAny.cpp: Removed.
* html/canvas/WebGLAny.h:
Moved convertToJSValue to the bindings where it belongs.

* html/canvas/WebGLRenderingContextBase.idl:
Annotate getExtension with [OverrideIDLType=IDLWebGLExtension].

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

2 years ago[Win] Build precompiled header successfully with clang-cl
commit-queue@webkit.org [Fri, 7 Jul 2017 01:11:00 +0000 (01:11 +0000)]
[Win] Build precompiled header successfully with clang-cl
https://bugs.webkit.org/show_bug.cgi?id=174221

Patch by Stephan Szabo <stephan.szabo@sony.com> on 2017-07-06
Reviewed by Alex Christensen.

* Source/cmake/WebKitMacros.cmake:

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

2 years ago[GTK][WPE] kill-old-process should kill more webkit related process
clopez@igalia.com [Fri, 7 Jul 2017 00:46:53 +0000 (00:46 +0000)]
[GTK][WPE] kill-old-process should kill more webkit related process
https://bugs.webkit.org/show_bug.cgi?id=174220

Reviewed by Michael Catanzaro.

Generate list of possible webkit-related process names and add
them to the list of process to kill.
Also update the possible system related process for GTK+/WPE.

* BuildSlaveSupport/kill-old-processes:
(listAllWebKitPrograms):
(main):

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

2 years ago[Cocoa] CTParagraphStyle leak under WebCore::LinkImageLayout::LinkImageLayout
commit-queue@webkit.org [Fri, 7 Jul 2017 00:00:30 +0000 (00:00 +0000)]
[Cocoa] CTParagraphStyle leak under WebCore::LinkImageLayout::LinkImageLayout
https://bugs.webkit.org/show_bug.cgi?id=174228

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-07-06
Reviewed by Andreas Kling.

* platform/mac/DragImageMac.mm:
(WebCore::LinkImageLayout::LinkImageLayout):

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

2 years agoUnreviewed, fix the internal iOS 11 build
wenson_hsieh@apple.com [Thu, 6 Jul 2017 23:59:08 +0000 (23:59 +0000)]
Unreviewed, fix the internal iOS 11 build

It turns out, our internal bots are still on an older version of the iOS 11 SDK that's missing _UIDataOwner in
<UIKit/NSItemProvider+UIKitAdditions_Private.h>. To ensure that we can build on both current and slightly older
versions of the iOS 11 SDK, fall back to using NSInteger instead of _UIDataOwner.

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _dragInteraction:dataOwnerForSession:]):
(-[WKContentView _dropInteraction:dataOwnerForSession:]):

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

2 years ago[iOS DnD] [WK2] Add delegate hooks for specifying the data owner for a drag or drop...
wenson_hsieh@apple.com [Thu, 6 Jul 2017 23:30:10 +0000 (23:30 +0000)]
[iOS DnD] [WK2] Add delegate hooks for specifying the data owner for a drag or drop session
https://bugs.webkit.org/show_bug.cgi?id=174139
<rdar://problem/33126212>

Reviewed by Beth Dakin.

Add hooks to query the UI delegate for a _UIDataOwner on both drag and drop sides.

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _dragInteraction:dataOwnerForSession:]):
(-[WKContentView _dropInteraction:dataOwnerForSession:]):

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

2 years ago[Cocoa] Improve performance of font lookups
mmaxfield@apple.com [Thu, 6 Jul 2017 23:04:18 +0000 (23:04 +0000)]
[Cocoa] Improve performance of font lookups
https://bugs.webkit.org/show_bug.cgi?id=173960
<rdar://problem/31996891>

Reviewed by Darin Adler.

PerformanceTests:

* Layout/font-fallback-font-family.html: Added.
* Layout/resources/font-fallback-font-family.html: Added.

Source/WebCore:

Looking up kCTFontPostScriptNameAttribute is faster than kCTFontNameAttribute.

No new tests because there is no behavior change.

* platform/spi/cocoa/CoreTextSPI.h:
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::FontDatabase::fontForPostScriptName):

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

2 years agoUpdate help text.
lforschler@apple.com [Thu, 6 Jul 2017 22:50:30 +0000 (22:50 +0000)]
Update help text.

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

2 years agoREGRESSION(r216944): Font loads can cause Chinese characters to draw as .notdef
mmaxfield@apple.com [Thu, 6 Jul 2017 22:09:11 +0000 (22:09 +0000)]
REGRESSION(r216944): Font loads can cause Chinese characters to draw as .notdef
https://bugs.webkit.org/show_bug.cgi?id=173962
<rdar://problem/32925318>

Reviewed by Simon Fraser.

Source/WebCore:

Previously, there was no signalling between our font loading code
which determined whether or not a font should be invisible (because
its in the middle of loading) and our system fallback code which
created fonts when we fall off the end of the fallback list. Because
of this, we were doing two things wrong:

1. When we started downloading a font, we would try to use a fallback
font. However, if the fallback font didn't suppor the character we're
trying to render, we would just bail and draw .notdef
2. Even if we continued down the fallback list, and fell of the end,
we wouldn't realize that the system fallback font should also be drawn
as invisible.

This patch solves these two problems by:
1. Performing a search to find the best (local) fallback font with
which to fall systemFallbackFontForCharacter(). This way, if you say
"font-family: 'RemoteFont', 'Helvetica'" we will use Helvetica as
the lookup to ask the system to search for.
2. Give the Font class an accessor which can create a duplicate, but
invisible font. Give FontCascadeFonts::glyphDataForVariant() the
correct tracking to know when to use this invisible duplicate.

Tests: fast/text/font-loading-system-fallback.html
       http/tests/webfont/font-loading-system-fallback-visibility.html

* platform/graphics/Font.cpp:
(WebCore::Font::invisibleFont):
* platform/graphics/Font.h:
* platform/graphics/FontCascadeFonts.cpp:
(WebCore::findBestFallbackFont):
(WebCore::FontCascadeFonts::glyphDataForSystemFallback):
(WebCore::FontCascadeFonts::glyphDataForVariant):
* platform/graphics/FontCascadeFonts.h:

LayoutTests:

* fast/text/font-loading-system-fallback-expected.html: Added.
* fast/text/font-loading-system-fallback.html: Added.
* http/tests/webfont/font-loading-system-fallback-visibility-expected.html: Added.
* http/tests/webfont/font-loading-system-fallback-visibility.html: Added.

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

2 years ago[WK2] ResourceLoadStatistics should batch its writes
bfulgham@apple.com [Thu, 6 Jul 2017 21:59:33 +0000 (21:59 +0000)]
[WK2] ResourceLoadStatistics should batch its writes
https://bugs.webkit.org/show_bug.cgi?id=174111
<rdar://problem/33115894>

Reviewed by Chris Dumez.

Revise the data writing operation to only write on a specific interval (currently
set to 5 minutes).

Also make 'writeStoreToDisk' simpler to use by moving the deleting (before write) and
creating (after write) of the FileMonitor into the method, rather than requiring this
knowledge in multiple places.

Make sure that we write our statistics file out before exiting so that we do not
lose any data if we exit before the five-minute window has elapsed.

* UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
(WebKit::ResourceLoadStatisticsStore::setWritePersistentStoreCallback): Deleted.
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords): Remove the stop
and start monitoring into 'writeStoreToDisk'. Also check if enough time has elapsed since
the last write to commit to disk.
(WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver): Remove the
stop and start monitoring into 'writeStoreToDisk'.
(WebKit::WebResourceLoadStatisticsStore::writeStoreToDisk): Add the stop and start monitoring
commands here, so callers don't have to know to do so.

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

2 years agoFileMonitor should not be ref counted
cdumez@apple.com [Thu, 6 Jul 2017 21:45:04 +0000 (21:45 +0000)]
FileMonitor should not be ref counted
https://bugs.webkit.org/show_bug.cgi?id=174166

Reviewed by Brent Fulgham.

Source/WebCore:

Update FileMonitor to no longer be refcounted. It was previously easy to leak it
because the object would ref itself in various lambdas. The client would have to
explicitely call FileMonitor::stopMonitoring() which was fragile.

This patch also simplifies the code and API a bit since no longer actually
requires startMonitoring() / stopMonitoring() API.

No new tests, covered by API tests.

* platform/FileMonitor.cpp:
(WebCore::FileMonitor::FileMonitor):
(WebCore::FileMonitor::~FileMonitor):
(WebCore::FileMonitor::create): Deleted.
(WebCore::FileMonitor::startMonitoring): Deleted.
(WebCore::FileMonitor::stopMonitoring): Deleted.
* platform/FileMonitor.h:
* platform/cocoa/FileMonitorCocoa.mm:
(WebCore::FileMonitor::FileMonitor):
(WebCore::FileMonitor::~FileMonitor):
(WebCore::FileMonitor::startMonitoring): Deleted.
(WebCore::FileMonitor::stopMonitoring): Deleted.

Source/WebKit2:

Update code using FileMonitor to reflect API change.

* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::startMonitoringStatisticsStorage):
(WebKit::WebResourceLoadStatisticsStore::stopMonitoringStatisticsStorage):
* UIProcess/WebResourceLoadStatisticsStore.h:

Tools:

Update the API tests to reflect the API change.

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

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

2 years agoFix build with VIDEO support disabled.
mrajca@apple.com [Thu, 6 Jul 2017 21:22:48 +0000 (21:22 +0000)]
Fix build with VIDEO support disabled.
https://bugs.webkit.org/show_bug.cgi?id=174217

Unreviewed build fix.

Source/WebCore:

* page/Page.cpp:

Source/WebKit2:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updateWebsitePolicies):

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

2 years agoUnreviewed, rolling out r219193.
jlewis3@apple.com [Thu, 6 Jul 2017 21:20:18 +0000 (21:20 +0000)]
Unreviewed, rolling out r219193.

The tests added with this revision were extreamly flaky on all
platforms.

Reverted changeset:

"[SVG] Leak in SVGAnimatedListPropertyTearOff"
https://bugs.webkit.org/show_bug.cgi?id=172545
http://trac.webkit.org/changeset/219193

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

2 years agoUse WTFLogAlways for debug logging so that it shows up in device system logs
zalan@apple.com [Thu, 6 Jul 2017 21:13:24 +0000 (21:13 +0000)]
Use WTFLogAlways for debug logging so that it shows up in device system logs
https://bugs.webkit.org/show_bug.cgi?id=173450

Reviewed by Simon Fraser.

If you want to showRenderTree() on-device, the result doesn't show in system log so you can't see it.
Switch to WTFLogAlways to fix this, for showRenderTree and its dependencies.

* platform/text/TextStream.cpp:
(WebCore::writeIndent):
* rendering/InlineBox.cpp:
(WebCore::InlineBox::showLineTreeAndMark):
(WebCore::InlineBox::showLineBox):
* rendering/InlineBox.h:
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::showLineTreeAndMark):
* rendering/InlineFlowBox.h:
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::showLineBox):
* rendering/InlineTextBox.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::showLineTreeAndMark):
* rendering/RenderBlockFlow.h:
* rendering/RenderObject.cpp:
(WebCore::showRenderTreeLegend):
(WebCore::RenderObject::showRenderTreeForThis):
(WebCore::RenderObject::showLineTreeForThis):
(WebCore::RenderObject::showRegionsInformation):
(WebCore::RenderObject::showRenderObject):
(WebCore::RenderObject::showRenderSubTreeAndMark):
* rendering/RenderObject.h:
* rendering/SimpleLineLayoutFunctions.cpp:
(WebCore::SimpleLineLayout::printPrefix):
(WebCore::SimpleLineLayout::showLineLayoutForFlow):
* rendering/SimpleLineLayoutFunctions.h:

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

2 years agoUnify FontCascadeFonts::glyphDataForVariant() and FontCascadeFonts::glyphDataForNorma...
mmaxfield@apple.com [Thu, 6 Jul 2017 21:07:19 +0000 (21:07 +0000)]
Unify FontCascadeFonts::glyphDataForVariant() and FontCascadeFonts::glyphDataForNormalVariant()
https://bugs.webkit.org/show_bug.cgi?id=174213

Reviewed by Zalan Bujtas.

They have almost identical code. This is in preparation for https://bugs.webkit.org/show_bug.cgi?id=173962

No new tests because there is no behavior change.

* platform/graphics/FontCascadeFonts.cpp:
(WebCore::FontCascadeFonts::glyphDataForVariant):
(WebCore::FontCascadeFonts::glyphDataForCharacter):
(WebCore::FontCascadeFonts::glyphDataForNormalVariant): Deleted.
* platform/graphics/FontCascadeFonts.h:

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

2 years agoWeb Inspector: Highlight matching canvas element when hovering contexts in the Resour...
drousso@apple.com [Thu, 6 Jul 2017 20:51:20 +0000 (20:51 +0000)]
Web Inspector: Highlight matching canvas element when hovering contexts in the Resources tab
https://bugs.webkit.org/show_bug.cgi?id=174209

Reviewed by Joseph Pecoraro.

* UserInterface/Views/CanvasTreeElement.js:
(WebInspector.CanvasTreeElement.prototype.onattach):
(WebInspector.CanvasTreeElement.prototype._handleMouseOver):
(WebInspector.CanvasTreeElement.prototype._handleMouseOut):

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

2 years ago[PAL] Move KillRing into PAL
don.olmstead@sony.com [Thu, 6 Jul 2017 20:23:27 +0000 (20:23 +0000)]
[PAL] Move KillRing into PAL
https://bugs.webkit.org/show_bug.cgi?id=173900

Reviewed by Myles C. Maxfield.

No new tests. No change in functionality.

Source/WebCore:

* Configurations/WebCore.xcconfig:
* PlatformGTK.cmake:
* PlatformMac.cmake:
* PlatformWPE.cmake:
* PlatformWin.cmake:
* WebCore.xcodeproj/project.pbxproj:
* editing/Editor.cpp:
(WebCore::Editor::Editor):
* editing/Editor.h:
(WebCore::Editor::killRing):
* editing/EditorCommand.cpp:

Source/WebCore/PAL:

* Configurations/PAL.xcconfig:
* PAL.xcodeproj/project.pbxproj:
* pal/CMakeLists.txt:
* pal/PlatformGTK.cmake:
* pal/PlatformMac.cmake:
* pal/PlatformWPE.cmake:
* pal/PlatformWin.cmake:
* pal/text/KillRing.h: Renamed from Source/WebCore/platform/KillRing.h.
* pal/text/KillRingNone.cpp: Renamed from Source/WebCore/platform/KillRingNone.cpp.
* pal/text/mac/KillRingMac.mm: Renamed from Source/WebCore/platform/mac/KillRingMac.mm.

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

2 years agoMarked js/slow-stress/Int32Array-alloc-huge.html as flaky.
jlewis3@apple.com [Thu, 6 Jul 2017 20:03:14 +0000 (20:03 +0000)]
Marked js/slow-stress/Int32Array-alloc-huge.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=173010

Unreviewed test gardening.

* platform/ios-simulator-wk2/TestExpectations:

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

2 years agoCrash under WebResourceLoadStatisticsStore::persistentStoragePath(WTF::String const&)
cdumez@apple.com [Thu, 6 Jul 2017 19:22:36 +0000 (19:22 +0000)]
Crash under WebResourceLoadStatisticsStore::persistentStoragePath(WTF::String const&)
https://bugs.webkit.org/show_bug.cgi?id=174205
<rdar://problem/33093552>

Reviewed by Brent Fulgham.

Make sure we isolateCopy() m_statisticsStoragePath before using it from the background
thread.

* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded):
(WebKit::WebResourceLoadStatisticsStore::refreshFromDisk):
(WebKit::WebResourceLoadStatisticsStore::resourceLogFilePath):
(WebKit::WebResourceLoadStatisticsStore::statisticsFilePath):
(WebKit::WebResourceLoadStatisticsStore::writeStoreToDisk):
(WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk):
(WebKit::WebResourceLoadStatisticsStore::deleteStoreFromDisk):
(WebKit::WebResourceLoadStatisticsStore::startMonitoringStatisticsStorage):
(WebKit::WebResourceLoadStatisticsStore::syncWithExistingStatisticsStorageIfNeeded):
(WebKit::WebResourceLoadStatisticsStore::persistentStoragePath): Deleted.
* UIProcess/WebResourceLoadStatisticsStore.h:

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

2 years agoFix CFURLRequestRef serialization after r207330
achristensen@apple.com [Thu, 6 Jul 2017 18:50:47 +0000 (18:50 +0000)]
Fix CFURLRequestRef serialization after r207330
https://bugs.webkit.org/show_bug.cgi?id=163332

* Shared/mac/WebCoreArgumentCodersMac.mm:
(IPC::ArgumentCoder<ResourceRequest>::encodePlatformData):
The CFURLConnection code was not updated.
We did not catch this because nobody uses the WebKit2 CFURLConnection code, but I need to use it to debug something.

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

2 years agoWe are missing places where we invalidate the for-in context
sbarati@apple.com [Thu, 6 Jul 2017 18:43:41 +0000 (18:43 +0000)]
We are missing places where we invalidate the for-in context
https://bugs.webkit.org/show_bug.cgi?id=174184

Reviewed by Geoffrey Garen.

JSTests:

* stress/for-in-invalidate-context-weird-assignments.js: Added.
(assert):
(test):

Source/JavaScriptCore:

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::invalidateForInContextForLocal):
* bytecompiler/NodesCodegen.cpp:
(JSC::EmptyLetExpression::emitBytecode):
(JSC::ForInNode::emitLoopHeader):
(JSC::ForOfNode::emitBytecode):
(JSC::BindingNode::bindValue):

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

2 years agoWeb Inspector: Support getting the content of WebGL/WebGL2 contexts
drousso@apple.com [Thu, 6 Jul 2017 18:35:58 +0000 (18:35 +0000)]
Web Inspector: Support getting the content of WebGL/WebGL2 contexts
https://bugs.webkit.org/show_bug.cgi?id=173569
<rdar://problem/33112420>

Reviewed by Joseph Pecoraro.

Source/WebCore:

Tests: inspector/canvas/requestContent-2d.html
       inspector/canvas/requestContent-webgl.html
       inspector/canvas/requestContent-webgl2.html

* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::clearIfComposited):
* html/canvas/WebGLRenderingContextBase.h:
(WebCore::WebGLRenderingContextBase::preventBufferClearForInspector):
(WebCore::WebGLRenderingContextBase::setPreventBufferClearForInspector):
Add a flag that will prevent the context buffer from being cleared, allowing it to be copied
within a toDataURL call. This is currently only used by InspectorCanvasAgent::requestContent.

* inspector/InspectorCanvasAgent.cpp:
(WebCore::InspectorCanvasAgent::requestContent):
Since toDataURL attempts to force the canvas to redraw, we can preserve the buffer after it
finishes drawing so that it can be copied, instead of it normally being swapped out.

LayoutTests:

* inspector/canvas/requestContent-2d-expected.txt: Added.
* inspector/canvas/requestContent-2d.html: Added.
* inspector/canvas/requestContent-webgl-expected.txt: Added.
* inspector/canvas/requestContent-webgl.html: Added.
* inspector/canvas/requestContent-webgl2-expected.txt: Added.
* inspector/canvas/requestContent-webgl2.html: Added.
* inspector/canvas/requestContent-expected.txt: Removed.
* inspector/canvas/requestContent.html: Removed.
* platform/gtk/TestExpectations:
* platform/win/TestExpectations:
Split the existing canvas content tests into one for each context type. This allows
platforms that don't support certain context types to ignore just those tests (e.g. WebGL2).

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

2 years agoMove ResourceLoadObserver notification throttling logic from WebProcess class to...
cdumez@apple.com [Thu, 6 Jul 2017 18:28:40 +0000 (18:28 +0000)]
Move ResourceLoadObserver notification throttling logic from WebProcess class to ResourceLoadObserver
https://bugs.webkit.org/show_bug.cgi?id=174194

Reviewed by Brent Fulgham.

Move ResourceLoadObserver notification throttling logic from WebProcess class to
ResourceLoadObserver. This makes more sense and decreases the complexity of the
WebProcess class.

Source/WebCore:

* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::setNotificationCallback):
(WebCore::ResourceLoadObserver::ResourceLoadObserver):
(WebCore::ResourceLoadObserver::logFrameNavigation):
(WebCore::ResourceLoadObserver::logSubresourceLoading):
(WebCore::ResourceLoadObserver::logWebSocketLoading):
(WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
(WebCore::ResourceLoadObserver::scheduleNotificationIfNeeded):
(WebCore::ResourceLoadObserver::notificationTimerFired):
* loader/ResourceLoadObserver.h:

Source/WebKit2:

* WebProcess/WebProcess.cpp:
(WebKit::m_webSQLiteDatabaseTracker):
(WebKit::WebProcess::statisticsChangedTimerFired): Deleted.
* WebProcess/WebProcess.h:

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

2 years ago[GTK] Layout test gardening.
clopez@igalia.com [Thu, 6 Jul 2017 18:24:12 +0000 (18:24 +0000)]
[GTK] Layout test gardening.

Unreviewed.

* platform/gtk/TestExpectations: Update WebRTC related expectations and mark a new emoji related test failing after r218371.
* platform/gtk/fast/css/css2-system-fonts-expected.txt: Rebaseline after r218446.
* platform/gtk/fast/css/getComputedStyle/computed-style-font-family-expected.txt: Removed. Rebaseline after r218446 (use the general expectation).
* platform/gtk/fast/text/font-stretch-parse-expected.txt: Removed. Rebaseline after r218446 (use the general expectation).
* platform/gtk/fast/text/font-style-parse-expected.txt: Removed. Rebaseline after r218446 (use the general expectation).
* platform/gtk/fast/text/font-weight-parse-expected.txt: Removed Rebaseline after r218446 (use the general expectation).

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

2 years agoREGRESSION(r208511): RenderImageResourceStyleImage should not assume image() won...
commit-queue@webkit.org [Thu, 6 Jul 2017 18:22:44 +0000 (18:22 +0000)]
REGRESSION(r208511): RenderImageResourceStyleImage should not assume image() won't return null if its m_cachedImage is valid
https://bugs.webkit.org/show_bug.cgi?id=174168

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2017-07-06
Reviewed by Simon Fraser.

RenderImageResourceStyleImage::image() may return a null pointer even if
its m_cachedImage is not null. The revision r208511, changed the function
RenderImageResourceStyleImage::shutdown() so it calls Image::stopAnimation().
But this change assumes that if m_cachedImage is not null then image() will
return a valid pointer. This is not true because StyleCachedImage::isPending()
can return true and hence, RenderImageResourceStyleImage::image() will return
a null pointer.

* rendering/RenderImageResourceStyleImage.cpp:
(WebCore::RenderImageResourceStyleImage::image): Like what RenderImageResource
does, return Image::nullImage() if m_styleImage->isPending().

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

2 years agoUnreviewed, rolling out r219201.
commit-queue@webkit.org [Thu, 6 Jul 2017 18:10:21 +0000 (18:10 +0000)]
Unreviewed, rolling out r219201.
https://bugs.webkit.org/show_bug.cgi?id=174211

"Causes crashes on Release builds and API tests" (Requested by
ddkilzer on #webkit).

Reverted changeset:

"Add release assert to explore crash for
<rdar://problem/32908525>"
http://trac.webkit.org/changeset/219201

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

2 years agoWebResourceLoadStatisticsStore should only be constructed when the feature is enabled
cdumez@apple.com [Thu, 6 Jul 2017 17:23:07 +0000 (17:23 +0000)]
WebResourceLoadStatisticsStore should only be constructed when the feature is enabled
https://bugs.webkit.org/show_bug.cgi?id=174189

Reviewed by Brent Fulgham.

Delay the construction of the WebResourceLoadStatisticsStore until the feature gets
enabled via WebsiteDataStore::setResourceLoadStatisticsEnabled(). Previously, we would
always construct a store and then have a boolean on the store to indicate if it is
enabled or not.

Also simplify the initialization process of the WebResourceLoadStatisticsStore, we
used to have:
1. WebResourceLoadStatisticsStore constructor
2. WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver()
3. WebResourceLoadStatisticsStore::setResourceLoadStatisticsEnabled(true)

All 3 steps are now taken care of by the WebResourceLoadStatisticsStore constructor.

* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitialize):
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
(WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded):
* UIProcess/WebResourceLoadStatisticsStore.h:
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::platformInitialize):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::WebsiteDataStore):
(WebKit::WebsiteDataStore::resourceLoadStatisticsEnabled):
(WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
* UIProcess/WebsiteData/WebsiteDataStore.h:
(WebKit::WebsiteDataStore::resourceLoadStatistics):
* UIProcess/wpe/WebProcessPoolWPE.cpp:
(WebKit::WebProcessPool::platformInitialize):

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

2 years agoUnreviewed, rolling out r219194.
commit-queue@webkit.org [Thu, 6 Jul 2017 17:12:54 +0000 (17:12 +0000)]
Unreviewed, rolling out r219194.
https://bugs.webkit.org/show_bug.cgi?id=174207

it broke some layout tests (Requested by clopez on #webkit).

Reverted changeset:

"[GStreamer] vid.me videos do not play"
https://bugs.webkit.org/show_bug.cgi?id=172240
http://trac.webkit.org/changeset/219194

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

2 years agoAdd release assert to explore crash for <rdar://problem/32908525>
ddkilzer@apple.com [Thu, 6 Jul 2017 16:49:16 +0000 (16:49 +0000)]
Add release assert to explore crash for <rdar://problem/32908525>

Reviewed by Brady Eidson.

* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::~UniqueIDBDatabase): Add
release assert to catch cases when the IDBBackingStore is not
deleted before the UniqueIDBDatabase is destroyed.  The
IDBBackingStore should always be released on the database
thread.

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

2 years agoAdd logging to first attempt to use the WebIconDatabase class.
beidson@apple.com [Thu, 6 Jul 2017 16:31:34 +0000 (16:31 +0000)]
Add logging to first attempt to use the WebIconDatabase class.
https://bugs.webkit.org/show_bug.cgi?id=174190

Reviewed by Andy Estes.

* Misc/WebIconDatabase.mm:
(+[WebIconDatabase sharedIconDatabase]): On first call, log a warning of the bleak future of this non-API.
* Misc/WebKitVersionChecks.h:

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

2 years agoUnreviewed, rolling out r219178.
jlewis3@apple.com [Thu, 6 Jul 2017 16:22:41 +0000 (16:22 +0000)]
Unreviewed, rolling out r219178.

This caused a consistent failure with the API test
StringBuilderTest.ToAtomicStringOnEmpty on all Debug testers.

Reverted changeset:

"[WTF] Clean up StringStatics.cpp by using
LazyNeverDestroyed<> for Atoms"
https://bugs.webkit.org/show_bug.cgi?id=174150
http://trac.webkit.org/changeset/219178

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