WebKit-https.git
3 years ago[iOS] Purge GraphicsServices font cache on memory warning.
akling@apple.com [Fri, 13 Jan 2017 00:47:37 +0000 (00:47 +0000)]
[iOS] Purge GraphicsServices font cache on memory warning.
<https://webkit.org/b/154343>

Reviewed by Antti Koivisto.

Source/WebCore:

The GS font cache was retaining CSS fonts after we stopped using them.
Call SPI to release them on memory pressure. This is one of multiple
steps necessary to actually free the fonts.

* Configurations/WebCore.xcconfig:
* page/cocoa/MemoryReleaseCocoa.mm:
(WebCore::platformReleaseMemory):
* platform/cocoa/MemoryPressureHandlerCocoa.mm:
* platform/spi/ios/GraphicsServicesSPI.h:

WebKitLibraries:

* WebKitPrivateFrameworkStubs/iOS/10/GraphicsServices.framework/GraphicsServices.tbd: Add SPI.

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

3 years agoDo not allow selection of editable content when not editing.
enrica@apple.com [Fri, 13 Jan 2017 00:36:58 +0000 (00:36 +0000)]
Do not allow selection of editable content when not editing.
https://bugs.webkit.org/show_bug.cgi?id=166897
<rdar://problem/29388806>

Reviewed by Tim Horton.

Source/WebKit2:

Test: fast/events/touch/ios/long-press-on-editable.html

When retrieving the position information, we should not consider
as candidates for selection editable elements, since this is only
used for non editable selections.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::isAssistableElement): Moved within the file.
(WebKit::WebPage::getPositionInformation):

LayoutTests:

* fast/events/touch/ios/long-press-on-editable-expected.txt: Added.
* fast/events/touch/ios/long-press-on-editable.html: Added.

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

3 years agoUnreviewed EFL/GTK build fix after r210684.
cdumez@apple.com [Fri, 13 Jan 2017 00:11:56 +0000 (00:11 +0000)]
Unreviewed EFL/GTK build fix after r210684.

* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::performPrefetchCursor):

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

3 years agoREGRESSION (r209977): Crash in UniqueIDBDatabase::executeNextDatabaseTask.
beidson@apple.com [Thu, 12 Jan 2017 23:48:38 +0000 (23:48 +0000)]
REGRESSION (r209977): Crash in UniqueIDBDatabase::executeNextDatabaseTask.
https://bugs.webkit.org/show_bug.cgi?id=166984

Reviewed by Alex Christensen.

No new tests (Unable to reproduce, speculative fix).

* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::performIterateCursor): If we're not already prefetching for this cursor,
  starting doing so after holding a protector ref.
(WebCore::IDBServer::UniqueIDBDatabase::performPrefetchCursor): If we're now done prefetching for this cursor,
  schedule the protector ref to be destroyed on the main thread.
* Modules/indexeddb/server/UniqueIDBDatabase.h:

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

3 years agoDouble Check URLs on UI side before putting in pasteboard
megan_gardner@apple.com [Thu, 12 Jan 2017 23:45:24 +0000 (23:45 +0000)]
Double Check URLs on UI side before putting in pasteboard
https://bugs.webkit.org/show_bug.cgi?id=166945
<rdar://problem/11187315>

Reviewed by Tim Horton.

Check URLs sent from the web process before putting the on pasteboard.

* UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
(WebKit::WebPasteboardProxy::setPasteboardPathnamesForType):
Add a check to make sure the URLs we've received are valid and not compromising to the user's system.

* UIProcess/WebPasteboardProxy.cpp:
(WebKit::WebPasteboardProxy::addWebProcessProxy):
Keep track of the webProcesses associated with the pasteboard proxies specifically, so that we can
use it to check the URLs before putting them on pasteboard.
(WebKit::WebPasteboardProxy::removeWebProcessProxy):
Remove dead webProcesses.

* UIProcess/WebPasteboardProxy.h:
* UIProcess/WebPasteboardProxy.messages.in:
Allow for the connection to be passed in, so that we can determine which webProcess we need to
check the URLs of.

* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::~WebProcessProxy):
Make sure to remove WebProcessProxys from the list stored in WebPasteboardProxy

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

3 years agoMake ApplicationCacheHost::maybeLoadSynchronously more robust
commit-queue@webkit.org [Thu, 12 Jan 2017 23:12:13 +0000 (23:12 +0000)]
Make ApplicationCacheHost::maybeLoadSynchronously more robust
https://bugs.webkit.org/show_bug.cgi?id=165192

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

No change of behavior.
Currently, in case out parameter "data" is not null and shouldLoadResourceFromApplicationCache returns false and resource is null, we might dereference a null pointer when calling maybeLoadSynchronously.
We refactor the code to ensure that this case cannot happen anymore.

* loader/appcache/ApplicationCacheHost.cpp:
(WebCore::bufferFromResource):
(WebCore::ApplicationCacheHost::maybeLoadSynchronously):

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

3 years agoUpdate style of ResourceHandleInternal
commit-queue@webkit.org [Thu, 12 Jan 2017 22:49:51 +0000 (22:49 +0000)]
Update style of ResourceHandleInternal
https://bugs.webkit.org/show_bug.cgi?id=166952

Patch by Alex Christensen <achristensen@webkit.org> on 2017-01-12
Reviewed by Andreas Kling.

No change in behavior.  Just un-indent and use initializer lists.

* platform/network/ResourceHandleInternal.h:
(WebCore::ResourceHandleInternal::ResourceHandleInternal):
(WebCore::ResourceHandleInternal::client):

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

3 years agoUse GenericEventQueue rather than callOnMainThread to schedule events in AudioSchedul...
jer.noble@apple.com [Thu, 12 Jan 2017 22:14:44 +0000 (22:14 +0000)]
Use GenericEventQueue rather than callOnMainThread to schedule events in AudioScheduledSourceNode.
https://bugs.webkit.org/show_bug.cgi?id=166983

Reviewed by Brent Fulgham.

* Modules/webaudio/AudioScheduledSourceNode.cpp:
(WebCore::AudioScheduledSourceNode::AudioScheduledSourceNode):
(WebCore::AudioScheduledSourceNode::finish):
* Modules/webaudio/AudioScheduledSourceNode.h:

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

3 years agoOneDrive application crashes upon launch
commit-queue@webkit.org [Thu, 12 Jan 2017 21:26:48 +0000 (21:26 +0000)]
OneDrive application crashes upon launch
https://bugs.webkit.org/show_bug.cgi?id=166975

Patch by Youenn Fablet <youenn@apple.com> on 2017-01-12
Reviewed by Brady Eidson.

Checking whether load is terminated just after calling ResourceLoader::willSendRequestInternal.
The reason is that delegate call may actually cancel the load at that point.

* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::willSendRequestInternal):

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

3 years agoMarking fast/mediastream/MediaStream-video-element-video-tracks-disabled-then-enabled...
ryanhaddad@apple.com [Thu, 12 Jan 2017 21:05:28 +0000 (21:05 +0000)]
Marking fast/mediastream/MediaStream-video-element-video-tracks-disabled-then-enabled.html as a timeout on mac-wk2.
https://bugs.webkit.org/show_bug.cgi?id=166980

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations:

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

3 years agoProtect MediaPlayer from being destroyed mid-load()
jer.noble@apple.com [Thu, 12 Jan 2017 20:57:32 +0000 (20:57 +0000)]
Protect MediaPlayer from being destroyed mid-load()
https://bugs.webkit.org/show_bug.cgi?id=166976

Reviewed by Eric Carlson.

It's possible for a message sent by MediaPlayer to HTMLMediaElement to cause
MediaPlayer to be destroyed before MediaPlayer::load() completes. We have
previously protected against this same problem in HTMLMediaElement::loadResource()
by ref'ing at the beginning of the function and deref'ing on exit. To do the
same in MediaPlayer, it must become RefCounted.

To keep the same semantics about m_client in MediaPlayer (always available without
requiring a null-check), make a new static MediaPlayerClient object which can
replace the real (HTMLMediaElement) client when the MediaPlayer is invalidated.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::~HTMLMediaElement):
(WebCore::HTMLMediaElement::clearMediaPlayer):
(WebCore::HTMLMediaElement::createMediaPlayer):
* html/HTMLMediaElement.h:
* platform/graphics/MediaPlayer.cpp:
(WebCore::nullMediaPlayerClient):
(WebCore::MediaPlayer::create):
(WebCore::MediaPlayer::MediaPlayer):
(WebCore::MediaPlayer::invalidate):
(WebCore::MediaPlayer::load):
(WebCore::MediaPlayer::loadWithNextMediaEngine):
(WebCore::MediaPlayer::inMediaDocument):
(WebCore::MediaPlayer::fullscreenMode):
(WebCore::MediaPlayer::requestedRate):
(WebCore::MediaPlayer::currentPlaybackTargetIsWirelessChanged):
(WebCore::MediaPlayer::networkStateChanged):
(WebCore::MediaPlayer::readyStateChanged):
(WebCore::MediaPlayer::volumeChanged):
(WebCore::MediaPlayer::muteChanged):
(WebCore::MediaPlayer::timeChanged):
(WebCore::MediaPlayer::sizeChanged):
(WebCore::MediaPlayer::repaint):
(WebCore::MediaPlayer::durationChanged):
(WebCore::MediaPlayer::rateChanged):
(WebCore::MediaPlayer::playbackStateChanged):
(WebCore::MediaPlayer::firstVideoFrameAvailable):
(WebCore::MediaPlayer::characteristicChanged):
(WebCore::MediaPlayer::cachedKeyForKeyId):
(WebCore::MediaPlayer::keyNeeded):
(WebCore::MediaPlayer::mediaKeysStorageDirectory):
(WebCore::MediaPlayer::referrer):
(WebCore::MediaPlayer::userAgent):
(WebCore::MediaPlayer::graphicsDeviceAdapter):
(WebCore::MediaPlayer::cachedResourceLoader):
(WebCore::MediaPlayer::createResourceLoader):
(WebCore::MediaPlayer::addAudioTrack):
(WebCore::MediaPlayer::removeAudioTrack):
(WebCore::MediaPlayer::addTextTrack):
(WebCore::MediaPlayer::removeTextTrack):
(WebCore::MediaPlayer::addVideoTrack):
(WebCore::MediaPlayer::removeVideoTrack):
(WebCore::MediaPlayer::outOfBandTrackSources):
(WebCore::MediaPlayer::shouldWaitForResponseToAuthenticationChallenge):
(WebCore::MediaPlayer::handlePlaybackCommand):
(WebCore::MediaPlayer::sourceApplicationIdentifier):
(WebCore::MediaPlayer::preferredAudioCharacteristics):
(WebCore::MediaPlayer::doesHaveAttribute):
(WebCore::MediaPlayer::mediaPlayerNetworkInterfaceName):
(WebCore::MediaPlayer::getRawCookies):
(WebCore::MediaPlayer::shouldDisableSleep):
* platform/graphics/MediaPlayer.h:
(WebCore::MediaPlayer::platformVolumeConfigurationRequired):
(WebCore::MediaPlayer::client):

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

3 years agoAdd the ability to filter the set of bindings tests you want to run
weinig@apple.com [Thu, 12 Jan 2017 20:39:40 +0000 (20:39 +0000)]
Add the ability to filter the set of bindings tests you want to run
https://bugs.webkit.org/show_bug.cgi?id=166977

Reviewed by Tim Horton.

Allows doing things like:
    run-bindings-tests TestObj* TestCEReactions*

to run only those tests that match the patterns.

* Scripts/run-bindings-tests:
(main):
Switch to using optparse and pass the remaining args as the filters.

* Scripts/webkitpy/bindings/main.py:
(BindingsTests.__init__):
Store the pattens.

(BindingsTests.test_matches_patterns):
Add helper predicate to determine if a test should be run. When no
patterns are present, all tests should run.

(BindingsTests.run_tests):
Filter tests using the passed in patterns.

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

3 years agoUpdate bindings test results.
weinig@apple.com [Thu, 12 Jan 2017 20:38:31 +0000 (20:38 +0000)]
Update bindings test results.

* bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
(WebCore::JSTestCustomNamedGetter::getOwnPropertySlot):
(WebCore::JSTestCustomNamedGetter::getOwnPropertySlotByIndex):
* bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
(WebCore::JSTestEventTarget::getOwnPropertySlot):
(WebCore::JSTestEventTarget::getOwnPropertySlotByIndex):
(WebCore::JSTestEventTarget::getOwnPropertyNames):
* bindings/scripts/test/JS/JSTestEventTarget.h:
* bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::JSTestInterface::put):
(WebCore::JSTestInterface::putByIndex):
* bindings/scripts/test/JS/JSTestInterface.h:
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSTestObj::getOwnPropertySlot):
(WebCore::JSTestObj::getOwnPropertySlotByIndex):
(WebCore::JSTestObj::getOwnPropertyNames):
* bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
(WebCore::JSTestOverrideBuiltins::getOwnPropertySlot):
(WebCore::JSTestOverrideBuiltins::getOwnPropertySlotByIndex):
(WebCore::JSTestOverrideBuiltins::getOwnPropertyNames):
* bindings/scripts/test/JS/JSTestOverrideBuiltins.h:

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

3 years agoWeb Inspector: cubic-bezier editor behaves poorly for invalid inputs in component...
commit-queue@webkit.org [Thu, 12 Jan 2017 20:21:58 +0000 (20:21 +0000)]
Web Inspector: cubic-bezier editor behaves poorly for invalid inputs in component fields
https://bugs.webkit.org/show_bug.cgi?id=166928

Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2017-01-12
Reviewed by Brian Burg.

* UserInterface/Views/BezierEditor.css:
(.bezier-editor):
(.bezier-editor > .number-input-container > input):

* UserInterface/Views/BezierEditor.js:
(WebInspector.BezierEditor.createBezierInput):
(WebInspector.BezierEditor):
Add type, step, min, and max to the bezier component inputs to better control user input.

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

3 years agoOutliers are not hidden in v3 UI
rniwa@webkit.org [Thu, 12 Jan 2017 19:32:20 +0000 (19:32 +0000)]
Outliers are not hidden in v3 UI
https://bugs.webkit.org/show_bug.cgi?id=166966

Reviewed by Andreas Kling.

Fixed the typo in addToSeries. An outlier has markedOutlier set to true, not isOutlier.

Also fixed a bug unveiled by new tests in MeasurementRootSet.ensureSingleton. It was was creating
a new MeasurementRootSet each time it was called instead of finding an existing instance. Fixed the bug
by merging the static maps of MeasurementRootSet and RootSet.

* public/v3/models/measurement-cluster.js:
(MeasurementCluster.prototype.addToSeries): Fixed the bug.
* public/v3/models/root-set.js:
(MeasurementRootSet.prototype.namedStaticMap): Added.
(MeasurementRootSet.prototype.ensureNamedStaticMap): Added.
(MeasurementRootSet.namedStaticMap): Added.
(MeasurementRootSet.ensureNamedStaticMap): Added.
* unit-tests/measurement-set-tests.js: Added tests for adopting time series data from a cluster.

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

3 years ago[GTK] WebKitWebProcess at 100% CPU loading hyphenation dictionaries
zandobersek@gmail.com [Thu, 12 Jan 2017 18:44:48 +0000 (18:44 +0000)]
[GTK] WebKitWebProcess at 100% CPU loading hyphenation dictionaries
https://bugs.webkit.org/show_bug.cgi?id=165601

Reviewed by Carlos Garcia Campos.

In HyphenationLibHyphen, retrieve the canonicalized absolute pathname of the dictionary file
in order to avoid storing symbolic links as the target files for specific locales. libhyphen
distributes its dictionary files by linking a set of similar locales files to a single file.
Not resolving those symbolic links means we'll be opening a single file via multiple
HyphenationDictionary objects, which is far from optimal.

To add insult to injury, these HyphenationDictionary objects were stored in a TinyLRUCache
with a slim capacity of 4. This meant that while already loading one single file through
multiple symlinks, because of continuous eviciton from this LRU cache the same symlinks
continued to be processed, in some cases resulting in opening the same dictionary file
hundreds or thousands of times. The capacity of this TinyLRUCache is increased to 32
to keep the amount of open libhyphen dictionaries capped at some reasonable number.

* platform/text/hyphen/HyphenationLibHyphen.cpp:
(WebCore::scanDirectoryForDicionaries):

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

