Add WTF::Optional class
https://bugs.webkit.org/show_bug.cgi?id=134083

Reviewed by Andreas Kling.

Source/WTF:
* WTF.xcodeproj/project.pbxproj:
* wtf/Optional.h: Added.
(WTF::Optional::Optional):
(WTF::Optional::~Optional):
(WTF::Optional::operator bool):
(WTF::Optional::value):

Tools:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/Optional.cpp: Added.
(TestWebKitAPI::TEST):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170187 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Rename SessionState to LegacySessionState
https://bugs.webkit.org/show_bug.cgi?id=134107

Reviewed by Dan Bernstein.

* Shared/LegacySessionState.cpp: Renamed from Source/WebKit2/Shared/SessionState.cpp.
(IPC::ArgumentCoder<RefPtr<T>>::encode):
(IPC::ArgumentCoder<RefPtr<T>>::decode):
(WebKit::LegacySessionState::LegacySessionState):
(WebKit::LegacySessionState::isEmpty):
(WebKit::LegacySessionState::encode):
(WebKit::LegacySessionState::decode):
* Shared/LegacySessionState.h: Renamed from Source/WebKit2/Shared/SessionState.h.
(WebKit::LegacySessionState::list):
(WebKit::LegacySessionState::currentIndex):
* Shared/WebPageCreationParameters.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
* UIProcess/cf/WebPageProxyCF.cpp:
(WebKit::WebPageProxy::restoreFromSessionStateData):
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::restoreSession):
(WebKit::WebPage::restoreSessionAndNavigateToCurrentItem):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170188 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Teach run-{safari, webkit-app} about iOS Simulator
https://bugs.webkit.org/show_bug.cgi?id=133986

Reviewed by David Kilzer.

Extract the logic from old-run-webkit-tests to install and launch {DumpRenderTree, WebKitTestRunnerApp}.app
into general-purpose routines in webkitdirs.pm so that they can be used both by script old-run-webkit-tests
and run-safari.

* Scripts/old-run-webkit-tests:
(installAndLaunchDumpToolAppUsingNotification): Extracted logic to install and launch {DumpRenderTree,
WebKitTestRunnerApp}.app into webkitdirs::installAndLaunchIOSWebKitAppInSimulator() and modified code
to call it.
(openIPhoneSimulator): Deleted; moved logic to webkitdirs::openIOSSimulator().
(quitIPhoneSimulator): Deleted; moved logic to webkitdirs::quitIOSSimulator().
* Scripts/run-webkit-app: Modified to call runIOSWebKitApp() when the iOS simulator SDK is used
(say, by specifying the optional command-line argument --simulator). For now, die() with an error
when the iOS device SDK is used as we don't support launching an app on the device at this time.
* Scripts/webkitdirs.pm:
(xcodeSDKVersion): Added.
(setupIOSWebKitEnvironment): Added.
(installedMobileSafariBundle): Added.
(mobileSafariBundle): Added.
(plistPathFromBundle): Added.
(appIdentiferFromBundle): Added.
(appDisplayNameFromBundle): Added.
(loadIPhoneSimulatorNotificationIfNeeded): Added.
(openIOSSimulator): Added.
(quitIOSSimulator): Added.
(iosSimulatorDeviceByName): Added.
(iosSimulatorRuntime): Added.
(findOrCreateSimulatorForIOSDevice): Added.
(runIOSWebKitAppInSimulator): Added.
(installAndLaunchIOSWebKitAppInSimulator): Added.
(runIOSWebKitApp): Added.
(runSafari): Modified to call runIOSWebKitAppInSimulator() the iOS simulator SDK is used. For now,
die() with an error when the iOS device SDK is used as we don't support launching Safari on the
device at this time.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170189 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Enable synchronous willSendRequest on iOS
https://bugs.webkit.org/show_bug.cgi?id=134081
<rdar://problem/17350927>

Reviewed by Andreas Kling.

We lost the call to make willSendrequest callbacks be synchronous if possible during code
refactoring. The call is present in ResourceHandleMac.mm but that code is not called when
we use the CFNetwork based loader. Call the SPI in setupRequest().

No new tests because existing tests should cover this functionality.

* platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::setupRequest):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170190 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Begin stubbing out new session state classes
https://bugs.webkit.org/show_bug.cgi?id=134110

Reviewed by Geoffrey Garen.

The basic idea is that these classes will replace the data blobs representing HistoryItems
that we currently send back and forth between the web and UI processes.

* Shared/SessionState.cpp: Added.
(WebKit::HTTPBody::Element::Element):
(WebKit::HTTPBody::Element::~Element):
(WebKit::FrameState::FrameState):
(WebKit::FrameState::~FrameState):
(WebKit::PageState::PageState):
(WebKit::PageState::~PageState):
* Shared/SessionState.h: Added.
(WebKit::HTTPBody::Element::type):
* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170191 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS]: Overrelease of RetainPtr object in file upload
https://bugs.webkit.org/show_bug.cgi?id=134072

Reviewed by Brady Eidson.

This ivar is a RetainPtr, the release will be done automatically
for us when we assign to nil or destruct.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView fileUploadPanelDidDismiss:]):

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