WebKit-https.git
3 years agoModernize BuildRequestQueuePage
rniwa@webkit.org [Tue, 21 Mar 2017 02:13:00 +0000 (02:13 +0000)]
Modernize BuildRequestQueuePage
https://bugs.webkit.org/show_bug.cgi?id=169903

Reviewed by Antti Koivisto.

Modernized the code for /v3/#/analysis/queue.

* public/v3/models/build-request.js:
(BuildRequest.fetchTriggerables): Deleted since the manifest JSON now contains all the triggerables.

* public/v3/pages/build-request-queue-page.js:
(BuildRequestQueuePage): Deleted this._triggerables. Added this._buildRequestsByTriggerable.
(BuildRequestQueuePage.prototype.open): Modernized the code.
(BuildRequestQueuePage.prototype.render): Ditto.
(BuildRequestQueuePage.prototype._constructBuildRequestTable): Ditto.

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

3 years agoAdd a system trace point for memory warning handling
simon.fraser@apple.com [Tue, 21 Mar 2017 02:04:59 +0000 (02:04 +0000)]
Add a system trace point for memory warning handling
https://bugs.webkit.org/show_bug.cgi?id=169893

Reviewed by Zalan Bujtas.

Source/WebCore:

Add a TraceScope for low memory handling, which logs 'critical' and 'synchronous'.

* page/MemoryRelease.cpp:
(WebCore::releaseMemory):

Source/WTF:

Make it possible to pass data to the Begin trace point.

* wtf/SystemTracing.h:
(WTF::TraceScope::TraceScope):

Tools:

Describe the new trace points.

* Tracing/SystemTracePoints.plist:

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

3 years agoOptimize packing of Document and superclass data members
simon.fraser@apple.com [Tue, 21 Mar 2017 02:04:55 +0000 (02:04 +0000)]
Optimize packing of Document and superclass data members
https://bugs.webkit.org/show_bug.cgi?id=169880

Reviewed by Antti Koivisto.

Move data members around to optimize packing in SecurityContext, SuspendableTimer and Document.
This saves as few hundred bytes on Document.

Padding detected via Tools/Scripts/dump-class-layout

* dom/Document.cpp:
(WebCore::Document::Document):
* dom/Document.h:
* dom/ScriptExecutionContext.h:
* dom/SecurityContext.cpp:
(WebCore::SecurityContext::SecurityContext):
* dom/SecurityContext.h:
* page/SuspendableTimer.cpp:
(WebCore::SuspendableTimer::SuspendableTimer):
* page/SuspendableTimer.h:

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

3 years agoCharts page show an inconsistent list of revisions for Git and Subversion
rniwa@webkit.org [Tue, 21 Mar 2017 01:19:39 +0000 (01:19 +0000)]
Charts page show an inconsistent list of revisions for Git and Subversion
https://bugs.webkit.org/show_bug.cgi?id=169888

Reviewed by Andreas Kling.

With Git, CommitLogViewer was showing the list of revisions including the starting hash,
which was the last data point's revision instead of all revisions after the last data point.

Fixed the bug by always specifying the revision at the last data point in both Subversion
and Git and then making /api/commits/<repository>/?from=X&to=Y exclude the first revision.
For clarity, "from" and "to" query parameters have been renamed to "precedingRevision" and
"lastRevision" respectively.

We also no longer adds 1 to the starting revision of Subversion-like starting revisions. e.g.
when the last data point was at r1234, new data point is at r1250, the label is now "r1234-r1250"
instead of "r1235-r1250".

* browser-tests/chart-revision-range-tests.js: Fixed the tests since revisionList no longer
specifies from/to revisions.
* browser-tests/commit-log-viewer-tests.js: Added. Added tests for CommitLogViewer.
* browser-tests/index.html: Include the new test. Also use a local copy of mocha.js/css.

* public/api/commits.php:
(main): Renamed "from" and "to" query parameters.

* public/include/commit-log-fetcher.php:
(CommitLogFetcher::fetch_between): Added a check that commit time should either be specified
in both rows or not specified in either. Also reject when before_first_revision is identical
or after last_revision instead of re-ordering them since it no longer makes sense to do so with
new query parameter names.

* public/v3/components/base.js:
(ComponentBase._addContentToElement): Use Array.isArray instead of instanceof. It's resilient
againt realm (global object) differences.

* public/v3/components/chart-pane-base.js:
(ChartPaneBase.prototype._updateCommitLogViewer): No longer calls enqueueToRender on this since
CommitLogViewer does that on its own now.
(ChartPaneBase.prototype.render): Juse use this._openRepository instead of relying on CommitLogViewer
to remember which repository is current. This was the only use of currentRepository.

* public/v3/components/commit-log-viewer.js:
(CommitLogViewer):
(CommitLogViewer.prototype.currentRepository): Deleted.
(CommitLogViewer.prototype.view):
(CommitLogViewer.prototype._fetchCommitLogs): Modernized and extracted from view to make it lazy.
Call fetchForSingleRevision when precedingRevision is not specified or it's identical to lastRevision
since the generic JSON API no longer supports being called with the identical revisions.
(CommitLogViewer.prototype.render): Modernized & simplified the code.
(CommitLogViewer.prototype._renderCommitList): Extracted from render to make it lazy.
(CommitLogViewer.htmlTemplate): Add ID on caption & tbody so that they're more easily addressable.
(CommitLogViewer.cssTemplate):

* public/v3/models/commit-log.js:
(CommitLog.prototype.diff): No longer includes from/to revisions in the result. Also avoid adding
1 to a Subversion-like starting revision for creating the label. See above. But we still do this
for forming URLs due to the way tools like Trac work with Subversion revisions.
(CommitLog.fetchBetweenRevisions): Rewritten using DataModel.prototype.cachedFetch with FIXME for
what this function is supposed to be doing.
(CommitLog._cachedCommitLogs): Deleted.
(CommitLog.fetchForSingleRevision): Added.
(CommitLog._constructFromRawData): Added.

* public/v3/models/data-model.js:
(DataModelObject.cachedFetch): Don't parse query values as an integer. Just URL-escape them.

* public/v3/remote.js:
(BrowserRemoteAPI.prototype.sendHttpRequest): Fixed a typo.

* server-tests/api-commits-tests.js: Renamed from api-commits.js. Updated the existing tests to
use new query parameters and added more test cases.

* unit-tests/commit-log-tests.js: Updated the test cases now that CommitLog.prototype.diff no longer
includes from/to values. They're computed in ChartRevisionRange instead.

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

3 years agoWebPageProxy DecidePolicyForNavigationAction and DecidePolicyForResponseSync should...
achristensen@apple.com [Tue, 21 Mar 2017 01:13:50 +0000 (01:13 +0000)]
WebPageProxy DecidePolicyForNavigationAction and DecidePolicyForResponseSync should be Delayed reply messages
https://bugs.webkit.org/show_bug.cgi?id=167183
<rdar://problem/30203539>

Reviewed by Andy Estes.

Source/WebKit2:

Before this patch, the WKNavigationDelegate's decidePolicyForNavigationAction must synchronously call the decisionHandler.
If it stores the decisionHandler and calls it after decidePolicyForNavigationAction returns, we can get incorrect behavior.
This can be seen when the _WKWebsitePolicies given to the decisionHandler had no effect.
Now, we will have the WebProcess waiting on the UIProcess to respond to the Delayed reply before continuing.
This will not be a regression because currently everybody is either calling the decisionHandler immediately or getting incorrect behavior,
and the behavior will be the same if the decisionHandler is called immediately. It is possible that we could make the WebProcess
not wait on the response, but we would need to make WebCore's loading truly asynchronous first
(getting rid of ResourceHandleClient's synchronous methods).

Covered by making an API test asynchronously call the decisionHandler.

* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageNavigationClient):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::receivedPolicyDecision):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::decidePolicyForResponseSync):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):

Tools:

* TestWebKitAPI/Tests/WebKit2Cocoa/WebsitePolicies.mm:
(-[WebsitePoliciesDelegate _webView:decidePolicyForNavigationAction:decisionHandler:]):

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

3 years agoWeb Inspector: Clicking on Clear Network Items icon throws an exception if timing...
nvasilyev@apple.com [Tue, 21 Mar 2017 01:01:22 +0000 (01:01 +0000)]
Web Inspector: Clicking on Clear Network Items icon throws an exception if timing popover is visible
https://bugs.webkit.org/show_bug.cgi?id=169852
<rdar://problem/31132652>

Reviewed by Joseph Pecoraro.

* UserInterface/Views/ResourceTimelineDataGridNode.js:
(WebInspector.ResourceTimelineDataGridNode.prototype._mouseoverRecordBar):
(WebInspector.ResourceTimelineDataGridNode):

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

3 years agoREGRESSION (r187873): Web Inspector: When resizing, prevent DataGrid columns from...
nvasilyev@apple.com [Tue, 21 Mar 2017 00:46:11 +0000 (00:46 +0000)]
REGRESSION (r187873): Web Inspector: When resizing, prevent DataGrid columns from collapsing entirely
https://bugs.webkit.org/show_bug.cgi?id=169899

Reviewed by Joseph Pecoraro.

* UserInterface/Views/DataGrid.js:
(WebInspector.DataGrid.prototype.resizerDragging):
leftMinimum and rightMaximum variables were always NaN because this.ColumnResizePadding is undefined.

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

3 years agoFix GTK build after r214190
achristensen@apple.com [Tue, 21 Mar 2017 00:19:53 +0000 (00:19 +0000)]
Fix GTK build after r214190
https://bugs.webkit.org/show_bug.cgi?id=169885

* UIProcess/InspectorServer/WebSocketServerConnection.cpp:
(WebKit::WebSocketServerConnection::sendWebSocketMessage):
(WebKit::WebSocketServerConnection::sendHTTPResponseHeader):
(WebKit::WebSocketServerConnection::sendRawData):
Finish renaming send to sendData.

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

3 years agoWeb Inspector: Pseudo-class markers overlap DOM breakpoints and disclosure triangle
mattbaker@apple.com [Tue, 21 Mar 2017 00:14:38 +0000 (00:14 +0000)]
Web Inspector: Pseudo-class markers overlap DOM breakpoints and disclosure triangle
https://bugs.webkit.org/show_bug.cgi?id=169850
<rdar://problem/31132335>

Reviewed by Joseph Pecoraro.

DOMTreeContentView should always have at least 7px of gutter space to
accomodate pseudo-class markers. When DOM breakpoints are visible the
gutter size is increased so breakpoints and markers do not overlap.

* UserInterface/Views/DOMTreeContentView.css:
(.content-view.dom-tree .tree-outline.dom):
(.content-view.dom-tree.show-gutter .tree-outline.dom):
(body[dir=ltr] .content-view.dom-tree .tree-outline.dom):
(body[dir=rtl] .content-view.dom-tree .tree-outline.dom):
(body[dir=ltr] .content-view.dom-tree.show-gutter .tree-outline.dom): Deleted.
(body[dir=rtl] .content-view.dom-tree.show-gutter .tree-outline.dom): Deleted.

* UserInterface/Views/DOMTreeOutline.css:
(.content-view.dom-tree.show-gutter .tree-outline.dom):
Change pseudo-class marker indent when showing DOM breakpoint gutter.
(body[dir=ltr] .tree-outline.dom li.pseudo-class-enabled > .selection-area::before):
Drive-by fix: copy paste error.

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

3 years agoSuspend media playback in background tabs
cdumez@apple.com [Mon, 20 Mar 2017 23:47:35 +0000 (23:47 +0000)]
Suspend media playback in background tabs
https://bugs.webkit.org/show_bug.cgi?id=169883
<rdar://problem/28056151>

Reviewed by Eric Carlson.

Source/WebCore:

Suspend media playback in background tabs to save battery
except in cases where we cannot (e.g. PiP, AirPlay).

Test: media/media-playback-page-visibility.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::visibilityStateChanged):
When page visibility state changes, begin / end media session
interruption with reason PlatformMediaSession::EnteringBackground.
This reason was already used on iOS when the application enters
or exist background. HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction()
takes care of preventing interruption in case of AirPlay or PiP.

LayoutTests:

Add layout test coverage.

* media/media-playback-page-visibility-expected.txt: Added.
* media/media-playback-page-visibility.html: Added.

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

3 years agoPrevent new navigations from onbeforeunload handler
dbates@webkit.org [Mon, 20 Mar 2017 23:07:50 +0000 (23:07 +0000)]
Prevent new navigations from onbeforeunload handler
https://bugs.webkit.org/show_bug.cgi?id=169891
<rdar://problem/31155736>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Ensure that all navigations initiated from an onbeforeunload handler are disallowed
regardless of how they were scheduled. Such navigations go against the expectation
of a user.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::isNavigationAllowed): Added.
(WebCore::FrameLoader::loadURL): Modified code to call FrameLoader::isNavigationAllowed().
(WebCore::FrameLoader::loadWithDocumentLoader): Ditto.
(WebCore::FrameLoader::stopAllLoaders): Ditto.
* loader/FrameLoader.h:

LayoutTests:

Update test to ensure that we disallow navigation initiated via a DOM click event from
an onbeforeunload handler.

* fast/events/before-unload-forbidden-navigation.html:

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

3 years agoFix os-build-fetcher.js and subprocess.js to make them work
rniwa@webkit.org [Mon, 20 Mar 2017 22:36:40 +0000 (22:36 +0000)]
Fix os-build-fetcher.js and subprocess.js to make them work
https://bugs.webkit.org/show_bug.cgi?id=169844

Reviewed by Antti Koivisto.

The script added in r213976 has a bug that it can execute commands to fetch subcommits in parallel.
Some commands to poll the lsit of system components is not desirable to be ran in parallel.

* server-tests/resources/mock-subprocess.js:
(MockSubprocess): Use const declaration.
(MockSubprocess.resetAndWaitForInvocation): Added.
(MockSubprocess.waitForInvocation): Renamed from waitingForInvocation. A function name must be a verb.
See https://webkit.org/code-style-guidelines/#names-verb
(MockSubprocess.reset): Set invocations.length to 0 so that tests can store a reference to the array
regardless of whether reset is called or when it's called.

* server-tests/tools-os-build-fetcher-tests.js: Updated tests per the code change. Most of codes now
expect each command to be ran seprately. e.g. if there were two commands to run, instead of expecting
them to be both ran, and resolving invocation promises, we'd wait for one command to run, resolve,
its subcommand to run, and then move onto the second top-level command. Also use a local reference
to MockSubprocess.invocations instead of using the fully qualified name.

* tools/js/os-build-fetcher.js:
(mapInSerialPromiseChain): Added. Calling a closure that returns a promise on each item in an array
in serial (not asynchronous) is a very common pattern in this class.
(OSBuildFetcher.fetchAndReportAllInOrder): Added.
(OSBuildFetcher.prototype.fetchAndReportNewBuilds): Log what the number of builds being submitted.
(OSBuildFetcher.prototype._fetchAvailableBuilds): Fixed the main bug. Using Promise.all would result
in each top-level command to be execued in parallel. Since each subcommand is executed as soon as
its parent command is executed, this results in commands to be executed in parallel.
Added a whole bunch of logging so that we can at least detect a bug like this in the future.
(OSBuildFetcher.prototype._commitsForAvailableBuilds): Cleanup the coding style.
(OSBuildFetcher.prototype._addSubCommitsForBuild): Use mapInSerialPromiseChain. Tightened the assertion
about the content returned by a subcommand.

* tools/js/subprocess.js: Fixed the bug that we were importing require('child_process').ChildProcess.
execFile is defined on require('child_process') itself.
(Subprocess.prototype.execute): Fixed a typo. this._childProcess doesn't exist.
(Subprocess):

* tools/sync-os-versions.js: Renamed from tools/pull-os-versions.js.
(syncLoop): Cleaned up the coding style a little. Also added logging about how long we're about to sleep.

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

3 years agowebkitpy: Work around simctl launch returning dead processes
jbedard@apple.com [Mon, 20 Mar 2017 21:33:58 +0000 (21:33 +0000)]
webkitpy: Work around simctl launch returning dead processes
https://bugs.webkit.org/show_bug.cgi?id=169878

Reviewed by Daniel Bates.

simctl launch will sometimes give the PID of a process which has just been terminated.
To work around this, we will always check if the returned PID is of a process which is
still running.

* Scripts/webkitpy/port/simulator_process.py:
(SimulatorProcess.Popen.__init__): Accept device argument.
(SimulatorProcess.Popen.poll): Call device.poll().
(SimulatorProcess._start): Pass device into Popen object.
* Scripts/webkitpy/xcode/device.py:
(Device.poll): Added.
* Scripts/webkitpy/xcode/simulated_device.py:
(SimulatedDevice.install_app): Change attempts to timeout.
(SimulatedDevice.launch_app): Check that the process being returned is active, use a
timeout instead of attempts.
(SimulatedDevice):
(SimulatedDevice.poll): Added.

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