3 years ago[css-grid] Make the grid sizing data persistent through layouts
jfernandez@igalia.com [Thu, 12 Jan 2017 18:41:28 +0000 (18:41 +0000)]
[css-grid] Make the grid sizing data persistent through layouts
https://bugs.webkit.org/show_bug.cgi?id=166883

Reviewed by Darin Adler and Manuel Rego Casasnovas.

Source/WebCore:

We want to keep the grid sizing data structures through different
layouts. This will allow to optimize some operations, reusing
these data while still valid. Additionally, operations like
determining the baseline position when the grid container is under
an inline formatting context need these data once the grid has
been laid out.

This patch controls the sizing data validity and make the data
structures persistent after layout.

Tests: fast/css-grid-layout/grid-add-item-with-positioned-items.html
       fast/css-grid-layout/grid-add-positioned-block-item-after-inline-item.html
       fast/css-grid-layout/grid-container-change-explicit-grid-recompute-child.html
       fast/css-grid-layout/grid-item-change-order-auto-flow.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::styleDidChange): Evaluate if the style change made the grid data invalid.
(WebCore::RenderBox::updateGridPositionAfterStyleChange): Evaluate if the style change made the grid data invalid.
* rendering/RenderBox.h:
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::Grid::setNeedsItemsPlacement): The grid must execute the items placement logic before continue processing the layout.
(WebCore::RenderGrid::addChild): Mark the grid data as dirty.
(WebCore::RenderGrid::removeChild): Mark the grid data as dirty.
(WebCore::RenderGrid::styleDidChange): Evaluate grid data validity.
(WebCore::RenderGrid::explicitGridDidResize): Mark the grid data as dirty.
(WebCore::RenderGrid::namedGridLinesDefinitionDidChange): Mark the grid data as dirty.
(WebCore::RenderGrid::layoutBlock): We don't need to clear the grid data anymore.
(WebCore::RenderGrid::dirtyGrid): Clearing the grid data and mark is as needing to execute the items placement logic.
(WebCore::RenderGrid::trackSizesForComputedStyle): Assert we don't need to perform the items placement logic.
(WebCore::RenderGrid::paintChildren): Assert we don't need to perform the items placement logic.
* rendering/RenderGrid.h:
(WebCore::RenderGrid::clear): Deleted.

LayoutTests:

The tests added are now needed to verify we perform correctly the
data validation after certain style changes.

* fast/css-grid-layout/grid-add-item-with-positioned-items-expected.txt: Added.
* fast/css-grid-layout/grid-add-item-with-positioned-items.html: Added.
* fast/css-grid-layout/grid-add-positioned-block-item-after-inline-item-expected.txt: Added.
* fast/css-grid-layout/grid-add-positioned-block-item-after-inline-item.html: Added.
* fast/css-grid-layout/grid-container-change-explicit-grid-recompute-child-expected.txt: Added.
* fast/css-grid-layout/grid-container-change-explicit-grid-recompute-child.html: Added.
* fast/css-grid-layout/grid-item-change-order-auto-flow-expected.txt: Added.
* fast/css-grid-layout/grid-item-change-order-auto-flow.html: Added.

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

3 years ago[iOS] Implement support for KeyboardEvent.code
cdumez@apple.com [Thu, 12 Jan 2017 18:34:20 +0000 (18:34 +0000)]
[iOS] Implement support for KeyboardEvent.code
https://bugs.webkit.org/show_bug.cgi?id=166932
<rdar://problem/29972518>

Reviewed by Darin Adler.

Source/WebCore:

Implement support for KeyboardEvent.code on iOS.

No new tests, updated existing test.

* platform/ios/PlatformEventFactoryIOS.h:
* platform/ios/PlatformEventFactoryIOS.mm:
(WebCore::codeForKeyEvent):
(WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):

Source/WebKit2:

Make sure KeyboardEvent.code is properly initialized on
iOS WK2.

* Shared/WebEvent.h:
* Shared/WebKeyboardEvent.cpp:
(WebKit::WebKeyboardEvent::WebKeyboardEvent):
* Shared/ios/WebIOSEventFactory.mm:
(WebIOSEventFactory::createWebKeyboardEvent):

Source/WTF:

Enable KEYBOARD_CODE_ATTRIBUTE feature on iOS.

* wtf/FeatureDefines.h:

LayoutTests:

Extend layout test coverage and rebaseline a couple of existing tests
now that more checks are passing.

* fast/events/ios/keyboard-event-key-attribute-expected.txt:
* fast/events/ios/keyboard-event-key-attribute.html:
* platform/ios-simulator/fast/events/constructors/keyboard-event-constructor-expected.txt:
* platform/ios-simulator/imported/w3c/web-platform-tests/dom/events/Event-subclasses-constructors-expected.txt:

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

3 years ago[WebIDL] Autogenerate named getters
commit-queue@webkit.org [Thu, 12 Jan 2017 18:30:53 +0000 (18:30 +0000)]
[WebIDL] Autogenerate named getters
https://bugs.webkit.org/show_bug.cgi?id=166835

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

Source/WebCore:

* Modules/mediastream/RTCStatsResponse.idl:
Update type to be nullable, since generator expects that for now.

* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSCustomSQLStatementErrorCallback.cpp: Removed.
* bindings/js/JSDOMMimeTypeArrayCustom.cpp: Removed.
* bindings/js/JSDOMNamedFlowCollectionCustom.cpp: Removed.
* bindings/js/JSDOMPluginArrayCustom.cpp: Removed.
* bindings/js/JSDOMPluginCustom.cpp: Removed.
* bindings/js/JSNamedNodeMapCustom.cpp: Removed.
* bindings/js/JSRTCStatsResponseCustom.cpp: Removed.
* bindings/js/JSStyleSheetListCustom.cpp: Removed.
Remove deleted files.

* bindings/js/JSSQLStatementErrorCallbackCustom.cpp:
Renamed from Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp for consistency.

* bindings/IDLTypes.h:
(WebCore::IDLNullable::nullValue):
(WebCore::IDLNullable::isNullValue):
(WebCore::IDLNullable::extractValueFromNullable):
Add Nullable traits for IDLNullable, that call down to the underlying type. This allows
us to more easily tests for nullability without stripping the IDLNullable off.

* bindings/js/JSDOMStringMapCustom.cpp:
(WebCore::JSDOMStringMap::getOwnPropertySlotDelegate): Deleted.
(WebCore::JSDOMStringMap::getOwnPropertyNames): Deleted.
Remove overriden getOwnPropertySlot and getOwnPropertyNames.

* bindings/js/JSHTMLCollectionCustom.cpp:
(WebCore::JSHTMLCollection::nameGetter): Deleted.
* bindings/js/JSHTMLFormElementCustom.cpp:
(WebCore::JSHTMLFormElement::nameGetter): Deleted.
* bindings/js/JSHTMLOptionsCollectionCustom.cpp:
(WebCore::JSHTMLOptionsCollection::nameGetter): Deleted.
* bindings/js/JSStorageCustom.cpp:
(WebCore::JSStorage::nameGetter): Deleted.
Remove custom name getters.

* bindings/js/JSHTMLSelectElementCustom.cpp:
(WebCore::selectElementIndexSetter):
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::setItem):
(WebCore::HTMLSelectElement::setLength):
(WebCore::HTMLSelectElement::setOption): Deleted.
* html/HTMLSelectElement.h:
Add implementation of HTMLSelectElement::setItem() that does properly
removes if the option is null. Re-implement selectElementIndexSetter to
use it and switch conversion code to use JSDOMConvert.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateIndexedGetter):
(GenerateNamedGetter):
Extract typed getter generation into their own functions.

(GenerateGetOwnPropertySlotBody):
(GenerateGetOwnPropertySlotBodyByIndex):
Extract getOwnPropertySlotBody / getOwnPropertySlotBodyByIndex generation
into their own functions. Add support for generating name getters.

(GenerateGetOwnPropertyNames):
Extract getOwnPropertyNames generation into its own function, adding support
for respecting the LegacyUnenumerableNamedProperties attribute and switching
the default to not include named properties in the enumerated names.

(GeneratePut):
(GeneratePutByIndex):
Extract put / putByIndex generators into their own functions in preparation
of supporting namedSetters in the future.

(GetIndexedSetterFunction):
(GetNamedSetterFunction):
(GetNamedDeleterFunction):
Add helper getter functions to extract named/index setter/deleters.

(InstanceOverridesPut):
Add helper predicate to determine if an interface needs an implementation
of put.

(GenerateHeader):
Place custom helper functions (e.g. nameGetter/putDelegate/etc.) together
in the generated header.

(GenerateImplementation):
(GenerateCallbackImplementationContent):
Replace inline generation with calls to the new helper generator functions.

(NativeToJSValueUsingReferences):
(NativeToJSValueUsingPointers):
(NativeToJSValue):
Remove unused inFunctionCall parameter, and add new suppressExceptionCheck
parameter, which is used for nameGetters.

* bindings/scripts/IDLAttributes.txt:
Add LegacyUnenumerableNamedProperties.

* css/StyleSheetList.cpp:
(WebCore::StyleSheetList::namedItem):
(WebCore::StyleSheetList::getNamedItem): Deleted.
* css/StyleSheetList.h:
* css/StyleSheetList.idl:
Rename getNamedItem to namedItem, and make it return a CSSStyleSheet*
which is what the bindings specify.

* dom/DOMNamedFlowCollection.idl:
Add LegacyUnenumerableNamedProperties to match existing behavior.

* dom/DOMStringMap.h:
Switch from typedef to type alias.

* dom/DOMStringMap.idl:
Remove CustomEnumerateProperty and JSCustomGetOwnPropertySlotAndDescriptor
and add the getter. Also add the missing setter and deleter commented out.

* dom/DatasetDOMStringMap.h:
* dom/DatasetDOMStringMap.cpp:
(WebCore::DatasetDOMStringMap::supportedPropertyNames):
(WebCore::DatasetDOMStringMap::names): Deleted.
Rename names to supportedPropertyNames to support the bindings.

(WebCore::DatasetDOMStringMap::item):
(WebCore::DatasetDOMStringMap::namedItem):
Add namedItems (to support the bindings), and rework item to return
an optional rather than using a bool out parameter.

* dom/NamedNodeMap.idl:
Add LegacyUnenumerableNamedProperties matching the spec.

* html/HTMLAllCollection.idl:
Add CustomNamedGetter and LegacyUnenumerableNamedProperties. Update signatures
to match the spec. Commenting out ones not implemented yet.

* html/HTMLCollection.idl:
Add LegacyUnenumerableNamedProperties matching the spec.

* html/HTMLFormControlsCollection.idl:
Add CustomNamedGetter. Update signature of the getter to match the spec.
The reason this can't be generated yet is that we don't have a good strategy
for functions with differing return types that shadow each other.

* html/HTMLFormElement.h:
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::namedItem):
(WebCore::HTMLFormElement::supportedPropertyNames):
Add implementation of namedItem and stub of supportedPropertyNames.

* html/HTMLFormElement.idl:
Add LegacyUnenumerableNamedProperties and remove CustomNamedGetter. Update
the signatures to match the spec.

* page/DOMWindow.idl:
Add LegacyUnenumerableNamedProperties matching the spec.

* plugins/DOMMimeTypeArray.idl:
* plugins/DOMPlugin.idl:
* plugins/DOMPluginArray.idl:
Add LegacyUnenumerableNamedProperties and add nullability to return types.

LayoutTests:

* fast/dom/HTMLSelectElement/select-selectedIndex-expected.txt:
* fast/dom/HTMLSelectElement/select-selectedIndex-multiple-expected.txt:
* js/dom/reflect-set-onto-dom-expected.txt:
Update exception text.

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

3 years agoWebBackForwardListProxy should remove restored session history items from PageCache...
akling@apple.com [Thu, 12 Jan 2017 17:52:59 +0000 (17:52 +0000)]
WebBackForwardListProxy should remove restored session history items from PageCache on close.
<https://webkit.org/b/166972>
<rdar://problem/28904157>

Reviewed by Brady Eidson.

Register history item ID's from the UIProcess with the associated-items map
so that we can remove any PageCache entries associated with them immediately
when closing a WebPage.

Otherwise they might not get removed until the next PageCache pruning happens.
This patch is a speculative fix for what looks like it might be weirdness
related to a PageCache entry outliving its originating Page.

* WebProcess/WebPage/WebBackForwardListProxy.cpp:
(WebKit::WebBackForwardListProxy::addItemFromUIProcess):
* WebProcess/WebPage/WebBackForwardListProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::restoreSessionInternal):

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

3 years agoRebaseline inspector/dom/getAccessibilityPropertiesForNode.html after r210605.
ryanhaddad@apple.com [Thu, 12 Jan 2017 17:49:32 +0000 (17:49 +0000)]
Rebaseline inspector/dom/getAccessibilityPropertiesForNode.html after r210605.

Unreviewed test gardening.

* inspector/dom/getAccessibilityPropertiesForNode-expected.txt:

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

3 years ago[GTK] Correct license on WebKitSecurityOrigin headers
mcatanzaro@igalia.com [Thu, 12 Jan 2017 17:31:20 +0000 (17:31 +0000)]
[GTK] Correct license on WebKitSecurityOrigin headers

These ought to be LGPLv2+, because the rest of the GTK+ API is LPGLv2+.

* UIProcess/API/gtk/WebKitSecurityOrigin.cpp:
* UIProcess/API/gtk/WebKitSecurityOrigin.h:
* UIProcess/API/gtk/WebKitSecurityOriginPrivate.h:

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

3 years ago[iOS][WK1] Fix initialization of CADisplayLink::preferredFramesPerSecond
commit-queue@webkit.org [Thu, 12 Jan 2017 17:06:50 +0000 (17:06 +0000)]
[iOS][WK1] Fix initialization of CADisplayLink::preferredFramesPerSecond
https://bugs.webkit.org/show_bug.cgi?id=166956

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

Set this option to 60fps instead of leaving set to the default.

* platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
(-[WebDisplayLinkHandler initWithMonitor:]):

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

3 years ago[EFL] Gardening on 13th Jan.
gyuyoung.kim@webkit.org [Thu, 12 Jan 2017 16:07:02 +0000 (16:07 +0000)]
[EFL] Gardening on 13th Jan.

Unreviewed EFL Gardening. Update crash and timeout tests after bumping Ubuntu version.

* platform/efl/TestExpectations:

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

3 years ago[MediaStream, Mac] Render media stream audio buffers
eric.carlson@apple.com [Thu, 12 Jan 2017 13:56:05 +0000 (13:56 +0000)]
[MediaStream, Mac] Render media stream audio buffers
https://bugs.webkit.org/show_bug.cgi?id=159836
<rdar://problem/27380390>

Unreviewed, revert accidental change.

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

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

3 years agoUnreviewed, build fix for macOS ports
utatane.tea@gmail.com [Thu, 12 Jan 2017 11:49:06 +0000 (11:49 +0000)]
Unreviewed, build fix for macOS ports
https://bugs.webkit.org/show_bug.cgi?id=166925

* WebCore.xcodeproj/project.pbxproj:

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

3 years ago[EFL] Second update TestExpectation file for Ubuntu 16.04.
gyuyoung.kim@webkit.org [Thu, 12 Jan 2017 11:26:31 +0000 (11:26 +0000)]
[EFL] Second update TestExpectation file for Ubuntu 16.04.

Unreviewed EFL gardening.

* platform/efl/TestExpectations: Need to update this file for EFL bot again.

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

3 years agoFollowup fix after r210503.
pvollan@apple.com [Thu, 12 Jan 2017 09:22:45 +0000 (09:22 +0000)]
Followup fix after r210503.
https://bugs.webkit.org/show_bug.cgi?id=166887

Reviewed by Alex Christensen.

After <http://trac.webkit.org/changeset/210503>, test results are written to a
duplicated file handle on Windows. This patch fixes the remaining call sites.

* DumpRenderTree/PixelDumpSupport.cpp:
* DumpRenderTree/TestRunner.cpp:
(TestRunner::waitToDumpWatchdogTimerFired):
* DumpRenderTree/TestRunner.h:
* DumpRenderTree/win/AccessibilityControllerWin.cpp:
* DumpRenderTree/win/DumpRenderTree.cpp:
* DumpRenderTree/win/DumpRenderTreeWin.h:
* DumpRenderTree/win/TestRunnerWin.cpp:
(TestRunner::setSpellCheckerLoggingEnabled):

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

