Fix one API test expectation failure on Mountain Lion, and add additional logging to help diagnose another.

* TestWebKitAPI/Tests/WebKit2Cocoa/Download.mm:
(-[DownloadDelegate _download:didReceiveResponse:]):
(-[DownloadDelegate _download:didReceiveData:]):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166260 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Mac] Pause the media element during system sleep.
https://bugs.webkit.org/show_bug.cgi?id=130718

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/video-system-sleep.html

Relying on the platform media system to pause and restart playback during
system sleep can cause problems on some platforms, especially where hardware
decoders are concerned. Rather than implicitly pausing the media during
system sleep, explicitly pause the media before sleeping and resume (if
appropriate) upon waking.

Add a new class to be used for system sleep notifications:
* platform/SystemSleepListener.cpp: Added.
(WebCore::SystemSleepListener::create):
(WebCore::SystemSleepListener::SystemSleepListener):
* platform/SystemSleepListener.h: Added.
(WebCore::SystemSleepListener::Client::~Client):
(WebCore::SystemSleepListener::~SystemSleepListener):
(WebCore::SystemSleepListener::client):

Add a Mac-specific implementation:
* platform/mac/SystemSleepListenerMac.h: Added.
* platform/mac/SystemSleepListenerMac.mm: Added.
(WebCore::SystemSleepListener::create):
(WebCore::SystemSleepListenerMac::SystemSleepListenerMac):
(WebCore::SystemSleepListenerMac::~SystemSleepListenerMac):

Listen for system sleep notifications in MediaSessionManager:
* platform/audio/MediaSessionManager.cpp:
(WebCore::MediaSessionManager::MediaSessionManager):
(WebCore::MediaSessionManager::systemWillSleep):
(WebCore::MediaSessionManager::systemDidWake):
* platform/audio/MediaSessionManager.h:

Drive-by fix; notify the MediaSession that playback will begin
due to autoplay, but do not begin autoplaying if the session
is already interrupted:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::parseAttribute):

Add new files to project:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.xcodeproj/project.pbxproj:
* CMakeLists.txt:
* GNUmakefile.list.am:

LayoutTests:

* media/video-system-sleep-expected.txt: Added.
* media/video-system-sleep.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166261 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add a WebFrame::fromCoreFrame static member function and use it where possible
https://bugs.webkit.org/show_bug.cgi?id=130744

Reviewed by Tim Horton.

* WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
(WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation):
* WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
(WebKit::InjectedBundleNodeHandle::documentFrame):
(WebKit::InjectedBundleNodeHandle::htmlFrameElementContentFrame):
(WebKit::InjectedBundleNodeHandle::htmlIFrameElementContentFrame):
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
* WebProcess/InjectedBundle/InjectedBundleDOMWindowExtension.cpp:
(WebKit::InjectedBundleDOMWindowExtension::frame):
* WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp:
(WebKit::InjectedBundleHitTestResult::frame):
(WebKit::InjectedBundleHitTestResult::targetFrame):
* WebProcess/Plugins/PluginView.cpp:
(WebKit::webPage):
(WebKit::PluginView::performFrameLoadURLRequest):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::focusedElementChanged):
(WebKit::WebChromeClient::focusedFrameChanged):
(WebKit::WebChromeClient::runBeforeUnloadConfirmPanel):
(WebKit::WebChromeClient::runJavaScriptAlert):
(WebKit::WebChromeClient::runJavaScriptConfirm):
(WebKit::WebChromeClient::runJavaScriptPrompt):
(WebKit::WebChromeClient::print):
(WebKit::WebChromeClient::exceededDatabaseQuota):
(WebKit::WebChromeClient::runOpenPanel):
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::textFieldDidBeginEditing):
(WebKit::WebEditorClient::textFieldDidEndEditing):
(WebKit::WebEditorClient::textDidChangeInTextField):
(WebKit::WebEditorClient::textDidChangeInTextArea):
(WebKit::WebEditorClient::doTextFieldCommandFromEvent):
(WebKit::WebEditorClient::textWillBeDeletedInTextField):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
(WebKit::WebFrameLoaderClient::dispatchWillSendSubmitEvent):
(WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::fromCoreFrame):
(WebKit::WebFrame::contentsAsString):
(WebKit::WebFrame::parentFrame):
(WebKit::WebFrame::childFrames):
(WebKit::WebFrame::frameForContext):
(WebKit::WebFrame::webArchiveData):
* WebProcess/WebPage/WebFrame.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166262 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Repatch should plant calls to getters directly rather than through a C helper
https://bugs.webkit.org/show_bug.cgi?id=129589

Source/JavaScriptCore: 

Reviewed by Mark Hahnenberg.
        
As the title says. All of the superstructure for this was already in place, so now it
was just a matter of actually emitting the call.
        
8x speed-up for getter microbenchmarks. 

