WebKit-https.git
2 years agoREGRESSION(r214194): Safari leaves a popup window open opened during before unload
rniwa@webkit.org [Fri, 30 Jun 2017 19:32:41 +0000 (19:32 +0000)]
REGRESSION(r214194): Safari leaves a popup window open opened during before unload
https://bugs.webkit.org/show_bug.cgi?id=174016

Reviewed by Chris Dumez.

Source/WebCore:

The bug was caused by WebKit allowing the opening of a new window via window.open but disallowing
the initial navigation within the newly opened window while a beforeunload event is being dispatched.

Because some websites which opens a window during a beforeunload event relies on the opened page
to communicate back in order to close it. This resulted in a newly opened popup window with about:blank
being left out on those websites.

Fixed the bug by allowing the navigation of a new window as well as an existing another window.
More concretely, we disallow navigations within the same frame tree as the one in which a beforeunload
event is being dispatched, and allow navigations elsewhere (i.e. different window / page).
During the destruction of a frame-less document, disallow all the navigations.

Tests: fast/events/before-unload-navigate-different-window.html
       fast/events/before-unload-open-window.html
       fast/events/before-unload-sibling-frame.html

* WebCore.xcodeproj/project.pbxproj:
* dom/Document.cpp:
(WebCore::Document::prepareForDestruction):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::isNavigationAllowed):
(WebCore::FrameLoader::shouldClose):
* loader/NavigationDisabler.h: Added. Extracted from NavigationScheduler.h
(WebCore::NavigationDisabler::NavigationDisabler): Increment the newly added counter on MainFrame unless
the frame is null (during the destruction of a frameless document) in which case we increment the global
disable count.
(WebCore::NavigationDisabler::~NavigationDisabler): Ditto for decrementation.
(WebCore::NavigationDisabler::isNavigationAllowed): Only allow the navigation when there is no frameless
document in destruction, and none of the frame in the same frame tree as the one given is currently in
the process of dispatching a beforeunload event.
* loader/NavigationScheduler.cpp:
(WebCore::NavigationScheduler::shouldScheduleNavigation):
* loader/NavigationScheduler.h:
(WebCore::NavigationDisabler): Moved to NavigationDisabler.h.
* page/MainFrame.h:
(WebCore::MainFrame): Added s_globalNavigationDisableCount.

LayoutTests:

Added regression tests for navigating a new window, a sibling iframe, and another existing window.

* fast/events/before-unload-navigate-different-window-expected.txt: Added.
* fast/events/before-unload-navigate-different-window.html: Added.
* fast/events/before-unload-open-window-expected.txt: Added.
* fast/events/before-unload-open-window.html: Added.
* fast/events/before-unload-sibling-frame-expected.txt: Added.
* fast/events/before-unload-sibling-frame.html: Added.
* fast/events/resources/message-opener.html: Added.
* fast/events/resources/message-top.html: Added.

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

2 years ago[WebIDL] Add support for conditionally read-write attributes
commit-queue@webkit.org [Fri, 30 Jun 2017 19:04:56 +0000 (19:04 +0000)]
[WebIDL] Add support for conditionally read-write attributes
https://bugs.webkit.org/show_bug.cgi?id=173993

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

The MEDIA_SOURCE feature/conditional requires changing a few readonly
attributes into read-write attributes. In the past we handled this with
custom bindings. This patch adds a new extended attribute, ConditionallyReadWrite
which achieves the same result.

* WebCore.xcodeproj/project.pbxproj:
Move a few custom binding to the "GC / Wrapping Only" group.

* bindings/js/JSAudioTrackCustom.cpp:
(WebCore::JSAudioTrack::setKind): Deleted.
(WebCore::JSAudioTrack::setLanguage): Deleted.
* bindings/js/JSTextTrackCustom.cpp:
(WebCore::JSTextTrack::setLanguage): Deleted.
* bindings/js/JSVideoTrackCustom.cpp:
(WebCore::JSVideoTrack::setKind): Deleted.
(WebCore::JSVideoTrack::setLanguage): Deleted.
Remove no longer needed custom bindings.

* bindings/scripts/CodeGeneratorJS.pm:
(GeneratePropertiesHashTable):
(GenerateImplementation):
(GenerateAttributeSetterDefinition):
(GenerateCallbackImplementationContent):
(GenerateHashTableValueArray):
(GenerateHashTable):
Pipe ConditionallyReadWrite through the generator.

* bindings/scripts/IDLAttributes.json:
Add ConditionallyReadWrite.

* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/TestObj.idl:
Add tests for ConditionallyReadWrite.

* html/track/AudioTrack.idl:
* html/track/TextTrack.idl:
* html/track/VideoTrack.idl:
Replace [Custom] with [ConditionallyReadWrite].

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

2 years agoUnreviewed, rolling out r218992.
jlewis3@apple.com [Fri, 30 Jun 2017 18:37:59 +0000 (18:37 +0000)]
Unreviewed, rolling out r218992.

The patch broke the iOS device builds.

Reverted changeset:

"DFG_ASSERT should allow stuffing registers before trapping."
https://bugs.webkit.org/show_bug.cgi?id=174005
http://trac.webkit.org/changeset/218992

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

2 years agoResourceLoadObserver does not need a ResourceLoadStatisticsStore
cdumez@apple.com [Fri, 30 Jun 2017 18:18:19 +0000 (18:18 +0000)]
ResourceLoadObserver does not need a ResourceLoadStatisticsStore
https://bugs.webkit.org/show_bug.cgi?id=174013

Reviewed by Brent Fulgham.

ResourceLoadObserver does not need a ResourceLoadStatisticsStore. ResourceLoadStatisticsStore is too complicated for its needs.
ResourceLoadStatisticsStore can then be moved to WebKit2/UIProcess in a follow-up.

Source/WebCore:

* Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::connect):
* dom/UserGestureIndicator.cpp:
(WebCore::UserGestureIndicator::UserGestureIndicator):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::willSendRequest):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadResourceSynchronously):
* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::shared):
(WebCore::ResourceLoadObserver::setNotificationCallback):
(WebCore::ResourceLoadObserver::shouldLog):
(WebCore::ResourceLoadObserver::logFrameNavigation):
(WebCore::ResourceLoadObserver::logSubresourceLoading):
(WebCore::ResourceLoadObserver::logWebSocketLoading):
(WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
(WebCore::ResourceLoadObserver::ensureResourceStatisticsForPrimaryDomain):
(WebCore::ResourceLoadObserver::takeResourceStatisticsForPrimaryDomain):
(WebCore::ResourceLoadObserver::isPrevalentResource):
(WebCore::ResourceLoadObserver::statisticsForOrigin):
(WebCore::ResourceLoadObserver::takeStatistics):
* loader/ResourceLoadObserver.h:
* loader/ResourceLoadStatisticsStore.cpp:
* loader/ResourceLoadStatisticsStore.h:
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::willSendRequestInternal):
* testing/Internals.cpp:
(WebCore::Internals::resourceLoadStatisticsForOrigin):

Source/WebKit/mac:

* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):

Source/WebKit2:

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

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

2 years agoFollow-up fix for r218996
jbedard@apple.com [Fri, 30 Jun 2017 18:10:37 +0000 (18:10 +0000)]
Follow-up fix for r218996

Unreviewed infrastructure fix.

Repeated calls to 'ios_version' make the log noisy, memoize the function.

* Scripts/webkitpy/port/ios_simulator.py:
(IOSSimulatorPort): Memoize ios_version().

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

2 years agoASSERTION FAILED: !canAnimate() && !m_currentFrame
commit-queue@webkit.org [Fri, 30 Jun 2017 17:28:20 +0000 (17:28 +0000)]
ASSERTION FAILED: !canAnimate() && !m_currentFrame
https://bugs.webkit.org/show_bug.cgi?id=173089

Patch by Fujii Hironori <Hironori.Fujii@sony.com> on 2017-06-30
Reviewed by Said Abou-Hallawa.

Source/WebCore:

WebCore::BitmapImage::draw() has an assertion which ensures
m_currentFrame is zero in case of async decoding. But, this
assertion failed if an GIF animation image which have finished its
animation was repainted. In that time, m_currentFrame was the last
frame index of the image.

Test: fast/images/animated-gif-paint-after-animation.html

* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::draw): Assert m_currentFrame is zero or the animation finished.
Call requestFrameAsyncDecodingAtIndex with m_currentFrame instead of zero.

LayoutTests:

* fast/images/animated-gif-paint-after-animation-expected.txt: Added.
* fast/images/animated-gif-paint-after-animation.html: Added.
* fast/images/resources/animated-red-green-1000x1000-repeat-1.gif: Added.

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

2 years ago[WK2][iOS][macOS] Update XPC services process launch dictionary
bfulgham@apple.com [Fri, 30 Jun 2017 16:54:11 +0000 (16:54 +0000)]
[WK2][iOS][macOS] Update XPC services process launch dictionary
https://bugs.webkit.org/show_bug.cgi?id=173995
<rdar://problem/32797264>

Reviewed by Alex Christensen.

Update the WebProcess and Plugin Process XPC launch dictionaries to activate
improved ALSR features when launching.

* PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist:
* WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist:
* WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist:

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

2 years agoRegExpCachedResult::setInput should reify left and right contexts
fpizlo@apple.com [Fri, 30 Jun 2017 16:37:29 +0000 (16:37 +0000)]
RegExpCachedResult::setInput should reify left and right contexts
https://bugs.webkit.org/show_bug.cgi?id=173818

Reviewed by Keith Miller.
JSTests:

* stress/right-left-context-invalidated-by-input.js: Added.
(test.validateContexts):
(test):

Source/JavaScriptCore:

If you don't reify them in setInput, then when you later try to reify them, you'll end up
using indices into an old input string to create a substring of a new input string. That
never goes well.

* runtime/RegExpCachedResult.cpp:
(JSC::RegExpCachedResult::setInput):

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

2 years agoMerge WebResourceLoadStatisticsManager and WebResourceLoadObserver
cdumez@apple.com [Fri, 30 Jun 2017 16:22:42 +0000 (16:22 +0000)]
Merge WebResourceLoadStatisticsManager and WebResourceLoadObserver
https://bugs.webkit.org/show_bug.cgi?id=174008

Reviewed by Brent Fulgham.

Merge WebResourceLoadStatisticsManager and WebResourceLoadObserver. One was basically
a proxy to the other.

* UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
(WKResourceLoadStatisticsManagerSetPrevalentResource):
(WKResourceLoadStatisticsManagerIsPrevalentResource):
(WKResourceLoadStatisticsManagerSetHasHadUserInteraction):
(WKResourceLoadStatisticsManagerIsHasHadUserInteraction):
(WKResourceLoadStatisticsManagerSetGrandfathered):
(WKResourceLoadStatisticsManagerIsGrandfathered):
(WKResourceLoadStatisticsManagerSetSubframeUnderTopFrameOrigin):
(WKResourceLoadStatisticsManagerSetSubresourceUnderTopFrameOrigin):
(WKResourceLoadStatisticsManagerSetSubresourceUniqueRedirectTo):
(WKResourceLoadStatisticsManagerSetTimeToLiveUserInteraction):
(WKResourceLoadStatisticsManagerSetTimeToLiveCookiePartitionFree):
(WKResourceLoadStatisticsManagerSetMinimumTimeBetweeenDataRecordsRemoval):
(WKResourceLoadStatisticsManagerSetGrandfatheringTime):
(WKResourceLoadStatisticsManagerFireDataModificationHandler):
(WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandler):
(WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandlerForOneDomain):
(WKResourceLoadStatisticsManagerFireTelemetryHandler):
(WKResourceLoadStatisticsManagerSetNotifyPagesWhenDataRecordsWereScanned):
(WKResourceLoadStatisticsManagerSetShouldClassifyResourcesBeforeDataRecordsRemoval):
(WKResourceLoadStatisticsManagerSetNotifyPagesWhenTelemetryWasCaptured):
(WKResourceLoadStatisticsManagerSetShouldSubmitTelemetry):
(WKResourceLoadStatisticsManagerClearInMemoryAndPersistentStore):
(WKResourceLoadStatisticsManagerClearInMemoryAndPersistentStoreModifiedSinceHours):
(WKResourceLoadStatisticsManagerResetToConsistentState):
* UIProcess/API/C/WKResourceLoadStatisticsManager.h:
* UIProcess/Cocoa/WebResourceLoadStatisticsManagerCocoa.mm:
(WebKit::WebResourceLoadStatisticsManager::registerUserDefaultsIfNeeded):
* UIProcess/WebResourceLoadObserver.cpp: Removed.
* UIProcess/WebResourceLoadObserver.h: Removed.
* UIProcess/WebResourceLoadStatisticsManager.cpp:
(WebKit::primaryDomain):
(WebKit::WebResourceLoadStatisticsManager::shared):
(WebKit::WebResourceLoadStatisticsManager::setStatisticsStore):
(WebKit::WebResourceLoadStatisticsManager::setStatisticsQueue):
(WebKit::WebResourceLoadStatisticsManager::clearInMemoryStore):
(WebKit::WebResourceLoadStatisticsManager::clearInMemoryAndPersistentStore):
(WebKit::WebResourceLoadStatisticsManager::logUserInteraction):
(WebKit::WebResourceLoadStatisticsManager::clearUserInteraction):
(WebKit::WebResourceLoadStatisticsManager::hasHadUserInteraction):
(WebKit::WebResourceLoadStatisticsManager::setPrevalentResource):
(WebKit::WebResourceLoadStatisticsManager::isPrevalentResource):
(WebKit::WebResourceLoadStatisticsManager::clearPrevalentResource):
(WebKit::WebResourceLoadStatisticsManager::setGrandfathered):
(WebKit::WebResourceLoadStatisticsManager::isGrandfathered):
(WebKit::WebResourceLoadStatisticsManager::setSubframeUnderTopFrameOrigin):
(WebKit::WebResourceLoadStatisticsManager::setSubresourceUnderTopFrameOrigin):
(WebKit::WebResourceLoadStatisticsManager::setSubresourceUniqueRedirectTo):
(WebKit::WebResourceLoadStatisticsManager::setTimeToLiveUserInteraction):
(WebKit::WebResourceLoadStatisticsManager::setTimeToLiveCookiePartitionFree):
(WebKit::WebResourceLoadStatisticsManager::setMinimumTimeBetweeenDataRecordsRemoval):
(WebKit::WebResourceLoadStatisticsManager::setGrandfatheringTime):
(WebKit::WebResourceLoadStatisticsManager::fireDataModificationHandler):
(WebKit::WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler):
(WebKit::WebResourceLoadStatisticsManager::fireTelemetryHandler):
* UIProcess/WebResourceLoadStatisticsManager.h:
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::removeData):
* WebKit2.xcodeproj/project.pbxproj:

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