3 years agoPrepare SocketStreamHandle for being created from WK2
achristensen@apple.com [Mon, 20 Mar 2017 20:05:50 +0000 (20:05 +0000)]
Prepare SocketStreamHandle for being created from WK2
https://bugs.webkit.org/show_bug.cgi?id=169885

Reviewed by Andy Estes.

No change in behavior.

* Modules/websockets/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::didOpenSocketStream):
(WebCore::WebSocketChannel::sendFrame):
Rename send to sendData to prevent name collisions with IPC::MessageSender::send.
* platform/network/SocketStreamHandle.cpp:
(WebCore::SocketStreamHandle::sendData):
(WebCore::SocketStreamHandle::send): Deleted.
* platform/network/SocketStreamHandle.h:
* platform/network/cf/SocketStreamHandleImpl.h:
* platform/network/curl/SocketStreamHandleImpl.h:
* platform/network/soup/SocketStreamHandleImpl.h:
Make platformSend and platformClose public so I can call them from IPC proxies.

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

3 years ago[QuickLook] Subresources should be in the same origin as the main document
aestes@apple.com [Mon, 20 Mar 2017 19:50:09 +0000 (19:50 +0000)]
[QuickLook] Subresources should be in the same origin as the main document
https://bugs.webkit.org/show_bug.cgi?id=169868
<rdar://problem/29898214>

Reviewed by Daniel Bates.

Source/WebCore:

Prior to this change, QuickLook documents were placed in a unique origin, which meant all
subresources were loaded as cross-origin requests. This prevented XMLHttpRequests to the
QuickLook custom protocol, since cross-origin XHRs must be made to a protocol that
understands CORS.

Instead of a unique origin, we now create an origin for QuickLook documents from the preview
response URL (an x-apple-ql-id: URL), which will allow QuickLook to make same-origin XHRs by
using a URL with the same scheme and host as the preview response URL.

Test: http/tests/quicklook/same-origin-xmlhttprequest-allowed.html

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

LayoutTests:

* http/tests/quicklook/resources/same-origin-xmlhttprequest-allowed.rtf: Added.
* http/tests/quicklook/resources/tap-run-test-hyperlink.js:
(runTest):
* http/tests/quicklook/same-origin-xmlhttprequest-allowed-expected.txt: Added.
* http/tests/quicklook/same-origin-xmlhttprequest-allowed.html: Added.

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

3 years agowindow.crypto.getRandomValues() uses the insecure RC4 RNG
jiewen_tan@apple.com [Mon, 20 Mar 2017 19:46:45 +0000 (19:46 +0000)]
window.crypto.getRandomValues() uses the insecure RC4 RNG
https://bugs.webkit.org/show_bug.cgi?id=169623
<rdar://problem/31044229>

Reviewed by Brent Fulgham.

This patch replaces the RC4 RNG with one based on AES-CTR.

No change of behavior.

* page/Crypto.cpp:
(WebCore::Crypto::getRandomValues):

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

3 years agoGraph coloring should use coalescable moves when spilling
fpizlo@apple.com [Mon, 20 Mar 2017 18:58:59 +0000 (18:58 +0000)]
Graph coloring should use coalescable moves when spilling
https://bugs.webkit.org/show_bug.cgi?id=169820

Reviewed by Michael Saboff.

This makes our graph coloring register allocator use a new family of move instructions when
spilling both operands of the move. It's a three-operand move:

    Move (src), (dst), %scratch

Previously, if both operands got spilled, we would emit a new instruction to load or store that
spill slot. But this made it hard for allocateStack to see that the two spill locations are
coalescable. This new kind of instruction makes it obvious that it's a coalescable move.

This change implements the coalescing of spill slots inside allocateStack.

This is an outrageous speed-up on the tsf_ir_speed benchmark from http://filpizlo.com/tsf/. This
is an interesting benchmark because it has a super ugly interpreter loop with ~20 live variables
carried around the loop back edge. This change makes that interpreter run 5x faster.

This isn't a speed-up on any other benchmarks. It also doesn't regress anything. Compile time is
neither progressed or regressed, since the coalescing is super cheap, and this does not add any
significant new machinery to the register allocator (it's just a small change to spill codegen).
Overall on our wasm benchmarks, this is a 16% throughput progression.

* assembler/MacroAssembler.h:
(JSC::MacroAssembler::move):
(JSC::MacroAssembler::move32):
(JSC::MacroAssembler::moveFloat):
(JSC::MacroAssembler::moveDouble):
* b3/air/AirAllocateRegistersByGraphColoring.cpp:
(JSC::B3::Air::allocateRegistersByGraphColoring):
* b3/air/AirAllocateStack.cpp:
(JSC::B3::Air::allocateStack):
* b3/air/AirInst.cpp:
(JSC::B3::Air::Inst::hasEarlyDef):
(JSC::B3::Air::Inst::hasLateUseOrDef):
(JSC::B3::Air::Inst::needsPadding):
* b3/air/AirInst.h:
* b3/air/AirOpcode.opcodes:
* b3/air/AirPadInterference.cpp:
(JSC::B3::Air::padInterference):
* runtime/Options.h:

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

3 years agoFix a paste-o in WebPaymentCoordinatorProxy::platformCompletePaymentSession
andersca@apple.com [Mon, 20 Mar 2017 18:30:19 +0000 (18:30 +0000)]
Fix a paste-o in WebPaymentCoordinatorProxy::platformCompletePaymentSession
https://bugs.webkit.org/show_bug.cgi?id=169881
rdar://problem/31030944

Reviewed by Dan Bernstein.

Don't always pass PKPaymentAuthorizationStatusFailure to the completion handler.

* UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
(WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession):

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

3 years ago[MediaStream] Respect constraints passed to getUserMedia
eric.carlson@apple.com [Mon, 20 Mar 2017 17:55:20 +0000 (17:55 +0000)]
[MediaStream] Respect constraints passed to getUserMedia
https://bugs.webkit.org/show_bug.cgi?id=169870
<rdar://problem/31138936>

Reviewed by Youenn Fablet and Jer Noble.
Source/WebCore:

Remember the fitness score calculated when evaluating constraints passed to getUserMedia, so
the best device is chosen when more than one device supports the constraints. Register two
mock video and two mock audio devices with different capabilities so these changes can
be tested.

No new tests, existing tests updated.

* platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::selectSettings): Store fitness score in m_fitnessScore.
* platform/mediastream/RealtimeMediaSource.h:

* platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
* platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
(WebCore::MockRealtimeAudioSource::create): Don't assume sampleRate is 44.1K
(WebCore::MockRealtimeAudioSourceMac::emitSampleBuffers): Use sampleRate() instead of m_sampleRate.
(WebCore::MockRealtimeAudioSourceMac::reconfigure): Ditto.
(WebCore::MockRealtimeAudioSourceMac::render): Ditto.
(WebCore::MockRealtimeAudioSourceMac::applySampleRate): Ditto.

* platform/mock/MockRealtimeAudioSource.cpp:
(WebCore::MockRealtimeAudioSource::updateSettings): Don't assume sampleRate is 44.1K
(WebCore::MockRealtimeAudioSource::initializeCapabilities): Support a range of sample rates.
(WebCore::MockRealtimeAudioSource::startProducingData): Initialize sampleRate if it hasn't
already been set.

* platform/mock/MockRealtimeMediaSource.cpp:
(WebCore::MockRealtimeMediaSource::audioDevices): Return an array of devices.
(WebCore::MockRealtimeMediaSource::videoDevices): Ditto.
(WebCore::MockRealtimeMediaSource::MockRealtimeMediaSource):
(WebCore::MockRealtimeMediaSource::mockAudioSourcePersistentID): Deleted.
(WebCore::MockRealtimeMediaSource::mockVideoSourcePersistentID): Deleted.
(WebCore::MockRealtimeMediaSource::mockAudioSourceName): Deleted.
(WebCore::MockRealtimeMediaSource::mockVideoSourceName): Deleted.
(WebCore::MockRealtimeMediaSource::audioDeviceInfo): Deleted.
(WebCore::MockRealtimeMediaSource::videoDeviceInfo): Deleted.
* platform/mock/MockRealtimeMediaSource.h:

* platform/mock/MockRealtimeMediaSourceCenter.cpp:
(WebCore::MockRealtimeMediaSourceCenter::validateRequestConstraints):
(WebCore::MockRealtimeMediaSourceCenter::createMediaStream):
(WebCore::MockRealtimeMediaSourceCenter::getMediaStreamDevices):
* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource):

LayoutTests:

* fast/mediastream/MediaDevices-enumerateDevices-expected.txt:
* fast/mediastream/MediaDevices-getUserMedia-expected.txt:
* fast/mediastream/MediaDevices-getUserMedia.html:
* fast/mediastream/MediaStream-video-element-expected.txt:
* fast/mediastream/MediaStreamTrack-getCapabilities-expected.txt:

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

3 years ago[Xcode] Incremental builds of WebKitLegacy are slow because of the Postprocess Header...
mitz@apple.com [Mon, 20 Mar 2017 17:51:45 +0000 (17:51 +0000)]
[Xcode] Incremental builds of WebKitLegacy are slow because of the Postprocess Headers phase
https://bugs.webkit.org/show_bug.cgi?id=169861

Reviewed by Sam Weinig.

Source/WebKit:

* WebKit.xcodeproj/project.pbxproj: Specified that the Postprocess Headers script build
  phase has the Headers and PrivateHeaders directories as its inputs and a timestamp file as
  its output.

Source/WebKit/mac:

* MigrateHeaders.make: Touch the PrivateHeaders directory when migrating a header into it.
* postprocess-headers.sh: Preserve the timestamp on the headers directories. Write out the
  timestamp file used by the Xcode project to determine whether to run the script.

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

3 years agoVersioning.
jmarcell@apple.com [Mon, 20 Mar 2017 17:49:36 +0000 (17:49 +0000)]
Versioning.

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

3 years agoTextIndicator should support a mode where selection rects are used to size the snapshot
wenson_hsieh@apple.com [Mon, 20 Mar 2017 17:32:48 +0000 (17:32 +0000)]
TextIndicator should support a mode where selection rects are used to size the snapshot
https://bugs.webkit.org/show_bug.cgi?id=169845
<rdar://problem/31127818>

Reviewed by Beth Dakin.

Source/WebCore:

Adds TextIndicator support in iOS for using the would-be selection rects of a given range to determine
snapshotting bounds. See below changes for more details.

* dom/Range.cpp:
(WebCore::Range::collectSelectionRectsWithoutUnionInteriorLines):
(WebCore::Range::collectSelectionRects):

Mark these helper methods as const.

* dom/Range.h:
* page/TextIndicator.cpp:
(WebCore::getSelectionRectsForRange):
(WebCore::initializeIndicator):

If TextIndicatorOptionUseSelectionRectForSizing is enabled, then compute selection rects and set the text rects
to be the resulting selection rects. These are in document coordinates.

* page/TextIndicator.h:

Source/WebKit2:

Adopt the new TextIndicatorOptionUseSelectionRectForSizing flag when generating an edit data interaction snapshot.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::didConcludeEditDataInteraction):

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

3 years agoMove code out of renderer destructors into willBeDestroyed()
simon.fraser@apple.com [Mon, 20 Mar 2017 17:28:55 +0000 (17:28 +0000)]
Move code out of renderer destructors into willBeDestroyed()
https://bugs.webkit.org/show_bug.cgi?id=169650

Reviewed by Antti Koivisto.

This is done for four reasons. First, code in willBeDestroyed() is able to call
virtual functions on derived classes. Second, this code will run before we've destroyed
the renderer's rareData, so can safely access it. Third, RenderWidget is special, and can have
its lifetime extended via manual ref-counting, and we want all cleanup to complete
before it goes into this weird zombie state. Fourth, in a shiny future where we have
ref-counted RenderObjects, we want cleanup code to be run explicitly and not tied
to object lifetime, and this is a step in that direction.

For all classes that derive from RenderObject, move code from the destructor into
willBeDestroyed(). New willBeDestroyed() implementations must call the base class.

RenderBlock and RenderBlockFlow are special; RenderBlockFlow::willBeDestroyed()
skips over RenderBlock::willBeDestroyed(), but they both need to run some code, which
I moved into RenderBlock::blockWillBeDestroyed().

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::~RenderBlock):
(WebCore::RenderBlock::willBeDestroyed):
(WebCore::RenderBlock::blockWillBeDestroyed):
* rendering/RenderBlock.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::~RenderBlockFlow):
(WebCore::RenderBlockFlow::willBeDestroyed):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::~RenderBox):
(WebCore::RenderBox::willBeDestroyed):
* rendering/RenderBox.h:
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::~RenderBoxModelObject):
* rendering/RenderCounter.cpp:
(WebCore::RenderCounter::~RenderCounter):
(WebCore::RenderCounter::willBeDestroyed):
* rendering/RenderCounter.h:
* rendering/RenderElement.cpp:
(WebCore::RenderElement::~RenderElement):
(WebCore::RenderElement::willBeDestroyed):
* rendering/RenderEmbeddedObject.cpp:
(WebCore::RenderEmbeddedObject::~RenderEmbeddedObject):
(WebCore::RenderEmbeddedObject::willBeDestroyed):
* rendering/RenderEmbeddedObject.h:
* rendering/RenderImage.cpp:
(WebCore::RenderImage::~RenderImage):
(WebCore::RenderImage::willBeDestroyed):
* rendering/RenderImage.h:
* rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::~RenderLayerModelObject):
(WebCore::RenderLayerModelObject::willBeDestroyed):
* rendering/RenderLayerModelObject.h:
* rendering/RenderLineBreak.cpp:
(WebCore::RenderLineBreak::~RenderLineBreak):
(WebCore::RenderLineBreak::willBeDestroyed):
* rendering/RenderLineBreak.h:
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::~RenderListBox):
(WebCore::RenderListBox::willBeDestroyed):
* rendering/RenderListBox.h:
* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::~RenderListItem):
(WebCore::RenderListItem::willBeDestroyed):
* rendering/RenderListItem.h:
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::~RenderListMarker):
(WebCore::RenderListMarker::willBeDestroyed):
* rendering/RenderListMarker.h:
* rendering/RenderMenuList.cpp:
(WebCore::RenderMenuList::~RenderMenuList):
(WebCore::RenderMenuList::willBeDestroyed):
* rendering/RenderMenuList.h:
* rendering/RenderNamedFlowThread.cpp:
(WebCore::RenderNamedFlowThread::~RenderNamedFlowThread):
(WebCore::RenderNamedFlowThread::willBeDestroyed):
* rendering/RenderNamedFlowThread.h:
* rendering/RenderObject.cpp:
(WebCore::RenderObject::willBeDestroyed):
* rendering/RenderQuote.cpp:
(WebCore::RenderQuote::~RenderQuote):
(WebCore::RenderQuote::willBeDestroyed):
* rendering/RenderQuote.h:
* rendering/RenderSearchField.cpp:
(WebCore::RenderSearchField::~RenderSearchField):
(WebCore::RenderSearchField::willBeDestroyed):
* rendering/RenderSearchField.h:
* rendering/RenderSnapshottedPlugIn.cpp:
(WebCore::RenderSnapshottedPlugIn::~RenderSnapshottedPlugIn):
(WebCore::RenderSnapshottedPlugIn::willBeDestroyed):
* rendering/RenderSnapshottedPlugIn.h:
* rendering/RenderText.cpp:
(WebCore::RenderText::~RenderText):
(WebCore::RenderText::willBeDestroyed):
* rendering/RenderTextControlMultiLine.cpp:
(WebCore::RenderTextControlMultiLine::~RenderTextControlMultiLine):
(WebCore::RenderTextControlMultiLine::willBeDestroyed):
* rendering/RenderTextControlMultiLine.h:
* rendering/RenderVideo.cpp:
(WebCore::RenderVideo::~RenderVideo):
(WebCore::RenderVideo::willBeDestroyed):
* rendering/RenderVideo.h:
* rendering/RenderWidget.h:
* rendering/svg/RenderSVGImage.cpp:
(WebCore::RenderSVGImage::~RenderSVGImage):
(WebCore::RenderSVGImage::willBeDestroyed):
* rendering/svg/RenderSVGImage.h:
* rendering/svg/RenderSVGResourceContainer.cpp:
(WebCore::RenderSVGResourceContainer::~RenderSVGResourceContainer):
(WebCore::RenderSVGResourceContainer::willBeDestroyed):

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

3 years agobuildbot: run-webkit-tests should display test failures and run exceptions differently
jbedard@apple.com [Mon, 20 Mar 2017 17:11:02 +0000 (17:11 +0000)]
buildbot: run-webkit-tests should display test failures and run exceptions differently
https://bugs.webkit.org/show_bug.cgi?id=169793
<rdar://problem/30987863>

Reviewed by Alexey Proskuryakov.

* BuildSlaveSupport/build.webkit.org-config/master.cfg:
(RunWebKitTests.evaluateCommand): Return EXCEPTION when run-webkit-tests returns with a code of 254.

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

