WebKit-https.git
3 years agobmalloc: Rename SmallPage to SmallRun
ggaren@apple.com [Thu, 10 Mar 2016 21:41:17 +0000 (21:41 +0000)]
bmalloc: Rename SmallPage to SmallRun
https://bugs.webkit.org/show_bug.cgi?id=155320

Reviewed by Alex Christensen.

A page is a fixed-size set of lines.

A run is an variable-sized set of lines.

We want to start using runs because:

    (a) we want to support varying the hardware page size by OS;

    (b) we want to support allocations larger than our current page size.

* bmalloc.xcodeproj/project.pbxproj:
* bmalloc/Allocator.cpp:
(bmalloc::Allocator::reallocate):
* bmalloc/Heap.cpp:
(bmalloc::Heap::Heap):
(bmalloc::Heap::initializeSmallRunMetadata):
(bmalloc::Heap::scavenge):
(bmalloc::Heap::scavengeSmallRuns):
(bmalloc::Heap::allocateSmallBumpRanges):
(bmalloc::Heap::allocateSmallRun):
(bmalloc::Heap::deallocateSmallLine):
(bmalloc::Heap::initializeLineMetadata): Deleted.
(bmalloc::Heap::scavengeSmallPages): Deleted.
(bmalloc::Heap::allocateSmallPage): Deleted.
* bmalloc/Heap.h:
* bmalloc/LineMetadata.h:
* bmalloc/SmallChunk.h:
(bmalloc::SmallChunk::begin):
(bmalloc::SmallChunk::end):
(bmalloc::SmallChunk::lines):
(bmalloc::SmallChunk::runs):
(bmalloc::SmallChunk::SmallChunk):
(bmalloc::SmallLine::end):
(bmalloc::SmallRun::get):
(bmalloc::SmallRun::begin):
(bmalloc::SmallRun::end):
(bmalloc::SmallChunk::pages): Deleted.
(bmalloc::SmallPage::get): Deleted.
(bmalloc::SmallPage::begin): Deleted.
(bmalloc::SmallPage::end): Deleted.
* bmalloc/SmallPage.h: Removed.
* bmalloc/SmallRun.h: Copied from Source/bmalloc/bmalloc/SmallPage.h.
(bmalloc::SmallRun::SmallRun):
(bmalloc::SmallRun::ref):
(bmalloc::SmallRun::deref):
(bmalloc::SmallPage::SmallPage): Deleted.
(bmalloc::SmallPage::ref): Deleted.
(bmalloc::SmallPage::deref): Deleted.
* bmalloc/VMHeap.cpp:
(bmalloc::VMHeap::allocateSmallChunk):
(bmalloc::VMHeap::allocateLargeChunk):
* bmalloc/VMHeap.h:
(bmalloc::VMHeap::allocateSmallRun):
(bmalloc::VMHeap::allocateLargeObject):
(bmalloc::VMHeap::deallocateSmallRun):
(bmalloc::VMHeap::deallocateLargeObject):
(bmalloc::VMHeap::allocateSmallPage): Deleted.
(bmalloc::VMHeap::deallocateSmallPage): Deleted.

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

3 years agoWeb Inspector: JavaScript Heap Allocations Timeline
joepeck@webkit.org [Thu, 10 Mar 2016 21:37:56 +0000 (21:37 +0000)]
Web Inspector: JavaScript Heap Allocations Timeline
https://bugs.webkit.org/show_bug.cgi?id=155287
<rdar://problem/25078088>

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

* inspector/InjectedScriptSource.js:
(InjectedScript.prototype._describe):
(InjectedScript.prototype._nodeDescription):
Provide the nicer node preview more often.

Source/WebInspectorUI:

Initial JavaScript Heap Allocations Timeline includes:

    - Snapshot markers in the timeline
    - Initial/Periodic/End snapshots during recording
    - Ability to manually take a snapshot
    - View of all objects in a Snapshot and Diff between snapshots
      - Summary view - rough display of the size/count of large objects
      - Instances view - view each of the individual objects

* UserInterface/Main.html:
* UserInterface/Test.html:
* UserInterface/Images/Compare.svg: Added.
* UserInterface/Images/HeapSnapshot.svg: Added.
* UserInterface/Images/HeapSnapshotDiff.svg: Added.
* UserInterface/Images/HeapSnapshotInstances.svg: Added.
* UserInterface/Images/HeapSnapshotSummary.svg: Added.
* Localizations/en.lproj/localizedStrings.js:
New resources and strings.

* UserInterface/Controllers/TimelineManager.js:
(WebInspector.TimelineManager.prototype.heapTrackingStarted):
(WebInspector.TimelineManager.prototype.heapTrackingCompleted):
(WebInspector.TimelineManager.prototype.heapSnapshotAdded):
* UserInterface/Protocol/HeapObserver.js:
(WebInspector.HeapObserver.prototype.trackingStart):
(WebInspector.HeapObserver.prototype.trackingComplete):
(WebInspector.HeapObserver):
Add snapshot records to the active recording's timeline.

* UserInterface/Models/HeapAllocationsInstrument.js: Added.
(WebInspector.HeapAllocationsInstrument):
(WebInspector.HeapAllocationsInstrument.supported):
(WebInspector.HeapAllocationsInstrument.prototype.get timelineRecordType):
(WebInspector.HeapAllocationsInstrument.prototype.startInstrumentation):
(WebInspector.HeapAllocationsInstrument.prototype.stopInstrumentation):
(WebInspector.HeapAllocationsInstrument.prototype._takeHeapSnapshot):
Start, stop, and periodic snapshots.

* UserInterface/Models/HeapAllocationsTimelineRecord.js:
(WebInspector.HeapAllocationsTimelineRecord):
(WebInspector.HeapAllocationsTimelineRecord.prototype.get timestamp):
(WebInspector.HeapAllocationsTimelineRecord.prototype.get heapSnapshot):
* UserInterface/Models/TimelineRecord.js:
* UserInterface/Models/TimelineRecording.js:
(WebInspector.TimelineRecording):
(WebInspector.TimelineRecording.prototype.addRecord):
* UserInterface/Views/TimelineOverviewGraph.js:
(WebInspector.TimelineOverviewGraph.createForTimeline):
* UserInterface/Views/TimelineTabContentView.js:
(WebInspector.TimelineTabContentView.displayNameForTimeline):
(WebInspector.TimelineTabContentView.iconClassNameForTimeline):
(WebInspector.TimelineTabContentView.genericClassNameForTimeline):
(WebInspector.TimelineTabContentView.iconClassNameForRecord):
(WebInspector.TimelineTabContentView.displayNameForRecord):
New timeline and record type.

* UserInterface/Models/HeapSnapshotDiff.js: Added.
(WebInspector.HeapSnapshotDiff):
(WebInspector.HeapSnapshotDiff.prototype.get snapshot1):
(WebInspector.HeapSnapshotDiff.prototype.get snapshot2):
(WebInspector.HeapSnapshotDiff.prototype.get addedInstances):
(WebInspector.HeapSnapshotDiff.prototype.get removedInstances):
(WebInspector.HeapSnapshotDiff.prototype.get sizeDifference):
(WebInspector.HeapSnapshotDiff.prototype.get growth):
(WebInspector.HeapSnapshotDiff.prototype.snapshotForDiff):
Compare two snapshots and create a "diff snapshot" which is just
the newly added objects.

* UserInterface/Views/ContentView.js:
(WebInspector.ContentView.createFromRepresentedObject):
(WebInspector.ContentView.isViewable):
A HeapSnapshot creates a HeapSnapshotClusterView.

* UserInterface/Views/HeapAllocationsTimelineDataGridNode.js: Added.
(WebInspector.HeapAllocationsTimelineDataGridNode):
(WebInspector.HeapAllocationsTimelineDataGridNode.prototype.get record):
(WebInspector.HeapAllocationsTimelineDataGridNode.prototype.get data):
(WebInspector.HeapAllocationsTimelineDataGridNode.prototype.createCellContent):
(WebInspector.HeapAllocationsTimelineDataGridNode.prototype.markAsBaseline):
(WebInspector.HeapAllocationsTimelineDataGridNode.prototype.clearBaseline):
* UserInterface/Views/HeapAllocationsTimelineOverviewGraph.css: Copied from Source/WebInspectorUI/UserInterface/Protocol/HeapObserver.js.
(.timeline-overview-graph.heap-allocations):
(.timeline-overview-graph.heap-allocations > img.snapshot):
* UserInterface/Views/HeapAllocationsTimelineOverviewGraph.js: Added.
(WebInspector.HeapAllocationsTimelineOverviewGraph):
(WebInspector.HeapAllocationsTimelineOverviewGraph.prototype.reset):
(WebInspector.HeapAllocationsTimelineOverviewGraph.prototype.layout.xScale):
(WebInspector.HeapAllocationsTimelineOverviewGraph.prototype.layout):
(WebInspector.HeapAllocationsTimelineOverviewGraph.prototype._visibleRecords):
(WebInspector.HeapAllocationsTimelineOverviewGraph.prototype._heapAllocationTimelineRecordAdded):
* UserInterface/Views/HeapAllocationsTimelineView.css: Copied from Source/WebInspectorUI/UserInterface/Protocol/HeapObserver.js.
(.timeline-view.heap-allocations > .data-grid):
(.timeline-view.heap-allocations > .data-grid td .icon.heap-snapshot):
(.timeline-view.heap-allocations > .data-grid tr.baseline):
(.timeline-view.heap-allocations > .content-view-container):
(.timeline-view.heap-allocations > .content-view-container > .content-view):
* UserInterface/Views/HeapAllocationsTimelineView.js: Added.
(WebInspector.HeapAllocationsTimelineView):
(WebInspector.HeapAllocationsTimelineView.prototype.showHeapSnapshotList):
(WebInspector.HeapAllocationsTimelineView.prototype.showHeapSnapshotTimelineRecord):
(WebInspector.HeapAllocationsTimelineView.prototype.showHeapSnapshotDiff):
(WebInspector.HeapAllocationsTimelineView.prototype.get navigationItems):
(WebInspector.HeapAllocationsTimelineView.prototype.get selectionPathComponents):
(WebInspector.HeapAllocationsTimelineView.prototype.get navigationSidebarTreeOutlineLabel):
(WebInspector.HeapAllocationsTimelineView.prototype.treeElementPathComponentSelected):
(WebInspector.HeapAllocationsTimelineView.prototype.userSelectedRecordFromOverview):
(WebInspector.HeapAllocationsTimelineView.prototype.closed):
(WebInspector.HeapAllocationsTimelineView.prototype.layout):
(WebInspector.HeapAllocationsTimelineView.prototype.reset):
(WebInspector.HeapAllocationsTimelineView.prototype._heapAllocationsTimelineRecordAdded):
(WebInspector.HeapAllocationsTimelineView.prototype._snapshotListPathComponentClicked):
(WebInspector.HeapAllocationsTimelineView.prototype._snapshotPathComponentSelected):
(WebInspector.HeapAllocationsTimelineView.prototype._currentContentViewDidChange):
(WebInspector.HeapAllocationsTimelineView.prototype._contentViewSelectionPathComponentDidChange):
(WebInspector.HeapAllocationsTimelineView.prototype._updateCompareHeapSnapshotButton):
(WebInspector.HeapAllocationsTimelineView.prototype._takeHeapSnapshotClicked):
(WebInspector.HeapAllocationsTimelineView.prototype._cancelSelectComparisonHeapSnapshots):
(WebInspector.HeapAllocationsTimelineView.prototype._compareHeapSnapshotsClicked):
(WebInspector.HeapAllocationsTimelineView.prototype._dataGridNodeSelected):
* UserInterface/Views/HeapSnapshotClassDataGridNode.js: Added.
(WebInspector.HeapSnapshotClassDataGridNode):
(WebInspector.HeapSnapshotClassDataGridNode.prototype.get data):
(WebInspector.HeapSnapshotClassDataGridNode.prototype.createCellContent):
(WebInspector.HeapSnapshotClassDataGridNode.prototype.sort):
(WebInspector.HeapSnapshotClassDataGridNode.prototype._populate):
(WebInspector.HeapSnapshotClassDataGridNode.prototype._fetchBatch):
(WebInspector.HeapSnapshotClassDataGridNode.prototype._updateBatchedSort):
(WebInspector.HeapSnapshotClassDataGridNode.prototype._updateBatchedChildren):
(WebInspector.HeapSnapshotClassDataGridNode.prototype._removeFetchMoreDataGridNode):
(WebInspector.HeapSnapshotClassDataGridNode.prototype._appendFetchMoreDataGridNode):
* UserInterface/Views/HeapSnapshotClusterContentView.js: Added.
(WebInspector.HeapSnapshotClusterContentView.createPathComponent):
(WebInspector.HeapSnapshotClusterContentView):
(WebInspector.HeapSnapshotClusterContentView.iconStyleClassNameForClassName):
(WebInspector.HeapSnapshotClusterContentView.prototype.get heapSnapshot):
(WebInspector.HeapSnapshotClusterContentView.prototype.get summaryContentView):
(WebInspector.HeapSnapshotClusterContentView.prototype.get instancesContentView):
(WebInspector.HeapSnapshotClusterContentView.prototype.get navigationItems):
(WebInspector.HeapSnapshotClusterContentView.prototype.get selectionPathComponents):
(WebInspector.HeapSnapshotClusterContentView.prototype.shown):
(WebInspector.HeapSnapshotClusterContentView.prototype.closed):
(WebInspector.HeapSnapshotClusterContentView.prototype.saveToCookie):
(WebInspector.HeapSnapshotClusterContentView.prototype.restoreFromCookie):
(WebInspector.HeapSnapshotClusterContentView.prototype.showSummary):
(WebInspector.HeapSnapshotClusterContentView.prototype.showInstances):
(WebInspector.HeapSnapshotClusterContentView.prototype._contentViewExtraArguments):
(WebInspector.HeapSnapshotClusterContentView.prototype._pathComponentForContentView):
(WebInspector.HeapSnapshotClusterContentView.prototype._identifierForContentView):
(WebInspector.HeapSnapshotClusterContentView.prototype._showContentViewForIdentifier):
(WebInspector.HeapSnapshotClusterContentView.prototype._pathComponentSelected):
(WebInspector.HeapSnapshotClusterContentView.prototype._toggleShowInternalObjectsSetting):
(WebInspector.HeapSnapshotClusterContentView.prototype._updateViewsForShowInternalObjectsSettingValue):
(WebInspector.HeapSnapshotClusterContentView.prototype._updateShowInternalObjectsButtonNavigationItem):
* UserInterface/Views/HeapSnapshotInstanceDataGridNode.js: Added.
(WebInspector.HeapSnapshotInstanceDataGridNode):
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype.get data):
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype.get selectable):
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype.createCells):
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype.createCellContent):
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype.sort):
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype._contextMenuHandler.):
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype._contextMenuHandler):
* UserInterface/Views/HeapSnapshotInstanceFetchMoreDataGridNode.js: Added.
(WebInspector.HeapSnapshotInstanceFetchMoreDataGridNode):
(WebInspector.HeapSnapshotInstanceFetchMoreDataGridNode.prototype.createCellContent):
(WebInspector.HeapSnapshotInstanceFetchMoreDataGridNode.prototype.sort):
* UserInterface/Views/HeapSnapshotInstancesContentView.css: Added.
* UserInterface/Views/HeapSnapshotInstancesContentView.js: Added.
(WebInspector.HeapSnapshotInstancesContentView):
(WebInspector.HeapSnapshotInstancesContentView.prototype.get showInternalObjects):
(WebInspector.HeapSnapshotInstancesContentView.prototype.set showInternalObjects):
(WebInspector.HeapSnapshotInstancesContentView.prototype._sortDataGrid):
* UserInterface/Views/HeapSnapshotInstancesDataGridTree.js: Added.
(WebInspector.HeapSnapshotInstancesDataGridTree):
(WebInspector.HeapSnapshotInstancesDataGridTree.buildSortComparator):
(WebInspector.HeapSnapshotInstancesDataGridTree.prototype.get heapSnapshot):
(WebInspector.HeapSnapshotInstancesDataGridTree.prototype.get includeInternalObjects):
(WebInspector.HeapSnapshotInstancesDataGridTree.prototype.set includeInternalObjects):
(WebInspector.HeapSnapshotInstancesDataGridTree.prototype.get children):
(WebInspector.HeapSnapshotInstancesDataGridTree.prototype.appendChild):
(WebInspector.HeapSnapshotInstancesDataGridTree.prototype.insertChild):
(WebInspector.HeapSnapshotInstancesDataGridTree.prototype.removeChildren):
(WebInspector.HeapSnapshotInstancesDataGridTree.prototype.set sortComparator):
(WebInspector.HeapSnapshotInstancesDataGridTree.prototype.sort):
(WebInspector.HeapSnapshotInstancesDataGridTree.prototype._populateTopLevel):
* UserInterface/Views/HeapSnapshotSummaryContentView.css: Added.
* UserInterface/Views/HeapSnapshotSummaryContentView.js: Added.
(WebInspector.HeapSnapshotSummaryContentView.createChartContainer):
(WebInspector.HeapSnapshotSummaryContentView.appendLegendRow):
(WebInspector.HeapSnapshotSummaryContentView.appendEmptyMessage):
(WebInspector.HeapSnapshotSummaryContentView):
(WebInspector.HeapSnapshotSummaryContentView.prototype.layout):
* UserInterface/Views/PathComponentIcons.css:
(.heap-snapshot-summary-icon .icon):
(.heap-snapshot-instances-icon .icon):
(.snapshot-list-icon .icon):
(.snapshot-diff-icon .icon):
(body:not(.mac-platform, .windows-platform) .snapshot-diff-icon .icon):
(body:not(.mac-platform, .windows-platform) .call-trees-icon .icon): Deleted.
* UserInterface/Views/TextNavigationItem.css:
(.navigation-bar .item.text):
* UserInterface/Views/TextNavigationItem.js:
(WebInspector.TextNavigationItem):
(WebInspector.TextNavigationItem.prototype.get text):
(WebInspector.TextNavigationItem.prototype.set text):
* UserInterface/Views/TimelineIcons.css:
(.heap-snapshot-record .icon):
* UserInterface/Views/Variables.css:
(:root):
New views.

* UserInterface/Views/FormattedValue.js:
(WebInspector.FormattedValue.createElementForNodePreview):
(WebInspector.FormattedValue.createElementForFunctionWithName):
(WebInspector.FormattedValue.createObjectPreviewOrFormattedValueForObjectPreview):
Better display for a raw object preview.

* UserInterface/Views/TimelineOverview.js:
(WebInspector.TimelineOverview):
(WebInspector.TimelineOverview.prototype.userSelectedRecord):
* UserInterface/Views/TimelineRecordingContentView.js:
(WebInspector.TimelineRecordingContentView):
(WebInspector.TimelineRecordingContentView.prototype.timelineOverviewUserSelectedRecord):
* UserInterface/Views/TimelineRuler.js:
(WebInspector.TimelineRuler.prototype.set allowsTimeRangeSelection):
(WebInspector.TimelineRuler.prototype._handleClick):
(WebInspector.TimelineRuler.prototype._handleMouseDown):
(WebInspector.TimelineRuler.prototype._handleMouseMove):
* UserInterface/Views/TimelineView.js:
(WebInspector.TimelineView.prototype.userSelectedRecordFromOverview):
Hook up a way for clicking in the TimelineOverview / TimelineRuler
to redispatch to an OverviewGraph element, and provide a patch for
the Overview -> RecordingContentView -> TimelineView for records.

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

3 years agoAdd separate WK and WK2 preferences for requiring user gestures for video media,...
jer.noble@apple.com [Thu, 10 Mar 2016 21:35:10 +0000 (21:35 +0000)]
Add separate WK and WK2 preferences for requiring user gestures for video media, distinct from user gestures for media generally
https://bugs.webkit.org/show_bug.cgi?id=155141

Reviewed by Beth Dakin.

Source/WebCore:

Rename RequireUserGestureForRateChange -> RequireUserGestureForVideoRateChange.
Rename Settings::requiresUserGestureForMediaPlayback -> Settings::videoPlaybackRequiresUserGesture.

Fix longstanding FIXME unifying our behavior restrictions between iOS and Mac.

* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::constructCommon): Rename.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement): Unify behavior restriction behavior.
(WebCore::HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture): Rename.
* html/MediaElementSession.cpp:
(WebCore::restrictionName): Rename.
(WebCore::MediaElementSession::playbackPermitted): Rename.
* html/MediaElementSession.h:
* page/Settings.cpp:
* page/Settings.in:
* testing/Internals.cpp:
(WebCore::Internals::setMediaElementRestrictions): Rename.

Source/WebKit/mac:

Deprecate WebPreferences.mediaPlaybackRequiresUserGesture property in favor of .videoPlaybackRequiresUserGesture.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences mediaPlaybackRequiresUserGesture]):
(-[WebPreferences setMediaPlaybackRequiresUserGesture:]):
(-[WebPreferences videoPlaybackRequiresUserGesture]):
(-[WebPreferences setVideoPlaybackRequiresUserGesture:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit/win:

* WebView.cpp:
(WebView::notifyPreferencesChanged):

Source/WebKit2:

Add a new preference, videoPlaybackRequiresUserGesture, distinct from mediaPlaybackRequiresUserGesture. Legacy clients of
mediaPlaybackRequiresUserGesture will still be able to use it normally, as setting that preference to true will effectively
set both audioPlaybackRequiresUserGesture and videoPlaybackRequiresUserGesture to true. Make these preferences all available
universally, rather than just on PLATFORM(IOS). This requires adding a definition for -setRequiresUserActionForMediaPlayback:
and -requiresUserActionForMediaPlayback on !PLATFORM(IOS).

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetVideoPlaybackRequiresUserGesture):
(WKPreferencesGetVideoPlaybackRequiresUserGesture):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
(-[WKWebView _setObscuredInsets:]):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):
(-[WKWebViewConfiguration encodeWithCoder:]):
(-[WKWebViewConfiguration initWithCoder:]):
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration requiresUserActionForMediaPlayback]):
(-[WKWebViewConfiguration setRequiresUserActionForMediaPlayback:]):
(-[WKWebViewConfiguration allowsInlineMediaPlayback]):
(-[WKWebViewConfiguration setAllowsInlineMediaPlayback:]):
(-[WKWebViewConfiguration _requiresUserActionForVideoPlayback]):
(-[WKWebViewConfiguration _setRequiresUserActionForVideoPlayback:]):
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Tools:

