WebKit.git
3 years agoReplace staging-prefixed UIKit drag and drop delegate methods with their public SDK...
wenson_hsieh@apple.com [Thu, 29 Jun 2017 16:09:36 +0000 (16:09 +0000)]
Replace staging-prefixed UIKit drag and drop delegate methods with their public SDK versions
https://bugs.webkit.org/show_bug.cgi?id=173959

Reviewed by Sam Weinig.

Remove references to _api_-prefixed UIDragInteractionDelegate and UIDropInteractionDelegate methods,
and replace them with their counterparts in the public SDK.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView dragInteraction:previewForLiftingItem:session:]):
(-[WKContentView dragInteraction:session:didEndWithOperation:]):
(-[WKContentView dragInteraction:item:willAnimateCancelWithAnimator:]):
(-[WKContentView dropInteraction:sessionDidEnter:]):
(-[WKContentView dropInteraction:sessionDidUpdate:]):
(-[WKContentView _simulateDataInteractionEntered:]):
(-[WKContentView _simulateDataInteractionUpdated:]):
(-[WKContentView _simulateDataInteractionSessionDidEnd:]):
(-[WKContentView _api_dragInteraction:previewForLiftingItem:session:]): Deleted.
(-[WKContentView _api_dragInteraction:session:didEndWithOperation:]): Deleted.
(-[WKContentView _api_dragInteraction:item:willAnimateCancelWithAnimator:]): Deleted.
(-[WKContentView _api_dropInteraction:sessionDidEnter:]): Deleted.
(-[WKContentView _api_dropInteraction:sessionDidUpdate:]): Deleted.

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

3 years agoUnreviewed. Fix GTK+ unit tests crashing after r218922.
carlosgc@webkit.org [Thu, 29 Jun 2017 12:09:04 +0000 (12:09 +0000)]
Unreviewed. Fix GTK+ unit tests crashing after r218922.

We need to check if icon database exists and is open now on dispose and API entry points.

* UIProcess/API/glib/WebKitFaviconDatabase.cpp:
(webkitFaviconDatabaseDispose):
(webkit_favicon_database_get_favicon_uri):
(webkit_favicon_database_clear):

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

3 years ago[GTK][WPE] Implement API::IconLoadingClient and rework WebKitFaviconDatabase to use...
carlosgc@webkit.org [Thu, 29 Jun 2017 10:00:19 +0000 (10:00 +0000)]
[GTK][WPE] Implement API::IconLoadingClient and rework WebKitFaviconDatabase to use IconDatabase directly
https://bugs.webkit.org/show_bug.cgi?id=173877

Reviewed by Brady Eidson.

Source/WebKit2:

This way IconDatabase and its related classes can be removed from WebCore, as well as the WebKit2 implementation
and C API. For now I've copied IconDatabase from WebCore to WebKit2 under the glib API directory, adding the
related classes as private inside IconDatabase, and removing some methods that are not used by the GLib API.

* PlatformGTK.cmake:
* UIProcess/API/glib/IconDatabase.cpp: Added.
(WebKit::urlForLogging):
(WebKit::defaultClient):
(WebKit::IconDatabase::IconRecord::IconRecord):
(WebKit::IconDatabase::IconRecord::~IconRecord):
(WebKit::IconDatabase::IconRecord::image):
(WebKit::IconDatabase::IconRecord::setImageData):
(WebKit::IconDatabase::IconRecord::loadImageFromResource):
(WebKit::IconDatabase::IconRecord::imageDataStatus):
(WebKit::IconDatabase::IconRecord::snapshot):
(WebKit::IconDatabase::PageURLRecord::PageURLRecord):
(WebKit::IconDatabase::PageURLRecord::~PageURLRecord):
(WebKit::IconDatabase::PageURLRecord::setIconRecord):
(WebKit::IconDatabase::PageURLRecord::snapshot):
(WebKit::IconDatabase::setClient):
(WebKit::IconDatabase::open):
(WebKit::IconDatabase::close):
(WebKit::IconDatabase::removeAllIcons):
(WebKit::documentCanHaveIcon):
(WebKit::IconDatabase::synchronousIconForPageURL):
(WebKit::IconDatabase::synchronousIconURLForPageURL):
(WebKit::IconDatabase::retainIconForPageURL):
(WebKit::IconDatabase::performRetainIconForPageURL):
(WebKit::IconDatabase::releaseIconForPageURL):
(WebKit::IconDatabase::performReleaseIconForPageURL):
(WebKit::IconDatabase::setIconDataForIconURL):
(WebKit::IconDatabase::setIconURLForPageURL):
(WebKit::IconDatabase::synchronousLoadDecisionForIconURL):
(WebKit::IconDatabase::synchronousIconDataKnownForIconURL):
(WebKit::IconDatabase::setEnabled):
(WebKit::IconDatabase::isEnabled):
(WebKit::IconDatabase::setPrivateBrowsingEnabled):
(WebKit::IconDatabase::isPrivateBrowsingEnabled):
(WebKit::IconDatabase::delayDatabaseCleanup):
(WebKit::IconDatabase::allowDatabaseCleanup):
(WebKit::IconDatabase::checkIntegrityBeforeOpening):
(WebKit::IconDatabase::IconDatabase):
(WebKit::IconDatabase::~IconDatabase):
(WebKit::IconDatabase::wakeSyncThread):
(WebKit::IconDatabase::scheduleOrDeferSyncTimer):
(WebKit::IconDatabase::syncTimerFired):
(WebKit::IconDatabase::isOpen):
(WebKit::IconDatabase::isOpenBesidesMainThreadCallbacks):
(WebKit::IconDatabase::databasePath):
(WebKit::IconDatabase::defaultDatabaseFilename):
(WebKit::IconDatabase::getOrCreateIconRecord):
(WebKit::IconDatabase::getOrCreatePageURLRecord):
(WebKit::IconDatabase::shouldStopThreadActivity):
(WebKit::IconDatabase::iconDatabaseSyncThread):
(WebKit::databaseVersionNumber):
(WebKit::isValidDatabase):
(WebKit::createDatabaseTables):
(WebKit::IconDatabase::performOpenInitialization):
(WebKit::IconDatabase::checkIntegrity):
(WebKit::IconDatabase::performURLImport):
(WebKit::IconDatabase::syncThreadMainLoop):
(WebKit::IconDatabase::performPendingRetainAndReleaseOperations):
(WebKit::IconDatabase::readFromDatabase):
(WebKit::IconDatabase::writeToDatabase):
(WebKit::IconDatabase::pruneUnretainedIcons):
(WebKit::IconDatabase::checkForDanglingPageURLs):
(WebKit::IconDatabase::removeAllIconsOnThread):
(WebKit::IconDatabase::deleteAllPreparedStatements):
(WebKit::IconDatabase::cleanupSyncThread):
(WebKit::readySQLiteStatement):
(WebKit::IconDatabase::setIconURLForPageURLInSQLDatabase):
(WebKit::IconDatabase::setIconIDForPageURLInSQLDatabase):
(WebKit::IconDatabase::removePageURLFromSQLDatabase):
(WebKit::IconDatabase::getIconIDForIconURLFromSQLDatabase):
(WebKit::IconDatabase::addIconURLToSQLDatabase):
(WebKit::IconDatabase::getImageDataForIconURLFromSQLDatabase):
(WebKit::IconDatabase::removeIconFromSQLDatabase):
(WebKit::IconDatabase::writeIconSnapshotToSQLDatabase):
(WebKit::IconDatabase::checkClosedAfterMainThreadCallback):
(WebKit::IconDatabase::dispatchDidImportIconURLForPageURLOnMainThread):
(WebKit::IconDatabase::dispatchDidImportIconDataForPageURLOnMainThread):
(WebKit::IconDatabase::dispatchDidRemoveAllIconsOnMainThread):
(WebKit::IconDatabase::dispatchDidFinishURLImportOnMainThread):
* UIProcess/API/glib/IconDatabase.h: Added.
(WebKit::IconDatabaseClient::didImportIconURLForPageURL):
(WebKit::IconDatabaseClient::didImportIconDataForPageURL):
(WebKit::IconDatabaseClient::didChangeIconForPageURL):
(WebKit::IconDatabaseClient::didRemoveAllIcons):
(WebKit::IconDatabaseClient::didFinishURLImport):
(WebKit::IconDatabaseClient::didClose):
(WebKit::IconDatabase::IconSnapshot::IconSnapshot):
(WebKit::IconDatabase::IconSnapshot::iconURL):
(WebKit::IconDatabase::IconSnapshot::timestamp):
(WebKit::IconDatabase::IconSnapshot::data):
(WebKit::IconDatabase::IconRecord::create):
(WebKit::IconDatabase::IconRecord::getTimestamp):
(WebKit::IconDatabase::IconRecord::setTimestamp):
(WebKit::IconDatabase::IconRecord::iconURL):
(WebKit::IconDatabase::IconRecord::retainingPageURLs):
(WebKit::IconDatabase::PageURLSnapshot::PageURLSnapshot):
(WebKit::IconDatabase::PageURLSnapshot::pageURL):
(WebKit::IconDatabase::PageURLSnapshot::iconURL):
(WebKit::IconDatabase::PageURLRecord::url):
(WebKit::IconDatabase::PageURLRecord::iconRecord):
(WebKit::IconDatabase::PageURLRecord::retain):
(WebKit::IconDatabase::PageURLRecord::release):
(WebKit::IconDatabase::PageURLRecord::retainCount):
* UIProcess/API/glib/WebKitFaviconDatabase.cpp:
(_WebKitFaviconDatabasePrivate::~_WebKitFaviconDatabasePrivate):
(getIconSurfaceSynchronously):
(webkitFaviconDatabaseSetIconURLForPageURL):
(webkitFaviconDatabaseCreate):
(webkitFaviconDatabaseOpen):
(webkitFaviconDatabaseIsOpen):
(webkitFaviconDatabaseSetPrivateBrowsingEnabled):
(webkitFaviconDatabaseGetLoadDecisionForIcon):
(webkitFaviconDatabaseSetIconForPageURL):
(webkit_favicon_database_get_favicon):
(webkit_favicon_database_get_favicon_uri):
* UIProcess/API/glib/WebKitFaviconDatabasePrivate.h:
* UIProcess/API/glib/WebKitIconLoadingClient.cpp: Added.
(IconLoadingClient::IconLoadingClient):
(attachIconLoadingClientToView):
* UIProcess/API/glib/WebKitIconLoadingClient.h: Copied from Source/WebKit2/UIProcess/API/glib/WebKitFaviconDatabasePrivate.h.
* UIProcess/API/glib/WebKitWebContext.cpp:
(ensureFaviconDatabase):
(webkitWebContextEnableIconDatabasePrivateBrowsingIfNeeded):
(webkitWebContextDisableIconDatabasePrivateBrowsingIfNeeded):
(webkit_web_context_set_favicon_database_directory):
* UIProcess/API/glib/WebKitWebView.cpp:
(webkitWebViewConstructed):
(webkitWebViewGetLoadDecisionForIcon):
(webkitWebViewSetIcon):
* UIProcess/API/glib/WebKitWebViewPrivate.h:

Tools:

Update favicons unit test to ensure we wait until the database is updated in testGetFavicon() before starting
the next tests.

* TestWebKitAPI/Tests/WebKitGLib/TestWebKitFaviconDatabase.cpp:
(testGetFavicon):

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

3 years agoAlign Document::canNavigate on the HTM5 specification
fred.wang@free.fr [Thu, 29 Jun 2017 07:43:07 +0000 (07:43 +0000)]
Align Document::canNavigate on the HTM5 specification
https://bugs.webkit.org/show_bug.cgi?id=173162

Patch by Frederic Wang <fwang@igalia.com> on 2017-06-28
Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

Test expectation for popup navigation are updated now that the following tests pass:
- iframe_sandbox_popups_escaping-3
- iframe_sandbox_popups_nonescaping-3

* web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-3-expected.txt: Update expectation to PASS.
* web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-3-expected.txt: Update expectation to PASS.

Source/WebCore:

Currently when a frame A with a sandboxed navigation flag tries and navigates another frame B
then Document::canNavigate verifies the cases where we try to navigate A's top frame (in
that case the allow-top-navigation flag is needed) or not (in that case, B must be a
descendant of A). This patch refines that a bit to check the case where B is a popup (in that
case navigation is permitted if A is the opener of B). This change aligns on the HTML5
specification and allows to pass more W3C Web Platform tests.
See https://html.spec.whatwg.org/multipage/browsers.html#allowed-to-navigate

Tests: imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-3.html
       imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-3.html

* dom/Document.cpp:
(WebCore::Document::canNavigate): This refines the case where the document's frame has the
sandbox navigation flag set in order to handle popup navigation. New comments referring to
the HTML5 specification are also added.

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

3 years ago[Win] Update expectations for layout tests.
pvollan@apple.com [Thu, 29 Jun 2017 06:07:41 +0000 (06:07 +0000)]
[Win] Update expectations for layout tests.
https://bugs.webkit.org/show_bug.cgi?id=172437

Unreviewed test gardening, update test expectations for failing tests.

* platform/win/TestExpectations:

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

3 years agoOnly apply font features for the particular type of font they are being applied to
mmaxfield@apple.com [Thu, 29 Jun 2017 05:45:44 +0000 (05:45 +0000)]
Only apply font features for the particular type of font they are being applied to
https://bugs.webkit.org/show_bug.cgi?id=172661
<rdar://problem/31534119>
<rdar://problem/32799624>

Reviewed by Simon Fraser.

There are two types of font formats which support features: AAT and OTF. Each of them has
a different idea about what the identity of a feature is. We were specifying both types
of feature identities to Core Text; however, this is causing Core Text to get confused.
Instead, we should only apply AAT features to AAT fonts and OTF features to OTF fonts.

Test: Un-marking these tests as failure on High Sierra:
      css3/font-variant-petite-caps-synthesis-coverage.html
      css3/font-variant-small-caps-synthesis-coverage.html

* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::FontType::FontType):
(WebCore::preparePlatformFont):
(WebCore::variationCapabilitiesForFontDescriptor):
(WebCore::isGXVariableFont): Deleted.

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

3 years ago[ResourceLoadStatistics] Simplify PrevalentResourceTelemetry struct
cdumez@apple.com [Thu, 29 Jun 2017 05:43:04 +0000 (05:43 +0000)]
[ResourceLoadStatistics] Simplify PrevalentResourceTelemetry struct
https://bugs.webkit.org/show_bug.cgi?id=173953

Reviewed by Sam Weinig.

* loader/ResourceLoadStatisticsStore.cpp:
(WebCore::ResourceLoadStatisticsStore::sortedPrevalentResourceTelemetry):
* loader/ResourceLoadStatisticsStore.h:
(WebCore::PrevalentResourceTelemetry::PrevalentResourceTelemetry): Deleted.

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

3 years agoMobileSafari was constantly using 10-15% CPU viewing a PDF
timothy_horton@apple.com [Thu, 29 Jun 2017 04:37:53 +0000 (04:37 +0000)]
MobileSafari was constantly using 10-15% CPU viewing a PDF
https://bugs.webkit.org/show_bug.cgi?id=173944
<rdar://problem/33039910>

Reviewed by Simon Fraser.

Source/WebKit2:

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _doAfterNextStablePresentationUpdate:]):
(-[WKWebView _doAfterNextPresentationUpdate:]):
(-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForPainting:]):
Bail early and just dispatch_async the completion block if we are using a custom
content view; these methods are very specific to the implementation of WKContentView
and don't make sense with custom content views.

doAfterNextStablePresentationUpdate is particularly egregious because, since
we will never call the stable update callbacks (because we bail from didCommitLayerTree
if we aren't using WKContentView), it will keep calling doAfterNextPresentationUpdate
over and over again.

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/WKPDFViewStablePresentationUpdateCallback.mm:
Add a test that we ever call the stable presentation update callback
when we have a WKPDFView up, instead of infinitely looping.

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

3 years ago[WK2][macOS][iOS] Don't request microphone access for clients that don't need it.
bfulgham@apple.com [Thu, 29 Jun 2017 04:04:37 +0000 (04:04 +0000)]
[WK2][macOS][iOS] Don't request microphone access for clients that don't need it.
https://bugs.webkit.org/show_bug.cgi?id=173948
<rdar://problem/32103275>

Reviewed by Eric Carlson.

Don't bother requesting a sandbox extension to access the microphone for any clients
on the Cocoa platform that are not Safari. Other clients don't have the necessary
system entitlements, and always fail leading to annoying SandboxViolation reports.

* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):

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