3 years agoMark imported/w3c/web-platform-tests/XMLHttpRequest/timeout-multiple-fetches.html...
ryanhaddad@apple.com [Mon, 20 Mar 2017 16:46:23 +0000 (16:46 +0000)]
Mark imported/w3c/web-platform-tests/XMLHttpRequest/timeout-multiple-fetches.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=169637

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

3 years agoMark differences in media stream implementation
jonlee@apple.com [Mon, 20 Mar 2017 15:40:57 +0000 (15:40 +0000)]
Mark differences in media stream implementation
https://bugs.webkit.org/show_bug.cgi?id=169873

Reviewed by Eric Carlson.

Rearrange IDL and add comments based on 05 February 2017 Editor's Draft of Media
Capture and Streams spec.
* Modules/mediastream/DOMURLMediaStream.idl:
* Modules/mediastream/MediaDeviceInfo.idl:
* Modules/mediastream/MediaDevices.idl:
* Modules/mediastream/MediaStream.idl:
* Modules/mediastream/MediaStreamEvent.idl:
* Modules/mediastream/MediaStreamTrack.idl:
* Modules/mediastream/MediaStreamTrackEvent.idl:
* Modules/mediastream/MediaTrackConstraints.idl:
* Modules/mediastream/MediaTrackSupportedConstraints.idl:
* Modules/mediastream/NavigatorMediaDevices.idl:
* Modules/mediastream/NavigatorUserMedia.idl:

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

3 years agoUse CopyFontDescriptorWithStrokeForStyle to get correct stroke width for captions.
pvollan@apple.com [Mon, 20 Mar 2017 12:02:50 +0000 (12:02 +0000)]
Use CopyFontDescriptorWithStrokeForStyle to get correct stroke width for captions.
https://bugs.webkit.org/show_bug.cgi?id=169674

Reviewed by Eric Carlson.

Use the MediaAccessibility function MACopyFontDescriptorWithStrokeForStyle to get
correct video captions stroke width from a given font size.

* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTextTrackContainerElement::updateTextStrokeStyle):
(WebCore::MediaControlTextTrackContainerElement::updateTimerFired):
* html/shadow/MediaControlElements.h:
* page/CaptionUserPreferences.h:
(WebCore::CaptionUserPreferences::captionStrokeWidth):
* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::CaptionUserPreferencesMediaAF::captionStrokeWidth):
(WebCore::CaptionUserPreferencesMediaAF::captionsTextEdgeCSS):
(WebCore::CaptionUserPreferencesMediaAF::strokeWidth): Deleted.
* page/CaptionUserPreferencesMediaAF.h:
* platform/cf/MediaAccessibilitySoftLink.cpp:
* platform/cf/MediaAccessibilitySoftLink.h:

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

3 years agoUnreviewed. Add missing types to WebKitAutocleanups.
carlosgc@webkit.org [Mon, 20 Mar 2017 09:15:02 +0000 (09:15 +0000)]
Unreviewed. Add missing types to WebKitAutocleanups.

* UIProcess/API/gtk/WebKitAutocleanups.h:

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

3 years ago[Cairo] Ensure depth and stencil renderbuffers are created on GLESv2
commit-queue@webkit.org [Mon, 20 Mar 2017 08:47:22 +0000 (08:47 +0000)]
[Cairo] Ensure depth and stencil renderbuffers are created on GLESv2
https://bugs.webkit.org/show_bug.cgi?id=166643

Patch by Emanuele Aina <emanuele.aina@collabora.com> on 2017-03-20
Reviewed by Darin Adler.

If the gfx device doesn't support GL_OES_packed_depth_stencil, the
separate depth and stencil buffers are not generated.

Copy what GraphicsContext3DEfl used to do and apply it in
GraphicsContext3DCairo.

The Intel gfx driver seem to tolerate unbound renderbuffers, but
enabling debugging in Mesa yields an error:

$ MESA_DEBUG=1 \
  MESA_EXTENSION_OVERRIDE=-GL_OES_packed_depth_stencil
  ./bin/MiniBrowser http://webglsamples.org/aquarium/aquarium.html
Mesa: User error: GL_INVALID_OPERATION in glRenderbufferStorage(no renderbuffer bound)

* platform/graphics/GraphicsContext3D.h:
* platform/graphics/cairo/GraphicsContext3DCairo.cpp:
(WebCore::GraphicsContext3D::GraphicsContext3D):
Ensure separate depth and stencil renderbuffers are created.
(WebCore::GraphicsContext3D::~GraphicsContext3D):
Ensure separate depth and stencil renderbuffers are released.

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

3 years agoWebHTMLView is useless as WebResourceHandler
ap@apple.com [Mon, 20 Mar 2017 00:26:25 +0000 (00:26 +0000)]
WebHTMLView is useless as WebResourceHandler
https://bugs.webkit.org/show_bug.cgi?id=169857

Reviewed by Dan Bernstein.

* WebView/WebHTMLView.mm:
(-[WebHTMLView _documentFragmentFromPasteboard:forType:inContext:subresources:]):
WebHTMLView doesnt implement any of WebResourceHandler methods.

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

3 years agoImplement self.origin
cdumez@apple.com [Sun, 19 Mar 2017 21:51:19 +0000 (21:51 +0000)]
Implement self.origin
https://bugs.webkit.org/show_bug.cgi?id=168023

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

* resources/import-expectations.json:
* web-platform-tests/html/dom/interfaces-expected.txt:
* web-platform-tests/html/dom/self-origin.any-expected.txt:
* web-platform-tests/html/dom/self-origin.sub-expected.txt:
Rebaseline several WPT tests now that more checks are passing.

* web-platform-tests/html/webappapis/the-windoworworkerglobalscope-mixin/Worker_Self_Origin-expected.txt: Added.
* web-platform-tests/html/webappapis/the-windoworworkerglobalscope-mixin/Worker_Self_Origin.html: Added.
* web-platform-tests/html/webappapis/the-windoworworkerglobalscope-mixin/support/WorkerSelfOriginSharedWorker.js: Added.
(onconnect):
* web-platform-tests/html/webappapis/the-windoworworkerglobalscope-mixin/support/WorkerSelfOriginWorker.js: Added.
* web-platform-tests/html/webappapis/the-windoworworkerglobalscope-mixin/support/w3c-import.log: Added.
* web-platform-tests/html/webappapis/the-windoworworkerglobalscope-mixin/w3c-import.log: Added.
Import test coverage for self.origin in workers.

Source/WebCore:

Implement self.origin:
- https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope

Firefox and Chrome already support this.

Test: imported/w3c/web-platform-tests/html/webappapis/the-windoworworkerglobalscope-mixin/Worker_Self_Origin.html

* page/DOMWindow.cpp:
(WebCore::DOMWindow::origin):
* page/DOMWindow.h:
* page/WindowOrWorkerGlobalScope.idl:
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::origin):
* workers/WorkerGlobalScope.h:

LayoutTests:

* http/tests/websocket/tests/hybi/handshake-fail-by-maxlength-expected.txt:
* http/tests/websocket/tests/hybi/handshake-fail-by-maxlength.html:
* http/tests/websocket/tests/hybi/handshake-fail-by-no-cr-expected.txt:
* http/tests/websocket/tests/hybi/handshake-fail-by-no-cr.html:
* http/tests/websocket/tests/hybi/handshake-fail-by-null-char-in-status-expected.txt:
* http/tests/websocket/tests/hybi/handshake-fail-by-null-char-in-status.html:
* http/tests/websocket/tests/hybi/handshake-fail-by-prepended-null-expected.txt:
* http/tests/websocket/tests/hybi/handshake-fail-by-prepended-null.html:
Rename origin to wsOrigin in tests to avoid conflict with window.origin.

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

3 years agoWeb Inspector: REGRESSION (r212910): Active call frame status icon has incorrect...
mattbaker@apple.com [Sun, 19 Mar 2017 21:11:50 +0000 (21:11 +0000)]
Web Inspector: REGRESSION (r212910): Active call frame status icon has incorrect left margin
https://bugs.webkit.org/show_bug.cgi?id=169862

Reviewed by Brian Burg.

* UserInterface/Views/CallFrameTreeElement.css:
(.tree-outline .item.call-frame .status):
(body[dir=ltr] .tree-outline .item.call-frame .status):
(body[dir=rtl] .tree-outline .item.call-frame .status):

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

3 years ago`const location = "foo"` throws in a worker
cdumez@apple.com [Sun, 19 Mar 2017 17:45:39 +0000 (17:45 +0000)]
`const location = "foo"` throws in a worker
https://bugs.webkit.org/show_bug.cgi?id=169839

Reviewed by Mark Lam.

JSTests:

* ChakraCore/test/es6/letconst_global_shadow_builtins_nonconfigurable.baseline-jsc:
Update expected jsc result now that we throw a SyntaxError when trying to shadow undefined
with a let variable. We used not to throw because the value is undefined but this was not
as per EcmaScript. Both Firefox and Chrome throw in this case.

* stress/global-lexical-redeclare-variable.js:
(catch):
Update test that defines a non-configurable 'zoo' property on the global object and then
expected shadowing it with a 'let zoo' variable to work because its value was undefined.
This was not as per EcmaScript spec and both Firefox and Chrome throw in this case.

Source/JavaScriptCore:

Our HasRestrictedGlobalProperty check in JSC was slightly wrong, causing us
to sometimes throw a Syntax exception when we shouldn't when declaring a
const/let variable and sometimes not throw an exception when we should have.

This aligns our behavior with ES6, Firefox and Chrome.

* runtime/ProgramExecutable.cpp:
(JSC::hasRestrictedGlobalProperty):
(JSC::ProgramExecutable::initializeGlobalProperties):
Rewrite hasRestrictedGlobalProperty logic as per the EcmaScript spec:
- http://www.ecma-international.org/ecma-262/6.0/index.html#sec-hasproperty
In particular, they were 2 issues:
- We should throw a SyntaxError if hasProperty() returned true but getOwnProperty()
  would fail to return a descriptor. This would happen for properties that are
  not OWN properties, but defined somewhere in the prototype chain. The spec does
  not say to use hasProperty(), only getOwnProperty() and says we should return
  false if getOwnProperty() does not return a descriptor. This is what we do now.
- We would fail to throw when declaring a let/const variable that shadows an own
  property whose value is undefined. This is because the previous code was
  explicitly checking for this case. I believe this was a misinterpretation of
  ES6 which says:
  """
  Let desc be O.[[GetOwnProperty]](P).
  If desc is undefined, return false.
  """
  We should check that desc is undefined, not desc.value. This is now fixed.

LayoutTests:

* fast/dom/window-const-variable-shadowing-expected.txt: Added.
* fast/dom/window-const-variable-shadowing.html: Added.
* fast/workers/const-location-variable-expected.txt: Added.
* fast/workers/const-location-variable.html: Added.
* fast/workers/resources/worker-const-location.js: Added.
Add layout test coverage for behavior changes. Those tests pass in Firefox and Chrome.

* js/dom/const-expected.txt:
* js/dom/const.html:
Update test which wrongly expected a let variable not to be able to shadow a
window named property. This test was failing in Chrome and Firefox. The reason
this does not throw is because window named properties are not on the window
object, they are on the WindowProperties object in the Window prototype chain.

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

3 years ago[Cocoa] Web Automation: non-sticky virtual keys like 'left arrow' don't work properly
bburg@apple.com [Sun, 19 Mar 2017 15:54:32 +0000 (15:54 +0000)]
[Cocoa] Web Automation: non-sticky virtual keys like 'left arrow' don't work properly
https://bugs.webkit.org/show_bug.cgi?id=169733
<rdar://problem/30162608>

Reviewed by Joseph Pecoraro.

There were several issues that caused certain virtual keys to not work correctly.
When a virtual key like 'left arrow' was dispatched as a keydown event, it was
ultimately being translated into an insertText: command instead of moveLeft:.

 - The automation browser window was not properly made key window and active, so
   AppKit never tried to match the NSEvent as a key equivalent. That code path
   must be taken in this case, as it translates arrow keys into command selectors.

 - AppKit relies on its own private use area (PUA) unicode characters to encode
   control keys that do not affect key modifier state, like the arrow keys.
   Since these PUA characters were not being used as the 'characters' of the
   NSEvents we synthesize, the events are treated as unknown and AppKit falls
   back to inserting the codepoint as uninterpreted text.

 - The Mac implementation of platformSimulateKeyStroke did not allow non-sticky
   virtual keys to use the 'InsertByKey' interaction which sends keydown+keyup.
   This is a programming mistake that causes such inputs to assert in debug builds
   and bail out to do nothing in non-debug builds.

 - A few simulated virtual keys that are matched to key equivalents did not properly set
   'charactersIgnoringModifiers' on NSEvents, which may use the wrong editing command.

* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::performKeyboardInteractions):
Fix this guard so that we actually call into key event synthesis code for iOS.

* UIProcess/Automation/WebAutomationSession.h: Add declarations.

* UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm:
(WebKit::WebAutomationSession::charCodeForVirtualKey): Moved from iOS implementation.
(WebKit::WebAutomationSession::charCodeIgnoringModifiersForVirtualKey): Added.
There are only a few special cases for now. We will probably need to hardcode
the decomposition for other ASCII characters so the expected DOM events are fired
when entering a shifted character (i.e., 'A' should be 'Shift'+'a', not 'A').

* UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
(WebKit::WebAutomationSession::platformSimulateKeyStroke):
Use charCodeIgnoringModifiersForVirtualKey().

* UIProcess/Automation/mac/WebAutomationSessionMac.mm:
(WebKit::WebAutomationSession::sendSynthesizedEventsToPage): use -becomeKeyWindow.
(WebKit::keyHasStickyModifier): Added.
(WebKit::keyCodeForVirtualKey): Added.
(WebKit::eventModifierFlagsForVirtualKey):Added.
(WebKit::WebAutomationSession::platformSimulateKeyStroke):
Separately compute key stickiness, keyCode, event modifier, and charCode for
the simulated keystroke. The code to compute charCode is now shared between
iOS and macOS since the PUA characters are the same for both AppKit and UIKit.

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

3 years agoimport(arg) crashes when ToString(arg) throws
utatane.tea@gmail.com [Sun, 19 Mar 2017 15:41:36 +0000 (15:41 +0000)]
import(arg) crashes when ToString(arg) throws
https://bugs.webkit.org/show_bug.cgi?id=169778

Reviewed by Saam Barati.

JSTests:

* stress/import-reject-with-exception.js: Added.
(shouldBe):
(let.x.get toString):

Source/JavaScriptCore:

JSPromiseDeferred should not be rejected with Exception*.

* runtime/JSGlobalObjectFunctions.cpp:
(JSC::globalFuncImportModule):

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

3 years agoUpdate Ukrainian translation
mcatanzaro@igalia.com [Sun, 19 Mar 2017 00:58:35 +0000 (00:58 +0000)]
Update Ukrainian translation
https://bugs.webkit.org/show_bug.cgi?id=169812

Patch by Yuri Chornoivan <yurchor@ukr.net> on 2017-03-18
Rubber-stamped by Michael Catanzaro.

* uk.po:

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

3 years agoWeb Inspector: Empty attribute added to a DOM tree outline element should not add...
webkit@devinrousso.com [Sun, 19 Mar 2017 00:58:18 +0000 (00:58 +0000)]
Web Inspector: Empty attribute added to a DOM tree outline element should not add whitespace within the tag
https://bugs.webkit.org/show_bug.cgi?id=139623

Reviewed by Brian Burg.

* UserInterface/Views/DOMTreeElement.js:
(WebInspector.DOMTreeElement.prototype._attributeEditingCommitted):
If the `newText` after editing has no content, remove the element for that attribute.

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

3 years agoWeb Inspector: add keyboard shortcut to clear timeline records
webkit@devinrousso.com [Sun, 19 Mar 2017 00:41:12 +0000 (00:41 +0000)]
Web Inspector: add keyboard shortcut to clear timeline records
https://bugs.webkit.org/show_bug.cgi?id=132485

Reviewed by Brian Burg.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Views/TimelineRecordingContentView.js:
(WebInspector.TimelineRecordingContentView):
(WebInspector.TimelineRecordingContentView.prototype.handleClearShortcut):

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

3 years agoAdd support for ImplementedAs, Clamp, EnforceRange, TreatNullAs for dictionary members
jonlee@apple.com [Sat, 18 Mar 2017 20:22:18 +0000 (20:22 +0000)]
Add support for ImplementedAs, Clamp, EnforceRange, TreatNullAs for dictionary members
https://bugs.webkit.org/show_bug.cgi?id=169731

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline tests. The results seem to show a problem in the original tests.
* web-platform-tests/WebCryptoAPI/encrypt_decrypt/aes_gcm.worker-expected.txt:
* web-platform-tests/WebCryptoAPI/encrypt_decrypt/test_aes_gcm-expected.txt:

Source/WebCore:

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateDictionaryImplementationContent): Create a new $implementationAsKey. Look for
ImplementedAs, and if it exists, override the value with the alias. Set the parameters of
convert<>() using JSValueToNative.
(IsValidContextForJSValueToNative): Update to include IDLDictionaryMembers.
(JSValueToNative): Bypass parseEnumeration serialization for enums if the context is an
IDLDictionaryMember. Dictionary members need convert<IDLEnumeration> which throw a TypeError
or return the enum (and utilizes parseEnumeration). parseEnumeration, in contrast, returns
an optional.

* bindings/scripts/test/TestObj.idl: Add test cases in TestDictionary.

Update test results.
* bindings/scripts/test/JS/JSTestEventConstructor.cpp:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:

LayoutTests:

Rebaseline. The enhancement progressed the results of these tests.
* crypto/subtle/aes-gcm-encrypt-malformed-parameters-expected.txt:
* crypto/subtle/aes-generate-key-malformed-parameters-expected.txt:
* crypto/subtle/hmac-generate-key-malformed-parameters-expected.txt:

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

3 years ago[JSC] Remove unnecessary condition from needsDerivedConstructorInArrowFunctionLexical...
gskachkov@gmail.com [Sat, 18 Mar 2017 20:21:51 +0000 (20:21 +0000)]
[JSC] Remove unnecessary condition from needsDerivedConstructorInArrowFunctionLexicalEnvironment in BytecodeGenerator.cpp
https://bugs.webkit.org/show_bug.cgi?id=169832

Reviewed by Mark Lam.

Remove already covered condition in needsDerivedConstructorInArrowFunctionLexicalEnvironment
function. Condition isConstructor() && constructorKind() == ConstructorKind::Extends is already
isClassContext.

 * bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::needsDerivedConstructorInArrowFunctionLexicalEnvironment):

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

3 years agoUse initializers for Document member variables
simon.fraser@apple.com [Sat, 18 Mar 2017 20:03:18 +0000 (20:03 +0000)]
Use initializers for Document member variables
https://bugs.webkit.org/show_bug.cgi?id=169848

Reviewed by Chris Dumez.

Move Document to use C++11 brace initializers.

No behavior change.

* dom/Document.cpp:
(WebCore::Document::Document):
* dom/Document.h:
(WebCore::Document::xmlStandaloneStatus):
(WebCore::Document::setHasXMLDeclaration):

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

3 years agoinnerText setter inserts empty text node if value starts with newline
cdumez@apple.com [Sat, 18 Mar 2017 19:51:48 +0000 (19:51 +0000)]
innerText setter inserts empty text node if value starts with newline
https://bugs.webkit.org/show_bug.cgi?id=169600

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Re-sync tests with upstream to gain test coverage.

* web-platform-tests/innerText/getter-expected.txt:
* web-platform-tests/innerText/getter-tests.js:
* web-platform-tests/innerText/setter-expected.txt:
* web-platform-tests/innerText/setter-tests.js:
* web-platform-tests/innerText/setter.html:

Source/WebCore:

innerText setter should not create empty text nodes as per:
- https://html.spec.whatwg.org/multipage/dom.html#the-innertext-idl-attribute (step 6.2)

No new tests, updated existing test.

* html/HTMLElement.cpp:
(WebCore::textToFragment):

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

3 years agoAllow setting the prototype of cross-origin objects, as long as they don't change
cdumez@apple.com [Sat, 18 Mar 2017 17:52:01 +0000 (17:52 +0000)]
Allow setting the prototype of cross-origin objects, as long as they don't change
https://bugs.webkit.org/show_bug.cgi?id=169787

Reviewed by Mark Lam.

LayoutTests/imported/w3c:

Import test coverage from W3C web-platform-tests.

* web-platform-tests/common/domain-setter.sub.html: Added.
* web-platform-tests/common/test-setting-immutable-prototype.js: Added.
(self.testSettingImmutablePrototypeToNewValueOnly.test):
(self.testSettingImmutablePrototypeToNewValueOnly):
(self.testSettingImmutablePrototype.else.test):
(self.testSettingImmutablePrototype):
* web-platform-tests/common/w3c-import.log:
* web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-cross-origin-domain.sub-expected.txt: Added.
* web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-cross-origin-domain.sub.html: Added.
* web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-goes-cross-origin-domain.sub-expected.txt: Added.
* web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-goes-cross-origin-domain.sub.html: Added.
* web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-same-origin-domain.sub-expected.txt: Added.
* web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-same-origin-domain.sub.html: Added.
* web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-same-origin-expected.txt: Added.
* web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-same-origin.html: Added.
* web-platform-tests/html/browsers/history/the-location-interface/w3c-import.log:
* web-platform-tests/html/browsers/the-windowproxy-exotic-object/w3c-import.log: Added.
* web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-cross-origin-domain.sub-expected.txt: Added.
* web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-cross-origin-domain.sub.html: Added.
* web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-goes-cross-origin-domain.sub-expected.txt: Added.
* web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-goes-cross-origin-domain.sub.html: Added.
* web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-same-origin-domain.sub-expected.txt: Added.
* web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-same-origin-domain.sub.html: Added.
* web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-same-origin-expected.txt: Added.
* web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-same-origin.html: Added.

Source/JavaScriptCore:

* runtime/JSGlobalObject.h:
Mark JS global object as an immutable prototype exotic object to match Window.

* runtime/JSObject.cpp:
(JSC::JSObject::setPrototypeWithCycleCheck):
Update setPrototypeWithCycleCheck() for immutable prototype exotic objects in order
to align with:
- https://tc39.github.io/ecma262/#sec-set-immutable-prototype

In particular, we need to call [[GetPrototypeOf]] and return true if it returns the same
value as the new prototype. We really need to call [[GetPrototypeOf]] and not merely
getting the prototype slot via getPrototypeDirect() since Location and Window override
[[GetPrototypeOf]] to return null in the cross-origin case.

* runtime/JSProxy.cpp:
(JSC::JSProxy::setPrototype):
Update JSProxy::setPrototype() to forward such calls to its target. This is needed so
we end up calling JSObject::setPrototypeWithCycleCheck() for the Window object.
Handling immutable prototype exotic objects in that method does the right thing for
Window.

Source/WebCore:

Allow setting the prototype of cross-origin objects, as long as they don't change:
- https://html.spec.whatwg.org/multipage/browsers.html#windowproxy-setprototypeof
- https://html.spec.whatwg.org/multipage/browsers.html#location-setprototypeof
- https://tc39.github.io/ecma262/#sec-set-immutable-prototype

Tests: imported/w3c/web-platform-tests/common/domain-setter.sub.html
       imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-cross-origin-domain.sub.html
       imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-goes-cross-origin-domain.sub.html
       imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-same-origin-domain.sub.html
       imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-same-origin.html
       imported/w3c/web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-cross-origin-domain.sub.html
       imported/w3c/web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-goes-cross-origin-domain.sub.html
       imported/w3c/web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-same-origin-domain.sub.html
       imported/w3c/web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-same-origin.html

* bindings/js/JSLocationCustom.cpp:
* page/Location.idl:
Drop custom setPrototype() implementation for Location and mark Location as an immutable
prototype exotic object now that JSC does the right thing for those.

LayoutTests:

* http/tests/security/cross-frame-access-object-setPrototypeOf-expected.txt:
* http/tests/security/cross-frame-access-object-setPrototypeOf.html:
* js/dom/setPrototypeOf-location-window-expected.txt:
* js/dom/setPrototypeOf-location-window.html:
Add checks for setting prototype of window and location objects to the same value
to make sure it does not throw, both in the same origin and the cross origin
cases.

* fast/dom/Window/window-custom-prototype-crash-expected.txt:
* http/tests/security/xss-DENIED-regular-propterty-with-iframe-proto-expected.txt:
* js/object-literal-shorthand-construction-expected.txt:
Rebaseline tests now that the exception message is a bit different.

* js/script-tests/prototype-assignment.js:
Remove special casing for Window, it now behaves like a regular immutable prototype
exotic object.

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

3 years agoStop sending media data as soon as peer connection is closed
commit-queue@webkit.org [Sat, 18 Mar 2017 04:32:10 +0000 (04:32 +0000)]
Stop sending media data as soon as peer connection is closed
https://bugs.webkit.org/show_bug.cgi?id=169813

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

Stopping sending of media data as soon as the peer connection is closed.
By stopping sending at source level, this may stop by a few frames/chunks earlier than before.
Making sure RealtimeOutgoingVideoSource is stopping observing the media source when being stopped and deleted.

* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
(WebCore::LibWebRTCPeerConnectionBackend::doStop):
* platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
(WebCore::RealtimeOutgoingAudioSource::stop):
* platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
* platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
(WebCore::RealtimeOutgoingVideoSource::stop):
* platform/mediastream/mac/RealtimeOutgoingVideoSource.h:

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

3 years agoWeb Inspector: wrong filename when saving resource from ResourceImageContentView
webkit@devinrousso.com [Sat, 18 Mar 2017 03:49:50 +0000 (03:49 +0000)]
Web Inspector: wrong filename when saving resource from ResourceImageContentView
https://bugs.webkit.org/show_bug.cgi?id=54454

Reviewed by Joseph Pecoraro.

* UserInterface/Views/ResourceContentView.js:
(WebInspector.ResourceContentView.prototype.get supportsSave):
(WebInspector.ResourceContentView.prototype.get saveData):
* UserInterface/Views/TextResourceContentView.js:
(WebInspector.TextResourceContentView.prototype.get supportsSave): Deleted.
Add save data getter to the parent class, so that both Images and Fonts can be saved.

* UserInterface/Views/Resource.js:
(WebInspector.Resource.prototype.canRequestContent):
Drive-by: remove unused function.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214133 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoImplement incoming webrtc data based on tracksCurr
commit-queue@webkit.org [Sat, 18 Mar 2017 02:36:24 +0000 (02:36 +0000)]
Implement incoming webrtc data based on tracksCurr
https://bugs.webkit.org/show_bug.cgi?id=169836

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

Source/WebCore:

Test: webrtc/video-with-receiver.html

Constructing incoming tracks based on libwebrtc OnAddTrack.
Constructing incoming media streams based on libwebrtc OnAddStream.
Firing only addstream if legacy API flag is on.

Ensuring that media stream and media stream tracks relationship is still correctly implemented.
For that, we keep a map that relates libwebrtc media streams with WebCore media streams.
Adding the ability to get a receiver related to the track on the track event.

Implementing the possibility to create a transceiver ahead of track arrival time.
Created transceivers that are not related to any real source are kept in the peer connection back end.
When a libwebrtc track is appearing, it is associated with the track source of the corresponding transceiver based on track type.

Added the ability to create empty real time sources and set their data libwebrtc track when being available.

* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::addTrackFromPlatform):
* Modules/mediastream/MediaStream.h:
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::mediaStreamFromRTCStream):
(WebCore::LibWebRTCMediaEndpoint::addRemoteStream):
(WebCore::LibWebRTCMediaEndpoint::addRemoteTrack):
(WebCore::LibWebRTCMediaEndpoint::removeRemoteStream):
(WebCore::LibWebRTCMediaEndpoint::OnAddStream):
(WebCore::LibWebRTCMediaEndpoint::OnRemoveStream):
(WebCore::LibWebRTCMediaEndpoint::OnAddTrack):
(WebCore::LibWebRTCMediaEndpoint::stop):
(WebCore::createMediaStreamTrack): Deleted.
(WebCore::LibWebRTCMediaEndpoint::addStream): Deleted.
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
(WebCore::LibWebRTCPeerConnectionBackend::doStop):
(WebCore::createReceiverForSource):
(WebCore::createEmptySource):
(WebCore::LibWebRTCPeerConnectionBackend::createReceiver):
(WebCore::LibWebRTCPeerConnectionBackend::videoReceiver):
(WebCore::LibWebRTCPeerConnectionBackend::audioReceiver):
(WebCore::LibWebRTCPeerConnectionBackend::removeRemoteStream):
(WebCore::LibWebRTCPeerConnectionBackend::addRemoteStream):
* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
* platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
(WebCore::RealtimeIncomingAudioSource::setSourceTrack):
* platform/mediastream/mac/RealtimeIncomingAudioSource.h:
* platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
(WebCore::RealtimeIncomingVideoSource::setSourceTrack):
* platform/mediastream/mac/RealtimeIncomingVideoSource.h:

LayoutTests:

* webrtc/video-with-receiver-expected.txt: Added.
* webrtc/video-with-receiver.html: Copied from LayoutTests/webrtc/video.html.
* webrtc/video.html:

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

3 years agoRemove TestExpectation for a test that is no longer in the tree.
ryanhaddad@apple.com [Sat, 18 Mar 2017 00:39:23 +0000 (00:39 +0000)]
Remove TestExpectation for a test that is no longer in the tree.

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

3 years ago[MediaStream] Compensate for video capture orientation
eric.carlson@apple.com [Sat, 18 Mar 2017 00:34:00 +0000 (00:34 +0000)]
[MediaStream] Compensate for video capture orientation
https://bugs.webkit.org/show_bug.cgi?id=169313
<rdar://problem/30994785>

Unreviewed, fix a crash in r214120 found by the bots.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(-[WebAVSampleBufferStatusChangeListener invalidate]): Drive-by removal of unnecessary code.
(-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]):
Actually retain self before callOnMainThread.
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC):
Invalidate the change listener first.

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

3 years agoMediaQueryList instances do not update for `prefers-reduced-motion`
dino@apple.com [Fri, 17 Mar 2017 23:40:22 +0000 (23:40 +0000)]
MediaQueryList instances do not update for `prefers-reduced-motion`
https://bugs.webkit.org/show_bug.cgi?id=169835
<rdar://problem/30339378>

Reviewed by Anders Carlsson.

Source/WebCore:

Tell the document it needs to evaluate the MediaQueryLists
if accessibility settings change.

Test: fast/media/mq-prefers-reduced-motion-matchMedia.html

* page/Page.cpp:
(WebCore::Page::accessibilitySettingsDidChange):

LayoutTests:

* fast/media/mq-prefers-reduced-motion-matchMedia-expected.txt: Added.
* fast/media/mq-prefers-reduced-motion-matchMedia.html: Added.

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

3 years agoMark media/modern-media-controls/airplay-placard/airplay-placard-text-section.html...
ryanhaddad@apple.com [Fri, 17 Mar 2017 23:33:11 +0000 (23:33 +0000)]
Mark media/modern-media-controls/airplay-placard/airplay-placard-text-section.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=169654

Unreviewed test gardening.

* platform/mac-wk1/TestExpectations:

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

3 years agoMake HTTPCookieStorage operate in the UIProcess in absence of a WebProcessPool.
beidson@apple.com [Fri, 17 Mar 2017 23:23:39 +0000 (23:23 +0000)]
Make HTTPCookieStorage operate in the UIProcess in absence of a WebProcessPool.
<rdar://problem/31102330> and https://bugs.webkit.org/show_bug.cgi?id=169797

Reviewed by Alex Christensen.

Source/WebCore:

No new tests (No behavior change).

* platform/network/NetworkStorageSession.h:
* platform/network/cocoa/NetworkStorageSessionCocoa.mm:
(WebCore::NetworkStorageSession::flushCookieStore):

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

Source/WebKit2:

* UIProcess/API/APIHTTPCookieStore.cpp:
(API::HTTPCookieStore::~HTTPCookieStore):
(API::HTTPCookieStore::cookies):
(API::HTTPCookieStore::setCookie):
(API::HTTPCookieStore::deleteCookie):
(API::HTTPCookieStore::registerObserver):
(API::HTTPCookieStore::unregisterObserver):
(API::HTTPCookieStore::cookieManagerDestroyed):
(API::HTTPCookieStore::registerForNewProcessPoolNotifications):
* UIProcess/API/APIHTTPCookieStore.h:

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::create):
(WebKit::WebProcessPool::notifyThisWebProcessPoolWasCreated):
(WebKit::m_hiddenPageThrottlingTimer):
* UIProcess/WebProcessPool.h:

* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::processPoolForCookieStorageOperations):
(WebKit::WebsiteDataStore::processPoolForCookieStorageNotifications): Deleted.
* UIProcess/WebsiteData/WebsiteDataStore.h:

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

3 years agoDisable per-region boxes for multicolumn
hyatt@apple.com [Fri, 17 Mar 2017 21:59:33 +0000 (21:59 +0000)]
Disable per-region boxes for multicolumn
https://bugs.webkit.org/show_bug.cgi?id=169830

Reviewed by Zalan Bujtas.

Source/WebCore:

Test: fast/multicol/float-adjacent-to-overflow-block.html

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::determineLogicalLeftPositionForChild):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::borderBoxRectInRegion):
(WebCore::RenderBox::renderBoxRegionInfo):
Limit all of the per-region box code to RenderNamedFlowThreads.
This code should never be used by multicolumn layout.

LayoutTests:

* fast/multicol/float-adjacent-to-overflow-block-expected.html: Added.
* fast/multicol/float-adjacent-to-overflow-block.html: Added.

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