3 years agoImplement InlineClassicScript
utatane.tea@gmail.com [Thu, 12 Jan 2017 09:01:40 +0000 (09:01 +0000)]
Implement InlineClassicScript
https://bugs.webkit.org/show_bug.cgi?id=166925

Reviewed by Ryosuke Niwa.

Source/JavaScriptCore:

Add ScriptFetcher field for SourceOrigin.

* runtime/SourceOrigin.h:
(JSC::SourceOrigin::SourceOrigin):
(JSC::SourceOrigin::fetcher):

Source/WebCore:

As of r210585, ScriptFetcher functionality is decoupled from ScriptElement.
This patch is a further cleanup. We introduce InlineClassicScript, which is
similar to LoadableClassicScript / LoadableModuleScript. And we move ScriptFetcher
functionality from LoadableScript to CachedScriptFetcher, which is the base
class of InlineClassicScript and LoadableScript.

And we start setting this CachedScriptFetcher to the member of JSC::SourceOrigin.
This allows us to examine the ScriptFetcher from the SourceOrigin.
When dynamic-import operator is called, we need to get the ScriptFetcher from the
caller script SourceOrigin since the subsequent module loading needs to know the
metadata about fetching and ScriptFetcher delivers it.

No behavior change.

* CMakeLists.txt:
* bindings/js/CachedModuleScript.cpp:
(WebCore::CachedModuleScript::load):
* bindings/js/CachedModuleScript.h:
* bindings/js/CachedModuleScriptLoader.cpp:
(WebCore::CachedModuleScriptLoader::create):
(WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader):
(WebCore::CachedModuleScriptLoader::load):
* bindings/js/CachedModuleScriptLoader.h:
* bindings/js/CachedScriptFetcher.cpp: Copied from Source/WebCore/dom/LoadableScript.cpp.
(WebCore::CachedScriptFetcher::requestScriptWithCache):
* bindings/js/CachedScriptFetcher.h: Copied from Source/JavaScriptCore/runtime/SourceOrigin.h.
(WebCore::CachedScriptFetcher::CachedScriptFetcher):
* bindings/js/CachedScriptSourceProvider.h:
(WebCore::CachedScriptSourceProvider::create):
(WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider):
(WebCore::makeSource): Deleted.
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::loadModuleScriptInWorld):
(WebCore::ScriptController::loadModuleScript):
* bindings/js/ScriptController.h:
* bindings/js/ScriptModuleLoader.cpp:
(WebCore::ScriptModuleLoader::fetch):
(WebCore::ScriptModuleLoader::notifyFinished):
* bindings/js/ScriptSourceCode.h:
(WebCore::ScriptSourceCode::ScriptSourceCode):
(WebCore::ScriptSourceCode::m_url):
* dom/InlineClassicScript.cpp: Added.
(WebCore::InlineClassicScript::create):
* dom/InlineClassicScript.h: Added.
* dom/LoadableClassicScript.cpp:
(WebCore::LoadableClassicScript::execute):
* dom/LoadableScript.cpp:
(WebCore::LoadableScript::requestScriptWithCache): Deleted.
* dom/LoadableScript.h:
(WebCore::LoadableScript::LoadableScript):
(): Deleted.
* dom/ScriptElement.cpp:
(WebCore::ScriptElement::prepareScript):
(WebCore::ScriptElement::requestModuleScript):
(WebCore::ScriptElement::executePendingScript):
* html/parser/HTMLScriptRunner.cpp:
(WebCore::HTMLScriptRunner::runScript):
* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::XMLDocumentParser::endElementNs):

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

3 years agoHide the UI to trigger an A/B testing when there are no triggerables
rniwa@webkit.org [Thu, 12 Jan 2017 07:18:28 +0000 (07:18 +0000)]
Hide the UI to trigger an A/B testing when there are no triggerables
https://bugs.webkit.org/show_bug.cgi?id=166964

Reviewed by Yusuke Suzuki.

Hide the "Start A/B Testing" button on analysis task pages instead of showing it and failing later
when the user tries to create one it with a TriggerableNotFound error.

Added the list of triggerables to the manifest JSON so that we can determine this condition without
having to fetch /api/triggerable for each analysis task as done in v2 UI.

* public/admin/reprocess-report.php:
* public/api/manifest.php:
* public/api/report.php:
* public/include/admin-header.php:
* public/include/manifest-generator.php: Moved from public/include/manifest.php.
(ManifestGenerator::generate):
(ManifestGenerator::triggerables): Added. Include the list of repositories this triggerable accepts
as well as the list of (test, platform) pairs on which this triggerable is available.
Use [testId, platformId] instead of a dictionary to reduce the file size.
* public/v3/components/customizable-test-group-form.js:
(CustomizableTestGroupForm): Removed this._disabled. This variable was used in TestGroupFrom to
disable the "Start A/B Testing" button when no range is selected but this ended up racy. Compute
the visibility of the button in render() function instead.
(CustomizableTestGroupForm.prototype.setRootSetMap):
(CustomizableTestGroupForm.prototype._submitted):
(CustomizableTestGroupForm.prototype.render): Hide the customize link and the button as needed.
The "Start A/B Testing" button must be hidden when either no range is selected or no title is typed.
"Customize" button must be hidden when no range is selected.
* public/v3/components/test-group-form.js:
(TestGroupForm): Removed _disabled since it's no longer used.
(TestGroupForm.prototype.setDisabled): Ditto.
(TestGroupForm.prototype.render): Ditto.
* public/v3/index.html: Include triggerable.js.
* public/v3/models/manifest.js:
(Manifest._didFetchManifest): Modernized. Create Triggerable objects from the manifest JSON.
* public/v3/models/triggerable.js: Added.
(Triggerable): Add this triggerable object to the static map of (test id, platform id) pair.
(Triggerable.prototype.acceptedRepositories): Added.
(Triggerable.findByTestConfiguration): Added. Finds a triggerable in the aforementioned static map.
* public/v3/pages/analysis-task-page.js:
(AnalysisTaskChartPane.prototype._updateStatus): Added. Re-render the page since time series data
points that were previously not available may have become available. The lack of this update was
causing a race condition in which the "Start A/B Testing" button for the charts is disabled even
after a group name had been specified because setRootSetMap was never called with a valid set.
(AnalysisTaskPage): Added this._triggerable.
(AnalysisTaskPage.prototype._didFetchTask): Find the triggerable now that we've fetched the task.
(AnalysisTaskPage.prototype.render): Hide the group view (the table of A/B testing results) entirely
when there are no groups to show. Also hide the forms to start A/B testing when there are no matching
triggerable, which is the main feature of this patch.
* server-tests/api-manifest.js: Added a test for including a list of triggerables in the manifest JSON.
* server-tests/resources/mock-data.js:
(MockData.resetV3Models): Reset Triggerable's static map.
* server-tests/tools-buildbot-triggerable-tests.js: Assert that Triggerable objects are  constructed
with appropriate list of repositories and (test, platform) associations.
* tools/js/database.js:
(tableToPrefixMap): Added triggerable_repositories's prefix.
* tools/js/remote.js:
(RemoteAPI.prototype.getJSON): Log the entire response to stderr when JSON.parse fails to aid debugging.
* tools/js/v3-models.js: Import triggerable.js.

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

3 years agofetch-from-remote doesn’t work with some websites
rniwa@webkit.org [Thu, 12 Jan 2017 06:50:16 +0000 (06:50 +0000)]
fetch-from-remote doesn’t work with some websites
https://bugs.webkit.org/show_bug.cgi?id=166963

Reviewed by Yusuke Suzuki.

Apparently file_get_contents is not compatible with some SSL/TLS connections.
Use curl_* functions to access remote servers instead.

* public/admin/fetch-from-remote.php:
(fetch_remote):

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

3 years agoAdd IconLoadingDelegate functionality to WKView.
beidson@apple.com [Thu, 12 Jan 2017 06:16:42 +0000 (06:16 +0000)]
Add IconLoadingDelegate functionality to WKView.
https://bugs.webkit.org/show_bug.cgi?id=166951

Reviewed by Tim Horton.

* UIProcess/API/mac/WKView.mm:
(-[WKView dealloc]):
(-[WKView maybeInstallIconLoadingClient]): If the subclass implements the delegate method, install the
  icon loading client. Otherwise, maintain the normal IconDatabase loading behavior.
(-[WKView initWithFrame:processPool:configuration:webView:]):

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

3 years agoWeb Inspector: Add another Protocol Version
commit-queue@webkit.org [Thu, 12 Jan 2017 05:59:16 +0000 (05:59 +0000)]
Web Inspector: Add another Protocol Version
https://bugs.webkit.org/show_bug.cgi?id=166953
<rdar://problem/29980631>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-01-11
Reviewed by Timothy Hatcher.

* UserInterface/Protocol/Legacy/10.3/InspectorBackendCommands.js: Added.
* Versions/Inspector-iOS-10.3.json: Added.

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

3 years agoREGRESSION(r206133): LayoutTest inspector/css/manager-preferredInspectorStyleSheetFor...
commit-queue@webkit.org [Thu, 12 Jan 2017 05:56:46 +0000 (05:56 +0000)]
REGRESSION(r206133): LayoutTest inspector/css/manager-preferredInspectorStyleSheetForFrame.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=162305
<rdar://problem/28389364>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-01-11
Reviewed by Timothy Hatcher.

* inspector/css/manager-preferredInspectorStyleSheetForFrame-expected.txt:
* inspector/css/manager-preferredInspectorStyleSheetForFrame.html:
Revert the change that broke this and move to more deterministic callbacks
that don't include the extra variance in producing output.

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

3 years ago[MediaStream, Mac] Render media stream audio buffers
eric.carlson@apple.com [Thu, 12 Jan 2017 05:22:32 +0000 (05:22 +0000)]
[MediaStream, Mac] Render media stream audio buffers
https://bugs.webkit.org/show_bug.cgi?id=159836
<rdar://problem/27380390>

Reviewed by Jer Noble.

No new tests, it isn't possible to test audio rendering directly. A follow-up patch will
add a mock audio source that will enable audio testing.

* platform/cf/CoreMediaSoftLink.cpp: Include new functions used.
* platform/cf/CoreMediaSoftLink.h:

* WebCore.xcodeproj/project.pbxproj: Remove references to the deleted previews.

* platform/Logging.h: Add MediaCaptureSamples.

* platform/MediaSample.h: Add outputPresentationTime and outputDuration.

* platform/cf/CoreMediaSoftLink.cpp: Add CMSampleBufferGetOutputDuration, CMSampleBufferGetOutputPresentationTimeStamp,
CMTimeConvertScale, CMTimebaseGetEffectiveRate, CMAudioSampleBufferCreateWithPacketDescriptions,
CMSampleBufferSetDataBufferFromAudioBufferList, CMSampleBufferSetDataReady,
CMAudioFormatDescriptionCreate, CMClockGetHostTimeClock, and CMClockGetTime.
* platform/cf/CoreMediaSoftLink.h:

Create and use an AVSampleBufferAudioRenderer each audio stream track, when it is available,
to render for audio samples. Store the offset between the first sample received from a track's
output presentation and the synchronizer time so we can adjust sample timestamps to be
relative to the synchronizer's timeline regardless of their source. Remove the use of source
previews because not all sources will have them.

* platform/graphics/avfoundation/MediaSampleAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:

Add an ObjC helper to catch renderer status changes.
(-[WebAVSampleBufferStatusChangeListener initWithParent:]):
(-[WebAVSampleBufferStatusChangeListener dealloc]):
(-[WebAVSampleBufferStatusChangeListener invalidate]):
(-[WebAVSampleBufferStatusChangeListener beginObservingLayer:]):
(-[WebAVSampleBufferStatusChangeListener stopObservingLayer:]):
(-[WebAVSampleBufferStatusChangeListener beginObservingRenderer:]):
(-[WebAVSampleBufferStatusChangeListener stopObservingRenderer:]):
(-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::removeOldSamplesFromPendingQueue):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::addSampleToPendingQueue):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateSampleTimes):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueAudioSample):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForVideoData):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForAudioData):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::createAudioRenderer):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyAudioRenderer):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyAudioRenderers):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::audioSourceProvider):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::rendererStatusDidChange):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerStatusDidChange):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::flushRenderers):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::platformLayer):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentDisplayMode):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueAudioSampleBufferFromTrack): Deleted.
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForMediaData): Deleted.
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSampleBuffer): Deleted.
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::prepareVideoSampleBufferFromTrack): Deleted.
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::internalSetVolume): Deleted.

* platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
(WebCore::MediaSampleAVFObjC::outputPresentationTime): New.
(WebCore::MediaSampleAVFObjC::outputDuration): New.
(WebCore::MediaSampleAVFObjC::dump): Log outputPresentationTime.

* platform/mediastream/AudioTrackPrivateMediaStream.h: Add timelineOffset.

* platform/mediastream/MediaStreamTrackPrivate.cpp:
(WebCore::MediaStreamTrackPrivate::setEnabled): No more m_preview.
(WebCore::MediaStreamTrackPrivate::endTrack): Ditto.
(WebCore::MediaStreamTrackPrivate::preview): Deleted.
* platform/mediastream/MediaStreamTrackPrivate.h:

* platform/mediastream/RealtimeMediaSource.h:
(WebCore::RealtimeMediaSource::preview): Deleted.

* platform/mediastream/RealtimeMediaSourcePreview.h: Removed.

* platform/mediastream/VideoTrackPrivateMediaStream.h: Add timelineOffset.

* platform/mediastream/mac/AVAudioCaptureSource.h:
* platform/mediastream/mac/AVAudioCaptureSource.mm:
(WebCore::AVAudioCaptureSource::updateSettings):
(WebCore::AVAudioCaptureSource::captureOutputDidOutputSampleBufferFromConnection): Pass the
sample buffer up the chain.
(WebCore::AVAudioSourcePreview::create): Deleted.
(WebCore::AVAudioSourcePreview::AVAudioSourcePreview): Deleted.
(WebCore::AVAudioSourcePreview::invalidate): Deleted.
(WebCore::AVAudioSourcePreview::play): Deleted.
(WebCore::AVAudioSourcePreview::pause): Deleted.
(WebCore::AVAudioSourcePreview::setEnabled): Deleted.
(WebCore::AVAudioSourcePreview::setVolume): Deleted.
(WebCore::AVAudioSourcePreview::updateState): Deleted.
(WebCore::AVAudioCaptureSource::createPreview): Deleted.

* platform/mediastream/mac/AVMediaCaptureSource.h:
(WebCore::AVMediaSourcePreview): Deleted.
(WebCore::AVMediaCaptureSource::createWeakPtr): Deleted.

* platform/mediastream/mac/AVMediaCaptureSource.mm:
(WebCore::AVMediaCaptureSource::AVMediaCaptureSource): No more preview.
(WebCore::AVMediaCaptureSource::reset):
(WebCore::AVMediaCaptureSource::preview): Deleted.
(WebCore::AVMediaCaptureSource::removePreview): Deleted.
(WebCore::AVMediaSourcePreview::AVMediaSourcePreview): Deleted.
(WebCore::AVMediaSourcePreview::~AVMediaSourcePreview): Deleted.
(WebCore::AVMediaSourcePreview::invalidate): Deleted.

* platform/mediastream/mac/AVVideoCaptureSource.h:
* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::processNewFrame): Don't set the "display immediately" attachment.
(WebCore::AVVideoSourcePreview::create): Deleted.
(WebCore::AVVideoSourcePreview::AVVideoSourcePreview): Deleted.
(WebCore::AVVideoSourcePreview::backgroundLayerBoundsChanged): Deleted.
(WebCore::AVVideoSourcePreview::invalidate): Deleted.
(WebCore::AVVideoSourcePreview::play): Deleted.
(WebCore::AVVideoSourcePreview::pause): Deleted.
(WebCore::AVVideoSourcePreview::setPaused): Deleted.
(WebCore::AVVideoSourcePreview::setEnabled): Deleted.
(WebCore::AVVideoCaptureSource::createPreview): Deleted.
(-[WebCoreAVVideoCaptureSourceObserver setParent:]): Deleted.
(-[WebCoreAVVideoCaptureSourceObserver observeValueForKeyPath:ofObject:change:context:]): Deleted.

* platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
(WebCore::MockRealtimeVideoSourceMac::CMSampleBufferFromPixelBuffer): Use a more typical video
time scale. Set the sample decode time.
(WebCore::MockRealtimeVideoSourceMac::pixelBufferFromCGImage): Use a static for colorspace
instead of fetching it for every frame.