* CMakeLists.txt:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* bytecode/PolymorphicGetByIdList.h:
(JSC::GetByIdAccess::doesCalls):
* jit/AccessorCallJITStubRoutine.cpp: Added.
(JSC::AccessorCallJITStubRoutine::AccessorCallJITStubRoutine):
(JSC::AccessorCallJITStubRoutine::~AccessorCallJITStubRoutine):
(JSC::AccessorCallJITStubRoutine::visitWeak):
* jit/AccessorCallJITStubRoutine.h: Added.
* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::storeCell):
* jit/GCAwareJITStubRoutine.h:
* jit/Repatch.cpp:
(JSC::generateGetByIdStub):
* runtime/GetterSetter.h:
(JSC::GetterSetter::offsetOfGetter):
(JSC::GetterSetter::offsetOfSetter):

LayoutTests: 

Reviewed by Mark Hahnenberg.

* js/regress/getter-expected.txt: Added.
* js/regress/getter.html: Added.
* js/regress/script-tests/getter.js: Added.
* js/regress/script-tests/string-char-code-at.js: Added.
(foo):
* js/regress/string-char-code-at-expected.txt: Added.
* js/regress/string-char-code-at.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166263 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore: Web Replay: resource unique identifiers should be unique-per-frame, not globally
https://bugs.webkit.org/show_bug.cgi?id=130632

Reviewed by Timothy Hatcher.

For replay purposes, we want to deterministically assign resource load identifiers
to resource loaders, provided that the resource loaders are created in the same
order.

To do this, we convert unique identifiers from being globally-unique to being
frame-unique. When a new frame is being loaded, unique identifiers for
subresources of that frame begin counting from 1.

No new tests. Identifier invariants are exercised by existing assertions and tests.

* loader/ProgressTracker.cpp:
(WebCore::ProgressTracker::ProgressTracker):
(WebCore::ProgressTracker::reset):
(WebCore::ProgressTracker::createUniqueIdentifier):
* loader/ProgressTracker.h:

Tools: Web Replay: resource unique identifiers should be unique-per-frame, not globally
https://bugs.webkit.org/show_bug.cgi?id=130623

Reviewed by Timothy Hatcher.

The resource loader callback dumping routines assumed that resource identifiers
were globally unique. Its map of resource identifiers to URLs must also track the
frame associated with the resource.

* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::dumpResourceURL): Additionally take a WKBundleFrameRef argument, and use the
opaque pointer as part of the key for assignedUrlsCache. The frame pointer is
stable as long as the frame is valid.
(WTR::InjectedBundlePage::didInitiateLoadForResource):
(WTR::InjectedBundlePage::willSendRequestForFrame):
(WTR::InjectedBundlePage::didReceiveResponseForResource):
(WTR::InjectedBundlePage::didFinishLoadForResource):
(WTR::InjectedBundlePage::didFailLoadForResource):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166264 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Pass the source frame to the CreateNewPage message
https://bugs.webkit.org/show_bug.cgi?id=130752

Reviewed by Tim Horton.

* UIProcess/API/APIUIClient.h:
(API::UIClient::createNewPage):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageUIClient):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::createNewPage):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::createWindow):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166265 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix 32-bit getter call alignment.

Reviewed by Mark Hahnenberg.

* jit/Repatch.cpp:
(JSC::generateGetByIdStub):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166266 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Change toolbarVisibility back to toolbarsVisibility
https://bugs.webkit.org/show_bug.cgi?id=130749

Reviewed by Tim Horton.

* UIProcess/API/Cocoa/WKWindowFeatures.h:
* UIProcess/API/Cocoa/WKWindowFeatures.mm:
(-[WKWindowFeatures _initWithWindowFeatures:WebCore::]):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166267 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS] Enable caption support in full screen.
https://bugs.webkit.org/show_bug.cgi?id=130603

Reviewed by Eric Carlson.

Add TextTrackRepresentation support to MediaPlayerPrivateAVFoundationObjC.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoLayer): Add the m_textTrackRepresenationLayer if present.
(WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer): Ditto.
(WebCore::MediaPlayerPrivateAVFoundationObjC::requiresTextTrackRepresentation): True, if a m_videoFullscreenLayer is present.
(WebCore::MediaPlayerPrivateAVFoundationObjC::setTextTrackRepresentation): Remove the old, and add the new m_textTrackRepresenationLayer.

Make the text track container a stacking context for painting purposes.
* Modules/mediacontrols/mediaControlsiOS.css:
(video::-webkit-media-text-track-container):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166268 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Move stopLoading: back for now.

* UIProcess/API/Cocoa/WKWebView.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView stopLoading:]):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166269 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add a UI delegate callback for handling window.open
https://bugs.webkit.org/show_bug.cgi?id=130757

Reviewed by Sam Weinig.

* UIProcess/API/Cocoa/WKUIDelegate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/Cocoa/UIClient.h:
* UIProcess/Cocoa/UIClient.mm:
(WebKit::UIClient::setDelegate):
(WebKit::UIClient::createNewPage):

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