Add support for thread QoS
https://bugs.webkit.org/show_bug.cgi?id=130688

Reviewed by Andreas Kling.

Source/JavaScriptCore: 

* heap/BlockAllocator.cpp:
(JSC::BlockAllocator::blockFreeingThreadStartFunc):
    - block freeing is a utility activity.

Source/WTF: 

* wtf/FastMalloc.cpp:
(WTF::TCMalloc_PageHeap::runScavengerThread):
    - block freeing is a utility activity.
* wtf/Threading.h:
    - declaration.
* wtf/ThreadingPthreads.cpp:
(WTF::createThreadInternal):
    - default to interactive.
(WTF::setCurrentThreadQOSUtility):
    - implementation.
* wtf/ThreadingWin.cpp:
(WTF::setCurrentThreadQOSUtility):
    - no-op implementation.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166184 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add support for thread QoS
https://bugs.webkit.org/show_bug.cgi?id=130688

Speculative EFL build fix.

* wtf/ThreadingPthreads.cpp:
(WTF::setCurrentThreadQOSUtility):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS] Download support by CFURLDownloadRef under USE(CFNETWORK).
https://bugs.webkit.org/show_bug.cgi?id=129322

Reviewed by Anders Carlsson.

Source/WebCore:

* platform/network/ResourceHandle.h:
* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::ResourceHandle::releaseConnectionForDownload): Changed to
return a RetainPtr that adopts the connection's retain count.

Source/WebKit/mac:

* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::convertMainResourceLoadToDownload): Use the
RetainPtr returned by releaseConnectionForDownload() rather than
manually releasing.

Source/WebKit2:

Based on an original patch by Yongjun Zhang  <yongjun_zhang@apple.com>.

* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):
* Shared/Downloads/ios/DownloadIOS.mm:
(WebKit::dispatchOnMainThread):
(WebKit::toDownload):
(WebKit::setUpDownloadClient):
(WebKit::Download::startWithHandle):
* UIProcess/API/APIDownloadClient.h:
(API::DownloadClient::~DownloadClient):
* UIProcess/API/C/WKContext.cpp:
(WKContextSetDownloadClient):
* UIProcess/API/Cocoa/WKProcessPool.mm:
(-[WKProcessPool _downloadDelegate]):
(-[WKProcessPool _setDownloadDelegate:]):
* UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
* UIProcess/API/Cocoa/_WKDownload.h: Added.
* UIProcess/API/Cocoa/_WKDownload.mm: Added.
(WebKit::wrapper):
(WebKit::createAPIDownloadClient):
(-[_WKDownload dealloc]):
(-[_WKDownload API::]):
* UIProcess/API/Cocoa/_WKDownloadDelegate.h: Added.
* UIProcess/API/Cocoa/_WKDownloadInternal.h: Added.
* UIProcess/Cocoa/DownloadClient.h: Added.
* UIProcess/Cocoa/DownloadClient.mm: Added.
* WebKit2.xcodeproj/project.pbxproj:

Tools:

Add an API test suite for _WKDownload.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/Download.mm: Added.
(-[DownloadDelegate initWithSourceURL:]):
(-[DownloadDelegate sourceURL]):
(-[DownloadDelegate _downloadDidStart:]):
(-[DownloadDelegate _download:didReceiveResponse:]):
(-[DownloadDelegate _download:didReceiveData:]):
(-[DownloadDelegate _download:decideDestinationWithSuggestedFilename:allowOverwrite:]):
(-[DownloadDelegate _downloadDidFinish:]):
(TEST):
(runTestWithNavigationDelegate):
(-[DownloadNavigationDelegate webView:decidePolicyForNavigationAction:decisionHandler:]):
(-[ConvertResponseToDownloadNavigationDelegate webView:decidePolicyForNavigationResponse:decisionHandler:]):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove WebGL asset entitlement
https://bugs.webkit.org/show_bug.cgi?id=130685

Reviewed by Simon Fraser.

No longer necessary on iOS.

* Configurations/WebContent-iOS.entitlements:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166187 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS][WK2] Micro-optimize view state updates on the UIProcess side
https://bugs.webkit.org/show_bug.cgi?id=130631

Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-03-24
Reviewed by Darin Adler.