2 years ago[PAL] Move Sound into PAL
commit-queue@webkit.org [Fri, 30 Jun 2017 16:12:17 +0000 (16:12 +0000)]
[PAL] Move Sound into PAL
https://bugs.webkit.org/show_bug.cgi?id=173999

Patch by Ross Kirsling <ross.kirsling@sony.com> on 2017-06-30
Reviewed by Alex Christensen.

Source/WebCore:

* Configurations/WebCore.xcconfig:
* PlatformGTK.cmake:
* PlatformMac.cmake:
* PlatformWPE.cmake:
* PlatformWin.cmake:
* WebCore.xcodeproj/project.pbxproj:
* editing/Editor.cpp:
(WebCore::Editor::cut):
(WebCore::Editor::copy):
(WebCore::Editor::performDelete):
* editing/EditorCommand.cpp:
(WebCore::executeSelectToMark):
(WebCore::executeSwapWithMark):
* editing/mac/EditorMac.mm:
(WebCore::Editor::takeFindStringFromSelection):
* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::beep):
* platform/Sound.h: Removed.

Source/WebCore/PAL:

* Configurations/PAL.xcconfig:
* PAL.xcodeproj/project.pbxproj:
* pal/CMakeLists.txt:
* pal/PlatformGTK.cmake:
* pal/PlatformMac.cmake:
* pal/PlatformWPE.cmake:
* pal/PlatformWin.cmake:
* pal/system/Sound.h: Renamed from Source/WebCore/platform/ios/SoundIOS.mm.
* pal/system/SoundNone.cpp: Renamed from Source/WebCore/platform/wpe/SoundWPE.cpp.
(PAL::systemBeep):
* pal/system/gtk/SoundGtk.cpp: Renamed from Source/WebCore/platform/gtk/SoundGtk.cpp.
* pal/system/mac/SoundMac.mm: Renamed from Source/WebCore/platform/mac/SoundMac.mm.
* pal/system/win/SoundWin.cpp: Renamed from Source/WebCore/platform/win/SoundWin.cpp.

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

2 years ago[iOS DnD] Drag caret rect is incorrectly computed when dropping in editable content...
wenson_hsieh@apple.com [Fri, 30 Jun 2017 16:08:21 +0000 (16:08 +0000)]
[iOS DnD] Drag caret rect is incorrectly computed when dropping in editable content in iframes
https://bugs.webkit.org/show_bug.cgi?id=174017
<rdar://problem/32959782>

Reviewed by Simon Fraser.

Source/WebCore:

We're currenly computing the drag caret rect (for the purposes of presentation at the client layers)
incorrectly, in per-frame document coordinates instead of root view coordinates in the mainframe. This means
drag caret geometry from embedded iframes in the document will show up in the content view with a rect in the
coordinate space of the iframe.

To fix this, we need to convert the drag caret rect to root view coordinates. This patch teaches
DragCaretController to do this, and tweaks WebKit/WebKit2 to use caretRectInRootViewCoordinates.

Test: DataInteractionTests.ExternalSourcePlainTextToIFrame

* editing/FrameSelection.cpp:
(WebCore::DragCaretController::caretRectInRootViewCoordinates):
* editing/FrameSelection.h:

Source/WebKit/mac:

Use root view coordinates when computing the drag caret rect.

* WebView/WebView.mm:
(-[WebView _dataInteractionCaretRect]):

Source/WebKit2:

Send the drag caret rect in root view coordinates over to the UI process.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _dragCaretRect]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:

Add basic test plumbing to fetch the current drag caret rect.

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

Tools:

Add a new test verifying that the drag caret is visually contained within the bounds of an iframe. Before these
changes, the caret would appear outside of the iframe.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/contenteditable-in-iframe.html: Added.
* TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
(checkDragCaretRectIsContainedInRect):
(TestWebKitAPI::TEST):
* TestWebKitAPI/ios/DataInteractionSimulator.h:
* TestWebKitAPI/ios/DataInteractionSimulator.mm:
(-[DataInteractionSimulator _resetSimulatedState]):
(-[DataInteractionSimulator _concludeDataInteractionAndPerformOperationIfNecessary]):
(-[DataInteractionSimulator _advanceProgress]):
(-[DataInteractionSimulator lastKnownDragCaretRect]):

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

2 years ago[WebIDL] Replace use of __is_polymorphic with standard std::is_polymorphic<>::value
commit-queue@webkit.org [Fri, 30 Jun 2017 15:45:59 +0000 (15:45 +0000)]
[WebIDL] Replace use of __is_polymorphic with standard std::is_polymorphic<>::value
https://bugs.webkit.org/show_bug.cgi?id=174012

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

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
Replace __is_polymorphic with standard std::is_polymorphic<>::value. Remove clang
specific guard now that we are using something other compilers support.

* bindings/scripts/test/JS/JSInterfaceName.cpp:
* bindings/scripts/test/JS/JSMapLike.cpp:
* bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
* bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
* bindings/scripts/test/JS/JSTestCEReactions.cpp:
* bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
* bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
* bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
* bindings/scripts/test/JS/JSTestEventConstructor.cpp:
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
* bindings/scripts/test/JS/JSTestException.cpp:
* bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
* bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
* bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
* bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
* bindings/scripts/test/JS/JSTestInterface.cpp:
* bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
* bindings/scripts/test/JS/JSTestIterable.cpp:
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
* bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
* bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
* bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
* bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
* bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
* bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
* bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp:
* bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp:
* bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
* bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
* bindings/scripts/test/JS/JSTestNode.cpp:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
* bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
* bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
* bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
* bindings/scripts/test/JS/JSTestSerialization.cpp:
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
* bindings/scripts/test/JS/JSTestStringifier.cpp:
* bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
* bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
* bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
* bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
* bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
* bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
Update test results.

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

2 years agoAdd support for different versions of iOS when loading test expectations
jbedard@apple.com [Fri, 30 Jun 2017 15:33:16 +0000 (15:33 +0000)]
Add support for different versions of iOS when loading test expectations
https://bugs.webkit.org/show_bug.cgi?id=173774
<rdar://problem/32951132>

Rubber-stamped by Aakash Jain.

When running layout tests, we should support multiple version of iOS the same way we do Mac.

* Scripts/webkitpy/port/ios.py:
(IOSPort.default_baseline_search_path): Add ios-<major version> test expectation.
(IOSPort.test_expectations_file_position): Added new file expectations, increment expected file position.
(IOSPort.ios_version): iOS ports must define a function to retrieve the iOS version.
* Scripts/webkitpy/port/ios_device.py:
(IOSDevicePort.ios_version): Ask connected devices for implementation.
* Scripts/webkitpy/port/ios_device_unittest.py:
(IOSDeviceTest.test_additional_platform_directory): Skip test until bug 173775 is finished.
(IOSDeviceTest.test_baseline_searchpath): Ditto.
(IOSDeviceTest.test_expectations_ordering): Ditto.
* Scripts/webkitpy/port/ios_simulator.py:
(IOSSimulatorPort.ios_version): If a runtime is specified, ask the runtime for the iOS version. Otherwise,
ask the platform.

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

2 years agoUpdate expectations for layout tests.
wilander@apple.com [Fri, 30 Jun 2017 15:09:58 +0000 (15:09 +0000)]
Update expectations for layout tests.
https://bugs.webkit.org/show_bug.cgi?id=173940

Unreviewed test gardening, update test expectations for failing tests.

* platform/wk2/TestExpectations:
    http/tests/loading/resourceLoadStatistics/telemetry-generation.html
    is still failing.

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

2 years agoSource/WebCore:
commit-queue@webkit.org [Fri, 30 Jun 2017 15:00:43 +0000 (15:00 +0000)]
Source/WebCore:
       Support PeerConnectionStates::BundlePolicy::MaxBundle when setting rtc configuration
       https://bugs.webkit.org/show_bug.cgi?id=169389

       Reviewed by Alex Christensen.

       Covered by manual testing (appr.tc and https://youennf.github.io/webrtc-tests/src/content/peerconnection/trickle-ice/).
       Updated test is showing some more failing but this is due to the fact that we are no longer totally lying on the configuration of the
underlying libwebrtc backend.

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.

ICE candidate pool size is disabled as it is creating issues with running tests on bots.

Patch by Youenn Fablet <youenn@apple.com> on 2017-06-30

* 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:
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-30
Reviewed by Alex Christensen.

* fast/mediastream/RTCPeerConnection-getConfiguration-expected.txt:

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

2 years agoFontconfig build breaks with glibc 2.15+
commit-queue@webkit.org [Fri, 30 Jun 2017 13:18:39 +0000 (13:18 +0000)]
Fontconfig build breaks with glibc 2.15+
https://bugs.webkit.org/show_bug.cgi?id=174019

Patch by Jacobo Aragunde PĂ©rez <jaragunde@igalia.com> on 2017-06-30
Reviewed by Carlos Alberto Lopez Perez.

Apply patch by Khem Raj adapted to fontconfig 2.11.1.

* wpe/jhbuild.modules:
* wpe/patches/fontconfig-avoid-conflicts-with-integer-width-macros-from-TS-18.patch: Added.

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

2 years agoDFG_ASSERT should allow stuffing registers before trapping.
keith_miller@apple.com [Fri, 30 Jun 2017 08:23:18 +0000 (08:23 +0000)]
DFG_ASSERT should allow stuffing registers before trapping.
https://bugs.webkit.org/show_bug.cgi?id=174005

Reviewed by Mark Lam.

Source/JavaScriptCore:

DFG_ASSERT currently prints error data to stderr before crashing,
which is nice for local development. In the wild, however, we
can't see this information in crash logs. This patch enables
stuffing some of the most useful information from DFG_ASSERTS into
up to five registers right before crashing. The values stuffed
should not impact any logging during local development.

* assembler/AbortReason.h:
* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::verifyEdge):
* dfg/DFGGraph.cpp:
(JSC::DFG::logForCrash):
(JSC::DFG::Graph::logAssertionFailure):
(JSC::DFG::crash): Deleted.
(JSC::DFG::Graph::handleAssertionFailure): Deleted.
* dfg/DFGGraph.h:

Source/WTF:

Add new template functions that enable stuffing up to five values
into registers before crashing.

* wtf/Assertions.h:
(CRASH_WITH_INFO):

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

2 years agoTop controls bars should invert with right-to-left user interface layout direction...
commit-queue@webkit.org [Fri, 30 Jun 2017 07:48:37 +0000 (07:48 +0000)]
Top controls bars should invert with right-to-left user interface layout direction locale
https://bugs.webkit.org/show_bug.cgi?id=173989
<rdar://problem/32863552>

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

Source/WebCore:

When the user interface layout direction is set by the locale to be right-to-left, we now:

    - invert the two top controls bars
    - invert the layout order for the fullscreen / PiP controls bar
    - orient the volume button the opposite direction when presented in a top controls bar

Test: media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-rtl.html