3 years agoCrash in WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange
rniwa@webkit.org [Thu, 29 Jun 2017 03:58:17 +0000 (03:58 +0000)]
Crash in WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange
https://bugs.webkit.org/show_bug.cgi?id=173958

Reviewed by Simon Fraser.

The crashed is most likely caused by updateLayersAfterAncestorChange calling [CALayer setPosition]
with a CGPoint which contains the x coordinate or the y coordinate of NaN.

Simon and I inpected the code but we couldn't figure out how we get there. Detect this case and bail out.
Also log the relevant values and debug assert when this condition is hit to help identifying the root cause.

* page/scrolling/mac/ScrollingTreeFixedNode.mm:
(WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange):

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

3 years agoResourceLoadObserver clean up
cdumez@apple.com [Thu, 29 Jun 2017 03:55:28 +0000 (03:55 +0000)]
ResourceLoadObserver clean up
https://bugs.webkit.org/show_bug.cgi?id=173955

Reviewed by Sam Weinig and Brent Fulgham.

ResourceLoadObserver clean up: Modernize code a bit and get rid of unused variables.

* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::clearInMemoryStore):
(WebCore::ResourceLoadObserver::clearInMemoryAndPersistentStore):
(WebCore::ResourceLoadObserver::shouldLog):
(WebCore::ResourceLoadObserver::logFrameNavigation):
(WebCore::ResourceLoadObserver::logSubresourceLoading):
(WebCore::ResourceLoadObserver::logWebSocketLoading):
(WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
(WebCore::ResourceLoadObserver::logUserInteraction):
(WebCore::ResourceLoadObserver::setSubframeUnderTopFrameOrigin):
(WebCore::ResourceLoadObserver::setSubresourceUnderTopFrameOrigin):
(WebCore::ResourceLoadObserver::setSubresourceUniqueRedirectTo):
(WebCore::ResourceLoadObserver::fireDataModificationHandler):
(WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler):
(WebCore::ResourceLoadObserver::primaryDomain):
(WebCore::ResourceLoadObserver::statisticsForOrigin):

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

3 years agoMove RenderEmbeddedObject::isReplacementObscured to HTMLPlugInElement
zalan@apple.com [Thu, 29 Jun 2017 03:54:05 +0000 (03:54 +0000)]
Move RenderEmbeddedObject::isReplacementObscured to HTMLPlugInElement
https://bugs.webkit.org/show_bug.cgi?id=173802
<rdar://problem/32884389>

Reviewed by Simon Fraser.

Source/WebCore:

Hittesting could potentially destroy "this" renderer so calling it inside RenderEmbeddedObject
could leave the caller with a stale pointer.
This patch protects the plugin element from getting destroyed and checks if the renderer got
deleted during the hittest to avoid nullptr dereference.

Speculative fix.

* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::isReplacementObscured):
* html/HTMLPlugInElement.h:
* rendering/RenderEmbeddedObject.cpp:
(WebCore::RenderEmbeddedObject::isReplacementObscured): Deleted.
* rendering/RenderEmbeddedObject.h:
* testing/Internals.cpp:
(WebCore::Internals::isPluginUnavailabilityIndicatorObscured):

Source/WebKit2:

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

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

3 years agoAvoid copying statistics in ResourceLoadStatisticsStore::readDataFromDecoder()
cdumez@apple.com [Thu, 29 Jun 2017 03:28:47 +0000 (03:28 +0000)]
Avoid copying statistics in ResourceLoadStatisticsStore::readDataFromDecoder()
https://bugs.webkit.org/show_bug.cgi?id=173951

Reviewed by Ryosuke Niwa.

* loader/ResourceLoadStatisticsStore.cpp:
(WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):

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

3 years agoREGRESSION (r218842): com.apple.WebKit crash in WebKit::ProcessLauncher::launchProcess
rniwa@webkit.org [Thu, 29 Jun 2017 02:56:22 +0000 (02:56 +0000)]
REGRESSION (r218842): com.apple.WebKit crash in WebKit::ProcessLauncher::launchProcess
https://bugs.webkit.org/show_bug.cgi?id=173950

Reviewed by Chris Dumez.

Added a null check as m_xpcConnection could be nullptr here in the case platformInvalidate had been called.

* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::ProcessLauncher::launchProcess):

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

3 years agoSafari's Speedometer score massively regresses when accessibility is enabled
rniwa@webkit.org [Thu, 29 Jun 2017 02:54:00 +0000 (02:54 +0000)]
Safari's Speedometer score massively regresses when accessibility is enabled
https://bugs.webkit.org/show_bug.cgi?id=173912

Reviewed by Chris Fleizach.

The bug was caused by HTMLTextFormControlElement::setInnerTextValue triggering a synchronous layout
via constructing VisiblePosition when the accessibility tree is present.

Added AXObjectCache::postTextReplacementNotificationForTextControl which avoids the construction of
VisiblePosition and other means of triggering a synchronous layout. This patch also fixes a subtle bug
that HTMLTextFormControlElement was creating TextMarkerData with axID set to that of the text control
element instead of the root editable element inside its shadow tree even though the typing command uses
axID of the root editable element. While I couldn't find any user-visible behavioral change from this
code change, new code is more self-consistent.

Also added LayoutDisallowedScope which asserts that no synchronous layout happens in setInnerTextValue
so that we don't introduce a new performance regression like this in the future.

No new tests. Existing tests in accessibility directory covers this.

* CMakeLists.txt: Added LayoutDisallowedScope.cpp.
* WebCore.xcodeproj/project.pbxproj: Ditto.

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::postTextReplacementNotificationForTextControl): Added.
(WebCore::AXObjectCache::textMarkerDataForVisiblePosition): Modernized. Returns optional<TextMarkerData>
instead of taking TextMarkerData as an out-argument, and returning with axID of 0.
(WebCore::AXObjectCache::textMarkerDataForFirstPositionInTextControl): Added. This specialized version
constructs TextMarkerData for the first position inside the editable region in a text control without
triggering a synchronous layout.

* accessibility/AXObjectCache.h:
(WebCore::TextMarkerData): Initialize each member automatically.
(WebCore::AXObjectCache::postTextReplacementNotificationForTextControl):

* accessibility/ios/AXObjectCacheIOS.mm:
(WebCore::AXObjectCache::postTextReplacementPlatformNotificationForTextControl): Added.

* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(+[WebAccessibilityTextMarker textMarkerWithVisiblePosition:cache:]):

* accessibility/mac/AXObjectCacheMac.mm:
(WebCore::addTextMarkerFor): Extracted from textReplacementChangeDictionary. Added a new variant which
takes a text form control instead.
(WebCore::textReplacementChangeDictionary): Templatized this function to either take VisiblePosition
and call textMarkerForVisiblePosition or take HTMLTextFormControlElement and call
textMarkerForFirstPositionInTextControl.
(WebCore::postUserInfoForChanges): Extracted from postTextReplacementPlatformNotification.
(WebCore::AXObjectCache::postTextReplacementPlatformNotification):
(WebCore::AXObjectCache::postTextReplacementPlatformNotificationForTextControl): Added.

* accessibility/mac/WebAccessibilityObjectWrapperBase.h:
* accessibility/mac/WebAccessibilityObjectWrapperMac.h:

* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(textMarkerForVisiblePosition):
(-[WebAccessibilityObjectWrapper textMarkerForFirstPositionInTextControl:]): Added.

* dom/Document.cpp:
(WebCore::Document::updateLayout): Assert that LayoutDisallowedScope is not in the stack frame.

* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::setInnerTextValue): Call postTextReplacementNotificationForTextControl
to avoid triggering a synchronous layout. Also create LayoutDisallowedScope to avoid a similar performance
regression from being introduced in the future in this function. Finally, made innerText a RefPtr for extra
safety since we're using it after updating the DOM tree.

* rendering/LayoutDisallowedScope.cpp: Added.
* rendering/LayoutDisallowedScope.h: Added.
(WebCore::LayoutDisallowedScope::LayoutDisallowedScope):
(WebCore::LayoutDisallowedScope::~LayoutDisallowedScope):
(WebCore::LayoutDisallowedScope::isLayoutAllowed):

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

3 years ago[iOS] Cannot italicize or bold text rendered with text styles
mmaxfield@apple.com [Thu, 29 Jun 2017 02:46:11 +0000 (02:46 +0000)]
[iOS] Cannot italicize or bold text rendered with text styles
https://bugs.webkit.org/show_bug.cgi?id=173634

Reviewed by Darin Adler.

Source/WebCore:

r218616 enabled the new cascade list codepath for "system-ui," but didn't do it for the named
text styles (like "font: -apple-system-tall-body;"). This new codepath is better because it
correctly specifies weights and italics (using kCTFontWeightTrait and kCTFontSlantTrait) instead
of using symbolic traits, and because it correctly handles fonts in the Core Text fallback chain.
This patch migrates the named text styles to this new codepath.

Test: fast/text/ipad/bold-tall-body-text-style.html

* platform/graphics/cocoa/FontDescriptionCocoa.cpp:
(WebCore::SystemFontDatabase::CoreTextCascadeListParameters::CoreTextCascadeListParameters):
(WebCore::SystemFontDatabase::CoreTextCascadeListParameters::isHashTableDeletedValue):
(WebCore::SystemFontDatabase::CoreTextCascadeListParameters::operator==):
(WebCore::SystemFontDatabase::CoreTextCascadeListParameters::hash):
(WebCore::SystemFontDatabase::CoreTextCascadeListParameters::CoreTextCascadeListParametersHash::hash):
(WebCore::SystemFontDatabase::CoreTextCascadeListParameters::CoreTextCascadeListParametersHash::equal):
(WebCore::SystemFontDatabase::systemFontCascadeList):
(WebCore::convertArray):
(WebCore::convertArray):
(WebCore::makeNeverDestroyed):
(WebCore::isUIFontTextStyle):
(WebCore::systemFontParameters):
(WebCore::FontCascadeDescription::effectiveFamilyCount):
(WebCore::FontCascadeDescription::effectiveFamilyAt):
(WebCore::SystemFontDatabase::CoreTextCascadeListParametersHash::hash): Deleted.
(WebCore::SystemFontDatabase::CoreTextCascadeListParametersHash::equal): Deleted.
* platform/graphics/ios/FontCacheIOS.mm:
(WebCore::platformFontWithFamilySpecialCase):

LayoutTests:

* fast/text/ipad/bold-tall-body-text-style-expected-mismatch.html: Added.
* fast/text/ipad/bold-tall-body-text-style.html: Added.

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

3 years agoWeb Inspector: Instrument active pixel memory used by canvases
drousso@apple.com [Thu, 29 Jun 2017 01:34:51 +0000 (01:34 +0000)]
Web Inspector: Instrument active pixel memory used by canvases
https://bugs.webkit.org/show_bug.cgi?id=173087
<rdar://problem/32719261>

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

* inspector/protocol/Canvas.json:
 - Add optional `memoryCost` attribute to the `Canvas` type.
 - Add `canvasMemoryChanged` event that is dispatched when the `memoryCost` of a canvas changes.

Source/WebCore:

Test: inspector/canvas/memory.html

* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::setImageBuffer):
* inspector/InspectorCanvasAgent.h:
* inspector/InspectorCanvasAgent.cpp:
(WebCore::InspectorCanvasAgent::didChangeCanvasMemory):
(WebCore::InspectorCanvasAgent::buildObjectForCanvas):
* inspector/InspectorInstrumentation.h:
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didChangeCanvasMemory):
(WebCore::InspectorInstrumentation::didChangeCanvasMemoryImpl):

Source/WebInspectorUI:

* .eslintrc:
* UserInterface/Controllers/CanvasManager.js:
(WebInspector.CanvasManager.prototype.canvasMemoryChanged):
* UserInterface/Models/Canvas.js:
(WebInspector.Canvas.fromPayload):
(WebInspector.Canvas.prototype.get memoryCost):
(WebInspector.Canvas.prototype.set memoryCost):
* UserInterface/Protocol/CanvasObserver.js:
(WebInspector.CanvasObserver.prototype.canvasMemoryChanged):
* UserInterface/Views/CanvasDetailsSidebarPanel.js:
(WebInspector.CanvasDetailsSidebarPanel.prototype.initialLayout):
(WebInspector.CanvasDetailsSidebarPanel.prototype._refreshIdentitySection):
(WebInspector.CanvasDetailsSidebarPanel.prototype._formatMemoryRow):
(WebInspector.CanvasDetailsSidebarPanel.prototype._canvasMemoryChanged):

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Base/Utilities.js:
(Number.bytesToString.value):
Add support for gigabyte numbers.

LayoutTests:

* inspector/canvas/memory-expected.txt: Added.
* inspector/canvas/memory.html: Added.

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

3 years agoPrevent displaying URLs with small capital letters
achristensen@apple.com [Thu, 29 Jun 2017 01:11:06 +0000 (01:11 +0000)]
Prevent displaying URLs with small capital letters
https://bugs.webkit.org/show_bug.cgi?id=173949
<rdar://problem/32952058>

Reviewed by Brent Fulgham.

Source/WebCore:

Covered by new API tests.

* platform/mac/WebCoreNSURLExtras.mm:
(WebCore::isLookalikeCharacter):

Tools:

* TestWebKitAPI/Tests/WebCore/cocoa/URLExtras.mm:
(TestWebKitAPI::TEST):

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

3 years agoUnreviewed test fix.
bfulgham@apple.com [Thu, 29 Jun 2017 00:51:36 +0000 (00:51 +0000)]
Unreviewed test fix.

Disable the file monitor tests on iOS because the 'system' API is unavailable on that platform.

* TestWebKitAPI/Tests/WebCore/FileMonitor.cpp:

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

3 years agoUnreviewed, fix a bad ChangeLog entry in r218899.
wenson_hsieh@apple.com [Thu, 29 Jun 2017 00:21:56 +0000 (00:21 +0000)]
Unreviewed, fix a bad ChangeLog entry in r218899.

Remove a leading space from the first line of the ChangeLog entry.

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

3 years agoAdd a Object rest/spread test to the experimental features test page
sbarati@apple.com [Thu, 29 Jun 2017 00:08:46 +0000 (00:08 +0000)]
Add a Object rest/spread test to the experimental features test page
https://bugs.webkit.org/show_bug.cgi?id=173947

Rubber stamped by Dean Jackson.

* experimental-features.html:

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

3 years agoSupport PeerConnectionStates::BundlePolicy::MaxBundle when setting rtc configuration
commit-queue@webkit.org [Wed, 28 Jun 2017 23:24:42 +0000 (23:24 +0000)]
Support PeerConnectionStates::BundlePolicy::MaxBundle when setting rtc configuration
https://bugs.webkit.org/show_bug.cgi?id=169389

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

Source/WebCore:

Covered by manual testing (appr.tc and https://youennf.github.io/webrtc-tests/src/content/peerconnection/trickle-ice/).
Previously, we were creating a libwebrtc peer connection and then setting its configuration.
libwebrtc does not like the configuration to be changed and may refuse to set the configuration.
Instead of doing that, we are now creating the libwebrtc peer connection with the provided configuration.

* Modules/mediastream/MediaEndpointPeerConnection.cpp:
(WebCore::MediaEndpointPeerConnection::setConfiguration):
* Modules/mediastream/MediaEndpointPeerConnection.h:
* Modules/mediastream/PeerConnectionBackend.h:
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::initializeWith):
(WebCore::iceServersFromConfiguration):
(WebCore::RTCPeerConnection::initializeConfiguration):
(WebCore::RTCPeerConnection::setConfiguration):
* Modules/mediastream/RTCPeerConnection.h:
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::LibWebRTCMediaEndpoint):
(WebCore::LibWebRTCMediaEndpoint::setConfiguration):
(WebCore::LibWebRTCMediaEndpoint::stop):
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
(WebCore::configurationFromMediaEndpointConfiguration):
(WebCore::LibWebRTCPeerConnectionBackend::setConfiguration):
* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
* platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
(WebCore::createActualPeerConnection):
(WebCore::LibWebRTCProvider::createPeerConnection):
* platform/mediastream/libwebrtc/LibWebRTCProvider.h:

Source/WebKit2:

Updating according new WebCore LIbWebRTCProvider API.

* WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
(WebKit::LibWebRTCProvider::createPeerConnection):
* WebProcess/Network/webrtc/LibWebRTCProvider.h:

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

3 years ago[iOS] Allow WKWebView clients to play audio in the background
cdumez@apple.com [Wed, 28 Jun 2017 23:22:29 +0000 (23:22 +0000)]
[iOS] Allow WKWebView clients to play audio in the background
https://bugs.webkit.org/show_bug.cgi?id=173932
<rdar://problem/32851547>

Reviewed by Ryosuke Niwa.

Allow WKWebView clients (such as MobileSafari) to play audio in the background
by taking a process assertion whenever a WebPage is audible.

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

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

3 years agoTeach ResourceLoadStatistics to recognize changes in the file system
bfulgham@apple.com [Wed, 28 Jun 2017 23:21:11 +0000 (23:21 +0000)]
Teach ResourceLoadStatistics to recognize changes in the file system
https://bugs.webkit.org/show_bug.cgi?id=173800
<rdar://problem/32937842>

Reviewed by Chris Dumez.

Source/WebCore:

We want to support the case where multiple UI processes choose to share the same
statistics file. To support this, update the ResourceLoadStatistics logic to be aware
that the statistics data file might change underneath it, and to take appropriate
action when it does.

* WebCore.xcodeproj/project.pbxproj: Update for new sources.
* WebCore/CMakeLists.txt: Update for new FileMonitor source file.
* loader/ResourceLoadStatisticsStore.cpp:
(WebCore::ResourceLoadStatisticsStore::clearInMemoryAndPersistent): Use the new deletion
handler for the data file instead of writing out an empty file.
(WebCore::ResourceLoadStatisticsStore::setDeletePersistentStoreCallback): Added.
* loader/ResourceLoadStatisticsStore.h:
* platform/FileMonitor.cpp: Added.
(WebCore::FileMonitor::create):
(WebCore::FileMonitor::FileMonitor): Register handlers and begin monitoring file.
(WebCore::FileMonitor::~FileMonitor): Stop any active file monitoring.
(WebCore::FileMonitor::startMonitoringPath): Stub implementation.
(WebCore::FileMonitor::stopMonitoring): Ditto.
* platform/FileMonitor.h: Added.
* platform/FileSystem.h: Export files needed by WebKit2. Add support for O_EVTONLY
Darwin file handles.
* platform/Logging.h: Add 'ResourceLoadStatistics' category.
* platform/cocoa/FileMonitorCocoa.mm: Added.
(WebCore::FileMonitor::startMonitoringPath): Create a new VNODE type dispatch_source
to receive notifications when the specified file changes.
(WebCore::FileMonitor::stopMonitoring): Cancel the dispatch_source when we are done
monitoring the file.
* platform/posix/FileSystemPOSIX.cpp: Update 'openFile' to understand the O_EVTONLY
mode of file handles (Darwin-only).

Source/WebKit2:

We want to support the case where multiple UI processes choose to share the same
statistics file. To support this, update the ResourceLoadStatistics logic to be aware
that the statistics data file might change underneath it, and to take appropriate
action when it does.

* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsEnabled): When we enable
the statistics, read in the data and then watch for changes.
(WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver): Add a
'delete data' handler to remove the file on disk, not just write an empty store.
(WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded): Use ASCIILiteral.
(WebKit::WebResourceLoadStatisticsStore::refreshFromDisk): Convenience function.
(WebKit::WebResourceLoadStatisticsStore::writeStoreToDisk): Sync with any on-disk
storage before writing out.
(WebKit::openAndLockFile): Convenience function.
(WebKit::closeAndUnlockFile): Ditto.
(WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk): Revise to lock file (on
platforms that support it) before writing to disk.
(WebKit::WebResourceLoadStatisticsStore::deleteStoreFromDisk): Added convenience function.
(WebKit::WebResourceLoadStatisticsStore::clearInMemoryData): Ditto.
(WebKit::WebResourceLoadStatisticsStore::startMonitoringStatisticsStorage): Create a
file system monitor to watch for file changes.
(WebKit::WebResourceLoadStatisticsStore::syncWithExistingStatisticsStorageIfNeeded): Added
convenience function.
(WebKit::WebResourceLoadStatisticsStore::createDecoderFromDisk): Revise to read data
directly so we can control file locking.
* UIProcess/WebResourceLoadStatisticsStore.h:

 2017-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>

Followup to r218885: adjust for further UIKit SPI changes
https://bugs.webkit.org/show_bug.cgi?id=173927
<rdar://problem/33020792>

Reviewed by Tim Horton.

On ToT, UIKit now invokes -_dragInteraction:item:shouldDelaySetDownAnimationWithCompletion: before the
completion block of -dragInteraction:willAnimateLiftWithAnimator:session: is called. This means we now need to
store the completion block in -shouldDelaySetDownAnimationWithCompletion: and wait until the UIDragAnimating
completion block in -willAnimateCancelWithAnimator: before invoking it.

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView cleanUpDragSourceSessionState]):

Ensure that the set-down completion block is invoked when a drag session ends (e.g., if the web content process
crashes).

(-[WKContentView _dragInteraction:item:shouldDelaySetDownAnimationWithCompletion:]):
(-[WKContentView _api_dragInteraction:item:willAnimateCancelWithAnimator:]):

Source/WTF:

* wtf/DispatchPtr.h: Added (moved from WebKit2)
* wtf/Platform.h: Make sure USE_FILE_LOCK is enabled.

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebCore/FileMonitor.cpp: Added.
(TestWebKitAPI::FileMonitorTest::tempFilePath):
(TestWebKitAPI::handleFileModification):
(TestWebKitAPI::handleFileDeletion):
(TestWebKitAPI::resetTestState):
(TestWebKitAPI::TEST_F):

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

3 years ago[Win] Build JSCOnly on Windows with clang-cl
commit-queue@webkit.org [Wed, 28 Jun 2017 23:04:38 +0000 (23:04 +0000)]
[Win] Build JSCOnly on Windows with clang-cl
https://bugs.webkit.org/show_bug.cgi?id=173889

Patch by Stephan Szabo <stephan.szabo@am.sony.com> on 2017-06-28
Reviewed by Konstantin Tokarev.

* CMakeLists.txt:
* Source/cmake/OptionsCommon.cmake:
* Source/cmake/OptionsMSVC.cmake:

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

3 years ago 2017-06-28 Wenson Hsieh <wenson_hsieh@apple.com>
wenson_hsieh@apple.com [Wed, 28 Jun 2017 22:58:16 +0000 (22:58 +0000)]
 2017-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>

Followup to r218885: adjust for further UIKit SPI changes
https://bugs.webkit.org/show_bug.cgi?id=173927
<rdar://problem/33020792>

Reviewed by Tim Horton.

On ToT, UIKit now invokes -_dragInteraction:item:shouldDelaySetDownAnimationWithCompletion: before the
completion block of -dragInteraction:willAnimateLiftWithAnimator:session: is called. This means we now need to
store the completion block in -shouldDelaySetDownAnimationWithCompletion: and wait until the UIDragAnimating
completion block in -willAnimateCancelWithAnimator: before invoking it.

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView cleanUpDragSourceSessionState]):

Ensure that the set-down completion block is invoked when a drag session ends (e.g., if the web content process
crashes).

(-[WKContentView _dragInteraction:item:shouldDelaySetDownAnimationWithCompletion:]):
(-[WKContentView _api_dragInteraction:item:willAnimateCancelWithAnimator:]):

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

3 years agoWeb Inspector: Cleanup Protocol JSON files
joepeck@webkit.org [Wed, 28 Jun 2017 22:53:22 +0000 (22:53 +0000)]
Web Inspector: Cleanup Protocol JSON files
https://bugs.webkit.org/show_bug.cgi?id=173934

Reviewed by Matt Baker.

* inspector/protocol/ApplicationCache.json:
* inspector/protocol/CSS.json:
* inspector/protocol/Console.json:
* inspector/protocol/DOM.json:
* inspector/protocol/DOMDebugger.json:
* inspector/protocol/Debugger.json:
* inspector/protocol/LayerTree.json:
* inspector/protocol/Network.json:
* inspector/protocol/Page.json:
* inspector/protocol/Runtime.json:
Be more consistent about placement of `description` property.

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

3 years agoWeb Inspector: Remove unused Inspector domain events
joepeck@webkit.org [Wed, 28 Jun 2017 22:53:18 +0000 (22:53 +0000)]
Web Inspector: Remove unused Inspector domain events
https://bugs.webkit.org/show_bug.cgi?id=173905

Reviewed by Matt Baker.

Source/JavaScriptCore:

* inspector/protocol/Inspector.json:

Source/WebInspectorUI:

* UserInterface/Protocol/InspectorObserver.js:
(WebInspector.InspectorObserver.prototype.detached): Deleted.

* UserInterface/Protocol/Legacy/10.0/InspectorBackendCommands.js:
* UserInterface/Protocol/Legacy/10.3/InspectorBackendCommands.js:
* UserInterface/Protocol/Legacy/7.0/InspectorBackendCommands.js:
* UserInterface/Protocol/Legacy/8.0/InspectorBackendCommands.js:
* UserInterface/Protocol/Legacy/9.0/InspectorBackendCommands.js:
* UserInterface/Protocol/Legacy/9.3/InspectorBackendCommands.js:
* Versions/Inspector-iOS-10.0.json:
* Versions/Inspector-iOS-10.3.json:
* Versions/Inspector-iOS-7.0.json:
* Versions/Inspector-iOS-8.0.json:
* Versions/Inspector-iOS-9.0.json:
* Versions/Inspector-iOS-9.3.json:
Remove from legacy backends as well since they did not send it.

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

3 years agoDocumentLoader should always notify the client if there are pending icon loads when...
beidson@apple.com [Wed, 28 Jun 2017 22:40:10 +0000 (22:40 +0000)]
DocumentLoader should always notify the client if there are pending icon loads when the load is stopped.
https://bugs.webkit.org/show_bug.cgi?id=173874

Reviewed by Alex Christensen.

Source/WebCore:

Covered by API tests.

Patch started by Carlos Garcia Campos, finished by me.

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::stopLoading): Make all of the callbacks for cancelled IconLoaders.
(WebCore::DocumentLoader::didGetLoadDecisionForIcon): Make the callback even if there's no IconLoader.
(WebCore::DocumentLoader::finishedLoadingIcon):
(WebCore::DocumentLoader::notifyFinishedLoadingIcon):
* loader/DocumentLoader.h:

Tools:

* TestWebKitAPI/Tests/WebKit2Cocoa/IconLoadingDelegate.mm:

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

3 years agoUnreviewed, adding Don Olmstead to contributors.json
don.olmstead@sony.com [Wed, 28 Jun 2017 22:27:28 +0000 (22:27 +0000)]
Unreviewed, adding Don Olmstead to contributors.json

* Scripts/webkitpy/common/config/contributors.json:

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

3 years agodropInteraction:sessionDidEnd: invokes dragEnded with a UIDragOperation rather than...
wenson_hsieh@apple.com [Wed, 28 Jun 2017 22:06:45 +0000 (22:06 +0000)]
dropInteraction:sessionDidEnd: invokes dragEnded with a UIDragOperation rather than a WebCore::DragOperation
https://bugs.webkit.org/show_bug.cgi?id=173935

Reviewed by Tim Horton.

Replaces a use of UIDragOperationNone with DragOperationNone.
Currently, there is no change in behavior since these are currently the same value (0).

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView dropInteraction:sessionDidEnd:]):

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

3 years agoSkip webrtc/video-replace-muted-track.html on iOS.
ryanhaddad@apple.com [Wed, 28 Jun 2017 21:22:39 +0000 (21:22 +0000)]
Skip webrtc/video-replace-muted-track.html on iOS.
https://bugs.webkit.org/show_bug.cgi?id=173608

Unreviewed test gardening.

* platform/ios-wk2/TestExpectations:

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

3 years agoWebsitePolicies given with navigation policy for redirects should apply to the provis...
achristensen@apple.com [Wed, 28 Jun 2017 21:04:26 +0000 (21:04 +0000)]
WebsitePolicies given with navigation policy for redirects should apply to the provisional document
https://bugs.webkit.org/show_bug.cgi?id=173886
<rdar://problem/32543191>

Reviewed by Andy Estes.
Source/WebKit2:

If, for example, we deny video autoplay for the initial request but allow it for the redirect destination
location, the document should allow video autoplay.  We were putting these settings onto the wrong DocumentLoader.
When a navigation policy is given to a response of a redirect location, we currently have the DocumentLoader
for the loading document in the FrameLoader's provisionalDocumentLoader, not the documentLoader.

Covered by a new API test.

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):

Tools:

* TestWebKitAPI/Tests/WebKit2Cocoa/WebsitePolicies.mm:
(ParsedRange::ParsedRange):
(-[TestSchemeHandler initWithVideoData:]):
(-[TestSchemeHandler webView:startURLSchemeTask:]):
(-[TestSchemeHandler webView:stopURLSchemeTask:]):
(TEST):

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

3 years agoVolume controls should be hidden when AirPlay is active
commit-queue@webkit.org [Wed, 28 Jun 2017 20:59:06 +0000 (20:59 +0000)]
Volume controls should be hidden when AirPlay is active
https://bugs.webkit.org/show_bug.cgi?id=173933
<rdar://problem/33011931>

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

Source/WebCore:

Ensure we don't show any volume controls during AirPlay. We set the mute button's enabled state to "false"
when AirPlay is active and key off this enabled stated to control the display of all volume-related controls
throughout the UI.

Tests: media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-volume-controls-hidden-when-mute-button-disabled.html
       media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-top-right-controls-bar-hidden-when-mute-button-disabled.html

* Modules/modern-media-controls/controls/inline-media-controls.js:
(InlineMediaControls.prototype._addTopRightBarWithMuteButtonToChildren):
(InlineMediaControls):
* Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
(MacOSFullscreenMediaControls.prototype.layout):
* Modules/modern-media-controls/media/airplay-support.js:
(AirplaySupport.prototype.syncControl):
(AirplaySupport):

LayoutTests:

Expand the AirplaySupport testing to check that the mute button's enabled state is set to "false"
in AirPlay and add new tests to check that volume controls are correctly hidden when the mute button
is disabled.

* media/modern-media-controls/airplay-support/airplay-support-expected.txt:
* media/modern-media-controls/airplay-support/airplay-support.html:
* media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-volume-controls-hidden-when-mute-button-disabled-expected.txt: Added.
* media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-volume-controls-hidden-when-mute-button-disabled.html: Added.
* media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-top-right-controls-bar-hidden-when-mute-button-disabled-expected.txt: Added.
* media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-top-right-controls-bar-hidden-when-mute-button-disabled.html: Added.
* platform/mac/TestExpectations:

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

3 years agoRemove excessive includes from WebCore/css sources
annulen@yandex.ru [Wed, 28 Jun 2017 20:58:07 +0000 (20:58 +0000)]
Remove excessive includes from WebCore/css sources
https://bugs.webkit.org/show_bug.cgi?id=173919

Reviewed by Simon Fraser.

No new tests needed.