* UIProcess/API/Cocoa/WKWebView.mm:
(contentZoomScale):
[UIScrollView zoomScale] is not fast enough for -[WKWebView _updateVisibleContentRects]. Since we know what the zoom view is,
make a fast version hardcoding that.

(-[WKWebView _updateScrollViewBackground]):
(-[WKWebView _zoomToPoint:WebCore::atScale:]):
(-[WKWebView _scrollToRect:WebCore::origin:WebCore::minimumScrollDistance:]):
(-[WKWebView _zoomToRect:WebCore::withOrigin:WebCore::fitEntireRect:minimumScale:maximumScale:minimumScrollDistance:]):
(-[WKWebView _updateVisibleContentRects]):
* UIProcess/ios/WKContentView.mm:
(fixedPositionRectFromExposedRect):
(-[WKContentView didUpdateVisibleRect:unobscuredRect:scale:inStableState:]):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166188 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix prepare-ChangeLog after r166156.
https://bugs.webkit.org/show_bug.cgi?id=130674

Reviewed by Darin Adler.

* Scripts/prepare-ChangeLog:
(generateFunctionLists):
(extractLineRangeBeforeChange):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166189 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Lazy load source code referred to from the source map, instead of when
the source code is revealed in the Resources sidebar.

https://bugs.webkit.org/show_bug.cgi?id=130625

Reviewed by Joseph Pecoraro.

* UserInterface/Models/SourceMapResource.js:
(WebInspector.SourceMapResource): Set up the type info here so it can be used to
dispaly the right icon in the sidebar.
(WebInspector.SourceMapResource.prototype.canRequestContentFromBackend): Use _contentRequested.
(WebInspector.SourceMapResource.prototype.requestContentFromBackend.sourceMapResourceLoaded):
Reset finished and remove the type change dance we had before.
* UserInterface/Views/SourceMapResourceTreeElement.js:
(WebInspector.SourceMapResourceTreeElement.prototype.onattach): Removed. Don't request content here.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166190 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WK2] Make updates on ViewUpdateDispatcher less heavy
https://bugs.webkit.org/show_bug.cgi?id=130626

Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-03-24
Reviewed by Darin Adler.

* WebProcess/WebPage/ViewUpdateDispatcher.cpp:
(WebKit::ViewUpdateDispatcher::visibleContentRectUpdate):
(WebKit::ViewUpdateDispatcher::dispatchVisibleContentRectUpdate):
* WebProcess/WebPage/ViewUpdateDispatcher.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166191 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Stop pulling in all the macro assemblers from VM.h
<https://webkit.org/b/130691>

Remove #include of "GPRInfo.h". This breaks WebCore's dependency
on macro assemblers headers and removes 8 includes from every
.cpp file in the JS bindings.

Reviewed by Geoff Garen.

* runtime/VM.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166192 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix the iOS build.

* wtf/ThreadingPthreads.cpp:
(WTF::createThreadInternal):
(WTF::setCurrentThreadQOSUtility):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166193 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Regression: AX: Don't expose role or notifications for invalid menus
https://bugs.webkit.org/show_bug.cgi?id=129814

Reviewed by Mario Sanchez Prada.

Source/WebCore: 

If a role=menu has no menuitem children, it should not be a menu.
This was a bit tricky to implement since we need to update the role after the children are created,
but it means we have to be a bit more aggressive about when to updateChildren, so that the role
is known to be valid.

Test: platform/mac/accessibility/invalid-menu-role-does-not-send-notification.html

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::notificationPostTimerFired):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::updateRoleAfterChildrenCreation):
(WebCore::AccessibilityRenderObject::addChildren):
* accessibility/AccessibilityRenderObject.h:
* accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
(-[WebAccessibilityObjectWrapperBase updateObjectBackingStore]):

LayoutTests: 

* accessibility/table-with-aria-role.html:
     Modify test so that tests only what we want (that the role is correct).
     No longer use role=menu on the table, since the table won't have menuitems and won't be a valid menu.
* platform/mac/accessibility/invalid-menu-role-does-not-send-notification-expected.txt: Added.
* platform/mac/accessibility/invalid-menu-role-does-not-send-notification.html: Added.
* platform/mac/accessibility/table-with-aria-role-expected.txt:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166194 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Build fix after r166186.

