Move more WKPreferences to WKWebViewConfiguration
https://bugs.webkit.org/show_bug.cgi?id=133756
<rdar://problem/17271468>

Reviewed by Tim Horton.

* UIProcess/API/Cocoa/WKPreferences.h:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences setMinimumFontSize:]):
(-[WKPreferences suppressesIncrementalRendering]): Deleted.
(-[WKPreferences setSuppressesIncrementalRendering:]): Deleted.
(-[WKPreferences allowsInlineMediaPlayback]): Deleted.
(-[WKPreferences setAllowsInlineMediaPlayback:]): Deleted.
(-[WKPreferences mediaPlaybackRequiresUserAction]): Deleted.
(-[WKPreferences setMediaPlaybackRequiresUserAction:]): Deleted.
(-[WKPreferences mediaPlaybackAllowsAirPlay]): Deleted.
(-[WKPreferences setMediaPlaybackAllowsAirPlay:]): Deleted.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView initWithFrame:configuration:]):
* UIProcess/API/Cocoa/WKWebViewConfiguration.h:
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration copyWithZone:]):
* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169818 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Don't snapshot offscreen plugins that would normally be considered primary plugins after they are moved in view.
https://bugs.webkit.org/show_bug.cgi?id=133667.
<rdar://problem/16743250>

Reviewed by Tim Horton.

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::PluginView):
(WebKit::PluginView::pluginSnapshotTimerFired):
Set the display state to Playing if the following is true:
The plugin in question is large enough to be considered the primary snapshot and either:
a) The maximum number of snapshot retries has been reached and no good snapshot has been found.
b) The plugin is moved to be on-screen while the snapshot attempts are in progress.
* WebProcess/Plugins/PluginView.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::plugInIntersectsSearchRect): Re-factor out intersection logic.
(WebKit::WebPage::plugInIsPrimarySize): Re-factor out primary plugin size logic.
(WebKit::WebPage::determinePrimarySnapshottedPlugIn): Use the above two methods here.
* WebProcess/WebPage/WebPage.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169820 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Restrict database process profile
https://bugs.webkit.org/show_bug.cgi?id=133750

Reviewed by Alexey Proskuryakov.

Make the sandbox profile much more restrictive.

* Resources/SandboxProfiles/ios/com.apple.WebKit.Databases.sb:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169821 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Structure::get should instantiate DeferGC only when materializing property map
https://bugs.webkit.org/show_bug.cgi?id=133727

Rubber-stamped by Andreas Kling.

Make materializePropertyMapIfNecessary always inline.

This is ~12% improvement on the microbenchmark attached in the bug.

* runtime/Structure.h:
(JSC::Structure::materializePropertyMapIfNecessary):
(JSC::Structure::materializePropertyMapIfNecessaryForPinning):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169822 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Always inline JSValue::get() and Structure::get().
<https://webkit.org/b/133755>

Reviewed by Ryosuke Niwa.

These functions get really hot, so ask the compiler to be more
aggressive about inlining them.

~28% speed-up on Ryosuke's microbenchmark for accessing nextSibling
through GetByVal.

* runtime/JSArrayIterator.cpp:
* runtime/JSCJSValue.cpp:
* runtime/JSCJSValueInlines.h:
(JSC::JSValue::get):
* runtime/JSPromiseDeferred.cpp:
* runtime/StructureInlines.h:
(JSC::Structure::get):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169823 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Turning on DUMP_PROPERTYMAP_STATS causes a build failure
https://bugs.webkit.org/show_bug.cgi?id=133673

Reviewed by Andreas Kling.


Source/JavaScriptCore: 
Rewrote the property map statistics code because the old code wasn't building,
and it was also mixing numbers for lookups and insertions/removals.

New logging code records the number of calls to PropertyTable::find (finds) and
PropertyTable::get/PropertyTable::findWithString separately so that we can quantify
the number of probing during updates and lookups.