* platform/mock/mediasource/MockSourceBufferPrivate.cpp: Add outputPresentationTime and outputDuration.

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

3 years agoREGRESSION: [mac-wk2] LayoutTest inspector/debugger/breakpoint-columns.html is a...
commit-queue@webkit.org [Thu, 12 Jan 2017 05:15:48 +0000 (05:15 +0000)]
REGRESSION: [mac-wk2] LayoutTest inspector/debugger/breakpoint-columns.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=161774
<rdar://problem/28217256>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-01-11
Reviewed by Mark Lam.

* platform/mac-wk2/TestExpectations:
Remove flaky expectations for a test that hasn't failed in a month.

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

3 years ago[WK2][Cocoa] Avoid null dereference in FullScreen code.
bfulgham@apple.com [Thu, 12 Jan 2017 05:03:36 +0000 (05:03 +0000)]
[WK2][Cocoa] Avoid null dereference in FullScreen code.
https://bugs.webkit.org/show_bug.cgi?id=166957
<rdar://problem/27745004>

Reviewed by Eric Carlson.

* WebProcess/cocoa/WebVideoFullscreenManager.mm:
(WebKit::WebVideoFullscreenManager::didSetupFullscreen): Use protected reference to 'this', and check for valid
page before attempting to use it.

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

3 years agoWeb Inspector: spring function editor has unusual layout, should have left-aligned...
commit-queue@webkit.org [Thu, 12 Jan 2017 04:11:32 +0000 (04:11 +0000)]
Web Inspector: spring function editor has unusual layout, should have left-aligned labels and slider tracks
https://bugs.webkit.org/show_bug.cgi?id=166933

Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2017-01-11
Reviewed by Brian Burg.

* UserInterface/Views/Main.css:
(input[type=range]::-webkit-slider-thumb):
(input[type=range]::-webkit-slider-runnable-track):
(input[type=range]::-webkit-slider-runnable-track::before): Deleted.
Fix slider styles.

* UserInterface/Views/SpringEditor.css:
(.spring-editor):
(.spring-editor > .spring-preview):
(.spring-editor > .spring-timing):
(.spring-editor > .number-input-container > .number-input-row > .number-input-row-title):
(.spring-editor > .number-input-container > .number-input-row > input):
(.spring-editor > .number-input-container > .number-input-row > input::-webkit-inner-spin-button):
(.spring-editor > .number-input-container > .number-input-row > input[type="range"]):
Decrease spacing and left-align text.

* UserInterface/Views/SpringEditor.js:
(WebInspector.SpringEditor.prototype._handleNumberInputKeydown):
(WebInspector.SpringEditor.prototype._changeSpringForInput):
Only update editor values when the new value of any input has changed.  This allows users to
enter decimal values ("." was being stripped by `parseFloat`).

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

3 years agoAdd committer status for Megan
megan_gardner@apple.com [Thu, 12 Jan 2017 04:03:15 +0000 (04:03 +0000)]
Add committer status for Megan
https://bugs.webkit.org/show_bug.cgi?id=166954

Reviewed by Tim Horton.

Add committer status for Megan Gardner

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

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

3 years agoRemove request.formData property until it gets implemented
commit-queue@webkit.org [Thu, 12 Jan 2017 02:44:30 +0000 (02:44 +0000)]
Remove request.formData property until it gets implemented
https://bugs.webkit.org/show_bug.cgi?id=166920
<rdar://problem/29971105>

Patch by Youenn Fablet <youenn@apple.com> on 2017-01-11
Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

* web-platform-tests/fetch/api/request/request-consume-empty-expected.txt:
* web-platform-tests/fetch/api/request/request-consume-expected.txt:
* web-platform-tests/fetch/api/request/request-idl-expected.txt:
* web-platform-tests/fetch/api/request/request-structure-expected.txt:

Source/WebCore:

Covered by rebased tests.

* Modules/fetch/FetchBody.idl:

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

3 years agoWeb Inspector: color, gradient, cubic-bezier, spring editors should be dismissable...
commit-queue@webkit.org [Thu, 12 Jan 2017 02:08:39 +0000 (02:08 +0000)]
Web Inspector: color, gradient, cubic-bezier, spring editors should be dismissable using ESC
https://bugs.webkit.org/show_bug.cgi?id=166934

Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2017-01-11
Reviewed by Brian Burg.

* UserInterface/Views/Popover.js:
(WebInspector.Popover):
(WebInspector.Popover.prototype.dismiss):
(WebInspector.Popover.prototype.handleEvent):
(WebInspector.Popover.prototype._addListenersIfNeeded):
Adds a keydown listener while visible for the Escape key that dismisses the popover.

* UserInterface/Views/QuickConsole.js:
(WebInspector.QuickConsole.prototype.set keyboardShortcutDisabled):
Expose the ability to disable the global keyboard shortcut.  This allows the Popover to have
its own Escape keyboard shortcut to take precedence.

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

3 years agoVersioning.
matthew_hanson@apple.com [Thu, 12 Jan 2017 01:55:51 +0000 (01:55 +0000)]
Versioning.

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

3 years agoReverting r210598, r210597, and r210591 to fix the iOS simulator build.
ryanhaddad@apple.com [Thu, 12 Jan 2017 01:52:33 +0000 (01:52 +0000)]
Reverting r210598, r210597, and r210591 to fix the iOS simulator build.
https://bugs.webkit.org/show_bug.cgi?id=166672

Unreviewed build fix.

* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::preparePlatformFont):
(WebCore::fontIsSystemFont): Deleted.

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

3 years agoREGRESSION: LayoutTest inspector/debugger/csp-exceptions.html is a flaky failure
commit-queue@webkit.org [Thu, 12 Jan 2017 01:24:44 +0000 (01:24 +0000)]
REGRESSION: LayoutTest inspector/debugger/csp-exceptions.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=165292
<rdar://problem/29471892>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-01-11
Reviewed by Geoffrey Garen.

* inspector/debugger/csp-exceptions-expected.txt:
* inspector/debugger/csp-exceptions.html:
* inspector/debugger/resources/csp-exception-iframe.html:
Improve the test to handle all console messages more carefully,
including outputing the console messages to test them as well.

* platform/mac-wk2/TestExpectations:
Unskip the test, it should no longer be flakey.

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

3 years agoRebaseline two tests after r210599.
bfulgham@apple.com [Thu, 12 Jan 2017 01:18:56 +0000 (01:18 +0000)]
Rebaseline two tests after r210599.

* fast/xmlhttprequest/xmlhttprequest-nonexistent-file-expected.txt:
* storage/domstorage/sessionstorage/blocked-file-access-expected.txt:

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

3 years agoCrash when WebCore's GC heap grows way too large.
akling@apple.com [Thu, 12 Jan 2017 00:55:32 +0000 (00:55 +0000)]
Crash when WebCore's GC heap grows way too large.
<https://webkit.org/b/166875>
<rdar://problem/27896585>

Reviewed by Mark Lam.

Source/JavaScriptCore:

Add a simple API to JSC::Heap that allows setting a hard limit on the amount
of live bytes. If this is exceeded, we crash with a recognizable signature.
By default there is no limit.

* heap/Heap.cpp:
(JSC::Heap::didExceedMaxLiveSize):
(JSC::Heap::updateAllocationLimits):
* heap/Heap.h:
(JSC::Heap::setMaxLiveSize):

Source/WebCore:

Cap the common WebCore VM at 4 GB of live JavaScript heap objects.

* bindings/js/CommonVM.cpp:
(WebCore::commonVMSlow):

Source/WTF:

Publish the WTF::GB constant.

* wtf/StdLibExtras.h:

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

3 years agoUnreviewed test fix after r210599.
bfulgham@apple.com [Thu, 12 Jan 2017 00:44:42 +0000 (00:44 +0000)]
Unreviewed test fix after r210599.

* TestWebKitAPI/Tests/WebKit2/WKPageIsPlayingAudio.cpp:
(TestWebKitAPI::TEST): Remove debugging code that was causing a timeout.

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

3 years agoAX: role=treeitem accessible name not spoken to VoiceOver macOS when using string...
n_wang@apple.com [Thu, 12 Jan 2017 00:11:00 +0000 (00:11 +0000)]
AX: role=treeitem accessible name not spoken to VoiceOver macOS when using string contained inside element
https://bugs.webkit.org/show_bug.cgi?id=164950
<rdar://problem/29337573>

Reviewed by Chris Fleizach.

Source/WebCore:

From the spec: https://www.w3.org/TR/wai-aria-practices/#TreeView
The element with role treeitem missing a label is labeled by its child elements.

Test: accessibility/mac/aria-tree-item-name.html

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::alternativeText):

LayoutTests:

* accessibility/mac/aria-tree-item-name-expected.txt: Added.
* accessibility/mac/aria-tree-item-name.html: Added.

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

3 years ago[GTK] Unreviewed build fix after r210600.
bfulgham@apple.com [Thu, 12 Jan 2017 00:05:20 +0000 (00:05 +0000)]
[GTK] Unreviewed build fix after r210600.

* platform/glib/FileSystemGlib.cpp:
(WebCore::getFileDeviceId): Attempting to use proper API here.

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

3 years agonavigator.plugins.refresh and WKContextRefreshPlugIns doesn't pick up changes to...
andersca@apple.com [Wed, 11 Jan 2017 23:55:37 +0000 (23:55 +0000)]
navigator.plugins.refresh and WKContextRefreshPlugIns doesn't pick up changes to already-present plug-ins
https://bugs.webkit.org/show_bug.cgi?id=166942
rdar://problem/29839194

Reviewed by Sam Weinig.

Source/WebKit2:

Use _CFBundleCreateUnique so the resulting bundle won't be cached.

* Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
(WebKit::NetscapePluginModule::getPluginInfo):

Source/WTF:

* wtf/spi/cf/CFBundleSPI.h:
Add SPI declaration.

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

3 years ago[GTK] Unreviewed build fix after r210599.
bfulgham@apple.com [Wed, 11 Jan 2017 23:07:39 +0000 (23:07 +0000)]
[GTK] Unreviewed build fix after r210599.

* platform/glib/FileSystemGlib.cpp:
(WebCore::getFileDeviceId): Revise for new signature.

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

3 years agoASSERTION FAILED: run->m_stop > 0 in *WebCore::RenderBlockFlow::computeInlineDirectio...
mmaxfield@apple.com [Wed, 11 Jan 2017 23:06:13 +0000 (23:06 +0000)]
ASSERTION FAILED: run->m_stop > 0 in *WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment
https://bugs.webkit.org/show_bug.cgi?id=166030

Reviewed by Ryosuke Niwa.

Source/WebCore:

Ordinarily, we don't process empty BiDi runs (because we filter them out).
However, when using isolates, we invoke extra machinery to create a
placeholder BiDi run, and replace it with the runs for the isolate. The
isolate's runs, though, can be empty, and rather than just deleting the
placeholder run, we will keep it around so that the m_logicallyLastRun is
still valid. This means that it is possible when all is said and done to
have empty runs, and computeInlineDirectionPositionsForSegment() needs to
not ASSERT() in this case.

Test: fast/text/bidi-isolate-empty-run.html

* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment):

LayoutTests:

* fast/text/bidi-isolate-empty-run-expected.txt: Added.
* fast/text/bidi-isolate-empty-run.html: Added.

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

3 years agoUnreviewed build fix after r210599.
bfulgham@apple.com [Wed, 11 Jan 2017 22:44:51 +0000 (22:44 +0000)]
Unreviewed build fix after r210599.

Add missing files.

* TestWebKitAPI/Tests/mac/CrossPartitionFileSchemeAccess.html: Added.
* TestWebKitAPI/Tests/mac/CrossPartitionFileSchemeAccess.mm: Added.

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

3 years agoFile scheme should not allow access of a resource on a different volume.
bfulgham@apple.com [Wed, 11 Jan 2017 21:55:20 +0000 (21:55 +0000)]
File scheme should not allow access of a resource on a different volume.
https://bugs.webkit.org/show_bug.cgi?id=158552
<rdar://problem/15307582>

Reviewed by Alex Christensen.

Source/WebCore:

Revise SecurityOrigin to prevent files from one storage device (volume) from accessing content
on a different storage device (volume) unless universal access is enabled.

Pass the current file device as part of the NSURLRequest so that CFNetwork can reject loads
where the device changes in the midst of a load.

Also properly reflect that SecurityOrigin is never null by passing as a reference,
rather than as a pointer.

Tests: Tools/TestWebKitAPI/Tests/mac/CrossPartitionFileSchemeAccess.mm

* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::canAccess): Pass argument as reference.
(WebCore::SecurityOrigin::canDisplay): Add check that files share the same volume.
(WebCore::SecurityOrigin::isSameSchemeHostPort): Pass argument as reference.
* page/SecurityOrigin.h:
* platform/FileSystem.cpp:
(WebCore::filesHaveSameVolume): Added.
* platform/FileSystem.h:
* platform/network/cocoa/ResourceRequestCocoa.mm:
(WebCore::ResourceRequest::doUpdatePlatformRequest): If loading a file URL, tell CFNetwork
the storage device at the time of the start of the load so we can trigger a failure if this
changes during the load operation.
* platform/posix/FileSystemPOSIX.cpp:
(WebCore::getFileDeviceId): Added.
* platform/win/FileSystemWin.cpp:
(WebCore::getFileDeviceId): Added.

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Add new files.
* TestWebKitAPI/Tests/mac/CrossPartitionFileSchemeAccess.html: Added.
* TestWebKitAPI/Tests/mac/CrossPartitionFileSchemeAccess.mm: Added.

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

3 years ago[Cocoa] Testing fix after r210597
mmaxfield@apple.com [Wed, 11 Jan 2017 21:46:43 +0000 (21:46 +0000)]
[Cocoa] Testing fix after r210597
https://bugs.webkit.org/show_bug.cgi?id=166672

Unreviewed.

* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::preparePlatformFont):

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

3 years ago[Cocoa] Testing fix after r210591
mmaxfield@apple.com [Wed, 11 Jan 2017 21:40:12 +0000 (21:40 +0000)]
[Cocoa] Testing fix after r210591
https://bugs.webkit.org/show_bug.cgi?id=166672

Unreviewed.

Fixes fast/text/trak-optimizeLegibility.html and
fast/text/system-font-features.html

* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::fontIsSystemFont):
(WebCore::preparePlatformFont):

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

