<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[225598] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/225598">225598</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2017-12-06 14:26:32 -0800 (Wed, 06 Dec 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Web App Manifest] Add SPI for fetching the manifest
https://bugs.webkit.org/show_bug.cgi?id=180294
rdar://problem/34747968

Patch by David Quesada <david_quesada@apple.com> on 2017-12-06
Reviewed by Geoffrey Garen.

Source/WebCore:

Test: applicationmanifest/developer-warnings.html

* Modules/applicationmanifest/ApplicationManifest.h:
(WebCore::ApplicationManifest::encode const):
(WebCore::ApplicationManifest::decode):
* Modules/applicationmanifest/ApplicationManifestParser.cpp:
(WebCore::ApplicationManifestParser::logManifestPropertyNotAString):
(WebCore::ApplicationManifestParser::logManifestPropertyInvalidURL):
    Drive-by wording changes. Since the warning is prefixed with "parsing
    application manifest:", remove a redundant use of "application manifest".

Source/WebKit:

Add a new method -[WKWebView _getApplicationManifestWithCompletionHandler:] to request
the manifest associated with the current page.

* Shared/API/APIObject.h:
* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):
* UIProcess/API/APIApplicationManifest.h: Copied from Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h.
    Add a new API object type for application manifests.
* UIProcess/API/C/WKPage.cpp:
(WKPageGetApplicationManifest_b):
    Add a C version of this SPI for WebKitTestRunner.
* UIProcess/API/C/WKPagePrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _getApplicationManifestWithCompletionHandler:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/Cocoa/_WKApplicationManifest.h: Copied from Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h.
* UIProcess/API/Cocoa/_WKApplicationManifest.mm: Added.
(-[_WKApplicationManifest initWithCoder:]):
(-[_WKApplicationManifest encodeWithCoder:]):
(+[_WKApplicationManifest applicationManifestFromJSON:manifestURL:documentURL:]):
(-[_WKApplicationManifest _apiObject]):
(nullableNSString):
(-[_WKApplicationManifest name]):
(-[_WKApplicationManifest shortName]):
(-[_WKApplicationManifest applicationDescription]):
(-[_WKApplicationManifest scope]):
(-[_WKApplicationManifest startURL]):
* UIProcess/API/Cocoa/_WKApplicationManifestInternal.h: Copied from Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h.
(API::wrapper):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::applicationManifestCallback):
(WebKit::WebPageProxy::getApplicationManifest):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::finishedLoadingApplicationManifest):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::getApplicationManifest):
(WebKit::WebPage::didFinishLoadingApplicationManifest):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/ApplicationManifest.mm: Added.
    Added two API tests for _WKApplicationManifest:
    - Testing _WKApplicationManifest's conformance to NSCoding.
    - Testing -[WKWebView _getApplicationManifestWithCompletionHandler:], verifying the
      values of the resulting _WKApplicationManifest.
(TestWebKitAPI::TEST):

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
    Added a new testRunner method getApplicationManifestThen(), used by the LayoutTests
    to request the document load its associated manifest. The layout tests formerly called
    an unimplemented function getManifestThen(), but I added 'Application' to somewhat
    differentiate this from the app cache manifest.

* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::didReceiveMessageToPage):
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::getApplicationManifestThen):
(WTR::TestRunner::didGetApplicationManifest):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):

LayoutTests:

* TestExpectations:
    Skip the app manifest-related layout tests for now while the feature is still disabled.
    Also moved the expectations disabling the manifest-src layout tests (which now pass
    when the feature is enabled) to the same location in the file.
* applicationmanifest/developer-warnings-expected.txt: Added.
* applicationmanifest/developer-warnings.html: Added.
* applicationmanifest/multiple-links-expected.txt: Added.
* applicationmanifest/multiple-links.html: Added.
    Add a layout test to verify only the first manifest link is loaded when there
    are multiple on the page.
* applicationmanifest/resources/developer-warnings.manifest: Added.
    Add a layout test to verify that warnings generated while parsing the manifest are
    logged to the console.
* http/tests/security/contentSecurityPolicy/manifest-src-allowed.html:
    Replaced calls to getManifestThen() with getApplicationManifestThen().
* http/tests/security/contentSecurityPolicy/manifest-src-blocked-expected.txt:
    Updated the expected console message to reflect the current wording for CSP violations.
* http/tests/security/contentSecurityPolicy/manifest-src-blocked.html:
    Replaced calls to getManifestThen() with getApplicationManifestThen().
* http/tests/security/contentSecurityPolicy/manifest.test/manifest.json:
    Removed a trailing newline that was causing JSON parsing to fail.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsTestExpectations">trunk/LayoutTests/TestExpectations</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicymanifestsrcallowedhtml">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/manifest-src-allowed.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicymanifestsrcblockedexpectedtxt">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/manifest-src-blocked-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicymanifestsrcblockedhtml">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/manifest-src-blocked.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecuritycontentSecurityPolicymanifesttestmanifestjson">trunk/LayoutTests/http/tests/security/contentSecurityPolicy/manifest.test/manifest.json</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesapplicationmanifestApplicationManifesth">trunk/Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h</a></li>