* Modules/modern-media-controls/controls/icon-service.js: Add new RTL variants for the mute and unmute icons.
* Modules/modern-media-controls/controls/inline-media-controls.css: Invert the position of the two top controls
bars when we switch user interface layout direction.
(.media-controls.inline.uses-ltr-user-interface-layout-direction > .controls-bar.top-left,):
(.media-controls.inline.uses-ltr-user-interface-layout-direction > .controls-bar.top-right,):
(.media-controls.inline > .controls-bar.top-left): Deleted.
(.media-controls.inline > .controls-bar.top-right): Deleted.
* Modules/modern-media-controls/controls/inline-media-controls.js:
(InlineMediaControls.prototype.layout): Default to using the LTR variant for the mute button icon since
it should only use the RTL variant in case the locale requires it *and* we display the mute button in a
top controls bar rather than the bottom controls bar (ie. when width becomes constrained).
(InlineMediaControls.prototype._topLeftContainerButtons): Invert the order of the fullscreen and PiP
buttons based on the user interface layout direction.
(InlineMediaControls.prototype._addTopRightBarWithMuteButtonToChildren):
(InlineMediaControls):
* Modules/modern-media-controls/controls/media-controls.js:
(MediaControls.prototype.set usesLTRUserInterfaceLayoutDirection): Schedule a layout when the user interface
layout direction changes.
* Modules/modern-media-controls/controls/mute-button.js: Add a new "usesRTLIconVariant" property, false by
default, to indicate we want to use the RTL variant of the button's icon.
(MuteButton):
(MuteButton.prototype.get muted):
(MuteButton.prototype.set muted):
(MuteButton.prototype.set usesRTLIconVariant):
(MuteButton.prototype.layout):
* Modules/modern-media-controls/images/iOS/Mute-RTL.svg: Added.
* Modules/modern-media-controls/images/iOS/VolumeHi-RTL.svg: Added.
* Modules/modern-media-controls/images/macOS/Mute-RTL.svg: Added.
* Modules/modern-media-controls/images/macOS/VolumeHi-RTL.svg: Added.
* Modules/modern-media-controls/media/media-controller.js: Use an ivar to track when it's worth notifying the
media controls that the user interface layout direction has changed. This means we won't need to schedule a
layout in case it's set to the current value.
(MediaController):
(MediaController.prototype.set usesLTRUserInterfaceLayoutDirection):

LayoutTests:

Add a new test to check we correctly layout the top controls bars in RTL and rebaseline a
test that now requires an asynchronous assertion.

* media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-rtl-expected.txt: Added.
* media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-rtl.html: Added.
* media/modern-media-controls/mute-button/mute-button-expected.txt:
* media/modern-media-controls/mute-button/mute-button.html:
* platform/mac/TestExpectations:

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

2 years agoREGRESSION (High Sierra): Gradient LayoutTests are failing
dino@apple.com [Fri, 30 Jun 2017 07:34:01 +0000 (07:34 +0000)]
REGRESSION (High Sierra): Gradient LayoutTests are failing
https://bugs.webkit.org/show_bug.cgi?id=174015
<rdar://problem/32332022>

Reviewed by Tim Horton.

Add the fudge factor to more of the gradient tests.

* canvas/philip/tests.js:
(_assertPixelWithGradientNoise): Bump the factor up a bit.
* canvas/philip/tests/2d.gradient.interpolate.multiple.html:
* canvas/philip/tests/2d.gradient.interpolate.solid.html:
* canvas/philip/tests/2d.gradient.radial.transform.1.html:
* canvas/philip/tests/2d.gradient.radial.transform.2.html:
* canvas/philip/tests/2d.gradient.radial.transform.3.html:
* canvas/philip/tests/initial.reset.gradient.html:

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

2 years agoBreakingContext::handleReplaced() should use replacedBox instead of m_current.renderer().
zalan@apple.com [Fri, 30 Jun 2017 06:21:04 +0000 (06:21 +0000)]
BreakingContext::handleReplaced() should use replacedBox instead of m_current.renderer().
https://bugs.webkit.org/show_bug.cgi?id=174011

Reviewed by Simon Fraser.

No change in functionality.

* rendering/line/BreakingContext.h:
(WebCore::BreakingContext::handleReplaced):
* rendering/line/LineWidth.cpp:
(WebCore::LineWidth::applyOverhang):
* rendering/line/LineWidth.h:

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

2 years ago[iOS DnD] Web content process crashes when the selection is moved far offscreen in...
wenson_hsieh@apple.com [Fri, 30 Jun 2017 04:44:53 +0000 (04:44 +0000)]
[iOS DnD] Web content process crashes when the selection is moved far offscreen in dragstart
https://bugs.webkit.org/show_bug.cgi?id=174010
<rdar://problem/32597802>

Reviewed by Tim Horton.

Source/WebCore:

The TextIndicator snapshot generated in createDragImageForSelection is not guaranteed to succeed; this patch
adds a null check following TextIndicator::createWithSelectionInFrame and bails early if the snapshot was not
successful.

Test: DataInteractionTests.DoNotCrashWhenSelectionMovesOffscreenAfterDragStart

* platform/ios/DragImageIOS.mm:
(WebCore::createDragImageForSelection):

Tools:

Adds a new API test to ensure that we don't crash trying to dereference a null RefPtr when the TextIndicator
snapshot fails for any reason.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/dragstart-change-selection-offscreen.html: Added.
* TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
(TestWebKitAPI::TEST):

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

2 years agoUploadedFile should include the file extension in its url
rniwa@webkit.org [Fri, 30 Jun 2017 04:43:00 +0000 (04:43 +0000)]
UploadedFile should include the file extension in its url
https://bugs.webkit.org/show_bug.cgi?id=174009

Reviewed by Chris Dumez.

Some command line tools such as darwinup use the file extension to determine the file type.
Include the file extension in the URL of an uploaded file to make it work with these tools.

* public/include/uploaded-file-helpers.php:
(format_uploaded_file): Include the file extension.
* public/v3/models/uploaded-file.js:
(UploadedFile):
(UploadedFile.prototype.url): Return the URL with hthe file extension specified. /api/uploaded-file
already supports having the file extension specified.
* server-tests/tools-sync-buildbot-integration-tests.js: Updated test cases.
* unit-tests/buildbot-syncer-tests.js: Ditto.

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

2 years agoAX: Cannot call setValue() on contenteditable or ARIA text controls
cfleizach@apple.com [Fri, 30 Jun 2017 03:43:25 +0000 (03:43 +0000)]
AX: Cannot call setValue() on contenteditable or ARIA text controls
https://bugs.webkit.org/show_bug.cgi?id=173520

Reviewed by Ryosuke Niwa.

Source/WebCore:

Add support for changing the value of a contenteditable and any other aria text control in setValue().

Test: accessibility/mac/set-value-editable-types.html

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::setValue):

Tools:

Add setValue() method to WKTR (already existed in DRT).

* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
(WTR::AccessibilityUIElement::setValue):
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::setValue):

LayoutTests:

* accessibility/mac/set-value-editable-types-expected.txt: Added.
* accessibility/mac/set-value-editable-types.html: Added.

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

2 years agoAssert that callback ID is not 0 or -1 during encoding and decoding
rniwa@webkit.org [Fri, 30 Jun 2017 03:03:54 +0000 (03:03 +0000)]
Assert that callback ID is not 0 or -1 during encoding and decoding
https://bugs.webkit.org/show_bug.cgi?id=173803

Reviewed by Brady Eidson.