3 years agoREGRESSION: Crash in com.apple.WebKit: IPC::Connection::sendMessage(std::__1::unique_...
andersca@apple.com [Wed, 11 Jan 2017 21:28:01 +0000 (21:28 +0000)]
REGRESSION: Crash in com.apple.WebKit: IPC::Connection::sendMessage(std::__1::unique_ptr<IPC::MachMessage, std::__1::default_delete<IPC::MachMessage> >) + 27
https://bugs.webkit.org/show_bug.cgi?id=165854
rdar://problem/29757269

Reviewed by Tim Horton.

* Platform/IPC/mac/ConnectionMac.mm:
(IPC::Connection::sendMessage):
Add assertion.

(IPC::Connection::initializeSendSource):
Turns out the event handler can be called spuriously, so guard against that.

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

3 years agoWeb Inspector: fix UIString for Print Styles button
commit-queue@webkit.org [Wed, 11 Jan 2017 20:30:48 +0000 (20:30 +0000)]
Web Inspector: fix UIString for Print Styles button
https://bugs.webkit.org/show_bug.cgi?id=166892

Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2017-01-11
Reviewed by Brian Burg.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Views/DOMTreeContentView.js:
(WebInspector.DOMTreeContentView):
Changed UIString to better match documentation.

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

3 years agoIterating over URLSearchParams does not work
cdumez@apple.com [Wed, 11 Jan 2017 19:18:24 +0000 (19:18 +0000)]
Iterating over URLSearchParams does not work
https://bugs.webkit.org/show_bug.cgi?id=166921
<rdar://problem/29970907>

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline W3C test now that more checks are passing.

* web-platform-tests/url/urlsearchparams-foreach-expected.txt:

Source/WebCore:

Make URLSearchParams iterable, as per:
- https://url.spec.whatwg.org/#urlsearchparams

Test: fast/dom/DOMURL/searchparams-iterable.html

* html/URLSearchParams.cpp:
(WebCore::URLSearchParams::Iterator::next):
(WebCore::URLSearchParams::Iterator::Iterator):
* html/URLSearchParams.h:
(WebCore::URLSearchParams::createIterator):
* html/URLSearchParams.idl:

LayoutTests:

Add layout test coverage.

* fast/dom/DOMURL/searchparams-iterable-expected.txt: Added.
* fast/dom/DOMURL/searchparams-iterable.html: Added.

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

3 years agoMark es6/typed_arrays_correct_prototype_chains.js as failing after r210570.
ryanhaddad@apple.com [Wed, 11 Jan 2017 18:48:34 +0000 (18:48 +0000)]
Mark es6/typed_arrays_correct_prototype_chains.js as failing after r210570.
https://bugs.webkit.org/show_bug.cgi?id=166931i

Unreviewed test gardening.

* es6.yaml:

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

3 years ago[Cocoa] Variation fonts without variations specified are not rendered as if the defau...
mmaxfield@apple.com [Wed, 11 Jan 2017 18:26:38 +0000 (18:26 +0000)]
[Cocoa] Variation fonts without variations specified are not rendered as if the default variations were specified
https://bugs.webkit.org/show_bug.cgi?id=166672
<rdar://problem/29779119>
<rdar://problem/29848883>

Reviewed by Simon Fraser.

CoreText has a bug (<rdar://problem/29859207>) where variation fonts without
a specified variation value are rendered as if the minimum value is specified,
rather than the default value. The solution is to apply default values where
they are omitted.

Test: fast/text/variations/advances.html

* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::preparePlatformFont):

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

3 years agoAttempt to fix the Windows build after r210588.
ryanhaddad@apple.com [Wed, 11 Jan 2017 18:08:37 +0000 (18:08 +0000)]
Attempt to fix the Windows build after r210588.

Unreviewed build fix.

* bindings/js/JSBindingsAllInOne.cpp:

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

3 years agoAddress some feedback from r210567.
weinig@apple.com [Wed, 11 Jan 2017 17:42:09 +0000 (17:42 +0000)]
Address some feedback from r210567.

* bindings/scripts/CodeGeneratorJS.pm:
(NativeToJSValueDOMConvertNeedsState):
(NativeToJSValueDOMConvertNeedsGlobalObject):
Fix typo. robost -> robust.

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

3 years agoRename JSCustomSQLStatementErrorCallback.cpp to JSSQLStatementErrorCallbackCustom.cpp
weinig@apple.com [Wed, 11 Jan 2017 17:38:35 +0000 (17:38 +0000)]
Rename JSCustomSQLStatementErrorCallback.cpp to JSSQLStatementErrorCallbackCustom.cpp
https://bugs.webkit.org/show_bug.cgi?id=166913

Reviewed by Alex Christensen.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSCustomSQLStatementErrorCallback.cpp: Removed.
* bindings/js/JSSQLStatementErrorCallbackCustom.cpp: Copied from Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp.
Rename to match conventions.

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

3 years agoUnreviewed, rolling out r210571.
ryanhaddad@apple.com [Wed, 11 Jan 2017 16:00:16 +0000 (16:00 +0000)]
Unreviewed, rolling out r210571.

This change broke the 32-bit macOS build and caused LayoutTest
failures.

Reverted changeset:

"File scheme should not allow access of a resource on a
different volume."
https://bugs.webkit.org/show_bug.cgi?id=158552
http://trac.webkit.org/changeset/210571

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

3 years ago[iOS][WK2] KeyboardEvent.key always returns an empty string
cdumez@apple.com [Wed, 11 Jan 2017 15:45:35 +0000 (15:45 +0000)]
[iOS][WK2] KeyboardEvent.key always returns an empty string
https://bugs.webkit.org/show_bug.cgi?id=166918
<rdar://problem/29861147>

Reviewed by Wenson Hsieh.

Source/WebKit2:

Make sure that KeyboardEvent.key gets properly initialized on iOS / WK2.

* Shared/WebEvent.h:
* Shared/WebKeyboardEvent.cpp:
(WebKit::WebKeyboardEvent::WebKeyboardEvent):
* Shared/ios/WebIOSEventFactory.mm:
(WebIOSEventFactory::createWebKeyboardEvent):

LayoutTests:

Add layout test coverage.

* fast/events/ios/keyboard-event-key-attribute-expected.txt: Added.
* fast/events/ios/keyboard-event-key-attribute.html: Added.

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

3 years agoDecouple module loading initiator from ScriptElement
utatane.tea@gmail.com [Wed, 11 Jan 2017 12:12:37 +0000 (12:12 +0000)]
Decouple module loading initiator from ScriptElement
https://bugs.webkit.org/show_bug.cgi?id=166888

Reviewed by Saam Barati and Ryosuke Niwa.

Source/JavaScriptCore:

Add ScriptFetcher and JSScriptFetcher.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* builtins/ModuleLoaderPrototype.js:
(requestFetch):
(requestInstantiate):
(requestSatisfy):
(requestInstantiateAll):
(requestLink):
(moduleEvaluation):
(loadAndEvaluateModule):
(importModule):
* llint/LLIntData.cpp:
(JSC::LLInt::Data::performAssertions):
* llint/LowLevelInterpreter.asm:
* runtime/Completion.cpp:
(JSC::loadAndEvaluateModule):
(JSC::loadModule):
(JSC::linkAndEvaluateModule):
* runtime/Completion.h:
* runtime/JSModuleLoader.cpp:
(JSC::JSModuleLoader::loadAndEvaluateModule):
(JSC::JSModuleLoader::loadModule):
(JSC::JSModuleLoader::linkAndEvaluateModule):
(JSC::JSModuleLoader::resolve):
(JSC::JSModuleLoader::fetch):
(JSC::JSModuleLoader::instantiate):
(JSC::JSModuleLoader::evaluate):
* runtime/JSModuleLoader.h:
* runtime/JSScriptFetcher.cpp: Copied from Source/WebCore/dom/LoadableScript.cpp.
(JSC::JSScriptFetcher::destroy):
* runtime/JSScriptFetcher.h: Added.
(JSC::JSScriptFetcher::createStructure):
(JSC::JSScriptFetcher::create):
(JSC::JSScriptFetcher::fetcher):
(JSC::JSScriptFetcher::JSScriptFetcher):
* runtime/JSType.h:
* runtime/ScriptFetcher.h: Copied from Source/WebCore/dom/LoadableScript.cpp.
(JSC::ScriptFetcher::~ScriptFetcher):
* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:

Source/WebCore:

Previously, we use ScriptElement (JSElement for ScriptElement) as the module loading initiator.
This element is used to transfer the metadata like charset throughout the module pipeline.
As a result, our module loader in the browser side is tightly coupled with ScriptElement.
It is not good since it prevent us from using the module loader in the non-DOM environment like
Web Workers.

So we decouple the necessary informations from ScriptElement. We move these information to
LoadableScript. And we use JSScriptFetcher to transfer LoadableScript through the JS implemented
module loader pipeline. We select LoadableScript instead of LoadableModuleScript since this initiator
information will be leveraged even in classic scripts once we implement the dynamic import.

No behavior change.

* ForwardingHeaders/runtime/JSScriptFetcher.h: Copied from Source/WebCore/dom/LoadableScript.cpp.
* ForwardingHeaders/runtime/ScriptFetcher.h: Copied from Source/WebCore/dom/LoadableScript.cpp.
* bindings/js/CachedModuleScript.cpp:
(WebCore::CachedModuleScript::create):
(WebCore::CachedModuleScript::load):
(WebCore::CachedModuleScript::CachedModuleScript): Deleted.
* bindings/js/CachedModuleScript.h:
Now we can merge CachedModuleScript to LoadableScript. But we do not do this in this patch since
we focus on decoupling the initiator information from ScriptElement.

(WebCore::CachedModuleScript::nonce): Deleted.
(WebCore::CachedModuleScript::crossOriginMode): Deleted.
* bindings/js/CachedModuleScriptLoader.cpp:
(WebCore::CachedModuleScriptLoader::load):
* bindings/js/CachedModuleScriptLoader.h:
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::moduleLoaderResolve):
(WebCore::JSDOMWindowBase::moduleLoaderFetch):
(WebCore::JSDOMWindowBase::moduleLoaderEvaluate):
* bindings/js/JSMainThreadExecState.h:
(WebCore::JSMainThreadExecState::loadModule):
(WebCore::JSMainThreadExecState::linkAndEvaluateModule):
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::loadModuleScriptInWorld):
(WebCore::ScriptController::loadModuleScript):
(WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
(WebCore::ScriptController::linkAndEvaluateModuleScript):
* bindings/js/ScriptController.h:
* bindings/js/ScriptModuleLoader.cpp:
(WebCore::ScriptModuleLoader::fetch):
* bindings/js/ScriptModuleLoader.h:
* dom/LoadableClassicScript.cpp:
(WebCore::LoadableClassicScript::create):
(WebCore::LoadableClassicScript::~LoadableClassicScript):
(WebCore::LoadableClassicScript::isLoaded):
(WebCore::LoadableClassicScript::error):
(WebCore::LoadableClassicScript::wasCanceled):
(WebCore::LoadableClassicScript::notifyFinished):
(WebCore::LoadableClassicScript::load):
* dom/LoadableClassicScript.h:
* dom/LoadableModuleScript.cpp:
(WebCore::LoadableModuleScript::create):
(WebCore::LoadableModuleScript::LoadableModuleScript):
(WebCore::LoadableModuleScript::load):
* dom/LoadableModuleScript.h:
* dom/LoadableScript.cpp:
(WebCore::LoadableScript::requestScriptWithCache):
* dom/LoadableScript.h:
(WebCore::LoadableScript::LoadableScript):
* dom/ScriptElement.cpp:
(WebCore::ScriptElement::requestClassicScript):
(WebCore::ScriptElement::requestModuleScript):
(WebCore::ScriptElement::executeModuleScript):
(WebCore::ScriptElement::requestScriptWithCacheForModuleScript): Deleted.
(WebCore::ScriptElement::requestScriptWithCache): Deleted.
* dom/ScriptElement.h:

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

3 years ago[GStreamer] Use smart pointers and modernize code in WebKitWebAudioSourceGStreamer
carlosgc@webkit.org [Wed, 11 Jan 2017 11:27:38 +0000 (11:27 +0000)]
[GStreamer] Use smart pointers and modernize code in WebKitWebAudioSourceGStreamer
https://bugs.webkit.org/show_bug.cgi?id=166886

Reviewed by Xabier Rodriguez-Calvar.

This patch doesn't change the behavior, so it's covered by existing Web Audio tests. It replaces pointers with
smart pointers, uses WTF::Vector instead of GSList and simplifies the code to map/unmap GstBuffers.

* platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
(webKitWebAudioSrcConstructed):
(webKitWebAudioSrcFinalize):
(webKitWebAudioSrcLoop):
(webKitWebAudioSrcChangeState):
* platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
(WTF::derefGPtr<GstBufferList>):
(WTF::adoptGRef):
(WTF::refGPtr<GstBufferPool>):
(WTF::derefGPtr<GstBufferPool>):
* platform/graphics/gstreamer/GRefPtrGStreamer.h:
* platform/graphics/gstreamer/GStreamerUtilities.cpp:
(WebCore::mapGstBuffer):
* platform/graphics/gstreamer/GStreamerUtilities.h:
* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(StreamingClient::createReadBuffer):

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

3 years agoUnreviewed, rolling out r182947.
commit-queue@webkit.org [Wed, 11 Jan 2017 09:08:11 +0000 (09:08 +0000)]
Unreviewed, rolling out r182947.
https://bugs.webkit.org/show_bug.cgi?id=166922

Caused huge memory leak see https://webkit.org/b/166884
(Requested by KaL on #webkit).

Reverted changeset:

"[GStreamer] Silent WebAudio buffers support"
https://bugs.webkit.org/show_bug.cgi?id=143869
http://trac.webkit.org/changeset/182947

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

3 years agoUnreviewed, rolling out r210579.
carlosgc@webkit.org [Wed, 11 Jan 2017 08:55:22 +0000 (08:55 +0000)]
Unreviewed, rolling out r210579.

That was not the right fix

Reverted changeset:

"Unreviewed GTK buildfix after r210571."
http://trac.webkit.org/changeset/210579

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

3 years ago[EFL] Update TestExpectation file for Ubuntu 16.04.
gyuyoung.kim@webkit.org [Wed, 11 Jan 2017 08:53:05 +0000 (08:53 +0000)]
[EFL] Update TestExpectation file for Ubuntu 16.04.

Unreviewed EFL gardening.

After bumping Ubuntu version to 16.04, there are many tests are failed.
This gardening is to update all failure tests on Ubuntu 16.04.

* platform/efl/TestExpectations:

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

3 years agoUnreviewed. Fix GTK+ build after r210571.
carlosgc@webkit.org [Wed, 11 Jan 2017 08:52:56 +0000 (08:52 +0000)]
Unreviewed. Fix GTK+ build after r210571.

Add getFileDeviceId implementation to FileSystemGlib.cpp.

* platform/glib/FileSystemGlib.cpp:
(WebCore::getFileDeviceId):

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

3 years agoUnreviewed GTK buildfix after r210571.
ossy@webkit.org [Wed, 11 Jan 2017 08:47:42 +0000 (08:47 +0000)]
Unreviewed GTK buildfix after r210571.

* PlatformGTK.cmake:

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

3 years agoAnother build fix. Always use UTC when expressing commit times in UNIX-epoch timestamps.
rniwa@webkit.org [Wed, 11 Jan 2017 07:53:17 +0000 (07:53 +0000)]
Another build fix. Always use UTC when expressing commit times in UNIX-epoch timestamps.

* public/api/measurement-set.php:

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

3 years agoFix a typo in the previous commit.
rniwa@webkit.org [Wed, 11 Jan 2017 04:53:53 +0000 (04:53 +0000)]
Fix a typo in the previous commit.

* public/api/measurement-set.php:

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

3 years agoBuild fixes for older versions of Postgres.
rniwa@webkit.org [Wed, 11 Jan 2017 04:51:12 +0000 (04:51 +0000)]
Build fixes for older versions of Postgres.

Also redirect / and /# to /v3/ as intended in r200820.

* public/api/measurement-set.php:
* public/api/runs.php:
* public/index.html:

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

3 years ago[GTK] install-dependencies script misses gdb
clopez@igalia.com [Wed, 11 Jan 2017 04:07:54 +0000 (04:07 +0000)]
[GTK] install-dependencies script misses gdb
https://bugs.webkit.org/show_bug.cgi?id=166917

Reviewed by Michael Catanzaro.

gdb is needed for generating the crash logs.

* gtk/install-dependencies:

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

3 years ago[GTK] No way for applications to set notification permissions without waiting for...
mcatanzaro@igalia.com [Wed, 11 Jan 2017 03:56:12 +0000 (03:56 +0000)]
[GTK] No way for applications to set notification permissions without waiting for permission request
https://bugs.webkit.org/show_bug.cgi?id=163366

Reviewed by Carlos Garcia Campos.

Source/WebKit2:

Websites can check the Notification.permission DOM property to check if they have permission
to show notifications *without triggering a permission request*. But the WebKitGTK+ API has
no way to affirmatively indicate notifications are allowed without a permission request. The
only way is via the permission request API, which is too late. It's a problem for Epiphany.
For example, open the Riot Matrix client in a web app; you will immediately see an info bar
informing the user that Riot does not have permission to send desktop notifications, even
though Epiphany automatically grants notification permission in web app mode when requested.
This problem is not exclusive to web apps; there is simply no way for notification
permission to be set correctly prior to a permission request for it. Fix this by introducing
a webkit_web_context_initialize_notification_permissions() API, and add a signal
WebKitWebContext::initialize-notification-permissions to indicate when it should be called.

* UIProcess/API/gtk/WebKitNotificationProvider.cpp:
(notificationPermissionsCallback):
(WebKitNotificationProvider::create):
(WebKitNotificationProvider::WebKitNotificationProvider):
(WebKitNotificationProvider::notificationPermissions):
(WebKitNotificationProvider::setNotificationPermissions):
* UIProcess/API/gtk/WebKitNotificationProvider.h:
* UIProcess/API/gtk/WebKitSecurityOrigin.cpp:
(webkitSecurityOriginGetSecurityOrigin):
* UIProcess/API/gtk/WebKitSecurityOriginPrivate.h:
* UIProcess/API/gtk/WebKitWebContext.cpp:
(webkitWebContextConstructed):
(webkit_web_context_class_init):
(addOriginToMap):
(webkit_web_context_initialize_notification_permissions):
(webkitWebContextInitializeNotificationPermissions):
* UIProcess/API/gtk/WebKitWebContext.h:
* UIProcess/API/gtk/WebKitWebContextPrivate.h:
* UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:

Tools:

* TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp:
(testWebViewNotification):
(setInitialNotificationPermissionsAllowedCallback):
(setInitialNotificationPermissionsDisallowedCallback):
(testWebViewNotificationInitialPermissionAllowed):
(testWebViewNotificationInitialPermissionDisallowed):
(beforeAll):
* TestWebKitAPI/gtk/WebKit2Gtk/TestMain.h:
* TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp:
(WebViewTest::WebViewTest):
(WebViewTest::initializeWebView):
* TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.h:

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

3 years agoImplement JSSourceCode to propagate SourceCode in module pipeline
utatane.tea@gmail.com [Wed, 11 Jan 2017 02:26:47 +0000 (02:26 +0000)]
Implement JSSourceCode to propagate SourceCode in module pipeline
https://bugs.webkit.org/show_bug.cgi?id=166861

Reviewed by Saam Barati.

Source/JavaScriptCore:

Instead of propagating source code string, we propagate JSSourceCode
cell in the module pipeline. This allows us to attach a metadata
to the propagated source code string. In particular, it propagates
SourceOrigin through the module pipeline.

And it also fixes JSC shell to use Module source type for module source code.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* builtins/ModuleLoaderPrototype.js:
(fulfillFetch):
(requestFetch):
* jsc.cpp:
(GlobalObject::moduleLoaderFetch):
(runWithScripts):
* llint/LLIntData.cpp:
(JSC::LLInt::Data::performAssertions):
* llint/LowLevelInterpreter.asm:
* runtime/Completion.cpp:
(JSC::loadAndEvaluateModule):
(JSC::loadModule):
* runtime/JSModuleLoader.cpp:
(JSC::JSModuleLoader::provide):
* runtime/JSModuleLoader.h:
* runtime/JSSourceCode.cpp: Added.
(JSC::JSSourceCode::destroy):
* runtime/JSSourceCode.h: Added.
(JSC::JSSourceCode::createStructure):
(JSC::JSSourceCode::create):
(JSC::JSSourceCode::sourceCode):
(JSC::JSSourceCode::JSSourceCode):
* runtime/JSType.h:
* runtime/ModuleLoaderPrototype.cpp:
(JSC::moduleLoaderPrototypeParseModule):
* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:

Source/WebCore:

Now SourceOrigin is correctly propagated through the module pipeline.
So the error reported by http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.html
is updated.

* ForwardingHeaders/runtime/JSSourceCode.h: Added.
* bindings/js/JSDOMPromise.h:
(WebCore::DeferredPromise::resolveWithCallback):
* bindings/js/ScriptModuleLoader.cpp:
(WebCore::ScriptModuleLoader::notifyFinished):

LayoutTests:

* http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.txt:

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

3 years agoMobileMiniBrowser tests don't work by default
timothy_horton@apple.com [Wed, 11 Jan 2017 01:54:25 +0000 (01:54 +0000)]
MobileMiniBrowser tests don't work by default
https://bugs.webkit.org/show_bug.cgi?id=166910

Reviewed by Alex Christensen.

* MobileMiniBrowser/MobileMiniBrowser.xcodeproj/xcshareddata/xcschemes/MobileMiniBrowserUITests.xcscheme: Added.
Add a shared scheme; the Makefile depends on the MobileMiniBrowserUITests scheme existing, at the very least.

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

3 years agoFile scheme should not allow access of a resource on a different volume.
bfulgham@apple.com [Wed, 11 Jan 2017 01:51:25 +0000 (01:51 +0000)]
File scheme should not allow access of a resource on a different volume.
https://bugs.webkit.org/show_bug.cgi?id=158552
<rdar://problem/15307582>

Reviewed by Alex Christensen.

Source/WebCore:

Revise SecurityOrigin to prevent files from one storage device (volume) from accessing content
on a different storage device (volume) unless universal access is enabled.

Pass the current file device as part of the NSURLRequest so that CFNetwork can reject loads
where the device changes in the midst of a load.

Also properly reflect that SecurityOrigin is never null by passing as a reference,
rather than as a pointer.

Tests: Tools/TestWebKitAPI/Tests/mac/CrossPartitionFileSchemeAccess.mm

* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::canAccess): Pass argument as reference.
(WebCore::SecurityOrigin::passesFileCheck): Add check that file URLs refer to files in
the same storage volume.
(WebCore::SecurityOrigin::canDisplay): Add check that files share the same volume.
(WebCore::SecurityOrigin::isSameSchemeHostPort): Pass argument as reference.
* page/SecurityOrigin.h:
* platform/FileSystem.cpp:
(WebCore::filesHaveSameVolume): Added.
* platform/FileSystem.h:
* platform/network/cocoa/ResourceRequestCocoa.mm:
(WebCore::ResourceRequest::doUpdatePlatformRequest): If loading a file URL, tell CFNetwork
the storage device at the time of the start of the load so we can trigger a failure if this
changes during the load operation.
* platform/posix/FileSystemPOSIX.cpp:
(WebCore::getFileDeviceId): Added.
* platform/win/FileSystemWin.cpp:
(WebCore::getFileDeviceId): Added.

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Add new files.
* TestWebKitAPI/Tests/mac/CrossPartitionFileSchemeAccess.html: Added.
* TestWebKitAPI/Tests/mac/CrossPartitionFileSchemeAccess.mm: Added.

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

3 years agoUnreviewed, rolling out r210052.
commit-queue@webkit.org [Wed, 11 Jan 2017 01:35:32 +0000 (01:35 +0000)]
Unreviewed, rolling out r210052.
https://bugs.webkit.org/show_bug.cgi?id=166915

"breaks web compatability" (Requested by keith_miller on
#webkit).

Reverted changeset:

"Add support for global"
https://bugs.webkit.org/show_bug.cgi?id=165171
http://trac.webkit.org/changeset/210052

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

3 years agoReverting run-jsc-stress-tests' $buildType to use string values.
mark.lam@apple.com [Wed, 11 Jan 2017 01:28:00 +0000 (01:28 +0000)]
Reverting run-jsc-stress-tests' $buildType to use string values.
https://bugs.webkit.org/show_bug.cgi?id=166912

Rubber stamped by Filip Pizlo.

This is so that we can test for it in the tests e.g.
//@ if $buildType == "debug" then runDefault("--maxSingleAllocationSize=1048576") else skip end

* Scripts/run-jsc-stress-tests:

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

3 years ago[WebIDL] Remove most of the custom bindings for the WebGL code
commit-queue@webkit.org [Wed, 11 Jan 2017 01:02:34 +0000 (01:02 +0000)]
[WebIDL] Remove most of the custom bindings for the WebGL code
https://bugs.webkit.org/show_bug.cgi?id=166834

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

Source/JavaScriptCore:

* runtime/ArrayPrototype.h:
* runtime/ObjectPrototype.h:
Export the ClassInfo so it can be used from WebCore.

Source/WebCore:

Removes all but one custom getter (getExtension) from the WebGL code.

* Modules/indexeddb/IDBKeyRange.idl:
Replace use of non-standard type, with new OverrideIDLType extended attribute, allowing us
to stay more consistent with the IDL files spec's provide.

* WebCore.xcodeproj/project.pbxproj:
Move JSWebGL2RenderingContextCustom to the GC/Wrapping only group.

* bindings/IDLTypes.h:
Add IDLWebGLAny, and simplify IDLIDBKey to not be templatized.

* bindings/js/JSDOMConvert.h:
(WebCore::Converter<IDLLong>::convert):
(WebCore::Converter<IDLFloat>::convert):
(WebCore::Converter<IDLUnrestrictedFloat>::convert):
(WebCore::Converter<IDLDouble>::convert):
(WebCore::Converter<IDLUnrestrictedDouble>::convert):
Add overloads of convert that convert a double to the numeric type.

(WebCore::Detail::GenericSequenceConverter::convert):
Add optimized specialization for JSArrays that does not use the iterator protocol.

(WebCore::Detail::NumericSequenceConverter::convert):
Add an even more optimized specialization for numeric types, which checks to see
if the array's butterfly has an optimized shape, and extracts the numeric values
from that.

(WebCore::Detail::SequenceConverter::convert):
(WebCore::Detail::SequenceConverter<IDLLong>::convert):
(WebCore::Detail::SequenceConverter<IDLFloat>::convert):
(WebCore::Detail::SequenceConverter<IDLUnrestrictedFloat>::convert):
(WebCore::Detail::SequenceConverter<IDLDouble>::convert):
(WebCore::Detail::SequenceConverter<IDLUnrestrictedDouble>::convert):
Select the right specialization based on type.

(WebCore::Converter<IDLSequence<T>>::convert):
(WebCore::Converter<IDLFrozenArray<T>>::convert):
Rename converter to be more accurate.

(WebCore::JSConverter<IDLWebGLAny>::convert):
Added. Calls through to converter in WebGLAny.h. We should replace this with a
call to the IDLUnion JSConverter when feasible.

* bindings/js/JSWebGL2RenderingContextCustom.cpp:
(WebCore::JSWebGL2RenderingContext::getInternalformatParameter): Deleted.
(WebCore::JSWebGL2RenderingContext::getQueryParameter): Deleted.
(WebCore::JSWebGL2RenderingContext::getSamplerParameter): Deleted.
(WebCore::JSWebGL2RenderingContext::getSyncParameter): Deleted.
(WebCore::JSWebGL2RenderingContext::getIndexedParameter): Deleted.
(WebCore::JSWebGL2RenderingContext::getActiveUniformBlockParameter): Deleted.
(WebCore::JSWebGL2RenderingContext::getActiveUniformBlockName): Deleted.
Remove unnecessary custom functions.

* bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
(WebCore::objectParameter): Deleted.
(WebCore::JSWebGLRenderingContextBase::getAttachedShaders): Deleted.
(WebCore::JSWebGLRenderingContextBase::getBufferParameter): Deleted.
(WebCore::JSWebGLRenderingContextBase::getFramebufferAttachmentParameter): Deleted.
(WebCore::JSWebGLRenderingContextBase::getParameter): Deleted.
(WebCore::JSWebGLRenderingContextBase::getProgramParameter): Deleted.
(WebCore::JSWebGLRenderingContextBase::getRenderbufferParameter): Deleted.
(WebCore::JSWebGLRenderingContextBase::getShaderParameter): Deleted.
(WebCore::JSWebGLRenderingContextBase::getSupportedExtensions): Deleted.
(WebCore::JSWebGLRenderingContextBase::getTexParameter): Deleted.
(WebCore::JSWebGLRenderingContextBase::getUniform): Deleted.
(WebCore::JSWebGLRenderingContextBase::getVertexAttrib): Deleted.
(WebCore::toNumberVector): Deleted.
(WebCore::functionForUniform): Deleted.
(WebCore::dataFunctionf): Deleted.
(WebCore::dataFunctioni): Deleted.
(WebCore::dataFunctionMatrix): Deleted.
(WebCore::JSWebGLRenderingContextBase::uniform1fv): Deleted.
(WebCore::JSWebGLRenderingContextBase::uniform1iv): Deleted.
(WebCore::JSWebGLRenderingContextBase::uniform2fv): Deleted.
(WebCore::JSWebGLRenderingContextBase::uniform2iv): Deleted.
(WebCore::JSWebGLRenderingContextBase::uniform3fv): Deleted.
(WebCore::JSWebGLRenderingContextBase::uniform3iv): Deleted.
(WebCore::JSWebGLRenderingContextBase::uniform4fv): Deleted.
(WebCore::JSWebGLRenderingContextBase::uniform4iv): Deleted.
(WebCore::JSWebGLRenderingContextBase::uniformMatrix2fv): Deleted.
(WebCore::JSWebGLRenderingContextBase::uniformMatrix3fv): Deleted.
(WebCore::JSWebGLRenderingContextBase::uniformMatrix4fv): Deleted.
(WebCore::JSWebGLRenderingContextBase::vertexAttrib1fv): Deleted.
(WebCore::JSWebGLRenderingContextBase::vertexAttrib2fv): Deleted.
(WebCore::JSWebGLRenderingContextBase::vertexAttrib3fv): Deleted.
(WebCore::JSWebGLRenderingContextBase::vertexAttrib4fv): Deleted.
Remove unnecessary custom functions.

* bindings/scripts/CodeGenerator.pm:
(IsBuiltinType):
Remove specialization of IDBKey.

* bindings/scripts/CodeGeneratorJS.pm:
(GetBaseIDLType):
(GetIDLType):
(NativeToJSValueDOMConvertNeedsState):
(NativeToJSValueDOMConvertNeedsGlobalObject):
(NativeToJSValue):
Allow IDL files to override the type of signature using a new OverrideIDLType
extended attribute. Currently this only works conversion to JS, but could be
extended to support more.

* bindings/scripts/IDLAttributes.txt:
Add OverrideIDLType.

* html/canvas/WebGL2RenderingContext.idl:
Add OverrideIDLType=IDLWebGLAny annotations to remove the need for custom functions.

* html/canvas/WebGLAny.cpp:
(WebCore::convertToJSValue):
(WebCore::toJS): Deleted.
* html/canvas/WebGLAny.h:
Rename the toJS function to convertToJSValue to avoid a template specialization issue.

* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::getAttachedShaders):
Update signature to match IDL, replacing bool return value plus out parameter with an
optional return value. Modernize the code a bit.

(WebCore::WebGLRenderingContextBase::uniform2f):
(WebCore::WebGLRenderingContextBase::uniform3f):
(WebCore::WebGLRenderingContextBase::uniform4f):
(WebCore::WebGLRenderingContextBase::uniform1i):
(WebCore::WebGLRenderingContextBase::uniform3i):
(WebCore::WebGLRenderingContextBase::uniform4i):
(WebCore::WebGLRenderingContextBase::uniform1fv):
(WebCore::WebGLRenderingContextBase::uniform2fv):
(WebCore::WebGLRenderingContextBase::uniform3fv):
(WebCore::WebGLRenderingContextBase::uniform4fv):
(WebCore::WebGLRenderingContextBase::uniform1iv):
(WebCore::WebGLRenderingContextBase::uniform2iv):
(WebCore::WebGLRenderingContextBase::uniform3iv):
(WebCore::WebGLRenderingContextBase::uniform4iv):
(WebCore::WebGLRenderingContextBase::uniformMatrix2fv):
(WebCore::WebGLRenderingContextBase::uniformMatrix3fv):
(WebCore::WebGLRenderingContextBase::uniformMatrix4fv):
(WebCore::WebGLRenderingContextBase::vertexAttrib4f):
(WebCore::WebGLRenderingContextBase::vertexAttrib1fv):
(WebCore::WebGLRenderingContextBase::vertexAttrib2fv):
(WebCore::WebGLRenderingContextBase::vertexAttrib3fv):
(WebCore::WebGLRenderingContextBase::vertexAttrib4fv):
(WebCore::WebGLRenderingContextBase::validateUniformParameters):
(WebCore::WebGLRenderingContextBase::validateUniformMatrixParameters):
(WebCore::WebGLRenderingContextBase::vertexAttribfvImpl):
* html/canvas/WebGLRenderingContextBase.h:
(WebCore::WebGLRenderingContextBase::TypedList::TypedList):
(WebCore::WebGLRenderingContextBase::TypedList::data):
(WebCore::WebGLRenderingContextBase::TypedList::length):
Re-order/group to match order in the IDL file. Remove overloads taking a pointer and
length, and replace it by having the main function take a specialized TypedList. TypedList
allows the bindings to pass the correct Variant type, but then the code to only think in
terms of the data() and length() functions.

* html/canvas/WebGLRenderingContextBase.idl:
Remove [Custom] annotations and re-order/group to match the spec. Update types of uniform*fv/iv
functions to take typedef'd unions.

LayoutTests:

* fast/canvas/webgl/gl-object-get-calls-expected.txt:
Update result for better error message.

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

3 years agoTemporarily add back the file removed in r210463 to unbreak internal bots.
rniwa@webkit.org [Tue, 10 Jan 2017 23:45:22 +0000 (23:45 +0000)]
Temporarily add back the file removed in r210463 to unbreak internal bots.

* Scripts/webkitpy/benchmark_runner/data/patches/Animometer.patch: Copied from Tools/Scripts/webkitpy/benchmark_runner/data/patches/Animometer.patch.

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

3 years agoStreamline the GC barrier slowpath
fpizlo@apple.com [Tue, 10 Jan 2017 23:41:55 +0000 (23:41 +0000)]
Streamline the GC barrier slowpath
https://bugs.webkit.org/show_bug.cgi?id=166878

Reviewed by Geoffrey Garen and Saam Barati.

This implements two optimizations to the barrier:

- Removes the write barrier buffer. This was just overhead.

- Teaches the slow path how to white an object that was black but unmarked, ensuring that
  we don't take slow path for this object again.

* JavaScriptCore.xcodeproj/project.pbxproj:
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileStoreBarrier):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::emitStoreBarrier):
* heap/CellState.h:
* heap/Heap.cpp:
(JSC::Heap::Heap):
(JSC::Heap::markToFixpoint):
(JSC::Heap::addToRememberedSet):
(JSC::Heap::stopTheWorld):
(JSC::Heap::writeBarrierSlowPath):
(JSC::Heap::buildConstraintSet):
(JSC::Heap::flushWriteBarrierBuffer): Deleted.
* heap/Heap.h:
(JSC::Heap::writeBarrierBuffer): Deleted.
* heap/SlotVisitor.cpp:
(JSC::SlotVisitor::appendJSCellOrAuxiliary):
(JSC::SlotVisitor::setMarkedAndAppendToMarkStack):
(JSC::SlotVisitor::appendToMarkStack):
(JSC::SlotVisitor::visitChildren):
* heap/WriteBarrierBuffer.cpp: Removed.
* heap/WriteBarrierBuffer.h: Removed.
* jit/JITOperations.cpp:
* jit/JITOperations.h:
* runtime/JSCellInlines.h:
(JSC::JSCell::JSCell):
* runtime/StructureIDBlob.h:
(JSC::StructureIDBlob::StructureIDBlob):

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