Set the default values for media preferences unconditionally, not just on PLATFORM(IOS). Set "video requires user gesture"
to sane defaults in addition to "audio requires user gesture" and (in the case of DumpREnderTree) instead of "media requires user gesture".

Add a new test of WK2 user gesture requirement preferences.

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebPreferencesToConsistentValues):
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit/ios/video-with-audio.html:
* TestWebKitAPI/Tests/WebKit/ios/video-without-audio.html:
* TestWebKitAPI/Tests/WebKit2Cocoa/RequiresUserActionForPlayback.mm: Added.
(-[RequiresUserActionForPlaybackNavigationDelegate webView:didFinishNavigation:]):
(-[RequiresUserActionForPlaybackMessageHandler userContentController:didReceiveScriptMessage:]):
(RequiresUserActionForPlaybackTest::SetUp):
(RequiresUserActionForPlaybackTest::createWebView):
(RequiresUserActionForPlaybackTest::testVideoWithAudio):
(RequiresUserActionForPlaybackTest::testVideoWithoutAudio):
(RequiresUserActionForPlaybackTest::testAudioOnly):
(TEST_F):
* TestWebKitAPI/Tests/WebKit2Cocoa/Coding.mm:
(TEST):

LayoutTests:

Update layout tests to reflect new restriction name.

* media/audio-playback-restriction-play-expected.txt:
* media/audio-playback-restriction-play.html:
* media/no-autoplay-with-user-gesture-requirement.html:
* media/video-load-require-user-gesture.html:
* media/video-play-require-user-gesture.html:
* media/video-crash-invisible-autoplay-display-none-expected.txt: Added.
* media/video-crash-invisible-autoplay-display-none.html: Added.
* media/video-main-content-allow-expected.txt:
* media/video-main-content-allow-then-deny-expected.txt:
* media/video-main-content-allow-then-deny.html:
* media/video-main-content-allow.html:
* media/video-main-content-deny-display-none-expected.txt:
* media/video-main-content-deny-display-none.html:
* media/video-main-content-deny-not-in-dom-expected.txt:
* media/video-main-content-deny-not-in-dom.html:
* media/video-main-content-deny-not-visible-expected.txt:
* media/video-main-content-deny-not-visible.html:
* media/video-main-content-deny-obscured-expected.txt:
* media/video-main-content-deny-obscured.html:
* media/video-main-content-deny-too-small-expected.txt:
* media/video-main-content-deny-too-small.html:

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

3 years agoAdd :defined support
rniwa@webkit.org [Thu, 10 Mar 2016 21:11:33 +0000 (21:11 +0000)]
Add :defined support
https://bugs.webkit.org/show_bug.cgi?id=155108

Reviewed by Antti Koivisto.

Source/WebCore:

Added :defined pseudo class which applies to a successfully instantiated custom element or a builtin element.
A new node flag, isUnresolvedCustomElement, which was added in r197917 tracks un-upgraded / unresolved custom
elements for which :defined should not apply.

Tests: fast/custom-elements/defined-pseudo-class.html
       fast/custom-elements/defined-rule.html

* bindings/js/JSCustomElementInterface.cpp:
(WebCore::JSCustomElementInterface::constructElement): Unset isUnresolvedCustomElement now that HTMLElement's
constructor sets isUnresolvedCustomElement.
* bindings/js/JSHTMLElementCustom.cpp:
(WebCore::constructJSHTMLElement): Set isUnresolvedCustomElement to true since :defined should never apply to
a custom element inside its constructor as HTMLElement constructor does not set the defined flag:
https://w3c.github.io/webcomponents/spec/custom/#htmlelement-constructor
* css/CSSSelector.cpp:
(WebCore::CSSSelector::selectorText): Added the support for serializing :defined.
* css/CSSSelector.h:
(PseudoClassType): Added PseudoClassDefined for :defined.
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne): Added the support for :defined.
* css/SelectorCheckerTestFunctions.h:
(WebCore::isDefinedElement): Added. Returns true for any builtin element and a custom element after a successful
construction / upgrades.
* css/SelectorPseudoClassAndCompatibilityElementMap.in: Added :defined.
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoClassType): Added the support for :defined.

LayoutTests:

Added W3C style testharness.js tests and ref tests for :defined pseudo class.

* fast/custom-elements/defined-pseudo-class-expected.txt: Added.
* fast/custom-elements/defined-pseudo-class.html: Added.
* fast/custom-elements/defined-rule-expected.html: Added.
* fast/custom-elements/defined-rule.html: Added.

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

3 years agoBuild fix for deprecated constant names.
ap@apple.com [Thu, 10 Mar 2016 20:52:19 +0000 (20:52 +0000)]
Build fix for deprecated constant names.

* Carbon/CarbonWindowAdapter.mm:
(-[CarbonWindowAdapter initWithCarbonWindowRef:takingOwnership:disableOrdering:carbon:]):
(-[CarbonWindowAdapter sendSuperEvent:]):

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

3 years agoUnreviewed, rolling out r197943.
commit-queue@webkit.org [Thu, 10 Mar 2016 20:46:57 +0000 (20:46 +0000)]
Unreviewed, rolling out r197943.
https://bugs.webkit.org/show_bug.cgi?id=155317

This change broke Windows, WinCairo, GTK and EFL builds
(Requested by ryanhaddad on #webkit).

Reverted changeset:

"Add a baseURL parameter to _WKUserStyleSheet"
https://bugs.webkit.org/show_bug.cgi?id=155219
http://trac.webkit.org/changeset/197943

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

3 years agoWeb Inspector: should be able to run protocol and input generator scripts from any...
bburg@apple.com [Thu, 10 Mar 2016 20:06:50 +0000 (20:06 +0000)]
Web Inspector: should be able to run protocol and input generator scripts from any directory
https://bugs.webkit.org/show_bug.cgi?id=155307

Reviewed by Joseph Pecoraro.

* Scripts/webkitpy/inspector/main.py:
(InspectorGeneratorTests.main):
* Scripts/webkitpy/replay/main.py:
(InputGeneratorTests.main):
Compute the current SCM based on the location of the script being executed, not
the $CWD which could be anything. There's rarely a good reason to use $CWD.

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

3 years agoAssignment to new.target should be an early error
sbarati@apple.com [Thu, 10 Mar 2016 19:41:37 +0000 (19:41 +0000)]
Assignment to new.target should be an early error
https://bugs.webkit.org/show_bug.cgi?id=151148

Reviewed by Mark Lam.

This patch makes it so that any form of assignment to new.target
is an early syntax error.

* parser/ASTBuilder.h:
(JSC::ASTBuilder::createNewTargetExpr):
(JSC::ASTBuilder::isNewTarget):
(JSC::ASTBuilder::createResolve):
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseAssignmentExpression):
(JSC::Parser<LexerType>::parseUnaryExpression):
* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::createThisExpr):
(JSC::SyntaxChecker::createSuperExpr):
(JSC::SyntaxChecker::createNewTargetExpr):
(JSC::SyntaxChecker::isNewTarget):
(JSC::SyntaxChecker::createResolve):
(JSC::SyntaxChecker::createObjectLiteral):
* tests/es6.yaml:
* tests/stress/new-target-syntax-errors.js: Added.
(shouldBeSyntaxError):
(shouldNotBeSyntaxError):
* tests/stress/new-target.js:
(Constructor):
(doWeirdThings):
(noAssign): Deleted.
(catch): Deleted.

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

3 years ago[MediaStream] push media stream state to the UI process
eric.carlson@apple.com [Thu, 10 Mar 2016 18:39:46 +0000 (18:39 +0000)]
[MediaStream] push media stream state to the UI process
https://bugs.webkit.org/show_bug.cgi?id=155281

Reviewed by Dean Jackson.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didCommitLoadForFrame): Don't clear m_mediaState, it is done in
  WebPageProxy::resetState. This reverts a change added in r197929.

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

3 years agoCSP: Implement support for script and style nonces
dbates@webkit.org [Thu, 10 Mar 2016 18:30:38 +0000 (18:30 +0000)]
CSP: Implement support for script and style nonces
https://bugs.webkit.org/show_bug.cgi?id=116508
<rdar://problem/24963980>

Reviewed by Brent Fulgham.

Source/WebCore:

Add support for script-src and style-src nonces as per sections Nonce usage for script elements
and Nonce usage for style elements of the Content Security Policy 2.0 spec., <https://www.w3.org/TR/2015/CR-CSP2-20150721/>.

* dom/InlineStyleSheetOwner.cpp:
(WebCore::InlineStyleSheetOwner::createSheet): Check if the nonce for an HTML style element matches a known nonce.
* dom/ScriptElement.cpp:
(WebCore::ScriptElement::requestScript): Check if the nonce for an HTML script element for an external JavaScript
script matches a known nonce. If it does then skip subsequent checks of the Content Security Policy when loading
the script.
(WebCore::ScriptElement::executeScript): Check if the nonce for an HTML script element for an inline JavaScript
script matches a known nonce.
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::process): Check if the nonce for an HTML link element matches a known nonce. If it does
then skip subsequent checks of the Content Security Policy when loading the stylesheet.
* html/HTMLScriptElement.idl: Unconditionally expose attribute nonce.
* html/HTMLStyleElement.idl: Ditto.
* page/csp/ContentSecurityPolicy.cpp:
(WebCore::isAllowedByAllWithNonce):
(WebCore::ContentSecurityPolicy::allowScriptWithNonce): Check if the nonce attribute value of a script element
matches a known nonce. This function delegates the check to ContentSecurityPolicyDirectiveList::allowScriptWithNonce().
(WebCore::ContentSecurityPolicy::allowStyleWithNonce): Check if the nonce attribute value of a style/link element
matches a known nonce. This function delegates the check to ContentSecurityPolicyDirectiveList::allowStyleWithNonce().
* page/csp/ContentSecurityPolicy.h:
* page/csp/ContentSecurityPolicyDirectiveList.cpp:
(WebCore::checkNonce): Checks if the directive allows the specified nonce.
(WebCore::ContentSecurityPolicyDirectiveList::allowScriptWithNonce): Check if the specified nonce is in
the source list of the script-src directive (if specified) or the source list of the default-src directive (if specified).
(WebCore::ContentSecurityPolicyDirectiveList::allowStyleWithNonce): Check if the specified nonce is in
the source list of the style-src directive (if specified) or the source list of the default-src directive (if specified).
* page/csp/ContentSecurityPolicyDirectiveList.h:
* page/csp/ContentSecurityPolicySourceList.cpp:
(WebCore::ContentSecurityPolicySourceList::matches): Returns whether the specified nonce is in the HashSet of
nonces for the directive.
(WebCore::ContentSecurityPolicySourceList::parse): Modified to call ContentSecurityPolicySourceList::parseNonceSource()
to parse a nonce source expression.
(WebCore::isBase64Character): Moved function to be above function ContentSecurityPolicySourceList::parseNonceSource()
so that it can referenced from both ContentSecurityPolicySourceList::parseNonceSource() and ContentSecurityPolicySourceList::parseHashSource().
(WebCore::isNonceCharacter): Added. Matches Blink's definition of a valid nonce character. This definition differs
from the definition in the Content Security Policy Level 3 spec., <https://w3c.github.io/webappsec-csp/> (29 February 2016).
(WebCore::ContentSecurityPolicySourceList::parseNonceSource): Parses a source expression for a nonce value.
* page/csp/ContentSecurityPolicySourceList.h:
(WebCore::ContentSecurityPolicySourceList::allowInline): We only allow inline scripts/stylesheets if
'unsafe-inline' was specified in the source list and the source list does not contain any hash sources
or nonce sources.
* page/csp/ContentSecurityPolicySourceListDirective.cpp:
(WebCore::ContentSecurityPolicySourceListDirective::allows): Checks if the specified nonce is in the source list.
* page/csp/ContentSecurityPolicySourceListDirective.h:

LayoutTests:

Update expected results due to differences between Blink and WebKit violation message formats.

Additionally mark script- and style- nonce tests as PASS in LayoutTests/TestExpectations so
that we run them.

* TestExpectations:
* http/tests/security/contentSecurityPolicy/1.1/scriptnonce-and-scripthash-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scriptnonce-and-scripthash.html:
* http/tests/security/contentSecurityPolicy/1.1/scriptnonce-basic-blocked-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scriptnonce-ignore-unsafeinline-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scriptnonce-invalidnonce-expected.txt: Also update result
to reflect that we consider "'n-" an invalid source expression (as expected).
* http/tests/security/contentSecurityPolicy/1.1/stylenonce-allowed-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/stylenonce-blocked-expected.txt:

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

3 years agoAdd a baseURL parameter to _WKUserStyleSheet
weinig@apple.com [Thu, 10 Mar 2016 18:24:50 +0000 (18:24 +0000)]
Add a baseURL parameter to _WKUserStyleSheet
https://bugs.webkit.org/show_bug.cgi?id=155219

Reviewed by Tim Horton.

Source/WebCore:

- Moves to a model for user content where instead of each page having a WebCore::UserContentController
  object, we have an abstract WebCore::UserContentProvider interface that can be implemented at the WebKit
  level. For now, legacy WebKit continues to use the old UserContentController, which implements
  WebCore::UserContentProvider, and WebKit2 implements its own implementation so it can store additional
  state.

* WebCore.xcodeproj/project.pbxproj:
Add new files.

* dom/ExtensionStyleSheets.cpp:
(WebCore::ExtensionStyleSheets::updateInjectedStyleSheetCache):
Switch to using forEachUserStyleSheet on the UserContentProvider.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::loadResource):
Remove null check now that we always have a UserContentProvider.

* loader/EmptyClients.cpp:
(WebCore::fillWithEmptyClients):
* loader/EmptyClients.h:
Add new EmptyClients.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadResourceSynchronously):
Remove null check now that we always have a UserContentProvider.

* loader/PingLoader.cpp:
(WebCore::processContentExtensionRulesForLoad):
Remove null check now that we always have a UserContentProvider.

* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::willSendRequestInternal):
Remove null check now that we always have a UserContentProvider.

* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):
Remove null check now that we always have a UserContentProvider.

* page/DOMWindow.cpp:
(WebCore::DOMWindow::shouldHaveWebKitNamespaceForWorld):
Remove null checks now that we always have a UserContentProvider, and userMessageHandlerDescriptors
returns a reference.

(WebCore::DOMWindow::open):
Remove null check now that we always have a UserContentProvider.

* page/Frame.cpp:
(WebCore::Frame::injectUserScripts):
Simplify by lifting document check out of the main loop and using forEachUserScript.

* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::~Page):
(WebCore::Page::userContentProvider):
(WebCore::Page::setUserContentProvider):
(WebCore::Page::setUserContentController): Deleted.
* page/Page.h:
(WebCore::Page::userContentController): Deleted.
* page/PageConfiguration.h:
Store the UserContentProvider in a Ref, and require PageConfigurations to provide one. This
removes a bunch of null checks and simplifies the code.

* page/UserContentController.cpp:
(WebCore::UserContentController::~UserContentController):
(WebCore::UserContentController::forEachUserScript):
(WebCore::UserContentController::forEachUserStyleSheet):
(WebCore::UserContentController::addUserScript):
(WebCore::UserContentController::removeUserScript):
(WebCore::UserContentController::removeUserScripts):
(WebCore::UserContentController::addUserStyleSheet):
(WebCore::UserContentController::removeUserStyleSheet):
(WebCore::UserContentController::removeUserStyleSheets):
(WebCore::UserContentController::addUserMessageHandlerDescriptor):
(WebCore::UserContentController::removeUserMessageHandlerDescriptor):
(WebCore::UserContentController::addUserContentExtension):
(WebCore::UserContentController::removeUserContentExtension):
(WebCore::UserContentController::removeAllUserContentExtensions):
(WebCore::UserContentController::removeAllUserContent):
(WebCore::UserContentController::addPage): Deleted.
(WebCore::UserContentController::removePage): Deleted.
(WebCore::contentExtensionsEnabled): Deleted.
(WebCore::UserContentController::processContentExtensionRulesForLoad): Deleted.
(WebCore::UserContentController::actionsForResourceLoad): Deleted.
* page/UserContentController.h:
(WebCore::UserContentController::userScripts): Deleted.
(WebCore::UserContentController::userStyleSheets): Deleted.
(WebCore::UserContentController::userMessageHandlerDescriptors): Deleted.
Add inheritance from UserContentProvider and simplify things by removing unique_ptrs
that were holding the member variables. There is usually only one UserContentController
so having these in unique_ptrs doesn't make much sense.

* page/UserContentProvider.cpp: Added.
(WebCore::UserContentProvider::UserContentProvider):
(WebCore::UserContentProvider::~UserContentProvider):
(WebCore::UserContentProvider::addPage):
(WebCore::UserContentProvider::removePage):
(WebCore::UserContentProvider::invalidateInjectedStyleSheetCacheInAllFramesInAllPages):
(WebCore::contentExtensionsEnabled):
(WebCore::UserContentProvider::processContentExtensionRulesForLoad):
(WebCore::UserContentProvider::actionsForResourceLoad):
* page/UserContentProvider.h: Added.
Add abstract class for providing user content and add some helpers on it.

* page/UserMessageHandlerDescriptor.h:
(WebCore::UserMessageHandlerDescriptor::create):
(WebCore::UserMessageHandlerDescriptor::client):
(WebCore::UserMessageHandlerDescriptor::invalidateClient):
* page/UserMessageHandlersNamespace.cpp:
(WebCore::UserMessageHandlersNamespace::handler):
Simplify now that userContentProvider() and userMessageHandlerDescriptors() are references.

Source/WebKit/mac:

* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):
(-[WebView setGroupName:]):
Update to account for the name change from UserContentController -> UserContentProvider.

Source/WebKit2:

- Moves to a model for user content where instead of using a WebCore::UserContentController
  object, we implement the new WebCore::UserContentProvider interface (on the existing
  WebUserContentController object).
- Uses this to maintain maps of UserStylesSheets and UserScripts along with their identifiers,
  freeing up the URL, which had been acting as the identifier, to be used as the baseURL which
  was what it was intended for.
- Adds a baseURL property to _WKUserStyleSheet.

* WebKit2.xcodeproj/project.pbxproj:
Add new files.

* Scripts/webkit/messages.py:
(headers_for_type):
Add support for sending WebUserContentControllerDataTypes.

* Shared/WebUserContentControllerDataTypes.cpp: Added.
(WebKit::WebUserScriptData::encode):
(WebKit::WebUserScriptData::decode):
(WebKit::WebUserStyleSheetData::encode):
(WebKit::WebUserStyleSheetData::decode):
* Shared/WebUserContentControllerDataTypes.h: Added.
Add helper types for sending user content over IPC.

* UIProcess/API/APIUserScript.cpp:
(API::UserScript::generateUniqueURL):
(API::UserScript::UserScript):
* UIProcess/API/APIUserScript.h:
* UIProcess/API/APIUserStyleSheet.cpp:
(API::UserStyleSheet::generateUniqueURL):
(API::UserStyleSheet::UserStyleSheet):
* UIProcess/API/APIUserStyleSheet.h:
Add identifiers for tracking across processes.

* UIProcess/API/Cocoa/_WKUserStyleSheet.h:
* UIProcess/API/Cocoa/_WKUserStyleSheet.mm:
(-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:userContentWorld:]):
(-[_WKUserStyleSheet baseURL]):
Add new initializer which takes a baseURL as well as an accessor for the baseURL.

* UIProcess/UserContent/WebUserContentControllerProxy.cpp:
(WebKit::WebUserContentControllerProxy::addProcess):
(WebKit::WebUserContentControllerProxy::addUserScript):
(WebKit::WebUserContentControllerProxy::removeUserScript):
(WebKit::WebUserContentControllerProxy::addUserStyleSheet):
(WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
Pass identifiers as well as user content.

* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::addUserScript):
(WebKit::InjectedBundle::addUserStyleSheet):
Move user content in via move semantics rather than using a unique_ptr.

(WebKit::InjectedBundle::removeUserScript):
(WebKit::InjectedBundle::removeUserStyleSheet):
(WebKit::InjectedBundle::removeUserScripts):
(WebKit::InjectedBundle::removeUserStyleSheets):
(WebKit::InjectedBundle::removeAllUserContent):
Update for new function signatures.

* WebProcess/UserContent/WebUserContentController.cpp:
(WebKit::WebUserContentController::WebUserContentController):
(WebKit::WebUserContentController::~WebUserContentController):
(WebKit::WebUserContentController::addUserContentWorlds):
(WebKit::WebUserContentController::removeUserContentWorlds):
(WebKit::WebUserContentController::addUserScripts):
(WebKit::WebUserContentController::removeUserScript):
(WebKit::WebUserContentController::removeAllUserScripts):
(WebKit::WebUserContentController::addUserStyleSheets):
(WebKit::WebUserContentController::removeUserStyleSheet):
(WebKit::WebUserContentController::removeAllUserStyleSheets):
(WebKit::WebUserContentController::addUserScriptMessageHandlers):
(WebKit::WebUserContentController::removeUserScriptMessageHandler):
(WebKit::WebUserContentController::addUserContentExtensions):
(WebKit::WebUserContentController::removeUserContentExtension):
(WebKit::WebUserContentController::removeAllUserContentExtensions):
(WebKit::WebUserContentController::addUserScriptInternal):
(WebKit::WebUserContentController::addUserScript):
(WebKit::WebUserContentController::removeUserScriptWithURL):
(WebKit::WebUserContentController::removeUserScriptInternal):
(WebKit::WebUserContentController::removeUserScripts):
(WebKit::WebUserContentController::addUserStyleSheetInternal):
(WebKit::WebUserContentController::addUserStyleSheet):
(WebKit::WebUserContentController::removeUserStyleSheetWithURL):
(WebKit::WebUserContentController::removeUserStyleSheetInternal):
(WebKit::WebUserContentController::removeUserStyleSheets):
(WebKit::WebUserContentController::removeAllUserContent):
(WebKit::WebUserContentController::forEachUserScript):
(WebKit::WebUserContentController::forEachUserStyleSheet):
* WebProcess/UserContent/WebUserContentController.h:
* WebProcess/UserContent/WebUserContentController.messages.in:
Convert to inheriting from UserContentProvider, rather than containing a UserContentController.
This means adding the storage for the user content, which has been simplified to avoid using
unique_ptrs.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::addUserScript):
(WebKit::WebPage::addUserStyleSheet):
(WebKit::WebPage::removeAllUserContent):
Update to call the WebUserContentController, rather than going to the UserContentController, which
no longer exists.