To diagnosing the hang inside Safari (<rdar://problem/32841256>), add assertions for the callback ID
to be not 0 or -1 during encoding and decoding of IPC messages since the latest analysis seems to
indicate the hang is caused by the hash map getting corrupted by the insertion of 0 (empty value).

Wrapped the uint64_t in CallbackID and OptionalCallbackID to add assertions.

* NetworkProcess/soup/NetworkProcessSoup.cpp:
(WebKit::NetworkProcess::platformInitializeNetworkProcess):
* Shared/CallbackID.h: Added.
(WebKit::CallbackID::CallbackID):
(WebKit::CallbackID::operator==):
(WebKit::CallbackID::toInteger):
(WebKit::CallbackID::isValid):
(WebKit::CallbackID::isValidCallbackID): A callback ID is valid when it's neither 0 nor -1.
(WebKit::CallbackID::fromInteger): Create a CallbackID object from potentially unsafe value.
(WebKit::CallbackID::generateID): Generates the next callback ID. Moved from CallbackBase.
(WebKit::CallbackID::encode): Added. Assert that it's neither 0 nor -1.
(WebKit::CallbackID::decode): Ditto.
(WTF::CallbackIDHash::hash):
(WTF::CallbackIDHash::equal):
(WTF::HashTraits<WebKit::CallbackID>::emptyValue):
(WTF::HashTraits<WebKit::CallbackID>::constructDeletedValue):
(WTF::HashTraits<WebKit::CallbackID>::isDeletedValue):
* Shared/OptionalCallbackID.h: Added. Unlike CallbackID, callback ID here can be 0.
(WebKit::OptionalCallbackID::OptionalCallbackID):
(WebKit::OptionalCallbackID::toInteger):
(WebKit::OptionalCallbackID::callbackID): Returns a valid CallbackID object. The caller of
this function must have verified that the ID is neither 0 or -1 before calling this function.
(WebKit::OptionalCallbackID::operator bool):
(WebKit::OptionalCallbackID::isValid):
(WebKit::OptionalCallbackID::isValidCallbackID):
(WebKit::OptionalCallbackID::encode): Since OptionalCallbackID can be 0, only assert that it's not -1.
(WebKit::OptionalCallbackID::decode): Ditto.
* Shared/mac/RemoteLayerTreeTransaction.h:
* Shared/mac/RemoteLayerTreeTransaction.h:
* UIProcess/GenericCallback.h:
(WebKit::CallbackBase::callbackID): Returns a CallbackID object instead of uint64_t.
(WebKit::CallbackBase::CallbackBase):
(WebKit::CallbackBase::generateCallbackID): Deleted.
(WebKit::CallbackMap::put): Returns a callback ID. Also added a version that doesn't take activity token
as used in WebCookieManagerProxy
(WebKit::CallbackMap::take): Takes a callback ID.
* UIProcess/WebCookieManagerProxy.cpp: Updated the code as callback maps are merged.
(WebKit::WebCookieManagerProxy::processPoolDestroyed):
(WebKit::WebCookieManagerProxy::processDidClose):
(WebKit::WebCookieManagerProxy::getHostnamesWithCookies):
(WebKit::WebCookieManagerProxy::didGetHostnamesWithCookies):
(WebKit::WebCookieManagerProxy::deleteCookie):
(WebKit::WebCookieManagerProxy::deleteAllCookiesModifiedSince):
(WebKit::WebCookieManagerProxy::setCookie):
(WebKit::WebCookieManagerProxy::setCookies):
(WebKit::WebCookieManagerProxy::getAllCookies):
(WebKit::WebCookieManagerProxy::getCookies):
(WebKit::WebCookieManagerProxy::didSetCookies):
(WebKit::WebCookieManagerProxy::didGetCookies):
(WebKit::WebCookieManagerProxy::didDeleteCookies):
(WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
(WebKit::WebCookieManagerProxy::getHTTPCookieAcceptPolicy):
(WebKit::WebCookieManagerProxy::didGetHTTPCookieAcceptPolicy):
(WebKit::WebCookieManagerProxy::didSetHTTPCookieAcceptPolicy):
* UIProcess/WebCookieManagerProxy.h:
* UIProcess/WebCookieManagerProxy.messages.in:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setInitialFocus):
(WebKit::WebPageProxy::validateCommand):
(WebKit::WebPageProxy::runJavaScriptInMainFrame):
(WebKit::WebPageProxy::getRenderTreeExternalRepresentation):
(WebKit::WebPageProxy::getSourceForFrame):
(WebKit::WebPageProxy::getContentsAsString):
(WebKit::WebPageProxy::getBytecodeProfile):
(WebKit::WebPageProxy::getSamplingProfilerOutput):
(WebKit::WebPageProxy::getContentsAsMHTMLData):
(WebKit::WebPageProxy::getSelectionOrContentsAsString):
(WebKit::WebPageProxy::getSelectionAsWebArchiveData):
(WebKit::WebPageProxy::getMainResourceDataOfFrame):
(WebKit::WebPageProxy::getResourceDataFromFrame):
(WebKit::WebPageProxy::getWebArchiveOfFrame):
(WebKit::WebPageProxy::forceRepaint):
(WebKit::WebPageProxy::clearLoadDependentCallbacks):
(WebKit::WebPageProxy::voidCallback):
(WebKit::WebPageProxy::dataCallback):
(WebKit::WebPageProxy::imageCallback):
(WebKit::WebPageProxy::stringCallback):
(WebKit::WebPageProxy::invalidateStringCallback):
(WebKit::WebPageProxy::scriptValueCallback):
(WebKit::WebPageProxy::computedPagesCallback):
(WebKit::WebPageProxy::validateCommandCallback):
(WebKit::WebPageProxy::unsignedCallback):
(WebKit::WebPageProxy::editingRangeCallback):
(WebKit::WebPageProxy::machSendRightCallback):
(WebKit::WebPageProxy::rectForCharacterRangeCallback):
(WebKit::WebPageProxy::printFinishedCallback):
(WebKit::WebPageProxy::computePagesForPrinting):
(WebKit::WebPageProxy::drawRectToImage):
(WebKit::WebPageProxy::drawPagesToPDF):
(WebKit::WebPageProxy::drawPagesForPrinting):
(WebKit::WebPageProxy::getMarkedRangeAsync):
(WebKit::WebPageProxy::getSelectedRangeAsync):
(WebKit::WebPageProxy::characterIndexForPointAsync):
(WebKit::WebPageProxy::firstRectForCharacterRangeAsync):
(WebKit::WebPageProxy::takeSnapshot):
(WebKit::WebPageProxy::installActivityStateChangeCompletionHandler):
(WebKit::WebPageProxy::getLoadDecisionForIcon):
(WebKit::WebPageProxy::finishedLoadingIcon):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::gestureCallback):
(WebKit::WebPageProxy::touchesCallback):
(WebKit::WebPageProxy::autocorrectionDataCallback):
(WebKit::WebPageProxy::selectionContextCallback):
(WebKit::WebPageProxy::autocorrectionContextCallback):
(WebKit::WebPageProxy::selectionRectsCallback):
(WebKit::WebPageProxy::selectWithGesture):
(WebKit::WebPageProxy::updateSelectionWithTouches):
(WebKit::WebPageProxy::requestAutocorrectionData):
(WebKit::WebPageProxy::applyAutocorrection):
(WebKit::WebPageProxy::executeEditCommand):
(WebKit::WebPageProxy::selectTextWithGranularityAtPoint):
(WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection):
(WebKit::WebPageProxy::moveSelectionAtBoundaryWithDirection):
(WebKit::WebPageProxy::selectPositionAtPoint):
(WebKit::WebPageProxy::beginSelectionInDirection):
(WebKit::WebPageProxy::updateSelectionWithExtentPoint):
(WebKit::WebPageProxy::updateSelectionWithExtentPointAndBoundary):
(WebKit::WebPageProxy::requestDictationContext):
(WebKit::WebPageProxy::requestAutocorrectionContext):
(WebKit::WebPageProxy::getSelectionContext):
(WebKit::WebPageProxy::selectWithTwoTouches):
(WebKit::WebPageProxy::requestRectsForGranularityWithSelectionOffset):
(WebKit::WebPageProxy::requestRectsAtSelectionOffsetWithText):
(WebKit::WebPageProxy::moveSelectionByOffset):
(WebKit::WebPageProxy::focusNextAssistedNode):
(WebKit::WebPageProxy::computePagesForPrintingAndDrawToPDF):
(WebKit::WebPageProxy::drawToPDFCallback):
* UIProcess/mac/WKPrintingView.mm:
(-[WKPrintingView _preparePDFDataForPrintingOnSecondaryThread]):
(-[WKPrintingView _askPageToComputePageRects]):
(-[WKPrintingView _drawPreview:]):
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::attributedSubstringForCharacterRangeAsync):
(WebKit::WebPageProxy::attributedStringForCharacterRangeCallback):
(WebKit::WebPageProxy::fontAtSelection):
(WebKit::WebPageProxy::fontAtSelectionCallback):
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/Cookies/WebCookieManager.cpp:
(WebKit::WebCookieManager::getHostnamesWithCookies):
(WebKit::WebCookieManager::deleteCookie):
(WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
(WebKit::WebCookieManager::getAllCookies):
(WebKit::WebCookieManager::getCookies):
(WebKit::WebCookieManager::setCookie):
(WebKit::WebCookieManager::setCookies):
(WebKit::WebCookieManager::setHTTPCookieAcceptPolicy):
(WebKit::WebCookieManager::getHTTPCookieAcceptPolicy):
* WebProcess/Cookies/WebCookieManager.h:
* WebProcess/Cookies/WebCookieManager.messages.in:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::getLoadDecisionForIcon):
(WebKit::WebFrameLoaderClient::finishedLoadingIcon):
* WebProcess/WebPage/AcceleratedDrawingArea.cpp:
(WebKit::AcceleratedDrawingArea::forceRepaintAsync):
(WebKit::AcceleratedDrawingArea::activityStateDidChange):
* WebProcess/WebPage/AcceleratedDrawingArea.h:
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
(WebKit::CoordinatedLayerTreeHost::forceRepaintAsync):
(WebKit::CoordinatedLayerTreeHost::renderNextFrame):
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::forceRepaintAsync):
(WebKit::DrawingArea::activityStateDidChange):
(WebKit::DrawingArea::addTransactionCallbackID):
* WebProcess/WebPage/DrawingArea.messages.in:
* WebProcess/WebPage/LayerTreeHost.h:
(WebKit::LayerTreeHost::forceRepaintAsync):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::reinitializeWebPage):
(WebKit::WebPage::takeSnapshot):
(WebKit::WebPage::validateCommand):
(WebKit::WebPage::setInitialFocus):
(WebKit::WebPage::setActivityState):
(WebKit::WebPage::runJavaScriptInMainFrame):
(WebKit::WebPage::getContentsAsString):
(WebKit::WebPage::getContentsAsMHTMLData):
(WebKit::WebPage::getRenderTreeExternalRepresentation):
(WebKit::WebPage::getSelectionAsWebArchiveData):
(WebKit::WebPage::getSelectionOrContentsAsString):
(WebKit::WebPage::getSourceForFrame):
(WebKit::WebPage::getMainResourceDataOfFrame):
(WebKit::WebPage::getResourceDataFromFrame):
(WebKit::WebPage::getWebArchiveOfFrame):
(WebKit::WebPage::forceRepaint):
(WebKit::WebPage::computePagesForPrinting):
(WebKit::WebPage::drawRectToImage):
(WebKit::WebPage::drawPagesToPDF):
(WebKit::WebPage::drawPagesForPrinting):
(WebKit::WebPage::didFinishPrintOperation):
(WebKit::WebPage::getMarkedRangeAsync):
(WebKit::WebPage::getSelectedRangeAsync):
(WebKit::WebPage::characterIndexForPointAsync):
(WebKit::WebPage::firstRectForCharacterRangeAsync):
(WebKit::WebPage::getBytecodeProfile):
(WebKit::WebPage::getSamplingProfilerOutput):
(WebKit::WebPage::didGetLoadDecisionForIcon):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:
(WebKit::WebPrintOperationGtk::WebPrintOperationGtk):
* WebProcess/WebPage/gtk/WebPrintOperationGtk.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getSelectionContext):
(WebKit::WebPage::selectWithGesture):
(WebKit::WebPage::updateSelectionWithTouches):
(WebKit::WebPage::selectWithTwoTouches):
(WebKit::WebPage::moveSelectionByOffset):
(WebKit::WebPage::getRectsForGranularityWithSelectionOffset):
(WebKit::WebPage::getRectsAtSelectionOffsetWithText):
(WebKit::WebPage::selectPositionAtPoint):
(WebKit::WebPage::selectPositionAtBoundaryWithDirection):
(WebKit::WebPage::moveSelectionAtBoundaryWithDirection):
(WebKit::WebPage::selectTextWithGranularityAtPoint):
(WebKit::WebPage::beginSelectionInDirection):
(WebKit::WebPage::updateSelectionWithExtentPointAndBoundary):
(WebKit::WebPage::updateSelectionWithExtentPoint):
(WebKit::WebPage::requestDictationContext):
(WebKit::WebPage::requestAutocorrectionData):
(WebKit::WebPage::applyAutocorrection):
(WebKit::WebPage::executeEditCommandWithCallback):
(WebKit::WebPage::requestAutocorrectionContext):
(WebKit::WebPage::focusNextAssistedNode):
(WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::activityStateDidChange):
(WebKit::RemoteLayerTreeDrawingArea::addTransactionCallbackID):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::forceRepaintAsync):
(WebKit::TiledCoreAnimationDrawingArea::activityStateDidChange):
(WebKit::TiledCoreAnimationDrawingArea::didUpdateActivityStateTimerFired):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::attributedSubstringForCharacterRangeAsync):
(WebKit::WebPage::fontAtSelection):

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

2 years agoWeb Inspector: Provide a way for creating a new tab but not making it immediately...
drousso@apple.com [Fri, 30 Jun 2017 02:25:02 +0000 (02:25 +0000)]
Web Inspector: Provide a way for creating a new tab but not making it immediately selected
https://bugs.webkit.org/show_bug.cgi?id=173983

Reviewed by Joseph Pecoraro.

* UserInterface/Views/TabBar.js:
(WebInspector.TabBar):
(WebInspector.TabBar.prototype.addTabBarItem):
(WebInspector.TabBar.prototype.insertTabBarItem):
(WebInspector.TabBar.prototype.removeTabBarItem):
(WebInspector.TabBar.prototype._handleClick):
(WebInspector.TabBar.prototype._handleNewTabClick):
* UserInterface/Views/TabBrowser.js:
(WebInspector.TabBrowser.prototype.addTabForContentView):
(WebInspector.TabBrowser.prototype.showTabForContentView):
(WebInspector.TabBrowser.prototype.closeTabForContentView):
* UserInterface/Base/Main.js:
(WebInspector.contentLoaded):
(WebInspector._openDefaultTab):
(WebInspector._tryToRestorePendingTabs):
(WebInspector.showNewTabTab):
(WebInspector.createNewTabWithType):
Add `options` dictionaries instead of optional parameters.

(WebInspector.tabContentViewClassForRepresentedObject):
Drive-by fix: remove incorrect placement of WebInspector.Collection check. This function
determines TabContentView classes, not ContentView.

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

2 years agoWeb Inspector: Remove unnecessary hasChildren from TreeOutline
drousso@apple.com [Fri, 30 Jun 2017 02:16:05 +0000 (02:16 +0000)]
Web Inspector: Remove unnecessary hasChildren from TreeOutline
https://bugs.webkit.org/show_bug.cgi?id=173986

Reviewed by Joseph Pecoraro.

* UserInterface/Views/TreeOutline.js:
(WebInspector.TreeOutline):
(WebInspector.TreeOutline.prototype.appendChild):
(WebInspector.TreeOutline.prototype.insertChild):
(WebInspector.TreeOutline.prototype.removeChildAtIndex):
(WebInspector.TreeOutline.prototype.removeChild):
(WebInspector.TreeOutline.prototype.get selectedTreeElementIndex):

* UserInterface/Views/NavigationSidebarPanel.js:
(WebInspector.NavigationSidebarPanel.prototype._checkOutlinesForPendingViewStateCookie):
* UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.js:
(WebInspector.VisualStyleCommaSeparatedKeywordEditor.prototype.get value):

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

2 years agogetBoundingClientRect returns wrong value for combination of page zoom and scroll
simon.fraser@apple.com [Fri, 30 Jun 2017 02:09:09 +0000 (02:09 +0000)]
getBoundingClientRect returns wrong value for combination of page zoom and scroll
https://bugs.webkit.org/show_bug.cgi?id=173841
rdar://problem/32983841

Reviewed by Dean Jackson.

Source/WebCore:

The layout viewport returned by FrameView::layoutViewportRect() is affected by page (Command-+) zooming,
since it's computed using scroll positions, so when we use its origin to convert into client coordinates
(which are zoom-agnostic), we need to account for page zoom, so fix FrameView::documentToClientOffset()
to do this.

Callers of documentToClientOffset() were checked, revealing that event client coordinates were also
wrong with page zoom and are fixed in the same way. It was found that SimulatedClick was using an
entirely wrong rect to compute its location: Element::clientRect() is NOT in client coordinates,
so change this code to use getBoundingClientRect() instead.

Minor refactoring in MouseRelatedEvent to make getting to the FrameView cleaner.

Some geometry types enhanced to have non-mutating scale functions.

Tests: fast/events/simulated-click-zoomed.html
       fast/visual-viewport/client-rects-relative-to-layout-viewport-zoomed.html

* dom/MouseRelatedEvent.cpp:
(WebCore::MouseRelatedEvent::init):
(WebCore::MouseRelatedEvent::initCoordinates):
(WebCore::MouseRelatedEvent::frameView):
(WebCore::MouseRelatedEvent::documentToAbsoluteScaleFactor):
(WebCore::MouseRelatedEvent::computePageLocation):
(WebCore::MouseRelatedEvent::computeRelativePosition):
(WebCore::pageZoomFactor): Deleted.
(WebCore::frameScaleFactor): Deleted.
* dom/MouseRelatedEvent.h:
(WebCore::MouseRelatedEvent::absoluteLocation):
(WebCore::MouseRelatedEvent::setAbsoluteLocation): Deleted.
* dom/SimulatedClick.cpp:
* page/FrameView.cpp:
(WebCore::FrameView::layoutViewportRect): baseLayoutViewportSize() is the same as the old code.
(WebCore::FrameView::documentToAbsoluteScaleFactor):
(WebCore::FrameView::absoluteToDocumentScaleFactor):
(WebCore::FrameView::absoluteToDocumentPoint):
(WebCore::FrameView::documentToClientOffset):
* page/FrameView.h:
* platform/graphics/FloatPoint.h:
(WebCore::FloatPoint::scale):
(WebCore::FloatPoint::scaled):
* platform/graphics/FloatSize.h:
(WebCore::FloatSize::scaled):
* platform/graphics/LayoutPoint.h:
(WebCore::LayoutPoint::scaled):