3 years ago:active and :hover states may not be updated across slots
rniwa@webkit.org [Tue, 10 Jan 2017 23:34:51 +0000 (23:34 +0000)]
:active and :hover states may not be updated across slots
https://bugs.webkit.org/show_bug.cgi?id=166881
<rdar://problem/29944582>

Reviewed by Antti Koivisto.

Source/WebCore:

The bug was caused by updateHoverActiveState not updating :hover and :active states on elements
when nodes are assigned to slots because they were walking up the tree using parentOrShadowHostElement
and parentNode. Fixed the bug by using parentElementInComposedTree instead since :hover and :active
states need to be updated in accordance with the render tree, which is created from the "flat tree"
or the "composed tree" in WebKit's terminology (this is old terminology in the spec).

Tests: fast/shadow-dom/clear-active-state-in-shadow.html
       fast/shadow-dom/hover-over-nested-slotted-content.html

* dom/Document.cpp:
(WebCore::Document::updateHoverActiveState): Fixed the bug.
* dom/Node.cpp:
(WebCore::Node::parentElementInComposedTree): Added.
* dom/Node.h:

LayoutTests:

Added two regression tests; one for clearing :active state across a slot, and another one for clearing
a hover state on an ancestor of a slot to which a slot with the hovered element is assigned.