* WebProcess/WebPage/WebPageGroupProxy.cpp:
(WebKit::WebPageGroupProxy::userContentController):
* WebProcess/WebPage/WebPageGroupProxy.h:
Return the WebUserContentController rather than old UserContentController.

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

3 years ago[iOS] DumpRenderTree crashes when accessing window.testRunner.inspectorTestStubURL
ddkilzer@apple.com [Thu, 10 Mar 2016 18:23:52 +0000 (18:23 +0000)]
[iOS] DumpRenderTree crashes when accessing window.testRunner.inspectorTestStubURL
<http://webkit.org/b/155295>

Reviewed by Brent Fulgham.

Tools:

* DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::inspectorTestStubURL): Always return nullptr for
PLATFORM(IOS).  This matches what we did in r192604 for
WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm.

LayoutTests:

* platform/ios-simulator-wk1/TestExpectations:
* platform/ios-simulator-wk2/TestExpectations:
- Remove all "inspector/" tests.  They are already skipped in
  platform/ios-simulator/TestExpectations, so no need to
  resurrect them here.

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

3 years agoUnreviewed, rolling out r197923.
ryanhaddad@apple.com [Thu, 10 Mar 2016 17:55:19 +0000 (17:55 +0000)]
Unreviewed, rolling out r197923.
https://bugs.webkit.org/show_bug.cgi?id=155301

Rolling out this change due to breaking the build and
LayoutTests. (Requested by ryanhaddad on #webkit).

Reverted changeset:

"Font antialiasing (smoothing) changes when elements are
rendered into compositing layers"
https://bugs.webkit.org/show_bug.cgi?id=23364
http://trac.webkit.org/changeset/197923

Patch by Commit Queue <commit-queue@webkit.org> on 2016-03-10

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

3 years agoCSP: Implement support for inline script and inline style hashes
dbates@webkit.org [Thu, 10 Mar 2016 17:46:06 +0000 (17:46 +0000)]
CSP: Implement support for inline script and inline style hashes
https://bugs.webkit.org/show_bug.cgi?id=155007
<rdar://problem/24964098>

Reviewed by Brent Fulgham.

Source/WebCore:

Inspiration taken from the analogous implementation in Blink.

Add support for script-src and style-src hashes as per sections Hash usage for script elements
and Hash usage for style elements of the Content Security Policy 2.0 spec., <https://www.w3.org/TR/2015/CR-CSP2-20150721/>.

Test: http/tests/security/contentSecurityPolicy/1.1/scripthash-tests.html

* WebCore.xcodeproj/project.pbxproj: Add file ContentSecurityPolicyHash.h. Also sort the list of files
in the group WebCore/page/csp.
* dom/InlineStyleSheetOwner.cpp:
(WebCore::InlineStyleSheetOwner::createSheet): Pass the content of the stylesheet when querying whether
the stylesheet is allowed by the Content Security Policy.
* dom/ScriptElement.cpp:
(WebCore::ScriptElement::executeScript): Pass the content of the inline JavaScript script when querying
whether the script is allowed by the Content Security Policy.
* dom/StyledElement.cpp:
(WebCore::StyledElement::styleAttributeChanged): The Content Security Policy style-src hashes do not apply
to inline styles defined in the HTML style attribute. So, pass a null string (to indicate the absence of
content) when querying whether the inline style is allowed by the Content Security Policy.
* page/csp/ContentSecurityPolicy.cpp:
(WebCore::toCryptoDigestAlgorithm): Convenience function that maps a ContentSecurityPolicyHashAlgorithm
enumerator to a CryptoDigest::Algorithm enumerator.
(WebCore::isAllowedByAllWithHashFromContent): Computes the digest of the specified content for each
hash algorithm and checks if digest matches a hash that was specified in a policy.
(WebCore::ContentSecurityPolicy::documentEncoding): Added.
(WebCore::ContentSecurityPolicy::allowInlineScript): Check if the hash of the script matches a known
hash if applicable. Otherwise, fall back to checking the URL of the script.
(WebCore::ContentSecurityPolicy::allowInlineStyle): Check if the hash of the stylesheet matches a
known hash if applicable. Otherwise, fall back to checking the URL of the stylesheet.
* page/csp/ContentSecurityPolicy.h:
(WebCore::ContentSecurityPolicy::addHashAlgorithmsForInlineScripts): Adds the specified set of
hash algorithms to the existing set of hash algorithms we know are used for inline scripts.
(WebCore::ContentSecurityPolicy::addHashAlgorithmsForInlineStylesheets): Adds the specified set of
hash algorithms to the existing set of hash algorithms we know are used for inline stylesheets.
* page/csp/ContentSecurityPolicyDirectiveList.cpp:
(WebCore::checkEval): Make this a static, non-member function because it does not depend on any
instance or class variables. Mark this function as inline to give a hint to the compiler that it
should consider inlining the implementation of this function into the caller.
(WebCore::checkInline): Ditto.
(WebCore::checkSource): Ditto.
(WebCore::checkHash): Checks if the directive allows content with the specified hash.
(WebCore::checkMediaType): Make this a static, non-member function because it does not depend on
any instance or class variables. Mark this function as inline to give a hint to the compiler that
it should consider inlining the implementation of this function into the caller.
(WebCore::ContentSecurityPolicyDirectiveList::create): Modified as needed now that WebCore::checkEval()
is a static, non-member function.
(WebCore::ContentSecurityPolicyDirectiveList::allowInlineScriptWithHash): Added.
(WebCore::ContentSecurityPolicyDirectiveList::allowInlineStyleWithHash): Added.
(WebCore::ContentSecurityPolicyDirectiveList::addDirective): Modified to pass the hash algorithms seen
from parsing the directives script-src, style-src, and default-src to the ContentSecurityPolicy object.
(WebCore::ContentSecurityPolicyDirectiveList::checkEval): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::checkInline): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::checkSource): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::checkMediaType): Deleted.
* page/csp/ContentSecurityPolicyDirectiveList.h:
* page/csp/ContentSecurityPolicyHash.h: Added.
(WTF::DefaultHash<WebCore::ContentSecurityPolicyDigest>::Hash::hash): Compute the hash of a digest as
we would compute the hash of a string.
(WTF::DefaultHash<WebCore::ContentSecurityPolicyDigest>::Hash::equal): Compare digests for equality
by making use of Vector's equality operator.
* page/csp/ContentSecurityPolicySourceList.cpp:
(WebCore::ContentSecurityPolicySourceList::matches): Checks if the hash is in the set of known hashes.
(WebCore::ContentSecurityPolicySourceList::parse): Modified to call ContentSecurityPolicySourceList::parseHashSource()
to try to parse the source list expression as a hash source. If this fails then we try to parse the
source expression as a scheme/host/port expression.
(WebCore::parseHashAlgorithmAdvancingPosition): Parses the hash algorithm from a hash source expression.
(WebCore::isBase64Character): Returns whether the specified character is a valid Base64/Base64url character,
excluding the padding character '='. Disregarding the omission of the padding character '=', this function
conforms to the ABNF grammar defined in section Source Lists of the Content Security Policy Level 3 spec.,
<https://w3c.github.io/webappsec-csp> (Editor’s Draft, 29 February 2016). We take the padding character '='
into account in ContentSecurityPolicySourceList::parseHashSource().
(WebCore::ContentSecurityPolicySourceList::parseHashSource): Parses a hash source expression per the ABNF
grammar described in section Source Lists of the Content Security Policy Level 3 spec.
* page/csp/ContentSecurityPolicySourceList.h:
(WebCore::ContentSecurityPolicySourceList::hashAlgorithmsUsed): Returns the set of hash algorithms seen from
parsing the source list.
(WebCore::ContentSecurityPolicySourceList::allowInline): We only allow inline scripts/stylesheets if
'unsafe-inline' was specified in the source list and the source list does not contain any hash sources.
* page/csp/ContentSecurityPolicySourceListDirective.cpp:
(WebCore::ContentSecurityPolicySourceListDirective::allows): Checks if the specified hash is in the source list.
* page/csp/ContentSecurityPolicySourceListDirective.h:
(WebCore::ContentSecurityPolicySourceListDirective::hashAlgorithmsUsed): Turns around and calls ContentSecurityPolicySourceList::hashAlgorithmsUsed().

LayoutTests:

Add new test http/tests/security/contentSecurityPolicy/1.1/scripthash-tests.html to ensure that
script hashes are interpreted correctly. Update many existing tests that had a hash source with
a SHA-1 hash to use a SHA-256 hash. The valid hash algorithms are SHA-256, SHA-384, and SHA-512
per the Content Security Policy Level 3 spec. At the time of writing, Blink also supports SHA-1.

* TestExpectations: Mark many CSP 1.1 tests as PASS so that we run them. Remove entries for tests
http/tests/security/contentSecurityPolicy/1.1/{script, style}hash-default-src.html as these tests
now pass.
* http/tests/security/contentSecurityPolicy/1.1/resources/didRunInlineScriptEpilogue.js: Added.
* http/tests/security/contentSecurityPolicy/1.1/resources/didRunInlineScriptPrologue.js: Added.
* http/tests/security/contentSecurityPolicy/1.1/resources/testScriptHash.php: Added.
* http/tests/security/contentSecurityPolicy/1.1/scripthash-allowed.html: Update test as SHA-1 is not
a supported hash algorithm per the Content Security Policy Level 3 spec.
* http/tests/security/contentSecurityPolicy/1.1/scripthash-basic-blocked-expected.txt: Ditto.
* http/tests/security/contentSecurityPolicy/1.1/scripthash-basic-blocked.html: Ditto.
* http/tests/security/contentSecurityPolicy/1.1/scripthash-default-src-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/scripthash-ignore-unsafeinline-expected.txt: Ditto.
* http/tests/security/contentSecurityPolicy/1.1/scripthash-ignore-unsafeinline.html: Ditto.
* http/tests/security/contentSecurityPolicy/1.1/scripthash-malformed-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scripthash-tests-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/scripthash-tests.html: Added.
* http/tests/security/contentSecurityPolicy/1.1/scripthash-unicode-normalization.html: Update test
as SHA-1 is not a supported hash algorithm per the Content Security Policy Level 3 spec.
* http/tests/security/contentSecurityPolicy/1.1/stylehash-allowed-expected.txt: Ditto.
* http/tests/security/contentSecurityPolicy/1.1/stylehash-allowed.html: Ditto.
* http/tests/security/contentSecurityPolicy/1.1/stylehash-basic-blocked-error-event.html: Ditto.
* http/tests/security/contentSecurityPolicy/1.1/stylehash-basic-blocked-expected.txt: Ditto.
* http/tests/security/contentSecurityPolicy/1.1/stylehash-basic-blocked.html: Ditto.
* http/tests/security/contentSecurityPolicy/1.1/stylehash-default-src-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/stylehash-svg-style-basic-blocked-error-event.html: Update test
as SHA-1 is not a supported hash algorithm per the Content Security Policy Level 3 spec.

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

3 years agoSpeculative revalidation requests do not have their 'first party for cookies' URL set
cdumez@apple.com [Thu, 10 Mar 2016 16:57:11 +0000 (16:57 +0000)]
Speculative revalidation requests do not have their 'first party for cookies' URL set
https://bugs.webkit.org/show_bug.cgi?id=155284
<rdar://problem/25053203>

Reviewed by Antti Koivisto.

Source/WebCore:

Export a few more symbols so they can be used in WebKit2.

* platform/URL.h:
* platform/network/ResourceRequestBase.h:

Source/WebKit2:

Speculative revalidation requests did not have their 'first party for cookies'
URL set. This means the underlying NSURLRequest has a nil mainDocumentURL.
Without a way to determine whether the cookie is in a third-party context,
CFNetwork defaults to accepting all cookies for these resources.

* NetworkProcess/cache/NetworkCacheCoders.cpp:
(WebKit::NetworkCache::Coder<WebCore::URL>::encode):
(WebKit::NetworkCache::Coder<WebCore::URL>::decode):
* NetworkProcess/cache/NetworkCacheCoders.h:
Add template specialization to support encoding / decoding WebCore::URL.

* NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
(WebKit::NetworkCache::constructRevalidationRequest):
Set the "first party for cookies" URL on the revalidation request.

(WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::registerSubresourceLoad):
(WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::saveToDiskIfReady):
Now keep the subresources' ResourceRequests, in addition to their key, so we can later
extract the 'first party for cookies' URL from the request and save it to disk.

(WebKit::NetworkCache::SpeculativeLoadManager::registerLoad):
Pass the ResourceRequest in addition to the key to
PendingFrameLoad::registerSubresourceLoad().

(WebKit::NetworkCache::SpeculativeLoadManager::revalidateEntry):
Add an extra SubresourceInfo parameter, in addition to the Entry, so we
have access to the first party for cookies URL. Pass this URL to
constructRevalidationRequest().

(WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry):
Add an extra SubresourceInfo parameter, in addition to the Entry, so we
have access to the first party for cookies URL.

(WebKit::NetworkCache::SpeculativeLoadManager::startSpeculativeRevalidation):
Pass the SubresourceInfo to preloadEntry().

* NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h:

* NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
(WebKit::NetworkCache::SubresourcesEntry::SubresourceInfo::encode):
(WebKit::NetworkCache::SubresourcesEntry::SubresourceInfo::decode):
Encode / Decode new firstPartyForCookies member.

(WebKit::NetworkCache::SubresourcesEntry::SubresourcesEntry):
(WebKit::NetworkCache::SubresourcesEntry::updateSubresourceLoads):
Take SubresourceLoad objects in, instead of simple Key objects so we have
access to the ResourceRequest. We extract the first party for cookies URL
from the request and pass it to the SubresourceInfo constructor.

* NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
(WebKit::NetworkCache::SubresourcesEntry::SubresourceInfo::SubresourceInfo):
(WebKit::NetworkCache::SubresourcesEntry::SubresourceLoad::SubresourceLoad):

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

3 years agoEnable AVFoundationNSURLSessionEnabled by default
jer.noble@apple.com [Thu, 10 Mar 2016 16:28:52 +0000 (16:28 +0000)]
Enable AVFoundationNSURLSessionEnabled by default
https://bugs.webkit.org/show_bug.cgi?id=154469

Reviewed by Sam Weinig.

Source/WebCore:

* page/Settings.cpp:

Source/WebKit/mac:

* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):

Source/WebKit2:

* Shared/WebPreferencesDefinitions.h:

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

3 years ago[GTK] Add support for WOFF2
fred.wang@free.fr [Thu, 10 Mar 2016 15:30:42 +0000 (15:30 +0000)]
[GTK] Add support for WOFF2
https://bugs.webkit.org/show_bug.cgi?id=152616

.:

Patch by Frederic Wang <fwang@igalia.org> on 2016-03-10
Reviewed by Carlos Garcia Campos.

* Source/CMakeLists.txt: Build brotli and woff2 third-party libraries if WOFF2 is enabled.
* Source/cmake/OptionsGTK.cmake: Always enable WOFF2 on GTK.

Source/ThirdParty:

Patch by Frederic Wang <fwang@igalia.com> on 2016-03-10
Reviewed by Carlos Garcia Campos.

We import the source of the third-party brotli and woff2 libraries because release packages do not exist yet.
The script to update source from upstream as well as the makefile to compile relevant files are based on similar code from Mozilla.

* brotli/CMakeLists.txt: Added. We force BROTLI_BUILD_PORTABLE by default, see https://github.com/google/brotli/issues/307.
* brotli/LICENSE: Added.
* brotli/README.webkit: Added.
* brotli/dec/Makefile: Added.
* brotli/dec/bit_reader.c: Added.
* brotli/dec/bit_reader.h: Added.
* brotli/dec/context.h: Added.
* brotli/dec/decode.c: Added.
* brotli/dec/decode.h: Added.
* brotli/dec/dictionary.c: Added.
* brotli/dec/dictionary.h: Added.
* brotli/dec/huffman.c: Added.
* brotli/dec/huffman.h: Added.
* brotli/dec/port.h: Added.
(BrotliRBit):
* brotli/dec/prefix.h: Added.
* brotli/dec/state.c: Added.
* brotli/dec/state.h: Added.
* brotli/dec/transform.h: Added.
* brotli/dec/types.h: Added.
* brotli/update.sh: Added. This script helps to get the latest version of the decoder source code.
* woff2/CMakeLists.txt: Added. We only compile the decoder files.
* woff2/LICENSE: Added.
* woff2/README.webkit: Added.
* woff2/src/buffer.h: Added.
(woff2::Failure):
(woff2::Buffer::Buffer):
(woff2::Buffer::Skip):
(woff2::Buffer::Read):
(woff2::Buffer::ReadU8):
(woff2::Buffer::ReadU16):
(woff2::Buffer::ReadS16):
(woff2::Buffer::ReadU24):
(woff2::Buffer::ReadU32):
(woff2::Buffer::ReadS32):
(woff2::Buffer::ReadTag):
(woff2::Buffer::ReadR64):
(woff2::Buffer::buffer):
(woff2::Buffer::offset):
(woff2::Buffer::length):
(woff2::Buffer::set_offset):
* woff2/src/file.h: Added.
(woff2::GetFileContent):
(woff2::SetFileContents):
* woff2/src/font.cc: Added.
* woff2/src/font.h: Added.
* woff2/src/glyph.cc: Added.
* woff2/src/glyph.h: Added.
(woff2::Glyph::Glyph):
* woff2/src/normalize.cc: Added.
* woff2/src/normalize.h: Added.
* woff2/src/port.h: Added.
(woff2::Log2Floor):
* woff2/src/round.h: Added.
(woff2::Round4):
* woff2/src/store_bytes.h: Added.
(woff2::StoreU32):
(woff2::Store16):
(woff2::StoreBytes):
* woff2/src/table_tags.cc: Added.
* woff2/src/table_tags.h: Added.
* woff2/src/transform.cc: Added.
* woff2/src/transform.h: Added.
* woff2/src/variable_length.cc: Added.
* woff2/src/variable_length.h: Added.
* woff2/src/woff2_common.cc: Added.
* woff2/src/woff2_common.h: Added.
(woff2::Table::operator<):
* woff2/src/woff2_compress.cc: Added.
* woff2/src/woff2_dec.cc: Added.
* woff2/src/woff2_dec.h: Added.
* woff2/src/woff2_decompress.cc: Added.
* woff2/src/woff2_enc.cc: Added.
* woff2/src/woff2_enc.h: Added.
(woff2::WOFF2Params::WOFF2Params):
* woff2/update.sh: Added. This script helps to get the latest upstream version.

Source/WebCore:

Patch by Frederic Wang <fwang@igalia.com> on 2016-03-10
Reviewed by Carlos Garcia Campos.

No new tests (Covered by existing tests).

* CMakeLists.txt: Add woff2 source to the include directory and link WebCore against brotli and woff2.
* platform/graphics/WOFFFileFormat.cpp:
(WebCore::isWOFF): Recognize the signature of WOFF2 font.
(WebCore::convertWOFFToSfnt): If the font has the WOFF2 signature, then try and decompress it using the woff2 library.
* platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
(WebCore::FontCustomPlatformData::supportsFormat): Add woff2 to the list of supported formats.

Source/WTF:

Patch by Frederic Wang <fwang@igalia.com> on 2016-03-10
Reviewed by Carlos Garcia Campos.

* wtf/FeatureDefines.h: Enable USE_WOFF2 flag on GTK.

Tools:

Patch by Frederic Wang <fwang@igalia.com> on 2016-03-10
Reviewed by Carlos Garcia Campos.

* Scripts/webkitpy/style/checker.py: Only verify basic style for third party modules brotli and woff2.

LayoutTests:

Patch by Frederic Wang <fwang@igalia.com> on 2016-03-10
Reviewed by Carlos Garcia Campos.

* fast/text/woff2-expected.html: Adjust font-size to work around anti-aliasing effects.
* fast/text/woff2.html: Ditto.
* platform/gtk/TestExpectations: Update test expectation of woff2 test for GTK.

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

3 years agoUnreviewed, revert changes accidentally committed with previous patch.
eric.carlson@apple.com [Thu, 10 Mar 2016 12:26:21 +0000 (12:26 +0000)]
Unreviewed, revert changes accidentally committed with previous patch.

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

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

3 years ago[css-grid] Fix placement for unknown named grid lines
rego@igalia.com [Thu, 10 Mar 2016 12:15:34 +0000 (12:15 +0000)]
[css-grid] Fix placement for unknown named grid lines
https://bugs.webkit.org/show_bug.cgi?id=155230

Reviewed by Sergio Villar Senin.

Source/WebCore:

The spec has changed and now all the implicit lines should be considered
when we're resolving named grid lines with an unknown name.

The relevant part of the spec is
(http://dev.w3.org/csswg/css-grid/#line-placement):
"If a name is given as a <custom-ident>, only lines with that name
 are counted. If not enough lines with that name exist,
 all implicit grid lines are assumed to have that name
 for the purpose of finding this position."

Modified the code to resolve named grid lines in GridResolvedPosition.
We need to keep the old behavior of considering "auto" unknown named
grid lines for the case of positioned grid items.

Test: fast/css-grid-layout/grid-item-unknown-named-grid-line-resolution.html

* rendering/style/GridResolvedPosition.cpp:
(WebCore::adjustGridPositionsFromStyle):
(WebCore::lookAheadForNamedGridLine):
(WebCore::lookBackForNamedGridLine):
(WebCore::resolveNamedGridLinePositionFromStyle):
(WebCore::definiteGridSpanWithNamedLineSpanAgainstOpposite):
(WebCore::resolveNamedGridLinePositionAgainstOppositePosition):
(WebCore::resolveGridPositionAgainstOppositePosition):
(WebCore::resolveGridPositionFromStyle):

LayoutTests:

Updated current tests to the new expected behavior and created a new
test checking different cases explicitly.

* fast/css-grid-layout/grid-container-change-named-grid-lines-recompute-child.html:
* fast/css-grid-layout/grid-item-bad-named-area-auto-placement-expected.txt:
* fast/css-grid-layout/grid-item-bad-named-area-auto-placement.html:
* fast/css-grid-layout/grid-item-named-grid-area-resolution.html:
* fast/css-grid-layout/grid-item-named-grid-line-resolution-expected.txt:
* fast/css-grid-layout/grid-item-named-grid-line-resolution.html:
* fast/css-grid-layout/grid-item-negative-position-resolution.html:
* fast/css-grid-layout/grid-item-position-changed-dynamic.html:
* fast/css-grid-layout/grid-item-unknown-named-grid-line-resolution-expected.txt: Added.
* fast/css-grid-layout/grid-item-unknown-named-grid-line-resolution.html: Added.
* fast/css-grid-layout/named-grid-lines-with-named-grid-areas-resolution.html:

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

3 years ago[MediaStream] push media stream state to the UI process
eric.carlson@apple.com [Thu, 10 Mar 2016 12:05:59 +0000 (12:05 +0000)]
[MediaStream] push media stream state to the UI process
https://bugs.webkit.org/show_bug.cgi?id=155281

Reviewed by Darin Adler.

Source/WebCore:

* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::MediaStream): Register with the document as an audio producer.
(WebCore::MediaStream::~MediaStream): Unregister.
(WebCore::MediaStream::setIsActive): Update document status.
(WebCore::MediaStream::pageMutedStateDidChange): Mute/unmute according to the page mute setting.
(WebCore::MediaStream::mediaState): Return state.
(WebCore::MediaStream::statusDidChange): Call document.updateIsPlayingMedia.
(WebCore::MediaStream::characteristicsChanged): Track stream mute state.
(WebCore::MediaStream::scheduleActiveStateChange): m_isActive -> m_active.
* Modules/mediastream/MediaStream.h:

* page/MediaProducer.h: Add HasActiveMediaCaptureDevice.

* platform/mediastream/MediaStreamPrivate.cpp:
(WebCore::MediaStreamPrivate::hasVideo): Make const.
(WebCore::MediaStreamPrivate::hasAudio): Ditto.
(WebCore::MediaStreamPrivate::muted): New.
* platform/mediastream/MediaStreamPrivate.h:

* platform/mediastream/mac/AVMediaCaptureSource.mm:
(WebCore::AVMediaCaptureSource::AVMediaCaptureSource): Initialize muted to true.
(WebCore::AVMediaCaptureSource::captureSessionIsRunningDidChange): Set muted.

Source/WebKit2:

* UIProcess/API/C/WKPage.cpp:
(WKPageGetMediaState): New.
* UIProcess/API/C/WKPagePrivate.h:

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didCommitLoadForFrame): Clear m_mediaState.
(WebKit::WebPageProxy::isPlayingMediaDidChange): Call m_pageClient.isPlayingMediaDidChange when
  audio or video state changes, call m_uiClient->isPlayingAudioDidChange when audio, vidoe,
  or media stream state changes.
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::mediaStateFlags): New.

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

3 years agoHow we load new.target in arrow functions is broken
gskachkov@gmail.com [Thu, 10 Mar 2016 08:19:42 +0000 (08:19 +0000)]
How we load new.target in arrow functions is broken
https://bugs.webkit.org/show_bug.cgi?id=155153

Reviewed by Saam Barati.

Fixed not correct approach of caching new.target. In current patch was added code feature
flag that shows that current function is using new.target, when generating byte code an arrow
function we are loading new.target value to its register from arrow function lexical environment.

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::emitLoadNewTargetFromArrowFunctionLexicalEnvironment):
* bytecompiler/BytecodeGenerator.h:
(JSC::BytecodeGenerator::newTarget):
* parser/ASTBuilder.h:
(JSC::ASTBuilder::createNewTargetExpr):
(JSC::ASTBuilder::usesNewTarget):
* parser/Nodes.h:
(JSC::ScopeNode::usesNewTarget):
* parser/ParserModes.h:
* tests/stress/arrowfunction-lexical-bind-newtarget.js:

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

3 years ago[GTK] Artifacts when using web view background color
carlosgc@webkit.org [Thu, 10 Mar 2016 07:13:48 +0000 (07:13 +0000)]
[GTK] Artifacts when using web view background color
https://bugs.webkit.org/show_bug.cgi?id=155229

Reviewed by Mario Sanchez Prada.

This is because when using a web view color, we fill with the
color every rectangle updated by the web process, but we should
always fill the entire backing store before rendering the actual
contents on top.

* WebProcess/WebPage/DrawingAreaImpl.cpp:
(WebKit::DrawingAreaImpl::display): Ensure the web process always
renders the whole visible rectangle when background is rendered by
the UI process.

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

3 years agoWeb Inspector: Get a RemoteObject or ObjectPreview from HeapSnapshot Object Identifier
commit-queue@webkit.org [Thu, 10 Mar 2016 06:15:25 +0000 (06:15 +0000)]
Web Inspector: Get a RemoteObject or ObjectPreview from HeapSnapshot Object Identifier
https://bugs.webkit.org/show_bug.cgi?id=155264
<rdar://problem/25070716>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-03-09
Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

* inspector/InjectedScript.h:
* inspector/InjectedScript.cpp:
(Inspector::InjectedScript::functionDetails):
(Inspector::InjectedScript::previewValue):
New InjectedScript methods for building Debugger.FunctionDetails
or Runtime.ObjectPreview protocol objects from a JSValue.

* inspector/InjectedScriptSource.js:
(InjectedScript.prototype.previewValue):
(InjectedScript.prototype.functionDetails):
(InjectedScript.prototype.getFunctionDetails):
(InjectedScript.RemoteObject.prototype._isPreviewableObjectInternal):
(InjectedScript.RemoteObject.prototype._createObjectPreviewForValue): Deleted.
(InjectedScript.RemoteObject.prototype._appendEntryPreviews): Deleted.
Share code around creating function details or object preview objects.

* inspector/agents/InspectorHeapAgent.cpp:
(Inspector::InspectorHeapAgent::InspectorHeapAgent):
(Inspector::InspectorHeapAgent::nodeForHeapObjectIdentifier):
(Inspector::InspectorHeapAgent::getPreview):
(Inspector::InspectorHeapAgent::getRemoteObject):
* inspector/agents/InspectorHeapAgent.h:
* inspector/protocol/Heap.json:
New protocol methods that go from heap object identifier to a
remote object or some kind of preview.

* inspector/scripts/codegen/generator.py:
Allow runtime casts for ObjectPreview.

LayoutTests:

* inspector/heap/getPreview-expected.txt: Added.
* inspector/heap/getPreview.html: Added.
* inspector/heap/getRemoteObject-expected.txt: Added.
* inspector/heap/getRemoteObject.html: Added.
Test the new protocol methods in different scenarios.

* inspector/heap/snapshot-expected.txt:
* inspector/heap/snapshot.html:
Fix typo.

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

3 years ago[INTL] Intl Constructors not web compatible with Object.create usage
commit-queue@webkit.org [Thu, 10 Mar 2016 05:28:34 +0000 (05:28 +0000)]
[INTL] Intl Constructors not web compatible with Object.create usage
https://bugs.webkit.org/show_bug.cgi?id=153679

Patch by Andy VanWagoner <thetalecrafter@gmail.com> on 2016-03-09
Reviewed by Darin Adler.

Source/JavaScriptCore:

Add workaround for initializing NumberFormat and DateTimeFormat objects
using Object.create followed by constructor.call. This is necessary for
backwards compatibility with libraries relying on v1 behavior of Intl
constructors.

Collator does not get the workaround, since polyfills do not include it,
and there are not any known instances of v2 incompatible libraries.

The workaround involves checking for an object that inherits from the
*Format constructor, but was not actually initialized with that type. A
substitute instance is created and attached to the object using a private
name. The prototype functions then check for the private property to use
in place of the original object.

Since this behavior is not part of the v2 spec, it should be removed as
soon as the incompatible behavior is no longer in common use.

* runtime/CommonIdentifiers.h:
* runtime/IntlDateTimeFormatConstructor.cpp:
(JSC::callIntlDateTimeFormat):
* runtime/IntlDateTimeFormatPrototype.cpp:
(JSC::IntlDateTimeFormatPrototypeGetterFormat):
(JSC::IntlDateTimeFormatPrototypeFuncResolvedOptions):
* runtime/IntlNumberFormatConstructor.cpp:
(JSC::callIntlNumberFormat):
* runtime/IntlNumberFormatPrototype.cpp:
(JSC::IntlNumberFormatPrototypeGetterFormat):
(JSC::IntlNumberFormatPrototypeFuncResolvedOptions):

LayoutTests:

Add tests for Object.create + contructor.call initialization of NumberFormat
and DateTimeFormat objects.

* js/intl-datetimeformat-expected.txt:
* js/intl-numberformat-expected.txt:
* js/script-tests/intl-datetimeformat.js:
* js/script-tests/intl-numberformat.js:

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

3 years agoExtract EventPath.h/cpp out of EventDispatcher.cpp
rniwa@webkit.org [Thu, 10 Mar 2016 05:27:07 +0000 (05:27 +0000)]
Extract EventPath.h/cpp out of EventDispatcher.cpp
https://bugs.webkit.org/show_bug.cgi?id=155285

Reviewed by Chris Dumez.

Extracted EventPath.h/cpp out of EventDispatcher.cpp to add the support for Event.deepPath()
in webkit.org/b/153538. The new file defines member functions of EventPath and RelatedNodeRetargeter.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/DOMAllInOne.cpp:
* dom/EventDispatcher.cpp:
(WebCore::EventDispatcher::dispatchScopedEvent):
(WebCore::EventDispatcher::dispatchEvent):
(WebCore::EventPath): Moved to EventPath.cpp.
(WebCore::eventTargetRespectingTargetRules): Moved to EventPath.h.
(WebCore::shouldEventCrossShadowBoundary): Moved to EventPath.cpp.
(WebCore::nodeOrHostIfPseudoElement): Ditto.
(WebCore::RelatedNodeRetargeter): Moved to EventPath.cpp.
* dom/EventPath.cpp: Added.
(WebCore::shouldEventCrossShadowBoundary): Moved from EventDispatcher.cpp.
(WebCore::nodeOrHostIfPseudoElement): Ditto.
(WebCore::EventPath::EventPath): Ditto.
(WebCore::RelatedNodeRetargeter): Ditto.
* dom/EventPath.h: Added.
(WebCore::EventPath::isEmpty):
(WebCore::EventPath::size):
(WebCore::EventPath::contextAt):
(WebCore::EventPath::lastContextIfExists):
(WebCore::EventPath::eventTargetRespectingTargetRules): Moved from EventDispatcher.cpp.

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

3 years agoFont antialiasing (smoothing) changes when elements are rendered into compositing...
simon.fraser@apple.com [Thu, 10 Mar 2016 05:26:25 +0000 (05:26 +0000)]
Font antialiasing (smoothing) changes when elements are rendered into compositing layers
https://bugs.webkit.org/show_bug.cgi?id=23364
rdar://problem/7288429

Reviewed by Tim Horton.
Source/WebCore:

Improve the appearance of subpixel-antialiased ("smoothed") text in non-opaque layers
by opting in to a new CALayer backing store format.

GraphicsLayer now has setSupportsSmoothedFonts(), which is called by RenderLayerBacking
when the platform has support for the new feature. Ideally this would only be set when
we know a layer has smoothed text drawn into it, but, for now, enable this for all
layers. The right thing happens with opaque layers under the hood.

setSupportsSmoothedFonts() is turned into a PlatformCALayer contentsFormat flag, which
is ultimately passed to setBackingStoreFormat().

We also need to propagate this flag to TileController tiles.

* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::supportsSmoothedFontsInNonOpaqueLayers):
(WebCore::GraphicsLayer::GraphicsLayer):
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::supportsSmoothedFonts):
(WebCore::GraphicsLayer::setSupportsSmoothedFonts):
* platform/graphics/TiledBacking.h:
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayer::supportsSmoothedFontsInNonOpaqueLayers):
(WebCore::GraphicsLayerCA::setSupportsSmoothedFonts):
(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
(WebCore::GraphicsLayerCA::updateContentsFormat):
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/ca/PlatformCALayer.cpp:
(WebCore::PlatformCALayer::drawRepaintIndicator): Give the number a "shadow" when
the contents format says we support smoothed fonts.
* platform/graphics/ca/PlatformCALayer.h:
* platform/graphics/ca/TileController.cpp:
(WebCore::TileController::setTileContentsFormatFlags):
(WebCore::TileController::createTileLayer):
* platform/graphics/ca/TileController.h:
* platform/graphics/ca/TileGrid.cpp:
(WebCore::TileGrid::updateTileLayerProperties):
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(WebCore::setBackingStoreFormat):
(PlatformCALayerCocoa::commonInit):
(PlatformCALayerCocoa::setContentsFormat):
(PlatformCALayer::drawLayerContents): Previously, we turned off font smoothing in
non-opaque layers to improve text appearance. We no longer need to do that when
the contents format has "SmoothedFonts".
* platform/ios/LegacyTileGridTile.mm:
(WebCore::setBackingStoreFormat):
(WebCore::LegacyTileGridTile::LegacyTileGridTile):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::createGraphicsLayer):

Source/WebKit2:

Send the ContentsFormat to the UI process (but nothing happens to it there yet).

* Shared/mac/RemoteLayerTreeTransaction.h:
* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::setContentsFormat):
(WebKit::PlatformCALayerRemote::contentsFormat):
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:

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

3 years agoWebKit should adopt journal_mode=wal for all SQLite databases.
barraclough@apple.com [Thu, 10 Mar 2016 05:17:58 +0000 (05:17 +0000)]
WebKit should adopt journal_mode=wal for all SQLite databases.
https://bugs.webkit.org/show_bug.cgi?id=133496

Reviewed by Brady Eidson & Darin Adler.

The statement intended to enable WAL mode is always failing because it is missing a
prepare(). Fix this. We were also previously permitting SQLITE_OK results - this
was in error (we were only getting these because stepping the unprepared statement
returned SQLITE_OK). Also set the SQLITE_OPEN_AUTOPROXY flag when opening the
database - this will improve perfomance when the database is accessed via an AFP
mount.

* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::open):
    - call prepareAndStep(), only check for SQLITE_ROW result.
* platform/sql/SQLiteFileSystem.cpp:
(WebCore::SQLiteFileSystem::openDatabase):
    - should set SQLITE_OPEN_AUTOPROXY flag when opening database.

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

3 years agoAdd runtime flags for shadow DOM and custom elements
rniwa@webkit.org [Thu, 10 Mar 2016 04:43:14 +0000 (04:43 +0000)]
Add runtime flags for shadow DOM and custom elements
https://bugs.webkit.org/show_bug.cgi?id=155213

Reviewed by Dean Jackson.

Source/WebCore:

Added new runtime flags for shadow DOM and custom elements.

* bindings/generic/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setShadowDOMEnabled): Added.
(WebCore::RuntimeEnabledFeatures::shadowDOMEnabled): Added.
(WebCore::RuntimeEnabledFeatures::setCustomElementsEnabled): Added.
(WebCore::RuntimeEnabledFeatures::customElementsEnabled): Added.
* dom/Document.idl:
* dom/Element.idl:
* dom/Node.idl:
* dom/NonDocumentTypeChildNode.idl:
* dom/ShadowRoot.idl:
* html/HTMLSlotElement.idl:

Source/WebKit/mac:

Set the runtime flag based on preferences. Enable shadow DOM and disable custom elements by default.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences shadowDOMEnabled]):
(-[WebPreferences setShadowDOMEnabled:]):
(-[WebPreferences customElementsEnabled]):
(-[WebPreferences setCustomElementsEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit2:

Set the runtime flag based on preferences. Enable shadow DOM and disable custom elements by default.

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetShadowDOMEnabled):
(WKPreferencesGetShadowDOMEnabled):
(WKPreferencesSetCustomElementsEnabled):
(WKPreferencesGetCustomElementsEnabled):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Source/WTF:

Removed the manual overrides of ENABLE_SHADOW_DOM and ENABLE_CUSTOM_ELEMENTS as they were
making --no-shadow-dom and --no-custom-elements flags on build-webkit useless.

* wtf/FeatureDefines.h:

Tools:

Always enable shadow DOM and custom elements during testing.

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebPreferencesToConsistentValues):
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::beginTesting):
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setShadowDOMEnabled): Added.
* WebKitTestRunner/InjectedBundle/TestRunner.h:

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

3 years agoHandling 'allowUniversalAccessFromFileURLs' on WKWebViewConfiguration causes test...
bfulgham@apple.com [Thu, 10 Mar 2016 04:06:51 +0000 (04:06 +0000)]
Handling 'allowUniversalAccessFromFileURLs' on WKWebViewConfiguration causes test breakage
https://bugs.webkit.org/show_bug.cgi?id=155265
<rdar://problem/11101440>

Reviewed by Andy Estes.

Source/WebKit2:

We require "AllowUniversalAccessFromFileURLs" to permit file URLs from accessing
localStorage. However, this setting is not available on the Cocoa WKPreference (by design).
Instead, you need to set this value on the WKWebViewConfiguration.

Back out the work-around landed in r197889,

* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]): Remove test workaround.
* UIProcess/mac/WebInspectorProxyMac.mm:
(WebKit::WebInspectorProxy::platformCreateInspectorPage): Set the correct flag on
the WKWebViewConfiguration.

Tools:

WK2 localStorage tests need the 'AllowUniversalAccessFromFileURLs' preference set by default.
Tests that confirm blocking localStorage manually set the flag to "False" in the test.

* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::initializeWebViewConfiguration): Set the default state to the correct value.

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

3 years agoWeb Inspector: LayoutTimelineView path components should reflect grid row nesting
mattbaker@apple.com [Thu, 10 Mar 2016 03:16:44 +0000 (03:16 +0000)]
Web Inspector: LayoutTimelineView path components should reflect grid row nesting
https://bugs.webkit.org/show_bug.cgi?id=155279
<rdar://problem/25075355>

Reviewed by Timothy Hatcher.

* UserInterface/Views/LayoutTimelineView.js:
(WebInspector.LayoutTimelineView.prototype.get selectionPathComponents):
Walk grid nodes to build path component array.

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

3 years agoAdd proper JSON.stringify support for Proxy when the target is an array
sbarati@apple.com [Thu, 10 Mar 2016 02:41:34 +0000 (02:41 +0000)]
Add proper JSON.stringify support for Proxy when the target is an array
https://bugs.webkit.org/show_bug.cgi?id=155180

Reviewed by Darin Adler.

This patch makes the following type of program true:
`JSON.stringify(new Proxy([25], {})) === "[25]"`

We need to change the JSON stringifier to use the IsArray test
in section 7.2.2 of ES6 spec instead of the JSC inherits(JSArray::info())
test.

This patch also adds tests for general JSON.stringify support
of Proxy.

* runtime/ArrayConstructor.cpp:
(JSC::arrayConstructorIsArray):
(JSC::arrayConstructorPrivateFuncIsArrayConstructor):
* runtime/ArrayConstructor.h:
(JSC::isArray):
* runtime/JSONObject.cpp:
(JSC::Stringifier::Holder::object):
(JSC::Stringifier::appendStringifiedValue):
(JSC::Stringifier::startNewLine):
(JSC::Stringifier::Holder::Holder):
* tests/es6.yaml:
* tests/stress/proxy-json.js: Added.
(assert):
(test):

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

3 years agodefineElement should upgrade existing unresolved custom elements
rniwa@webkit.org [Thu, 10 Mar 2016 02:33:12 +0000 (02:33 +0000)]
defineElement should upgrade existing unresolved custom elements
https://bugs.webkit.org/show_bug.cgi?id=155107

Reviewed by Darin Adler.

Source/WebCore:

Added the support for upgrading existing unresolved custom elements when defineElement is called.

The current implementation upgrades elements in the order they were created and has the issue that
it keeps accumulating all elements with a hyphen in its name until defineElement is called as
documented in https://github.com/w3c/webcomponents/issues/419

This patch re-purposes IsEditingTextFlag to indicate that the node is an unresolved custom element.
Since isEditingText() is only called in textRendererIsNeeded only on Text nodes, it's mutually
exclusive with isUnresolvedCustomElement().

The list of unresolved custom elements is kept in m_upgradeCandidatesMap, a hash map of element names
to the list of unresolved elements with that name.

In addition, added the logic to use HTMLElement as the interface for unresolved custom element instead
of HTMLUnknownElement.

Test: fast/custom-elements/upgrading/upgrading-parser-created-element.html

* bindings/js/JSCustomElementInterface.cpp:
(WebCore::JSCustomElementInterface::upgradeElement): Clear the flag.
* bindings/js/JSDocumentCustom.cpp:
(WebCore::JSDocument::defineElement): Set the unique private name to keep the interface alive before
calling addElementDefinition as the call can now invoke author scripts.
* dom/CustomElementDefinitions.cpp:
(WebCore::CustomElementDefinitions::addElementDefinition): Upgrade existing unresolved elements kept
in m_upgradeCandidatesMap.
(WebCore::CustomElementDefinitions::addUpgradeCandidate): Added.
* dom/CustomElementDefinitions.h:
* dom/Document.cpp:
(WebCore::createHTMLElementWithNameValidation): Added the code to add the unresolved custom elements
to the upgrade candidates map. Also instantiate it as HTMLElement instead of HTMLUnknownElement.
(WebCore::createFallbackHTMLElement): Ditto.
* dom/Node.h:
(WebCore::Node::setIsCustomElement):
(WebCore::Node::isUnresolvedCustomElement): Added.
(WebCore::Node::setIsUnresolvedCustomElement): Added.
(WebCore::Node::setCustomElementIsResolved): Added. Clears IsEditingTextOrUnresolvedCustomElementFlag
and sets IsCustomElement.
(WebCore::Node::isEditingText): Check both IsEditingTextOrUnresolvedCustomElementFlag and IsTextFlag
for safety even though it's currently only used in textRendererIsNeeded which takes Text&.
* dom/make_names.pl:
(defaultParametersHash): Added customElementInterfaceName as a parameter.
(printWrapperFactoryCppFile): Generate the code to use customElementInterfaceName when the element
for which the wrapper is created has isUnresolvedCustomElement flag set.
* html/HTMLTagNames.in: Use HTMLElement for unresolved custom elements.
* html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface): Added the code to add
the unresolved custom elements to the upgrade candidates map. Also instantiate it as HTMLElement instead
of HTMLUnknownElement.

LayoutTests:

Added W3C style testharness.js tests for asynchronously defining custom elements.

* fast/custom-elements/upgrading/Node-cloneNode.html:
* fast/custom-elements/upgrading/upgrading-parser-created-element-expected.txt: Added.
* fast/custom-elements/upgrading/upgrading-parser-created-element.html: Added.

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

3 years agoRetrieve additional context for some data detector link for preview and action menu.
enrica@apple.com [Thu, 10 Mar 2016 02:05:49 +0000 (02:05 +0000)]
Retrieve additional context for some data detector link for preview and action menu.
https://bugs.webkit.org/show_bug.cgi?id=155278
rdar://problem/24884951