* css/CSSCanvasValue.cpp:
* css/CSSComputedStyleDeclaration.cpp:
* css/CSSContentDistributionValue.cpp:
* css/CSSCrossfadeValue.cpp:
* css/CSSCursorImageValue.cpp:
* css/CSSCustomPropertyValue.cpp:
* css/CSSDefaultStyleSheets.cpp:
* css/CSSFilterImageValue.cpp:
* css/CSSFontFace.cpp:
* css/CSSFontFaceSet.cpp:
* css/CSSFontFaceSource.cpp:
* css/CSSFontFaceSrcValue.cpp:
* css/CSSFontFeatureValue.cpp:
* css/CSSFontSelector.cpp:
* css/CSSFontValue.cpp:
* css/CSSImageGeneratorValue.cpp:
* css/CSSImageSetValue.cpp:
* css/CSSImageValue.cpp:
* css/CSSImportRule.cpp:
* css/CSSKeyframesRule.cpp:
* css/CSSMediaRule.cpp:
* css/CSSNamedImageValue.cpp:
* css/CSSPrimitiveValue.cpp:
* css/CSSProperty.cpp:
* css/CSSPropertySourceData.cpp:
* css/CSSReflectValue.cpp:
* css/CSSRuleList.cpp:
* css/CSSSegmentedFontFace.cpp:
* css/CSSSelector.cpp:
* css/CSSStyleRule.cpp:
* css/CSSStyleSheet.cpp:
* css/CSSSupportsRule.cpp:
* css/CSSToStyleMap.cpp:
* css/CSSValueList.cpp:
* css/CSSValuePool.cpp:
* css/CSSVariableData.cpp:
* css/ElementRuleCollector.cpp:
* css/InspectorCSSOMWrappers.cpp:
* css/MediaList.cpp:
* css/MediaQueryEvaluator.cpp:
* css/MediaQueryExpression.cpp:
* css/PropertySetCSSStyleDeclaration.cpp:
* css/RGBColor.cpp:
* css/SelectorChecker.cpp:
* css/StyleProperties.cpp:
* css/StyleResolver.cpp:
* css/StyleRule.cpp:
* css/StyleSheetContents.cpp:
* css/TransformFunctions.cpp:
* css/ViewportStyleResolver.cpp:
* css/WebKitCSSRegionRule.cpp:
* css/parser/CSSParser.cpp:
* css/parser/CSSParserFastPaths.cpp:
* css/parser/CSSParserIdioms.cpp:
* css/parser/CSSParserSelector.cpp:
* css/parser/CSSParserToken.cpp:
* css/parser/CSSPropertyParser.cpp:
* css/parser/CSSSelectorParser.cpp:
* css/parser/MediaQueryParser.cpp:

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

3 years agoMarked imported/w3c/web-platform-tests/IndexedDB/idbindex_getAllKeys.html as flaky.
jlewis3@apple.com [Wed, 28 Jun 2017 20:24:23 +0000 (20:24 +0000)]
Marked imported/w3c/web-platform-tests/IndexedDB/idbindex_getAllKeys.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=172834

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations:

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

3 years ago[cmake] Improve configuration tests for librt and libatomic
annulen@yandex.ru [Wed, 28 Jun 2017 20:02:07 +0000 (20:02 +0000)]
[cmake] Improve configuration tests for librt and libatomic
https://bugs.webkit.org/show_bug.cgi?id=173921

Reviewed by Michael Catanzaro.

1. Both tests are converted to use specialized CMake modules
2. Both libraries are now linked only if they are really needed and usable
   by compiler
3. librt is no more required to be detected by find_library(), which may fail
   in case of cross-compilation
4. libatomic test moved to port-independent CMakeLists.txt

* CMakeLists.txt:
* PlatformGTK.cmake:

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

3 years agoFix CMake build.
achristensen@apple.com [Wed, 28 Jun 2017 19:46:10 +0000 (19:46 +0000)]
Fix CMake build.

* PlatformMac.cmake:

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

3 years ago[iOS DnD] [WK2] Dragged content flashes after the preview sets down when cancelling...
wenson_hsieh@apple.com [Wed, 28 Jun 2017 19:35:39 +0000 (19:35 +0000)]
[iOS DnD] [WK2] Dragged content flashes after the preview sets down when cancelling a drag
https://bugs.webkit.org/show_bug.cgi?id=173927
<rdar://problem/33020792>

Reviewed by Tim Horton.

When a drag is cancelled, UIKit normally animates fly-back and set-down animations back-to-back. However, for
WebKit2, we need to call out to the web process in order to trigger a repaint of the dragged content at normal
opacity when the drag cancel animation completes. Thus, we can hook into UIKit SPI to split the cancellation
animation into two discrete phases: the fly-back and the set-down (the latter of which may be deferred using a
completion block).

To do this, we implement a new SPI hook, _dragInteraction:item:shouldDelaySetDownAnimationWithCompletion:, to
indicate that the set-down should be deferred, and call the completion block after the next layer tree commit.
Since -shouldDelaySetDownAnimationWithCompletion: is invoked after the UIDragAnimating completion block in
-willAnimateCancelWithAnimator:, this layer tree commit is guaranteed to come after we've told the web process
to repaint at full opacity.

This patch also accounts for additional changes in UIKit. Once -shouldDelaySetDownAnimationWithCompletion:
becomes available, -sessionDidEnd: will no longer be invoked after a cancelled drag lift if the user did not
begin moving. This means that our cleanup logic in -sessionDidEnd: will no longer be executed in this case,
leaving the view with an inconsistent dragging state. To fix this, we need to implement
-dragInteraction:willAnimateLiftWithAnimator:session: to perform drag session cleanup following a cancelled drag
lift, for which the drag animator's final position will be UIViewAnimatingPositionStart.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
(-[WKContentView _dragInteraction:item:shouldDelaySetDownAnimationWithCompletion:]):

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

3 years agoBuild fix for PAL
jbedard@apple.com [Wed, 28 Jun 2017 19:17:46 +0000 (19:17 +0000)]
Build fix for PAL
https://bugs.webkit.org/show_bug.cgi?id=173896

Reviewed by Dan Bernstein.

Remove the workaround build fix in r218863.

* PAL.xcodeproj/project.pbxproj: We should be using PROJECT_DIR instead of SRCROOT
when in a nested Xcode project.

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

3 years agoEnsure that computed new stack pointer values do not underflow.
jfbastien@apple.com [Wed, 28 Jun 2017 18:12:35 +0000 (18:12 +0000)]
Ensure that computed new stack pointer values do not underflow.

Re-apply this patch, it originally broke the ARM build because the llint code
generated `subs xzr, x3, sp` which isn't valid ARM64: the third operand cannot
be SP (that encoding would be ZR instead, subtracting zero). Flip the comparison
and operands to emit valid code (because the second operand can be SP).

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

3 years agoAdjusted test expectations for http/tests/loading/resourceLoadStatistics/telemetry...
jlewis3@apple.com [Wed, 28 Jun 2017 17:47:27 +0000 (17:47 +0000)]
Adjusted test expectations for http/tests/loading/resourceLoadStatistics/telemetry-generation.html.
https://bugs.webkit.org/show_bug.cgi?id=173499

Unreviewed test gardening.

* platform/wk2/TestExpectations:

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

3 years agoRemove unnecessary `const double` method arguments
commit-queue@webkit.org [Wed, 28 Jun 2017 17:16:54 +0000 (17:16 +0000)]
Remove unnecessary `const double` method arguments
https://bugs.webkit.org/show_bug.cgi?id=173925

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

Addressing post-landing feedback from webkit.org/b/173858.

* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::formattedStringForDuration):
* Modules/mediacontrols/MediaControlsHost.h:
* rendering/RenderTheme.h:
(WebCore::RenderTheme::mediaControlsFormattedStringForDuration):
* rendering/RenderThemeCocoa.h:

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

3 years agoMark the GraphicsContext as accelerated when the WebHTMLView's layer is drawing async...
simon.fraser@apple.com [Wed, 28 Jun 2017 16:57:06 +0000 (16:57 +0000)]
Mark the GraphicsContext as accelerated when the WebHTMLView's layer is drawing asynchronously
https://bugs.webkit.org/show_bug.cgi?id=173899
rdar://problem/32994474

Reviewed by Tim Horton.

When the WebHTMLView is layer-backed, and -drawsAsynchronously on its layer is YES,
then mark the GraphicsContext that WebCore is using for drawing as accelerated, so
that ImageBuffer::createCompatibleBuffer() creates appropriately matched buffers.

Also clean up WebFrame a little, sharing code that checks whether the WebFrame's
documentView is a WebHTMLView.

* WebView/WebFrame.mm:
(-[WebFrame _webHTMLDocumentView]):
(-[WebFrame _paintBehaviorForDestinationContext:]):
(-[WebFrame _drawRect:contentsOnly:]):
(-[WebFrame setTimeoutsPaused:]):
(-[WebFrame prepareForPause]):
(-[WebFrame resumeFromPause]):
(-[WebFrame resetTextAutosizingBeforeLayout]):
* WebView/WebHTMLView.mm:
(-[WebHTMLView drawLayer:inContext:]):
(-[WebHTMLView _web_isDrawingIntoAcceleratedLayer]):
* WebView/WebHTMLViewInternal.h:

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

3 years agoUnreviewed, rolling out r218373.
zalan@apple.com [Wed, 28 Jun 2017 16:45:14 +0000 (16:45 +0000)]
Unreviewed, rolling out r218373.

Output is not right

Reverted changeset:

"Use WTFLogAlways for debug logging so that it shows up in
device system logs"
https://bugs.webkit.org/show_bug.cgi?id=173450
http://trac.webkit.org/changeset/218373

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

3 years ago[GTK] Some web pages disappear immediately after rendering
carlosgc@webkit.org [Wed, 28 Jun 2017 16:32:49 +0000 (16:32 +0000)]
[GTK] Some web pages disappear immediately after rendering
https://bugs.webkit.org/show_bug.cgi?id=173768

Reviewed by Xabier Rodriguez-Calvar.

This is happening with websites having a "hidden" class in HTML tag when a media element is added. In the GTK+
port the media controls CSS contains the following code:

.hidden {
    display: none !important;
}

That causes the whole HTML document to become display: none. That's why we just render a white page, and also
the reason why it only happens with the GTK+ port and only with some specific websites. We should limit the
scope of the hidden class to the media control elements.

* css/mediaControlsGtk.css:
(audio::-webkit-media-controls-panel.hidden,):
(audio::-webkit-media-controls-panel div.mute-box.hidden,):
(audio::-webkit-media-controls-current-time-display.hidden,):
(audio::-webkit-media-controls-timeline.hidden,):
(audio::-webkit-media-controls-toggle-closed-captions-button, video::-webkit-media-controls-toggle-closed-captions-button):
(audio::-webkit-media-controls-toggle-closed-captions-button.hidden,):
(video::-webkit-media-controls-closed-captions-container.hidden):
(audio::-webkit-media-controls-fullscreen-button.hidden,):
(.hidden): Deleted.

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

3 years agoMedia controls volume glyph does not have the correct material
graouts@webkit.org [Wed, 28 Jun 2017 16:05:58 +0000 (16:05 +0000)]
Media controls volume glyph does not have the correct material
https://bugs.webkit.org/show_bug.cgi?id=173918
<rdar://problem/33012697>

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-mute-button-in-bottom-or-top-right-controls-bar.html

All buttons were hosted in a ControlsBar save for the MuteButton, so we now host it in a controls bar as well
to ensure compositing is similar to all other buttons.

* Modules/modern-media-controls/controls/inline-media-controls.css:
(.media-controls.inline > .controls-bar.top-right):
(.media-controls.inline > button.mute): Deleted.
* Modules/modern-media-controls/controls/inline-media-controls.js:
(InlineMediaControls):
(InlineMediaControls.prototype.layout):
(InlineMediaControls.prototype._addTopRightBarWithMuteButtonToChildren):
* Modules/modern-media-controls/controls/macos-inline-media-controls.js:
(MacOSInlineMediaControls.prototype.handleEvent):

LayoutTests:

Add a new test to check the mute button is correctly hosted in the top-right controls bar
when width becomes scarce.

* media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-mute-button-in-bottom-or-top-right-controls-bar-expected.txt: Added.
* media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-mute-button-in-bottom-or-top-right-controls-bar.html: Added.
* platform/mac/TestExpectations:

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

3 years agoUnreviewed, rolling out r218869.
cdumez@apple.com [Wed, 28 Jun 2017 15:55:51 +0000 (15:55 +0000)]
Unreviewed, rolling out r218869.

Broke the iOS build

Reverted changeset:

"Ensure that computed new stack pointer values do not
underflow."
https://bugs.webkit.org/show_bug.cgi?id=173700
http://trac.webkit.org/changeset/218869

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

3 years agoUnreviewed, rolling out r218873.
cdumez@apple.com [Wed, 28 Jun 2017 15:54:56 +0000 (15:54 +0000)]
Unreviewed, rolling out r218873.

Broke the iOS build

Reverted changeset:

"Gardening: CLoop build fix."
https://bugs.webkit.org/show_bug.cgi?id=173700
http://trac.webkit.org/changeset/218873

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

3 years ago[GTK] LayoutTest webaudio/silent-audio-interrupted-in-background.html makes its subse...
commit-queue@webkit.org [Wed, 28 Jun 2017 14:24:16 +0000 (14:24 +0000)]
[GTK] LayoutTest webaudio/silent-audio-interrupted-in-background.html makes its subsequent test flaky crash
https://bugs.webkit.org/show_bug.cgi?id=173916

Unreviewed test gardening.

Patch by Fujii Hironori <Hironori.Fujii@sony.com> on 2017-06-28

* platform/gtk/TestExpectations: Marked it Skip.

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

3 years agoGardening: CLoop build fix.
mark.lam@apple.com [Wed, 28 Jun 2017 12:35:05 +0000 (12:35 +0000)]
Gardening: CLoop build fix.
https://bugs.webkit.org/show_bug.cgi?id=173700
<rdar://problem/32926032>

Not reviewed.

* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):

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

3 years agoFix typo in comment: WordResult => WorkResult
ddkilzer@apple.com [Wed, 28 Jun 2017 11:23:39 +0000 (11:23 +0000)]
Fix typo in comment: WordResult => WorkResult

* wtf/AutomaticThread.h:

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

3 years agoAvoid double thread dispatch in WebsiteDataStore::fetchDataForTopPrivatelyControlledD...
cdumez@apple.com [Wed, 28 Jun 2017 07:34:41 +0000 (07:34 +0000)]
Avoid double thread dispatch in WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains()
https://bugs.webkit.org/show_bug.cgi?id=173904

Reviewed by Brent Fulgham.

Avoid double thread dispatch in WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains().
It calls fetchData() which dispatches to the main queue, then fetchDataForTopPrivatelyControlledDomains()
dispatches to the background queue. It should be possible to get fetchData() to dispatch directly
on the right queue.

* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::fetchData):
(WebKit::WebsiteDataStore::fetchDataAndApply):
(WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains):
* UIProcess/WebsiteData/WebsiteDataStore.h:

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

3 years agoREGRESSION(r218799): [GTK][WPE] Critical warning at exit
carlosgc@webkit.org [Wed, 28 Jun 2017 07:20:23 +0000 (07:20 +0000)]
REGRESSION(r218799): [GTK][WPE] Critical warning at exit
https://bugs.webkit.org/show_bug.cgi?id=173907

Reviewed by Konstantin Tokarev.

GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

This is now always happening when closing the MeiniBrowser and it's causing a lot of unit tests to fail. In
r218799, GRefPtrGtk.h include was removed from PasteboardHelper.h that contains a GRefPtr<GtkTargetList>. The
targets are destroyed at exit, but now trying to use g_object_unref instead of gtk_target_list_unref(). I've
found two more cases like this in r218799, that removes GUniquePtrSoup.h from ResourceHandleInternal.h and
ResourceRequest.h that have GUniquePtr<SoupBuffer> and GUniquePtr<SoupURI>.

Fixes several GTK+ and WPE unit tests.

* platform/gtk/PasteboardHelper.h: Bring back GRefPtrGtk.h.
* platform/network/ResourceHandleInternal.h: Bring back GUniquePtrSoup.h.
* platform/network/soup/ResourceRequest.h: Ditto.

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

3 years agoEnsure that computed new stack pointer values do not underflow.
mark.lam@apple.com [Wed, 28 Jun 2017 07:11:57 +0000 (07:11 +0000)]
Ensure that computed new stack pointer values do not underflow.
https://bugs.webkit.org/show_bug.cgi?id=173700
<rdar://problem/32926032>

Reviewed by Filip Pizlo and Saam Barati.

1. Added a RELEASE_ASSERT to BytecodeGenerator::generate() to ensure that
   m_numCalleeLocals is sane.

2. Added underflow checks in LLInt code and VarargsFrame code.

3. Introduce minimumReservedZoneSize, which is hardcoded to 16K.
   Ensure that Options::reservedZoneSize() is at least minimumReservedZoneSize.
   Ensure that Options::softReservedZoneSize() is at least greater than
   Options::reservedZoneSize() by minimumReservedZoneSize.