* fast/shadow-dom/clear-active-state-in-shadow-expected.html: Added.
* fast/shadow-dom/clear-active-state-in-shadow.html: Added.
* fast/shadow-dom/hover-over-nested-slotted-content-expected.html: Added.
* fast/shadow-dom/hover-over-nested-slotted-content.html: Added.
* platform/ios-simulator/TestExpectations:

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

3 years agoProperty setters should not be called for bound arguments list entries.
mark.lam@apple.com [Tue, 10 Jan 2017 23:17:42 +0000 (23:17 +0000)]
Property setters should not be called for bound arguments list entries.
https://bugs.webkit.org/show_bug.cgi?id=165631

Reviewed by Filip Pizlo.

JSTests:

* stress/property-setters-should-not-be-called-for-bound-arguments-list-entries.js: Added.

Source/JavaScriptCore:

* builtins/FunctionPrototype.js:
(bind):
- use @putByValDirect to set the bound arguments so that we don't consult the
  prototype chain for setters.

* runtime/IntlDateTimeFormatPrototype.cpp:
(JSC::IntlDateTimeFormatPrototypeGetterFormat):
* runtime/IntlNumberFormatPrototype.cpp:
(JSC::IntlNumberFormatPrototypeGetterFormat):
- no need to create a bound arguments array because these bound functions binds
  no arguments according to the spec.

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

3 years agoMissing logging in IconLoader::startLoading
krollin@apple.com [Tue, 10 Jan 2017 23:09:44 +0000 (23:09 +0000)]
Missing logging in IconLoader::startLoading
https://bugs.webkit.org/show_bug.cgi?id=166904

Reviewed by Sam Weinig.

The LOG_ERROR in startLoading references 'resourceRequest', which has
been WTF::Moved as part of a preceding function call. As such, the
logging statement doesn't print out a possibly useful URL. Fix this by
making a copy of the URL before it's affected by the Move.

No new tests -- change only affects logging code.

* loader/icon/IconLoader.cpp:
(WebCore::IconLoader::startLoading):

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

3 years agoRecord/replay: fix range used for fuzzy matching
krollin@apple.com [Tue, 10 Jan 2017 22:31:06 +0000 (22:31 +0000)]
Record/replay: fix range used for fuzzy matching
https://bugs.webkit.org/show_bug.cgi?id=166041

Reviewed by Darin Adler and Alex Christensen.

Because of two bugs, the attempt to determine the range of URLs to
check as part of the process of fuzzy matching was failing. The intent
was to find the range of URLs that started with the same
<scheme://host:port> as a given URL. However, because of a reversed
test, the upper end of the range ended up being the "end()" iterator
of the entire collection of URLs. With that fixed, there was another
bug due to one URL being given as <scheme://host:port> and the other
given as <scheme://host:port/> (note the trailing slash). Both of
these issues are now fixed.

* NetworkProcess/capture/NetworkCaptureManager.cpp:
(WebKit::NetworkCapture::Manager::initialize):
(WebKit::NetworkCapture::Manager::findBestFuzzyMatch):
(WebKit::NetworkCapture::Manager::urlIdentifyingCommonDomain):
* NetworkProcess/capture/NetworkCaptureManager.h:
* NetworkProcess/capture/NetworkCaptureResource.cpp:
(WebKit::NetworkCapture::Resource::url):
(WebKit::NetworkCapture::Resource::urlIdentifyingCommonDomain):
(WebKit::NetworkCapture::Resource::baseURL): Deleted.
* NetworkProcess/capture/NetworkCaptureResource.h:

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

3 years agoImplement "proximity" scroll snapping
wenson_hsieh@apple.com [Tue, 10 Jan 2017 22:26:56 +0000 (22:26 +0000)]
Implement "proximity" scroll snapping
https://bugs.webkit.org/show_bug.cgi?id=135994
<rdar://problem/18162418>

Reviewed by Dean Jackson.

Source/WebCore:

Adds support for proximity scroll snapping. To do this, we introduce scroll offset ranges, a list of scroll
offset ranges that are plumbed alongside the list of scroll snap offsets. Similar to a snap offset, a snap
offset range contains scroll offsets on which scrolling is allowed to come to a rest within a scroll snapping
container. However, unlike normal snap offsets, scrolling may only come to rest within a snap offset range if
the predicted scroll offset already lies within the range. The new algorithm for selecting a target scroll snap
position given a destination offset is now:

-   If the scroll destination lies within a snap offset range, return the scroll destination
-   Otherwise, compute the nearest lower/upper snap offsets and lower/upper snap offset ranges
-   If scrolling ended with no velocity, return the nearest snap offset
-   If scrolling ended with positive velocity, choose the upper snap offset only if there is no snap offset
    range in between the scroll destination and the snap offset; else, choose the lower snap offset
-   If scrolling ended with negative velocity, choose the lower snap offset only if there is no snap offset
    range in between the scroll destination and the snap offset; else, choose the upper snap offset

The extra rule accounting for scroll offset ranges in between the scroll destination and a potential snap offset
handles the corner case where the user scrolls with momentum very lightly away from a snap offset, such that the
predicted scroll destination is still within proximity of the snap offset. In this case, the regular (mandatory
scroll snapping) behavior would be to snap to the next offset in the direction of momentum scrolling, but
instead, it is more intuitive to return to the original snap position.

We also move scrolling prediction logic into ScrollingMomentumCalculator and adopt the platform
_NSScrollingMomentumCalculator's destinationOrigin property when computing the predicted scroll destination.
Previously, we were simply multiplying by an empirically-derived constant to approximate the scroll destination,
but now that we are supporting proximity scroll snapping, we need more exact scroll destinaton prediction in
order to make sure that scrolling to a snap offset range feels natural.

Tests: tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-then-proximity.html
       tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-mainframe.html
       tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-overflow.html

* WebCore.xcodeproj/project.pbxproj:
* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::setStateScrollingNodeSnapOffsetsAsFloat):
(WebCore::AsyncScrollingCoordinator::updateOverflowScrollingNode):
(WebCore::AsyncScrollingCoordinator::updateScrollSnapPropertiesWithFrameView):

Make boilerplate changes to plumb lists of horizontal and vertical snap offset ranges alongside the lists of
horizontal and vertical snap offsets.

* page/scrolling/AxisScrollSnapOffsets.cpp:
(WebCore::snapOffsetRangesToString):
(WebCore::indicesOfNearestSnapOffsetRanges):
(WebCore::indicesOfNearestSnapOffsets):
(WebCore::adjustAxisSnapOffsetsForScrollExtent):
(WebCore::computeAxisProximitySnapOffsetRanges):
(WebCore::updateSnapOffsetsForScrollableArea):
(WebCore::closestSnapOffset):

Adjust the snap offset selection algorithm to take snap offset ranges into account. See above for more details.
Additionally, augment snap offset update logic to emit snap offset ranges for proximity scroll snapping. To do
this, we run the following steps on the final list of processed snap offsets:
-   Compute the proximity distance, which (for now) is arbitrarily 0.3 * the length or width of the scroll snap
    port, depending on whether scroll snapping is taking place in the X or Y axis.
-   For each pair of adjacent snap offsets, if they are more than 2 * proximity distance away from each other,
    emit a snap offset range starting from (lower snap offset + proximity distance) and ending on (upper snap
    offset + proximity distance).

* page/scrolling/AxisScrollSnapOffsets.h:
(WebCore::closestSnapOffset): Deleted.
* page/scrolling/ScrollSnapOffsetsInfo.h:

Introduce ScrollSnapOffsetsInfo, a struct which contains data relevant to scroll snapping. This includes
vertical and horizontal snap offsets, as well as vertical and horizontal snap offset ranges. Snap offset ranges
consist of a vector of ranges of scroll offsets.

* page/scrolling/ScrollingCoordinator.h:
* page/scrolling/ScrollingMomentumCalculator.cpp:
(WebCore::projectedInertialScrollDistance):
(WebCore::ScrollingMomentumCalculator::ScrollingMomentumCalculator):
(WebCore::ScrollingMomentumCalculator::setRetargetedScrollOffset):
(WebCore::ScrollingMomentumCalculator::predictedDestinationOffset):
(WebCore::ScrollingMomentumCalculator::create):
(WebCore::ScrollingMomentumCalculator::setPlatformMomentumScrollingPredictionEnabled):
(WebCore::BasicScrollingMomentumCalculator::BasicScrollingMomentumCalculator):
(WebCore::BasicScrollingMomentumCalculator::linearlyInterpolatedOffsetAtProgress):
(WebCore::BasicScrollingMomentumCalculator::initializeInterpolationCoefficientsIfNecessary):
(WebCore::BasicScrollingMomentumCalculator::initializeSnapProgressCurve):
* page/scrolling/ScrollingMomentumCalculator.h:
(WebCore::ScrollingMomentumCalculator::retargetedScrollOffset):
(WebCore::ScrollingMomentumCalculator::retargetedScrollOffsetDidChange):

Currently, the ScrollingMomentumCalculator is responsible for taking an initial position, initial velocity, and
target position and animating the scroll offset from the initial to target position. Now, we refactor the
ScrollingMomentumCalculator interface to no longer take a target offset upon initialization, and instead compute
the predicted scroll destination given initial position and velocity; clients of the ScrollingMomentumCalculator
then use this predicted scroll destination to compute a retargeted scroll offset and then call
setRetargetedScrollOffset on the calculator, which sets up an animation curve to the new retargeted offset. This
allows both the AppKit-based scrolling momentum calculator and platform-invariant momentum calculator to be used
interchangeably, while still allowing them to compute a destination offset from initial parameters of the
scroll.