Reviewed by Tim Horton.

Source/WebCore:

Adding helper function to compute a range by moving by a number of characters
from a given position and direction.
Adding function to check if the given data detector link element requires
an extended context.

* editing/VisibleUnits.cpp:
(WebCore::rangeExpandedByCharactersInDirectionAtWordBoundary):
* editing/VisibleUnits.h:
* editing/cocoa/DataDetection.h:
* editing/cocoa/DataDetection.mm:
(WebCore::DataDetection::requiresExtendedContext):

Source/WebKit2:

Data detector results for items like calendar events, can be augmented
retrieving the text surrounding the link.

* Platform/spi/ios/DataDetectorsUISPI.h:
* Shared/ios/InteractionInformationAtPosition.h:
* Shared/ios/InteractionInformationAtPosition.mm:
(WebKit::InteractionInformationAtPosition::encode):
(WebKit::InteractionInformationAtPosition::decode):
* UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant showDataDetectorsSheet]):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _dataForPreviewItemController:atPosition:type:]):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPositionInformation):

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

3 years agoES6: Implement lexical scoping for function definitions in strict mode
sbarati@apple.com [Thu, 10 Mar 2016 02:04:20 +0000 (02:04 +0000)]
ES6: Implement lexical scoping for function definitions in strict mode
https://bugs.webkit.org/show_bug.cgi?id=152844

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

This patch implements block scoping for function definitions
in strict mode. The implementation works as follows:

- If we're in sloppy mode, function declarations work exactly
  as they did before this patch. I.e, function declarations are hoisted
  and declared like "var" variables.

- If you're in strict mode and at the top of a function scope or program
  scope, function declarations still work like they used to. They are defined
  like "var" variables. This is necessary for backwards compatibility
  because ES5 strict mode allowed duplicate function declarations at the
  top-most scope of a program/function.

- If you're in strict mode and inside a block statement or a switch statement,
  function declarations are now block scoped. All function declarations within
  a block are hoisted to the beginning of the block. They are not hoisted out of the
  block like they are in sloppy mode. This allows for the following types of
  programs:
  ```
  function foo() {
      function bar() { return 20; }
      {
          function bar() { return 30; }
          bar(); // 30
      }
      bar(); // 20
  }
  ```

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::instantiateLexicalVariables):
(JSC::BytecodeGenerator::emitPrefillStackTDZVariables):
(JSC::BytecodeGenerator::pushLexicalScope):
(JSC::BytecodeGenerator::pushLexicalScopeInternal):
(JSC::BytecodeGenerator::initializeBlockScopedFunctions):
(JSC::BytecodeGenerator::popLexicalScope):
(JSC::BytecodeGenerator::liftTDZCheckIfPossible):
(JSC::BytecodeGenerator::pushTDZVariables):
(JSC::BytecodeGenerator::getVariablesUnderTDZ):
(JSC::BytecodeGenerator::emitNewRegExp):
(JSC::BytecodeGenerator::emitNewFunctionExpressionCommon):
(JSC::BytecodeGenerator::emitNewFunctionExpression):
(JSC::BytecodeGenerator::emitNewArrowFunctionExpression):
* bytecompiler/BytecodeGenerator.h:
* parser/ASTBuilder.h:
(JSC::ASTBuilder::createSourceElements):
(JSC::ASTBuilder::features):
(JSC::ASTBuilder::numConstants):
(JSC::ASTBuilder::createFuncDeclStatement):
(JSC::ASTBuilder::createClassDeclStatement):
(JSC::ASTBuilder::createBlockStatement):
(JSC::ASTBuilder::createTryStatement):
(JSC::ASTBuilder::createSwitchStatement):
(JSC::ASTBuilder::Scope::Scope):
(JSC::ASTBuilder::funcDeclarations): Deleted.
* parser/NodeConstructors.h:
(JSC::CaseBlockNode::CaseBlockNode):
(JSC::SwitchNode::SwitchNode):
(JSC::BlockNode::BlockNode):
* parser/Nodes.cpp:
(JSC::ScopeNode::ScopeNode):
(JSC::ScopeNode::singleStatement):
(JSC::ProgramNode::ProgramNode):
(JSC::ModuleProgramNode::ModuleProgramNode):
(JSC::EvalNode::EvalNode):
(JSC::FunctionNode::FunctionNode):
(JSC::VariableEnvironmentNode::VariableEnvironmentNode):
* parser/Nodes.h:
(JSC::VariableEnvironmentNode::VariableEnvironmentNode):
(JSC::VariableEnvironmentNode::lexicalVariables):
(JSC::VariableEnvironmentNode::functionStack):
(JSC::ScopeNode::captures):
(JSC::ScopeNode::varDeclarations):
(JSC::ScopeNode::neededConstants):
(JSC::ProgramNode::startColumn):
(JSC::ProgramNode::endColumn):
(JSC::EvalNode::startColumn):
(JSC::EvalNode::endColumn):
(JSC::ModuleProgramNode::startColumn):
(JSC::ModuleProgramNode::endColumn):
(JSC::ScopeNode::functionStack): Deleted.
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseInner):
(JSC::Parser<LexerType>::didFinishParsing):
(JSC::Parser<LexerType>::parseStatementListItem):
(JSC::Parser<LexerType>::parseSwitchStatement):
(JSC::Parser<LexerType>::parseBlockStatement):
(JSC::Parser<LexerType>::parseStatement):
(JSC::Parser<LexerType>::parseFunctionInfo):
(JSC::getMetadata):
(JSC::Parser<LexerType>::parseFunctionDeclaration):
(JSC::Parser<LexerType>::parseExportDeclaration):
* parser/Parser.h:
(JSC::Scope::declareVariable):
(JSC::Scope::declareFunction):
(JSC::Scope::appendFunction):
(JSC::Scope::takeFunctionDeclarations):
(JSC::Scope::declareLexicalVariable):
(JSC::Parser::currentVariableScope):
(JSC::Parser::currentLexicalDeclarationScope):
(JSC::Parser::currentFunctionScope):
(JSC::Parser::pushScope):
(JSC::Parser::popScopeInternal):
(JSC::Parser::declareVariable):
(JSC::Parser::declareFunction):
(JSC::Parser::hasDeclaredVariable):
(JSC::Parser::isFunctionMetadataNode):
(JSC::Parser<LexerType>::parse):
* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::createFuncDeclStatement):
(JSC::SyntaxChecker::createClassDeclStatement):
(JSC::SyntaxChecker::createBlockStatement):
(JSC::SyntaxChecker::createExprStatement):
(JSC::SyntaxChecker::createIfStatement):
(JSC::SyntaxChecker::createContinueStatement):
(JSC::SyntaxChecker::createTryStatement):
(JSC::SyntaxChecker::createSwitchStatement):
(JSC::SyntaxChecker::createWhileStatement):
(JSC::SyntaxChecker::createWithStatement):
(JSC::SyntaxChecker::createDoWhileStatement):
* parser/VariableEnvironment.h:
(JSC::VariableEnvironmentEntry::isExported):
(JSC::VariableEnvironmentEntry::isImported):
(JSC::VariableEnvironmentEntry::isImportedNamespace):
(JSC::VariableEnvironmentEntry::isFunction):
(JSC::VariableEnvironmentEntry::setIsCaptured):
(JSC::VariableEnvironmentEntry::setIsConst):
(JSC::VariableEnvironmentEntry::setIsExported):
(JSC::VariableEnvironmentEntry::setIsImported):
(JSC::VariableEnvironmentEntry::setIsImportedNamespace):
(JSC::VariableEnvironmentEntry::setIsFunction):
(JSC::VariableEnvironmentEntry::clearIsVar):
(JSC::VariableEnvironment::VariableEnvironment):
(JSC::VariableEnvironment::begin):
(JSC::VariableEnvironment::end):
* tests/es6.yaml:
* tests/stress/block-scoped-function-declarations.js: Added.
(assert):
(test):
(f.foo.bar):
(f.foo.):
(f.foo):
(f):
(assert.foo.):
(assert.foo):
(assert.foo.foo):
(assert.foo.bar):
(assert.foo.switch.case.1):
(assert.foo.switch.case.2):
(assert.foo.switch.foo):
(assert.foo.switch.bar):

LayoutTests:

* js/let-syntax-expected.txt:
* js/parser-syntax-check-expected.txt:
* js/script-tests/parser-syntax-check.js:
(testFailed):
(runTest):

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

3 years agoLast opened tab does not receive SetHiddenPageTimerThrottlingIncreaseLimit message
barraclough@apple.com [Thu, 10 Mar 2016 01:55:34 +0000 (01:55 +0000)]
Last opened tab does not receive SetHiddenPageTimerThrottlingIncreaseLimit message
https://bugs.webkit.org/show_bug.cgi?id=155126

Reviewed by Anders Carlson.

WebPageProxy will increment the hidden page throttling counter from within its constructor,
which currently causes the WebProcessPool to try to synchronously message all processes.
The web page triggering the increment then fails to receive the message, since it was
still being constructed. Make the update of the limit async, such that the page is fully
constructed before the WebProcessPool processes the update.

* UIProcess/WebProcessPool.cpp:
(WebKit::m_hiddenPageThrottlingAutoIncreasesCounter):
    - This now schedules a zero-delay timer to handle the update.
(WebKit::m_hiddenPageThrottlingTimer):
    - This is now responsible for calling updateHiddenPageThrottlingAutoIncreaseLimit.
* UIProcess/WebProcessPool.h:
    - Added m_hiddenPageThrottlingTimer.

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

3 years agocheck-webkit-style: fix false-positive warnings about @try/@catch blocks in Objective...
ddkilzer@apple.com [Thu, 10 Mar 2016 01:53:43 +0000 (01:53 +0000)]
check-webkit-style: fix false-positive warnings about @try/@catch blocks in Objective-C++ source files
<http://webkit.org/b/155273>

Reviewed by Andy Estes.

* Scripts/webkitpy/style/checkers/cpp.py:
(check_spacing_for_function_call): Ignore @catch lines.
(check_braces): Ditto.
* Scripts/webkitpy/style/checkers/cpp_unittest.py:
(CppStyleTest.test_brace_at_begin_of_line): Add test case.

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

3 years agoFix the Windows build after <https://trac.webkit.org/changeset/197905>
dbates@webkit.org [Thu, 10 Mar 2016 01:46:40 +0000 (01:46 +0000)]
Fix the Windows build after <https://trac.webkit.org/changeset/197905>
(https://bugs.webkit.org/show_bug.cgi?id=155247)

We need to call the std::unique_ptr<CryptoDigest>() constructor directly
instead of using the convenience function std::make_unique<CryptoDigest>()
because std::make_unique<CryptoDigest>() cannot access the private constructor
CryptoDigest().

* platform/crypto/win/CryptoDigestWin.cpp:
(WebCore::CryptoDigest::create):

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

3 years agoEnhance existing Animometer tests
jonlee@apple.com [Thu, 10 Mar 2016 01:38:50 +0000 (01:38 +0000)]
Enhance existing Animometer tests
https://bugs.webkit.org/show_bug.cgi?id=155261

Reviewed by Simon Fraser.

* Animometer/tests/master/resources/canvas-tests.js: Add a gradient to
the filled circles. To expose more of the gradient, add another circle.
(SimpleCanvasStage.call.animate): For each frame, create a gradient with
undulating stop points and colors. Fill the circles twice; once with
the solid color, and once with the gradient.

* Animometer/tests/master/resources/dom-particles.js: Refactor the
emission variables into a separate stage for this test. Add a colorOffset
variable to make the colors of each particle slightly different, since
the ramp controller can add large numbers of particles all at once, which
would otherwise get all the same color.
* Animometer/tests/master/resources/particles.js:
(initialize): Remove the code specific to the SVG mask test.

* Animometer/tests/master/resources/image-data.js:
(initialize): Remove unused local variable.
* Animometer/tests/master/resources/multiply.js:
(initialize): Make the test harder by adding more total particles.

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

3 years agoWeb Inspector: Timelines UI redesign: use DataGridNode for TimelineView selection...
mattbaker@apple.com [Thu, 10 Mar 2016 01:38:03 +0000 (01:38 +0000)]
Web Inspector: Timelines UI redesign: use DataGridNode for TimelineView selection path components
https://bugs.webkit.org/show_bug.cgi?id=154954
<rdar://problem/24947939>

Reviewed by Timothy Hatcher.

This patch adds a new path component, TimelineDataGridNodePathComponent,
for creating a path component from the current grid selection. This is
needed since TimelineViews will no longer have an associated content tree
outline once the navigation sidebar is removed.

TimelineDataGridNode has new protected methods, "displayName" and
"iconClassNames", which are used to populate hierarchical path components,
create grid node data, and create cell content.

TimelineView subclasses share a certain amount of boilerplate code for
getting selection path components and handling path component selection.
In the future we may be able to reduce this code by introducing a new
DataGridTimelineView base class.

* UserInterface/Main.html:
Added/removed files.

* UserInterface/Views/LayoutTimelineDataGridNode.js:
(WebInspector.LayoutTimelineDataGridNode.prototype.get data):
(WebInspector.LayoutTimelineDataGridNode.prototype.createCellContent):
(WebInspector.LayoutTimelineDataGridNode):
(WebInspector.LayoutTimelineDataGridNode.prototype.get record): Deleted.
Moved to base class.

* UserInterface/Views/LayoutTimelineView.js:
(WebInspector.LayoutTimelineView.prototype.get selectionPathComponents):
(WebInspector.LayoutTimelineView.prototype.dataGridNodePathComponentSelected):
(WebInspector.LayoutTimelineView.prototype.treeElementPathComponentSelected): Deleted.
TimelineView tree outlines are going away.

* UserInterface/Views/MemoryTimelineView.js:
(WebInspector.MemoryTimelineView.prototype.treeElementPathComponentSelected): Deleted.
TimelineView tree outlines are going away.

* UserInterface/Views/NetworkTimelineView.js:
(WebInspector.NetworkTimelineView.prototype.get selectionPathComponents):
(WebInspector.NetworkTimelineView.prototype.dataGridNodePathComponentSelected):
(WebInspector.NetworkTimelineView.prototype.treeElementPathComponentSelected): Deleted.
TimelineView tree outlines are going away.

* UserInterface/Views/ProfileNodeDataGridNode.js:
(WebInspector.ProfileNodeDataGridNode.prototype.get data):
(WebInspector.ProfileNodeDataGridNode.prototype.createCellContent):
(WebInspector.ProfileNodeDataGridNode.prototype.displayName):
(WebInspector.ProfileNodeDataGridNode.prototype.iconClassNames):
(WebInspector.ProfileNodeDataGridNode):
(WebInspector.ProfileNodeDataGridNode.prototype._iconClassNameForProfileNode): Deleted.
(WebInspector.ProfileNodeDataGridNode.prototype._titleForProfileNode): Deleted.
Re-implemented as overrides of the base class methods "iconClassNames"
and "displayName".

* UserInterface/Views/RenderingFrameTimelineDataGridNode.js:
(WebInspector.RenderingFrameTimelineDataGridNode.prototype.createCellContent):
(WebInspector.RenderingFrameTimelineDataGridNode):
(WebInspector.RenderingFrameTimelineDataGridNode.prototype.get record): Deleted.
Moved to base class.

* UserInterface/Views/ResourceTimelineDataGridNode.js:
(WebInspector.ResourceTimelineDataGridNode.prototype.createCellContent):
(WebInspector.ResourceTimelineDataGridNode.prototype.displayName):
(WebInspector.ResourceTimelineDataGridNode.prototype.iconClassNames):
Override base class methods, making it possible to remove ResourceTimelineDataGridNodePathComponent,
and treat all TimelineDataGridNodes in a uniform manner.

(WebInspector.ResourceTimelineDataGridNode.prototype._createNameCellDocumentFragment):
Replace duplicated code with call to "displayName".

* UserInterface/Views/ResourceTimelineDataGridNodePathComponent.js: Removed.
Replaced by more generic solution, TimelineDataGridNodePathComponent.

* UserInterface/Views/ScriptDetailsTimelineView.js:
(WebInspector.ScriptDetailsTimelineView.prototype.get selectionPathComponents):
(WebInspector.ScriptDetailsTimelineView.prototype.dataGridNodePathComponentSelected):
(WebInspector.ScriptDetailsTimelineView.prototype.treeElementPathComponentSelected): Deleted.
TimelineView tree outlines are going away.

* UserInterface/Views/ScriptTimelineDataGridNode.js:
(WebInspector.ScriptTimelineDataGridNode.prototype.createCellContent):
(WebInspector.ScriptTimelineDataGridNode.prototype._createNameCellDocumentFragment):
Replace duplicated code with call to "displayName".

(WebInspector.ScriptTimelineDataGridNode):
(WebInspector.ScriptTimelineDataGridNode.prototype.get record): Deleted.
Moved to base class.

* UserInterface/Views/SourceCodeTimelineTimelineDataGridNode.js:
(WebInspector.SourceCodeTimelineTimelineDataGridNode.prototype.createCellContent):
(WebInspector.SourceCodeTimelineTimelineDataGridNode.prototype._createNameCellContent):
Replace duplicated code with call to "displayName".

* UserInterface/Views/TimelineDataGridNode.js:
(WebInspector.TimelineDataGridNode.prototype.get record):
Implemented in terms of the "records" getter, since all subclasses simply returned the
node's first (or only) record.

(WebInspector.TimelineDataGridNode.prototype.displayName):
(WebInspector.TimelineDataGridNode.prototype.iconClassNames):
Base class implementations, using utility methods in TimelineTabContentView
to get display data based on the node's timeline record. Can be overridden
by nodes that either don't have a timeline record (ProfileNodeDataGridNode)

* UserInterface/Views/TimelineDataGridNodePathComponent.js:
(WebInspector.TimelineDataGridNodePathComponent):
(WebInspector.TimelineDataGridNodePathComponent.prototype.get timelineDataGridNode):
(WebInspector.TimelineDataGridNodePathComponent.prototype.get previousSibling):
(WebInspector.TimelineDataGridNodePathComponent.prototype.get nextSibling):

* UserInterface/Views/TimelineView.js:
(WebInspector.TimelineView):
(WebInspector.TimelineView.prototype.get selectionPathComponents):
Must be implemented by subclasses since not all TimelineViews use a DataGrid.

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

3 years agoAdd text tests
jonlee@apple.com [Thu, 10 Mar 2016 01:37:35 +0000 (01:37 +0000)]
Add text tests
https://bugs.webkit.org/show_bug.cgi?id=155257

Reviewed by Simon Fraser.

* Animometer/resources/extensions.js:
(UnitBezier.Utilities.createClass): Add a class that computes Bezier points
assuming that two of the control points are at (0,0) and (1,1). Taken from
WebCore/platform/graphics/UnitBezier.h
* Animometer/resources/runner/tests.js: Add a test for English text and one
for international text.
* Animometer/tests/master/international.html: Added.
* Animometer/tests/master/resources/text.js: Added. The test assumes there is
#template div which it will copy. The copies are placed behind the template, and
are set with different colors each frame. They are moved around with CSS transform.
* Animometer/tests/master/text.html: Added.

Remove the other text tests, since these ones cover the same techniques.
* Animometer/tests/text/layering-text.html: Removed.
* Animometer/tests/text/resources/layering-text.js: Removed.
* Animometer/tests/text/resources/text-boxes.js: Removed.
* Animometer/tests/text/text-boxes.html: Removed.
* Animometer/resources/debug-runner/tests.js:

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

3 years agoAdd a new image test
jonlee@apple.com [Thu, 10 Mar 2016 01:35:18 +0000 (01:35 +0000)]
Add a new image test
https://bugs.webkit.org/show_bug.cgi?id=155232

Reviewed by Dean Jackson.
Provisionally reviewed by Said Abou-Hallawa.

The image test renders PNGs and moves them with translate and rotate
transforms. Each particle has a lifetime, and when the lifetime ends or
the particle goes offscreen, it resets itself somewhere on the stage.

* Animometer/resources/debug-runner/tests.js: Remove the CSS bouncing PNG
images test, because this one tests the same technique.
* Animometer/resources/runner/tests.js: Added here as "Leaves".
* Animometer/tests/master/leaves.html: Added.
* Animometer/tests/master/resources/particles.js: Refactor out the parts
specific to the DOM particles test. Consequently make velocity a public
member.
(initialize): The options parameter is never used, so remove it.
(animate): Remove unused local variable.
* Animometer/tests/master/resources/leaves.js: Maintains a focal point that
moves back and forth across the canvas. That point affects the velocity
of the particles. When the focal point is on the leftmost side, it is
between [-6, -2], and set in reset(). When the focal point is on the rightmost
side, it will be from [2, 6].
* Animometer/tests/master/resources/dom-particles.js: Move JS specific to
this test here from particles.js.

New images.
* Animometer/tests/master/resources/compass100.png: Added.
* Animometer/tests/master/resources/console100.png: Added.
* Animometer/tests/master/resources/contribute100.png: Added.
* Animometer/tests/master/resources/debugger100.png: Added.
* Animometer/tests/master/resources/inspector100.png: Added.
* Animometer/tests/master/resources/layout100.png: Added.
* Animometer/tests/master/resources/performance100.png: Added.
* Animometer/tests/master/resources/script100.png: Added.
* Animometer/tests/master/resources/shortcuts100.png: Added.
* Animometer/tests/master/resources/standards100.png: Added.
* Animometer/tests/master/resources/storage100.png: Added.
* Animometer/tests/master/resources/styles100.png: Added.
* Animometer/tests/master/resources/timeline100.png: Added.

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

3 years agoWeb Inspector: Nodes in Computed Styles > Container Regions formatted incorrectly.
mattbaker@apple.com [Thu, 10 Mar 2016 01:10:09 +0000 (01:10 +0000)]
Web Inspector: Nodes in Computed Styles > Container Regions formatted incorrectly.
https://bugs.webkit.org/show_bug.cgi?id=155277
<rdar://problem/25072711>

Reviewed by Timothy Hatcher.

* UserInterface/Views/DOMTreeDataGrid.js:
(WebInspector.DOMTreeDataGrid):
Enable icon column property.

* UserInterface/Views/DOMTreeDataGridNode.js:
(WebInspector.DOMTreeDataGridNode):
Removed calls to unused methods.

(WebInspector.DOMTreeDataGridNode.prototype.createCellContent):
(WebInspector.DOMTreeDataGridNode.prototype._createNameCellDocumentFragment):
Simplified cell content creation.

(WebInspector.DOMTreeDataGridNode.prototype._updateNodeName): Deleted.
(WebInspector.DOMTreeDataGridNode.prototype._makeNameCell): Deleted.
Renamed _createNameCellDocumentFragment to be consistent with similar
methods in other data grid node classes.

(WebInspector.DOMTreeDataGridNode.prototype._updateNameCellData): Deleted.
No longer needed.

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

3 years ago[Win] Implement CryptoDigest
dbates@webkit.org [Thu, 10 Mar 2016 01:09:03 +0000 (01:09 +0000)]
[Win] Implement CryptoDigest
https://bugs.webkit.org/show_bug.cgi?id=155247
<rdar://problem/25065843>

Reviewed by Brent Fulgham.

Implement the CryptoDigest abstraction for Windows so that we can compute cryptographically
secure hashes. This will allow us to support Content Security Policy inline script and inline
stylesheet hashes on Windows.

* PlatformWin.cmake: Add file CryptoDigestWin.cpp.
* PlatformWinCairo.cmake: Ditto.
* platform/crypto/win/CryptoDigestWin.cpp: Added.
(WebCore::CryptoDigest::CryptoDigest): Instantiate a CryptoDigestContext object.
(WebCore::CryptoDigest::~CryptoDigest): Destroy the cryptographic service provider and hash
object if non-null.
(WebCore::CryptoDigest::create): Acquire a handle to a cryptographic service provider (HCRYPTPROV)
and a handle to a hash object (HCRYPTHASH).
(WebCore::CryptoDigest::addBytes): Add the contents of the specified buffer to the hash object.
(WebCore::CryptoDigest::computeHash): Compute and return a Vector of bytes that represent the digest.

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

3 years agoBuild fix after r196870.
rniwa@webkit.org [Thu, 10 Mar 2016 01:02:35 +0000 (01:02 +0000)]
Build fix after r196870.

* public/include/report-processor.php:

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

3 years agoAdd Size metric to perf dashboard
rniwa@webkit.org [Thu, 10 Mar 2016 01:00:14 +0000 (01:00 +0000)]
Add Size metric to perf dashboard
https://bugs.webkit.org/show_bug.cgi?id=155266

Reviewed by Chris Dumez.

Added the "Size" metric and use bytes as its unit.

* public/js/helper-classes.js:
(PerfTestRuns):
* public/v2/data.js:
(RunsData.unitFromMetricName):

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

3 years agoREGRESSION (r197149): Missing availability checks when soft-linking DataDetectors...
ddkilzer@apple.com [Thu, 10 Mar 2016 00:56:31 +0000 (00:56 +0000)]
REGRESSION (r197149): Missing availability checks when soft-linking DataDetectors.framework
<http://webkit.org/b/155258>

Reviewed by Andy Estes.

Source/WebCore:

* page/mac/ServicesOverlayController.mm:
(WebCore::ServicesOverlayController::Highlight::setDDHighlight):
(WebCore::ServicesOverlayController::Highlight::paintContents):
(WebCore::ServicesOverlayController::mouseIsOverHighlight):
- Add check that returns early if DataDetectors.framework is not
  available.

* platform/spi/mac/DataDetectorsSPI.h:
- Mark Objective-C classses as optional.

Source/WebKit/mac:

* WebView/WebImmediateActionController.mm:
(-[WebImmediateActionController _clearImmediateActionState]):
(-[WebImmediateActionController immediateActionRecognizerWillBeginAnimation:]):
(-[WebImmediateActionController _animationControllerForDataDetectedText]):
(-[WebImmediateActionController _animationControllerForDataDetectedLink]):
- Add check that returns early if DataDetectors.framework is not
  available.

Source/WebKit2:

* Platform/mac/MenuUtilities.mm:
(WebKit::menuItemForTelephoneNumber):
(WebKit::menuForTelephoneNumber):
- Add check that returns early if DataDetectors.framework is not
  available.

* Shared/mac/WebHitTestResultData.mm:
(WebKit::WebHitTestResultData::platformDecode):
- Add Debug assertion.  The soft-linked code should never be
  called if there was no actionContext passed in.

* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::dismissContentRelativeChildWindowsFromViewOnly):
- Protect calls to DDActionsManager with availability check.