* UIProcess/Cocoa/DownloadClient.mm:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166195 268f45cc-cd09-0410-ab3c-d52691b4dbfc
mathml/presentation/tokenElements-background-color.html ImageOnlyFailure after 166170
https://bugs.webkit.org/show_bug.cgi?id=130693

Patch by Martin Hock <mhock@apple.com> on 2014-03-24
Reviewed by Tim Horton.

* platform/mac/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166196 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix the iOS build.

* Shared/Downloads/ios/DownloadIOS.mm:
(WebKit::setUpDownloadClient):
* UIProcess/Cocoa/DownloadClient.mm:

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

* WebCore.exp.in:
Move a CFNetwork only symbol inside the USE(CFNETWORK) section.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166198 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Update some mediastream LayoutTests results
https://bugs.webkit.org/show_bug.cgi?id=130692

Reviewed by Eric Carlson.

Tests were not passing due to outdated expected files.

* fast/mediastream/MediaStream-MediaElement-srcObject-expected.txt:
* fast/mediastream/MediaStreamTrack-expected.txt:
* fast/mediastream/RTCPeerConnection-ice-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166199 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Re-fix the build.

* WebCore.exp.in:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166200 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Activate WebVTT Tests Once Merging is Complete
https://bugs.webkit.org/show_bug.cgi?id=130420

Reviewed by Eric Carlson.

Source/JavaScriptCore: 

* Configurations/FeatureDefines.xcconfig: Turn on ENABLE(WEBVTT_REGIONS)

Source/WebCore: 

* Configurations/FeatureDefines.xcconfig: Turn on ENABLE(WEBVTT_REGIONS)

Source/WebKit/mac: 

* Configurations/FeatureDefines.xcconfig: Turn on ENABLE(WEBVTT_REGIONS)

Source/WebKit2: 

* Configurations/FeatureDefines.xcconfig: Turn on ENABLE(WEBVTT_REGIONS)

LayoutTests: 

* TestExpectations: Remove [Skip] for media/track/regions-webvtt
* platform/efl/TestExpectations: Skip media/track/regions-webvtt
* platform/gtk/TestExpectations: Skip media/track/regions-webvtt
* platform/mac/js/dom/global-constructors-attributes.html: Add new VTTRegions cases.
* platform/mac-mountainlion/js/dom/global-constructors-attributes.html: Ditto.
* platform/win/TestExpectations: Skip media/track/regions-webvtt


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166201 268f45cc-cd09-0410-ab3c-d52691b4dbfc
XSS Auditor doesn't block <script> injected before an existing <script>
https://bugs.webkit.org/show_bug.cgi?id=130475

Merged from Blink (patch by Tom Sepez):
https://src.chromium.org/viewvc/blink?view=rev&revision=169697

Source/WebCore:

Tests: http/tests/security/xssAuditor/script-tag-expression-follows.html
       http/tests/security/xssAuditor/script-tag-near-start.html

* html/parser/XSSAuditor.cpp:
(WebCore::startsHTMLCommentAt):
(WebCore::startsSingleLineCommentAt):
(WebCore::startsMultiLineCommentAt):
(WebCore::startsOpeningScriptTagAt):
(WebCore::XSSAuditor::decodedSnippetForJavaScript):

LayoutTests:

* http/tests/security/xssAuditor/resources/echo-intertag.pl:
* http/tests/security/xssAuditor/script-tag-expression-follows-expected.txt: Added.
* http/tests/security/xssAuditor/script-tag-expression-follows.html: Added.
* http/tests/security/xssAuditor/script-tag-near-start-expected.txt: Added.
* http/tests/security/xssAuditor/script-tag-near-start.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166202 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION (r165872): Double-applying device scale to snapshots
https://bugs.webkit.org/show_bug.cgi?id=130697
<rdar://problem/16396629>

Reviewed by Simon Fraser.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::scaledSnapshotWithOptions):
Drive-by, make scaledSnapshotWithOptions respect SnapshotOptionsExcludeDeviceScaleFactor.

(WebKit::WebPage::snapshotAtSize):
Divide the device scale out of the scale factor

* WebProcess/WebPage/WebPage.h:
Rename the scale argument to scaledSnapshotWithOptions to clarify
that it is an additional scale on top of the device scale.


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