4. Ensure that stack checks emitted by JIT tiers include an underflow check if
   and only if the max size of the frame is greater than Options::reservedZoneSize().

   By design, we are guaranteed to have at least Options::reservedZoneSize() bytes
   of memory at the bottom (end) of the stack.  This means that, at any time, the
   frame pointer must be at least Options::reservedZoneSize() bytes away from the
   end of the stack.  Hence, if the max frame size is less than
   Options::reservedZoneSize(), there's no way that frame pointer - max
   frame size can underflow, and we can elide the underflow check.

   Note that we use Options::reservedZoneSize() instead of
   Options::softReservedZoneSize() for determine if we need an underflow check.
   This is because the softStackLimit that is used for stack checks can be set
   based on Options::reservedZoneSize() during error handling (e.g. when creating
   strings for instantiating the Error object).  Hence, the guaranteed minimum of
   distance between the frame pointer and the end of the stack is
   Options::reservedZoneSize() and nor Options::softReservedZoneSize().

   Note also that we ensure that Options::reservedZoneSize() is at least
   minimumReservedZoneSize (i.e. 16K).  In typical deployments,
   Options::reservedZoneSize() may be larger.  Using Options::reservedZoneSize()
   instead of minimumReservedZoneSize gives us more chances to elide underflow
   checks.

* JavaScriptCore.xcodeproj/project.pbxproj:
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::generate):
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::requiredRegisterCountForExecutionAndExit):
* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::compile):
(JSC::DFG::JITCompiler::compileFunction):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::lower):
* jit/JIT.cpp:
(JSC::JIT::compileWithoutLinking):
* jit/SetupVarargsFrame.cpp:
(JSC::emitSetupVarargsFrameFastCase):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
* runtime/MinimumReservedZoneSize.h: Added.
* runtime/Options.cpp:
(JSC::recomputeDependentOptions):
* runtime/VM.cpp:
(JSC::VM::updateStackLimits):
* wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::B3IRGenerator):
* wasm/js/WebAssemblyFunction.cpp:
(JSC::callWebAssemblyFunction):

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

3 years agoWebAssembly: running out of executable memory should throw OoM
jfbastien@apple.com [Wed, 28 Jun 2017 06:42:13 +0000 (06:42 +0000)]
WebAssembly: running out of executable memory should throw OoM
https://bugs.webkit.org/show_bug.cgi?id=171537
<rdar://problem/32963338>

Reviewed by Saam Barati.

JSTests:

* wasm.yaml:
* wasm/lowExecutableMemory/executable-memory-oom.js: Added.
(const.invoke):
(failCount.0.catch):
(failCount.0.module.undefined.catch):
* wasm/lowExecutableMemory/exports-oom.js: Added.
(const.type):
(const.params):
(const.randomProgram):
(failCount.0.catch):
(failCount.0.module.undefined.catch):
* wasm/lowExecutableMemory/imports-oom.js: Added.
(const.type):
(const.params):
(const.randomProgram):
(f.imports.push):
(failCount.0.catch):
(failCount.0.module.undefined.catch):

Source/JavaScriptCore:

Both on first compile with BBQ as well as on tier-up with OMG,
running out of X memory shouldn't cause the entire program to
terminate. An exception will do when compiling initial code (since
we don't have any other fallback at the moment), and refusal to
tier up will do as well (it'll just be slower).

This is useful because programs which generate huge amounts of
code simply look like crashes, which developers report to
us. Getting a JavaScript exception instead is much clearer.

* jit/ExecutableAllocator.cpp:
(JSC::ExecutableAllocator::allocate):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::shouldJIT):
* runtime/Options.h:
* wasm/WasmBBQPlan.cpp:
(JSC::Wasm::BBQPlan::prepare):
(JSC::Wasm::BBQPlan::complete):
* wasm/WasmBinding.cpp:
(JSC::Wasm::wasmToJs):
(JSC::Wasm::wasmToWasm):
* wasm/WasmBinding.h:
* wasm/WasmOMGPlan.cpp:
(JSC::Wasm::OMGPlan::work):
* wasm/js/JSWebAssemblyCodeBlock.cpp:
(JSC::JSWebAssemblyCodeBlock::JSWebAssemblyCodeBlock):
* wasm/js/JSWebAssemblyCodeBlock.h:
* wasm/js/JSWebAssemblyInstance.cpp:
(JSC::JSWebAssemblyInstance::finalizeCreation):

Tools:

* Scripts/run-jsc-stress-tests: add a configuration which runs the
tests under limited executable memory and avoids non-WebAssembly
code generation so that we more reliably run out of executable
memory in WebAssembly.

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

3 years agoJITStubRoutine::passesFilter should use isJITPC
sbarati@apple.com [Wed, 28 Jun 2017 06:23:23 +0000 (06:23 +0000)]
JITStubRoutine::passesFilter should use isJITPC
https://bugs.webkit.org/show_bug.cgi?id=173906

Reviewed by JF Bastien.

This patch makes JITStubRoutine use the isJITPC abstraction defined
inside ExecutableAllocator.h. Before, JITStubRoutine was using a
hardcoded platform size constant. This means it'd do the wrong thing
if Options::jitMemoryReservationSize() was larger than the defined
constant for that platform. This patch also removes a bunch of
dead code in that file.

* jit/ExecutableAllocator.cpp:
* jit/ExecutableAllocator.h:
* jit/JITStubRoutine.h:
(JSC::JITStubRoutine::passesFilter):
(JSC::JITStubRoutine::canPerformRangeFilter): Deleted.
(JSC::JITStubRoutine::filteringStartAddress): Deleted.
(JSC::JITStubRoutine::filteringExtentSize): Deleted.

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

3 years agoFix some stale comments in Wasm code base
sbarati@apple.com [Wed, 28 Jun 2017 05:45:59 +0000 (05:45 +0000)]
Fix some stale comments in Wasm code base
https://bugs.webkit.org/show_bug.cgi?id=173814

Reviewed by Mark Lam.

* wasm/WasmBinding.cpp:
(JSC::Wasm::wasmToJs):
* wasm/WasmOMGPlan.cpp:
(JSC::Wasm::runOMGPlanForIndex):

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

3 years ago[ResourceLoadStatistics] Update minimumTimeBetweeenDataRecordsRemoval to 1 hour inste...
cdumez@apple.com [Wed, 28 Jun 2017 05:14:24 +0000 (05:14 +0000)]
[ResourceLoadStatistics] Update minimumTimeBetweeenDataRecordsRemoval to 1 hour instead of 1 minute
https://bugs.webkit.org/show_bug.cgi?id=173895
<rdar://problem/32984366>

Reviewed by Brent Fulgham.

Update minimumTimeBetweeenDataRecordsRemoval to 1 hour instead of 1 minute to save battery.
Also port code to modern time types.

Source/WebCore:

* loader/ResourceLoadObserver.cpp:
(WebCore::reduceTimeResolution):
(WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
(WebCore::ResourceLoadObserver::setTimeToLiveUserInteraction):
(WebCore::ResourceLoadObserver::setTimeToLiveCookiePartitionFree):
(WebCore::ResourceLoadObserver::setMinimumTimeBetweeenDataRecordsRemoval):
(WebCore::ResourceLoadObserver::setReducedTimestampResolution):
(WebCore::ResourceLoadObserver::setGrandfatheringTime):
* loader/ResourceLoadObserver.h:
* loader/ResourceLoadStatistics.h:
(WebCore::ResourceLoadStatistics::mostRecentUserInteractionTime):
* loader/ResourceLoadStatisticsStore.cpp:
(WebCore::ResourceLoadStatisticsStore::createEncoderFromData):
(WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
(WebCore::shouldPartitionCookies):
(WebCore::ResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
(WebCore::ResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree):
(WebCore::ResourceLoadStatisticsStore::setMinimumTimeBetweeenDataRecordsRemoval):
(WebCore::ResourceLoadStatisticsStore::setGrandfatheringTime):
(WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
(WebCore::ResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
(WebCore::ResourceLoadStatisticsStore::handleFreshStartWithEmptyOrNoStore):
(WebCore::ResourceLoadStatisticsStore::shouldRemoveDataRecords):
(WebCore::ResourceLoadStatisticsStore::dataRecordsBeingRemoved):
* loader/ResourceLoadStatisticsStore.h:

Source/WebKit2:

* UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
(WKResourceLoadStatisticsManagerSetTimeToLiveUserInteraction):
(WKResourceLoadStatisticsManagerSetTimeToLiveCookiePartitionFree):
(WKResourceLoadStatisticsManagerSetMinimumTimeBetweeenDataRecordsRemoval):
(WKResourceLoadStatisticsManagerSetGrandfatheringTime):
* UIProcess/WebResourceLoadStatisticsManager.cpp:
(WebKit::WebResourceLoadStatisticsManager::setTimeToLiveUserInteraction):
(WebKit::WebResourceLoadStatisticsManager::setTimeToLiveCookiePartitionFree):
(WebKit::WebResourceLoadStatisticsManager::setMinimumTimeBetweeenDataRecordsRemoval):
(WebKit::WebResourceLoadStatisticsManager::setGrandfatheringTime):
* UIProcess/WebResourceLoadStatisticsManager.h:
* UIProcess/WebResourceLoadStatisticsStore.h:

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

3 years agoPort HysteresisActivity to Seconds type
cdumez@apple.com [Wed, 28 Jun 2017 05:06:03 +0000 (05:06 +0000)]
Port HysteresisActivity to Seconds type
https://bugs.webkit.org/show_bug.cgi?id=173902

Reviewed by Simon Fraser.

Source/WebCore:

* platform/HysteresisActivity.h:
(WebCore::HysteresisActivity::HysteresisActivity):
(WebCore::HysteresisActivity::stop):
* platform/ios/WebSQLiteDatabaseTrackerClient.mm:

Source/WebKit2:

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

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

3 years agoBuild fix for PAL
jbedard@apple.com [Wed, 28 Jun 2017 04:52:09 +0000 (04:52 +0000)]
Build fix for PAL
https://bugs.webkit.org/show_bug.cgi?id=173896

Reviewed by Myles C. Maxfield.

* PAL.xcodeproj/project.pbxproj: Ensure that the SRCROOT is WebCore/PAL and not
just WebCore.

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

3 years agoWeb Inspector: Cleanup RemoteObject tests
joepeck@webkit.org [Wed, 28 Jun 2017 04:23:48 +0000 (04:23 +0000)]
Web Inspector: Cleanup RemoteObject tests
https://bugs.webkit.org/show_bug.cgi?id=173885

Reviewed by Matt Baker.

* inspector/model/remote-object-dom.html: Added.
* inspector/model/remote-object-expected.txt:
* inspector/model/remote-object.html:
Split out DOM results (which differ across ports and features).

* inspector/model/resources/remote-object-utilities.js:
(TestPage.registerInitializer.window.runSteps):
This should have been a continue not a return.

* platform/mac/inspector/model/remote-object-dom-expected.txt: Added.
* platform/mac/inspector/model/remote-object-expected.txt: Removed.
Platform expectations are now limited to just the DOM test.

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

3 years ago[ESnext] Implement Object Rest - Implementing Object Rest Destructuring
ticaiolima@gmail.com [Wed, 28 Jun 2017 03:05:47 +0000 (03:05 +0000)]
[ESnext] Implement Object Rest - Implementing Object Rest Destructuring
https://bugs.webkit.org/show_bug.cgi?id=167962

Reviewed by Saam Barati.

JSTests:

* stress/object-rest-deconstruct.js: Added.
(let.assert):
(let.assertPropDescriptor):
(catch):
(get 3):
(foo):
(let.src.get y):
(let.src.set y):
(let.gen):

Source/JavaScriptCore:

Object Rest/Spread Destructing proposal is in stage 3[1] and this
Patch is a prototype implementation of it. A simple change over the
parser was necessary to support the new '...' token on Object Pattern
destruction rule. In the bytecode generator side, We changed the
bytecode generated on ObjectPatternNode::bindValue to store in an
set the identifiers of already destructured properties, following spec draft
section[2], and then pass it as excludedNames to CopyDataProperties.
The rest destructuring calls copyDataProperties to perform the
copy of rest properties in rhs.

We also implemented CopyDataProperties as private JS global operation
on builtins/GlobalOperations.js following it's specification on [3].
It is implemented using Set object to verify if a property is on
excludedNames to keep this algorithm with O(n + m) complexity, where n
= number of source's own properties and m = excludedNames.length.

In this implementation we aren't using excludeList as constant if
destructuring pattern contains computed property, i.e. we can
just determine the key to be excluded at runtime. If we can define all
identifiers in the pattern in compile time, we then create a
constant JSSet. This approach gives a good performance improvement,
since we allocate the excludeSet just once, reducing GC pressure.

[1] - https://github.com/tc39/proposal-object-rest-spread
[2] - https://tc39.github.io/proposal-object-rest-spread/#Rest-RuntimeSemantics-PropertyDestructuringAssignmentEvaluation
[3] - https://tc39.github.io/proposal-object-rest-spread/#AbstractOperations-CopyDataProperties

* builtins/BuiltinNames.h:
* builtins/GlobalOperations.js:
(globalPrivate.copyDataProperties):
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::finishCreation):
* bytecompiler/NodesCodegen.cpp:
(JSC::ObjectPatternNode::bindValue):
* parser/ASTBuilder.h:
(JSC::ASTBuilder::appendObjectPatternEntry):
(JSC::ASTBuilder::appendObjectPatternRestEntry):
(JSC::ASTBuilder::setContainsObjectRestElement):
* parser/Nodes.h:
(JSC::ObjectPatternNode::appendEntry):
(JSC::ObjectPatternNode::setContainsRestElement):
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseDestructuringPattern):
(JSC::Parser<LexerType>::parseProperty):
* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::operatorStackPop):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::asyncFunctionStructure):
(JSC::JSGlobalObject::setStructure): Deleted.
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::privateToObject):
* runtime/JSGlobalObjectFunctions.h:
* runtime/ObjectConstructor.cpp:
(JSC::ObjectConstructor::finishCreation):
* runtime/SetPrototype.cpp:
(JSC::SetPrototype::finishCreation):

Source/WTF:

* wtf/HashSet.h:
(WTF::=):

LayoutTests:

* js/parser-syntax-check-expected.txt:
* js/script-tests/parser-syntax-check.js:

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

3 years agoMove WebsiteDataRecord processing off-thread in WebsiteDataStore::fetchDataForTopPriv...
cdumez@apple.com [Wed, 28 Jun 2017 01:47:15 +0000 (01:47 +0000)]
Move WebsiteDataRecord processing off-thread in WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains()
https://bugs.webkit.org/show_bug.cgi?id=173882
<rdar://problem/32984366>

Reviewed by Darin Adler.

Move WebsiteDataRecord processing off-thread in WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains()
as we have data showing it is slow and hangs the UIProcess' main thread.

* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains):

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

3 years agoUnreviewed, unmark workers/bomb.html flakiness after r218856
utatane.tea@gmail.com [Wed, 28 Jun 2017 01:09:03 +0000 (01:09 +0000)]
Unreviewed, unmark workers/bomb.html flakiness after r218856

* platform/gtk-wayland/TestExpectations:
* platform/ios-device/TestExpectations:
* platform/ios-wk2/TestExpectations:
* platform/mac/TestExpectations:

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

3 years ago[WK2][macOS] Expand sandbox to allow access to the CoreMedia volume control endpoint
bfulgham@apple.com [Wed, 28 Jun 2017 01:06:53 +0000 (01:06 +0000)]
[WK2][macOS] Expand sandbox to allow access to the CoreMedia volume control endpoint
https://bugs.webkit.org/show_bug.cgi?id=173898
<rdar://problem/32930754>

Reviewed by Ryosuke Niwa.

* WebProcess/com.apple.WebProcess.sb.in:

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

3 years agoMediaPlayerPrivate m_private may not yet be created when setPrivateBrowsingMode is...
commit-queue@webkit.org [Wed, 28 Jun 2017 01:04:29 +0000 (01:04 +0000)]
MediaPlayerPrivate m_private may not yet be created when setPrivateBrowsingMode is called.
https://bugs.webkit.org/show_bug.cgi?id=173893
rdar://problem/32986872

Patch by Jeremy Jones <jeremyj@apple.com> on 2017-06-27
Reviewed by Ryosuke Niwa.

No new tests because no reproducable case.

setPrivateBrowsingMode can be called on MediaPlayer before the MediaPlayerPrivate is created.
The value should only be pushed down the m_private if it has been created.

* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::setPrivateBrowsingMode):

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

3 years ago[JSC] Do not touch VM after notifying Ready in DFG::Worklist
utatane.tea@gmail.com [Wed, 28 Jun 2017 00:46:50 +0000 (00:46 +0000)]
[JSC] Do not touch VM after notifying Ready in DFG::Worklist
https://bugs.webkit.org/show_bug.cgi?id=173888

Reviewed by Saam Barati.