* UIProcess/mac/WKImmediateActionController.mm:
(-[WKImmediateActionController _clearImmediateActionState]):
(-[WKImmediateActionController immediateActionRecognizerWillBeginAnimation:]):
- Protect calls to DDActionsManager with availability check.
(-[WKImmediateActionController _animationControllerForDataDetectedText]):
(-[WKImmediateActionController _animationControllerForDataDetectedLink]):
- Add check that returns early if DataDetectors.framework is not
  available.

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

3 years agoAdd state dumping facility
commit-queue@webkit.org [Thu, 10 Mar 2016 00:45:35 +0000 (00:45 +0000)]
Add state dumping facility
https://bugs.webkit.org/show_bug.cgi?id=154930
<rdar://problem/24939135>

Patch by Keith Rollin <krollin@apple.com> on 2016-03-09
Reviewed by Anders Carlsson.

Source/WebKit2:

Collect the times at which pages are loaded. Dump them when an OS
state dump is triggered.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didCommitLoad):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::lastPageLoadTime):
* WebProcess/WebProcess.h:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::registerWithStateDumper):
(WebKit::WebProcess::platformInitializeProcess):

Source/WTF:

Add an OS_STATE flag to control the inclusion of process state dumping
functionality.

* wtf/Platform.h:

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

3 years agoRemoving reference to Dashboard.Repository.Internal.trac from open source unit tests.
jmarcell@apple.com [Thu, 10 Mar 2016 00:40:30 +0000 (00:40 +0000)]
Removing reference to Dashboard.Repository.Internal.trac from open source unit tests.
https://bugs.webkit.org/show_bug.cgi?id=155274

Reviewed by Alexey Proskuryakov.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/tests.js:
(setup): Deleted. In bug 154180 we removed Dashboard.Repository.Internal which was causing an
error in the unit tests.

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

3 years agoArray.isArray support for Proxy
sbarati@apple.com [Thu, 10 Mar 2016 00:36:06 +0000 (00:36 +0000)]
Array.isArray support for Proxy
https://bugs.webkit.org/show_bug.cgi?id=155179

Reviewed by Mark Lam.

This patch implements Array.isArray to be compliant
with the ES6 spec. Specifically, it needs to interface
properly with Proxy arguments.
https://tc39.github.io/ecma262/#sec-isarray

* runtime/ArrayConstructor.cpp:
(JSC::ArrayConstructor::getCallData):
(JSC::arrayConstructorIsArray):
(JSC::arrayConstructorPrivateFuncIsArrayConstructor):
* runtime/ArrayPrototype.cpp:
(JSC::speciesConstructArray):
* runtime/ProxyObject.cpp:
(JSC::ProxyObject::revoke):
(JSC::ProxyObject::isRevoked):
(JSC::ProxyObject::visitChildren):
* runtime/ProxyObject.h:
(JSC::ProxyObject::target):
(JSC::ProxyObject::handler):
* tests/es6.yaml:
* tests/stress/proxy-is-array.js: Added.
(assert):
(test):

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

3 years agoAdd heuristic for "main content" videos which override user gesture requirements
jer.noble@apple.com [Thu, 10 Mar 2016 00:22:12 +0000 (00:22 +0000)]
Add heuristic for "main content" videos which override user gesture requirements
https://bugs.webkit.org/show_bug.cgi?id=155224

Reviewed by Eric Carlson.

Source/WebCore:

Tests: media/video-main-content-allow-then-deny.html
       media/video-main-content-allow.html
       media/video-main-content-deny-display-none.html
       media/video-main-content-deny-not-in-dom.html
       media/video-main-content-deny-not-visible.html
       media/video-main-content-deny-obscured.html
       media/video-main-content-deny-too-small.html

Add a new behavior "restriction" to MediaElementSession that allows media elements
to optionally overriding their own user gesture requirements if the session determines
that the media element is the page's "main content".

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::didAttachRenderers):
(WebCore::HTMLMediaElement::updateShouldPlay):
* html/HTMLMediaElement.h:
* html/MediaElementSession.cpp:
(WebCore::restrictionName):
(WebCore::MediaElementSession::MediaElementSession):
(WebCore::MediaElementSession::addBehaviorRestriction):
(WebCore::MediaElementSession::playbackPermitted):
(WebCore::MediaElementSession::dataLoadingPermitted):
(WebCore::isMainContent):
(WebCore::MediaElementSession::mainContentCheckTimerFired):
(WebCore::MediaElementSession::updateIsMainContent):
* html/MediaElementSession.h:
* testing/Internals.cpp:
(WebCore::Internals::setMediaElementRestrictions):

LayoutTests:

* media/video-main-content-allow-expected.txt: Added.
* media/video-main-content-allow-then-deny-expected.txt: Added.
* media/video-main-content-allow-then-deny.html: Added.
* media/video-main-content-allow.html: Added.
* media/video-main-content-deny-display-none-expected.txt: Added.
* media/video-main-content-deny-display-none.html: Added.
* media/video-main-content-deny-not-in-dom-expected.txt: Added.
* media/video-main-content-deny-not-in-dom.html: Added.
* media/video-main-content-deny-not-visible-expected.txt: Added.
* media/video-main-content-deny-not-visible.html: Added.
* media/video-main-content-deny-obscured-expected.txt: Added.
* media/video-main-content-deny-obscured.html: Added.
* media/video-main-content-deny-too-small-expected.txt: Added.
* media/video-main-content-deny-too-small.html: Added.

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

3 years agoAdded missing #if(SOUP) after r197591.
commit-queue@webkit.org [Thu, 10 Mar 2016 00:14:07 +0000 (00:14 +0000)]
Added missing #if(SOUP) after r197591.
https://bugs.webkit.org/show_bug.cgi?id=155259

Patch by Konstantin Tokarev <annulen@yandex.ru> on 2016-03-09
Reviewed by Alex Christensen.

No new tests needed.

* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:

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

3 years ago_WKWebsiteDataSize.h should be an SPI header.
andersca@apple.com [Thu, 10 Mar 2016 00:03:04 +0000 (00:03 +0000)]
_WKWebsiteDataSize.h should be an SPI header.

Rubber-stamped by Tim Horton.

* WebKit2.xcodeproj/project.pbxproj:

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

3 years ago[JSC] Fix the ARM64 MacroAssembler after r197816
commit-queue@webkit.org [Wed, 9 Mar 2016 23:57:30 +0000 (23:57 +0000)]
[JSC] Fix the ARM64 MacroAssembler after r197816
https://bugs.webkit.org/show_bug.cgi?id=155268

Patch by Benjamin Poulain <bpoulain@apple.com> on 2016-03-09
Reviewed by Mark Lam.

The patch tries to generate instructions that do not exist,
causing quite fun stuff at runtime.

* assembler/MacroAssemblerARM64.h:
(JSC::MacroAssemblerARM64::load8):
(JSC::MacroAssemblerARM64::store16):
(JSC::MacroAssemblerARM64::store8):

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

3 years agoSkipping js/regress/getter-richards-try-catch.html on ios-simulator debug
ryanhaddad@apple.com [Wed, 9 Mar 2016 23:47:57 +0000 (23:47 +0000)]
Skipping js/regress/getter-richards-try-catch.html on ios-simulator debug
https://bugs.webkit.org/show_bug.cgi?id=155271

Unreviewed test gardening.

* platform/ios-simulator/TestExpectations:

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

3 years agoAdd a getter for WebVideoFullscreenInterfaceObjC and update its rate property
adachan@apple.com [Wed, 9 Mar 2016 23:36:22 +0000 (23:36 +0000)]
Add a getter for WebVideoFullscreenInterfaceObjC and update its rate property
https://bugs.webkit.org/show_bug.cgi?id=155239

Reviewed by Eric Carlson.

* platform/mac/WebVideoFullscreenInterfaceMac.h:
Move the stub implementation of setVideoDimensions() to the mm file.
Declare a getter to WebVideoFullscreenInterfaceMacObjC.
* platform/mac/WebVideoFullscreenInterfaceMac.mm:
(WebCore::WebVideoFullscreenInterfaceMac::setRate):
Also update the rate property of WebVideoFullscreenInterfaceMacObjC.
(WebCore::WebVideoFullscreenInterfaceMac::setVideoDimensions):
Stub implementation of setVideoDimensions() has been moved to here.

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

3 years agoFix Mac build without video enabled after r197633.
achristensen@apple.com [Wed, 9 Mar 2016 23:33:55 +0000 (23:33 +0000)]
Fix Mac build without video enabled after r197633.

* bindings/objc/DOM.mm:

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

3 years agouse ulimit command to check process limit in webkitpy
aakash_jain@apple.com [Wed, 9 Mar 2016 23:07:49 +0000 (23:07 +0000)]
use ulimit command to check process limit in webkitpy
https://bugs.webkit.org/show_bug.cgi?id=155260

Reviewed by Alexey Proskuryakov.

* Scripts/webkitpy/port/ios.py:
(IOSSimulatorPort.default_child_processes): Use ulimit command output instead of
launchctl limit maxproc command.

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

3 years agoSkip two flaky tests on mac-wk1
ryanhaddad@apple.com [Wed, 9 Mar 2016 23:02:57 +0000 (23:02 +0000)]
Skip two flaky tests on mac-wk1
https://bugs.webkit.org/show_bug.cgi?id=155196

Unreviewed test gardening.

media/video-with-blob-url-allowed-by-csp-media-src-star.html and media/video-with-data-url-allowed-by-csp-media-src-star.html
are flaky on mac-wk1. Skipping to get bots to green during investigation.

* platform/mac-wk1/TestExpectations:

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

3 years agoHandling 'allowUniversalAccessFromFileURLs' on WKWebViewConfiguration causes test...
bfulgham@apple.com [Wed, 9 Mar 2016 23:00:57 +0000 (23:00 +0000)]
Handling 'allowUniversalAccessFromFileURLs' on WKWebViewConfiguration causes test breakage
https://bugs.webkit.org/show_bug.cgi?id=155265

Unreviewed work-around to allow testing to continue.

* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]): Workaround build break.

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

3 years agoUnreviewed, rolling out r197873.
commit-queue@webkit.org [Wed, 9 Mar 2016 22:34:08 +0000 (22:34 +0000)]
Unreviewed, rolling out r197873.
https://bugs.webkit.org/show_bug.cgi?id=155262

"Crashes some JSC tests" (Requested by mlam on #webkit).

Reverted changeset:

"Add dumping of function expression names in CodeBlock
bytecode dump."
https://bugs.webkit.org/show_bug.cgi?id=155248
http://trac.webkit.org/changeset/197873

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

3 years agoRename Node.treeRoot to rootNode and turn it on by default
rniwa@webkit.org [Wed, 9 Mar 2016 22:29:33 +0000 (22:29 +0000)]
Rename Node.treeRoot to rootNode and turn it on by default
https://bugs.webkit.org/show_bug.cgi?id=155226

Reviewed by Antonio Gomes.
Source/WebCore:

Node.prototype.treeRoot has been merged into DOM spec from Shadow DOM spec and renamed to rootNode:
https://dom.spec.whatwg.org/#dom-node-rootnode

Rename the method and expose it unconditionally on Node.prototype.

Tests: fast/dom/Node/rootNode.html
       fast/shadow-dom/Node-interface-rootNode.html

* dom/ContainerNode.h:
(WebCore::Node::highestAncestor): Deleted. There is no need for this function to be inlined.
* dom/Document.h: Now that both TreeScope and Node defines rootNode, we need to pick either.
Here, we pick TreeScope's definition since Document is by definition always in a document so there is
no need to even check inTreeScope().
* dom/Node.cpp:
(WebCore::Node::rootNode): Moved here. Also added a fast path for when "this" node is in a document
or a shadow root since TreeScope stores its root node as a member variable (m_rootNode).
* dom/Node.h:
* dom/Node.idl: Renamed the method and removed Conditional=SHADOW_DOM.
* dom/ShadowRoot.h: Similar to the change in Document.h. See above.
* editing/Editor.cpp:
(WebCore::correctSpellcheckingPreservingTextCheckingParagraph): Use rootNode instead of free function
defined in htmlediting.cpp, which was removed in this patch.
* editing/htmlediting.cpp:
(WebCore::highestAncestor): Deleted.
* editing/htmlediting.h:
* html/FormAssociatedElement.cpp:
(WebCore::computeRootNode): Added.
(WebCore::FormAssociatedElement::removedFrom): We can't use Node::rootNode here because this function
is called in the middle of removing a subtree, and some associated form element's inDocument flag may
not have been updated yet. So use computeRootNode to manually find the highest ancestor.
(WebCore::FormAssociatedElement::formRemovedFromTree): Ditto.
* xml/XPathPath.cpp:
(WebCore::XPath::LocationPath::evaluate):

LayoutTests:

Split Node-interface-treeRoot.html into two pieces, the one that doesn't invoke shadow DOM and the other that tests
shadow DOM related cases. I intend to upstream these tests to W3C at some point so keep them in testharness.js form.

* fast/dom/Node/rootNode-expected.txt: Added.
* fast/dom/Node/rootNode.html: Copied from LayoutTests/fast/shadow-dom/Node-interface-treeRoot.html.
* fast/shadow-dom/Node-interface-rootNode-expected.txt: Renamed from Node-interface-treeRoot-expected.txt.
* fast/shadow-dom/Node-interface-rootNode.html: Renamed from LayoutTests/fast/shadow-dom/Node-interface-treeRoot.html.
* js/dom/dom-static-property-for-in-iteration-expected.txt:
* platform/efl/js/dom/dom-static-property-for-in-iteration-expected.txt:
* platform/gtk/js/dom/dom-static-property-for-in-iteration-expected.txt:

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

3 years ago[cmake] Fixed All-in-One build.
commit-queue@webkit.org [Wed, 9 Mar 2016 21:50:04 +0000 (21:50 +0000)]
[cmake] Fixed All-in-One build.
https://bugs.webkit.org/show_bug.cgi?id=155241

Patch by Konstantin Tokarev <annulen@yandex.ru> on 2016-03-09
Reviewed by Csaba Osztrogonác.

.:

* Source/cmake/WebKitMacros.cmake: Last item of WebCore_SOURCES was
not removed in PROCESS_ALLINONE_FILE.

Source/WebCore:

No new tests needed.

* bindings/js/JSBindingsAllInOne.cpp: Should not include generated
file.

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

3 years agoFix use-after-free when cancelling synchronous XHR when using NetworkSession
achristensen@apple.com [Wed, 9 Mar 2016 21:49:59 +0000 (21:49 +0000)]
Fix use-after-free when cancelling synchronous XHR when using NetworkSession
https://bugs.webkit.org/show_bug.cgi?id=155253

Reviewed by Brady Eidson.

* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::continueWillSendRequest):
Store the completion handler on the stack before calling didFail, which deletes the
NetworkLoad, so we don't access m_redirectCompletionHandler after deleting the NetworkLoad.

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

3 years agoUnreviewed, rebaseline bindings tests after r197874.
cdumez@apple.com [Wed, 9 Mar 2016 21:48:19 +0000 (21:48 +0000)]
Unreviewed, rebaseline bindings tests after r197874.

* bindings/scripts/test/JS/JSattribute.cpp:
(WebCore::JSattribute::getOwnPropertySlot):
* bindings/scripts/test/JS/JSattribute.h:

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

3 years agoStop building armv7 on iOS device builders
ap@apple.com [Wed, 9 Mar 2016 21:44:00 +0000 (21:44 +0000)]
Stop building armv7 on iOS device builders
https://bugs.webkit.org/show_bug.cgi?id=155246

Reviewed by David Kilzer.

* BuildSlaveSupport/build.webkit.org-config/config.json: Building both armv7 and
armv7s makes the bots unnecessarily slow. We can catch super rare v7-only regressions
elsewhere.

* Scripts/webkitpy/common/config/ews.json: Changed EWS to match, as we always want
EWS configuration to be verified by buildbot queues.

* Scripts/webkitdirs.pm:
* Scripts/webkitpy/port/ios.py:
Changed default to arm64. I think that the default is probably not used in any
practical scenarios, but it's nice to make it more sensible.

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

3 years agoUnreviewed, rolling out r197698.
commit-queue@webkit.org [Wed, 9 Mar 2016 21:31:03 +0000 (21:31 +0000)]
Unreviewed, rolling out r197698.
https://bugs.webkit.org/show_bug.cgi?id=155252

Caused assertions, and wasn't reviewed by a WK2 owner
(Requested by andersca on #webkit).

Reverted changeset:

"Last opened tab does not receive
SetHiddenPageTimerThrottlingIncreaseLimit message"
https://bugs.webkit.org/show_bug.cgi?id=155126
http://trac.webkit.org/changeset/197698

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

3 years agoWebsiteDataStore::Configuration::legacyWebsiteDataStoreConfiguration() should respect...
conrad_shultz@apple.com [Wed, 9 Mar 2016 21:30:45 +0000 (21:30 +0000)]
WebsiteDataStore::Configuration::legacyWebsiteDataStoreConfiguration() should respect the passed-in configuration
https://bugs.webkit.org/show_bug.cgi?id=155250

Reviewed by Anders Carlsson.

Note that the legacy directories are already set by default in ProcessPoolConfiguration::createWithLegacyOptions(),
which is also where the shouldHaveLegacyDataStore flag, which will cause this code path to be reached, is set.

* UIProcess/WebProcessPool.cpp:
(WebKit::legacyWebsiteDataStoreConfiguration):
Use the passed-in configuration to set the application cache, network cache, and media keys storage directories.

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

3 years agoFor RSS feeds, convert image and link relative URIs to absolute URIs
jond@apple.com [Wed, 9 Mar 2016 21:30:07 +0000 (21:30 +0000)]
For RSS feeds, convert image and link relative URIs to absolute URIs
https://bugs.webkit.org/show_bug.cgi?id=155237

Reviewed by Timothy Hatcher.

* wp-content/themes/webkit/functions.php:

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

3 years agoSpeculative disk cache resource revalidations are sometimes wasted
cdumez@apple.com [Wed, 9 Mar 2016 21:22:36 +0000 (21:22 +0000)]
Speculative disk cache resource revalidations are sometimes wasted
https://bugs.webkit.org/show_bug.cgi?id=155187
<rdar://problem/25032905>

Reviewed by Antti Koivisto.

Speculative disk cache resource revalidations were sometimes wasted.

We would sometimes correctly revalidate a resource but the
NetworkResourceLoader then either:
1. Fail to reuse the speculatively validated entry
2. Reuse the speculatively validated entry but then validate it again

Bug 1 was caused by the revalidated entry key sometimes being
different from the cached entry key. This could happen when
revalidation fails (the server did not send back a 304) in
which case we call NetworkCache::store() which creates a new
cache Entry, generating a cache key from our revalidation
request. If the original request has a cache partition or a
range, then the keys would not match because we did not set
the cache partition or the range on the revalidation request.
This has been addressed by setting the cache partition on the
revalidation request in constructRevalidationRequest() and by
not doing revalidation if the original request had a 'range'
header.

Bug 2 was caused by us marking a speculatively revalidated entry
as "not needing revalidating" only in Cache::update(). Cache::update()
is only called in the case the revalidation was successful (server
returned a 304). If revalidation was not successful, Cache::store()
would be called instead was we would fail to update the
needsRevalidation flag. NetworkResourceLoader would then validate
again the resource that was already speculatively revalidated.
To address the problem, we now update the 'needsRevalidation' flag
as soon as the speculative revalidation completes, in
SpeculativeLoad::didComplete().

* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::Cache::retrieve):
(WebKit::NetworkCache::makeCacheKey):
(WebKit::NetworkCache::Cache::update):
* NetworkProcess/cache/NetworkCacheEntry.cpp:
(WebKit::NetworkCache::Entry::setNeedsValidation):
* NetworkProcess/cache/NetworkCacheEntry.h:
* NetworkProcess/cache/NetworkCacheKey.cpp:
(WebKit::NetworkCache::noPartitionString):
(WebKit::NetworkCache::Key::Key):
(WebKit::NetworkCache::Key::hasPartition):
* NetworkProcess/cache/NetworkCacheKey.h:
* NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
(WebKit::NetworkCache::SpeculativeLoad::didComplete):
* NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
(WebKit::NetworkCache::constructRevalidationRequest):
(WebKit::NetworkCache::SpeculativeLoadManager::retrieveEntryFromStorage):
(WebKit::NetworkCache::SpeculativeLoadManager::revalidateEntry):

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