* jsc.cpp:
* runtime/PropertyMapHashTable.h:
(JSC::PropertyTable::find):
(JSC::PropertyTable::get):
(JSC::PropertyTable::findWithString):
(JSC::PropertyTable::add):
(JSC::PropertyTable::remove):
(JSC::PropertyTable::reinsert):
(JSC::PropertyTable::rehash):
* runtime/Structure.cpp:
(JSC::PropertyMapStatisticsExitLogger::PropertyMapStatisticsExitLogger):
(JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger):

Source/WTF: 
Added DEFINE_GLOBAL_FOR_LOGGING to allow running a destructor in logging code
that needs to be enabled in release builds (e.g. for JavaScriptCore).

* wtf/StdLibExtras.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169824 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Make it possible for waitForAndDispatchImmediately to bail if a sync message comes in from the other direction
https://bugs.webkit.org/show_bug.cgi?id=133708

Reviewed by Anders Carlsson.

* Platform/IPC/Connection.cpp:
(IPC::WaitForMessageState):
(IPC::Connection::Connection):
(IPC::Connection::waitForMessage):
(IPC::Connection::processIncomingMessage):
(IPC::Connection::connectionDidClose):
* Platform/IPC/Connection.h:
(IPC::Connection::waitForAndDispatchImmediately):
Remove the waitForMessageMap, and assert that we're only ever waiting for one message at a time.
This simplifies this code a bit, and we never wait on more than one message at a time, so it was unnecessary.

Add a flag to waitForAndDispatchImmediately, InterruptWaitingIfSyncMessageArrives, which will cause
waitForAndDispatchImmediately to bail if a sync message arrives, to avoid pointlessly blocking both processes
for the entire timeout.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169825 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add a script that generates a gperf hash for HTTP header names
https://bugs.webkit.org/show_bug.cgi?id=133760

Reviewed by Andreas Kling.

This is the first step towards getting rid of AtomicString from HTTPHeaderMap.

* CMakeLists.txt:
* DerivedSources.make:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.xcodeproj/project.pbxproj:
* platform/network/HTTPHeaderNames.in: Added.
* platform/network/create-http-header-name-table: Added.
(HTTPHeaderName):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169826 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[wk2] Don't dispatch view state changes immediately
https://bugs.webkit.org/show_bug.cgi?id=133713

Reviewed by Simon Fraser.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::viewStateDidChange):
(WebKit::WebPageProxy::dispatchViewStateChange):
(WebKit::WebPageProxy::updateViewState): Deleted.
* UIProcess/WebPageProxy.h:
On PLATFORM(COCOA), wait until just before CA is going to commit the UI process layer
tree to dispatch view state changes to the Web process. This avoids sending multiple
view state change messages to the Web process within one run-loop cycle, for example
when a view is moved around in the view hierarchy but the view state otherwise remains the same.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169827 268f45cc-cd09-0410-ab3c-d52691b4dbfc
inspector-protocol/debugger/breakpoint-action-detach.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=133761

* TestExpectations: Skipped it. Updated bug number for another inspector-protocol
test while at it.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169828 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Don't force CharacterData to override getOwnPropertySlot.
<https://webkit.org/b/133717>

This was preventing us from taking the GetByVal fast path for Text nodes
since they inherit from CharacterData and having a "length" attribute
meant we gave them a custom getOwnPropertySlot, despite not actually
needing it for anything.

Reviewed by Anders Carlsson.

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

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169829 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EME][Mac] Propagate errors from AVSampleBufferDisplayLayer through to MSE
https://bugs.webkit.org/show_bug.cgi?id=133747

Reviewed by Eric Carlson.

Abstract out the delivery of errors in MediaKeySession into its own method, which can be triggered by
CDMSession objects through the CDMSessionClient interface:
* Modules/encryptedmedia/MediaKeySession.cpp:
(WebCore::MediaKeySession::keyRequestTimerFired):
(WebCore::MediaKeySession::addKeyTimerFired):
(WebCore::MediaKeySession::sendMessage):
(WebCore::MediaKeySession::sendError):
* Modules/encryptedmedia/MediaKeySession.h:
* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::sourceBufferPrivateDidReceiveRenderingError):
* Modules/mediasource/SourceBuffer.h:
* platform/graphics/SourceBufferPrivateClient.h:
* platform/graphics/CDMSession.h:

Add an Objective-C object which can listen for error KVO notifications:
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
(WebCore::SourceBufferPrivateAVFObjCErrorClient::~SourceBufferPrivateAVFObjCErrorClient):
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(-[WebAVSampleBufferErrorListener initWithParent:WebCore::]):
(-[WebAVSampleBufferErrorListener dealloc]):
(-[WebAVSampleBufferErrorListener invalidate]):
(-[WebAVSampleBufferErrorListener beginObservingLayer:]):
(-[WebAVSampleBufferErrorListener stopObservingLayer:]):
(-[WebAVSampleBufferErrorListener beginObservingRenderer:]):
(-[WebAVSampleBufferErrorListener stopObservingRenderer:]):
(-[WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]):
(-[WebAVSampleBufferErrorListener layerFailedToDecode:]):
(WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
(WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
(WebCore::SourceBufferPrivateAVFObjC::registerForErrorNotifications):
(WebCore::SourceBufferPrivateAVFObjC::unregisterForErrorNotifications):
(WebCore::SourceBufferPrivateAVFObjC::layerDidReceiveError):
(WebCore::SourceBufferPrivateAVFObjC::rendererDidReceiveError):

Register for the new error notifications:
* platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
(WebCore::CDMSessionMediaSourceAVFObjC::~CDMSessionMediaSourceAVFObjC): Moved to source file.
* platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
(WebCore::CDMSessionMediaSourceAVFObjC::CDMSessionMediaSourceAVFObjC): Register for error notifications.
(WebCore::CDMSessionMediaSourceAVFObjC::~CDMSessionMediaSourceAVFObjC): Unregister for error notifications.
(WebCore::CDMSessionMediaSourceAVFObjC::layerDidReceiveError): Pass through to CDMSessionClient.
(WebCore::CDMSessionMediaSourceAVFObjC::rendererDidReceiveError): Ditto.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169830 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove an unnecessary asObject(this) call inside JSObject::fastGetOwnPropertySlot.

Rubber-stamped by Andreas Kling.

* runtime/JSObject.h:
(JSC::JSObject::fastGetOwnPropertySlot):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169831 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS] Enable fast/viewport tests
<http://webkit.org/b/133754>

Reviewed by Andy Estes.

* platform/ios-sim/Skipped:
- Stop skipping fast/viewport tests.

* platform/ios-sim/fast/viewport/viewport-legacy-handheldfriendly-expected.txt: Added.
* platform/ios-sim/fast/viewport/viewport-legacy-mobileoptimized-2-expected.txt: Added.
* platform/ios-sim/fast/viewport/viewport-legacy-mobileoptimized-3-expected.txt: Added.
* platform/ios-sim/fast/viewport/viewport-legacy-mobileoptimized-expected.txt: Added.
* platform/ios-sim/fast/viewport/viewport-legacy-ordering-5-expected.txt: Added.
* platform/ios-sim/fast/viewport/viewport-legacy-ordering-6-expected.txt: Added.
* platform/ios-sim/fast/viewport/viewport-legacy-xhtmlmp-expected.txt: Added.
* platform/ios-sim/fast/viewport/viewport-legacy-xhtmlmp-remove-and-add-expected.txt: Added.
- iOS never supported these "legacy" viewport modes, so add
  platform-specific results with current behavior.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169832 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL] URTBF after r169823.

* bindings/ScriptValue.cpp: Missing include added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169834 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Get rid of an unneeded HTTPHeaderMap::remove overload
https://bugs.webkit.org/show_bug.cgi?id=133763

Reviewed by Andreas Kling.

Change HTTPHeaderMap::remove to return whether an entry was removed or not and simplify
ResourceRequestBase::clearHTTPAuthorization.

* platform/network/HTTPHeaderMap.cpp:
(WebCore::HTTPHeaderMap::remove):
* platform/network/HTTPHeaderMap.h:
* platform/network/ResourceRequestBase.cpp:
(WebCore::ResourceRequestBase::clearHTTPAuthorization):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169836 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed. Moving myself to the list of reviewers.

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

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169837 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CMake]URTBF after r169826.

* CMakeLists.txt: Typo fix.

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