After notifying Plan::Ready and releasing Worklist lock, VM can be destroyed.
Thus, Plan::vm() can return a destroyed VM. Do not touch it.
This causes occasional SEGV / assertion failures in workers/bomb test.

* dfg/DFGWorklist.cpp:

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

3 years ago[iOS DnD] Support dragging out of contenteditable areas without a prior selection
wenson_hsieh@apple.com [Wed, 28 Jun 2017 00:36:31 +0000 (00:36 +0000)]
[iOS DnD] Support dragging out of contenteditable areas without a prior selection
https://bugs.webkit.org/show_bug.cgi?id=173854
<rdar://problem/32236827>

Reviewed by Ryosuke Niwa and Tim Horton.

Source/WebCore:

Allows elements to be dragged from contenteditable areas for both WebKit1 and WebKit2 iOS. There are two main
changes in WebCore: move the touch point adjustment code into EventHandler::tryToBeginDataInteractionAtPoint, so
that the clientPosition specified will be adjusted to an appropriate clickable node if needed. This is necessary
because UIWebDocumentView and WKContentView no longer send adjusted points to WebCore when requesting drag
start. See <https://bugs.webkit.org/show_bug.cgi?id=173855> for a followup regarding the globalPosition and
clientPositions passed in to the MouseEvents when performing a drag or synthetic click.

Secondly, image elements in Mail's contenteditable area are not draggable unless the heuristic in
DragController::draggableElement is tweaked to not reject image dragging across the board if the
loadsImagesAutomatically setting is turned off. Instead, even if images are not automatically loaded, allow the
image drag to commence if the image renderer already has a cached image.

Test: DataInteractionTests.DragImageFromContentEditable

* page/DragController.cpp:
(WebCore::imageElementIsDraggable):
(WebCore::DragController::draggableElement):
* page/ios/EventHandlerIOS.mm:
(WebCore::EventHandler::tryToBeginDataInteractionAtPoint):

Source/WebKit/mac:

Vends some information from the DragItem passed into -[WebView _startDrag:] through the WebView as SPI for
WebKit1 clients. No behavior change with these changes alone -- see <rdar://problem/32991062> for more detail.

* WebView/WebView.mm:
(-[WebView _startDrag:]):
(-[WebView _dragSourceAction]):
(-[WebView _draggedLinkTitle]):
(-[WebView _draggedLinkURL]):
(-[WebView _draggedElementBounds]):
(-[WebView _endedDataInteraction:global:]):
* WebView/WebViewData.h:
* WebView/WebViewPrivate.h:

Source/WebKit2:

Instead of allowing a drag to occur only if a position information request discovers a clickable node, remove
the position information request entirely and just call into WebCore to try and begin the drag. Currently, the
position information request serves two purposes:
1. To adjust the hit-test location to account for nearby clickable nodes.
2. To obtain information about the content being dragged.

The first requirement is fulfilled by performing the drag location adjustment in WebCore instead (see
ChangeLogs for more detail). The second requirement is fulfilled by refactoring in
https://bugs.webkit.org/show_bug.cgi?id=173832 to fold all information relevant to starting a drag into the
DragItem struct, and then propagating the DragItem struct. The relevant information from the position
information update is now populated when the UI process receives the drag start response.

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _startDrag:item:]):
(-[WKContentView computeClientAndGlobalPointsForDropSession:outClientPoint:outGlobalPoint:]):
(-[WKContentView _dragInteraction:prepareForSession:completion:]):
(-[WKContentView _api_dropInteraction:sessionDidEnter:]):
(-[WKContentView _api_dropInteraction:sessionDidUpdate:]):
(positionInformationMayStartDataInteraction): Deleted.

Tools:

Adds a new test to check that an image can be dragged out of a contenteditable and dropped.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/contenteditable-and-target.html: Added.
* TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
(TestWebKitAPI::TEST):

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

3 years agoMarked http/tests/loading/resourceLoadStatistics/telemetry-generation.html as flaky.
jlewis3@apple.com [Tue, 27 Jun 2017 23:55:27 +0000 (23:55 +0000)]
Marked http/tests/loading/resourceLoadStatistics/telemetry-generation.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=173499

Unreviewed test gardening.

* platform/wk2/TestExpectations:

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

3 years ago[Modern Media Controls] Accessibility labels should be formatted using NSDateComponen...
commit-queue@webkit.org [Tue, 27 Jun 2017 23:48:22 +0000 (23:48 +0000)]
[Modern Media Controls] Accessibility labels should be formatted using NSDateComponentsFormatter
https://bugs.webkit.org/show_bug.cgi?id=173858
<rdar://problem/32643171>

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

Source/WebCore:

We shouldn't be manually trying to create a formatted string for media controls and instead rely
on NSDateComponentsFormatter to perform this task for us. So we remove the ad-hoc code in the JS
media controls code and instead add a new MediaControlsHost method to format durations which calls
into RenderTheme to provide a formatted duration string relevant to the current platform and locale.

* English.lproj/modern-media-controls-localized-strings.js:
* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::formattedStringForDuration):
* Modules/mediacontrols/MediaControlsHost.h:
* Modules/mediacontrols/MediaControlsHost.idl:
* Modules/modern-media-controls/controls/slider.js:
(Slider.prototype.set inputAccessibleLabel):
* Modules/modern-media-controls/controls/time-label.js:
(TimeLabel.prototype.commitProperty):
* Modules/modern-media-controls/main.js:
(createControls):
(formattedStringForDuration):
(formatTimeToString): Deleted.
* rendering/RenderTheme.h:
(WebCore::RenderTheme::mediaControlsFormattedStringForDuration):
* rendering/RenderThemeCocoa.h:
* rendering/RenderThemeCocoa.mm:
(WebCore::RenderThemeCocoa::mediaControlsFormattedStringForDuration):

LayoutTests:

* media/modern-media-controls/scrubber/scrubber-has-correct-ax-label-expected.txt:
* media/modern-media-controls/scrubber/scrubber-has-correct-ax-label.html:

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

3 years agor218647 causes getUserMedia to fail on some machines
eric.carlson@apple.com [Tue, 27 Jun 2017 23:40:07 +0000 (23:40 +0000)]
r218647 causes getUserMedia to fail on some machines
https://bugs.webkit.org/show_bug.cgi?id=173894

Reviewed by Youenn Fablet.

* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::isFrameRateSupported): Change frame rate epsilon from 0.00001
to 0.001.

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

3 years agoPlacard icons act like buttons (can get keyboard focus and shows up in VoiceOver)
commit-queue@webkit.org [Tue, 27 Jun 2017 23:29:22 +0000 (23:29 +0000)]
Placard icons act like buttons (can get keyboard focus and shows up in VoiceOver)
https://bugs.webkit.org/show_bug.cgi?id=173891
<rdar://problem/33011855>

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

Source/WebCore:

Ensure that we disable buttons inside placards as they're only decorative and should
not be interactive.

* Modules/modern-media-controls/controls/placard.js:
(Placard.):

LayoutTests:

Update the Placard test to check that its <button> is disabled.

* media/modern-media-controls/placard/placard-expected.txt:
* media/modern-media-controls/placard/placard.html:

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

3 years agoUpdate boringssl to c8ff30cbe716c72279a6f6a9d7d7d0d4091220fa
achristensen@apple.com [Tue, 27 Jun 2017 23:05:07 +0000 (23:05 +0000)]
Update boringssl to c8ff30cbe716c72279a6f6a9d7d7d0d4091220fa
https://bugs.webkit.org/show_bug.cgi?id=173676

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

* Configurations/boringssl.xcconfig: Enabling ASM.
* Source/third_party/boringssl/BUILD.generated.gni:
* Source/third_party/boringssl: Updated folder according new revision.
* WebKit/patch-boringssl: Added, needed to fix some files to disable warnings.
* libwebrtc.xcodeproj/project.pbxproj:

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

3 years agoRefresh usrsctp to Source/ThirdParty/libwebrtc/WebKit/patch-usrsctp and libsrtp to...
achristensen@apple.com [Tue, 27 Jun 2017 22:54:19 +0000 (22:54 +0000)]
Refresh usrsctp to Source/ThirdParty/libwebrtc/WebKit/patch-usrsctp and libsrtp to ccf84786f8ef803cb9c75e919e5a3976b9f5a67
https://bugs.webkit.org/show_bug.cgi?id=173673

Patch by Youenn Fablet <youenn@apple.com> on 2017-06-27
Reviewed by Sam Weinig.

* Source/third_party/libsrtp/README.chromium:
* Source/third_party/libsrtp/srtp/srtp.c:
(srtp_stream_init_keys):
(srtp_calc_aead_iv_srtcp):
(srtp_protect_rtcp_aead):
(srtp_unprotect_rtcp_aead):
* Source/third_party/libsrtp/test/srtp_driver.c:
(srtp_validate_encrypted_extensions_headers_gcm):
* Source/third_party/usrsctp/usrsctplib/.gitignore: Added.
* Source/third_party/usrsctp/usrsctplib/CMakeLists.txt:
* Source/third_party/usrsctp/usrsctplib/Makefile.am:
* Source/third_party/usrsctp/usrsctplib/README.md:
* Source/third_party/usrsctp/usrsctplib/configure.ac:
* Source/third_party/usrsctp/usrsctplib/programs/CMakeLists.txt:
* Source/third_party/usrsctp/usrsctplib/programs/Makefile.am:
* Source/third_party/usrsctp/usrsctplib/programs/client.c:
(main):
* Source/third_party/usrsctp/usrsctplib/programs/datachan_serv.c:
(main):
* Source/third_party/usrsctp/usrsctplib/programs/ekr_loop_offload.c: Added.
(handle_packets):
* Source/third_party/usrsctp/usrsctplib/programs/test_timer.c: Added.
(main):
* Source/third_party/usrsctp/usrsctplib/usrsctp.pc.in: Added.
* Source/third_party/usrsctp/usrsctplib/usrsctplib/CMakeLists.txt:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_asconf.c:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_asconf.h:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_auth.c:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_auth.h:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_bsd_addr.c:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_bsd_addr.h:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_cc_functions.c:
(sctp_cwnd_update_after_fr):
(sctp_hs_cwnd_update_after_fr):
(sctp_htcp_cwnd_update_after_fr):
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_constants.h:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_crc32.c:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_crc32.h:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_header.h:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_indata.c:
(sctp_build_readq_entry):
(sctp_place_control_in_stream):
(sctp_abort_in_reasm):
(sctp_queue_data_to_stream):
(sctp_build_readq_entry_from_ctl):
(sctp_handle_old_unordered_data):
(sctp_inject_old_unordered_data):
(sctp_deliver_reasm_check):
(sctp_add_chk_to_control):
(sctp_queue_data_for_reasm):
(sctp_find_reasm_entry):
(sctp_process_a_data_chunk):
(sctp_sack_check):
(sctp_process_segment_range):
(sctp_check_for_revoked):
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_indata.h:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.c:
(sctp_process_init):
(sctp_process_cookie_existing):
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.h:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_output.c:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_output.h:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_pcb.c:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_pcb.h:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_peeloff.h:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_ss_functions.c:
(sctp_ss_rr_add):
(sctp_ss_fcfs_select):
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_structs.h:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_sysctl.c:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_timer.c:
(sctp_recover_sent_list):
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_uio.h:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_usrreq.c:
(sctp_init):
(sctp_pathmtu_adjustment):
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_var.h:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctputil.c:
(sctp_log_strm_del):
(sctp_init_asoc):
(sctp_notify_send_failed):
(sctp_notify_send_failed2):
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctputil.h:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet6/sctp6_usrreq.c:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/netinet6/sctp6_var.h:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/user_mbuf.c:
(m_get):
(mbuf_initialize):
* Source/third_party/usrsctp/usrsctplib/usrsctplib/user_mbuf.h:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/user_socket.c:
* Source/third_party/usrsctp/usrsctplib/usrsctplib/usrsctp.h:
* WebKit/patch-usrsctp: Added.

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

3 years agoRemove an inaccurate comment inside DFGClobberize.h
sbarati@apple.com [Tue, 27 Jun 2017 22:43:20 +0000 (22:43 +0000)]
Remove an inaccurate comment inside DFGClobberize.h
https://bugs.webkit.org/show_bug.cgi?id=163874

Reviewed by Filip Pizlo.

The comment said that Clobberize may or may not be sound if run prior to
doing type inference. This is not correct, though. Clobberize *must* be sound
prior do doing type inference since we use it inside the BytecodeParser, which
is the very first thing the DFG does.

* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):

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

3 years agoDisable m_temporarilyAllowingInlinePlaybackAfterFullscreen on pause
commit-queue@webkit.org [Tue, 27 Jun 2017 22:39:21 +0000 (22:39 +0000)]
Disable m_temporarilyAllowingInlinePlaybackAfterFullscreen on pause
https://bugs.webkit.org/show_bug.cgi?id=173843
rdar://problem/32982431

Patch by Jeremy Jones <jeremyj@apple.com> on 2017-06-27
Reviewed by Eric Carlson.

Source/WebCore:

Test: media/media-fullscreen-pause-inline.html

Some pages may not have a fullscreen button, so disabled m_temporarilyAllowingInlinePlaybackAfterFullscreen on pause.

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

LayoutTests:

Some pages may not have a fullscreen button, so disabled m_temporarilyAllowingInlinePlaybackAfterFullscreen on pause.

* media/media-fullscreen-pause-inline-expected.txt: Added.
* media/media-fullscreen-pause-inline.html: Added.
* platform/mac-wk2/TestExpectations:

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

3 years ago[iOS] Avoid taking / releasing process assertions too quickly due to database activity
cdumez@apple.com [Tue, 27 Jun 2017 21:49:04 +0000 (21:49 +0000)]
[iOS] Avoid taking / releasing process assertions too quickly due to database activity
https://bugs.webkit.org/show_bug.cgi?id=173879
<rdar://problem/32412701>

Reviewed by Antti Koivisto.

Source/WebCore:

Add HysteresisActivity to WebSQLiteDatabaseTrackerClient to avoid taking / releasing
process assertion too quickly due to database activity.

* platform/ios/WebSQLiteDatabaseTrackerClient.h:
* platform/ios/WebSQLiteDatabaseTrackerClient.mm:
(WebCore::WebSQLiteDatabaseTrackerClient::WebSQLiteDatabaseTrackerClient):
(WebCore::WebSQLiteDatabaseTrackerClient::willBeginFirstTransaction):
(WebCore::WebSQLiteDatabaseTrackerClient::didFinishLastTransaction):
(WebCore::WebSQLiteDatabaseTrackerClient::hysteresisUpdated):

Source/WebKit2:

Specify an activity name when taking the process assertion to facilitate
debugging in the future. It took me a while to figure out this assertion
was the one that was too aggressive because it was anonymous.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _setUpSQLiteDatabaseTrackerClient]):

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

3 years agoFunction constructor needs to follow the spec and validate parameters and body indepe...
sbarati@apple.com [Tue, 27 Jun 2017 21:37:46 +0000 (21:37 +0000)]
Function constructor needs to follow the spec and validate parameters and body independently
https://bugs.webkit.org/show_bug.cgi?id=173303
<rdar://problem/32732526>

Reviewed by Keith Miller.

JSTests:

* ChakraCore/test/Function/FuncBodyES5.baseline-jsc:
* stress/function-constructor-semantics.js: Added.
(assert):
(hasSyntaxError):
(foo):
(async.foo):
(testError):
(testOK.toString):
(toString):

LayoutTests/imported/w3c:

* web-platform-tests/html/webappapis/scripting/events/inline-event-handler-ordering-expected.txt:
* web-platform-tests/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-late-expected.txt:
* web-platform-tests/html/webappapis/scripting/processing-model-2/compile-error-in-attribute-expected.txt:
* web-platform-tests/html/webappapis/scripting/processing-model-2/compile-error-in-body-onerror-expected.txt:

Source/JavaScriptCore:

The Function constructor must check the arguments and body strings
independently for syntax errors. People rely on this specified behavior
to verify that a particular string is a valid function body. We used
to check these things strings concatenated together, instead of
independently. For example, this used to be valid: `Function("/*", "*/){")`.
However, we should throw a syntax error here since "(/*)" is not a valid
parameter list, and "*/){" is not a valid body.

To implement the specified behavior, we check the syntax independently of
both the body and the parameter list. To check that the parameter list has
valid syntax, we check that it is valid if in a function with an empty body.
To check that the body has valid syntax, we check it is valid in a function
with an empty parameter list.