3 years agoTime channel attack on SVG Filters
said@apple.com [Fri, 17 Mar 2017 21:51:03 +0000 (21:51 +0000)]
Time channel attack on SVG Filters
https://bugs.webkit.org/show_bug.cgi?id=118689

Reviewed by Simon Fraser.

Source/WebCore:

The time channel attack can happen if the attacker applies FEColorMatrix
or FEConvolveMatrix and provides a matrix which is filled with subnormal
floating point values. Performing floating-point operations on subnormals
is very expensive unless the pixel in the source graphics is black (or
zero). By measuring the time a filter takes to be applied, the attacker
can know whether the pixel he wants to steal from  an iframe is black or
white. By repeating the same process on all the pixels in the iframe, the
attacker can reconstruct the whole page of the iframe.

To fix this issue, the values in the matrices of these filters will clamped
to FLT_MIN. We do not want to consume too much time calculating filtered
pixels because of such tiny values. The difference between applying FLT_MIN
and applying a subnormal should not be even noticeable. Normalizing the
floating-point matrices should happen only at the beginning of the filter
platformApplySoftware().

* platform/graphics/filters/FEColorMatrix.cpp:
(WebCore::FEColorMatrix::platformApplySoftware):
* platform/graphics/filters/FEConvolveMatrix.cpp:
(WebCore::FEConvolveMatrix::fastSetInteriorPixels):
(WebCore::FEConvolveMatrix::fastSetOuterPixels):
(WebCore::FEConvolveMatrix::platformApplySoftware):
* platform/graphics/filters/FEConvolveMatrix.h:
* platform/graphics/filters/FilterEffect.h:
(WebCore::FilterEffect::normalizedFloats):

Source/WTF:

Performing arithmetic operations on subnormal floating-point numbers is
very expensive. Normalizing the floating-point number to the minimum normal
value should accelerate the calculations and there won't be a noticeable
difference in the result since all the subnormal values and the minimum
normal value are all very close to zero.

* wtf/MathExtras.h:
(normalizedFloat):

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

3 years agoExplicitly resize the audio buffer in RealtimeOutgoingAudioSource.
jer.noble@apple.com [Fri, 17 Mar 2017 21:31:49 +0000 (21:31 +0000)]
Explicitly resize the audio buffer in RealtimeOutgoingAudioSource.
https://bugs.webkit.org/show_bug.cgi?id=169814
<rdar://problem/30975496>

Reviewed by Eric Carlson.

Rather than just reserving sufficient capacity, actually change the buffer's underlying size to match.

* platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
(WebCore::RealtimeOutgoingAudioSource::pullAudioData):

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

3 years ago[WK2] Disable background tab responsiveness detection on iOS
cdumez@apple.com [Fri, 17 Mar 2017 21:28:01 +0000 (21:28 +0000)]
[WK2] Disable background tab responsiveness detection on iOS
https://bugs.webkit.org/show_bug.cgi?id=169824
<rdar://problem/30913776>

Reviewed by Dan Bernstein.

Disable background tab responsiveness detection on iOS where background tabs
often get suspended. This feature was not tested or meant to be enabled on
iOS, this was an oversight on my part.

* UIProcess/BackgroundProcessResponsivenessTimer.cpp:
(WebKit::BackgroundProcessResponsivenessTimer::shouldBeActive):

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

3 years ago[WebCrypto] Make sure all CryptoKey classes are structured clonable
jiewen_tan@apple.com [Fri, 17 Mar 2017 21:18:42 +0000 (21:18 +0000)]
[WebCrypto] Make sure all CryptoKey classes are structured clonable
https://bugs.webkit.org/show_bug.cgi?id=169232
<rdar://problem/31106660>

Reviewed by Brent Fulgham.

Source/WebCore:

This patch does the following few things: 1) It makes CryptoKeyEC and CryptoKeyRaw
structured clonable; 2) It makes CryptoKeyAES and CryptoKeyHMAC to use a move importer
during deserialization; 3) It adds some tests to make sure CryptoKeyAES, CryptoKeyHMAC
and CryptoKeyRSA won't lose their internal data during serialization/deserialization.

Tests: crypto/workers/subtle/ec-postMessage-worker.html
       crypto/workers/subtle/raw-postMessage-worker.html

* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::write):
(WebCore::CloneDeserializer::readHMACKey):
(WebCore::CloneDeserializer::readAESKey):
(WebCore::CloneDeserializer::readECKey):
(WebCore::CloneDeserializer::readRawKey):
(WebCore::CloneDeserializer::readCryptoKey):
* crypto/keys/CryptoKeyEC.cpp:
(WebCore::CryptoKeyEC::namedCurveString):
(WebCore::CryptoKeyEC::isValidECAlgorithm):
* crypto/keys/CryptoKeyEC.h:

LayoutTests:

* crypto/workers/subtle/aes-postMessage-worker-expected.txt:
* crypto/workers/subtle/aes-postMessage-worker.html:
* crypto/workers/subtle/ec-postMessage-worker-expected.txt: Added.
* crypto/workers/subtle/ec-postMessage-worker.html: Added.
* crypto/workers/subtle/hmac-postMessage-worker-expected.txt:
* crypto/workers/subtle/hmac-postMessage-worker.html:
* crypto/workers/subtle/raw-postMessage-worker-expected.txt: Added.
* crypto/workers/subtle/raw-postMessage-worker.html: Added.
* crypto/workers/subtle/resources/ec-postMessage-worker.js: Added.
* crypto/workers/subtle/resources/raw-postMessage-worker.js: Added.
* crypto/workers/subtle/resources/rsa-postMessage-worker.js:
* crypto/workers/subtle/rsa-postMessage-worker-expected.txt:
* crypto/workers/subtle/rsa-postMessage-worker.html:

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

3 years agoUse USE_INTERNAL_SDK to compute ENABLE_FAST_JIT_PERMISSIONS instead of HAVE_INTERNAL_SDK
msaboff@apple.com [Fri, 17 Mar 2017 21:16:05 +0000 (21:16 +0000)]
Use USE_INTERNAL_SDK to compute ENABLE_FAST_JIT_PERMISSIONS instead of HAVE_INTERNAL_SDK
https://bugs.webkit.org/show_bug.cgi?id=169817

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

* Configurations/FeatureDefines.xcconfig:

Source/WebCore/PAL:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit/mac:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit2:

* Configurations/FeatureDefines.xcconfig:

Tools:

* TestWebKitAPI/Configurations/FeatureDefines.xcconfig:

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

3 years ago[MediaStream] Compensate for video capture orientation
eric.carlson@apple.com [Fri, 17 Mar 2017 21:14:28 +0000 (21:14 +0000)]
[MediaStream] Compensate for video capture orientation
https://bugs.webkit.org/show_bug.cgi?id=169313
<rdar://problem/30994785>

Reviewed by Jer Noble.

No new tests, the mock video source doesn't support rotation. Test will be added when this
is fixed in https://bugs.webkit.org/show_bug.cgi?id=169822.

Add 'orientation' and 'mirrored' attributes to MediaSample
* platform/MediaSample.h:
(WebCore::MediaSample::videoOrientation):
(WebCore::MediaSample::videoMirrored):
* platform/graphics/avfoundation/MediaSampleAVFObjC.h:

A video sample can be rotated and/or mirrored, so the video layer may need to be rotated
and resized for display. We don't want expose this information to the renderer, so allocate
return a generic CALayer as the player's platforLayer, and add the video layer as a sublayer
so we can adjust it to display correctly. Add an enum for playback state as well as display
mode so we correctly display a black frame when video frames are available but playback has
not yet started.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(-[WebAVSampleBufferStatusChangeListener initWithParent:]):
(-[WebAVSampleBufferStatusChangeListener invalidate]):
(-[WebAVSampleBufferStatusChangeListener beginObservingLayers]):
(-[WebAVSampleBufferStatusChangeListener stopObservingLayers]): Ditto.
(-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoTransformationMatrix):
(WebCore::runWithoutAnimations):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerErrorDidChange):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::cancelLoad):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::platformLayer):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::displayLayer):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::backgroundLayer):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentDisplayMode):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayMode):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentMediaTime):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::activeStatusChanged):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateRenderingMode):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::paintCurrentFrameInContext):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::acceleratedRenderingStateChanged):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setShouldBufferData):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::backgroundLayerBoundsChanged):
(-[WebAVSampleBufferStatusChangeListener beginObservingLayer:]): Deleted.
(-[WebAVSampleBufferStatusChangeListener stopObservingLayer:]): Deleted.
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer): Deleted.
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer): Deleted.
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::paused): Deleted.
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::shouldBePlaying): Deleted.

* platform/mediastream/mac/AVVideoCaptureSource.h:
* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::processNewFrame): Add connection parameter so we can get the
video orientation.
(WebCore::AVVideoCaptureSource::captureOutputDidOutputSampleBufferFromConnection):

Pass sample orientation to libwebrtc.
* platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
(WebCore::RealtimeOutgoingVideoSource::sendFrame):
(WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
* platform/mediastream/mac/RealtimeOutgoingVideoSource.h:

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

3 years agoFix the flow thread state on the descendants of out of flow positioned replaced elements.
zalan@apple.com [Fri, 17 Mar 2017 21:12:47 +0000 (21:12 +0000)]
Fix the flow thread state on the descendants of out of flow positioned replaced elements.
https://bugs.webkit.org/show_bug.cgi?id=169821
<rdar://problem/30964017>

Reviewed by Simon Fraser.

Source/WebCore:

Descendants of a replaced out of flow elmement should inherit the flowthread state
from the replaced element and not from the replaced element's parent.

Test: fast/multicol/fix-inherit-when-container-is-replaced.html

* rendering/RenderObject.cpp:
(WebCore::RenderObject::computedFlowThreadState):

LayoutTests:

* fast/multicol/fix-inherit-when-container-is-replaced-expected.txt: Added.
* fast/multicol/fix-inherit-when-container-is-replaced.html: Added.

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

3 years agoUpdate feature status for outdated entries: CSS Shapes, Force Click Events
jond@apple.com [Fri, 17 Mar 2017 20:59:35 +0000 (20:59 +0000)]
Update feature status for outdated entries: CSS Shapes, Force Click Events
https://bugs.webkit.org/show_bug.cgi?id=169829

Reviewed by Matt Baker.

* features.json:

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

3 years agoMake SocketStreamError a private header.
achristensen@apple.com [Fri, 17 Mar 2017 20:45:27 +0000 (20:45 +0000)]
Make SocketStreamError a private header.
https://bugs.webkit.org/show_bug.cgi?id=169831

* WebCore.xcodeproj/project.pbxproj:
I'll need this from WebKit2.

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

3 years agoUpdate webrtc tests expectations
commit-queue@webkit.org [Fri, 17 Mar 2017 20:45:23 +0000 (20:45 +0000)]
Update webrtc tests expectations
https://bugs.webkit.org/show_bug.cgi?id=169828

Unreviewed.

Patch by Youenn Fablet <youenn@apple.com> on 2017-03-17

* TestExpectations: Marking some webrtc tests as flaky.

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

3 years agoAdd encoder for SocketStreamError
achristensen@apple.com [Fri, 17 Mar 2017 20:42:50 +0000 (20:42 +0000)]
Add encoder for SocketStreamError
https://bugs.webkit.org/show_bug.cgi?id=169831

Reviewed by Andy Estes.

This isn't used yet, but we'll soon need to send these across IPC.

* platform/network/SocketStreamError.h:
(WebCore::SocketStreamError::encode):
(WebCore::SocketStreamError::decode):

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

3 years agoMake SocketStreamHandle virtual functions asynchronous
achristensen@apple.com [Fri, 17 Mar 2017 20:30:37 +0000 (20:30 +0000)]
Make SocketStreamHandle virtual functions asynchronous
https://bugs.webkit.org/show_bug.cgi?id=169818

Reviewed by Andy Estes.

No change in behavior.  Instead of returning immediately, call a completion handler.
This is in preparation for making them truly asynchronous.

I still need to be able to synchronously get the number of buffered bytes, but the
buffer itself will soon be in the NetworkProcess with a new subclass of SocketStreamHandle
that messages across IPC.  The number of buffered bytes will still be stored in the WebProcess,
and when it updates, the message from SocketStreamHandleClient::didUpdateBufferedAmount will update it.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/network/SocketStreamHandle.cpp:
(WebCore::SocketStreamHandle::send):
(WebCore::SocketStreamHandle::close):
(WebCore::SocketStreamHandle::sendPendingData): Deleted.
* platform/network/SocketStreamHandle.h:
(WebCore::SocketStreamHandle::bufferedAmount): Deleted.
* platform/network/SocketStreamHandleImpl.cpp: Added.
(WebCore::SocketStreamHandleImpl::platformSend):
(WebCore::SocketStreamHandleImpl::sendPendingData):
(WebCore::SocketStreamHandleImpl::bufferedAmount):
m_buffer was moved from SocketStreamHandle to SocketStreamHandleImpl, so some of the logic must move with it.
I moved as much logic that was shared in the superclass to a new shared location for code shared among the subclass implementations.
* platform/network/cf/SocketStreamHandleImpl.h:
* platform/network/cf/SocketStreamHandleImplCFNet.cpp:
(WebCore::SocketStreamHandleImpl::platformSendInternal):
(WebCore::SocketStreamHandleImpl::platformSend): Deleted.
* platform/network/curl/SocketStreamHandleImpl.h:
* platform/network/curl/SocketStreamHandleImplCurl.cpp:
(WebCore::SocketStreamHandleImpl::platformSendInternal):
(WebCore::SocketStreamHandleImpl::platformSend): Deleted.
* platform/network/soup/SocketStreamHandleImpl.h:
* platform/network/soup/SocketStreamHandleImplSoup.cpp:
(WebCore::SocketStreamHandleImpl::platformSendInternal):
(WebCore::SocketStreamHandleImpl::platformSend): Deleted.

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

3 years agoAdd a reload policy where only expired subresources are revalidated
antti@apple.com [Fri, 17 Mar 2017 19:52:49 +0000 (19:52 +0000)]
Add a reload policy where only expired subresources are revalidated
https://bugs.webkit.org/show_bug.cgi?id=169756

Reviewed by Andreas Kling.

Source/WebCore:

Test: http/tests/cache/reload-expired-only.html

The default reload behavior revalidates all resources on the page. This patch adds
a new policy that revalidates expired (and uncacheable) resources only. Using this
policy can speed up reloads significantly and also reduce network traffic and server
load.

* history/PageCache.cpp:
(WebCore::canCachePage):
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::reload):
* loader/FrameLoader.cpp:
(WebCore::isBackForwardLoadType):
(WebCore::isReload):

    Add a helper function.

(WebCore::FrameLoader::loadURL):
(WebCore::logNavigation):
(WebCore::FrameLoader::reload):

    Replace bool arguments with OptionSet<ReloadOption>. Most of the patch is about adapting to this.

(WebCore::FrameLoader::transitionToCommitted):
(WebCore::FrameLoader::subresourceCachePolicy):

    Return CachePolicyVerify for 'ReloadExpiredOnly' frame load type. This is the substantive
    change that causes the behavior difference.

(WebCore::FrameLoader::checkLoadCompleteForThisFrame):
(WebCore::FrameLoader::defaultRequestCachingPolicy):

    Flip the isMainResource condition for better readability.

(WebCore::FrameLoader::shouldPerformFragmentNavigation):
(WebCore::FrameLoader::loadDifferentDocumentItem):
* loader/FrameLoader.h:
(WebCore::FrameLoader::reload):
* loader/FrameLoaderTypes.h:
* loader/HistoryController.cpp:
(WebCore::HistoryController::restoreDocumentState):
* page/DiagnosticLoggingKeys.cpp:
(WebCore::DiagnosticLoggingKeys::reloadRevalidatingExpiredKey):
* page/DiagnosticLoggingKeys.h:
* replay/UserInputBridge.cpp:
(WebCore::UserInputBridge::reloadFrame):
* replay/UserInputBridge.h:
* testing/Internals.cpp:
(WebCore::Internals::forceReload):
(WebCore::Internals::reloadExpiredOnly):

    Testing support.

* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit/mac:

* WebView/WebFrame.mm:
(toWebFrameLoadType):
(-[WebFrame reload]):
(-[WebFrame reloadFromOrigin]):

Source/WebKit2:

* UIProcess/API/C/WKPage.cpp:
(WKPageReload):
(WKPageReloadWithoutContentBlockers):
(WKPageReloadFromOrigin):
(WKPageReloadExpiredOnly):
* UIProcess/API/C/WKPage.h:
* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
(-[WKBrowsingContextController reload]):
(-[WKBrowsingContextController reloadFromOrigin]):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView reload]):
(-[WKWebView reloadFromOrigin]):
(-[WKWebView _reloadWithoutContentBlockers]):
(-[WKWebView _reloadExpiredOnly]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::reloadBrowsingContext):
* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::didHandleContentFilterUnblockNavigation):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::reload):
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::reload):
(WebKit::shouldReuseCommittedSandboxExtension):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