Tools:

Make "Zoom In" and "Zoom Out" work correctly in the WebKit1 window. Previously they
always did text zooming.

* MiniBrowser/mac/WK1BrowserWindowController.m:
(-[WK1BrowserWindowController zoomIn:]):
(-[WK1BrowserWindowController zoomOut:]):
(-[WK1BrowserWindowController canResetZoom]):
(-[WK1BrowserWindowController resetZoom:]):

LayoutTests:

* fast/events/clientXY-in-zoom-and-scroll.html: New baseline for progressed behavior.
* fast/events/simulated-click-zoomed-expected.txt: Added.
* fast/events/simulated-click-zoomed.html: Added.
* fast/visual-viewport/client-rects-relative-to-layout-viewport-zoomed-expected.txt: Added.
* fast/visual-viewport/client-rects-relative-to-layout-viewport-zoomed.html: Added.
* platform/ios/TestExpectations:
* platform/mac/fast/events/clientXY-in-zoom-and-scroll-expected.txt:

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

2 years agoUnreviewed, fixing Window's build after r218976
megan_gardner@apple.com [Fri, 30 Jun 2017 01:13:03 +0000 (01:13 +0000)]
Unreviewed, fixing Window's build after r218976

* rendering/ScrollAlignment.cpp:
(WebCore::operator<<):

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

2 years ago[iOS] Don't confuse coordinate spaces when computing the size of PDF snapshots
aestes@apple.com [Fri, 30 Jun 2017 01:01:06 +0000 (01:01 +0000)]
[iOS] Don't confuse coordinate spaces when computing the size of PDF snapshots
https://bugs.webkit.org/show_bug.cgi?id=173996
<rdar://problem/32961028>

Reviewed by Tim Horton.

When computing the printing rect for PDF snapshots, we were getting the width the
WKContentView's bounds and the height from the WKScrollView's contentSize. These sizes are
in different coordinate spaces, leading to incorrect clipping on sites that have a non-1
scale factor.

Fix this by using the WKContentView's bounds for both width and height.

* UIProcess/ios/WKContentView.mm:
(-[WKContentView _wk_pageCountForPrintFormatter:]):

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

2 years agoCalculating postCapacity in unshiftCountSlowCase is wrong
sbarati@apple.com [Fri, 30 Jun 2017 00:58:18 +0000 (00:58 +0000)]
Calculating postCapacity in unshiftCountSlowCase is wrong
https://bugs.webkit.org/show_bug.cgi?id=173992
<rdar://problem/32283199>

Reviewed by Keith Miller.

JSTests:

* stress/unshiftCountSlowCase-correct-postCapacity.js: Added.
(temp):

Source/JavaScriptCore:

This patch fixes a bug inside unshiftCountSlowCase where we would use
more memory than we allocated. The bug was when deciding how much extra
space we have after the vector we've allocated. This area is called the
postCapacity. The largest legal postCapacity value we could use is the
space we allocated minus the space we need:
largestPossiblePostCapacity = newStorageCapacity - requiredVectorLength;
However, the code was calculating the postCapacity as:
postCapacity = max(newStorageCapacity - requiredVectorLength, count);

where count is how many elements we're appending. Depending on the inputs,
count could be larger than (newStorageCapacity - requiredVectorLength). This
would cause us to use more memory than we actually allocated.

* runtime/JSArray.cpp:
(JSC::JSArray::unshiftCountSlowCase):

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

2 years agoAdd TextStream operators for Range, VisiblePosition, VisibleSelection, and ScrollAlig...
megan_gardner@apple.com [Fri, 30 Jun 2017 00:55:34 +0000 (00:55 +0000)]
Add TextStream operators for Range, VisiblePosition, VisibleSelection, and ScrollAlignment
https://bugs.webkit.org/show_bug.cgi?id=173997

Reviewed by Simon Fraser.

Adding logging that can be used with TextStream-based LOG_WITH_STREAM.

* dom/Range.cpp:
(WebCore::operator<<):
* dom/Range.h:
* editing/VisiblePosition.h:
* editing/VisibleSelection.cpp:
(WebCore::operator<<):
* editing/VisibleSelection.h:
* rendering/ScrollAlignment.cpp:
(WebCore::operator<<):
* rendering/ScrollAlignment.h:

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

2 years agoWeb Inspector: Cleanup unused/invalid parameters for SidebarPanels
drousso@apple.com [Fri, 30 Jun 2017 00:41:04 +0000 (00:41 +0000)]
Web Inspector: Cleanup unused/invalid parameters for SidebarPanels
https://bugs.webkit.org/show_bug.cgi?id=173985

Reviewed by Joseph Pecoraro.

* UserInterface/Views/SidebarPanel.js:
* UserInterface/Views/NavigationSidebarPanel.js:
* UserInterface/Views/NavigationSidebarPanel.css:
(.sidebar > .panel.navigation > .overflow-shadow.top): Deleted.
* UserInterface/Views/DetailsSidebarPanel.js:

* UserInterface/Views/ApplicationCacheDetailsSidebarPanel.js:
* UserInterface/Views/CSSStyleDetailsSidebarPanel.js:
* UserInterface/Views/DOMDetailsSidebarPanel.js:
* UserInterface/Views/DOMNodeDetailsSidebarPanel.js:
* UserInterface/Views/IndexedDatabaseDetailsSidebarPanel.js:
* UserInterface/Views/LayerTreeDetailsSidebarPanel.js:
* UserInterface/Views/ProbeDetailsSidebarPanel.js:
* UserInterface/Views/ResourceDetailsSidebarPanel.js:
* UserInterface/Views/ScopeChainDetailsSidebarPanel.js:
* UserInterface/Views/StorageSidebarPanel.js:

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

2 years agoUnreviewed, rolling out r218903.
jlewis3@apple.com [Fri, 30 Jun 2017 00:15:56 +0000 (00:15 +0000)]
Unreviewed, rolling out r218903.

This patch and its fix cause immediate flakiness on all WK2
testers

Reverted changeset:

"Support PeerConnectionStates::BundlePolicy::MaxBundle when
setting rtc configuration"
https://bugs.webkit.org/show_bug.cgi?id=169389
http://trac.webkit.org/changeset/218903

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

2 years agoUnreviewed, rolling out r218963.
jlewis3@apple.com [Fri, 30 Jun 2017 00:14:55 +0000 (00:14 +0000)]
Unreviewed, rolling out r218963.

This patch and its fix cause immediate flakiness on all WK2
testers

Reverted changeset:

"Support PeerConnectionStates::BundlePolicy::MaxBundle when
setting rtc configuration"
https://bugs.webkit.org/show_bug.cgi?id=169389
http://trac.webkit.org/changeset/218963

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

2 years agoSplit ResourceLoadObserver into 2 classes: one for WebCore and one for the UIProcess
cdumez@apple.com [Thu, 29 Jun 2017 23:40:29 +0000 (23:40 +0000)]
Split ResourceLoadObserver into 2 classes: one for WebCore and one for the UIProcess
https://bugs.webkit.org/show_bug.cgi?id=173990

Reviewed by Brent Fulgham.

Split ResourceLoadObserver into 2 classes: one for WebCore and one for the UIProcess.
They really have different API and there is therefore close to no code duplication.

Source/WebCore:

* loader/ResourceLoadObserver.cpp:
(WebCore::primaryDomain):
(WebCore::ResourceLoadObserver::setStatisticsQueue):
(WebCore::ResourceLoadObserver::shouldLog):
* loader/ResourceLoadObserver.h:
* loader/ResourceLoadStatisticsStore.cpp:
(WebCore::ResourceLoadStatisticsStore::primaryDomain):
* loader/ResourceLoadStatisticsStore.h:
* platform/URL.h:

Source/WebKit2:

* CMakeLists.txt:
* UIProcess/Cocoa/WebResourceLoadStatisticsManagerCocoa.mm:
(WebKit::WebResourceLoadStatisticsManager::registerUserDefaultsIfNeeded):
* UIProcess/WebResourceLoadObserver.cpp: Added.
(WebKit::primaryDomain):
(WebKit::WebResourceLoadObserver::sharedObserver):
(WebKit::WebResourceLoadObserver::setStatisticsStore):
(WebKit::WebResourceLoadObserver::setStatisticsQueue):
(WebKit::WebResourceLoadObserver::clearInMemoryStore):
(WebKit::WebResourceLoadObserver::clearInMemoryAndPersistentStore):
(WebKit::WebResourceLoadObserver::logUserInteraction):
(WebKit::WebResourceLoadObserver::clearUserInteraction):
(WebKit::WebResourceLoadObserver::hasHadUserInteraction):
(WebKit::WebResourceLoadObserver::setPrevalentResource):
(WebKit::WebResourceLoadObserver::isPrevalentResource):
(WebKit::WebResourceLoadObserver::clearPrevalentResource):
(WebKit::WebResourceLoadObserver::setGrandfathered):
(WebKit::WebResourceLoadObserver::isGrandfathered):
(WebKit::WebResourceLoadObserver::setSubframeUnderTopFrameOrigin):
(WebKit::WebResourceLoadObserver::setSubresourceUnderTopFrameOrigin):
(WebKit::WebResourceLoadObserver::setSubresourceUniqueRedirectTo):
(WebKit::WebResourceLoadObserver::setTimeToLiveUserInteraction):
(WebKit::WebResourceLoadObserver::setTimeToLiveCookiePartitionFree):
(WebKit::WebResourceLoadObserver::setMinimumTimeBetweeenDataRecordsRemoval):
(WebKit::WebResourceLoadObserver::setGrandfatheringTime):
(WebKit::WebResourceLoadObserver::fireDataModificationHandler):
(WebKit::WebResourceLoadObserver::fireShouldPartitionCookiesHandler):
(WebKit::WebResourceLoadObserver::fireTelemetryHandler):
* UIProcess/WebResourceLoadObserver.h: Added.
* UIProcess/WebResourceLoadStatisticsManager.cpp:
(WebKit::WebResourceLoadStatisticsManager::setPrevalentResource):
(WebKit::WebResourceLoadStatisticsManager::isPrevalentResource):
(WebKit::WebResourceLoadStatisticsManager::setHasHadUserInteraction):
(WebKit::WebResourceLoadStatisticsManager::hasHadUserInteraction):
(WebKit::WebResourceLoadStatisticsManager::setGrandfathered):
(WebKit::WebResourceLoadStatisticsManager::isGrandfathered):
(WebKit::WebResourceLoadStatisticsManager::setSubframeUnderTopFrameOrigin):
(WebKit::WebResourceLoadStatisticsManager::setSubresourceUnderTopFrameOrigin):
(WebKit::WebResourceLoadStatisticsManager::setSubresourceUniqueRedirectTo):
(WebKit::WebResourceLoadStatisticsManager::setTimeToLiveUserInteraction):
(WebKit::WebResourceLoadStatisticsManager::setTimeToLiveCookiePartitionFree):
(WebKit::WebResourceLoadStatisticsManager::setMinimumTimeBetweeenDataRecordsRemoval):
(WebKit::WebResourceLoadStatisticsManager::setGrandfatheringTime):
(WebKit::WebResourceLoadStatisticsManager::fireDataModificationHandler):
(WebKit::WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler):
(WebKit::WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandlerForOneDomain):
(WebKit::WebResourceLoadStatisticsManager::fireTelemetryHandler):
(WebKit::WebResourceLoadStatisticsManager::clearInMemoryAndPersistentStore):
(WebKit::WebResourceLoadStatisticsManager::clearInMemoryAndPersistentStoreModifiedSinceHours):
(WebKit::WebResourceLoadStatisticsManager::resetToConsistentState):
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::removeData):
* WebKit2.xcodeproj/project.pbxproj:

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

2 years ago[WebIDL] Remove custom binding for UserMessageHandlersNamespace
commit-queue@webkit.org [Thu, 29 Jun 2017 23:13:26 +0000 (23:13 +0000)]
[WebIDL] Remove custom binding for UserMessageHandlersNamespace
https://bugs.webkit.org/show_bug.cgi?id=173956

Patch by Sam Weinig <sam@webkit.org> on 2017-06-29
Reviewed by Darin Adler.

Source/WebCore:

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSUserMessageHandlersNamespaceCustom.cpp: Removed.
Remove JSUserMessageHandlersNamespaceCustom.cpp

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateNamedGetterLambda):
Add support for calling named getters with additional arguments from [CallWith].

(GenerateAttributeGetterBodyDefinition):
(GenerateAttributeSetterBodyDefinition):
(GenerateCallWithUsingReferences):
(GenerateCallWithUsingPointers):
(GenerateConstructorCallWithUsingPointers):
(GenerateCallWith):
(GenerateParametersCheck):
Update arguments to GenerateCallWith(Using...) to no longer pass an operation,
which was only needed for the no longer used ScriptArguments, pass a thisObject
reference, and optionally pass an indentation.

* bindings/scripts/IDLAttributes.json:
Remove no longer used ScriptArguments and CallStack, add World.

* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjWithScriptArgumentsAndCallStackAttributeGetter): Deleted.
(WebCore::jsTestObjWithScriptArgumentsAndCallStackAttribute): Deleted.
(WebCore::setJSTestObjWithScriptArgumentsAndCallStackAttributeSetter): Deleted.
(WebCore::setJSTestObjWithScriptArgumentsAndCallStackAttribute): Deleted.
(WebCore::jsTestObjPrototypeFunctionWithScriptArgumentsAndCallStackBody): Deleted.
(WebCore::jsTestObjPrototypeFunctionWithScriptArgumentsAndCallStack): Deleted.
* bindings/scripts/test/TestObj.idl:
Remove tests of ScriptArguments and CallStack.

* bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp: Added.
* bindings/scripts/test/JS/JSTestNamedGetterCallWith.h: Added.
* bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp: Added.
* bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.h: Added.
* bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp: Added.
* bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.h: Added.
* bindings/scripts/test/TestNamedGetterCallWith.idl: Added.
* bindings/scripts/test/TestNamedGetterNoIdentifier.idl: Added.
* bindings/scripts/test/TestNamedGetterWithIdentifier.idl: Added.
Add basic named getter tests and a specific test of named getters using CallWith.

* page/UserMessageHandlersNamespace.cpp:
(WebCore::UserMessageHandlersNamespace::supportedPropertyNames):
(WebCore::UserMessageHandlersNamespace::namedItem):
(WebCore::UserMessageHandlersNamespace::handler): Deleted.
* page/UserMessageHandlersNamespace.h:
Rename handler to namedItem, matching convention and the expectations of the
bindings generator and swap the order of the arguments for the same reason.

* page/UserMessageHandlersNamespace.idl:
Remove CustomGetOwnPropertySlotAndDescriptor, and add the anonymous named getter.

Source/WebKit2:

* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp:
(webkit_dom_dom_window_webkit_message_handlers_post_message):
Update for name change.

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

2 years agoAvoid copying ResourceLoadStatistics objects
cdumez@apple.com [Thu, 29 Jun 2017 23:07:48 +0000 (23:07 +0000)]
Avoid copying ResourceLoadStatistics objects
https://bugs.webkit.org/show_bug.cgi?id=173972

Reviewed by Brent Fulgham.

Avoid copying ResourceLoadStatistics objects given that they are big. Make the type move-only
to avoid such mistakes in the future.

* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::logFrameNavigation):
* loader/ResourceLoadStatistics.h:
(WebCore::ResourceLoadStatistics::ResourceLoadStatistics):

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

2 years agoFix for intermittent Layout Test fail http/tests/loading/resourceLoadStatistics/telem...
wilander@apple.com [Thu, 29 Jun 2017 22:22:35 +0000 (22:22 +0000)]
Fix for intermittent Layout Test fail http/tests/loading/resourceLoadStatistics/telemetry-generation.html
https://bugs.webkit.org/show_bug.cgi?id=173940
<rdar://problem/33018125>

Reviewed by Brent Fulgham.

Source/WebCore:

No new tests. This change enables the exiting test to pass.

* loader/ResourceLoadStatisticsStore.cpp:
(WebCore::ResourceLoadStatisticsStore::sortedPrevalentResourceTelemetry):
    Added an assert.

Source/WebKit2:

This change allows the TestController to turn off
regular resource load statistics telemetry submission
and to manually control when telemetry is calculated
and submitted.

* UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
(WKResourceLoadStatisticsManagerSetShouldSubmitTelemetry):
    New test infrastructure.
* UIProcess/API/C/WKResourceLoadStatisticsManager.h:
* UIProcess/WebResourceLoadStatisticsManager.cpp:
(WebKit::WebResourceLoadStatisticsManager::setShouldSubmitTelemetry):
    New test infrastructure.
* UIProcess/WebResourceLoadStatisticsManager.h:
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::setShouldSubmitTelemetry):
    New test infrastructure.
(WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
    The test function now calls
    WebResourceLoadStatisticsStore::submitTelemetry() directly
    instead of firing the timer.
(WebKit::WebResourceLoadStatisticsStore::telemetryTimerFired):
    Now checks whether it should submit telemetry or not.
(WebKit::WebResourceLoadStatisticsStore::submitTelemetry):
    Split out so that the test code doesn't have to fire the timer.
* UIProcess/WebResourceLoadStatisticsStore.h:
* UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
(WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
    Now doesn't submit if it's executed by test code.

Tools:

This change allows the TestController to turn off
regular resource load statistics telemetry submission
and to manually control when telemetry is calculated
and submitted.

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
    Turns off automatic resource load statistics telemetry submission.

LayoutTests:

* platform/wk2/TestExpectations:
    http/tests/loading/resourceLoadStatistics/telemetry-generation.html
    is now expected to pass.

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

2 years agoSupport PeerConnectionStates::BundlePolicy::MaxBundle when setting rtc configuration
commit-queue@webkit.org [Thu, 29 Jun 2017 22:05:09 +0000 (22:05 +0000)]
Support PeerConnectionStates::BundlePolicy::MaxBundle when setting rtc configuration
https://bugs.webkit.org/show_bug.cgi?id=169389

Unreviewed.

Patch by Youenn Fablet <youenn@apple.com> on 2017-06-29

* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
(WebCore::configurationFromMediaEndpointConfiguration): Reactivating CPU overuse detection as it might be the cause of the bots regressions.

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

2 years ago[Curl] ResourceHandleManager violate the class responsibility of ResourceHandle
commit-queue@webkit.org [Thu, 29 Jun 2017 21:58:55 +0000 (21:58 +0000)]
[Curl] ResourceHandleManager violate the class responsibility of ResourceHandle
https://bugs.webkit.org/show_bug.cgi?id=173630

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

* platform/network/ResourceHandle.h:
* platform/network/curl/ResourceHandleCurl.cpp:
(WebCore::ResourceHandle::platformLoadResourceSynchronously):
(WebCore::calculateWebTimingInformations):
(WebCore::handleLocalReceiveResponse):
(WebCore::writeCallback):
(WebCore::isHttpInfo):
(WebCore::isHttpRedirect):
(WebCore::isHttpAuthentication):
(WebCore::isHttpNotModified):
(WebCore::isAppendableHeader):
(WebCore::removeLeadingAndTrailingQuotes):
(WebCore::getProtectionSpace):
(WebCore::headerCallback):
(WebCore::readCallback):
(WebCore::getFormElementsCount):
(WebCore::setupFormData):
(WebCore::ResourceHandle::setupPUT):
(WebCore::ResourceHandle::setupPOST):
(WebCore::ResourceHandle::handleDataURL):
(WebCore::ResourceHandle::dispatchSynchronousJob):
(WebCore::ResourceHandle::applyAuthentication):
(WebCore::ResourceHandle::initialize):
(WebCore::ResourceHandle::handleCurlMsg):
* platform/network/curl/ResourceHandleManager.cpp:
(WebCore::ResourceHandleManager::downloadTimerCallback):
(WebCore::ResourceHandleManager::startJob):
(WebCore::calculateWebTimingInformations): Deleted.
(WebCore::isHttpInfo): Deleted.
(WebCore::isHttpRedirect): Deleted.
(WebCore::isHttpAuthentication): Deleted.
(WebCore::isHttpNotModified): Deleted.
(WebCore::handleLocalReceiveResponse): Deleted.
(WebCore::writeCallback): Deleted.
(WebCore::isAppendableHeader): Deleted.
(WebCore::removeLeadingAndTrailingQuotes): Deleted.
(WebCore::getProtectionSpace): Deleted.
(WebCore::headerCallback): Deleted.
(WebCore::readCallback): Deleted.
(WebCore::getFormElementsCount): Deleted.
(WebCore::setupFormData): Deleted.
(WebCore::ResourceHandleManager::setupPUT): Deleted.
(WebCore::ResourceHandleManager::setupPOST): Deleted.
(WebCore::handleDataURL): Deleted.
(WebCore::ResourceHandleManager::dispatchSynchronousJob): Deleted.
(WebCore::ResourceHandleManager::applyAuthenticationToRequest): Deleted.
(WebCore::ResourceHandleManager::initializeHandle): Deleted.
* platform/network/curl/ResourceHandleManager.h:

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

2 years agoAsync image decoding should be disabled for iBooks on tvOS
commit-queue@webkit.org [Thu, 29 Jun 2017 20:54:59 +0000 (20:54 +0000)]
Async image decoding should be disabled for iBooks on tvOS
https://bugs.webkit.org/show_bug.cgi?id=173945

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

The iBooks on tvOS is an AppStore application. We need to disable async
image decoding for iBooks on tvOS permanently through WebKit.

* platform/cocoa/RuntimeApplicationChecksCocoa.mm:
(WebCore::IOSApplication::isIBooks):
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::updateFromSettings):

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

2 years ago[WebIDL] Add a new extended attribute to model the forced return value optimization...
commit-queue@webkit.org [Thu, 29 Jun 2017 20:38:52 +0000 (20:38 +0000)]
[WebIDL] Add a new extended attribute to model the forced return value optimization used on Node and Crypto
https://bugs.webkit.org/show_bug.cgi?id=173961

Patch by Sam Weinig <sam@webkit.org> on 2017-06-29
Reviewed by Darin Adler.

Source/WebCore:

Node and Crypto were both using custom bindings to implement an optimization
for operations that always returned one one of the arguments passed in. The
optimization directly returns the JSValue argument, avoiding wrapping and
unwrapping, and all the cache lookups that might entail. This allows that
optimization to work without custom bindings by adding a new extended attribute
[ReturnValue] that can annotate an argument. When used, the implementation
function is expected to return either void or ExceptionOr<void>.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSBindingsAllInOne.cpp:
* bindings/js/JSCryptoCustom.cpp: Removed.
Remove JSCryptoCustom.cpp.

* bindings/js/JSNodeCustom.cpp:
(WebCore::JSNode::insertBefore): Deleted.
(WebCore::JSNode::replaceChild): Deleted.
(WebCore::JSNode::removeChild): Deleted.
(WebCore::JSNode::appendChild): Deleted.
Remove custom functions.

* bindings/scripts/CodeGeneratorJS.pm:
(OperationHasForcedReturnValue):
Add helper to determine if an operation has [ReturnValue] on any argument.

(NeedsExplicitPropagateExceptionCall):
We must treat operations with a [ReturnValue] argument like we do operations
returning void, and explicitly check for exceptions.

(GenerateParametersCheck):
Pull out the argument in a variable called 'returnValue' if it is annotated
with [ReturnValue].

(GenerateImplementationFunctionCall):
Special case operations with a [ReturnValue] argument to return the previously
set aside 'returnValue' variable.

* bindings/scripts/IDLAttributes.json:
Add [ReturnValue].

* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionTestReturnValueOptimizationBody):
(WebCore::jsTestObjPrototypeFunctionTestReturnValueOptimization):
(WebCore::jsTestObjPrototypeFunctionTestReturnValueOptimizationWithExceptionBody):
(WebCore::jsTestObjPrototypeFunctionTestReturnValueOptimizationWithException):
* bindings/scripts/test/TestObj.idl:
Add tests for [ReturnValue].

* dom/Node.idl:
* page/Crypto.idl:
Add [ReturnValue] annotations and remove [Custom] annotations.

LayoutTests:

* js/dom/dot-node-base-exception-expected.txt: Removed.
* js/dom/dot-node-base-exception.html: Removed.
* js/dom/script-tests/dot-node-base-exception.js: Removed.
Remove now obsolete test.

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

2 years agoWeb Inspector: Create a single -webkit-canvas for use inside popovers
drousso@apple.com [Thu, 29 Jun 2017 20:15:55 +0000 (20:15 +0000)]
Web Inspector: Create a single -webkit-canvas for use inside popovers
https://bugs.webkit.org/show_bug.cgi?id=173820

Reviewed by Matt Baker.

* UserInterface/Views/Popover.css:
(.popover):
* UserInterface/Views/Popover.js:
(WebInspector.Popover):
(WebInspector.Popover.prototype._drawBackground):

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

2 years agoSlight clean up of WebResourceLoadStatisticsStore
cdumez@apple.com [Thu, 29 Jun 2017 19:51:05 +0000 (19:51 +0000)]
Slight clean up of WebResourceLoadStatisticsStore
https://bugs.webkit.org/show_bug.cgi?id=173976

Reviewed by Brent Fulgham.

* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::dataTypesToRemove):
(WebKit::WebResourceLoadStatisticsStore::classifyResource):
(WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
(WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsEnabled):
(WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
(WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
(WebKit::WebResourceLoadStatisticsStore::stopMonitoringStatisticsStorage):
(WebKit::initializeDataTypesToRemove): Deleted.
* UIProcess/WebResourceLoadStatisticsStore.h:
(WebKit::WebResourceLoadStatisticsStore::coreStore): Deleted.

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

2 years agoUnreviewed, rolling out r218512.
commit-queue@webkit.org [Thu, 29 Jun 2017 19:34:03 +0000 (19:34 +0000)]
Unreviewed, rolling out r218512.
https://bugs.webkit.org/show_bug.cgi?id=173981

"It changes the behavior of the JS API's JSEvaluateScript
which breaks TurboTax" (Requested by saamyjoon on #webkit).

Reverted changeset:

"test262: Completion values for control flow do not match the
spec"
https://bugs.webkit.org/show_bug.cgi?id=171265
http://trac.webkit.org/changeset/218512

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

2 years agoWKContentRuleLists with if-top-url or unless-top-url should run regex against entire...
achristensen@apple.com [Thu, 29 Jun 2017 19:31:36 +0000 (19:31 +0000)]
WKContentRuleLists with if-top-url or unless-top-url should run regex against entire top URL
https://bugs.webkit.org/show_bug.cgi?id=173980

Reviewed by Tim Horton.

Source/WebKit2:

if-top-url and unless-top-url were broken inside WebKit2 apps.  This fixes them and adds a test.
ContentExtension::populateConditionCacheIfNeeded was calling WebCompiledContentRuleList::conditionsApplyOnlyToDomain
but m_data.conditionsApplyOnlyToDomainOffset was always 0 instead of ConditionsApplyOnlyToDomainOffset because
it wasn't being encoded and decoded when telling the WebProcess about the content rule list.  This was causing us
to use whatever was at offset 0 in the file instead of the correct value stored in the file to determine
whether to run regular expressions against the entire top URL for if-top-url or unless-top-url or against
just the domain for if-top-domain or unless-top-domain.  Luckily, offset 0 in the file is always
ContentRuleListStore::CurrentContentRuleListFileVersion, so it was deterministic and easy to debug.

I should have added a LayoutTest with r213669 to verify correct behavior in an actual WKWebView,
but I didn't because it wouldn't have caught regressions since the contentextension tests are
marked as flaky since r206914, but once that is fixed the new test http/tests/contentextensions/top-url.html
will verify that this feature is behaving correctly.  It failed before this change and passes after.

* Shared/WebCompiledContentRuleListData.cpp:
(WebKit::WebCompiledContentRuleListData::encode):
(WebKit::WebCompiledContentRuleListData::decode):

LayoutTests:

* http/tests/contentextensions/top-url-expected.txt: Added.
* http/tests/contentextensions/top-url.html: Added.
* http/tests/contentextensions/top-url.html.json: Added.

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

2 years agoUnreviewed, rolling out r218944.
cdumez@apple.com [Thu, 29 Jun 2017 19:24:52 +0000 (19:24 +0000)]
Unreviewed, rolling out r218944.

Optimization is incorrect

Reverted changeset:

"Avoid copying ResourceLoadStatistics objects"
https://bugs.webkit.org/show_bug.cgi?id=173972
http://trac.webkit.org/changeset/218944

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

2 years agoREGRESSION(r218896): ASSERT in WebPageProxy::dataCallback
commit-queue@webkit.org [Thu, 29 Jun 2017 19:19:17 +0000 (19:19 +0000)]
REGRESSION(r218896): ASSERT in WebPageProxy::dataCallback
https://bugs.webkit.org/show_bug.cgi?id=173968

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2017-06-29
Reviewed by Michael Catanzaro.

The problem is that WebPageProxy::getLoadDecisionForIcon() sends 0 as callback ID when the decision is to not
load the icon. Since r218896 we always notify the client even when the decision is to not load the icon, in
which case the UI doesn't really expect a callback. When WebPageProxy::dataCallback is called with a 0 callback ID,
CallbackMap::take() crashes in RELEASE_ASSERT(callbackID).

Fixes several GTK+ unit tests that are crashing.

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::didGetLoadDecisionForIcon): Return earlier if decision is false or frame is nullptr.
(WebCore::DocumentLoader::finishedLoadingIcon): Move RELEASE_ASSERT to notifyFinishedLoadingIcon().
(WebCore::DocumentLoader::notifyFinishedLoadingIcon): Assert if callbackIdentifier is 0 or m_frame is nullptr,
since it's no longer expected to happen.

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

2 years agostatistics.mostRecentUserInteraction should be of type WallTime
cdumez@apple.com [Thu, 29 Jun 2017 19:13:10 +0000 (19:13 +0000)]
statistics.mostRecentUserInteraction should be of type WallTime
https://bugs.webkit.org/show_bug.cgi?id=173974

Reviewed by Brent Fulgham.

statistics.mostRecentUserInteraction should be of type WallTime for clarity.

Source/WebCore:

* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
(WebCore::ResourceLoadObserver::logUserInteraction):
(WebCore::ResourceLoadObserver::clearUserInteraction):
* loader/ResourceLoadStatistics.cpp:
(WebCore::ResourceLoadStatistics::encode):
(WebCore::ResourceLoadStatistics::decode):
(WebCore::ResourceLoadStatistics::toString):
(WebCore::ResourceLoadStatistics::merge):
* loader/ResourceLoadStatistics.h:
(WebCore::ResourceLoadStatistics::mostRecentUserInteractionTime): Deleted.
* loader/ResourceLoadStatisticsStore.cpp:
(WebCore::shouldPartitionCookies):
(WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
(WebCore::ResourceLoadStatisticsStore::sortedPrevalentResourceTelemetry):

Source/WebKit2:

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
(IPC::ArgumentCoder<ResourceLoadStatistics>::decode):

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

2 years agoAdd WebKitSystemInterface for iOS 11
jbedard@apple.com [Thu, 29 Jun 2017 19:11:37 +0000 (19:11 +0000)]
Add WebKitSystemInterface for iOS 11
https://bugs.webkit.org/show_bug.cgi?id=173936

Reviewed by Lucas Forschler.

Tools:

* Scripts/copy-webkitlibraries-to-product-directory: Copy iOS 11 WebKitSystemInterface libraries.

WebKitLibraries:

* libWebKitSystemInterfaceIOSDevice11.a: Added.
* libWebKitSystemInterfaceIOSSimulator11.a: Added.

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

2 years agoWebAssembly: disable some APIs under CSP
jfbastien@apple.com [Thu, 29 Jun 2017 18:49:18 +0000 (18:49 +0000)]
WebAssembly: disable some APIs under CSP
https://bugs.webkit.org/show_bug.cgi?id=173892
<rdar://problem/32914613>

Reviewed by Daniel Bates.

Source/JavaScriptCore:

We should disable parts of WebAssembly under Content Security
Policy as discussed here:

https://github.com/WebAssembly/design/issues/1092

Exactly what should be disabled isn't super clear, so we may as
well be conservative and disable many things if developers already
opted into CSP. It's easy to loosen what we disable later.

This patch disables:
- WebAssembly.Instance
- WebAssembly.instantiate
- WebAssembly.Memory
- WebAssembly.Table

And leaves:
- WebAssembly on the global object
- WebAssembly.Module
- WebAssembly.compile
- WebAssembly.CompileError
- WebAssembly.LinkError

Nothing because currently unimplmented:
- WebAssembly.compileStreaming
- WebAssembly.instantiateStreaming

That way it won't be possible to call WebAssembly-compiled code,
or create memories (which use fancy 4GiB allocations
sometimes). Table isn't really useful on its own, and eventually
we may make them shareable so without more details it seems benign
to disable them (and useless if we don't).

I haven't done anything with postMessage, so you can still
postMessage a WebAssembly.Module cross-CSP, but you can't
instantiate it so it's useless. Because of this I elected to leave
WebAssembly.Module and friends available.

I haven't added any new directives. It's still unsafe-eval. We can
add something else later, but it seems odd to add a WebAssembly as
a new capability and tell developers "you should have been using
this directive which we just implemented if you wanted to disable
WebAssembly which didn't exist when you adopted CSP". So IMO we
should keep unsafe-eval as it currently is, add WebAssembly to
what it disables, and later consider having two new directives
which do each individually or something.

In all cases I throw an EvalError *before* other WebAssembly
errors would be produced.

Note that, as for eval, reporting doesn't work and is tracked by
https://webkit.org/b/111869

* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::JSGlobalObject):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::webAssemblyEnabled):
(JSC::JSGlobalObject::webAssemblyDisabledErrorMessage):
(JSC::JSGlobalObject::setWebAssemblyEnabled):
* wasm/js/JSWebAssemblyInstance.cpp:
(JSC::JSWebAssemblyInstance::create):
* wasm/js/JSWebAssemblyMemory.cpp:
(JSC::JSWebAssemblyMemory::create):
* wasm/js/JSWebAssemblyMemory.h:
* wasm/js/JSWebAssemblyTable.cpp:
(JSC::JSWebAssemblyTable::create):
* wasm/js/WebAssemblyMemoryConstructor.cpp:
(JSC::constructJSWebAssemblyMemory):

Source/WebCore:

This does the basic separation of eval-blocked and
WebAssembly-blocked, but currently only blocks neither or both. I
think we'll eventually consider allowing one to be blocked but not
the other, so this separation makes sense and means that when we
want to do the change it'll be tiny. At a minimum we want a
different error message, which this patch provides (a lot of the
code ties blocking to the error message).

Tests: http/tests/security/contentSecurityPolicy/WebAssembly-allowed.html
       http/tests/security/contentSecurityPolicy/WebAssembly-blocked-in-about-blank-iframe.html
       http/tests/security/contentSecurityPolicy/WebAssembly-blocked-in-external-script.html
       http/tests/security/contentSecurityPolicy/WebAssembly-blocked-in-subframe.html
       http/tests/security/contentSecurityPolicy/WebAssembly-blocked.html

* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::enableWebAssembly):
(WebCore::ScriptController::disableWebAssembly):
* bindings/js/ScriptController.h:
* bindings/js/WorkerScriptController.cpp:
(WebCore::WorkerScriptController::disableWebAssembly):
* bindings/js/WorkerScriptController.h:
* dom/Document.cpp:
(WebCore::Document::disableWebAssembly):
* dom/Document.h:
* dom/ScriptExecutionContext.h:
* page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::didCreateWindowProxy):
(WebCore::ContentSecurityPolicy::applyPolicyToScriptExecutionContext):
* page/csp/ContentSecurityPolicy.h:
* page/csp/ContentSecurityPolicyDirectiveList.cpp:
(WebCore::ContentSecurityPolicyDirectiveList::create):
* page/csp/ContentSecurityPolicyDirectiveList.h:
(WebCore::ContentSecurityPolicyDirectiveList::webAssemblyDisabledErrorMessage):
(WebCore::ContentSecurityPolicyDirectiveList::setWebAssemblyDisabledErrorMessage):
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::disableWebAssembly):
* workers/WorkerGlobalScope.h:

LayoutTests:

These tests are basically the same as eval-blocked, but with
WebAssembly APIs instead of eval.

Disable all of them on iOS simulator which doesn't support
WebAssembly (whereas iOS does).

* http/tests/security/contentSecurityPolicy/WebAssembly-allowed-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/WebAssembly-allowed.html: Added.
* http/tests/security/contentSecurityPolicy/WebAssembly-blocked-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/WebAssembly-blocked-in-about-blank-iframe-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/WebAssembly-blocked-in-about-blank-iframe.html: Added.
* http/tests/security/contentSecurityPolicy/WebAssembly-blocked-in-external-script-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/WebAssembly-blocked-in-external-script.html: Added.
* http/tests/security/contentSecurityPolicy/WebAssembly-blocked-in-subframe-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/WebAssembly-blocked-in-subframe.html: Added.
* http/tests/security/contentSecurityPolicy/WebAssembly-blocked.html: Added.
* http/tests/security/contentSecurityPolicy/resources/WebAssembly-blocked-in-external-script.js: Added.
* platform/ios-simulator/TestExpectations:

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

2 years agoMake InlineBox::m_topLeft and m_logicalWidth protected.
zalan@apple.com [Thu, 29 Jun 2017 18:47:25 +0000 (18:47 +0000)]
Make InlineBox::m_topLeft and m_logicalWidth protected.
https://bugs.webkit.org/show_bug.cgi?id=173973

Reviewed by Simon Fraser.

I don't think this reasoning from 10 years ago is valid anymore ->
  "FIXME: Would like to make this protected, but methods are accessing these members over in the part."
(comment was conveniently removed in a later commit).

No change in functionality.

* rendering/InlineBox.h:
(WebCore::InlineBox::InlineBox):

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

2 years ago[iOS DnD] Adopt +objectWithItemProviderData: for serializing NSItemProviderReading...
wenson_hsieh@apple.com [Thu, 29 Jun 2017 18:14:54 +0000 (18:14 +0000)]
[iOS DnD] Adopt +objectWithItemProviderData: for serializing NSItemProviderReading-conformant objects
https://bugs.webkit.org/show_bug.cgi?id=173971
<rdar://problem/33006605>

Reviewed by Tim Horton.

Moves off of a very-recently-deprecated API, in favor of its replacement. Guarded by a runtime check and staging
declarations. No change in behavior.

* platform/ios/WebItemProviderPasteboard.mm:
(-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):

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