* page/scrolling/ScrollingStateScrollingNode.cpp:
(WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
(WebCore::ScrollingStateScrollingNode::setHorizontalSnapOffsets):
(WebCore::ScrollingStateScrollingNode::setVerticalSnapOffsets):
(WebCore::ScrollingStateScrollingNode::setHorizontalSnapOffsetRanges):
(WebCore::ScrollingStateScrollingNode::setVerticalSnapOffsetRanges):
* page/scrolling/ScrollingStateScrollingNode.h:
(WebCore::ScrollingStateScrollingNode::horizontalSnapOffsets):
(WebCore::ScrollingStateScrollingNode::verticalSnapOffsets):
(WebCore::ScrollingStateScrollingNode::horizontalSnapOffsetRanges):
(WebCore::ScrollingStateScrollingNode::verticalSnapOffsetRanges):
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
(WebCore::ScrollingTreeScrollingNode::dumpProperties):
* page/scrolling/ScrollingTreeScrollingNode.h:
(WebCore::ScrollingTreeScrollingNode::horizontalSnapOffsets):
(WebCore::ScrollingTreeScrollingNode::verticalSnapOffsets):
(WebCore::ScrollingTreeScrollingNode::horizontalSnapOffsetRanges):
(WebCore::ScrollingTreeScrollingNode::verticalSnapOffsetRanges):

Add more boilerplate support for snap offset ranges.

* page/scrolling/mac/ScrollingMomentumCalculatorMac.h:
* page/scrolling/mac/ScrollingMomentumCalculatorMac.mm:
(WebCore::ScrollingMomentumCalculator::create):
(WebCore::ScrollingMomentumCalculator::setPlatformMomentumScrollingPredictionEnabled):
(WebCore::ScrollingMomentumCalculatorMac::ScrollingMomentumCalculatorMac):
(WebCore::ScrollingMomentumCalculatorMac::scrollOffsetAfterElapsedTime):
(WebCore::ScrollingMomentumCalculatorMac::predictedDestinationOffset):
(WebCore::ScrollingMomentumCalculatorMac::retargetedScrollOffsetDidChange):
(WebCore::ScrollingMomentumCalculatorMac::animationDuration):
(WebCore::ScrollingMomentumCalculatorMac::requiresMomentumScrolling):
(WebCore::ScrollingMomentumCalculatorMac::ensurePlatformMomentumCalculator):

Hook into AppKit momentum scroll offset prediction.

* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
(WebCore::convertToLayoutUnits):
(WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::ensureSnapOffsetsInfo):
(WebCore::ScrollableArea::horizontalSnapOffsets):
(WebCore::ScrollableArea::horizontalSnapOffsetRanges):
(WebCore::ScrollableArea::verticalSnapOffsetRanges):
(WebCore::ScrollableArea::verticalSnapOffsets):
(WebCore::ScrollableArea::setHorizontalSnapOffsets):
(WebCore::ScrollableArea::setVerticalSnapOffsets):
(WebCore::ScrollableArea::setHorizontalSnapOffsetRanges):
(WebCore::ScrollableArea::setVerticalSnapOffsetRanges):
(WebCore::ScrollableArea::clearHorizontalSnapOffsets):
(WebCore::ScrollableArea::clearVerticalSnapOffsets):
* platform/ScrollableArea.h:
(WebCore::ScrollableArea::horizontalSnapOffsets): Deleted.
(WebCore::ScrollableArea::verticalSnapOffsets): Deleted.
* platform/cocoa/ScrollController.h:
* platform/cocoa/ScrollController.mm:
(WebCore::ScrollController::processWheelEventForScrollSnap):

Fix an issue where initial scrolling velocity would be set to zero at the end of a drag gesture.

(WebCore::ScrollController::updateScrollSnapState):
(WebCore::ScrollController::updateScrollSnapPoints):
(WebCore::ScrollController::setNearestScrollSnapIndexForAxisAndOffset):
* platform/cocoa/ScrollSnapAnimatorState.h:
(WebCore::ScrollSnapAnimatorState::snapOffsetsForAxis):
(WebCore::ScrollSnapAnimatorState::snapOffsetRangesForAxis):
(WebCore::ScrollSnapAnimatorState::setSnapOffsetsAndPositionRangesForAxis):
(WebCore::ScrollSnapAnimatorState::setSnapOffsetsForAxis): Deleted.
* platform/cocoa/ScrollSnapAnimatorState.mm:
(WebCore::ScrollSnapAnimatorState::setupAnimationForState):
(WebCore::ScrollSnapAnimatorState::targetOffsetForStartOffset):
(WebCore::projectedInertialScrollDistance): Deleted.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
* testing/Internals.cpp:
(WebCore::Internals::setPlatformMomentumScrollingPredictionEnabled):

Add a new hook for layout tests to force scrolling momentum calculators to use the platform-invariant momentum
scrolling prediction heuristic instead of the platform-dependent one.

(WebCore::Internals::scrollSnapOffsets):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit2:

Adds boilerplate support for plumbing lists of snap offset ranges from the web process to the UI process
alongside the list of snap offsets.

* Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp:
(ArgumentCoder<ScrollingStateScrollingNode>::encode):
(ArgumentCoder<ScrollingStateScrollingNode>::decode):
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<ScrollOffsetRange<float>>::encode):
(IPC::ArgumentCoder<ScrollOffsetRange<float>>::decode):
* Shared/WebCoreArgumentCoders.h:
* UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
(-[WKOverflowScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
* UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:

Adjust mainframe proximity scroll snapping logic to not subtract out the top content inset when there is no
active snap offset (i.e. when snapping rests in a snap offset range). Attempting to subtract out the top inset
in this case caused the scroll offset to jump after ending a drag with no momentum in a snap offset range.

(WebKit::RemoteScrollingCoordinatorProxy::adjustTargetContentOffsetForSnapping):
(WebKit::RemoteScrollingCoordinatorProxy::shouldSnapForMainFrameScrolling):
(WebKit::RemoteScrollingCoordinatorProxy::closestSnapOffsetForMainFrameScrolling):

LayoutTests:

Adds 3 new layout tests for proximity scroll snapping. Also tweaks some existing tests that test scroll snapping
after scrolling with momentum to use the custom heuristic for predicting scroll destination instead of platform
momentum scrolling. This ensures that the results of our layout tests that depend on predicting momentum scroll
destination are consistent across runs.

* tiled-drawing/scrolling/latched-div-with-scroll-snap.html:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-iframe.html:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-borders.html:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-hidden-scrollbars.html:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal.html:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-slow-horizontal.html:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-slow-vertical.html:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-then-horizontal.html:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical.html:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-overflow-stateless.html:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-overflow.html:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-padding.html:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-rotated.html:

Force these tests to use platform-independent scrolling momentum prediction, by multiplying the last scroll
delta upon release by a constant factor.

* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-then-proximity-expected.txt: Added.
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-then-proximity.html: Added.

Tests that after changing scroll-snap-type from mandatory to proximity, swiping downwards no longer snaps the
scroll offset to the second box, but instead leaves the scroll offset somewhere in the middle of the first box.

* tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-mainframe-expected.txt: Added.
* tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-mainframe.html: Added.

Tests that when scroll-snap-type is proximity in the mainframe, scrolling slightly downwards snaps the scroll
offset back up to the top; scrolling somewhere in the middle of the first box does not snap the scroll offset;
and scrolling near the end of the first box snaps the scroll offset to the second box.

* tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-overflow-expected.txt: Added.
* tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-overflow.html: Added.

Similar to scroll-snap-proximity-mainframe.html, except for overflow scrolling instead of the mainframe.

* tiled-drawing/scrolling/scroll-snap/scroll-snap-scrolling-jumps-to-top.html:

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

3 years agoMake Event.initEvent()'s first parameter mandatory
cdumez@apple.com [Tue, 10 Jan 2017 21:59:15 +0000 (21:59 +0000)]
Make Event.initEvent()'s first parameter mandatory
https://bugs.webkit.org/show_bug.cgi?id=166894

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline existing W3C test now that we're closing to the specification.

* web-platform-tests/dom/interfaces-expected.txt:

Source/WebCore:

Make Event.initEvent()'s first parameter mandatory. As per the
specification, all parameters should be mandatory and we are
currently dicussing the possibility of making them optional in
the specification. However, having the first parameter optional
makes little sense as it would set the event's type to the string
"undefined".

Test: fast/events/initEvent-parameters.html

* dom/Event.idl:

LayoutTests:

Add layout test coverage.

* fast/events/initEvent-parameters-expected.txt: Added.
* fast/events/initEvent-parameters.html: Added.

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

3 years agoCalling async arrow function which is in a class's member function will cause error
gskachkov@gmail.com [Tue, 10 Jan 2017 21:13:33 +0000 (21:13 +0000)]
Calling async arrow function which is in a class's member function will cause error
https://bugs.webkit.org/show_bug.cgi?id=166879

Reviewed by Saam Barati.

JSTests:

* stress/async-arrow-functions-lexical-binding-in-class.js: Added.
(shouldBe):
(shouldBeAsync):
(BaseClass.prototype.baseClassValue):
(BaseClass.prototype.get property):
(BaseClass):
(runSomething):
(ChildClass.prototype.classValue):
(ChildClass.prototype.get classProperty):
(ChildClass.prototype.asyncValueExp):
(ChildClass.prototype.asyncValueBody):
(ChildClass.prototype.asyncThisPropExp):
(ChildClass.prototype.asyncThisPropBody):
(ChildClass.prototype.asyncThisPropInEvalExp):
(ChildClass.prototype.asyncThisPropInEvalBody):
(ChildClass.prototype.asyncThisValueExp):
(ChildClass.prototype.asyncThisValueBody):
(ChildClass.prototype.asyncThisValueInEvalExp):
(ChildClass.prototype.asyncThisValueInEvalBody):
(ChildClass):
(ChildClass2):
(ChildClass2.prototype.classValue):
(ChildClass2.prototype.get classProperty):
* stress/async-arrow-functions-lexical-super-binding.js:

Source/JavaScriptCore:

Current patch fixed loading 'super' in async arrow function. Errored appear becuase
super was loaded always nevertherless if it used in async arrow function or not, but bytecompiler
put to arrow function context only if it used within arrow function. So to fix this issue we need to
check if super was used in arrow function.

* bytecompiler/BytecodeGenerator.h:
* bytecompiler/NodesCodegen.cpp:
(JSC::FunctionNode::emitBytecode):

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

3 years agoUnreviewed, rolling out r210537.
ryanhaddad@apple.com [Tue, 10 Jan 2017 20:42:25 +0000 (20:42 +0000)]
Unreviewed, rolling out r210537.
https://bugs.webkit.org/show_bug.cgi?id=166903

This change introduced JSC test failures (Requested by
ryanhaddad on #webkit).

Reverted changeset:

"Implement JSSourceCode to propagate SourceCode in module
pipeline"
https://bugs.webkit.org/show_bug.cgi?id=166861
http://trac.webkit.org/changeset/210537

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

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

3 years agoREGRESSION(r189555): ImageDocument title no longer includes the size of the image
cdumez@apple.com [Tue, 10 Jan 2017 20:12:18 +0000 (20:12 +0000)]
REGRESSION(r189555): ImageDocument title no longer includes the size of the image
https://bugs.webkit.org/show_bug.cgi?id=166876
<rdar://problem/29939970>

Reviewed by Ryosuke Niwa.

Add a code comment to clarify fix that was made in r210536.

* html/ImageDocument.cpp:
(WebCore::ImageDocument::createDocumentStructure):

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

3 years agoAdd support for MediaKeys.generateRequest().
jer.noble@apple.com [Tue, 10 Jan 2017 20:09:21 +0000 (20:09 +0000)]
Add support for MediaKeys.generateRequest().
https://bugs.webkit.org/show_bug.cgi?id=166880

Reviewed by Xabier Rodriguez-Calvar.

Source/WebCore:

Test: media/encrypted-media/mock-MediaKeySession-generateRequest.html

Implement MediaKeySession::generateRequest(). This requires some additions
to CDM, CDMPrivate, and CDMInstance to support platform adoption and to
implement mock support for testing. Additionally, add an InitDataRegistry
object which can sanitize and extract key data from various initData types.
(At the moment, only the "keyids" initData type is implemented.)

Drive-by fixes: Change all instances of initDataType from String -> AtomicString.
Add "const" flags to all CDMPrivate methods that might be called from a const
reference.

* CMakeLists.txt:
* Modules/encryptedmedia/CDM.cpp:
(WebCore::CDM::supportsInitDataType):
(WebCore::CDM::sanitizeInitData):
(WebCore::CDM::supportsInitData):
* Modules/encryptedmedia/CDM.h:
* Modules/encryptedmedia/CDMInstance.h:
* Modules/encryptedmedia/CDMPrivate.h:
* Modules/encryptedmedia/InitDataRegistry.cpp: Added.
(WebCore::extractKeyIDsKeyids):
(WebCore::sanitizeKeyids):
(WebCore::sanitizeCenc):
(WebCore::extractKeyIDsCenc):
(WebCore::sanitizeWebM):
(WebCore::extractKeyIDsWebM):
(WebCore::InitDataRegistry::shared):
(WebCore::InitDataRegistry::InitDataRegistry):
(WebCore::InitDataRegistry::sanitizeInitData):
(WebCore::InitDataRegistry::extractKeyIDs):
(WebCore::InitDataRegistry::registerInitDataType):
* Modules/encryptedmedia/InitDataRegistry.h:
* Modules/encryptedmedia/MediaKeySession.cpp:
(WebCore::messageEventName):
(WebCore::MediaKeySession::MediaKeySession):
(WebCore::MediaKeySession::generateRequest):
(WebCore::MediaKeySession::enqueueMessage):
* Modules/encryptedmedia/MediaKeySession.h:
* Modules/encryptedmedia/MediaKeys.cpp:
(WebCore::MediaKeys::setServerCertificate):
* WebCore.xcodeproj/project.pbxproj:
* testing/MockCDMFactory.cpp:
(WebCore::MockCDMFactory::addKeysToSessionWithID):
(WebCore::MockCDMFactory::setSupportedDataTypes):
(WebCore::MockCDM::supportsInitDataType):
(WebCore::MockCDM::supportsConfiguration):
(WebCore::MockCDM::supportsConfigurationWithRestrictions):
(WebCore::MockCDM::supportsSessionTypeWithConfiguration):
(WebCore::MockCDM::supportsRobustness):
(WebCore::MockCDM::distinctiveIdentifiersRequirement):
(WebCore::MockCDM::persistentStateRequirement):
(WebCore::MockCDM::distinctiveIdentifiersAreUniquePerOriginAndClearable):
(WebCore::MockCDM::supportsInitData):
(WebCore::MockCDMInstance::setServerCertificate):
(WebCore::MockCDMInstance::requestLicense):
* testing/MockCDMFactory.h:
(WebCore::MockCDMFactory::supportedDataTypes):
(WebCore::MockCDMFactory::hasSessionWithID):
(WebCore::MockCDMFactory::removeSessionWithID):
(WebCore::MockCDMFactory::setSupportedDataTypes): Deleted.

LayoutTests:

Add shouldResolve() and shouldReject() to video-test.js and update existing
tests to use these new functions.

* media/encrypted-media/mock-MediaKeys-createSession-expected.txt: Added.
* media/encrypted-media/mock-MediaKeys-createSession.html: Added.
* media/encrypted-media/mock-MediaKeys-setServerCertificate.html:
* media/encrypted-media/mock-MediaKeySession-generateRequest.html:
* media/encrypted-media/mock-MediaKeySystemAccess.html:
* media/encrypted-media/mock-navigator-requestMediaKeySystemAccess.html:
* media/video-test.js:
(shouldResolve):
(shouldReject):
* platform/mac/TestExpectations:

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

3 years agoUnreviewed, rolling out r210540.
commit-queue@webkit.org [Tue, 10 Jan 2017 19:13:06 +0000 (19:13 +0000)]
Unreviewed, rolling out r210540.
https://bugs.webkit.org/show_bug.cgi?id=166896

too crude for non-WebCore clients (Requested by kling on
#webkit).

Reverted changeset:

"Crash when GC heap grows way too large."
https://bugs.webkit.org/show_bug.cgi?id=166875
http://trac.webkit.org/changeset/210540

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

3 years agoJSArray has some object scanning races
fpizlo@apple.com [Tue, 10 Jan 2017 18:44:45 +0000 (18:44 +0000)]
JSArray has some object scanning races
https://bugs.webkit.org/show_bug.cgi?id=166874

Reviewed by Mark Lam.

This fixes two separate bugs, both of which I detected by running
array-splice-contiguous.js in extreme anger:

1) Some of the paths of shifting and unshifting were not grabbing the internal cell
   lock. This was causing the array storage scan to crash, even though it was well
   synchronized (the scan does hold the lock). The fix is just to hold the lock anywhere
   that memmoves the innards of the butterfly.

2) Out of line property scanning was synchronized using double collect snapshot. Array
   storage scanning was synchronized using locks. But what if array storage
   transformations messed up the out of line properties? It turns out that we actually
   need to hoist the array storage scanner's locking up into the double collect
   snapshot.

I don't know how to write a test that does any better of a job of catching this than
array-splice-contiguous.js.

* heap/DeferGC.h: Make DisallowGC usable even if NDEBUG.
* runtime/JSArray.cpp:
(JSC::JSArray::unshiftCountSlowCase):
(JSC::JSArray::shiftCountWithArrayStorage):
(JSC::JSArray::unshiftCountWithArrayStorage):
* runtime/JSObject.cpp:
(JSC::JSObject::visitButterflyImpl):

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

3 years agoAdd support for MediaKeys.createSession().
jer.noble@apple.com [Tue, 10 Jan 2017 18:41:31 +0000 (18:41 +0000)]
Add support for MediaKeys.createSession().
https://bugs.webkit.org/show_bug.cgi?id=166796

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/encrypted-media/mock-MediaKeys-createSession.html

Implement MediaKeys::createSession(). This requires some additions to
CDM, CDMPrivate, and CDMInstance to support platform adoption and to
implement mock support for testing. Because the CDMInstance will now
be shared between MediaKeys and MediaKeySession, it cannot be a unique_ptr.
Make CDMInterface ref-counted and store it as a Ref.

* Modules/encryptedmedia/CDM.cpp:
(WebCore::CDM::createInstance):
(WebCore::CDM::supportsSessions):
* Modules/encryptedmedia/CDM.h:
* Modules/encryptedmedia/CDMInstance.h:
* Modules/encryptedmedia/CDMPrivate.h:
* Modules/encryptedmedia/MediaKeySession.cpp:
(WebCore::MediaKeySession::create):
(WebCore::MediaKeySession::MediaKeySession):
(WebCore::MediaKeySession::sessionId):
(WebCore::MediaKeySession::expiration):
(WebCore::MediaKeySession::keyStatuses):
* Modules/encryptedmedia/MediaKeySession.h:
* Modules/encryptedmedia/MediaKeySessionType.idl:
* Modules/encryptedmedia/MediaKeySystemAccess.cpp:
(WebCore::MediaKeySystemAccess::createMediaKeys):
* Modules/encryptedmedia/MediaKeys.cpp:
(WebCore::MediaKeys::MediaKeys):
(WebCore::MediaKeys::createSession):
* Modules/encryptedmedia/MediaKeys.h:
(WebCore::MediaKeys::create):
* Modules/encryptedmedia/MediaKeys.idl:

LayoutTests:

* media/encrypted-media/mock-MediaKeys-createSession-expected.txt: Added.
* media/encrypted-media/mock-MediaKeys-createSession.html: Added.
* platform/mac/TestExpectations:

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

3 years agosvn-apply failed to apply a patch (deleting file with svn property)
jbedard@apple.com [Tue, 10 Jan 2017 18:05:07 +0000 (18:05 +0000)]
svn-apply failed to apply a patch (deleting file with svn property)
https://bugs.webkit.org/show_bug.cgi?id=165953

Reviewed by Daniel Bates.

* Scripts/VCSUtils.pm:
(parseSvnPropertyValue): The beginning of a diff will cause an early exit in the case of no empty newlines.
* Scripts/webkitperl/VCSUtils_unittest/parseSvnProperty.pl: Add tests without break between diffs for properties.

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