LayoutTests:

* http/tests/cache/reload-expired-only-expected.txt: Added.
* http/tests/cache/reload-expired-only.html: Added.
* http/tests/cache/resources/document-with-cached-unique-script.html: Added.
* http/tests/cache/resources/random-cached.cgi:

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

3 years agoAX: VoiceOver no longer works corectly with editable text in the web
n_wang@apple.com [Fri, 17 Mar 2017 19:48:36 +0000 (19:48 +0000)]
AX: VoiceOver no longer works corectly with editable text in the web
https://bugs.webkit.org/show_bug.cgi?id=169801

Reviewed by Chris Fleizach.

Source/WebCore:

The issue is that since we are entering text controls when getting the text marker,
the end text marker of the input tag might associate to the placeholder div instead of
the input tag itself.
Fixed the issue by checking the shadow elements using shadowHost() instead of isShadowRoot().
Also, only enter text controls when navigating by characters/indexes, so that both Mac and
iOS will get the correct text marker ranges for shadow host elements.

Tests: accessibility/ios-simulator/element-text-range-for-text-control.html
       accessibility/mac/text-markers-for-input-with-placeholder.html

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::traverseToOffsetInRange):
(WebCore::AXObjectCache::startOrEndCharacterOffsetForRange):
(WebCore::AXObjectCache::characterOffsetForIndex):
* accessibility/AXObjectCache.h:

LayoutTests:

* accessibility/ios-simulator/element-text-range-for-text-control-expected.txt: Added.
* accessibility/ios-simulator/element-text-range-for-text-control.html: Added.
* accessibility/mac/text-markers-for-input-with-placeholder-expected.txt: Added.
* accessibility/mac/text-markers-for-input-with-placeholder.html: Added.

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

3 years ago[WK1] Support animated transitions when performing a data interaction operation
wenson_hsieh@apple.com [Fri, 17 Mar 2017 19:30:43 +0000 (19:30 +0000)]
[WK1] Support animated transitions when performing a data interaction operation
https://bugs.webkit.org/show_bug.cgi?id=169805
<rdar://problem/31045767>

Reviewed by Beth Dakin and Megan Gardner.

Source/WebCore:

When performing a snapshot excluding the current selection, use ScrollableArea::visibleContentRect to compute
the visible content rect rather than FrameView::visualViewportRect. In WebKit1, the latter will return the
entire content view's bounds.

* page/TextIndicator.cpp:
(WebCore::takeSnapshots):

Source/WebKit/mac:

Adds WebKit1 support for animated transitions when performing a data interaction operation. See per-method changes
for more details.

* DOM/DOMElement.h:
* DOM/DOMElement.mm:
(-[DOMElement boundsInRootViewSpace]):

Introduce -[DOMElement boundsInRootViewSpace], which returns the bounds of the element in root view coordinates.

* WebCoreSupport/WebDragClient.h:
(): Deleted.
* WebCoreSupport/WebDragClient.mm:
(WebDragClient::didConcludeEditDrag):

Add boilerplate plumbing.

* WebView/WebView.mm:
(-[WebUITextIndicatorData initWithImage:textIndicatorData:scale:]):

Add contentImageWithoutSelection and contentImageWithoutSelectionRectInRootViewCoordinates to WebUITextIndicatorData.

(floatRectsForCGRectArray):
(-[WebView _createImageWithPlatterForImage:boundingRect:contentScaleFactor:clippingRects:]):

Introduces a SPI helper method in WebView that clients can use to generate an image of a text platter given an
image of some text, as well as clipping rects to apply to the image.

(-[WebView _dataOperationTextIndicator]):

Add SPI to fetch the text indicator used to drive animations for the current data operation.

(-[WebView _didConcludeEditDataInteraction]):
* WebView/WebViewData.h:
* WebView/WebViewInternal.h:
* WebView/WebViewPrivate.h:

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

3 years agoInitial letter does not paginate properly.
hyatt@apple.com [Fri, 17 Mar 2017 18:54:47 +0000 (18:54 +0000)]
Initial letter does not paginate properly.
https://bugs.webkit.org/show_bug.cgi?id=169795
<rdar://problem/23715770>

Reviewed by Zalan Bujtas.

Source/WebCore:

Tests: fast/css-generated-content/initial-letter-pagination-raised.html
       fast/css-generated-content/initial-letter-pagination-raised-rl.html
       fast/css-generated-content/initial-letter-pagination-sunken.html
       fast/css-generated-content/initial-letter-pagination-sunken-rl.html

* rendering/FloatingObjects.cpp:
(WebCore::FloatingObject::FloatingObject):
(WebCore::FloatingObject::copyToNewContainer):
(WebCore::FloatingObject::cloneForNewParent):
(WebCore::FloatingObject::translationOffsetToAncestor):
* rendering/FloatingObjects.h:
(WebCore::FloatingObject::setMarginOffset):
(WebCore::FloatingObject::locationOffsetOfBorderBox):
(WebCore::FloatingObject::marginOffset):
Add the margin offset to the FloatingObject so that we can control the
placement of the border box relative to the margin box without relying
on only the CSS-specified margins. This allows for sunken initial letter
FloatingObjects to be created and propagated out to ancestor blocks for painting
without altering the CSS margins of the sunken letter.

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::adjustForUnsplittableChild):
Update the logical height for initial letter containers after the initial
letter shifts to the next page, since the lines that follow need to lay out
relative to the initial letter, i.e., they shift down if it shifts down.

(WebCore::RenderBlockFlow::addOverflowFromFloats):
(WebCore::RenderBlockFlow::paintFloats):
(WebCore::RenderBlockFlow::clipOutFloatingObjects):
Patched to use the new helpers on FloatingObject rather than
xPositionForFloatIncludingMargins and yPositionForFloatIncludingMargins.

(WebCore::RenderBlockFlow::computeLogicalLocationForFloat):
Updated to set the placement and margins of the floating object before
returning. The initial letter adjustments have been factored out into their
own function.

(WebCore::RenderBlockFlow::adjustInitialLetterPosition):
A helper function called by computeLogicalLocationForFloat that handles
the placement and margin adjustments for initial letters. Note that sunken
letters no longer "hack" the top margin of the child but instead rely on
the fact that the FloatingObject has its own independent margin offset now
that can be set to a value that is distinct from the CSS supplied margin.

(WebCore::RenderBlockFlow::positionNewFloats):
Revised to no longer do the placement, but to let computeLogicalLocationForFloat
do it. The height is still set here however, since we don't know that until after
the child has received a layout.

(WebCore::RenderBlockFlow::addOverhangingFloats):
(WebCore::RenderBlockFlow::flipFloatForWritingModeForChild):
(WebCore::RenderBlockFlow::hitTestFloats):
(WebCore::RenderBlockFlow::adjustForBorderFit):
Patched to use the new FloatingObject helpers rather than
xPositionForFloatIncludingMargins and yPositionForFloatIncludingMargins.

* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::setLogicalMarginsForFloat):
New helper function for setting the margin offsets on a FloatingObject.

(WebCore::RenderBlockFlow::xPositionForFloatIncludingMargin): Deleted.
(WebCore::RenderBlockFlow::yPositionForFloatIncludingMargin): Deleted.
Deleted in favor of new FloatingObject helpers.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::isUnsplittableForPagination):
Make initial letter unsplittable as far as pagination is concerned.

* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::ascentAndDescentForBox):
(WebCore::RootInlineBox::includeFontForBox):
(WebCore::RootInlineBox::includeGlyphsForBox):
(WebCore::RootInlineBox::fitsToGlyphs):
Turn off the restriction that you can't fit to vertical glyphs. The numbers returned
are fine now. This allows vertical initial letters to work.

LayoutTests:

* fast/css-generated-content/initial-letter-pagination-raised-expected.html: Added.
* fast/css-generated-content/initial-letter-pagination-raised.html: Added.
* fast/css-generated-content/initial-letter-pagination-sunken-expected.html: Added.
* fast/css-generated-content/initial-letter-pagination-sunken.html: Added.
* platform/ios-simulator/TestExpectations:

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

3 years agoAir should be powerful enough to support Tmp-splitting
fpizlo@apple.com [Fri, 17 Mar 2017 17:58:18 +0000 (17:58 +0000)]
Air should be powerful enough to support Tmp-splitting
https://bugs.webkit.org/show_bug.cgi?id=169515

Reviewed by Saam Barati.

Source/JavaScriptCore:

In the process of implementing the Tmp-splitting optimization, I made some small
clean-ups. They don't affect anything - it's basically moving code around and adding
utility functions.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* assembler/LinkBuffer.cpp:
(JSC::LinkBuffer::allocate): testb3 was sometimes failing its checkDoesNotUseInstruction check because of uninitialized memory. This initializes the internal fragmentation slop of every JIT allocation.
* b3/air/AirAllocateRegistersByGraphColoring.cpp:
* b3/air/AirAllocateRegistersByGraphColoring.h:
(JSC::B3::Air::useIRC): It's useful to be able to query which register allocator we're using.
* b3/air/AirArg.cpp:
(WTF::printInternal):
* b3/air/AirArg.h:
(JSC::B3::Air::Arg::temperature): The temperature of a role is a useful concept to have factored out.
* b3/air/AirBreakCriticalEdges.cpp: Added.
(JSC::B3::Air::breakCriticalEdges): I was surprised that we didn't have this already. It's a pretty fundamental CFG utility.
* b3/air/AirBreakCriticalEdges.h: Added.
* b3/air/AirGenerate.cpp:
* b3/air/AirInsertionSet.h: You can't use & if you want copy-constructibility, which seems to be a prerequisite to IndexMap<BasicBlock, InsertionSet>.
(JSC::B3::Air::InsertionSet::InsertionSet):
(JSC::B3::Air::InsertionSet::code):
* b3/air/AirLiveness.h: Teach Liveness to track only warm liveness.
(JSC::B3::Air::TmpLivenessAdapter::acceptsRole):
(JSC::B3::Air::StackSlotLivenessAdapter::acceptsRole):
(JSC::B3::Air::RegLivenessAdapter::acceptsRole):
(JSC::B3::Air::AbstractLiveness::AbstractLiveness):
(JSC::B3::Air::AbstractLiveness::LocalCalc::execute):

Source/WTF:

Teach IndexMap how to handle types that don't have a default constructor. This makes it
easy to create a IndexMap<BasicBlock, InsertionSet>, which is a super powerful
construct.

* wtf/IndexMap.h:
(WTF::IndexMap::IndexMap):
(WTF::IndexMap::resize):
(WTF::IndexMap::clear):

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

3 years agoRealtimeIncomingAudioSource is not stopping properly
commit-queue@webkit.org [Fri, 17 Mar 2017 17:16:51 +0000 (17:16 +0000)]
RealtimeIncomingAudioSource is not stopping properly
https://bugs.webkit.org/show_bug.cgi?id=169807

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

Source/WebCore:

Test: webrtc/release-after-getting-track.html

* platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
(WebCore::RealtimeIncomingAudioSource::~RealtimeIncomingAudioSource):
(WebCore::RealtimeIncomingAudioSource::stopProducingData):

LayoutTests:

* webrtc/release-after-getting-track-expected.txt: Added.
* webrtc/release-after-getting-track.html: Added.

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

3 years agoUse completion handlers instead of return values for sending websocket data
achristensen@apple.com [Fri, 17 Mar 2017 15:57:23 +0000 (15:57 +0000)]
Use completion handlers instead of return values for sending websocket data
https://bugs.webkit.org/show_bug.cgi?id=169802

Reviewed by Carlos Garcia Campos.

Source/WebCore:

No change in behavior, but this is a baby step towards making things more asynchronous.

* Modules/websockets/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::didOpenSocketStream):
(WebCore::WebSocketChannel::processOutgoingFrameQueue):
(WebCore::WebSocketChannel::sendFrame):
* Modules/websockets/WebSocketChannel.h:
* platform/network/SocketStreamHandle.cpp:
(WebCore::SocketStreamHandle::send):
* platform/network/SocketStreamHandle.h:
* platform/network/cf/SocketStreamHandleImpl.h:

Source/WebKit2:

* UIProcess/InspectorServer/WebSocketServerConnection.cpp:
(WebKit::WebSocketServerConnection::sendWebSocketMessage):
(WebKit::WebSocketServerConnection::sendHTTPResponseHeader):
(WebKit::WebSocketServerConnection::sendRawData):

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

3 years agoWebGPU: build fixes for non-Cocoa platforms
zandobersek@gmail.com [Fri, 17 Mar 2017 14:11:24 +0000 (14:11 +0000)]
WebGPU: build fixes for non-Cocoa platforms
https://bugs.webkit.org/show_bug.cgi?id=169781

Reviewed by Alex Christensen.

Enable building WebGPU code for other ports and fix various build
failures. This still leaves the GPUDevice::platformLayer() method
missing for other ports, as well as the general implementation of
the WebGPU platform abstractions under platform/graphics/gpu/.

* CMakeLists.txt: Move the WebGPU build targets here.
* PlatformMac.cmake:
* html/canvas/WebGPULibrary.h: Explicitly include the WTFString.h
header to suppress missing WTF::String definition errors.
* platform/graphics/gpu/GPUBuffer.cpp:
(WebCore::GPUBuffer::contents): Avoid ambiguous calls to
ArrayBuffer::create() by passing nullptr as the first argument.
* platform/graphics/gpu/GPUDevice.h: Include the Forward.h header
to forward-declare the WTF::String class. Also remove the unused
PlatformGPUDevice typedef for non-Cocoa platforms.
(WebCore::GPUDevice::layer): Move this and the related m_layer
member variable under the PLATFORM(COCOA) guard.
* platform/graphics/gpu/GPUFunction.cpp:
(WebCore::GPUFunction::GPUFunction): Remove the GPULibrary
parameter checks in this no-op constructor that's used on
non-Cocoa platforms.

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

3 years agoFix uninitialized public members in WebProcess
tpopela@redhat.com [Fri, 17 Mar 2017 13:13:02 +0000 (13:13 +0000)]
Fix uninitialized public members in WebProcess
https://bugs.webkit.org/show_bug.cgi?id=169604

Reviewed by Michael Catanzaro.

Found by Coverity scan.

* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
* WebProcess/InjectedBundle/InjectedBundleNavigationAction.h:
* WebProcess/Plugins/Netscape/NetscapePlugin.h:
* WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
(WebKit::NetscapePluginX11::NetscapePluginX11):

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

3 years agoFollow-up (r213833): write a layout test for 169199
magomez@igalia.com [Fri, 17 Mar 2017 12:22:10 +0000 (12:22 +0000)]
Follow-up (r213833): write a layout test for 169199
https://bugs.webkit.org/show_bug.cgi?id=169576
<rdar://problem/31024766>

Reviewed by Said Abou-Hallawa.

Source/WebCore:

Add a function to Internals to force the deletion of the ImageDecoder just after
requesting the async decoding of a frame, and implement that behaviour in BitmapImage.

Test: fast/images/clear-animation-decoder.html

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

LayoutTests:

Add a test that ensures there's no crash when deleting the ImageDecoder after requesting
an async decoding operation.

* fast/images/clear-animation-decoder-expected.txt: Added.
* fast/images/clear-animation-decoder.html: Added.

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

3 years agoUnreviewed GTK+ gardening. Mark mediastream and webrtc new failures.
carlosgc@webkit.org [Fri, 17 Mar 2017 09:46:11 +0000 (09:46 +0000)]
Unreviewed GTK+ gardening. Mark mediastream and webrtc new failures.

* platform/gtk/TestExpectations:

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

3 years agoFix uninitialized public members in NetworkProcess
tpopela@redhat.com [Fri, 17 Mar 2017 09:45:55 +0000 (09:45 +0000)]
Fix uninitialized public members in NetworkProcess
https://bugs.webkit.org/show_bug.cgi?id=169598

Reviewed by Alex Christensen.

Found by Coverity scan.

* NetworkProcess/NetworkProcessCreationParameters.h:
* NetworkProcess/cache/NetworkCacheStorage.cpp:

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

3 years ago[Cairo] Handle the blend mode in GraphicsContext::drawPattern
carlosgc@webkit.org [Fri, 17 Mar 2017 08:22:57 +0000 (08:22 +0000)]
[Cairo] Handle the blend mode in GraphicsContext::drawPattern
https://bugs.webkit.org/show_bug.cgi?id=169746

Reviewed by Žan Doberšek.

We are not taking into account the blend mode when passing the cairo operator to drawPatternToCairoContext().
This is based on patch by Žan Doberšek, just adding the toCairoOperator changes to make it easier to handle
it. Instead of checking everywhere if blend mode is Normal to decide whether to use toCairoOperator with
CompositeOperator or BlendMode, there's no a single toCairoOperator that receives both parameters, but BlendMode
is optional and defaults to Normal.

* platform/graphics/cairo/CairoUtilities.cpp:
(WebCore::toCairoCompositeOperator):
(WebCore::toCairoOperator):
* platform/graphics/cairo/CairoUtilities.h:
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::setPlatformCompositeOperation):
(WebCore::GraphicsContext::drawPattern):

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