2 years ago[Curl] Separate global curl settings from ResourceHandleManager as CurlContext class
commit-queue@webkit.org [Thu, 29 Jun 2017 18:07:32 +0000 (18:07 +0000)]
[Curl] Separate global curl settings from ResourceHandleManager as CurlContext class
https://bugs.webkit.org/show_bug.cgi?id=173629

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

* PlatformWinCairo.cmake:
* platform/network/curl/CookieJarCurl.cpp:
(WebCore::setCookiesFromDOM):
(WebCore::cookiesForSession):
* platform/network/curl/CurlContext.cpp: Added.
(WebCore::certificatePath):
(WebCore::cookieJarPath):
(WebCore::CurlContext::CurlContext):
(WebCore::CurlContext::~CurlContext):
(WebCore::CurlContext::initCookieSession):
(WebCore::CurlContext::ProxyInfo::url):
(WebCore::CurlContext::setProxyInfo):
(WebCore::CurlContext::getEffectiveURL):
(WebCore::CurlContext::createMultiHandle):
(WebCore::CurlContext::mutexFor):
(WebCore::CurlContext::lock):
(WebCore::CurlContext::unlock):
* platform/network/curl/CurlContext.h: Added.
(WebCore::CurlContext::singleton):
(WebCore::CurlContext::curlShareHandle):
(WebCore::CurlContext::getCookieJarFileName):
(WebCore::CurlContext::setCookieJarFileName):
(WebCore::CurlContext::getCertificatePath):
(WebCore::CurlContext::shouldIgnoreSSLErrors):
(WebCore::CurlContext::proxyInfo):
(WebCore::CurlContext::setProxyInfo):
(WebCore::CurlContext::getLogFile):
(WebCore::CurlContext::isVerbose):
* platform/network/curl/CurlDownload.cpp:
(WebCore::CurlDownload::init):
(WebCore::CurlDownload::start):
(WebCore::CurlDownload::cancel):
(WebCore::CurlDownload::didReceiveHeader):
* platform/network/curl/CurlDownload.h:
* platform/network/curl/CurlJobManager.cpp: Renamed from Source/WebCore/platform/network/curl/CurlManager.cpp.
(WebCore::CurlJobManager::CurlJobManager):
(WebCore::CurlJobManager::~CurlJobManager):
(WebCore::CurlJobManager::add):
(WebCore::CurlJobManager::remove):
(WebCore::CurlJobManager::getActiveCount):
(WebCore::CurlJobManager::getPendingCount):
(WebCore::CurlJobManager::startThreadIfNeeded):
(WebCore::CurlJobManager::stopThread):
(WebCore::CurlJobManager::stopThreadIfIdle):
(WebCore::CurlJobManager::updateHandleList):
(WebCore::CurlJobManager::addToCurl):
(WebCore::CurlJobManager::removeFromCurl):
(WebCore::CurlJobManager::workerThread):
* platform/network/curl/CurlJobManager.h: Renamed from Source/WebCore/platform/network/curl/CurlManager.h.
(WebCore::CurlJobManager::singleton):
* platform/network/curl/ResourceHandleManager.cpp:
(WebCore::ResourceHandleManager::ResourceHandleManager):
(WebCore::ResourceHandleManager::~ResourceHandleManager):
(WebCore::handleLocalReceiveResponse):
(WebCore::getProtectionSpace):
(WebCore::headerCallback):
(WebCore::ResourceHandleManager::downloadTimerCallback):
(WebCore::ResourceHandleManager::initializeHandle):
(WebCore::certificatePath): Deleted.
(WebCore::cookieJarPath): Deleted.
(WebCore::ResourceHandleManager::setCookieJarFileName): Deleted.
(WebCore::ResourceHandleManager::getCookieJarFileName): Deleted.
(WebCore::ResourceHandleManager::setProxyInfo): Deleted.
(WebCore::ResourceHandleManager::initCookieSession): Deleted.
* platform/network/curl/ResourceHandleManager.h:
(): Deleted.

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

2 years agoAvoid copying ResourceLoadStatistics objects
cdumez@apple.com [Thu, 29 Jun 2017 17:58:30 +0000 (17:58 +0000)]
Avoid copying ResourceLoadStatistics objects
https://bugs.webkit.org/show_bug.cgi?id=173972

Reviewed by Geoffrey Garen.

Avoid copying ResourceLoadStatistics objects given that they are big. Make the type move-only
to avoid such mistakes in the future.

* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::logFrameNavigation):
* loader/ResourceLoadStatistics.h:
(WebCore::ResourceLoadStatistics::ResourceLoadStatistics):

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

2 years agoFull stop shows to the right of the picture-in-picture localised string in Hebrew
commit-queue@webkit.org [Thu, 29 Jun 2017 17:54:32 +0000 (17:54 +0000)]
Full stop shows to the right of the picture-in-picture localised string in Hebrew
https://bugs.webkit.org/show_bug.cgi?id=173966
<rdar://problem/32847376>

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

Source/WebCore:

We manually set the CSS "direction" property to "rtl" when we're not using an LTR language for a placard.

Test: media/modern-media-controls/placard/placard-ltr.html

* Modules/modern-media-controls/controls/placard.css:
(.media-controls:not(.uses-ltr-user-interface-layout-direction) .placard):

LayoutTests:

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

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

2 years agoVersioning.
jmarcell@apple.com [Thu, 29 Jun 2017 17:50:15 +0000 (17:50 +0000)]
Versioning.

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

2 years agoVersioning.
jmarcell@apple.com [Thu, 29 Jun 2017 17:45:36 +0000 (17:45 +0000)]
Versioning.

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

2 years agoVMTraps has some races
keith_miller@apple.com [Thu, 29 Jun 2017 17:34:57 +0000 (17:34 +0000)]
VMTraps has some races
https://bugs.webkit.org/show_bug.cgi?id=173941

Reviewed by Michael Saboff.

Source/JavaScriptCore:

This patch refactors much of the VMTraps API.

On the message sending side:

1) No longer uses the Yarr JIT check to determine if we are in
RegExp code. That was unsound because RegExp JIT code can be run
on compilation threads.  Instead it looks at the current frame's
code block slot and checks if it is valid, which is the same as
what it did for JIT code previously.

2) Only have one signal sender thread, previously, there could be
many at once, which caused some data races. Additionally, the
signal sender thread is an automatic thread so it will deallocate
itself when not in use.

On the VMTraps breakpoint side:

1) We now have a true mapping of if we hit a breakpoint instead of
a JIT assertion. So the exception handler won't eat JIT assertions
anymore.

2) It jettisons all CodeBlocks that have VMTraps breakpoints on
them instead of every CodeBlock on the stack. This both prevents
us from hitting stale VMTraps breakpoints and also doesn't OSR
codeblocks that otherwise don't need to be jettisoned.

3) The old exception handler could theoretically fail for a couple
of reasons then resume execution with a clobbered instruction
set. This patch will kill the program if the exception handler
would fail.

This patch also refactors some of the jsc.cpp functions to take the
CommandLine options object instead of individual options. Also, there
is a new command line option that makes exceptions due to watchdog
timeouts an acceptable result.

* API/tests/testapi.c:
(main):
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::installVMTrapBreakpoints):
* dfg/DFGCommonData.cpp:
(JSC::DFG::pcCodeBlockMap):
(JSC::DFG::CommonData::invalidate):
(JSC::DFG::CommonData::~CommonData):
(JSC::DFG::CommonData::installVMTrapBreakpoints):
(JSC::DFG::codeBlockForVMTrapPC):
* dfg/DFGCommonData.h:
* jsc.cpp:
(functionDollarAgentStart):
(checkUncaughtException):
(checkException):
(runWithOptions):
(printUsageStatement):
(CommandLine::parseArguments):
(jscmain):
(runWithScripts): Deleted.
* runtime/JSLock.cpp:
(JSC::JSLock::didAcquireLock):
* runtime/VMTraps.cpp:
(JSC::sanitizedTopCallFrame):
(JSC::VMTraps::tryInstallTrapBreakpoints):
(JSC::VMTraps::willDestroyVM):
(JSC::VMTraps::fireTrap):
(JSC::VMTraps::handleTraps):
(JSC::VMTraps::VMTraps):
(JSC::VMTraps::~VMTraps):
(JSC::findActiveVMAndStackBounds): Deleted.
(JSC::installSignalHandler): Deleted.
(JSC::VMTraps::addSignalSender): Deleted.
(JSC::VMTraps::removeSignalSender): Deleted.
(JSC::VMTraps::SignalSender::willDestroyVM): Deleted.
(JSC::VMTraps::SignalSender::send): Deleted.
* runtime/VMTraps.h:
(JSC::VMTraps::~VMTraps): Deleted.
(JSC::VMTraps::SignalSender::SignalSender): Deleted.

Tools:

Add new testing mode for testing the Watchdog with our stress
tests.

* Scripts/run-jsc-stress-tests:

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

2 years agoUnreviewed Apple CMake build after r218901
bfulgham@apple.com [Thu, 29 Jun 2017 16:47:47 +0000 (16:47 +0000)]
Unreviewed Apple CMake build after r218901

I did not add 'cocoa/FileMonitorCocoa.mm' to the PlatformMac.cmake file as part of r218901.):

* PlatformMac.cmake:

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

2 years agoSmall improvement of calls to RenderLayerBacking members
fred.wang@free.fr [Thu, 29 Jun 2017 16:25:55 +0000 (16:25 +0000)]
Small improvement of calls to RenderLayerBacking members
https://bugs.webkit.org/show_bug.cgi?id=173969

Patch by Frederic Wang <fwang@igalia.com> on 2017-06-29
Reviewed by Simon Fraser.

No new tests, behavior unchanged.

* page/FrameView.cpp:
(WebCore::FrameView::tiledBacking): Access the member with RenderLayerBacking::tiledBacking.
(WebCore::FrameView::updateTilesForExtendedBackgroundMode): Ditto.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::usesCompositedScrolling): Use RenderLayerBacking::hasScrollingLayer as
it better matches the intention of the check here.

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

2 years ago[Readable Streams API] Fix ReadableStream "strategy" argument handling
commit-queue@webkit.org [Thu, 29 Jun 2017 16:19:38 +0000 (16:19 +0000)]
[Readable Streams API] Fix ReadableStream "strategy" argument handling
https://bugs.webkit.org/show_bug.cgi?id=172716

Patch by Romain Bellessort <romain.bellessort@crf.canon.fr> on 2017-06-29
Reviewed by Xabier Rodriguez-Calvar.

LayoutTests/imported/w3c:

Updated expectations.

* web-platform-tests/streams/readable-byte-streams/general-expected.txt: Updated.
* web-platform-tests/streams/readable-byte-streams/general.dedicatedworker-expected.txt: Updated.

Source/WebCore:

Aligned default strategy parameter with spec, as defined in [1].

[1] https://streams.spec.whatwg.org/#rs-constructor

Added new tests and updated some existing ones based on the newly
expected behavior. Also updated expectations for WPT streams tests.

* Modules/streams/ReadableStream.js:
(initializeReadableStream): Fixed initialization of strategy.

LayoutTests:

Added new tests and updated some existing ones based on the newly
expected behavior.

* streams/readable-byte-stream-controller-expected.txt: Updated.
* streams/readable-byte-stream-controller.js: Updated.

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

2 years agoSource/WebCore:
antti@apple.com [Thu, 29 Jun 2017 16:10:10 +0000 (16:10 +0000)]
Source/WebCore:
REGRESSION(r215347): NAS4Free Pop-down menus fail to appear
https://bugs.webkit.org/show_bug.cgi?id=173967
<rdar://problem/32690114>

Reviewed by Andreas Kling.

Menus on this configuration page operate by mutating visibility. We fail to trigger required
compositing updates when visibility changes on non-composited layer. Visibility of a non-composited
descendant may affect geometry of the composited ancestor layer.

Test: compositing/backing/non-composited-visibility-change.html

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::layerStyleChanged):
(WebCore::RenderLayerCompositor::needsCompositingUpdateForStyleChangeOnNonCompositedLayer): Added.

    Trigger compositing update for non-composited layers on visibility change.
    Factor tests into function.

* rendering/RenderLayerCompositor.h:

LayoutTests:
NAS4Free Pop-down menus take 3 seconds to appear
https://bugs.webkit.org/show_bug.cgi?id=173967
<rdar://problem/32690114>

Reviewed by Andreas Kling.

* compositing/backing/non-composited-visibility-change-expected.html: Added.
* compositing/backing/non-composited-visibility-change.html: Added.

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

2 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: https://svn.webkit.org/repository/webkit/trunk@218924 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218923 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218922 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218921 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218920 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218919 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218918 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218917 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218916 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218915 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218914 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218913 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218912 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218911 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218910 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218909 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218908 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218907 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218906 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218905 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218904 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218903 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218902 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218901 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218900 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218899 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218898 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218897 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218896 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218895 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218894 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218893 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218892 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218891 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218890 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218889 268f45cc-cd09-0410-ab3c-d52691b4dbfc

2 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: https://svn.webkit.org/repository/webkit/trunk@218888 268f45cc-cd09-0410-ab3c-d52691b4dbfc