* runtime/FunctionConstructor.cpp:
(JSC::constructFunctionSkippingEvalEnabledCheck):

LayoutTests:

* fast/dom/attribute-event-listener-errors-expected.txt:
* fast/events/attribute-listener-deletion-crash-expected.txt:
* fast/events/window-onerror-syntax-error-in-attr-expected.txt:
* js/dom/invalid-syntax-for-function-expected.txt:

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

3 years agoUsing public logging for WebRTC release logging
commit-queue@webkit.org [Tue, 27 Jun 2017 21:35:25 +0000 (21:35 +0000)]
Using public logging for WebRTC release logging
https://bugs.webkit.org/show_bug.cgi?id=173881

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

No change of behavior.

* Modules/mediastream/PeerConnectionBackend.cpp:
(WebCore::PeerConnectionBackend::createOfferSucceeded):
(WebCore::PeerConnectionBackend::createOfferFailed):
(WebCore::PeerConnectionBackend::createAnswerSucceeded):
(WebCore::PeerConnectionBackend::createAnswerFailed):
(WebCore::PeerConnectionBackend::setLocalDescriptionFailed):
(WebCore::PeerConnectionBackend::setRemoteDescriptionFailed):
(WebCore::PeerConnectionBackend::addIceCandidateFailed):
(WebCore::PeerConnectionBackend::newICECandidate):
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::queuedSetLocalDescription):
(WebCore::RTCPeerConnection::queuedSetRemoteDescription):
(WebCore::RTCPeerConnection::queuedAddIceCandidate):
(WebCore::RTCPeerConnection::updateIceGatheringState):
(WebCore::RTCPeerConnection::updateIceConnectionState):
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered):

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

3 years ago[PAL] Add symbol export macros for PAL
don.olmstead@sony.com [Tue, 27 Jun 2017 21:30:01 +0000 (21:30 +0000)]
[PAL] Add symbol export macros for PAL
https://bugs.webkit.org/show_bug.cgi?id=171519

Reviewed by Konstantin Tokarev.

Source/WebCore:

No new tests. No change in behavior.

* CMakeLists.txt:
* config.h:
* platform/PlatformExportMacros.h:

Source/WebCore/PAL:

No new tests. No change in behavior.

* Configurations/CopyPALHeaders.xcconfig: Added.
* PAL.xcodeproj/project.pbxproj:
* config.h:
* pal/ExportMacros.h: Copied from Source/WebCore/platform/PlatformExportMacros.h.
* pal/PlatformWin.cmake:
* pal/crypto/CryptoDigest.h:

Source/WebKit2:

* config.h:

Tools:

* DumpRenderTree/config.h:
* TestWebKitAPI/CMakeLists.txt:
* TestWebKitAPI/config.h:
* WebKitTestRunner/config.h:

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

3 years agoProcessLauncherMac could leak a xpc connection when the process had failed to launch
rniwa@webkit.org [Tue, 27 Jun 2017 21:23:22 +0000 (21:23 +0000)]
ProcessLauncherMac could leak a xpc connection when the process had failed to launch
https://bugs.webkit.org/show_bug.cgi?id=173865

Reviewed by Antti Koivisto.

Explicitly cancel the XPC connection even When the process launch had failed to avoid a leak.

* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::ProcessLauncher::launchProcess):

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

3 years agoResource Load Statistics: Add telemetry
wilander@apple.com [Tue, 27 Jun 2017 21:10:24 +0000 (21:10 +0000)]
Resource Load Statistics: Add telemetry
https://bugs.webkit.org/show_bug.cgi?id=173499
<rdar://problem/32826094>

Reviewed by Brent Fulgham.

Source/WebCore:

Test: http/tests/loading/resourceLoadStatistics/telemetry-generation.html

* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::fireTelemetryHandler):
    Test infrastructure.
* loader/ResourceLoadObserver.h:
* loader/ResourceLoadStatisticsStore.cpp:
(WebCore::ResourceLoadStatisticsStore::setFireTelemetryCallback):
(WebCore::ResourceLoadStatisticsStore::fireTelemetryHandler):
    Test infrastructure.
(WebCore::ResourceLoadStatisticsStore::sortedPrevalentResourceTelemetry):
    Convenience function for telemetry.
* loader/ResourceLoadStatisticsStore.h:
    Added struct WebCore::PrevalentResourceTelemetry.
* page/DiagnosticLoggingKeys.cpp:
(WebCore::DiagnosticLoggingKeys::resourceLoadStatisticsTelemetryKey):
    Added.
* page/DiagnosticLoggingKeys.h:

Source/WebKit2:

* PlatformGTK.cmake:
    Added UIProcess/WebResourceLoadStatisticsTelemetry.cpp
* PlatformMac.cmake:
    Added UIProcess/WebResourceLoadStatisticsTelemetry.cpp
* PlatformWPE.cmake:
    Added UIProcess/WebResourceLoadStatisticsTelemetry.cpp
* UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
(WKResourceLoadStatisticsManagerFireTelemetryHandler):
(WKResourceLoadStatisticsManagerSetNotifyPagesWhenTelemetryWasCaptured):
    Test infrastructure.
* UIProcess/API/C/WKResourceLoadStatisticsManager.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::notifyPageStatisticsTelemetryFinished):
    Test infrastructure.
* UIProcess/WebProcessProxy.h:
* UIProcess/WebResourceLoadStatisticsManager.cpp:
(WebKit::WebResourceLoadStatisticsManager::fireTelemetryHandler):
(WebKit::WebResourceLoadStatisticsManager::setNotifyPagesWhenTelemetryWasCaptured):
(WebKit::WebResourceLoadStatisticsManager::resetToConsistentState):
    Test infrastructure.
* UIProcess/WebResourceLoadStatisticsManager.h:
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
    Configures a timer for telemetry capture. Fires 5 seconds after launch
    and then every 24 hours.
(WebKit::WebResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned):
    Variable renamed notifyPages -> notifyPagesWhenDataRecordsWereScanned.
(WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
    Variable renamed notifyPages -> notifyPagesWhenDataRecordsWereScanned.
(WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
    Variable renamed notifyPages -> notifyPagesWhenDataRecordsWereScanned.
(WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
    Variable renamed notifyPages -> notifyPagesWhenDataRecordsWereScanned.
(WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
    Variable renamed notifyPages -> notifyPagesWhenDataRecordsWereScanned.
(WebKit::WebResourceLoadStatisticsStore::telemetryTimerFired):
     Calls WebResourceLoadStatisticsTelemetry::calculateAndSubmit().
* UIProcess/WebResourceLoadStatisticsStore.h:
* UIProcess/WebResourceLoadStatisticsTelemetry.cpp: Added.
(WebKit::numberOfResourcesWithUserInteraction):
(WebKit::median):
(WebKit::nonEphemeralWebPageProxy):
(WebKit::submitTopList):
(WebKit::submitTopLists):
(WebKit::notifyPages):
(WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
(WebKit::WebResourceLoadStatisticsTelemetry::setNotifyPagesWhenTelemetryWasCaptured):
* UIProcess/WebResourceLoadStatisticsTelemetry.h: Added.
* WebKit2.xcodeproj/project.pbxproj:

Tools:

Adds three new testRunner functions:
- installStatisticsDidRunTelemetryCallback()
- statisticsFireTelemetryHandler()
- setStatisticsNotifyPagesWhenTelemetryWasCaptured()

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::didReceiveMessageToPage):
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::installStatisticsDidRunTelemetryCallback):
(WTR::TestRunner::statisticsDidRunTelemetryCallback):
(WTR::TestRunner::statisticsFireTelemetryHandler):
(WTR::TestRunner::setStatisticsNotifyPagesWhenTelemetryWasCaptured):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues):
(WTR::TestController::statisticsFireTelemetryHandler):
(WTR::TestController::setStatisticsNotifyPagesWhenTelemetryWasCaptured):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):

LayoutTests:

* http/tests/loading/resourceLoadStatistics/telemetry-generation-expected.txt: Added.
* http/tests/loading/resourceLoadStatistics/telemetry-generation.html: Added.
* platform/wk2/TestExpectations:
    Enabled here since ResourceLoadStatistics is WK2-only.

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

3 years agoAdd missing includes to fix compilation error on FreeBSD
commit-queue@webkit.org [Tue, 27 Jun 2017 21:06:04 +0000 (21:06 +0000)]
Add missing includes to fix compilation error on FreeBSD
https://bugs.webkit.org/show_bug.cgi?id=172919

Patch by Ting-Wei Lan <lantw44@gmail.com> on 2017-06-27
Reviewed by Mark Lam.

Source/JavaScriptCore:

* API/JSRemoteInspector.h:
* API/tests/GlobalContextWithFinalizerTest.cpp:
* API/tests/TypedArrayCTest.cpp:

Source/WebCore:

No new tests needed.

* crypto/gcrypt/CryptoKeyECGCrypt.cpp:
* platform/audio/ReverbAccumulationBuffer.cpp:

Source/WebKit2:

* UIProcess/API/C/WKContextPrivate.h:
* UIProcess/API/C/WKPagePrivate.h:
* UIProcess/ProcessAssertion.h:

Tools:

* ImageDiff/cairo/PlatformImageCairo.cpp:

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

3 years agoWeb Inspector: no discoverable way to dismiss the split console
mattbaker@apple.com [Tue, 27 Jun 2017 21:01:54 +0000 (21:01 +0000)]
Web Inspector: no discoverable way to dismiss the split console
https://bugs.webkit.org/show_bug.cgi?id=167034
<rdar://problem/30023436>

Reviewed by Devin Rousso.

This patch adds an Xcode-style toggle button to the left of the
split console navigation bar. Additionally, the split console code
has been broken out into it's own class to reduce the clutter in
Main.js/css, and simplify future console maintenance.

* Localizations/en.lproj/localizedStrings.js:

* UserInterface/Base/Main.js:
(WebInspector.loaded):
Replace the "split" ContentBrowser with a new ConsoleDrawer class,
which encapsulates the drawer height setting and resize behavior.
(WebInspector.contentLoaded):
The console drawer manages its own height.

* UserInterface/Images/HideConsoleDrawer.svg: Added.
* UserInterface/Images/ShowConsoleDrawer.svg: Added.
Console drawer toggle button images. Styled after corresponding Xcode button.

* UserInterface/Main.html:

* UserInterface/Views/ConsoleDrawer.css: Added.
Moved old #split-content-browser styles over from Main.css.
(.console-drawer):
(.console-drawer > .navigation-bar):
(.console-drawer > .navigation-bar > .item.button:not(.clear-log)):
Make button spacing less cramped.
(.console-drawer > .navigation-bar > .item:not(.flexible-space)):
(.console-drawer > .navigation-bar > :matches(.item.button, .log-scope-bar)):
(.console-drawer > .navigation-bar > .item > .glyph,):

* UserInterface/Views/ConsoleDrawer.js: Added.
New class responsible for console drawer expand / collapse and resizer
dragging, which was previously part of Main.js. The console drawer toolbar
now has a toggle button, debugging controls, and a call frames path item.
The "Show Console Tab" button has been removed.

(WebInspector.ConsoleDrawer):
(WebInspector.ConsoleDrawer.prototype.get collapsed):
(WebInspector.ConsoleDrawer.prototype.set collapsed):
(WebInspector.ConsoleDrawer.prototype.get height):
(WebInspector.ConsoleDrawer.prototype.shown):
(WebInspector.ConsoleDrawer.prototype.layout):
(WebInspector.ConsoleDrawer.prototype._consoleResizerMouseDown.dockedResizerDrag):
(WebInspector.ConsoleDrawer.prototype._consoleResizerMouseDown.dockedResizerDragEnd):
(WebInspector.ConsoleDrawer.prototype._consoleResizerMouseDown):
(WebInspector.ConsoleDrawer.prototype._restoreDrawerHeight):
(WebInspector.ConsoleDrawer.prototype._updateDrawerHeight):
(WebInspector.ConsoleDrawer.prototype._selectedTabContentViewDidChange):
When switching to a tab that doesn't support showing the console drawer,
hide it without altering the collapsed state.

* UserInterface/Views/LogContentView.js:
(WebInspector.LogContentView.prototype.get navigationItems):

* UserInterface/Views/Main.css:
Renamed #split-content-browser to #console-drawer, and moved related
styles to ConsoleDrawer.css.

(#split-content-browser): Deleted.
(#split-content-browser > .navigation-bar): Deleted.
(#split-content-browser > .navigation-bar :matches(.find-banner, .find-banner + .divider)): Deleted.
(#split-content-browser > .navigation-bar .item): Deleted.
(#split-content-browser > .navigation-bar .item:not(.flexible-space)): Deleted.
(#split-content-browser .hierarchical-path-component.log-icon .icon): Deleted.
(#split-content-browser .hierarchical-path-component.log-icon .title): Deleted.
(#split-content-browser .hierarchical-path-component.log-icon select): Deleted.
(#split-content-browser > .navigation-bar > :matches(.hierarchical-path, .log-scope-bar)): Deleted.
(#split-content-browser > .navigation-bar > .log-scope-bar > li): Deleted.

* UserInterface/Views/QuickConsole.js:
(WebInspector.QuickConsole):
(WebInspector.QuickConsole.prototype._toggleOrFocus):
(WebInspector.QuickConsole.prototype._updateStyles):
Update top border style in response to change in selected TabBrowser
tab or the console drawer collapsed state.

(WebInspector.QuickConsole.prototype.consoleLogVisibilityChanged): Deleted.
(WebInspector.QuickConsole.prototype.set keyboardShortcutDisabled): Deleted.

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

3 years agoAdd RenderEmbeddedObject::getReplacementTextGeometry helper.
zalan@apple.com [Tue, 27 Jun 2017 19:52:00 +0000 (19:52 +0000)]
Add RenderEmbeddedObject::getReplacementTextGeometry helper.
https://bugs.webkit.org/show_bug.cgi?id=173847

Reviewed by Simon Fraser.

...and remove getReplacementTextGeometry's redundant return value.

No change in functionality.

* rendering/RenderEmbeddedObject.cpp:
(WebCore::RenderEmbeddedObject::paintReplaced):
(WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
(WebCore::RenderEmbeddedObject::unavailablePluginIndicatorBounds):
(WebCore::RenderEmbeddedObject::isInUnavailablePluginIndicator):
* rendering/RenderEmbeddedObject.h:

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

3 years agoRefactor drag start codepaths to plumb a DragItem to client layers
wenson_hsieh@apple.com [Tue, 27 Jun 2017 19:11:34 +0000 (19:11 +0000)]
Refactor drag start codepaths to plumb a DragItem to client layers
https://bugs.webkit.org/show_bug.cgi?id=173832
Work towards <rdar://problem/32236827>

Reviewed by Ryosuke Niwa and Tim Horton.

Source/WebCore:

Refactor drag start logic in WebCore to set up a DragItem and propagate it to WebDragClient. No change in behavior.

* loader/EmptyClients.cpp:
* page/DragClient.h:
* page/DragController.cpp:
(WebCore::DragController::startDrag):
(WebCore::DragController::doImageDrag):
(WebCore::DragController::doSystemDrag):

Refactor to pass along a DragItem. Also, remove unused drag image anchor computation.

* page/DragController.h:
* platform/DragImage.h:
* platform/DragItem.h:

Add additional information needed to begin a drag on iOS.

(WebCore::DragItem::encode):
(WebCore::DragItem::decode):

Add IPC serialization/deserialization support for DragItem.

* platform/PasteboardWriterData.cpp:
(WebCore::PasteboardWriterData::isEmpty):
* platform/PasteboardWriterData.h:

Source/WebKit/mac:

Refactor code used to start a drag in WebKit1 to plumb a single DragItem from DragController to the client layer
in WebDragClient that contains all the information needed to begin a drag. Also renames _setDataInteractionData:
to _startDrag: to match logic used to start a drag on other platforms.

No behavior change -- the same information should be propagated to AppKit and UIKit when beginning a drag, only
through the DragItem struct.

* WebCoreSupport/WebDragClient.h:
* WebCoreSupport/WebDragClient.mm:
(WebDragClient::startDrag):
(WebDragClient::dragSourceActionMaskForPoint):
(WebDragClient::willPerformDragSourceAction):
(WebDragClient::beginDrag):
* WebView/WebView.mm:
(-[WebView _startDrag:]):
(-[WebView _setDataInteractionData:textIndicator:atClientPosition:anchorPoint:action:]): Deleted.
* WebView/WebViewInternal.h:

Source/WebKit/win:

Adjust for changes to WebDragClient::startDrag by pulling information out of DragItem.

* WebCoreSupport/WebDragClient.cpp:
(WebDragClient::startDrag):
* WebCoreSupport/WebDragClient.h:

Source/WebKit2:

Add support for serializing a DragItem over IPC. This encodes and decodes all members of DragItem except for the
PasteboardWriterData and the DragImage's image. The DragItem is sent over to the UI process in
WebDragClient::startDrag via the WebPageProxy::startDrag IPC message (renamed from WebPageProxy::setDragImage)
which now takes a DragItem.

* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::startDrag):
(WebKit::WebPageProxy::setDragImage): Deleted.
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:

Rename SetDragImage to StartDrag and refactor to receive only a DragItem and shareable bitmap handle.

* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::startDrag):
(WebKit::PageClientImpl::startDataInteractionWithImage): Deleted.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _startDrag:item:]):
(-[WKContentView _startDataInteractionWithImage:withIndicatorData:atClientPosition:anchorPoint:action:]): Deleted.

Rename startDataInteractionWithImage to startDrag.

* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::startDrag):
(WebKit::WebPageProxy::setDragImage): Deleted.
* WebProcess/WebCoreSupport/WebDragClient.cpp:
(WebKit::WebDragClient::startDrag):
* WebProcess/WebCoreSupport/WebDragClient.h:
* WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
(WebKit::WebDragClient::startDrag):
* WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
(WebKit::WebDragClient::startDrag):

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

3 years agoWeb Inspector: Crash generating object preview for ArrayIterator
joepeck@webkit.org [Tue, 27 Jun 2017 17:43:03 +0000 (17:43 +0000)]
Web Inspector: Crash generating object preview for ArrayIterator
https://bugs.webkit.org/show_bug.cgi?id=173754
<rdar://problem/32859012>

Reviewed by Saam Barati.

Source/JavaScriptCore:

When Inspector generates an object preview for an ArrayIterator instance it made
a "clone" of the original ArrayIterator instance by constructing a new object with
the instance's structure. However, user code could have modified that instance's
structure, such as adding / removing properties. The `return` property had special
meaning, and our clone did not fill that slot. This approach is brittle in that
we weren't satisfying the expectations of an object with a particular Structure,
and the original goal of having Web Inspector peek values of built-in Iterators
was to avoid observable behavior.

This tightens Web Inspector's Iterator preview to only peek values if the
Iterators would actually be non-observable. It also builds an ArrayIterator
clone like a regular object construction.

* inspector/JSInjectedScriptHost.cpp:
(Inspector::cloneArrayIteratorObject):
Build up the Object from scratch with a new ArrayIterator prototype.

(Inspector::JSInjectedScriptHost::iteratorEntries):
Only clone and peek iterators if it would not be observable.
Also update iteration to be more in line with IterationOperations, such as when
we call iteratorClose.

* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::JSGlobalObject):
(JSC::JSGlobalObject::init):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::stringIteratorProtocolWatchpoint):
* runtime/JSGlobalObjectInlines.h:
(JSC::JSGlobalObject::isStringPrototypeIteratorProtocolFastAndNonObservable):
Add a StringIterator WatchPoint in line with the Array/Map/Set iterator watchpoints.

* runtime/JSMap.cpp:
(JSC::JSMap::isIteratorProtocolFastAndNonObservable):
(JSC::JSMap::canCloneFastAndNonObservable):
* runtime/JSMap.h:
* runtime/JSSet.cpp:
(JSC::JSSet::isIteratorProtocolFastAndNonObservable):
(JSC::JSSet::canCloneFastAndNonObservable):
* runtime/JSSet.h:
Promote isIteratorProtocolFastAndNonObservable to a method.

* runtime/JSObject.cpp:
(JSC::canDoFastPutDirectIndex):
* runtime/JSTypeInfo.h:
(JSC::TypeInfo::isArgumentsType):
Helper to detect if an Object is an Arguments type.

LayoutTests:

* platform/mac/inspector/model/remote-object-expected.txt:
* inspector/model/remote-object-expected.txt:
* inspector/model/remote-object.html:
Test generating a preview for an ArrayIterator that has had a `return` property added to it.

* inspector/model/remote-object-mutated-iterators-expected.txt: Added.
* inspector/model/remote-object-mutated-iterators.html: Added.
Test generating a preview for different iterators after the IteratorPrototypes have been mutated.

* inspector/model/resources/remote-object-utilities.js: Added.
(runInBrowserTest):
(TestPage.registerInitializer):
(TestPage.registerInitializer.checkComplete):
(TestPage.registerInitializer.window.runSteps):
Share code for remote-object dump tests.

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

3 years agoSome tests to verify forbidden frame navigation time out
fred.wang@free.fr [Tue, 27 Jun 2017 15:59:48 +0000 (15:59 +0000)]
Some tests to verify forbidden frame navigation time out
https://bugs.webkit.org/show_bug.cgi?id=173657

Patch by Frederic Wang <fwang@igalia.com> on 2017-06-27
Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

* web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-2-expected.txt: Update the text expectation to PASS.
* web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation_by_user_activation_without_user_gesture-expected.txt: Ditto.
* web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_navigate_ancestor-1-expected.txt: Ditto.
* web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-3-expected.txt: Add the security error until bug 173162 is fixed.
* web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-3-expected.txt: Ditto.

Source/WebCore:

Currently some tests try and perform a forbidden frame navigation and verify the
corresponding console error. However, WebKit does not raise any exception for such error so
the tests have to wait until the timeout limit to complete, which makes execution slow.
This patch modifies the setters of window.location for which such error may happen in order
to raise an exception so the tests behave as expected.

No new tests, already covered by existing tests.

* page/Location.cpp: Adjust Location::setLocation to return a security exception and pass it
to the callers.
(WebCore::Location::setHref): Adjust function to possibly return an exception.
(WebCore::Location::setProtocol): Ditto.
(WebCore::Location::setHost): Ditto.
(WebCore::Location::setHostname): Ditto.
(WebCore::Location::setPort): Ditto.
(WebCore::Location::setPathname): Ditto.
(WebCore::Location::setSearch): Ditto.
(WebCore::Location::setHash): Ditto.
(WebCore::Location::assign): Ditto.
(WebCore::Location::setLocation): FrameLoader::findFrameForNavigation is really only used
to verify whether navigating m_frame is permitted so it is more simple and clearer to do it
directly. When navigation is not permitted, this function now raises a security exception.
* page/Location.h: Modify some setters to return an ExceptionOr<void>.
* page/Location.idl: Allow some setters to raise an exception.

LayoutTests:

* fast/frames/sandboxed-iframe-navigation-top-denied-expected.txt: Add the security error.
* http/tests/security/frameNavigation/inactive-function-in-popup-navigate-child.html: Adjust
the test to catch and dump the exception and complete immediately.
* http/tests/security/frameNavigation/inactive-function-in-popup-navigate-child-expected.txt:
Add the dumped security error exception.

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

3 years ago[iOS DnD] [WK2] WKWebView does not handle drag sessions that exit and re-enter
wenson_hsieh@apple.com [Tue, 27 Jun 2017 14:49:20 +0000 (14:49 +0000)]
[iOS DnD] [WK2] WKWebView does not handle drag sessions that exit and re-enter
https://bugs.webkit.org/show_bug.cgi?id=173856
<rdar://problem/32957100>

Reviewed by Ryosuke Niwa.

Upon exiting a WKContentView, the dropSession tracked by _dataInteractionState is not cleared out. If the drag
session re-enters the WKWebView, a _different_ UIDropSession is sent to the drop delegate, causing us to bail
from handling the session altogether in -dropInteraction:canHandleSession:. To fix this, we need to clear out
the dropSession when the drag session exits the view.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView dropInteraction:sessionDidExit:]):

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

3 years agoLayoutTest webrtc/datachannel/multiple-connections.html is a flaky timeout
commit-queue@webkit.org [Tue, 27 Jun 2017 14:47:29 +0000 (14:47 +0000)]
LayoutTest webrtc/datachannel/multiple-connections.html is a flaky timeout
https://bugs.webkit.org/show_bug.cgi?id=173853

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

* webrtc/datachannel/multiple-connections.html:

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

3 years ago[GTK] Layout Test webrtc/video.html issues "stack smashing detected"
commit-queue@webkit.org [Tue, 27 Jun 2017 06:41:51 +0000 (06:41 +0000)]
[GTK] Layout Test webrtc/video.html issues "stack smashing detected"
https://bugs.webkit.org/show_bug.cgi?id=173862

Patch by Fujii Hironori <Hironori.Fujii@sony.com> on 2017-06-26
Reviewed by Carlos Garcia Campos.

Tests: webrtc/video.html

Passing a bool variable to g_object_get causes out-of-bound write.
gboolean should be used, which is 4 bytes while bool is one byte.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::muted): Use gboolean instead of bool.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
(WebCore::MediaPlayerPrivateGStreamerOwr::trackEnded): Ditto.

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

3 years agoRegExpPrototype.js builtin uses for-of iteration which is almost certainly incorrect
sbarati@apple.com [Tue, 27 Jun 2017 05:49:43 +0000 (05:49 +0000)]
RegExpPrototype.js builtin uses for-of iteration which is almost certainly incorrect
https://bugs.webkit.org/show_bug.cgi?id=173740

Reviewed by Mark Lam.

JSTests:

* stress/regexp-prototype-replace-builtin-should-not-use-for-of.js: Added.
(Array.prototype.Symbol.iterator):

Source/JavaScriptCore:

The builtin was using for-of iteration to iterate over an internal
list in its algorithm. For-of iteration is observable via user code
in the global object, so this approach was wrong as it would break if
a user changed the Array iteration protocol in some way.

* builtins/RegExpPrototype.js:
(replace):

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

3 years agoWebsiteDataStore::fetchDataForTopPrivatelyControlledDomains() is inefficient
cdumez@apple.com [Tue, 27 Jun 2017 03:33:12 +0000 (03:33 +0000)]
WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains() is inefficient
https://bugs.webkit.org/show_bug.cgi?id=173850

Reviewed by Ryosuke Niwa.

Source/WebCore:

* loader/ResourceLoadStatisticsStore.cpp:
(WebCore::ResourceLoadStatisticsStore::updateStatisticsForRemovedDataRecords):
* loader/ResourceLoadStatisticsStore.h:

Source/WebKit2:

Update WebsiteDataRecord::matchesTopPrivatelyControlledDomain() to rely on
SecurityOriginData::host rather than SecurityOriginData::securityOrigin()->host().
SecurityOriginData::securityOrigin() is expensive and it seems unnecessary to call
it here since we already have the host.

Also update WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains() to return
domains as a HashSet rather than a Vector to avoid having duplicate domains.

* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
* UIProcess/WebProcessProxy.h:
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
* UIProcess/WebsiteData/WebsiteDataRecord.cpp:
(WebKit::WebsiteDataRecord::matchesTopPrivatelyControlledDomain):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains):
(WebKit::WebsiteDataStore::removeDataForTopPrivatelyControlledDomains):
* UIProcess/WebsiteData/WebsiteDataStore.h:

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

3 years agoREGRESSION (AsyncImageDecoding): A tab with the WWDC keynote paused is killed for...
antti@apple.com [Tue, 27 Jun 2017 03:28:00 +0000 (03:28 +0000)]
REGRESSION (AsyncImageDecoding): A tab with the WWDC keynote paused is killed for using excessive power (Image thrashing)
https://bugs.webkit.org/show_bug.cgi?id=173804
<rdar://problem/32623745>

Reviewed by Simon Fraser.

Source/WebCore:

When under memory pressure MemoryCache::singleton().pruneLiveResources(true) is called inFrameView::didPaintContents()
after top level paint. We end up decoding and pruning bitmaps repeatedly for each tile, which is not great.

Situation gets worse with async decoding. Painting now doesn’t actually decode the image, it just starts the decoding.
When it completes we trigger another paint to get the bits to the tiles. The paint for the first tile then calls
pruneLiveResources and loses the bitmap and the second tile triggers another round of async decoding. We have code
that prevents pruning of visible images but non-visible images in tiling area can hit this bug easily.

Test: fast/images/low-memory-decode.html

* page/FrameView.cpp:
(WebCore::FrameView::willPaintContents):
(WebCore::FrameView::didPaintContents):

    Eliminate synchronous pruning during painting. This is an obsolete mechanism from early iOS times.

* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::imageFrameAvailableAtIndex):
(WebCore::BitmapImage::decodeCountForTesting):

    Testing support.

* platform/graphics/BitmapImage.h:
* testing/Internals.cpp:
(WebCore::Internals::imageDecodeCount):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

* fast/images/low-memory-decode-expected.txt: Added.
* fast/images/low-memory-decode.html: Added.

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

3 years agoMarked media/media-source/media-source-paint-to-canvas.html as flaky.
jlewis3@apple.com [Tue, 27 Jun 2017 00:26:27 +0000 (00:26 +0000)]
Marked media/media-source/media-source-paint-to-canvas.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=173565

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

3 years agoMarked animations/play-state-suspend.html as flaky.
jlewis3@apple.com [Mon, 26 Jun 2017 23:47:15 +0000 (23:47 +0000)]
Marked animations/play-state-suspend.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=173726

Unreviewed test gardening.

* platform/ios-wk2/TestExpectations:

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

3 years agoSkip a test on 32-bit platforms since we run out of address space.
sbarati@apple.com [Mon, 26 Jun 2017 23:39:49 +0000 (23:39 +0000)]
Skip a test on 32-bit platforms since we run out of address space.

Rubber stamped by Mark Lam.

* stress/dont-reserve-huge-capacity-lexer.js:

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

3 years agoInvalidate WebVideoFullscreenManager when WebPage is destroyed.
commit-queue@webkit.org [Mon, 26 Jun 2017 22:36:45 +0000 (22:36 +0000)]
Invalidate WebVideoFullscreenManager when WebPage is destroyed.
https://bugs.webkit.org/show_bug.cgi?id=173835
rdar://problem/32969161

Patch by Jeremy Jones <jeremyj@apple.com> on 2017-06-26
Reviewed by Jer Noble.

WebVideoFullscreenManager has a pointer to WebPage, and even null checks it in a few places,
but the only place it is nulled out is in the destructor. This allows a dangling reference.

This changes invalidates that reference when WebPage is destructed and adds nullchecks
or asserts throughout WebVideoFullscreenManager as appropriate.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::~WebPage):
* WebProcess/cocoa/WebVideoFullscreenManager.h:
(WebKit::WebVideoFullscreenManager::invalidate):
* WebProcess/cocoa/WebVideoFullscreenManager.mm:
(WebKit::WebVideoFullscreenManager::~WebVideoFullscreenManager):
(WebKit::WebVideoFullscreenManager::enterVideoFullscreenForVideoElement):
(WebKit::WebVideoFullscreenManager::exitVideoFullscreenForVideoElement):
(WebKit::WebVideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation):
(WebKit::WebVideoFullscreenManager::hasVideoChanged):
(WebKit::WebVideoFullscreenManager::videoDimensionsChanged):
(WebKit::WebVideoFullscreenManager::didSetupFullscreen):
(WebKit::WebVideoFullscreenManager::didEnterFullscreen):
(WebKit::WebVideoFullscreenManager::didCleanupFullscreen):
(WebKit::WebVideoFullscreenManager::fullscreenMayReturnToInline):

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

3 years agoDisable diagnostic logging in ephemeral sessions
cdumez@apple.com [Mon, 26 Jun 2017 21:09:33 +0000 (21:09 +0000)]
Disable diagnostic logging in ephemeral sessions
https://bugs.webkit.org/show_bug.cgi?id=173849
<rdar://problem/32987341>

Reviewed by Geoffrey Garen.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setDiagnosticLoggingClient):
Construct a dummy logging client if the page's session is ephemeral.

(WebKit::WebPageProxy::logDiagnosticMessage):
(WebKit::WebPageProxy::logDiagnosticMessageWithResult):
(WebKit::WebPageProxy::logDiagnosticMessageWithValue):
(WebKit::WebPageProxy::logDiagnosticMessageWithEnhancedPrivacy):
Slight cleanup to make the code look a bit safer.

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