3 years agoWeb Inspector: memory category timelines would look better with ruler tick-aligned...
webkit@devinrousso.com [Fri, 17 Mar 2017 05:29:51 +0000 (05:29 +0000)]
Web Inspector: memory category timelines would look better with ruler tick-aligned guides
https://bugs.webkit.org/show_bug.cgi?id=158100

Reviewed by Joseph Pecoraro.

* UserInterface/Views/MemoryTimelineView.css:
(.timeline-view.memory > .content > .details):
(.timeline-view.memory > .content > .details > .timeline-ruler):
(body[dir=ltr] .timeline-view.memory > .content > .details > .timeline-ruler):
(body[dir=rtl] .timeline-view.memory > .content > .details > .timeline-ruler):
Make the TimelineRuler absolutely positioned so it can use the full height of the view,
providing enough space for the markers to be visible.

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

3 years agoMark imported/w3c/web-platform-tests/html/browsers/history/the-location-interface...
ryanhaddad@apple.com [Fri, 17 Mar 2017 05:14:31 +0000 (05:14 +0000)]
Mark imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location_hash.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=169572

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

3 years agoRebaseline js/dom/global-constructors-attributes.html.
ryanhaddad@apple.com [Fri, 17 Mar 2017 04:49:23 +0000 (04:49 +0000)]
Rebaseline js/dom/global-constructors-attributes.html.

Unreviewed test gardening.

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

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

3 years agoWeb Inspector: Console Evaluation links in the Console should not show normally
webkit@devinrousso.com [Fri, 17 Mar 2017 02:14:28 +0000 (02:14 +0000)]
Web Inspector: Console Evaluation links in the Console should not show normally
https://bugs.webkit.org/show_bug.cgi?id=157483

Reviewed by Matt Baker.

* UserInterface/Models/CallFrame.js:
(WebInspector.CallFrame):
(WebInspector.CallFrame.prototype.get isConsoleEvaluation):
(WebInspector.CallFrame.fromDebuggerPayload):
(WebInspector.CallFrame.fromPayload):
Move console evaluation check to the constructor for consistency.

* UserInterface/Views/ConsoleMessageView.js:
(WebInspector.ConsoleMessageView.prototype._appendLocationLink):
* UserInterface/Views/StackTraceView.js:
(WebInspector.StackTraceView):
Only add CallFrameView elements if the corresponding CallFame is not a console evaluation.

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

3 years agoFix GTK build.
achristensen@apple.com [Fri, 17 Mar 2017 02:07:54 +0000 (02:07 +0000)]
Fix GTK build.

* UIProcess/InspectorServer/WebSocketServerConnection.h:

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

3 years agoFix GTK build.
achristensen@apple.com [Fri, 17 Mar 2017 01:56:05 +0000 (01:56 +0000)]
Fix GTK build.

* UIProcess/InspectorServer/WebSocketServerConnection.cpp:
(WebKit::WebSocketServerConnection::didReceiveSocketStreamData):
* UIProcess/InspectorServer/WebSocketServerConnection.h:

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

3 years agoFix GTK build.
achristensen@apple.com [Fri, 17 Mar 2017 01:43:05 +0000 (01:43 +0000)]
Fix GTK build.

* platform/network/soup/SocketStreamHandleImplSoup.cpp:
(WebCore::SocketStreamHandleImpl::readBytes):
Changing RefPtr to Ref broke something.
For the record, EWS was orange so I couldn't see these build failures.

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

3 years agoTurn off JavaScript Configuration File processing for Debug builds
msaboff@apple.com [Fri, 17 Mar 2017 01:37:12 +0000 (01:37 +0000)]
Turn off JavaScript Configuration File processing for Debug builds
https://bugs.webkit.org/show_bug.cgi?id=169799

Reviewed by Dean Jackson.

Change the default value for m_javaScriptConfigurationFileEnabled for Debug
builds to be the same as a Release build, that is false (off).

* UIProcess/WebProcessPool.h:

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

3 years agoFix GTK build.
achristensen@apple.com [Fri, 17 Mar 2017 01:23:50 +0000 (01:23 +0000)]
Fix GTK build.

* platform/network/soup/SocketStreamHandleImplSoup.cpp:
(WebCore::SocketStreamHandleImpl::readBytes):
didFailToReceiveSocketStreamData needs a parameter.

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

3 years agoactivating webrtc tests on Release bots
commit-queue@webkit.org [Fri, 17 Mar 2017 00:51:37 +0000 (00:51 +0000)]
activating webrtc tests on Release bots
https://bugs.webkit.org/show_bug.cgi?id=169775

Unreviewed.

Patch by Youenn Fablet <youenn@apple.com> on 2017-03-16

* TestExpectations:

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

3 years agoWebGL: Improve index validation when using uint index values
dino@apple.com [Fri, 17 Mar 2017 00:51:02 +0000 (00:51 +0000)]
WebGL: Improve index validation when using uint index values
https://bugs.webkit.org/show_bug.cgi?id=169798

Reviewed by Simon Fraser.

Source/WebCore:

Make sure that we test index validation with the correct type.
Also stop using -1 in WebGLBuffer to indicate non-existant values.

Test: fast/canvas/webgl/draw-elements-out-of-bounds-uint-index.html

* html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::validateIndexArrayConservative): Use optional<> and
unsigned values.
* html/canvas/WebGLBuffer.cpp: Use unsigned for maxIndex (they can't be negative)
and optional<> to indicate unknown value.
(WebCore::WebGLBuffer::getCachedMaxIndex):
(WebCore::WebGLBuffer::setCachedMaxIndex):
* html/canvas/WebGLBuffer.h:
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::validateIndexArrayConservative): Use optional<> and
unsigned values.
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::validateVertexAttributes): No need to check if
an unsigned value is less than zero.

LayoutTests:

* fast/canvas/webgl/draw-elements-out-of-bounds-uint-index-expected.txt: Added.
* fast/canvas/webgl/draw-elements-out-of-bounds-uint-index.html: Added.

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

3 years agoFix exception scope verification failures in GenericArgumentsInlines.h.
mark.lam@apple.com [Fri, 17 Mar 2017 00:51:01 +0000 (00:51 +0000)]
Fix exception scope verification failures in GenericArgumentsInlines.h.
https://bugs.webkit.org/show_bug.cgi?id=165012

Reviewed by Saam Barati.

* runtime/GenericArgumentsInlines.h:
(JSC::GenericArguments<Type>::defineOwnProperty):

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

3 years agoImprove the system tracing points
simon.fraser@apple.com [Fri, 17 Mar 2017 00:47:16 +0000 (00:47 +0000)]
Improve the system tracing points
https://bugs.webkit.org/show_bug.cgi?id=169790

Reviewed by Zalan Bujtas.

Use a more cohesive set of system trace points that give a good overview of what
WebKit is doing. Added points for resource loading, render tree building, sync messages
to the web process, async image decode, WASM and fetching cookies.

Source/JavaScriptCore:

* wasm/WasmPlan.cpp:
(JSC::Wasm::Plan::run):
* wasm/js/WebAssemblyFunction.cpp:
(JSC::callWebAssemblyFunction):

Source/WebCore:

* loader/CookieJar.cpp:
(WebCore::cookies):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::provisionalLoadStarted):
(WebCore::FrameLoader::checkLoadCompleteForThisFrame):
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::willSendRequestInternal):
(WebCore::logResourceLoaded):
(WebCore::SubresourceLoader::didFinishLoading):
(WebCore::SubresourceLoader::didFail):
(WebCore::SubresourceLoader::didCancel):
* page/FrameView.cpp:
(WebCore::FrameView::paintContents):
* platform/graphics/ImageFrameCache.cpp:
(WebCore::ImageFrameCache::startAsyncDecodingQueue):
* platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
(WebCore::DisplayRefreshMonitorIOS::requestRefreshCallback):
(WebCore::DisplayRefreshMonitorIOS::displayLinkFired):
* style/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::commit):

Source/WebKit/mac:

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

Source/WebKit2:

* UIProcess/ChildProcessProxy.h:
(WebKit::ChildProcessProxy::sendSync):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::handleTouchEventSynchronously):
* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
(WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
* WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
(WebKit::RemoteLayerTreeContext::buildTransaction):
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::didUpdate):
(WebKit::RemoteLayerTreeDrawingArea::BackingStoreFlusher::flush):

Source/WTF:

* wtf/SystemTracing.h:

Tools:

* Tracing/SystemTracePoints.plist:

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

3 years agoWeb Inspector: REGRESSION (r213691): Saving DOM breakpoints broken after refactoring
mattbaker@apple.com [Fri, 17 Mar 2017 00:23:45 +0000 (00:23 +0000)]
Web Inspector: REGRESSION (r213691): Saving DOM breakpoints broken after refactoring
https://bugs.webkit.org/show_bug.cgi?id=169779

Reviewed by Joseph Pecoraro.

Use correct method: _saveBreakpoints -> _saveDOMBreakpoints.

* UserInterface/Controllers/DOMDebuggerManager.js:
(WebInspector.DOMDebuggerManager.prototype.addDOMBreakpoint):
Remove check before saving to be consistent with similar code in
DebuggerManager and DOMDebuggerManager.

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

3 years agoRenderView::documentBeingDestroyed() needs a new name.
simon.fraser@apple.com [Fri, 17 Mar 2017 00:20:45 +0000 (00:20 +0000)]
RenderView::documentBeingDestroyed() needs a new name.
https://bugs.webkit.org/show_bug.cgi?id=166727

Reviewed by Andreas Kling.

Now that we destroy the render tree for documents going into the page cache, RenderView::documentBeingDestroyed()
is misleadingly named. Rename it to renderTreeBeingDestroyed() and fix all callers.

* page/FrameView.cpp:
(WebCore::FrameView::scheduleRelayoutOfSubtree):
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::absoluteEventTrackingRegionsForFrame):
* rendering/CounterNode.cpp:
(WebCore::CounterNode::resetRenderers):
* rendering/ImageQualityController.cpp:
(WebCore::ImageQualityController::highQualityRepaintTimerFired):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::willBeDestroyed):
(WebCore::canMergeContiguousAnonymousBlocks):
(WebCore::RenderBlock::removeChild):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::willBeDestroyed):
(WebCore::RenderBlockFlow::removeChild):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::removeFloatingOrPositionedChildFromBlockLists):
(WebCore::RenderBox::deleteLineBoxWrapper):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::willBeDestroyed):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::insertChildInternal):
(WebCore::RenderElement::removeChildInternal):
(WebCore::RenderElement::clearLayoutRootIfNeeded):
(WebCore::RenderElement::willBeDestroyed):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::imageChanged):
(WebCore::RenderImage::notifyFinished):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::willBeDestroyed):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::removeChild):
(WebCore::RenderLayer::calculateClipRects):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::notifyFlushRequired):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::layerWillBeRemoved):
(WebCore::RenderLayerCompositor::fixedRootBackgroundLayerChanged):
* rendering/RenderLineBreak.cpp:
(WebCore::RenderLineBreak::deleteInlineBoxWrapper):
* rendering/RenderNamedFlowFragment.cpp:
(WebCore::RenderNamedFlowFragment::attachRegion):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::resetFlowThreadStateOnRemoval):
(WebCore::RenderObject::willBeDestroyed):
(WebCore::RenderObject::destroyAndCleanupAnonymousWrappers):
* rendering/RenderObject.h:
(WebCore::RenderObject::renderTreeBeingDestroyed):
(WebCore::RenderObject::documentBeingDestroyed): Deleted.
* rendering/RenderQuote.cpp:
(WebCore::RenderQuote::detachQuote):
* rendering/RenderRegion.cpp:
(WebCore::RenderRegion::attachRegion):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::willBeDestroyed):
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::removeChild):
* rendering/RenderTable.h:
(WebCore::RenderTable::setNeedsSectionRecalc):
* rendering/RenderText.cpp:
(WebCore::RenderText::removeAndDestroyTextBoxes):
* rendering/RenderVideo.cpp:
(WebCore::RenderVideo::updatePlayer):
* rendering/svg/RenderSVGResource.cpp:
(WebCore::RenderSVGResource::markForLayoutAndParentResourceInvalidation):
* rendering/svg/RenderSVGResourceContainer.cpp:
(WebCore::RenderSVGResourceContainer::markClientForInvalidation):
* rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::subtreeChildWasAdded):
(WebCore::RenderSVGText::subtreeChildWillBeRemoved):
(WebCore::RenderSVGText::subtreeChildWasRemoved):
(WebCore::RenderSVGText::subtreeStyleDidChange):

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

3 years agoWrap legacy WebRTC API in runtime flag
commit-queue@webkit.org [Fri, 17 Mar 2017 00:05:36 +0000 (00:05 +0000)]
Wrap legacy WebRTC API in runtime flag
https://bugs.webkit.org/show_bug.cgi?id=169646

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

Source/WebCore:

Test: webrtc/legacy-api.html

Adding a runtime flag for legacy API.
Making some WebIDL peer connection members runtime-enabled.
Adding a JS private getter on this flag so that overloaded operations behave as promise-based only if flag is turned off.

* Modules/mediastream/RTCPeerConnection.idl:
* Modules/mediastream/RTCPeerConnectionInternals.js:
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::isWebRTCLegacyAPIEnabled):
(WebCore::JSDOMGlobalObject::addBuiltinGlobals):
* bindings/js/WebCoreBuiltinNames.h:
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::webRTCLegacyAPIEnabled):
(WebCore::RuntimeEnabledFeatures::setWebRTCLegacyAPIEnabled):

Source/WebKit/mac:

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

Source/WebKit2:

Adding preference to legacy API.

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetWebRTCLegacyAPIEnabled):
(WKPreferencesGetWebRTCLegacyAPIEnabled):
* UIProcess/API/C/WKPreferencesRef.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Tools:

* DumpRenderTree/mac/DumpRenderTree.mm:
(enableExperimentalFeatures):
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::beginTesting):
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setWebRTCLegacyAPIEnabled):
* WebKitTestRunner/InjectedBundle/TestRunner.h:

LayoutTests:

* webrtc/legacy-api-expected.txt: Added.
* webrtc/legacy-api.html: Added.

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

3 years agoArray concat operation should check for length overflows.
mark.lam@apple.com [Thu, 16 Mar 2017 23:51:19 +0000 (23:51 +0000)]
Array concat operation should check for length overflows.
https://bugs.webkit.org/show_bug.cgi?id=169796
<rdar://problem/31095276>

Reviewed by Keith Miller.

* runtime/ArrayPrototype.cpp:
(JSC::concatAppendOne):
(JSC::arrayProtoPrivateFuncConcatMemcpy):

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

3 years agoUpdate the WKHTTPCookieStore API to be simpler and add observers.
beidson@apple.com [Thu, 16 Mar 2017 23:30:09 +0000 (23:30 +0000)]
Update the WKHTTPCookieStore API to be simpler and add observers.
<rdar://problem/31096000> and https://bugs.webkit.org/show_bug.cgi?id=169776

Reviewed by Alex Christensen.
Source/WebKit2:

When reviewing the API internally we realized the NSHTTPCookieStorage model doesn't
necessarily fit perfectly, and that to handle partitioned cookies going forward we
need to be much simpler right now.

We also realized that we should implement the "cookie store changed" observer for
any clients that might be providing a cookie viewing API.

* UIProcess/API/APIHTTPCookieStore.cpp:
(API::HTTPCookieStore::~HTTPCookieStore):
(API::HTTPCookieStore::deleteCookie):
(API::APIWebCookieManagerProxyObserver::APIWebCookieManagerProxyObserver):
(API::HTTPCookieStore::registerObserver):
(API::HTTPCookieStore::unregisterObserver):
(API::HTTPCookieStore::cookiesDidChange):
(API::HTTPCookieStore::cookieManagerDestroyed):
(API::HTTPCookieStore::registerForNewProcessPoolNotifications):
(API::HTTPCookieStore::unregisterForNewProcessPoolNotifications):
(API::HTTPCookieStore::setCookies): Deleted.
(API::HTTPCookieStore::removeCookiesSinceDate): Deleted.
(API::HTTPCookieStore::setHTTPCookieAcceptPolicy): Deleted.
(API::HTTPCookieStore::getHTTPCookieAcceptPolicy): Deleted.
* UIProcess/API/APIHTTPCookieStore.h:

* UIProcess/API/Cocoa/WKHTTPCookieStore.h:
* UIProcess/API/Cocoa/WKHTTPCookieStore.mm:
(WKHTTPCookieStoreObserver::WKHTTPCookieStoreObserver):
(-[WKHTTPCookieStore dealloc]):
(-[WKHTTPCookieStore allCookies:]):
(-[WKHTTPCookieStore addObserver:]):
(-[WKHTTPCookieStore removeObserver:]):
(-[WKHTTPCookieStore fetchCookies:]): Deleted.
(-[WKHTTPCookieStore fetchCookiesForURL:completionHandler:]): Deleted.
(-[WKHTTPCookieStore setCookies:forURL:mainDocumentURL:completionHandler:]): Deleted.
(-[WKHTTPCookieStore removeCookiesSinceDate:completionHandler:]): Deleted.
(-[WKHTTPCookieStore setCookieAcceptPolicy:completionHandler:]): Deleted.
(kitCookiePolicyToNSCookiePolicy): Deleted.
(-[WKHTTPCookieStore fetchCookieAcceptPolicy:]): Deleted.

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