3 years agoFix old iOS
oliver@apple.com [Wed, 9 Mar 2016 21:15:00 +0000 (21:15 +0000)]
Fix old iOS

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

3 years agoWeb Inspector: Remove unnecessary constructor
commit-queue@webkit.org [Wed, 9 Mar 2016 21:13:51 +0000 (21:13 +0000)]
Web Inspector: Remove unnecessary constructor
https://bugs.webkit.org/show_bug.cgi?id=155249

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-03-09
Reviewed by Timothy Hatcher.

* UserInterface/Views/ScriptTimelineDataGrid.js:
(WebInspector.ScriptTimelineDataGrid):

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

3 years agoWincairo buildfix
oliver@apple.com [Wed, 9 Mar 2016 21:09:51 +0000 (21:09 +0000)]
Wincairo buildfix
https://bugs.webkit.org/show_bug.cgi?id=155245

Reviewed by Mark Lam.

Fix up exports for a few symbols

* jit/ExecutableAllocator.h:
* jit/ExecutableAllocatorFixedVMPool.cpp:

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

3 years agofocus() / blur() should be on HTMLElement / SVGElement, not Element
cdumez@apple.com [Wed, 9 Mar 2016 20:55:28 +0000 (20:55 +0000)]
focus() / blur() should be on HTMLElement / SVGElement, not Element
https://bugs.webkit.org/show_bug.cgi?id=155216

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline now that more checks are passing.

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

Source/WebCore:

focus() / blur() should be on HTMLElement / SVGElement, not Element:
- https://html.spec.whatwg.org/multipage/dom.html#htmlelement
- https://www.w3.org/TR/SVG2/types.html#InterfaceSVGElement

Chrome and Firefox match the specification.

Note that after this change, focus() / blur() is no longer exposed
on MathMLElement. This matches the MathML specification and is
consistent with Firefox and Chrome.

* dom/Element.idl:
* html/HTMLElement.idl:
* svg/SVGElement.idl:

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

3 years agoMove attributes to the instance for most interfaces that have "Error" in their name
cdumez@apple.com [Wed, 9 Mar 2016 20:37:36 +0000 (20:37 +0000)]
Move attributes to the instance for most interfaces that have "Error" in their name
https://bugs.webkit.org/show_bug.cgi?id=155231

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline now that more checks are passing.

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

Source/WebCore:

Our bindings generator was keeping attributes on the instances for
interfaces having "Error" or "Exception" in their name. The reason is
that interfaces that have "Error" in their prototype would not behave
correctly otherwise because "Error" incorrectly has its attributes on
the instance at the moment. However, in our bindings generator, the
condition to decide if an interface's prototype should be "Error" is
if $interface->isException. Therefore, we should use the same condition
to decide if we should keep attributes on the instance until "Error"
is updated to have its attributes on the prototype. Doing this for any
interface having "Error" or "Exception" in their name is overkill.

No new tests, already covered by existing test.

* bindings/scripts/CodeGeneratorJS.pm:
(InterfaceRequiresAttributesOnInstance):

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

3 years agoAdd dumping of function expression names in CodeBlock bytecode dump.
mark.lam@apple.com [Wed, 9 Mar 2016 20:36:40 +0000 (20:36 +0000)]
Add dumping of function expression names in CodeBlock bytecode dump.
https://bugs.webkit.org/show_bug.cgi?id=155248

Reviewed by Filip Pizlo.

Because ...
[  19] new_func_exp      loc5, loc3, f0:foo

... is more informative than
[  19] new_func_exp      loc5, loc3, f0

Anonymous functions will be dumped as <anon>.

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::dumpFunctionExpr):
(JSC::CodeBlock::dumpBytecode):
* bytecode/CodeBlock.h:

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

3 years agoAdd iOS Simulator EWS to bot watcher's dashboard
ap@apple.com [Wed, 9 Mar 2016 20:36:35 +0000 (20:36 +0000)]
Add iOS Simulator EWS to bot watcher's dashboard
https://bugs.webkit.org/show_bug.cgi?id=155220

Reviewed by Lucas Forschler.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BubbleQueueServer.js:

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

3 years agoRename WebCore/platform/crypto/mac/CryptoDigestMac.cpp to WebCore/platform/crypto...
dbates@webkit.org [Wed, 9 Mar 2016 20:25:25 +0000 (20:25 +0000)]
Rename WebCore/platform/crypto/mac/CryptoDigestMac.cpp to WebCore/platform/crypto/commoncrypto/CryptoDigestCommonCrypto.cpp
https://bugs.webkit.org/show_bug.cgi?id=155244

Reviewed by Alexey Proskuryakov.

The file WebCore/platform/crypto/mac/CryptoDigestMac.cpp is applicable to both iOS and OS X.
We should move and rename this file to reflect that is applicable to both of these platforms.

* PlatformMac.cmake:
* WebCore.xcodeproj/project.pbxproj:
* platform/crypto/commoncrypto/CryptoDigestCommonCrypto.cpp: Renamed from Source/WebCore/platform/crypto/mac/CryptoDigestMac.cpp.

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

3 years agoLocal HTML should be blocked from localStorage access unless "Disable Local File...
bfulgham@apple.com [Wed, 9 Mar 2016 20:22:28 +0000 (20:22 +0000)]
Local HTML should be blocked from localStorage access unless "Disable Local File Restrictions" is checked
https://bugs.webkit.org/show_bug.cgi?id=155185
Source/WebKit2:

Reviewed by Anders Carlsson.
<rdar://problem/11101440>

Tested by TestWebKitAPI tests IndexedDB.IndexedDBMultiProcess and IndexedDB.IndexedDBPersistence.

Allow Cocoa WKWebViewConfiguration access to the 'allowUniversalAccessFromFileURLs' setting.

* UIProcess/API/Cocoa/WKWebView.mm:
(- [WKWebView _initializeWithConfiguration]): Set 'allowUniversalAccessFromFileURLsKey' in
page configuration.
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration _allowUniversalAccessFromFileURLs]): Added,
(-[WKWebViewConfiguration _setAllowUniversalAccessFromFileURLs:]): Added.
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:

Tools:

<rdar://problem/11101440>

Reviewed by Anders Carlsson.

* TestWebKitAPI/Tests/WebKit2/CloseFromWithinCreatePage.cpp:
(TestWebKitAPI::TEST): Allow local file accesss to run test.
* TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBMultiProcess.mm:
(TEST): Ditto.
* TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBPersistence.mm:
(TEST): Ditto.

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

3 years ago[ES6] Implement RegExp sticky flag and related functionality
msaboff@apple.com [Wed, 9 Mar 2016 20:11:46 +0000 (20:11 +0000)]
[ES6] Implement RegExp sticky flag and related functionality
https://bugs.webkit.org/show_bug.cgi?id=155177

Reviewed by Saam Barati.

Source/JavaScriptCore:

Implemented the ES6 RegExp sticky functionality.

There are two main behavior changes when the sticky flag is specified.
1) Matching starts at lastIndex and lastIndex is updated after the match.
2) The regular expression is only matched from the start position in the string.
See ES6 section 21.2.5.2.2 for details.

Changed both the Yarr interpreter and jit to not loop to the next character for sticky RegExp's.
Updated RegExp exec and match, and stringProtoFuncMatch to handle lastIndex changes.

Restructured the way flags are passed to and through YarrPatterns to use RegExpFlags instead of
individual bools.

Updated tests for 'y' flag and new behavior.

* bytecode/CodeBlock.cpp:
(JSC::regexpToSourceString):
* inspector/ContentSearchUtilities.cpp:
(Inspector::ContentSearchUtilities::findMagicComment):
* runtime/CommonIdentifiers.h:
* runtime/RegExp.cpp:
(JSC::regExpFlags):
(JSC::RegExpFunctionalTestCollector::outputOneTest):
(JSC::RegExp::finishCreation):
(JSC::RegExp::compile):
(JSC::RegExp::compileMatchOnly):
* runtime/RegExp.h:
* runtime/RegExpKey.h:
* runtime/RegExpObjectInlines.h:
(JSC::RegExpObject::execInline):
(JSC::RegExpObject::matchInline):
* runtime/RegExpPrototype.cpp:
(JSC::regExpProtoFuncCompile):
(JSC::flagsString):
(JSC::regExpProtoGetterMultiline):
(JSC::regExpProtoGetterSticky):
(JSC::regExpProtoGetterUnicode):
* runtime/StringPrototype.cpp:
(JSC::stringProtoFuncMatch):
* tests/es6.yaml:
* tests/stress/static-getter-in-names.js:
(shouldBe):
* yarr/RegularExpression.cpp:
(JSC::Yarr::RegularExpression::Private::compile):
* yarr/YarrInterpreter.cpp:
(JSC::Yarr::Interpreter::tryConsumeBackReference):
(JSC::Yarr::Interpreter::matchAssertionBOL):
(JSC::Yarr::Interpreter::matchAssertionEOL):
(JSC::Yarr::Interpreter::matchAssertionWordBoundary):
(JSC::Yarr::Interpreter::matchDotStarEnclosure):
(JSC::Yarr::Interpreter::matchDisjunction):
(JSC::Yarr::Interpreter::Interpreter):
(JSC::Yarr::ByteCompiler::atomPatternCharacter):
* yarr/YarrInterpreter.h:
(JSC::Yarr::BytecodePattern::BytecodePattern):
(JSC::Yarr::BytecodePattern::estimatedSizeInBytes):
(JSC::Yarr::BytecodePattern::ignoreCase):
(JSC::Yarr::BytecodePattern::multiline):
(JSC::Yarr::BytecodePattern::sticky):
(JSC::Yarr::BytecodePattern::unicode):
* yarr/YarrJIT.cpp:
(JSC::Yarr::YarrGenerator::matchCharacterClass):
(JSC::Yarr::YarrGenerator::jumpIfCharNotEquals):
(JSC::Yarr::YarrGenerator::generateAssertionBOL):
(JSC::Yarr::YarrGenerator::generateAssertionEOL):
(JSC::Yarr::YarrGenerator::generatePatternCharacterOnce):
(JSC::Yarr::YarrGenerator::generatePatternCharacterFixed):
(JSC::Yarr::YarrGenerator::generateDotStarEnclosure):
(JSC::Yarr::YarrGenerator::backtrack):
* yarr/YarrPattern.cpp:
(JSC::Yarr::YarrPatternConstructor::YarrPatternConstructor):
(JSC::Yarr::YarrPatternConstructor::atomPatternCharacter):
(JSC::Yarr::YarrPatternConstructor::setupAlternativeOffsets):
(JSC::Yarr::YarrPatternConstructor::optimizeBOL):
(JSC::Yarr::YarrPattern::compile):
(JSC::Yarr::YarrPattern::YarrPattern):
* yarr/YarrPattern.h:
(JSC::Yarr::YarrPattern::reset):
(JSC::Yarr::YarrPattern::nonwordcharCharacterClass):
(JSC::Yarr::YarrPattern::ignoreCase):
(JSC::Yarr::YarrPattern::multiline):
(JSC::Yarr::YarrPattern::sticky):
(JSC::Yarr::YarrPattern::unicode):

LayoutTests:

New and updated tests.

* js/Object-getOwnPropertyNames-expected.txt:
* js/regexp-flags-expected.txt:
* js/regexp-sticky-expected.txt: Added.
* js/regexp-sticky.html: Added.
* js/script-tests/Object-getOwnPropertyNames.js:
* js/script-tests/regexp-flags.js:
(RegExp.prototype.hasOwnProperty): Deleted check for sticky property.
* js/script-tests/regexp-sticky.js: New test.
(asString):
(testStickyExec):
(testStickyMatch):

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

3 years agoRemoving and re-adding a script message handler with the same name results in an...
timothy_horton@apple.com [Wed, 9 Mar 2016 19:56:41 +0000 (19:56 +0000)]
Removing and re-adding a script message handler with the same name results in an unusable message handler
https://bugs.webkit.org/show_bug.cgi?id=155223

Reviewed by Sam Weinig.
Source/WebCore:

New API test: WKUserContentController.ScriptMessageHandlerReplaceWithSameName.

* page/UserMessageHandler.h:
(WebCore::UserMessageHandler::descriptor):
* page/UserMessageHandlersNamespace.cpp:
(WebCore::UserMessageHandlersNamespace::handler):
This lazy removal mechanism combined with the fact that we only compare
handler name and world makes it such that m_messageHandlers could have
a stale UserMessageHandler with a UserMessageHandlerDescriptor that differed
only in client.

It is safe to compare the descriptors by pointer instead because m_messageHandler
holds a strong reference to its UserMessageHandlerDescriptors, and this will ensure
that the add-remove-add path (with identical name and world) causes a new
UserContentController to be created.

We also now clean up any stale UserMessageHandlers whenever we're about to
add a new one, by removing any which the UserContentController no longer knows about.

Tools:

* TestWebKitAPI/Tests/WebKit2Cocoa/UserContentController.mm:
(TEST):
Add a test ensuring that it is possible to remove and re-add a script message handler
with the same name and still dispatch messages to it.

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

3 years agoFunctionExecutable::ecmaName() should not be based on inferredName().
mark.lam@apple.com [Wed, 9 Mar 2016 19:36:21 +0000 (19:36 +0000)]
FunctionExecutable::ecmaName() should not be based on inferredName().
https://bugs.webkit.org/show_bug.cgi?id=155203

Reviewed by Michael Saboff.

Source/JavaScriptCore:

The ES6 rules for how a function name should be inferred closely matches JSC's
implementation with one exception:
    var o = {}
    o.foo = function() {}

JSC's inferredName for o.foo would be "foo".
ES6 specifies that o.foo.name is "".

The fix is to add a distinct FunctionExecutable::ecmaName() which applies the ES6
rules for inferring the initial value of Function.name.

* bytecode/UnlinkedFunctionExecutable.cpp:
(JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
* bytecode/UnlinkedFunctionExecutable.h:
* parser/ASTBuilder.h:
(JSC::ASTBuilder::createAssignResolve):
(JSC::ASTBuilder::createGetterOrSetterProperty):
(JSC::ASTBuilder::createProperty):
(JSC::ASTBuilder::makeAssignNode):
* parser/Nodes.h:
* runtime/Executable.h:
* runtime/JSFunction.cpp:
(JSC::JSFunction::reifyName):
* tests/es6.yaml:

LayoutTests:

* js/script-tests/function-toString-vs-name.js:
- Fixed up object property test section and added new test cases.
* platform/mac/http/tests/media/media-source/mediasource-sourcebuffer-mode-expected.txt:

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

3 years agoAdd two finger tap on links.
enrica@apple.com [Wed, 9 Mar 2016 19:29:29 +0000 (19:29 +0000)]
Add two finger tap on links.
https://bugs.webkit.org/show_bug.cgi?id=155205
rdar://problem/22937516

Reviewed by Sam Weinig.

Adds two finger tap gesture recognizer. When performed
on a link, it calls the delegate.

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setupInteraction]):
(-[WKContentView cleanupInteraction]):
(-[WKContentView _removeDefaultGestureRecognizers]):
(-[WKContentView _addDefaultGestureRecognizers]):
(-[WKContentView _twoFingerSingleTapGestureRecognized:]):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::handleTwoFingerTapAtPoint):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::handleTwoFingerTapAtPoint):

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

3 years agoAlways call NSURLSession completion handlers
commit-queue@webkit.org [Wed, 9 Mar 2016 19:04:07 +0000 (19:04 +0000)]
Always call NSURLSession completion handlers
https://bugs.webkit.org/show_bug.cgi?id=155137

Patch by Alex Christensen <achristensen@webkit.org> on 2016-03-09
Reviewed by Darin Adler.

There are some edge cases which should not be hit, but if they are they would cause the
network process to hang and network resources to be leaked.  This can be avoided.
There are also a few release asserts that do not need to crash release builds.

* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTask::NetworkDataTask):
(WebKit::NetworkDataTask::didReceiveChallenge):
(WebKit::NetworkDataTask::didCompleteWithError):
(WebKit::NetworkDataTask::didReceiveResponse):
(WebKit::NetworkDataTask::didReceiveData):
(WebKit::NetworkDataTask::willPerformHTTPRedirection):
(WebKit::NetworkDataTask::scheduleFailure):
(WebKit::NetworkDataTask::tryPasswordBasedAuthentication):
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
(-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
(-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):

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

3 years agoAlign HTMLKeygenElement.keytype with the specification
cdumez@apple.com [Wed, 9 Mar 2016 18:45:18 +0000 (18:45 +0000)]
Align HTMLKeygenElement.keytype with the specification
https://bugs.webkit.org/show_bug.cgi?id=155214

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline now that more checks are passing.

* web-platform-tests/html/dom/reflection-forms-expected.txt:

Source/WebCore:

Align HTMLKeygenElement.keytype with the specification:
- https://html.spec.whatwg.org/#dom-keygen-keytype
- https://html.spec.whatwg.org/#attr-keygen-keytype

In particular, the following changes were made:
1. Return "rsa" by default (i.e. when the corresponding content attribute is missing)
2. Only return known values

Test: fast/dom/HTMLKeygenElement/keygen-keytype.html

* html/HTMLKeygenElement.cpp:
(WebCore::HTMLKeygenElement::setKeytype):
(WebCore::HTMLKeygenElement::keytype):
(WebCore::HTMLKeygenElement::appendFormData):
* html/HTMLKeygenElement.h:
* html/HTMLKeygenElement.idl:

LayoutTests:

Add test coverage for HTMLKeygenElement.keytype.

* fast/dom/HTMLKeygenElement/keygen-keytype-expected.txt: Added.
* fast/dom/HTMLKeygenElement/keygen-keytype.html: Added.

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

3 years ago[GStreamer] Fix MediaPlayerPrivate conflicts
philn@webkit.org [Wed, 9 Mar 2016 18:26:38 +0000 (18:26 +0000)]
[GStreamer] Fix MediaPlayerPrivate conflicts
https://bugs.webkit.org/show_bug.cgi?id=155236

Reviewed by Martin Robinson.

In some cases the mediastream player would be used to play
non-mediastream videos or MSE streams. The OWR player should be
used only for mediastreams and the MediaPlayerPrivateGStreamer
player should be used only for normal <video> elements and
MediaSource support.

This patch intends to fix the massive tests timeouts currently
happening on the GTK bots after r197752.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::supportsType): Bail out if
the type checked represents a mediastream.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
Prevent signal disconnection on possible NULL GObjects.
(WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
(WebCore::MediaPlayerPrivateGStreamerOwr::MediaPlayerPrivateGStreamerOwr):
Simplify constructor to the bare minimum.
(WebCore::MediaPlayerPrivateGStreamerOwr::load): Create sinks only
if needed from the load method.
(WebCore::MediaPlayerPrivateGStreamerOwr::getSupportedTypes):
Initialize the type cache to an empty static hashset.
(WebCore::MediaPlayerPrivateGStreamerOwr::supportsType): This
player does support mediastreams and nothing else.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.h:

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

3 years agoHarden JSC Root element functions from bad values
msaboff@apple.com [Wed, 9 Mar 2016 18:10:59 +0000 (18:10 +0000)]
Harden JSC Root element functions from bad values
https://bugs.webkit.org/show_bug.cgi?id=155234

Reviewed by Saam Barati.

Changed jsCast() to jsDynamicCast() in Root related function to protect against being
called with non-Root arguments.

* jsc.cpp:
(functionCreateElement):
(functionGetElement):
(functionSetElementRoot):

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

3 years ago[JSC] Pick how to OSR Enter to FTL at runtime instead of compile time
benjamin@webkit.org [Wed, 9 Mar 2016 17:51:38 +0000 (17:51 +0000)]
[JSC] Pick how to OSR Enter to FTL at runtime instead of compile time
https://bugs.webkit.org/show_bug.cgi?id=155217

Reviewed by Filip Pizlo.

This patch addresses 2 types of problems with tiering up to FTL
with OSR Entry in a loop:
-When there are nested loops, it is generally valuable to enter
 an outer loop rather than an inner loop.
-When tiering up at a point that cannot OSR Enter, we are at
 the mercy of the outer loop frequency to compile the right
 entry point.

The first case is significant in the test "gaussian-blur".
That test has 4 nested loops. When we have an OSR Entry,
the analysis phases have to be pesimistic where we enter:
we do not really know what constraint can be proven from
the DFG code that was running.

In "gaussian-blur", integer-range analysis removes pretty
much all overflow checks in the inner loops of where we entered.
The more outside we enter, the better code we generate.

Since we spend the most iterations in the inner loop, we naturally
tend to OSR Enter into the 2 most inner loops, making the most
pessimistic assumptions.

To avoid such problems, I changed how we decide where to OSR Enter.
Previously, the last CheckTierUpAndOSREnter to cross the threshold
was where we take the entry point for FTL.

What happens now is that the entry point is not decied when
compiling the CheckTierUp variants. Instead, all the information
we need is gathered during compilation and keept on the JITCode
to be used at runtime.

When we try to tier up and decide to OSR Enter, we use the information
we have to pick a good outer loop for OSR Entry.

Now the problem is outer loop do not CheckTierUpAndOSREnter often,
wasting several miliseconds before entering the newly compiled FTL code.

To solve that, every CheckTierUpAndOSREnter has its own trigger that
bypass the counter. When the FTL Code is compiled, the trigger is set
and we enter through the right CheckTierUpAndOSREnter immediately.

---

This new mechanism also solves a problem of ai-astar.
When we try to tier up in ai-astar, we had nothing to compile until
the outer loop is reached.

To make sure we reached the CheckTierUpAndOSREnter in a reasonable time,
we had CheckTierUpWithNestedTriggerAndOSREnter with a special trigger.

With the new mechanism, we can do much better:
-When we keep hitting CheckTierUpInLoop, we now have all the information
 we need to already start compiling the outer loop.
 Instead of waiting for the outer loop to be reached a few times, we compile
 it as soon as the inner loop is hammering CheckTierUpInLoop.
-With the new triggers, the very next time we hit the outer loop, we OSR Enter.

This allow us to compile what we need sooner and enter sooner.

* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): Deleted.
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize): Deleted.
* dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC): Deleted.
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode): Deleted.
* dfg/DFGJITCode.h:
* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::JITCompiler):
(JSC::DFG::JITCompiler::compileEntryExecutionFlag):
* dfg/DFGNodeType.h:
* dfg/DFGOperations.cpp:
* dfg/DFGOperations.h:
* dfg/DFGPlan.h:
(JSC::DFG::Plan::canTierUpAndOSREnter):
* dfg/DFGPredictionPropagationPhase.cpp:
(JSC::DFG::PredictionPropagationPhase::propagate): Deleted.
* dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute): Deleted.
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile): Deleted.
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGTierUpCheckInjectionPhase.cpp:
(JSC::DFG::TierUpCheckInjectionPhase::run):
(JSC::DFG::TierUpCheckInjectionPhase::buildNaturalLoopToLoopHintMap):
(JSC::DFG::TierUpCheckInjectionPhase::findLoopsContainingLoopHintWithoutOSREnter): Deleted.
* dfg/DFGToFTLForOSREntryDeferredCompilationCallback.cpp:
(JSC::DFG::ToFTLForOSREntryDeferredCompilationCallback::ToFTLForOSREntryDeferredCompilationCallback):
(JSC::DFG::Ref<ToFTLForOSREntryDeferredCompilationCallback>ToFTLForOSREntryDeferredCompilationCallback::create):
(JSC::DFG::ToFTLForOSREntryDeferredCompilationCallback::compilationDidBecomeReadyAsynchronously):
(JSC::DFG::ToFTLForOSREntryDeferredCompilationCallback::compilationDidComplete):
* dfg/DFGToFTLForOSREntryDeferredCompilationCallback.h:

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