<li><a href="#trunkSourceWebCoreModulesapplicationmanifestApplicationManifestParsercpp">trunk/Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.cpp</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitSharedAPIAPIObjecth">trunk/Source/WebKit/Shared/API/APIObject.h</a></li>
<li><a href="#trunkSourceWebKitSharedCocoaAPIObjectmm">trunk/Source/WebKit/Shared/Cocoa/APIObject.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPICWKPagecpp">trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPICWKPagePrivateh">trunk/Source/WebKit/UIProcess/API/C/WKPagePrivate.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPICocoaWKWebViewPrivateh">trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebPageProxycpp">trunk/Source/WebKit/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebPageProxyh">trunk/Source/WebKit/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebPageProxymessagesin">trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKitWebKitxcodeprojprojectpbxproj">trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebCoreSupportWebFrameLoaderClientcpp">trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebCoreSupportWebFrameLoaderClienth">trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebPageWebPagecpp">trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebPageWebPageh">trunk/Source/WebKit/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebPageWebPagemessagesin">trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleBindingsTestRunneridl">trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleInjectedBundlecpp">trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleTestRunnercpp">trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleTestRunnerh">trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestInvocationcpp">trunk/Tools/WebKitTestRunner/TestInvocation.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/applicationmanifest/</li>
<li><a href="#trunkLayoutTestsapplicationmanifestdeveloperwarningsexpectedtxt">trunk/LayoutTests/applicationmanifest/developer-warnings-expected.txt</a></li>
<li><a href="#trunkLayoutTestsapplicationmanifestdeveloperwarningshtml">trunk/LayoutTests/applicationmanifest/developer-warnings.html</a></li>
<li><a href="#trunkLayoutTestsapplicationmanifestmultiplelinksexpectedtxt">trunk/LayoutTests/applicationmanifest/multiple-links-expected.txt</a></li>
<li><a href="#trunkLayoutTestsapplicationmanifestmultiplelinkshtml">trunk/LayoutTests/applicationmanifest/multiple-links.html</a></li>
<li>trunk/LayoutTests/applicationmanifest/resources/</li>
<li><a href="#trunkLayoutTestsapplicationmanifestresourcesdeveloperwarningsmanifest">trunk/LayoutTests/applicationmanifest/resources/developer-warnings.manifest</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPIAPIApplicationManifesth">trunk/Source/WebKit/UIProcess/API/APIApplicationManifest.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPICocoa_WKApplicationManifesth">trunk/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPICocoa_WKApplicationManifestmm">trunk/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPICocoa_WKApplicationManifestInternalh">trunk/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifestInternal.h</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKitCocoaApplicationManifestmm">trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ApplicationManifest.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/LayoutTests/ChangeLog 2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2017-12-06  David Quesada  <david_quesada@apple.com>
+
+        [Web App Manifest] Add SPI for fetching the manifest
+        https://bugs.webkit.org/show_bug.cgi?id=180294
+        rdar://problem/34747968
+
+        Reviewed by Geoffrey Garen.
+
+        * TestExpectations:
+            Skip the app manifest-related layout tests for now while the feature is still disabled.
+            Also moved the expectations disabling the manifest-src layout tests (which now pass
+            when the feature is enabled) to the same location in the file.
+        * applicationmanifest/developer-warnings-expected.txt: Added.
+        * applicationmanifest/developer-warnings.html: Added.
+        * applicationmanifest/multiple-links-expected.txt: Added.
+        * applicationmanifest/multiple-links.html: Added.
+            Add a layout test to verify only the first manifest link is loaded when there
+            are multiple on the page.
+        * applicationmanifest/resources/developer-warnings.manifest: Added.
+            Add a layout test to verify that warnings generated while parsing the manifest are
+            logged to the console.
+        * http/tests/security/contentSecurityPolicy/manifest-src-allowed.html:
+            Replaced calls to getManifestThen() with getApplicationManifestThen().
+        * http/tests/security/contentSecurityPolicy/manifest-src-blocked-expected.txt:
+            Updated the expected console message to reflect the current wording for CSP violations.
+        * http/tests/security/contentSecurityPolicy/manifest-src-blocked.html:
+            Replaced calls to getManifestThen() with getApplicationManifestThen().
+        * http/tests/security/contentSecurityPolicy/manifest.test/manifest.json:
+            Removed a trailing newline that was causing JSON parsing to fail.
+
</ins><span class="cx"> 2017-12-06  Youenn Fablet  <youenn@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Import WPT workers test suite
</span></span></pre></div>
<a id="trunkLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/TestExpectations (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/TestExpectations       2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/LayoutTests/TestExpectations  2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -1110,8 +1110,6 @@
</span><span class="cx"> webkit.org/b/153148 http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.php
</span><span class="cx"> webkit.org/b/153150 http/tests/security/contentSecurityPolicy/1.1/child-src/frame-fires-load-event-when-blocked.html
</span><span class="cx"> webkit.org/b/153150 http/tests/security/contentSecurityPolicy/1.1/child-src/frame-fires-load-event-when-redirect-blocked.html
</span><del>-webkit.org/b/153152 http/tests/security/contentSecurityPolicy/manifest-src-allowed.html # Needs testRunner.getManifestThen()
-webkit.org/b/153152 http/tests/security/contentSecurityPolicy/manifest-src-blocked.html # Needs testRunner.getManifestThen()
</del><span class="cx"> webkit.org/b/153155 http/tests/security/contentSecurityPolicy/1.1/scripthash-basic-blocked-error-event.html
</span><span class="cx"> webkit.org/b/153155 http/tests/security/contentSecurityPolicy/1.1/stylehash-basic-blocked-error-event.html
</span><span class="cx"> webkit.org/b/153155 http/tests/security/contentSecurityPolicy/1.1/stylehash-svg-style-basic-blocked-error-event.html
</span><span class="lines">@@ -1650,3 +1648,9 @@
</span><span class="cx"> webkit.org/b/179287 http/wpt/web-animations/timing-model/animations/set-the-animation-start-time.html [ Pass Failure ]
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/177440 imported/w3c/web-platform-tests/html/browsers/origin/relaxing-the-same-origin-restriction/document_domain_setter_null.tentative.html [ Pass Failure ]
</span><ins>+
+# Application Manifest tests
+webkit.org/b/153152 http/tests/security/contentSecurityPolicy/manifest-src-allowed.html [ Skip ]
+webkit.org/b/153152 http/tests/security/contentSecurityPolicy/manifest-src-blocked.html [ Skip ]
+webkit.org/b/158205 applicationmanifest/ [ Skip ]
+
</ins></span></pre></div>
<a id="trunkLayoutTestsapplicationmanifestdeveloperwarningsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/applicationmanifest/developer-warnings-expected.txt (0 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/applicationmanifest/developer-warnings-expected.txt                            (rev 0)
+++ trunk/LayoutTests/applicationmanifest/developer-warnings-expected.txt       2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+CONSOLE MESSAGE: Parsing application manifest developer-warnings.manifest: The value of "start_url" is not a valid URL.
+CONSOLE MESSAGE: Parsing application manifest developer-warnings.manifest: The value of "name" is not a string.
+ALERT: Pass
+
</ins></span></pre></div>
<a id="trunkLayoutTestsapplicationmanifestdeveloperwarningshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/applicationmanifest/developer-warnings.html (0 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/applicationmanifest/developer-warnings.html                            (rev 0)
+++ trunk/LayoutTests/applicationmanifest/developer-warnings.html       2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+<link rel="manifest" href="resources/developer-warnings.manifest">
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+    testRunner.getApplicationManifestThen(function() {
+        alert("Pass");
+        testRunner.notifyDone();
+    });
+}
+</script>
</ins></span></pre></div>
<a id="trunkLayoutTestsapplicationmanifestmultiplelinksexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/applicationmanifest/multiple-links-expected.txt (0 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/applicationmanifest/multiple-links-expected.txt                                (rev 0)
+++ trunk/LayoutTests/applicationmanifest/multiple-links-expected.txt   2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+multiple-links.html - didFinishLoading
+urlscheme://1 - willSendRequest <NSURLRequest URL urlscheme://1, main document URL multiple-links.html, http method GET> redirectResponse (null)
+urlscheme://1 - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -1002, failing URL "urlscheme://1">
+
</ins></span></pre></div>
<a id="trunkLayoutTestsapplicationmanifestmultiplelinkshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/applicationmanifest/multiple-links.html (0 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/applicationmanifest/multiple-links.html                                (rev 0)
+++ trunk/LayoutTests/applicationmanifest/multiple-links.html   2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+<link rel="manifest" href="urlscheme://1" media="print">
+<link rel="manifest" href="urlscheme://2">
+<script>
+if (window.testRunner) {
+    testRunner.dumpResourceLoadCallbacks();
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+    testRunner.getApplicationManifestThen(function() {
+        testRunner.notifyDone();
+    });
+}
+</script>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsapplicationmanifestresourcesdeveloperwarningsmanifest"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/applicationmanifest/resources/developer-warnings.manifest (0 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/applicationmanifest/resources/developer-warnings.manifest                              (rev 0)
+++ trunk/LayoutTests/applicationmanifest/resources/developer-warnings.manifest 2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+{
+    "name": 0,
+    "start_url": "http:?"
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicymanifestsrcallowedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/manifest-src-allowed.html (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/manifest-src-allowed.html    2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/manifest-src-allowed.html       2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -4,7 +4,7 @@
</span><span class="cx">     if (window.testRunner) {
</span><span class="cx">         testRunner.dumpAsText();
</span><span class="cx">         testRunner.waitUntilDone();
</span><del>-        testRunner.getManifestThen(function() {
</del><ins>+        testRunner.getApplicationManifestThen(function() {
</ins><span class="cx">             alert("Pass");
</span><span class="cx">             testRunner.notifyDone();
</span><span class="cx">         });
</span></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicymanifestsrcblockedexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/manifest-src-blocked-expected.txt (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/manifest-src-blocked-expected.txt    2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/manifest-src-blocked-expected.txt       2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -1,4 +1,3 @@
</span><del>-CONSOLE MESSAGE: Refused to load manifest from 'http://127.0.0.1:8000/security/contentSecurityPolicy/manifest.test/manifest.json' because it violates the following Content Security Policy directive: "manifest-src 'none'".
-
</del><ins>+CONSOLE MESSAGE: Refused to load http://127.0.0.1:8000/security/contentSecurityPolicy/manifest.test/manifest.json because it does not appear in the manifest-src directive of the Content Security Policy.
</ins><span class="cx"> ALERT: Pass
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicymanifestsrcblockedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/manifest-src-blocked.html (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/manifest-src-blocked.html    2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/manifest-src-blocked.html       2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -4,7 +4,7 @@
</span><span class="cx">     if (window.testRunner) {
</span><span class="cx">         testRunner.dumpAsText();
</span><span class="cx">         testRunner.waitUntilDone();
</span><del>-        testRunner.getManifestThen(function() {
</del><ins>+        testRunner.getApplicationManifestThen(function() {
</ins><span class="cx">             alert("Pass");
</span><span class="cx">             testRunner.notifyDone();
</span><span class="cx">         });
</span></span></pre></div>
<a id="trunkLayoutTestshttptestssecuritycontentSecurityPolicymanifesttestmanifestjson"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/manifest.test/manifest.json (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/manifest.test/manifest.json  2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/manifest.test/manifest.json     2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><span class="cx"> {
</span><span class="cx">     "name": "Super Racer 2000",
</span><span class="cx">     "start_url": "/start.html"
</span><del>-}
</del><ins>+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Source/WebCore/ChangeLog      2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2017-12-06  David Quesada  <david_quesada@apple.com>
+
+        [Web App Manifest] Add SPI for fetching the manifest
+        https://bugs.webkit.org/show_bug.cgi?id=180294
+        rdar://problem/34747968
+
+        Reviewed by Geoffrey Garen.
+
+        Test: applicationmanifest/developer-warnings.html
+
+        * Modules/applicationmanifest/ApplicationManifest.h:
+        (WebCore::ApplicationManifest::encode const):
+        (WebCore::ApplicationManifest::decode):
+        * Modules/applicationmanifest/ApplicationManifestParser.cpp:
+        (WebCore::ApplicationManifestParser::logManifestPropertyNotAString):
+        (WebCore::ApplicationManifestParser::logManifestPropertyInvalidURL):
+            Drive-by wording changes. Since the warning is prefixed with "parsing
+            application manifest:", remove a redundant use of "application manifest".
+
</ins><span class="cx"> 2017-12-06  Per Arne Vollan  <pvollan@apple.com>
</span><span class="cx"> 
</span><span class="cx">         The WebProcess should use the NSRunLoop runloop type.
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesapplicationmanifestApplicationManifesth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h   2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h      2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #if ENABLE(APPLICATION_MANIFEST)
</span><span class="cx"> 
</span><span class="cx"> #include "URL.h"
</span><ins>+#include <wtf/Optional.h>
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -37,8 +38,36 @@
</span><span class="cx">     String description;
</span><span class="cx">     URL scope;
</span><span class="cx">     URL startURL;
</span><ins>+
+    template<class Encoder> void encode(Encoder&) const;
+    template<class Decoder> static std::optional<ApplicationManifest> decode(Decoder&);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><ins>+template<class Encoder>
+void ApplicationManifest::encode(Encoder& encoder) const
+{
+    encoder << name << shortName << description << scope << startURL;
+}
+
+template<class Decoder>
+std::optional<ApplicationManifest> ApplicationManifest::decode(Decoder& decoder)
+{
+    ApplicationManifest result;
+
+    if (!decoder.decode(result.name))
+        return std::nullopt;
+    if (!decoder.decode(result.shortName))
+        return std::nullopt;
+    if (!decoder.decode(result.description))
+        return std::nullopt;
+    if (!decoder.decode(result.scope))
+        return std::nullopt;
+    if (!decoder.decode(result.startURL))
+        return std::nullopt;
+
+    return result;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(APPLICATION_MANIFEST)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesapplicationmanifestApplicationManifestParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.cpp (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.cpp   2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.cpp      2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -79,12 +79,12 @@
</span><span class="cx"> 
</span><span class="cx"> void ApplicationManifestParser::logManifestPropertyNotAString(const String& propertyName)
</span><span class="cx"> {
</span><del>-    logDeveloperWarning("The \"" + propertyName + "\" application manifest property is not a string.");
</del><ins>+    logDeveloperWarning("The value of \"" + propertyName + "\" is not a string.");
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ApplicationManifestParser::logManifestPropertyInvalidURL(const String& propertyName)
</span><span class="cx"> {
</span><del>-    logDeveloperWarning("The \"" + propertyName + "\" application manifest property is not a valid URL.");
</del><ins>+    logDeveloperWarning("The value of \"" + propertyName + "\" is not a valid URL.");
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ApplicationManifestParser::logDeveloperWarning(const String& message)
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Source/WebKit/ChangeLog       2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -1,3 +1,55 @@
</span><ins>+2017-12-06  David Quesada  <david_quesada@apple.com>
+
+        [Web App Manifest] Add SPI for fetching the manifest
+        https://bugs.webkit.org/show_bug.cgi?id=180294
+        rdar://problem/34747968
+
+        Reviewed by Geoffrey Garen.
+
+        Add a new method -[WKWebView _getApplicationManifestWithCompletionHandler:] to request
+        the manifest associated with the current page.
+
+        * Shared/API/APIObject.h:
+        * Shared/Cocoa/APIObject.mm:
+        (API::Object::newObject):
+        * UIProcess/API/APIApplicationManifest.h: Copied from Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h.
+            Add a new API object type for application manifests.
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageGetApplicationManifest_b):
+            Add a C version of this SPI for WebKitTestRunner.
+        * UIProcess/API/C/WKPagePrivate.h:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _getApplicationManifestWithCompletionHandler:]):
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+        * UIProcess/API/Cocoa/_WKApplicationManifest.h: Copied from Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h.
+        * UIProcess/API/Cocoa/_WKApplicationManifest.mm: Added.
+        (-[_WKApplicationManifest initWithCoder:]):
+        (-[_WKApplicationManifest encodeWithCoder:]):
+        (+[_WKApplicationManifest applicationManifestFromJSON:manifestURL:documentURL:]):
+        (-[_WKApplicationManifest _apiObject]):
+        (nullableNSString):
+        (-[_WKApplicationManifest name]):
+        (-[_WKApplicationManifest shortName]):
+        (-[_WKApplicationManifest applicationDescription]):
+        (-[_WKApplicationManifest scope]):
+        (-[_WKApplicationManifest startURL]):
+        * UIProcess/API/Cocoa/_WKApplicationManifestInternal.h: Copied from Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h.
+        (API::wrapper):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::applicationManifestCallback):
+        (WebKit::WebPageProxy::getApplicationManifest):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::finishedLoadingApplicationManifest):
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::getApplicationManifest):
+        (WebKit::WebPage::didFinishLoadingApplicationManifest):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+
</ins><span class="cx"> 2017-12-06  Per Arne Vollan  <pvollan@apple.com>
</span><span class="cx"> 
</span><span class="cx">         The WebProcess should use the NSRunLoop runloop type.
</span></span></pre></div>
<a id="trunkSourceWebKitSharedAPIAPIObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/API/APIObject.h (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/API/APIObject.h       2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Source/WebKit/Shared/API/APIObject.h  2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -97,6 +97,9 @@
</span><span class="cx">         
</span><span class="cx">         // UIProcess types
</span><span class="cx">         ApplicationCacheManager,
</span><ins>+#if ENABLE(APPLICATION_MANIFEST)
+        ApplicationManifest,
+#endif
</ins><span class="cx">         Attachment,
</span><span class="cx">         AutomationSession,
</span><span class="cx">         BackForwardList,
</span></span></pre></div>
<a id="trunkSourceWebKitSharedCocoaAPIObjectmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/Cocoa/APIObject.mm (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/Cocoa/APIObject.mm    2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Source/WebKit/Shared/Cocoa/APIObject.mm       2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -81,6 +81,10 @@
</span><span class="cx"> #import "_WKUserStyleSheetInternal.h"
</span><span class="cx"> #import "_WKVisitedLinkStoreInternal.h"
</span><span class="cx"> 
</span><ins>+#if ENABLE(APPLICATION_MANIFEST)
+#import "_WKApplicationManifestInternal.h"
+#endif
+
</ins><span class="cx"> static const size_t minimumObjectAlignment = 8;
</span><span class="cx"> static_assert(minimumObjectAlignment >= alignof(void*), "Objects should always be at least pointer-aligned.");
</span><span class="cx"> static const size_t maximumExtraSpaceForAlignment = minimumObjectAlignment - alignof(void*);
</span><span class="lines">@@ -119,6 +123,12 @@
</span><span class="cx">     // API::Object, so they are allocated using +alloc.
</span><span class="cx"> 
</span><span class="cx">     switch (type) {
</span><ins>+#if ENABLE(APPLICATION_MANIFEST)
+    case Type::ApplicationManifest:
+        wrapper = [_WKApplicationManifest alloc];
+        break;
+#endif
+
</ins><span class="cx">     case Type::Array:
</span><span class="cx">         wrapper = [WKNSArray alloc];
</span><span class="cx">         break;
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIAPIApplicationManifesthfromrev225597trunkSourceWebCoreModulesapplicationmanifestApplicationManifesth"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit/UIProcess/API/APIApplicationManifest.h (from rev 225597, trunk/Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h) (0 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/APIApplicationManifest.h                               (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/APIApplicationManifest.h  2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "APIObject.h"
+#include <WebCore/ApplicationManifest.h>
+
+namespace API {
+
+#if ENABLE(APPLICATION_MANIFEST)
+class ApplicationManifest final : public ObjectImpl<Object::Type::ApplicationManifest> {
+public:
+    static Ref<ApplicationManifest> create(const WebCore::ApplicationManifest& applicationManifest)
+    {
+        return adoptRef(*new ApplicationManifest(applicationManifest));
+    }
+
+    explicit ApplicationManifest(const WebCore::ApplicationManifest& applicationManifest)
+        : m_applicationManifest(applicationManifest)
+    {
+    }
+
+    const WebCore::ApplicationManifest& applicationManifest() const { return m_applicationManifest; }
+
+private:
+    WebCore::ApplicationManifest m_applicationManifest;
+};
+#endif
+
+} // namespace API
+
</ins></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPICWKPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp   2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp      2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -2760,3 +2760,17 @@
</span><span class="cx"> {
</span><span class="cx">     return toImpl(page)->processIdentifier();
</span><span class="cx"> }
</span><ins>+
+#ifdef __BLOCKS__
+void WKPageGetApplicationManifest_b(WKPageRef page, WKPageGetApplicationManifestBlock block)
+{
+#if ENABLE(APPLICATION_MANIFEST)
+    toImpl(page)->getApplicationManifest([block](const std::optional<WebCore::ApplicationManifest> &manifest, CallbackBase::Error) {
+        block();
+    });
+#else // ENABLE(APPLICATION_MANIFEST)
+    UNUSED_PARAM(page);
+    block();
+#endif // not ENABLE(APPLICATION_MANIFEST)
+}
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPICWKPagePrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/C/WKPagePrivate.h (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/C/WKPagePrivate.h      2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPagePrivate.h 2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -178,6 +178,11 @@
</span><span class="cx"> 
</span><span class="cx"> WK_EXPORT WKProcessID WKPageGetProcessIdentifier(WKPageRef page);
</span><span class="cx"> 
</span><ins>+#ifdef __BLOCKS__
+typedef void (^WKPageGetApplicationManifestBlock)(void);
+WK_EXPORT void WKPageGetApplicationManifest_b(WKPageRef page, WKPageGetApplicationManifestBlock block);
+#endif
+
</ins><span class="cx"> #ifdef __cplusplus
</span><span class="cx"> }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm     2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm        2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -117,6 +117,10 @@
</span><span class="cx"> #import <wtf/spi/darwin/dyldSPI.h>
</span><span class="cx"> #import <wtf/text/TextStream.h>
</span><span class="cx"> 
</span><ins>+#if ENABLE(APPLICATION_MANIFEST)
+#import "_WKApplicationManifestInternal.h"
+#endif
+
</ins><span class="cx"> #if ENABLE(DATA_DETECTION)
</span><span class="cx"> #import "WKDataDetectorTypesInternal.h"
</span><span class="cx"> #endif
</span><span class="lines">@@ -4344,6 +4348,25 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)_getApplicationManifestWithCompletionHandler:(void (^)(_WKApplicationManifest *))completionHandler
+{
+#if ENABLE(APPLICATION_MANIFEST)
+    _page->getApplicationManifest([completionHandler = makeBlockPtr(completionHandler)](const std::optional<WebCore::ApplicationManifest>& manifest, WebKit::CallbackBase::Error error) {
+        UNUSED(error);
+        if (completionHandler) {
+            if (manifest) {
+                auto apiManifest = API::ApplicationManifest::create(*manifest);
+                completionHandler(wrapper(apiManifest));
+            } else
+                completionHandler(nil);
+        }
+    });
+#else
+    if (completionHandler)
+        completionHandler(nil);
+#endif
+}
+
</ins><span class="cx"> - (_WKPaginationMode)_paginationMode
</span><span class="cx"> {
</span><span class="cx">     switch (_page->paginationMode()) {
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPICocoaWKWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h       2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h  2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -96,6 +96,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> @class WKBrowsingContextHandle;
</span><ins>+@class _WKApplicationManifest;
</ins><span class="cx"> @class _WKFrameHandle;
</span><span class="cx"> @class _WKHitTestResult;
</span><span class="cx"> @class _WKIconLoadingDelegate;
</span><span class="lines">@@ -307,6 +308,8 @@
</span><span class="cx"> - (void)_getWebArchiveDataWithCompletionHandler:(void (^)(NSData *, NSError *))completionHandler;
</span><span class="cx"> - (void)_getContentsAsStringWithCompletionHandler:(void (^)(NSString *, NSError *))completionHandler WK_API_AVAILABLE(macosx(10.13), ios(11.0));
</span><span class="cx"> 
</span><ins>+- (void)_getApplicationManifestWithCompletionHandler:(void (^)(_WKApplicationManifest *))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+
</ins><span class="cx"> @property (nonatomic, setter=_setPaginationMode:) _WKPaginationMode _paginationMode;
</span><span class="cx"> // Whether the column-break-{before,after} properties are respected instead of the
</span><span class="cx"> // page-break-{before,after} properties.
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPICocoa_WKApplicationManifesthfromrev225597trunkSourceWebCoreModulesapplicationmanifestApplicationManifesth"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.h (from rev 225597, trunk/Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h) (0 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.h                         (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.h    2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#import <WebKit/WKFoundation.h>
+
+#if WK_API_ENABLED
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+WK_CLASS_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA))
+@interface _WKApplicationManifest : NSObject <NSCoding>
+
+@property (nonatomic, readonly, nullable, copy) NSString *name;
+@property (nonatomic, readonly, nullable, copy) NSString *shortName;
+@property (nonatomic, readonly, nullable, copy) NSString *applicationDescription;
+@property (nonatomic, readonly, nullable, copy) NSURL *scope;
+@property (nonatomic, readonly, copy) NSURL *startURL;
+
++ (_WKApplicationManifest *)applicationManifestFromJSON:(NSString *)json manifestURL:(NSURL *)manifestURL documentURL:(nullable NSURL *)documentURL;
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif // WK_API_ENABLED
</ins></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPICocoa_WKApplicationManifestmm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.mm (0 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.mm                                (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.mm   2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -0,0 +1,167 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "_WKApplicationManifestInternal.h"
+
+#if WK_API_ENABLED
+
+#import <WebCore/ApplicationManifest.h>
+#import <WebCore/ApplicationManifestParser.h>
+
+@implementation _WKApplicationManifest
+
+#if ENABLE(APPLICATION_MANIFEST)
+
+- (instancetype)initWithCoder:(NSCoder *)aDecoder
+{
+    NSString *name = [aDecoder decodeObjectForKey:@"name"];
+    NSString *shortName = [aDecoder decodeObjectForKey:@"short_name"];
+    NSString *description = [aDecoder decodeObjectForKey:@"description"];
+    NSURL *scopeURL = [aDecoder decodeObjectForKey:@"scope"];
+    NSURL *startURL = [aDecoder decodeObjectForKey:@"start_url"];
+
+    WebCore::ApplicationManifest coreApplicationManifest {
+        WTF::String(name),
+        WTF::String(shortName),
+        WTF::String(description),
+        WebCore::URL(scopeURL),
+        WebCore::URL(startURL)
+    };
+
+    API::Object::constructInWrapper<API::ApplicationManifest>(self, WTFMove(coreApplicationManifest));
+
+    return self;
+}
+
+- (void)dealloc
+{
+    _applicationManifest->~ApplicationManifest();
+
+    [super dealloc];
+}
+
+- (void)encodeWithCoder:(NSCoder *)aCoder
+{
+    [aCoder encodeObject:self.name forKey:@"name"];
+    [aCoder encodeObject:self.shortName forKey:@"short_name"];
+    [aCoder encodeObject:self.applicationDescription forKey:@"description"];
+    [aCoder encodeObject:self.scope forKey:@"scope"];
+    [aCoder encodeObject:self.startURL forKey:@"start_url"];
+}
+
++ (_WKApplicationManifest *)applicationManifestFromJSON:(NSString *)json manifestURL:(NSURL *)manifestURL documentURL:(NSURL *)documentURL
+{
+    auto manifest = WebCore::ApplicationManifestParser::parse(WTF::String(json), WebCore::URL(manifestURL), WebCore::URL(documentURL));
+    return [API::wrapper(API::ApplicationManifest::create(manifest).leakRef()) autorelease];
+}
+
+- (API::Object&)_apiObject
+{
+    return *_applicationManifest;
+}
+
+static NSString *nullableNSString(const WTF::String& string)
+{
+    return string.isNull() ? nil : (NSString *)string;
+}
+
+- (NSString *)name
+{
+    return nullableNSString(_applicationManifest->applicationManifest().name);
+}
+
+- (NSString *)shortName
+{
+    return nullableNSString(_applicationManifest->applicationManifest().shortName);
+}
+
+- (NSString *)applicationDescription
+{
+    return nullableNSString(_applicationManifest->applicationManifest().description);
+}
+
+- (NSURL *)scope
+{
+    return _applicationManifest->applicationManifest().scope;
+}
+
+- (NSURL *)startURL
+{
+    return _applicationManifest->applicationManifest().startURL;
+}
+
+#else // ENABLE(APPLICATION_MANIFEST)
+
++ (_WKApplicationManifest *)applicationManifestFromJSON:(NSString *)json manifestURL:(NSURL *)manifestURL documentURL:(NSURL *)documentURL
+{
+    UNUSED_PARAM(json);
+    UNUSED_PARAM(manifestURL);
+    UNUSED_PARAM(documentURL);
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+- (instancetype)initWithCoder:(NSCoder *)aDecoder
+{
+    UNUSED_PARAM(aDecoder);
+    [self release];
+    return nil;
+}
+
+- (void)encodeWithCoder:(NSCoder *)aCoder
+{
+    UNUSED_PARAM(aCoder);
+}
+
+- (NSString *)name
+{
+    return nil;
+}
+
+- (NSString *)shortName
+{
+    return nil;
+}
+
+- (NSString *)applicationDescription
+{
+    return nil;
+}
+
+- (NSURL *)scope
+{
+    return nil;
+}
+
+- (NSURL *)startURL
+{
+    return nil;
+}
+
+#endif // ENABLE(APPLICATION_MANIFEST)
+
+@end
+
+#endif // WK_API_ENABLED
</ins></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPICocoa_WKApplicationManifestInternalhfromrev225597trunkSourceWebCoreModulesapplicationmanifestApplicationManifesth"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifestInternal.h (from rev 225597, trunk/Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h) (0 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifestInternal.h                         (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifestInternal.h    2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -0,0 +1,60 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#import <WebKit/WKFoundation.h>
+
+#if WK_API_ENABLED
+
+#import "APIApplicationManifest.h"
+#import "_WKApplicationManifest.h"
+#import <WebCore/ApplicationManifest.h>
+
+namespace WebCore {
+struct ApplicationManifest;
+}
+
+#if ENABLE(APPLICATION_MANIFEST)
+namespace API {
+
+inline _WKApplicationManifest *wrapper(API::ApplicationManifest& applicationManifest)
+{
+    ASSERT([applicationManifest.wrapper() isKindOfClass:[_WKApplicationManifest class]]);
+    return (_WKApplicationManifest *)applicationManifest.wrapper();
+}
+
+}
+
+@interface _WKApplicationManifest () <WKObject> {
+@package
+    API::ObjectStorage<API::ApplicationManifest> _applicationManifest;
+}
+
+@end
+
+#endif // ENABLE(APPLICATION_MANIFEST)
+
+#endif // WK_API_ENABLED
</ins></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp   2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp      2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -5313,6 +5313,17 @@
</span><span class="cx">     callback->performCallbackWithReturnValue(range);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(APPLICATION_MANIFEST)
+void WebPageProxy::applicationManifestCallback(const std::optional<WebCore::ApplicationManifest>& manifestOrNull, CallbackID callbackID)
+{
+    auto callback = m_callbacks.take<ApplicationManifestCallback>(callbackID);
+    if (!callback)
+        return;
+
+    callback->performCallbackWithReturnValue(manifestOrNull);
+}
+#endif
+
</ins><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx"> void WebPageProxy::machSendRightCallback(const MachSendRight& sendRight, CallbackID callbackID)
</span><span class="cx"> {
</span><span class="lines">@@ -7231,4 +7242,18 @@
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(ATTACHMENT_ELEMENT)
</span><span class="cx"> 
</span><ins>+#if ENABLE(APPLICATION_MANIFEST)
+void WebPageProxy::getApplicationManifest(Function<void(const std::optional<WebCore::ApplicationManifest>&, CallbackBase::Error)>&& callbackFunction)
+{
+    if (!isValid()) {
+        callbackFunction(std::nullopt, CallbackBase::Error::Unknown);
+        return;
+    }
+
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    m_loadDependentStringCallbackIDs.add(callbackID);
+    m_process->send(Messages::WebPage::GetApplicationManifest(callbackID), m_pageID);
+}
+#endif
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebPageProxy.h     2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h        2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2010-2017 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -158,6 +158,7 @@
</span><span class="cx"> class TextIndicator;
</span><span class="cx"> class ValidationBubble;
</span><span class="cx"> 
</span><ins>+struct ApplicationManifest;
</ins><span class="cx"> struct DictionaryPopupInfo;
</span><span class="cx"> struct ExceptionDetails;
</span><span class="cx"> struct FileChooserSettings;
</span><span class="lines">@@ -266,6 +267,10 @@
</span><span class="cx"> typedef GenericCallback<const String&, bool, int32_t> ValidateCommandCallback;
</span><span class="cx"> typedef GenericCallback<const WebCore::IntRect&, const EditingRange&> RectForCharacterRangeCallback;
</span><span class="cx"> 
</span><ins>+#if ENABLE(APPLICATION_MANIFEST)
+typedef GenericCallback<const std::optional<WebCore::ApplicationManifest>&> ApplicationManifestCallback;
+#endif
+
</ins><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> typedef GenericCallback<const AttributedString&, const EditingRange&> AttributedStringForCharacterRangeCallback;
</span><span class="cx"> typedef GenericCallback<const String&, double, bool> FontAtSelectionCallback;
</span><span class="lines">@@ -1244,6 +1249,10 @@
</span><span class="cx">     void setAttachmentDataAndContentType(const String& identifier, WebCore::SharedBuffer& data, std::optional<String>&& newContentType, std::optional<String>&& newFilename, Function<void(CallbackBase::Error)>&&);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(APPLICATION_MANIFEST)
+    void getApplicationManifest(Function<void(const std::optional<WebCore::ApplicationManifest>&, CallbackBase::Error)>&&);
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, Ref<API::PageConfiguration>&&);
</span><span class="cx">     void platformInitialize();
</span><span class="lines">@@ -1504,6 +1513,9 @@
</span><span class="cx">     void validateCommandCallback(const String&, bool, int, CallbackID);
</span><span class="cx">     void unsignedCallback(uint64_t, CallbackID);
</span><span class="cx">     void editingRangeCallback(const EditingRange&, CallbackID);
</span><ins>+#if ENABLE(APPLICATION_MANIFEST)
+    void applicationManifestCallback(const std::optional<WebCore::ApplicationManifest>&, CallbackID);
+#endif
</ins><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     void machSendRightCallback(const WebCore::MachSendRight&, CallbackID);
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebPageProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in   2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in      2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -167,6 +167,9 @@
</span><span class="cx">     EditingRangeCallback(struct WebKit::EditingRange range, WebKit::CallbackID callbackID)
</span><span class="cx">     UnsignedCallback(uint64_t result, WebKit::CallbackID callbackID)
</span><span class="cx">     RectForCharacterRangeCallback(WebCore::IntRect rect, struct WebKit::EditingRange actualRange, WebKit::CallbackID callbackID)
</span><ins>+#if ENABLE(APPLICATION_MANIFEST)
+    ApplicationManifestCallback(std::optional<WebCore::ApplicationManifest> manifest, WebKit::CallbackID callbackID)
+#endif
</ins><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     AttributedStringForCharacterRangeCallback(struct WebKit::AttributedString string, struct WebKit::EditingRange actualRange, WebKit::CallbackID callbackID)
</span><span class="cx">     FontAtSelectionCallback(String fontName, double fontSize, bool selectioHasMultipleFonts, WebKit::CallbackID callbackID)
</span></span></pre></div>
<a id="trunkSourceWebKitWebKitxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj     2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj        2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -1228,6 +1228,10 @@
</span><span class="cx">          5CE85B201C88E64B0070BFCE /* PingLoad.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CE85B1F1C88E6430070BFCE /* PingLoad.h */; };
</span><span class="cx">          5CFECB041E1ED1CC00F88504 /* LegacyCustomProtocolManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CFECB031E1ED1C800F88504 /* LegacyCustomProtocolManager.cpp */; };
</span><span class="cx">          617A52D81F43A9DA00DCDC0A /* ServiceWorkerClientFetchMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 617A52D71F43A9B600DCDC0A /* ServiceWorkerClientFetchMessageReceiver.cpp */; };
</span><ins>+               63108F961F96719C00A0DB84 /* _WKApplicationManifest.h in Headers */ = {isa = PBXBuildFile; fileRef = 63108F941F96719C00A0DB84 /* _WKApplicationManifest.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               63108F971F96719C00A0DB84 /* _WKApplicationManifest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 63108F951F96719C00A0DB84 /* _WKApplicationManifest.mm */; };
+               63108F991F9671F700A0DB84 /* _WKApplicationManifestInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 63108F981F9671F700A0DB84 /* _WKApplicationManifestInternal.h */; };
+               634842511FB26E7100946E3C /* APIApplicationManifest.h in Headers */ = {isa = PBXBuildFile; fileRef = 6348424F1FB26E7100946E3C /* APIApplicationManifest.h */; };
</ins><span class="cx">           636353A51E9858DF0009F8AF /* _WKGeolocationCoreLocationProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 63FABE191E970D65003011D5 /* _WKGeolocationCoreLocationProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          63C32C251E9810D900699BD0 /* _WKGeolocationPosition.mm in Sources */ = {isa = PBXBuildFile; fileRef = 63C32C231E9810D900699BD0 /* _WKGeolocationPosition.mm */; };
</span><span class="cx">          63C32C261E9810D900699BD0 /* _WKGeolocationPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = 63C32C241E9810D900699BD0 /* _WKGeolocationPosition.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -3618,6 +3622,10 @@
</span><span class="cx">          5D442A5516D5856700AC3331 /* PluginService.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PluginService.entitlements; sourceTree = "<group>"; };
</span><span class="cx">          5DAD73F1116FF90C00EE5396 /* BaseTarget.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = BaseTarget.xcconfig; sourceTree = "<group>"; };
</span><span class="cx">          617A52D71F43A9B600DCDC0A /* ServiceWorkerClientFetchMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerClientFetchMessageReceiver.cpp; sourceTree = "<group>"; };
</span><ins>+               63108F941F96719C00A0DB84 /* _WKApplicationManifest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _WKApplicationManifest.h; sourceTree = "<group>"; };
+               63108F951F96719C00A0DB84 /* _WKApplicationManifest.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKApplicationManifest.mm; sourceTree = "<group>"; };
+               63108F981F9671F700A0DB84 /* _WKApplicationManifestInternal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _WKApplicationManifestInternal.h; sourceTree = "<group>"; };
+               6348424F1FB26E7100946E3C /* APIApplicationManifest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = APIApplicationManifest.h; sourceTree = "<group>"; };
</ins><span class="cx">           63C32C231E9810D900699BD0 /* _WKGeolocationPosition.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKGeolocationPosition.mm; sourceTree = "<group>"; };
</span><span class="cx">          63C32C241E9810D900699BD0 /* _WKGeolocationPosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKGeolocationPosition.h; sourceTree = "<group>"; };
</span><span class="cx">          63C32C271E98119000699BD0 /* _WKGeolocationPositionInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKGeolocationPositionInternal.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -5795,6 +5803,9 @@
</span><span class="cx">                          37A5E01218BBF937000A081E /* _WKActivatedElementInfo.h */,
</span><span class="cx">                          37A5E01118BBF937000A081E /* _WKActivatedElementInfo.mm */,
</span><span class="cx">                          379A873518BBFA4300588AF2 /* _WKActivatedElementInfoInternal.h */,
</span><ins>+                               63108F941F96719C00A0DB84 /* _WKApplicationManifest.h */,
+                               63108F951F96719C00A0DB84 /* _WKApplicationManifest.mm */,
+                               63108F981F9671F700A0DB84 /* _WKApplicationManifestInternal.h */,
</ins><span class="cx">                           F44291911FA59107002CC93E /* _WKAttachment.h */,
</span><span class="cx">                          F44291931FA59311002CC93E /* _WKAttachment.mm */,
</span><span class="cx">                          F44291951FA5942A002CC93E /* _WKAttachmentInternal.h */,
</span><span class="lines">@@ -7195,6 +7206,7 @@
</span><span class="cx">                          37C4C08318149C2A003688B9 /* Cocoa */,
</span><span class="cx">                          BC8A501311765F4500757573 /* cpp */,
</span><span class="cx">                          BC111B47112F616900337BAB /* mac */,
</span><ins>+                               6348424F1FB26E7100946E3C /* APIApplicationManifest.h */,
</ins><span class="cx">                           2E5C770D1FA7D429005932C3 /* APIAttachment.cpp */,
</span><span class="cx">                          2E5C770C1FA7D429005932C3 /* APIAttachment.h */,
</span><span class="cx">                          99C81D5B1C20E817005C4C82 /* APIAutomationClient.h */,
</span><span class="lines">@@ -8462,6 +8474,8 @@
</span><span class="cx">                  files = (
</span><span class="cx">                          37A5E01418BBF93F000A081E /* _WKActivatedElementInfo.h in Headers */,
</span><span class="cx">                          379A873618BBFA4300588AF2 /* _WKActivatedElementInfoInternal.h in Headers */,
</span><ins>+                               63108F961F96719C00A0DB84 /* _WKApplicationManifest.h in Headers */,
+                               63108F991F9671F700A0DB84 /* _WKApplicationManifestInternal.h in Headers */,
</ins><span class="cx">                           F44291921FA591C9002CC93E /* _WKAttachment.h in Headers */,
</span><span class="cx">                          F44291961FA5942A002CC93E /* _WKAttachmentInternal.h in Headers */,
</span><span class="cx">                          99E714C51C124A0400665B3A /* _WKAutomationDelegate.h in Headers */,
</span><span class="lines">@@ -8537,6 +8551,7 @@
</span><span class="cx">                          A19DD3C01D07D16800AC823B /* _WKWebViewPrintFormatterInternal.h in Headers */,
</span><span class="cx">                          A182D5B51BE6BD250087A7CC /* AccessibilityIOS.h in Headers */,
</span><span class="cx">                          A7D792D81767CCA300881CBE /* ActivityAssertion.h in Headers */,
</span><ins>+                               634842511FB26E7100946E3C /* APIApplicationManifest.h in Headers */,
</ins><span class="cx">                           BC64697011DBE603006455B0 /* APIArray.h in Headers */,
</span><span class="cx">                          2E5C770E1FA7D429005932C3 /* APIAttachment.h in Headers */,
</span><span class="cx">                          99C81D5D1C21F38B005C4C82 /* APIAutomationClient.h in Headers */,
</span><span class="lines">@@ -10110,6 +10125,7 @@
</span><span class="cx">                  buildActionMask = 2147483647;
</span><span class="cx">                  files = (
</span><span class="cx">                          37A5E01318BBF937000A081E /* _WKActivatedElementInfo.mm in Sources */,
</span><ins>+                               63108F971F96719C00A0DB84 /* _WKApplicationManifest.mm in Sources */,
</ins><span class="cx">                           F44291941FA59311002CC93E /* _WKAttachment.mm in Sources */,
</span><span class="cx">                          990D28B21C65209400986977 /* _WKAutomationSession.mm in Sources */,
</span><span class="cx">                          99788ACC1F421DE200C08000 /* _WKAutomationSessionConfiguration.mm in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebCoreSupportWebFrameLoaderClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp   2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp      2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -1840,4 +1840,15 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(APPLICATION_MANIFEST)
+void WebFrameLoaderClient::finishedLoadingApplicationManifest(uint64_t callbackIdentifier, const std::optional<WebCore::ApplicationManifest>& manifest)
+{
+    WebPage* webPage = m_frame->page();
+    if (!webPage)
+        return;
+
+    webPage->didFinishLoadingApplicationManifest(callbackIdentifier, manifest);
+}
+#endif // ENABLE(APPLICATION_MANIFEST)
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebCoreSupportWebFrameLoaderClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h     2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h        2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -262,6 +262,10 @@
</span><span class="cx">     void getLoadDecisionForIcons(const Vector<std::pair<WebCore::LinkIcon&, uint64_t>>&) final;
</span><span class="cx">     void finishedLoadingIcon(uint64_t callbackIdentifier, WebCore::SharedBuffer*) final;
</span><span class="cx"> 
</span><ins>+#if ENABLE(APPLICATION_MANIFEST)
+    void finishedLoadingApplicationManifest(uint64_t, const std::optional<WebCore::ApplicationManifest>&) final;
+#endif
+
</ins><span class="cx">     WebFrame* m_frame;
</span><span class="cx">     RefPtr<PluginView> m_pluginView;
</span><span class="cx">     bool m_hasSentResponseToPluginView;
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp       2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp  2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -5898,4 +5898,32 @@
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(ATTACHMENT_ELEMENT)
</span><span class="cx"> 
</span><ins>+#if ENABLE(APPLICATION_MANIFEST)
+void WebPage::getApplicationManifest(CallbackID callbackID)
+{
+    ASSERT(callbackID.isValid());
+    Document* mainFrameDocument = m_mainFrame->coreFrame()->document();
+    DocumentLoader* loader = mainFrameDocument ? mainFrameDocument->loader() : nullptr;
+
+    if (!loader) {
+        send(Messages::WebPageProxy::ApplicationManifestCallback(std::nullopt, callbackID));
+        return;
+    }
+
+    auto coreCallbackID = loader->loadApplicationManifest();
+    if (!coreCallbackID) {
+        send(Messages::WebPageProxy::ApplicationManifestCallback(std::nullopt, callbackID));
+        return;
+    }
+
+    m_applicationManifestFetchCallbackMap.add(coreCallbackID, callbackID.toInteger());
+}
+
+void WebPage::didFinishLoadingApplicationManifest(uint64_t coreCallbackID, const std::optional<WebCore::ApplicationManifest>& manifest)
+{
+    auto callbackID = CallbackID::fromInteger(m_applicationManifestFetchCallbackMap.take(coreCallbackID));
+    send(Messages::WebPageProxy::ApplicationManifestCallback(manifest, callbackID));
+}
+#endif // ENABLE(APPLICATION_MANIFEST)
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h    2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -87,6 +87,10 @@
</span><span class="cx"> #include <WebCore/ViewportConfiguration.h>
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(APPLICATION_MANIFEST)
+#include <WebCore/ApplicationManifest.h>
+#endif
+
</ins><span class="cx"> #if ENABLE(IOS_TOUCH_EVENTS)
</span><span class="cx"> #include <WebKitAdditions/PlatformTouchEventIOS.h>
</span><span class="cx"> #elif ENABLE(TOUCH_EVENTS)
</span><span class="lines">@@ -1031,6 +1035,11 @@
</span><span class="cx">     void setAttachmentDataAndContentType(const String& identifier, const IPC::DataReference&, std::optional<String> newContentType, std::optional<String> newFilename, CallbackID);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(APPLICATION_MANIFEST)
+    void getApplicationManifest(CallbackID);
+    void didFinishLoadingApplicationManifest(uint64_t, const std::optional<WebCore::ApplicationManifest>&);
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     WebPage(uint64_t pageID, WebPageCreationParameters&&);
</span><span class="cx"> 
</span><span class="lines">@@ -1645,6 +1654,10 @@
</span><span class="cx">     HashMap<uint64_t, WebURLSchemeHandlerProxy*> m_identifierToURLSchemeHandlerProxyMap;
</span><span class="cx"> 
</span><span class="cx">     HashMap<uint64_t, WTF::Function<void (bool granted)>> m_storageAccessResponseCallbackMap;
</span><ins>+
+#if ENABLE(APPLICATION_MANIFEST)
+    HashMap<uint64_t, uint64_t> m_applicationManifestFetchCallbackMap;
+#endif
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebPageWebPagemessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in       2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in  2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -491,4 +491,8 @@
</span><span class="cx">     SetAttachmentDisplayOptions(String identifier, struct WebCore::AttachmentDisplayOptions options, WebKit::CallbackID callbackID)
</span><span class="cx">     SetAttachmentDataAndContentType(String identifier, IPC::DataReference data, std::optional<String> newContentType, std::optional<String> newFilename, WebKit::CallbackID callbackID)
</span><span class="cx"> #endif
</span><ins>+
+#if ENABLE(APPLICATION_MANIFEST)
+    GetApplicationManifest(WebKit::CallbackID callbackID)
+#endif
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Tools/ChangeLog       2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2017-12-06  David Quesada  <david_quesada@apple.com>
+
+        [Web App Manifest] Add SPI for fetching the manifest
+        https://bugs.webkit.org/show_bug.cgi?id=180294
+        rdar://problem/34747968
+
+        Reviewed by Geoffrey Garen.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKitCocoa/ApplicationManifest.mm: Added.
+            Added two API tests for _WKApplicationManifest:
+            - Testing _WKApplicationManifest's conformance to NSCoding.
+            - Testing -[WKWebView _getApplicationManifestWithCompletionHandler:], verifying the
+              values of the resulting _WKApplicationManifest.
+        (TestWebKitAPI::TEST):
+
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+            Added a new testRunner method getApplicationManifestThen(), used by the LayoutTests
+            to request the document load its associated manifest. The layout tests formerly called
+            an unimplemented function getManifestThen(), but I added 'Application' to somewhat
+            differentiate this from the app cache manifest.
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::didReceiveMessageToPage):
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::getApplicationManifestThen):
+        (WTR::TestRunner::didGetApplicationManifest):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+
</ins><span class="cx"> 2017-12-05  Stephan Szabo  <stephan.szabo@sony.com>
</span><span class="cx"> 
</span><span class="cx">         Switch windows build to Visual Studio 2017
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj   2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -260,6 +260,7 @@
</span><span class="cx">          6354F4D11F7C3AB500D89DF3 /* ApplicationManifestParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6354F4D01F7C3AB500D89DF3 /* ApplicationManifestParser.cpp */; };
</span><span class="cx">          6356FB221EC4E0BA0044BF18 /* VisibleContentRect.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6356FB211EC4E0BA0044BF18 /* VisibleContentRect.mm */; };
</span><span class="cx">          636353A71E98665D0009F8AF /* GeolocationGetCurrentPositionResult.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 636353A61E9861940009F8AF /* GeolocationGetCurrentPositionResult.html */; };
</span><ins>+               63F668221F97F7F90032EE51 /* ApplicationManifest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 63F668201F97C3AA0032EE51 /* ApplicationManifest.mm */; };
</ins><span class="cx">           6BFD294C1D5E6C1D008EC968 /* HashCountedSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A38D7E51C752D5F004F157D /* HashCountedSet.cpp */; };
</span><span class="cx">          751B05D61F8EAC410028A09E /* DatabaseTrackerTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 751B05D51F8EAC1A0028A09E /* DatabaseTrackerTest.mm */; };
</span><span class="cx">          754CEC811F6722F200D0039A /* AutoFillAvailable.mm in Sources */ = {isa = PBXBuildFile; fileRef = 754CEC801F6722DC00D0039A /* AutoFillAvailable.mm */; };
</span><span class="lines">@@ -1403,6 +1404,7 @@
</span><span class="cx">          6354F4D01F7C3AB500D89DF3 /* ApplicationManifestParser.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ApplicationManifestParser.cpp; sourceTree = "<group>"; };
</span><span class="cx">          6356FB211EC4E0BA0044BF18 /* VisibleContentRect.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = VisibleContentRect.mm; sourceTree = "<group>"; };
</span><span class="cx">          636353A61E9861940009F8AF /* GeolocationGetCurrentPositionResult.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = GeolocationGetCurrentPositionResult.html; sourceTree = "<group>"; };
</span><ins>+               63F668201F97C3AA0032EE51 /* ApplicationManifest.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ApplicationManifest.mm; sourceTree = "<group>"; };
</ins><span class="cx">           751B05D51F8EAC1A0028A09E /* DatabaseTrackerTest.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DatabaseTrackerTest.mm; sourceTree = "<group>"; };
</span><span class="cx">          754CEC801F6722DC00D0039A /* AutoFillAvailable.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AutoFillAvailable.mm; sourceTree = "<group>"; };
</span><span class="cx">          7560917719259C59009EF06E /* MemoryCacheAddImageToCacheIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MemoryCacheAddImageToCacheIOS.mm; sourceTree = "<group>"; };
</span><span class="lines">@@ -2002,6 +2004,7 @@
</span><span class="cx">                          37E7DD651EA0715B009B396D /* AdditionalReadAccessAllowedURLsProtocol.h */,
</span><span class="cx">                          A1DF74301C41B65800A2F4D0 /* AlwaysRevalidatedURLSchemes.mm */,
</span><span class="cx">                          2DE71AFD1D49C0BD00904094 /* AnimatedResize.mm */,
</span><ins>+                               63F668201F97C3AA0032EE51 /* ApplicationManifest.mm */,
</ins><span class="cx">                           754CEC801F6722DC00D0039A /* AutoFillAvailable.mm */,
</span><span class="cx">                          2DD355351BD08378005DF4A7 /* AutoLayoutIntegration.mm */,
</span><span class="cx">                          374B7A5E1DF36EEE00ACCB6C /* BundleEditingDelegate.mm */,
</span><span class="lines">@@ -3256,6 +3259,7 @@
</span><span class="cx">                          7A909A7D1D877480007E10F8 /* AffineTransform.cpp in Sources */,
</span><span class="cx">                          A1DF74321C41B65800A2F4D0 /* AlwaysRevalidatedURLSchemes.mm in Sources */,
</span><span class="cx">                          2DE71AFE1D49C0BD00904094 /* AnimatedResize.mm in Sources */,
</span><ins>+                               63F668221F97F7F90032EE51 /* ApplicationManifest.mm in Sources */,
</ins><span class="cx">                           6354F4D11F7C3AB500D89DF3 /* ApplicationManifestParser.cpp in Sources */,
</span><span class="cx">                          7CCE7EB41A411A7E00447C4C /* AttributedString.mm in Sources */,
</span><span class="cx">                          CDC8E48D1BC5CB4500594FEC /* AudioSessionCategoryIOS.mm in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKitCocoaApplicationManifestmm"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ApplicationManifest.mm (0 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ApplicationManifest.mm                               (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ApplicationManifest.mm  2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -0,0 +1,107 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+
+#if WK_API_ENABLED && ENABLE(APPLICATION_MANIFEST)
+
+#import "PlatformUtilities.h"
+#import "Test.h"
+#import "TestNavigationDelegate.h"
+#import "TestWKWebView.h"
+#import <WebKit/WKWebViewPrivate.h>
+#import <WebKit/_WKApplicationManifest.h>
+
+namespace TestWebKitAPI {
+
+TEST(WebKit, ApplicationManifestCoding)
+{
+    auto jsonString = @"{ \"name\": \"TestName\", \"short_name\": \"TestShortName\", \"description\": \"TestDescription\", \"scope\": \"https://test.com/app\", \"start_url\": \"https://test.com/app/index.html\" }";
+    RetainPtr<_WKApplicationManifest> manifest { [_WKApplicationManifest applicationManifestFromJSON:jsonString manifestURL:[NSURL URLWithString:@"https://test.com/manifest.json"] documentURL:[NSURL URLWithString:@"https://test.com/"]] };
+    
+    manifest = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:manifest.get()]];
+    
+    EXPECT_TRUE([manifest isKindOfClass:[_WKApplicationManifest class]]);
+    EXPECT_STREQ("TestName", manifest.get().name.UTF8String);
+    EXPECT_STREQ("TestShortName", manifest.get().shortName.UTF8String);
+    EXPECT_STREQ("TestDescription", manifest.get().applicationDescription.UTF8String);
+    EXPECT_STREQ("https://test.com/app", manifest.get().scope.absoluteString.UTF8String);
+    EXPECT_STREQ("https://test.com/app/index.html", manifest.get().startURL.absoluteString.UTF8String);
+}
+
+TEST(WebKit, ApplicationManifestBasic)
+{
+    static bool done = false;
+
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSZeroRect]);
+    [webView synchronouslyLoadHTMLString:@""];
+    [webView.get() _getApplicationManifestWithCompletionHandler:^(_WKApplicationManifest *manifest) {
+        EXPECT_NULL(manifest);
+        done = true;
+    }];
+    Util::run(&done);
+
+    done = false;
+    [webView synchronouslyLoadHTMLString:@"<link rel=\"manifest\" href=\"invalidurl://path\">"];
+    [webView _getApplicationManifestWithCompletionHandler:^(_WKApplicationManifest *manifest) {
+        EXPECT_NULL(manifest);
+        done = true;
+    }];
+    Util::run(&done);
+
+    done = false;
+    NSDictionary *manifestObject = @{ @"name": @"Test" };
+    [webView synchronouslyLoadHTMLString:[NSString stringWithFormat:@"<link rel=\"manifest\" href=\"data:application/manifest+json;charset=utf-8;base64,%@\">", [[NSJSONSerialization dataWithJSONObject:manifestObject options:0 error:nil] base64EncodedStringWithOptions:0]]];
+    [webView _getApplicationManifestWithCompletionHandler:^(_WKApplicationManifest *manifest) {
+        EXPECT_TRUE([manifest.name isEqualToString:@"Test"]);
+        done = true;
+    }];
+    Util::run(&done);
+
+    done = false;
+    manifestObject = @{
+        @"name": @"A Web Application",
+        @"short_name": @"WebApp",
+        @"description": @"Hello.",
+        @"start_url": @"http://example.com/app/start",
+        @"scope": @"http://example.com/app",
+    };
+    NSString *htmlString = [NSString stringWithFormat:@"<link rel=\"manifest\" href=\"data:text/plain;charset=utf-8;base64,%@\">", [[NSJSONSerialization dataWithJSONObject:manifestObject options:0 error:nil] base64EncodedStringWithOptions:0]];
+    [webView loadHTMLString:htmlString baseURL:[NSURL URLWithString:@"http://example.com/app/index"]];
+    [webView _test_waitForDidFinishNavigation];
+    [webView _getApplicationManifestWithCompletionHandler:^(_WKApplicationManifest *manifest) {
+        EXPECT_TRUE([manifest.name isEqualToString:@"A Web Application"]);
+        EXPECT_TRUE([manifest.shortName isEqualToString:@"WebApp"]);
+        EXPECT_TRUE([manifest.applicationDescription isEqualToString:@"Hello."]);
+        EXPECT_TRUE([manifest.startURL isEqual:[NSURL URLWithString:@"http://example.com/app/start"]]);
+        EXPECT_TRUE([manifest.scope isEqual:[NSURL URLWithString:@"http://example.com/app"]]);
+        done = true;
+    }];
+    Util::run(&done);
+}
+
+} // namespace TestWebKitAPI
+
+#endif // WK_API_ENABLED && ENABLE(APPLICATION_MANIFEST)
</ins></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleBindingsTestRunneridl"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl      2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -306,4 +306,6 @@
</span><span class="cx">     void terminateNetworkProcess();
</span><span class="cx"> 
</span><span class="cx">     void removeAllSessionCredentials(object callback);
</span><ins>+
+    void getApplicationManifestThen(object callback);
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleInjectedBundlecpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp   2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp      2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -298,6 +298,11 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     
</span><ins>+    if (WKStringIsEqualToUTF8CString(messageName, "DidGetApplicationManifest")) {
+        m_testRunner->didGetApplicationManifest();
+        return;
+    }
+    
</ins><span class="cx">     WKRetainPtr<WKStringRef> errorMessageName(AdoptWK, WKStringCreateWithUTF8CString("Error"));
</span><span class="cx">     WKRetainPtr<WKStringRef> errorMessageBody(AdoptWK, WKStringCreateWithUTF8CString("Unknown"));
</span><span class="cx">     WKBundlePagePostMessage(page, errorMessageName.get(), errorMessageBody.get());
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleTestRunnercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp       2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp  2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -652,6 +652,7 @@
</span><span class="cx">     StatisticsDidRunTelemetryCallbackID,
</span><span class="cx">     StatisticsDidClearThroughWebsiteDataRemovalCallbackID,
</span><span class="cx">     DidRemoveAllSessionCredentialsCallbackID,
</span><ins>+    GetApplicationManifestCallbackID,
</ins><span class="cx">     FirstUIScriptCallbackID = 100
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -1874,4 +1875,17 @@
</span><span class="cx">     return WKUInt64GetValue(static_cast<WKUInt64Ref>(returnData));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void TestRunner::getApplicationManifestThen(JSValueRef callback)
+{
+    cacheTestRunnerCallback(GetApplicationManifestCallbackID, callback);
+    
+    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("GetApplicationManifest"));
+    WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), nullptr, nullptr);
+}
+
+void TestRunner::didGetApplicationManifest()
+{
+    callTestRunnerCallback(GetApplicationManifestCallbackID);
+}
+
</ins><span class="cx"> } // namespace WTR
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleTestRunnerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h    2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -405,6 +405,9 @@
</span><span class="cx"> 
</span><span class="cx">     void removeAllSessionCredentials(JSValueRef);
</span><span class="cx">     void callDidRemoveAllSessionCredentialsCallback();
</span><ins>+    
+    void getApplicationManifestThen(JSValueRef);
+    void didGetApplicationManifest();
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     TestRunner();
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestInvocationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (225597 => 225598)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp  2017-12-06 22:24:30 UTC (rev 225597)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp     2017-12-06 22:26:32 UTC (rev 225598)
</span><span class="lines">@@ -1246,6 +1246,19 @@
</span><span class="cx">         return result;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (WKStringIsEqualToUTF8CString(messageName, "GetApplicationManifest")) {
+#ifdef __BLOCKS__
+        WKPageGetApplicationManifest_b(TestController::singleton().mainWebView()->page(), ^{
+            WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("DidGetApplicationManifest"));
+            WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), 0);
+        });
+#else
+        // FIXME: Add API for loading the manifest on non-__BLOCKS__ ports.
+        ASSERT_NOT_REACHED();
+#endif
+        return nullptr;
+    }
+
</ins><span class="cx">     ASSERT_NOT_REACHED();
</span><span class="cx">     return nullptr;
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>