* UIProcess/WebCookieManagerProxy.cpp:
(WebKit::WebCookieManagerProxy::~WebCookieManagerProxy):
(WebKit::WebCookieManagerProxy::processPoolDestroyed):
(WebKit::WebCookieManagerProxy::registerObserver):
(WebKit::WebCookieManagerProxy::unregisterObserver):
(WebKit::WebCookieManagerProxy::cookiesDidChange):
(WebKit::WebCookieManagerProxy::setCookieObserverCallback): Deleted.
* UIProcess/WebCookieManagerProxy.h:
(WebKit::WebCookieManagerProxy::Observer::~Observer):

Add the ability for interested clients to listen for the creation of new WebProcessPools,
which is needed by APIHTTPCookieStore:
* UIProcess/WebProcessPool.cpp:
(WebKit::generateListenerIdentifier):
(WebKit::processPoolCreationListenerFunctionMap):
(WebKit::WebProcessPool::registerProcessPoolCreationListener):
(WebKit::WebProcessPool::unregisterProcessPoolCreationListener):
(WebKit::WebProcessPool::create):
* UIProcess/WebProcessPool.h:

* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::processPoolForCookieStorageNotifications):
(WebKit::WebsiteDataStore::isAssociatedProcessPool):
(WebKit::WebsiteDataStore::processPools):
* UIProcess/WebsiteData/WebsiteDataStore.h:

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/WKHTTPCookieStore.mm: Renamed from Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKHTTPCookieStorage.mm.
(-[CookieObserver cookiesDidChangeInCookieStore:]):
(TEST): Also test delete and observers.

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

3 years agoWeb Inspector: add "Save Selected" context menu item to Console
webkit@devinrousso.com [Thu, 16 Mar 2017 23:19:39 +0000 (23:19 +0000)]
Web Inspector: add "Save Selected" context menu item to Console
https://bugs.webkit.org/show_bug.cgi?id=151837

Reviewed by Joseph Pecoraro.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Base/Main.js:
(WebInspector.saveDataToFile):
Allow data to be saved without a provided URL.  It will default to localized "Untitled".

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

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

3 years agoWeb Inspector: RTL: selected frame indicator is not positioned correctly
webkit@devinrousso.com [Thu, 16 Mar 2017 23:11:53 +0000 (23:11 +0000)]
Web Inspector: RTL: selected frame indicator is not positioned correctly
https://bugs.webkit.org/show_bug.cgi?id=169763

Reviewed by Matt Baker.

* UserInterface/Views/RenderingFrameTimelineOverviewGraph.js:
(WebInspector.RenderingFrameTimelineOverviewGraph.prototype._updateFrameMarker):
(WebInspector.RenderingFrameTimelineOverviewGraph.prototype._mouseClicked):
Treat the current mouse position (event.pageX) as a negative value when in RTL, meaning that
the delta movement from the starting position is flipped.

* UserInterface/Views/TimelineRuler.css:
(body[dir=ltr] .timeline-ruler > .header > .divider,):
(body[dir=rtl] .timeline-ruler > .header > .divider,):
(.timeline-ruler > .header > .divider):
(.timeline-ruler > .header > .divider > .label):
(body[dir=ltr] .timeline-ruler > .header > .divider > .label):
(body[dir=rtl] .timeline-ruler > .header > .divider > .label):
(.timeline-ruler > .markers > .divider):
(.timeline-ruler > .markers > .marker):
(body[dir=ltr] .timeline-ruler > .markers > .marker):
(body[dir=rtl] .timeline-ruler > .markers > .marker):
(.timeline-ruler > .markers > .marker::before):
(body[dir=ltr] .timeline-ruler > .markers > .marker::before):
(body[dir=rtl] .timeline-ruler > .markers > .marker::before):
(body[dir=ltr] .timeline-ruler > .markers > .marker.current-time):
(body[dir=rtl] .timeline-ruler > .markers > .marker.current-time):
(.timeline-ruler > .markers > .marker.current-time::before):
(.timeline-ruler > .markers > .marker.current-time): Deleted.

(.timeline-ruler > .selection-handle):
(body[dir=ltr] .timeline-ruler > .selection-handle.left):
(body[dir=rtl] .timeline-ruler > .selection-handle.left):
(body[dir=ltr] .timeline-ruler > .selection-handle.right):
(body[dir=rtl] .timeline-ruler > .selection-handle.right):
Drive-by: add CSS variable for clarity.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214076 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoRebase webrtc tests
commit-queue@webkit.org [Thu, 16 Mar 2017 22:53:51 +0000 (22:53 +0000)]
Rebase webrtc tests
https://bugs.webkit.org/show_bug.cgi?id=169791

Unreviewed.

Patch by Youenn Fablet <youenn@apple.com> on 2017-03-16

* TestExpectations:
* fast/mediastream/MediaStream-add-remove-tracks-expected.txt:
* fast/mediastream/MediaStreamTrack-expected.txt:
* fast/mediastream/MediaStreamTrack-onended-expected.txt:
* fast/mediastream/RTCPeerConnection-addIceCandidate-expected.txt:
* fast/mediastream/RTCPeerConnection-events-expected.txt:
* fast/mediastream/RTCPeerConnection-media-setup-single-dialog-expected.txt:
* fast/mediastream/RTCPeerConnection-media-setup-two-dialogs-expected.txt:
* fast/mediastream/RTCPeerConnection-remotely-assigned-transceiver-mid-expected.txt:
* fast/mediastream/RTCPeerConnection-setLocalDescription-offer-expected.txt:
* fast/mediastream/RTCPeerConnection-setRemoteDescription-offer-expected.txt:
* fast/mediastream/RTCPeerConnection-statsSelector-expected.txt:
* platform/mac/TestExpectations:

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

3 years ago[WebCrypto] Support SPKI/PKCS8 for Elliptic Curve
jiewen_tan@apple.com [Thu, 16 Mar 2017 22:32:20 +0000 (22:32 +0000)]
[WebCrypto] Support SPKI/PKCS8 for Elliptic Curve
https://bugs.webkit.org/show_bug.cgi?id=169318
<rdar://problem/31081956>

Reviewed by Brent Fulgham.

LayoutTests/imported/w3c:

* web-platform-tests/WebCryptoAPI/import_export/ec_importKey.worker-expected.txt:
* web-platform-tests/WebCryptoAPI/import_export/test_ec_importKey-expected.txt:

Source/WebCore:

This patch adds SPKI/PKCS8 support for Elliptic Curve cryptos. We can now import/export
SPKI/PKCS8 Elliptic Curve keys after this change. Few things to note: 1) This patch
implements a loose DER encoder/decoder for hacking the underlying CommonCrypto library.
2) It only permits id-ecPublicKey as the AlgorithmIdentifier following OpenSSL/Chrome(BoringSSL).
3) It follows OpenSSL/Chrome(BoringSSL) to replace ECParameters in ECPrivateKey with custom
tags. Hence, we should fully comply with OpenSSL/Chrome(BoringSSL).

Tests: crypto/subtle/ec-import-jwk-key-export-pkcs8-key.html
       crypto/subtle/ec-import-jwk-key-export-spki-key.html
       crypto/subtle/ec-import-pkcs8-key-export-jwk-key.html
       crypto/subtle/ec-import-pkcs8-key-export-pkcs8-key-p256.html
       crypto/subtle/ec-import-pkcs8-key-export-pkcs8-key-p384.html
       crypto/subtle/ec-import-raw-key-export-spki-key.html
       crypto/subtle/ec-import-spki-key-export-jwk-key.html
       crypto/subtle/ec-import-spki-key-export-raw-key.html
       crypto/subtle/ec-import-spki-key-export-spki-key-p256.html
       crypto/subtle/ec-import-spki-key-export-spki-key-p384.html
       crypto/subtle/ecdh-generate-export-key-spki-p256.html
       crypto/subtle/ecdh-generate-export-key-spki-p384.html
       crypto/subtle/ecdh-generate-export-pkcs8-p256.html
       crypto/subtle/ecdh-generate-export-pkcs8-p384.html
       crypto/subtle/ecdh-import-pkcs8-key-p256.html
       crypto/subtle/ecdh-import-pkcs8-key-p384.html
       crypto/subtle/ecdh-import-spki-key-p256.html
       crypto/subtle/ecdh-import-spki-key-p384.html
       crypto/workers/subtle/ec-generate-export-pkcs8-key.html
       crypto/workers/subtle/ec-generate-export-spki-key.html
       crypto/workers/subtle/ec-import-pkcs8-key.html
       crypto/workers/subtle/ec-import-spki-key.html

* WebCore.xcodeproj/project.pbxproj:
* crypto/algorithms/CryptoAlgorithmECDH.cpp:
(WebCore::CryptoAlgorithmECDH::importKey):
(WebCore::CryptoAlgorithmECDH::exportKey):
* crypto/gnutls/CryptoKeyECGnuTLS.cpp:
(WebCore::CryptoKeyEC::platformExportRaw):
(WebCore::CryptoKeyEC::platformImportSpki):
(WebCore::CryptoKeyEC::platformExportSpki):
(WebCore::CryptoKeyEC::platformImportPkcs8):
(WebCore::CryptoKeyEC::platformExportPkcs8):
(WebCore::CryptoKeyEC::exportRaw): Deleted.
* crypto/keys/CryptoKeyEC.cpp:
(WebCore::CryptoKeyEC::importSpki):
(WebCore::CryptoKeyEC::importPkcs8):
(WebCore::CryptoKeyEC::exportRaw):
(WebCore::CryptoKeyEC::exportSpki):
(WebCore::CryptoKeyEC::exportPkcs8):
* crypto/keys/CryptoKeyEC.h:
* crypto/mac/CommonCryptoDERUtilities.h: Added.
(WebCore::bytesUsedToEncodedLength):
(WebCore::extraBytesNeededForEncodedLength):
(WebCore::addEncodedASN1Length):
(WebCore::bytesNeededForEncodedLength):
* crypto/mac/CryptoKeyECMac.cpp:
(WebCore::compareBytes):
(WebCore::CryptoKeyEC::platformExportRaw):
(WebCore::CryptoKeyEC::platformImportJWKPrivate):
(WebCore::getOID):
(WebCore::CryptoKeyEC::platformImportSpki):
(WebCore::CryptoKeyEC::platformExportSpki):
(WebCore::CryptoKeyEC::platformImportPkcs8):
(WebCore::CryptoKeyEC::platformExportPkcs8):
(WebCore::CryptoKeyEC::exportRaw): Deleted.
Enlarge the robust of exportRaw.
* crypto/mac/CryptoKeyRSAMac.cpp:
(WebCore::CryptoKeyRSA::exportSpki):
(WebCore::CryptoKeyRSA::exportPkcs8):
Enhance the implementation.
(WebCore::bytesUsedToEncodedLength): Deleted.
(WebCore::bytesNeededForEncodedLength): Deleted.
(WebCore::addEncodedASN1Length): Deleted.
Moved to CommonCryptoDERUtilities.h.

LayoutTests:

* crypto/subtle/ec-export-key-malformed-parameters-expected.txt:
* crypto/subtle/ec-export-key-malformed-parameters.html:
* crypto/subtle/ec-import-jwk-key-export-jwk-key-private-expected.txt:
* crypto/subtle/ec-import-jwk-key-export-jwk-key-private.html:
* crypto/subtle/ec-import-jwk-key-export-pkcs8-key-expected.txt: Added.
* crypto/subtle/ec-import-jwk-key-export-pkcs8-key.html: Added.
* crypto/subtle/ec-import-jwk-key-export-spki-key-expected.txt: Added.
* crypto/subtle/ec-import-jwk-key-export-spki-key.html: Added.
* crypto/subtle/ec-import-key-malformed-parameters-expected.txt:
* crypto/subtle/ec-import-key-malformed-parameters.html:
* crypto/subtle/ec-import-pkcs8-key-export-jwk-key-expected.txt: Added.
* crypto/subtle/ec-import-pkcs8-key-export-jwk-key.html: Added.
* crypto/subtle/ec-import-pkcs8-key-export-pkcs8-key-p256-expected.txt: Added.
* crypto/subtle/ec-import-pkcs8-key-export-pkcs8-key-p256.html: Added.
* crypto/subtle/ec-import-pkcs8-key-export-pkcs8-key-p384-expected.txt: Added.
* crypto/subtle/ec-import-pkcs8-key-export-pkcs8-key-p384.html: Added.
* crypto/subtle/ec-import-raw-key-export-spki-key-expected.txt: Added.
* crypto/subtle/ec-import-raw-key-export-spki-key.html: Added.
* crypto/subtle/ec-import-spki-key-export-jwk-key-expected.txt: Added.
* crypto/subtle/ec-import-spki-key-export-jwk-key.html: Added.
* crypto/subtle/ec-import-spki-key-export-raw-key-expected.txt: Added.
* crypto/subtle/ec-import-spki-key-export-raw-key.html: Added.
* crypto/subtle/ec-import-spki-key-export-spki-key-p256-expected.txt: Added.
* crypto/subtle/ec-import-spki-key-export-spki-key-p256.html: Added.
* crypto/subtle/ec-import-spki-key-export-spki-key-p384-expected.txt: Added.
* crypto/subtle/ec-import-spki-key-export-spki-key-p384.html: Added.
* crypto/subtle/ecdh-generate-export-key-spki-p256-expected.txt: Added.
* crypto/subtle/ecdh-generate-export-key-spki-p256.html: Added.
* crypto/subtle/ecdh-generate-export-key-spki-p384-expected.txt: Added.
* crypto/subtle/ecdh-generate-export-key-spki-p384.html: Added.
* crypto/subtle/ecdh-generate-export-pkcs8-p256-expected.txt: Added.
* crypto/subtle/ecdh-generate-export-pkcs8-p256.html: Added.
* crypto/subtle/ecdh-generate-export-pkcs8-p384-expected.txt: Added.
* crypto/subtle/ecdh-generate-export-pkcs8-p384.html: Added.
* crypto/subtle/ecdh-import-pkcs8-key-p256-expected.txt: Added.
* crypto/subtle/ecdh-import-pkcs8-key-p256.html: Added.
* crypto/subtle/ecdh-import-pkcs8-key-p384-expected.txt: Added.
* crypto/subtle/ecdh-import-pkcs8-key-p384.html: Added.
* crypto/subtle/ecdh-import-spki-key-p256-expected.txt: Added.
* crypto/subtle/ecdh-import-spki-key-p256.html: Added.
* crypto/subtle/ecdh-import-spki-key-p384-expected.txt: Added.
* crypto/subtle/ecdh-import-spki-key-p384.html: Added.
* crypto/workers/subtle/ec-generate-export-pkcs8-key-expected.txt: Added.
* crypto/workers/subtle/ec-generate-export-pkcs8-key.html: Added.
* crypto/workers/subtle/ec-generate-export-spki-key-expected.txt: Added.
* crypto/workers/subtle/ec-generate-export-spki-key.html: Added.
* crypto/workers/subtle/ec-import-pkcs8-key-expected.txt: Added.
* crypto/workers/subtle/ec-import-pkcs8-key.html: Added.
* crypto/workers/subtle/ec-import-spki-key-expected.txt: Added.
* crypto/workers/subtle/ec-import-spki-key.html: Added.
* crypto/workers/subtle/resources/ec-generate-export-pkcs8-key.js: Added.
* crypto/workers/subtle/resources/ec-generate-export-spki-key.js: Added.
* crypto/workers/subtle/resources/ec-import-pkcs8-key.js: Added.
* crypto/workers/subtle/resources/ec-import-spki-key.js: Added.

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

3 years agoDon't use an optional for didReceiveSocketStreamData's length
achristensen@apple.com [Thu, 16 Mar 2017 22:15:58 +0000 (22:15 +0000)]
Don't use an optional for didReceiveSocketStreamData's length
https://bugs.webkit.org/show_bug.cgi?id=169699

Reviewed by Brady Eidson.

Rather than sending a message with an optional length, send a message with a length
and send a different message if the receiving of bytes failed.

No new tests (no behavior change).

* Modules/websockets/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::didReceiveSocketStreamData):
* Modules/websockets/WebSocketChannel.h:
* platform/network/SocketStreamHandleClient.h:
* platform/network/cf/SocketStreamHandleImplCFNet.cpp:
(WebCore::SocketStreamHandleImpl::readStreamCallback):
* platform/network/soup/SocketStreamHandleImplSoup.cpp:
(WebCore::SocketStreamHandleImpl::readBytes):

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