3 years agoCleaning up TestExpectations files to remove deleted tests and duplicate entries...
ryanhaddad@apple.com [Wed, 9 Mar 2016 17:44:24 +0000 (17:44 +0000)]
Cleaning up TestExpectations files to remove deleted tests and duplicate entries for ios-simulator.

Unreviewed test gardening.

* TestExpectations:
* platform/ios-simulator/TestExpectations:

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

3 years agoSkipping fast/events/max-tabindex-focus.html on ios-simulator
ryanhaddad@apple.com [Wed, 9 Mar 2016 17:25:23 +0000 (17:25 +0000)]
Skipping fast/events/max-tabindex-focus.html on ios-simulator
https://bugs.webkit.org/show_bug.cgi?id=155233

Unreviewed test gardening.

* platform/ios-simulator/TestExpectations:

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

3 years agoLocal HTML should be blocked from localStorage access unless "Disable Local File...
bfulgham@apple.com [Wed, 9 Mar 2016 17:06:56 +0000 (17:06 +0000)]
Local HTML should be blocked from localStorage access unless "Disable Local File Restrictions" is checked..
https://bugs.webkit.org/show_bug.cgi?id=155185
<rdar://problem/11101440>

Reviewed by Zalan Bujtas.

Source/WebCore:

Tested by storage/domstorage/localstorage/blocked-file-access.html.

* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::canAccessStorage): If the origin is a local file, and we have not been granted
universal file access, prevent access to DOM localStorage.

LayoutTests:

* storage/domstorage/localstorage/blocked-file-access-expected.txt: Added.
* storage/domstorage/localstorage/blocked-file-access.html: Added.
* storage/domstorage/localstorage/resources/blocked-example.html: Added.

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

3 years ago[css-grid] Allow to place positioned grid items on the padding
rego@igalia.com [Wed, 9 Mar 2016 14:26:39 +0000 (14:26 +0000)]
[css-grid] Allow to place positioned grid items on the padding
https://bugs.webkit.org/show_bug.cgi?id=155199

Reviewed by Sergio Villar Senin.

Source/WebCore:

According to the following discussion on the CSS WG mailing list,
we should be able to place positioned grid items on the padding directly:
https://lists.w3.org/Archives/Public/www-style/2015Nov/0070.html

This means that a positioned grid item can be placed on the padding itself.
The "auto" value resolves to the padding edges (0th and -0th lines).
So if a positioned item is placed with: grid-column: auto / 1;
it'd be placed on the padding, from line 0th to 1st line.

On top of that, we've to detect properly the first and last explicit
grid lines during the layout of positioned grid items.
We have to consider that the grid can have implicit tracks created
previously by regular grid items.

Tests: fast/css-grid-layout/grid-positioned-items-padding.html
       fast/css-grid-layout/grid-positioned-items-within-grid-implicit-track.html

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::offsetAndBreadthForPositionedChild):

LayoutTests:

Add new tests and updated results in a current one.

* fast/css-grid-layout/grid-positioned-items-implicit-grid.html:
* fast/css-grid-layout/grid-positioned-items-padding-expected.txt: Added.
* fast/css-grid-layout/grid-positioned-items-padding.html: Added.
* fast/css-grid-layout/grid-positioned-items-within-grid-implicit-track-expected.txt: Added.
* fast/css-grid-layout/grid-positioned-items-within-grid-implicit-track.html: Added.

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

3 years agoImageDocuments leak their world.
akling@apple.com [Wed, 9 Mar 2016 12:00:32 +0000 (12:00 +0000)]
ImageDocuments leak their world.
<https://webkit.org/b/155167>
<rdar://problem/24987363>

Reviewed by Antti Koivisto.

Source/WebCore:

ImageDocument uses a special code path in ImageLoader in order to manually
control how the image is loaded. It has to do this because the ImageDocument
is really just a synthetic wrapper around a main resource that's an image.

This custom loading code had a bug where it would create a new CachedImage
and neglect to set its CachedResource::m_state flag to Pending (which is
normally set by CachedResource::load(), but we don't call that for these.)

This meant that when ImageDocument called CachedImage::finishLoading() to
trigger the notifyFinished() callback path, the image would look at its
loading state and see that it was Unknown (not Pending), and conclude that
it hadn't loaded yet. So we never got the notifyFinished() signal.

The world leaks here because ImageLoader slaps a ref on its <img> element
while it waits for the loading operation to complete. Once finished, whether
successfully or with an error, it derefs the <img>.

Since we never fired notifyFinished(), we ended up with an extra ref on
these <img> forever, and then the element kept its document alive too.

Test: fast/dom/ImageDocument-world-leak.html

* loader/ImageLoader.cpp:
(WebCore::ImageLoader::updateFromElement):

LayoutTests:

Made a little test that loads an image into an <iframe> 10 times and then
triggers a garbage collection and checks that all the documents got destroyed.

Prior to this change, all 10 ImageDocuments would remain alive at the end.

This got rolled out the first time because it failed on bots. It failed due
to expecting a specific number of documents to be live at the start of the
test, which was not reliable on bots since we appear to have more leaks(!)

Tweaked the test to check the delta in live document count instead.

* fast/dom/ImageDocument-world-leak-expected.txt: Added.
* fast/dom/ImageDocument-world-leak.html: Added.

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

3 years ago[css-grid] Fix auto-track sizing with min-size:auto and specific sizes
svillar@igalia.com [Wed, 9 Mar 2016 11:02:40 +0000 (11:02 +0000)]
[css-grid] Fix auto-track sizing with min-size:auto and specific sizes
https://bugs.webkit.org/show_bug.cgi?id=155165

Reviewed by Darin Adler.

Source/WebCore:

Specs recently changed the way auto tracks are sized. In the
previous versions, when sizing auto minimums, only the
min-width|height of the items spanning through the auto tracks
were used to size them. The new text specifies that for items
with a specified minimum size of auto, the behavior is
equivalent to a min-content minimum.

This means that from now on, auto tracks with min-size:auto
will no longer be smaller than min-content tracks (which was
pretty weird from the user POV).

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::minSizeForChild): use grid items
min-content contributions whenever the specified size is not
auto or when min-size is auto.

LayoutTests:

* fast/css-grid-layout/grid-automatic-minimum-for-auto-columns-expected.txt:
* fast/css-grid-layout/grid-automatic-minimum-for-auto-columns.html:
* fast/css-grid-layout/grid-automatic-minimum-for-auto-rows-expected.txt:
* fast/css-grid-layout/grid-automatic-minimum-for-auto-rows.html:

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

3 years ago[css-grid] Initial support for implicit grid before explicit grid
rego@igalia.com [Wed, 9 Mar 2016 10:15:23 +0000 (10:15 +0000)]
[css-grid] Initial support for implicit grid before explicit grid
https://bugs.webkit.org/show_bug.cgi?id=155014

Reviewed by Darin Adler.

Source/WebCore:

Change GridSpan to store int instead of unsigned. This allows us to
resolve positions before the explicit grid with negative values.

This patch adds a new type of GridSpan called "Untranslated".
This type is only used in populateExplicitGridAndOrderIterator().
Where we store the smallest negative position in both axis.

Then the GridSpans are translated into positive values, using the offset
calculated before. This is done in placeItemsOnGrid() and from that
moment the rest of the code uses "Definite" GridSpans, which returns
only positive positions (unsigned instead of int).
This allows us to don't have to modify the rest of the code, as it keeps
using GridSpans as before.

Let's use an example to explain how it works. Imagine that we've a 2
columns grid and 2 items placed like:
* Item A: grid-column: -5;
* Item B: grid-column: 1;

Initially we'll use "Unstranslated" GridSpans with the following values:
* Item A: GridSpan(-2, -1)
* Item B: GridSpan(0, 1)

Then we'll translate them using the smallest position as offset (-2)
so we've "Definite" GridSpans:
* Item A: GridSpan(0, 1)
* Item B: GridSpan(2, 3)

Test: fast/css-grid-layout/implicit-tracks-before-explicit.html

* css/CSSParser.cpp:
(WebCore::CSSParser::parseGridTemplateAreasRow):
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::GridIterator::nextEmptyGridArea):
(WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
(WebCore::RenderGrid::gridTrackSize):
(WebCore::RenderGrid::insertItemIntoGrid):
(WebCore::RenderGrid::placeItemsOnGrid):
(WebCore::RenderGrid::populateExplicitGridAndOrderIterator):
(WebCore::RenderGrid::createEmptyGridAreaAtSpecifiedPositionsOutsideGrid):
(WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid):
(WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid):
(WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
(WebCore::RenderGrid::placeAutoMajorAxisItemsOnGrid): Deleted.
(WebCore::RenderGrid::layoutPositionedObject): Deleted.
* rendering/RenderGrid.h:
* rendering/style/GridCoordinate.h:
(WebCore::GridSpan::untranslatedDefiniteGridSpan):
(WebCore::GridSpan::translatedDefiniteGridSpan):
(WebCore::GridSpan::integerSpan):
(WebCore::GridSpan::untranslatedResolvedInitialPosition):
(WebCore::GridSpan::untranslatedResolvedFinalPosition):
(WebCore::GridSpan::resolvedInitialPosition):
(WebCore::GridSpan::resolvedFinalPosition):
(WebCore::GridSpan::begin):
(WebCore::GridSpan::end):
(WebCore::GridSpan::isTranslatedDefinite):
(WebCore::GridSpan::isIndefinite):
(WebCore::GridSpan::translate):
(WebCore::GridSpan::GridSpan):
(WebCore::GridSpan::operator==): Deleted.
(WebCore::GridSpan::GridSpanIterator::GridSpanIterator): Deleted.
(WebCore::GridSpan::GridSpanIterator::operator unsigned&): Deleted.
* rendering/style/GridResolvedPosition.cpp:
(WebCore::resolveRowStartColumnStartNamedGridLinePositionAgainstOppositePosition):
(WebCore::resolveRowEndColumnEndNamedGridLinePositionAgainstOppositePosition):
(WebCore::resolveNamedGridLinePositionAgainstOppositePosition):
(WebCore::resolveGridPositionAgainstOppositePosition):
(WebCore::resolveGridPositionFromStyle):
(WebCore::GridResolvedPosition::resolveGridPositionsFromStyle):
(WebCore::GridResolvedPosition::spanSizeForAutoPlacedItem): Deleted.

LayoutTests:

Updated results in current tests and added specific test for this.

* fast/css-grid-layout/grid-auto-flow-resolution.html:
* fast/css-grid-layout/grid-item-negative-position-resolution.html:
* fast/css-grid-layout/grid-item-spanning-resolution.html:
* fast/css-grid-layout/implicit-tracks-before-explicit-expected.txt: Added.
* fast/css-grid-layout/implicit-tracks-before-explicit.html: Added.

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

3 years ago[iOS] Arabic text on Wikipedia is shown as boxes
mmaxfield@apple.com [Wed, 9 Mar 2016 08:54:56 +0000 (08:54 +0000)]
[iOS] Arabic text on Wikipedia is shown as boxes
https://bugs.webkit.org/show_bug.cgi?id=155129
<rdar://problem/24919902>

Reviewed by Darin Adler.

Source/WebCore:

GeezaPro is the PostScript name, not the family name.

Test: fast/text/arabic-blacklisted.html

* platform/graphics/ios/FontCacheIOS.mm:
(WebCore::platformLookupFallbackFont):

LayoutTests:

This test is iOS-specific.

* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/mac/TestExpectations:
* platform/win/TestExpectations:
* fast/text/arabic-blacklisted-expected.html: Added.
* fast/text/arabic-blacklisted.html: Added.

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

3 years agoUnreviewed, rolling out r197825.
commit-queue@webkit.org [Wed, 9 Mar 2016 07:45:19 +0000 (07:45 +0000)]
Unreviewed, rolling out r197825.
https://bugs.webkit.org/show_bug.cgi?id=155222

It broke the EFL build. It is not dead code. (Requested by
gyuyoung on #webkit).

Reverted changeset:

"Delete dead scrolling code"
https://bugs.webkit.org/show_bug.cgi?id=155210
http://trac.webkit.org/changeset/197825

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

3 years agoRemove failing assertion. There are strings that claim to be atomic but that the
fpizlo@apple.com [Wed, 9 Mar 2016 07:29:43 +0000 (07:29 +0000)]
Remove failing assertion. There are strings that claim to be atomic but that the
compiler thread can totally deal with, like the empty string.

Rubber stamped by Mark Lam.

* wtf/text/StringImpl.h:
(WTF::StringImpl::ref):
(WTF::StringImpl::deref):

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

3 years agoElement with maximum tabIndex cannot be returned by nextElementWithGreaterTabIndex()
cdumez@apple.com [Wed, 9 Mar 2016 06:27:54 +0000 (06:27 +0000)]
Element with maximum tabIndex cannot be returned by nextElementWithGreaterTabIndex()
https://bugs.webkit.org/show_bug.cgi?id=155215

Reviewed by Ryosuke Niwa.

Source/WebCore:

Element with maximum tabIndex cannot be returned by nextElementWithGreaterTabIndex()
due to a bug in r197726. This patch fixes the issue by only comparing
candidate.tabIndex to winningTabIndex if winner is non-null.

Test: fast/events/max-tabindex-focus.html

* page/FocusController.cpp:
(WebCore::nextElementWithGreaterTabIndex):

LayoutTests:

Add test to make sure that an Element with a tabIndex equal to
2147483647 (maximum tabIndex) can be focused.

* fast/events/max-tabindex-focus-expected.txt: Added.
* fast/events/max-tabindex-focus.html: Added.

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

3 years agoFix iOS Simulator EWS.
ap@apple.com [Wed, 9 Mar 2016 05:53:54 +0000 (05:53 +0000)]
Fix iOS Simulator EWS.

Unreviewed build fix.

* Scripts/webkitpy/common/config/ports.py:

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

3 years agoDFG should be able to constant-fold strings
fpizlo@apple.com [Wed, 9 Mar 2016 05:16:47 +0000 (05:16 +0000)]
DFG should be able to constant-fold strings
https://bugs.webkit.org/show_bug.cgi?id=155200

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

This adds constant-folding of string1 + string2 and string.length. The actual folding
rule is easy, but there are some gotchas.

The problem is that the DFG cannot allocate new JSString objects until we are on the
main thread. So, DFG IR must have a node for a JSValue string constant that hasn't been
created yet - i.e. it doesn't have any concrete JSValue bits yet.

We have the ability to speak of such things, using LazyJSValue. But that's a class, not
a node type. This patch now adds a node type, LazyJSConstant, which is a Node that holds
a LazyJSValue.

This puts us in a weird situation: AI uses JSValue to represent constants. It would take
a lot of work to change it to use LazyJSValue. So, this implements the constant folding
in StrengthReductionPhase. I created a bug and put a FIXME about moving these rules into
AI.

OTOH, our experience in B3 shows that constant folding in strength reduction is quite
nice. It would totally make sense to have strength reduction have constant folding rules
that mirror the rules in AI, or to factor out the AI constant folding rules, the same
way that B3 factors out those rules into Value methods.

Another issue is how to represent the cumulative result of possibly many foldings. I
initially considered adding LazyJSValue kinds that represented concatenation. Folding
the concatenation to a constant meand that this constant was actually a LazyJSValue that
represented the concatenation of two other things. But this would get super messy if we
wanted to fold an operation that uses the results of another folded operation.

So, the JIT thread folds string operations by creating a WTF::String that contains the
result. The DFG::Graph holds a +1 on the underlying StringImpl, so we can pass the
StringImpl* around without reference counting. The LazyJSValue now has a special kind
that means: we created this StringImpl* on the JIT thread, and once the JIT is done, we
will relinquish ownership of it. LazyJSValue has some magic to emit code for these
to-be-created-JSStrings while also transferring ownership of the StringImpl from the JIT
thread to the main thread and registering the JSString with the GC.

This just implements folding for concatenation and GetArrayLength. It's just a proof of
concept for evil things I want to do later.

This change is a 2.5x speed-up on the string concatenation microbenchmarks I added in
this patch.

* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGFrozenValue.cpp:
(JSC::DFG::FrozenValue::emptySingleton):
(JSC::DFG::FrozenValue::tryGetString):
(JSC::DFG::FrozenValue::dumpInContext):
* dfg/DFGFrozenValue.h:
(JSC::DFG::FrozenValue::strength):
* dfg/DFGGraph.h:
* dfg/DFGLazyJSValue.cpp:
(JSC::DFG::LazyJSValue::newString):
(JSC::DFG::LazyJSValue::getValue):
(JSC::DFG::equalToStringImpl):
(JSC::DFG::LazyJSValue::tryGetStringImpl):
(JSC::DFG::LazyJSValue::tryGetString):
(JSC::DFG::LazyJSValue::strictEqual):
(JSC::DFG::LazyJSValue::switchLookupValue):
(JSC::DFG::LazyJSValue::emit):
(JSC::DFG::LazyJSValue::dumpInContext):
* dfg/DFGLazyJSValue.h:
(JSC::DFG::LazyJSValue::LazyJSValue):
(JSC::DFG::LazyJSValue::knownStringImpl):
(JSC::DFG::LazyJSValue::kind):
(JSC::DFG::LazyJSValue::tryGetValue):
(JSC::DFG::LazyJSValue::character):
(JSC::DFG::LazyJSValue::stringImpl):
* dfg/DFGMayExit.cpp:
(JSC::DFG::mayExit):
* dfg/DFGNode.cpp:
(JSC::DFG::Node::convertToIdentityOn):
(JSC::DFG::Node::convertToLazyJSConstant):
(JSC::DFG::Node::convertToPutHint):
(JSC::DFG::Node::convertToPutClosureVarHint):
(JSC::DFG::Node::tryGetString):
(JSC::DFG::Node::promotedLocationDescriptor):
* dfg/DFGNode.h:
(JSC::DFG::Node::convertToConstant):
(JSC::DFG::Node::convertToConstantStoragePointer):
(JSC::DFG::Node::castConstant):
(JSC::DFG::Node::hasLazyJSValue):
(JSC::DFG::Node::lazyJSValue):
(JSC::DFG::Node::initializationValueForActivation):
* dfg/DFGNodeType.h:
* dfg/DFGPredictionPropagationPhase.cpp:
(JSC::DFG::PredictionPropagationPhase::propagate):
* dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileSetRegExpObjectLastIndex):
(JSC::DFG::SpeculativeJIT::compileLazyJSConstant):
* dfg/DFGSpeculativeJIT.h:
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGStrengthReductionPhase.cpp:
(JSC::DFG::StrengthReductionPhase::handleNode):
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileInt52Constant):
(JSC::FTL::DFG::LowerDFGToB3::compileLazyJSConstant):
(JSC::FTL::DFG::LowerDFGToB3::compileDoubleRep):

Source/WTF:

Also disable assertions about reference counting strings on the JIT thread. We will do
that now and it's OK.

* wtf/text/StringImpl.h:
(WTF::StringImpl::ref):
(WTF::StringImpl::deref):

LayoutTests:

* js/regress/script-tests/strcat-const.js: Added.
(foo):
(bar):
* js/regress/script-tests/strcat-length-const.js: Added.
(foo):
(bar):
* js/regress/strcat-const-expected.txt: Added.
* js/regress/strcat-const.html: Added.
* js/regress/strcat-length-const-expected.txt: Added.
* js/regress/strcat-length-const.html: Added.

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