Changeset 225598 in webkit
- Timestamp:
- Dec 6, 2017 2:26:32 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 9 added
- 31 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r225593 r225598 1 2017-12-06 David Quesada <david_quesada@apple.com> 2 3 [Web App Manifest] Add SPI for fetching the manifest 4 https://bugs.webkit.org/show_bug.cgi?id=180294 5 rdar://problem/34747968 6 7 Reviewed by Geoffrey Garen. 8 9 * TestExpectations: 10 Skip the app manifest-related layout tests for now while the feature is still disabled. 11 Also moved the expectations disabling the manifest-src layout tests (which now pass 12 when the feature is enabled) to the same location in the file. 13 * applicationmanifest/developer-warnings-expected.txt: Added. 14 * applicationmanifest/developer-warnings.html: Added. 15 * applicationmanifest/multiple-links-expected.txt: Added. 16 * applicationmanifest/multiple-links.html: Added. 17 Add a layout test to verify only the first manifest link is loaded when there 18 are multiple on the page. 19 * applicationmanifest/resources/developer-warnings.manifest: Added. 20 Add a layout test to verify that warnings generated while parsing the manifest are 21 logged to the console. 22 * http/tests/security/contentSecurityPolicy/manifest-src-allowed.html: 23 Replaced calls to getManifestThen() with getApplicationManifestThen(). 24 * http/tests/security/contentSecurityPolicy/manifest-src-blocked-expected.txt: 25 Updated the expected console message to reflect the current wording for CSP violations. 26 * http/tests/security/contentSecurityPolicy/manifest-src-blocked.html: 27 Replaced calls to getManifestThen() with getApplicationManifestThen(). 28 * http/tests/security/contentSecurityPolicy/manifest.test/manifest.json: 29 Removed a trailing newline that was causing JSON parsing to fail. 30 1 31 2017-12-06 Youenn Fablet <youenn@apple.com> 2 32 -
trunk/LayoutTests/TestExpectations
r225593 r225598 1111 1111 webkit.org/b/153150 http/tests/security/contentSecurityPolicy/1.1/child-src/frame-fires-load-event-when-blocked.html 1112 1112 webkit.org/b/153150 http/tests/security/contentSecurityPolicy/1.1/child-src/frame-fires-load-event-when-redirect-blocked.html 1113 webkit.org/b/153152 http/tests/security/contentSecurityPolicy/manifest-src-allowed.html # Needs testRunner.getManifestThen()1114 webkit.org/b/153152 http/tests/security/contentSecurityPolicy/manifest-src-blocked.html # Needs testRunner.getManifestThen()1115 1113 webkit.org/b/153155 http/tests/security/contentSecurityPolicy/1.1/scripthash-basic-blocked-error-event.html 1116 1114 webkit.org/b/153155 http/tests/security/contentSecurityPolicy/1.1/stylehash-basic-blocked-error-event.html … … 1651 1649 1652 1650 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 ] 1651 1652 # Application Manifest tests 1653 webkit.org/b/153152 http/tests/security/contentSecurityPolicy/manifest-src-allowed.html [ Skip ] 1654 webkit.org/b/153152 http/tests/security/contentSecurityPolicy/manifest-src-blocked.html [ Skip ] 1655 webkit.org/b/158205 applicationmanifest/ [ Skip ] 1656 -
trunk/LayoutTests/http/tests/security/contentSecurityPolicy/manifest-src-allowed.html
r195367 r225598 5 5 testRunner.dumpAsText(); 6 6 testRunner.waitUntilDone(); 7 testRunner.get ManifestThen(function() {7 testRunner.getApplicationManifestThen(function() { 8 8 alert("Pass"); 9 9 testRunner.notifyDone(); -
trunk/LayoutTests/http/tests/security/contentSecurityPolicy/manifest-src-blocked-expected.txt
r195367 r225598 1 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'". 2 1 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. 3 2 ALERT: Pass 4 3 -
trunk/LayoutTests/http/tests/security/contentSecurityPolicy/manifest-src-blocked.html
r195367 r225598 5 5 testRunner.dumpAsText(); 6 6 testRunner.waitUntilDone(); 7 testRunner.get ManifestThen(function() {7 testRunner.getApplicationManifestThen(function() { 8 8 alert("Pass"); 9 9 testRunner.notifyDone(); -
trunk/Source/WebCore/ChangeLog
r225597 r225598 1 2017-12-06 David Quesada <david_quesada@apple.com> 2 3 [Web App Manifest] Add SPI for fetching the manifest 4 https://bugs.webkit.org/show_bug.cgi?id=180294 5 rdar://problem/34747968 6 7 Reviewed by Geoffrey Garen. 8 9 Test: applicationmanifest/developer-warnings.html 10 11 * Modules/applicationmanifest/ApplicationManifest.h: 12 (WebCore::ApplicationManifest::encode const): 13 (WebCore::ApplicationManifest::decode): 14 * Modules/applicationmanifest/ApplicationManifestParser.cpp: 15 (WebCore::ApplicationManifestParser::logManifestPropertyNotAString): 16 (WebCore::ApplicationManifestParser::logManifestPropertyInvalidURL): 17 Drive-by wording changes. Since the warning is prefixed with "parsing 18 application manifest:", remove a redundant use of "application manifest". 19 1 20 2017-12-06 Per Arne Vollan <pvollan@apple.com> 2 21 -
trunk/Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h
r225507 r225598 29 29 30 30 #include "URL.h" 31 #include <wtf/Optional.h> 31 32 32 33 namespace WebCore { … … 38 39 URL scope; 39 40 URL startURL; 41 42 template<class Encoder> void encode(Encoder&) const; 43 template<class Decoder> static std::optional<ApplicationManifest> decode(Decoder&); 40 44 }; 45 46 template<class Encoder> 47 void ApplicationManifest::encode(Encoder& encoder) const 48 { 49 encoder << name << shortName << description << scope << startURL; 50 } 51 52 template<class Decoder> 53 std::optional<ApplicationManifest> ApplicationManifest::decode(Decoder& decoder) 54 { 55 ApplicationManifest result; 56 57 if (!decoder.decode(result.name)) 58 return std::nullopt; 59 if (!decoder.decode(result.shortName)) 60 return std::nullopt; 61 if (!decoder.decode(result.description)) 62 return std::nullopt; 63 if (!decoder.decode(result.scope)) 64 return std::nullopt; 65 if (!decoder.decode(result.startURL)) 66 return std::nullopt; 67 68 return result; 69 } 41 70 42 71 } // namespace WebCore -
trunk/Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.cpp
r225507 r225598 80 80 void ApplicationManifestParser::logManifestPropertyNotAString(const String& propertyName) 81 81 { 82 logDeveloperWarning("The \"" + propertyName + "\" application manifest propertyis not a string.");82 logDeveloperWarning("The value of \"" + propertyName + "\" is not a string."); 83 83 } 84 84 85 85 void ApplicationManifestParser::logManifestPropertyInvalidURL(const String& propertyName) 86 86 { 87 logDeveloperWarning("The \"" + propertyName + "\" application manifest propertyis not a valid URL.");87 logDeveloperWarning("The value of \"" + propertyName + "\" is not a valid URL."); 88 88 } 89 89 -
trunk/Source/WebKit/ChangeLog
r225597 r225598 1 2017-12-06 David Quesada <david_quesada@apple.com> 2 3 [Web App Manifest] Add SPI for fetching the manifest 4 https://bugs.webkit.org/show_bug.cgi?id=180294 5 rdar://problem/34747968 6 7 Reviewed by Geoffrey Garen. 8 9 Add a new method -[WKWebView _getApplicationManifestWithCompletionHandler:] to request 10 the manifest associated with the current page. 11 12 * Shared/API/APIObject.h: 13 * Shared/Cocoa/APIObject.mm: 14 (API::Object::newObject): 15 * UIProcess/API/APIApplicationManifest.h: Copied from Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h. 16 Add a new API object type for application manifests. 17 * UIProcess/API/C/WKPage.cpp: 18 (WKPageGetApplicationManifest_b): 19 Add a C version of this SPI for WebKitTestRunner. 20 * UIProcess/API/C/WKPagePrivate.h: 21 * UIProcess/API/Cocoa/WKWebView.mm: 22 (-[WKWebView _getApplicationManifestWithCompletionHandler:]): 23 * UIProcess/API/Cocoa/WKWebViewPrivate.h: 24 * UIProcess/API/Cocoa/_WKApplicationManifest.h: Copied from Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h. 25 * UIProcess/API/Cocoa/_WKApplicationManifest.mm: Added. 26 (-[_WKApplicationManifest initWithCoder:]): 27 (-[_WKApplicationManifest encodeWithCoder:]): 28 (+[_WKApplicationManifest applicationManifestFromJSON:manifestURL:documentURL:]): 29 (-[_WKApplicationManifest _apiObject]): 30 (nullableNSString): 31 (-[_WKApplicationManifest name]): 32 (-[_WKApplicationManifest shortName]): 33 (-[_WKApplicationManifest applicationDescription]): 34 (-[_WKApplicationManifest scope]): 35 (-[_WKApplicationManifest startURL]): 36 * UIProcess/API/Cocoa/_WKApplicationManifestInternal.h: Copied from Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h. 37 (API::wrapper): 38 * UIProcess/WebPageProxy.cpp: 39 (WebKit::WebPageProxy::applicationManifestCallback): 40 (WebKit::WebPageProxy::getApplicationManifest): 41 * UIProcess/WebPageProxy.h: 42 * UIProcess/WebPageProxy.messages.in: 43 * WebKit.xcodeproj/project.pbxproj: 44 * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: 45 (WebKit::WebFrameLoaderClient::finishedLoadingApplicationManifest): 46 * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 47 * WebProcess/WebPage/WebPage.cpp: 48 (WebKit::WebPage::getApplicationManifest): 49 (WebKit::WebPage::didFinishLoadingApplicationManifest): 50 * WebProcess/WebPage/WebPage.h: 51 * WebProcess/WebPage/WebPage.messages.in: 52 1 53 2017-12-06 Per Arne Vollan <pvollan@apple.com> 2 54 -
trunk/Source/WebKit/Shared/API/APIObject.h
r224729 r225598 98 98 // UIProcess types 99 99 ApplicationCacheManager, 100 #if ENABLE(APPLICATION_MANIFEST) 101 ApplicationManifest, 102 #endif 100 103 Attachment, 101 104 AutomationSession, -
trunk/Source/WebKit/Shared/Cocoa/APIObject.mm
r224729 r225598 82 82 #import "_WKVisitedLinkStoreInternal.h" 83 83 84 #if ENABLE(APPLICATION_MANIFEST) 85 #import "_WKApplicationManifestInternal.h" 86 #endif 87 84 88 static const size_t minimumObjectAlignment = 8; 85 89 static_assert(minimumObjectAlignment >= alignof(void*), "Objects should always be at least pointer-aligned."); … … 120 124 121 125 switch (type) { 126 #if ENABLE(APPLICATION_MANIFEST) 127 case Type::ApplicationManifest: 128 wrapper = [_WKApplicationManifest alloc]; 129 break; 130 #endif 131 122 132 case Type::Array: 123 133 wrapper = [WKNSArray alloc]; -
trunk/Source/WebKit/UIProcess/API/APIApplicationManifest.h
r225597 r225598 26 26 #pragma once 27 27 28 #include "APIObject.h" 29 #include <WebCore/ApplicationManifest.h> 30 31 namespace API { 32 28 33 #if ENABLE(APPLICATION_MANIFEST) 34 class ApplicationManifest final : public ObjectImpl<Object::Type::ApplicationManifest> { 35 public: 36 static Ref<ApplicationManifest> create(const WebCore::ApplicationManifest& applicationManifest) 37 { 38 return adoptRef(*new ApplicationManifest(applicationManifest)); 39 } 29 40 30 #include "URL.h" 41 explicit ApplicationManifest(const WebCore::ApplicationManifest& applicationManifest) 42 : m_applicationManifest(applicationManifest) 43 { 44 } 31 45 32 namespace WebCore { 46 const WebCore::ApplicationManifest& applicationManifest() const { return m_applicationManifest; } 33 47 34 struct ApplicationManifest { 35 String name; 36 String shortName; 37 String description; 38 URL scope; 39 URL startURL; 48 private: 49 WebCore::ApplicationManifest m_applicationManifest; 40 50 }; 51 #endif 41 52 42 } // namespace WebCore53 } // namespace API 43 54 44 #endif // ENABLE(APPLICATION_MANIFEST)45 -
trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp
r224677 r225598 2761 2761 return toImpl(page)->processIdentifier(); 2762 2762 } 2763 2764 #ifdef __BLOCKS__ 2765 void WKPageGetApplicationManifest_b(WKPageRef page, WKPageGetApplicationManifestBlock block) 2766 { 2767 #if ENABLE(APPLICATION_MANIFEST) 2768 toImpl(page)->getApplicationManifest([block](const std::optional<WebCore::ApplicationManifest> &manifest, CallbackBase::Error) { 2769 block(); 2770 }); 2771 #else // ENABLE(APPLICATION_MANIFEST) 2772 UNUSED_PARAM(page); 2773 block(); 2774 #endif // not ENABLE(APPLICATION_MANIFEST) 2775 } 2776 #endif -
trunk/Source/WebKit/UIProcess/API/C/WKPagePrivate.h
r222309 r225598 179 179 WK_EXPORT WKProcessID WKPageGetProcessIdentifier(WKPageRef page); 180 180 181 #ifdef __BLOCKS__ 182 typedef void (^WKPageGetApplicationManifestBlock)(void); 183 WK_EXPORT void WKPageGetApplicationManifest_b(WKPageRef page, WKPageGetApplicationManifestBlock block); 184 #endif 185 181 186 #ifdef __cplusplus 182 187 } -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
r225449 r225598 117 117 #import <wtf/spi/darwin/dyldSPI.h> 118 118 #import <wtf/text/TextStream.h> 119 120 #if ENABLE(APPLICATION_MANIFEST) 121 #import "_WKApplicationManifestInternal.h" 122 #endif 119 123 120 124 #if ENABLE(DATA_DETECTION) … … 4345 4349 } 4346 4350 4351 - (void)_getApplicationManifestWithCompletionHandler:(void (^)(_WKApplicationManifest *))completionHandler 4352 { 4353 #if ENABLE(APPLICATION_MANIFEST) 4354 _page->getApplicationManifest([completionHandler = makeBlockPtr(completionHandler)](const std::optional<WebCore::ApplicationManifest>& manifest, WebKit::CallbackBase::Error error) { 4355 UNUSED(error); 4356 if (completionHandler) { 4357 if (manifest) { 4358 auto apiManifest = API::ApplicationManifest::create(*manifest); 4359 completionHandler(wrapper(apiManifest)); 4360 } else 4361 completionHandler(nil); 4362 } 4363 }); 4364 #else 4365 if (completionHandler) 4366 completionHandler(nil); 4367 #endif 4368 } 4369 4347 4370 - (_WKPaginationMode)_paginationMode 4348 4371 { -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
r224396 r225598 97 97 98 98 @class WKBrowsingContextHandle; 99 @class _WKApplicationManifest; 99 100 @class _WKFrameHandle; 100 101 @class _WKHitTestResult; … … 307 308 - (void)_getWebArchiveDataWithCompletionHandler:(void (^)(NSData *, NSError *))completionHandler; 308 309 - (void)_getContentsAsStringWithCompletionHandler:(void (^)(NSString *, NSError *))completionHandler WK_API_AVAILABLE(macosx(10.13), ios(11.0)); 310 311 - (void)_getApplicationManifestWithCompletionHandler:(void (^)(_WKApplicationManifest *))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 309 312 310 313 @property (nonatomic, setter=_setPaginationMode:) _WKPaginationMode _paginationMode; -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.h
r225597 r225598 26 26 #pragma once 27 27 28 #i f ENABLE(APPLICATION_MANIFEST)28 #import <WebKit/WKFoundation.h> 29 29 30 #i nclude "URL.h"30 #if WK_API_ENABLED 31 31 32 namespace WebCore { 32 #import <Foundation/Foundation.h> 33 33 34 struct ApplicationManifest { 35 String name; 36 String shortName; 37 String description; 38 URL scope; 39 URL startURL; 40 }; 34 NS_ASSUME_NONNULL_BEGIN 41 35 42 } // namespace WebCore 36 WK_CLASS_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)) 37 @interface _WKApplicationManifest : NSObject <NSCoding> 43 38 44 #endif // ENABLE(APPLICATION_MANIFEST) 39 @property (nonatomic, readonly, nullable, copy) NSString *name; 40 @property (nonatomic, readonly, nullable, copy) NSString *shortName; 41 @property (nonatomic, readonly, nullable, copy) NSString *applicationDescription; 42 @property (nonatomic, readonly, nullable, copy) NSURL *scope; 43 @property (nonatomic, readonly, copy) NSURL *startURL; 45 44 45 + (_WKApplicationManifest *)applicationManifestFromJSON:(NSString *)json manifestURL:(NSURL *)manifestURL documentURL:(nullable NSURL *)documentURL; 46 47 @end 48 49 NS_ASSUME_NONNULL_END 50 51 #endif // WK_API_ENABLED -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifestInternal.h
r225597 r225598 26 26 #pragma once 27 27 28 #i f ENABLE(APPLICATION_MANIFEST)28 #import <WebKit/WKFoundation.h> 29 29 30 #include "URL.h" 30 #if WK_API_ENABLED 31 32 #import "APIApplicationManifest.h" 33 #import "_WKApplicationManifest.h" 34 #import <WebCore/ApplicationManifest.h> 31 35 32 36 namespace WebCore { 37 struct ApplicationManifest; 38 } 33 39 34 struct ApplicationManifest { 35 String name; 36 String shortName; 37 String description; 38 URL scope; 39 URL startURL; 40 }; 40 #if ENABLE(APPLICATION_MANIFEST) 41 namespace API { 41 42 42 } // namespace WebCore 43 inline _WKApplicationManifest *wrapper(API::ApplicationManifest& applicationManifest) 44 { 45 ASSERT([applicationManifest.wrapper() isKindOfClass:[_WKApplicationManifest class]]); 46 return (_WKApplicationManifest *)applicationManifest.wrapper(); 47 } 48 49 } 50 51 @interface _WKApplicationManifest () <WKObject> { 52 @package 53 API::ObjectStorage<API::ApplicationManifest> _applicationManifest; 54 } 55 56 @end 43 57 44 58 #endif // ENABLE(APPLICATION_MANIFEST) 45 59 60 #endif // WK_API_ENABLED -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r225583 r225598 5314 5314 } 5315 5315 5316 #if ENABLE(APPLICATION_MANIFEST) 5317 void WebPageProxy::applicationManifestCallback(const std::optional<WebCore::ApplicationManifest>& manifestOrNull, CallbackID callbackID) 5318 { 5319 auto callback = m_callbacks.take<ApplicationManifestCallback>(callbackID); 5320 if (!callback) 5321 return; 5322 5323 callback->performCallbackWithReturnValue(manifestOrNull); 5324 } 5325 #endif 5326 5316 5327 #if PLATFORM(COCOA) 5317 5328 void WebPageProxy::machSendRightCallback(const MachSendRight& sendRight, CallbackID callbackID) … … 7232 7243 #endif // ENABLE(ATTACHMENT_ELEMENT) 7233 7244 7245 #if ENABLE(APPLICATION_MANIFEST) 7246 void WebPageProxy::getApplicationManifest(Function<void(const std::optional<WebCore::ApplicationManifest>&, CallbackBase::Error)>&& callbackFunction) 7247 { 7248 if (!isValid()) { 7249 callbackFunction(std::nullopt, CallbackBase::Error::Unknown); 7250 return; 7251 } 7252 7253 auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken()); 7254 m_loadDependentStringCallbackIDs.add(callbackID); 7255 m_process->send(Messages::WebPage::GetApplicationManifest(callbackID), m_pageID); 7256 } 7257 #endif 7258 7234 7259 } // namespace WebKit -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r225583 r225598 1 1 /* 2 * Copyright (C) 2010-201 6Apple Inc. All rights reserved.2 * Copyright (C) 2010-2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 159 159 class ValidationBubble; 160 160 161 struct ApplicationManifest; 161 162 struct DictionaryPopupInfo; 162 163 struct ExceptionDetails; … … 266 267 typedef GenericCallback<const String&, bool, int32_t> ValidateCommandCallback; 267 268 typedef GenericCallback<const WebCore::IntRect&, const EditingRange&> RectForCharacterRangeCallback; 269 270 #if ENABLE(APPLICATION_MANIFEST) 271 typedef GenericCallback<const std::optional<WebCore::ApplicationManifest>&> ApplicationManifestCallback; 272 #endif 268 273 269 274 #if PLATFORM(MAC) … … 1245 1250 #endif 1246 1251 1252 #if ENABLE(APPLICATION_MANIFEST) 1253 void getApplicationManifest(Function<void(const std::optional<WebCore::ApplicationManifest>&, CallbackBase::Error)>&&); 1254 #endif 1255 1247 1256 private: 1248 1257 WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, Ref<API::PageConfiguration>&&); … … 1505 1514 void unsignedCallback(uint64_t, CallbackID); 1506 1515 void editingRangeCallback(const EditingRange&, CallbackID); 1516 #if ENABLE(APPLICATION_MANIFEST) 1517 void applicationManifestCallback(const std::optional<WebCore::ApplicationManifest>&, CallbackID); 1518 #endif 1507 1519 #if PLATFORM(COCOA) 1508 1520 void machSendRightCallback(const WebCore::MachSendRight&, CallbackID); -
trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in
r225583 r225598 168 168 UnsignedCallback(uint64_t result, WebKit::CallbackID callbackID) 169 169 RectForCharacterRangeCallback(WebCore::IntRect rect, struct WebKit::EditingRange actualRange, WebKit::CallbackID callbackID) 170 #if ENABLE(APPLICATION_MANIFEST) 171 ApplicationManifestCallback(std::optional<WebCore::ApplicationManifest> manifest, WebKit::CallbackID callbackID) 172 #endif 170 173 #if PLATFORM(MAC) 171 174 AttributedStringForCharacterRangeCallback(struct WebKit::AttributedString string, struct WebKit::EditingRange actualRange, WebKit::CallbackID callbackID) -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r225438 r225598 1229 1229 5CFECB041E1ED1CC00F88504 /* LegacyCustomProtocolManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CFECB031E1ED1C800F88504 /* LegacyCustomProtocolManager.cpp */; }; 1230 1230 617A52D81F43A9DA00DCDC0A /* ServiceWorkerClientFetchMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 617A52D71F43A9B600DCDC0A /* ServiceWorkerClientFetchMessageReceiver.cpp */; }; 1231 63108F961F96719C00A0DB84 /* _WKApplicationManifest.h in Headers */ = {isa = PBXBuildFile; fileRef = 63108F941F96719C00A0DB84 /* _WKApplicationManifest.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1232 63108F971F96719C00A0DB84 /* _WKApplicationManifest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 63108F951F96719C00A0DB84 /* _WKApplicationManifest.mm */; }; 1233 63108F991F9671F700A0DB84 /* _WKApplicationManifestInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 63108F981F9671F700A0DB84 /* _WKApplicationManifestInternal.h */; }; 1234 634842511FB26E7100946E3C /* APIApplicationManifest.h in Headers */ = {isa = PBXBuildFile; fileRef = 6348424F1FB26E7100946E3C /* APIApplicationManifest.h */; }; 1231 1235 636353A51E9858DF0009F8AF /* _WKGeolocationCoreLocationProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 63FABE191E970D65003011D5 /* _WKGeolocationCoreLocationProvider.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1232 1236 63C32C251E9810D900699BD0 /* _WKGeolocationPosition.mm in Sources */ = {isa = PBXBuildFile; fileRef = 63C32C231E9810D900699BD0 /* _WKGeolocationPosition.mm */; }; … … 3619 3623 5DAD73F1116FF90C00EE5396 /* BaseTarget.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = BaseTarget.xcconfig; sourceTree = "<group>"; }; 3620 3624 617A52D71F43A9B600DCDC0A /* ServiceWorkerClientFetchMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerClientFetchMessageReceiver.cpp; sourceTree = "<group>"; }; 3625 63108F941F96719C00A0DB84 /* _WKApplicationManifest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _WKApplicationManifest.h; sourceTree = "<group>"; }; 3626 63108F951F96719C00A0DB84 /* _WKApplicationManifest.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKApplicationManifest.mm; sourceTree = "<group>"; }; 3627 63108F981F9671F700A0DB84 /* _WKApplicationManifestInternal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _WKApplicationManifestInternal.h; sourceTree = "<group>"; }; 3628 6348424F1FB26E7100946E3C /* APIApplicationManifest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = APIApplicationManifest.h; sourceTree = "<group>"; }; 3621 3629 63C32C231E9810D900699BD0 /* _WKGeolocationPosition.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKGeolocationPosition.mm; sourceTree = "<group>"; }; 3622 3630 63C32C241E9810D900699BD0 /* _WKGeolocationPosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKGeolocationPosition.h; sourceTree = "<group>"; }; … … 5796 5804 37A5E01118BBF937000A081E /* _WKActivatedElementInfo.mm */, 5797 5805 379A873518BBFA4300588AF2 /* _WKActivatedElementInfoInternal.h */, 5806 63108F941F96719C00A0DB84 /* _WKApplicationManifest.h */, 5807 63108F951F96719C00A0DB84 /* _WKApplicationManifest.mm */, 5808 63108F981F9671F700A0DB84 /* _WKApplicationManifestInternal.h */, 5798 5809 F44291911FA59107002CC93E /* _WKAttachment.h */, 5799 5810 F44291931FA59311002CC93E /* _WKAttachment.mm */, … … 7196 7207 BC8A501311765F4500757573 /* cpp */, 7197 7208 BC111B47112F616900337BAB /* mac */, 7209 6348424F1FB26E7100946E3C /* APIApplicationManifest.h */, 7198 7210 2E5C770D1FA7D429005932C3 /* APIAttachment.cpp */, 7199 7211 2E5C770C1FA7D429005932C3 /* APIAttachment.h */, … … 8463 8475 37A5E01418BBF93F000A081E /* _WKActivatedElementInfo.h in Headers */, 8464 8476 379A873618BBFA4300588AF2 /* _WKActivatedElementInfoInternal.h in Headers */, 8477 63108F961F96719C00A0DB84 /* _WKApplicationManifest.h in Headers */, 8478 63108F991F9671F700A0DB84 /* _WKApplicationManifestInternal.h in Headers */, 8465 8479 F44291921FA591C9002CC93E /* _WKAttachment.h in Headers */, 8466 8480 F44291961FA5942A002CC93E /* _WKAttachmentInternal.h in Headers */, … … 8538 8552 A182D5B51BE6BD250087A7CC /* AccessibilityIOS.h in Headers */, 8539 8553 A7D792D81767CCA300881CBE /* ActivityAssertion.h in Headers */, 8554 634842511FB26E7100946E3C /* APIApplicationManifest.h in Headers */, 8540 8555 BC64697011DBE603006455B0 /* APIArray.h in Headers */, 8541 8556 2E5C770E1FA7D429005932C3 /* APIAttachment.h in Headers */, … … 10111 10126 files = ( 10112 10127 37A5E01318BBF937000A081E /* _WKActivatedElementInfo.mm in Sources */, 10128 63108F971F96719C00A0DB84 /* _WKApplicationManifest.mm in Sources */, 10113 10129 F44291941FA59311002CC93E /* _WKAttachment.mm in Sources */, 10114 10130 990D28B21C65209400986977 /* _WKAutomationSession.mm in Sources */, -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
r225292 r225598 1841 1841 } 1842 1842 1843 #if ENABLE(APPLICATION_MANIFEST) 1844 void WebFrameLoaderClient::finishedLoadingApplicationManifest(uint64_t callbackIdentifier, const std::optional<WebCore::ApplicationManifest>& manifest) 1845 { 1846 WebPage* webPage = m_frame->page(); 1847 if (!webPage) 1848 return; 1849 1850 webPage->didFinishLoadingApplicationManifest(callbackIdentifier, manifest); 1851 } 1852 #endif // ENABLE(APPLICATION_MANIFEST) 1853 1843 1854 } // namespace WebKit -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
r224237 r225598 263 263 void finishedLoadingIcon(uint64_t callbackIdentifier, WebCore::SharedBuffer*) final; 264 264 265 #if ENABLE(APPLICATION_MANIFEST) 266 void finishedLoadingApplicationManifest(uint64_t, const std::optional<WebCore::ApplicationManifest>&) final; 267 #endif 268 265 269 WebFrame* m_frame; 266 270 RefPtr<PluginView> m_pluginView; -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r225583 r225598 5899 5899 #endif // ENABLE(ATTACHMENT_ELEMENT) 5900 5900 5901 #if ENABLE(APPLICATION_MANIFEST) 5902 void WebPage::getApplicationManifest(CallbackID callbackID) 5903 { 5904 ASSERT(callbackID.isValid()); 5905 Document* mainFrameDocument = m_mainFrame->coreFrame()->document(); 5906 DocumentLoader* loader = mainFrameDocument ? mainFrameDocument->loader() : nullptr; 5907 5908 if (!loader) { 5909 send(Messages::WebPageProxy::ApplicationManifestCallback(std::nullopt, callbackID)); 5910 return; 5911 } 5912 5913 auto coreCallbackID = loader->loadApplicationManifest(); 5914 if (!coreCallbackID) { 5915 send(Messages::WebPageProxy::ApplicationManifestCallback(std::nullopt, callbackID)); 5916 return; 5917 } 5918 5919 m_applicationManifestFetchCallbackMap.add(coreCallbackID, callbackID.toInteger()); 5920 } 5921 5922 void WebPage::didFinishLoadingApplicationManifest(uint64_t coreCallbackID, const std::optional<WebCore::ApplicationManifest>& manifest) 5923 { 5924 auto callbackID = CallbackID::fromInteger(m_applicationManifestFetchCallbackMap.take(coreCallbackID)); 5925 send(Messages::WebPageProxy::ApplicationManifestCallback(manifest, callbackID)); 5926 } 5927 #endif // ENABLE(APPLICATION_MANIFEST) 5928 5901 5929 } // namespace WebKit -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r225583 r225598 88 88 #endif 89 89 90 #if ENABLE(APPLICATION_MANIFEST) 91 #include <WebCore/ApplicationManifest.h> 92 #endif 93 90 94 #if ENABLE(IOS_TOUCH_EVENTS) 91 95 #include <WebKitAdditions/PlatformTouchEventIOS.h> … … 1032 1036 #endif 1033 1037 1038 #if ENABLE(APPLICATION_MANIFEST) 1039 void getApplicationManifest(CallbackID); 1040 void didFinishLoadingApplicationManifest(uint64_t, const std::optional<WebCore::ApplicationManifest>&); 1041 #endif 1042 1034 1043 private: 1035 1044 WebPage(uint64_t pageID, WebPageCreationParameters&&); … … 1646 1655 1647 1656 HashMap<uint64_t, WTF::Function<void (bool granted)>> m_storageAccessResponseCallbackMap; 1657 1658 #if ENABLE(APPLICATION_MANIFEST) 1659 HashMap<uint64_t, uint64_t> m_applicationManifestFetchCallbackMap; 1660 #endif 1648 1661 }; 1649 1662 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in
r225422 r225598 492 492 SetAttachmentDataAndContentType(String identifier, IPC::DataReference data, std::optional<String> newContentType, std::optional<String> newFilename, WebKit::CallbackID callbackID) 493 493 #endif 494 495 #if ENABLE(APPLICATION_MANIFEST) 496 GetApplicationManifest(WebKit::CallbackID callbackID) 497 #endif 494 498 } -
trunk/Tools/ChangeLog
r225563 r225598 1 2017-12-06 David Quesada <david_quesada@apple.com> 2 3 [Web App Manifest] Add SPI for fetching the manifest 4 https://bugs.webkit.org/show_bug.cgi?id=180294 5 rdar://problem/34747968 6 7 Reviewed by Geoffrey Garen. 8 9 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 10 * TestWebKitAPI/Tests/WebKitCocoa/ApplicationManifest.mm: Added. 11 Added two API tests for _WKApplicationManifest: 12 - Testing _WKApplicationManifest's conformance to NSCoding. 13 - Testing -[WKWebView _getApplicationManifestWithCompletionHandler:], verifying the 14 values of the resulting _WKApplicationManifest. 15 (TestWebKitAPI::TEST): 16 17 * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: 18 Added a new testRunner method getApplicationManifestThen(), used by the LayoutTests 19 to request the document load its associated manifest. The layout tests formerly called 20 an unimplemented function getManifestThen(), but I added 'Application' to somewhat 21 differentiate this from the app cache manifest. 22 23 * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: 24 (WTR::InjectedBundle::didReceiveMessageToPage): 25 * WebKitTestRunner/InjectedBundle/TestRunner.cpp: 26 (WTR::TestRunner::getApplicationManifestThen): 27 (WTR::TestRunner::didGetApplicationManifest): 28 * WebKitTestRunner/InjectedBundle/TestRunner.h: 29 * WebKitTestRunner/TestInvocation.cpp: 30 (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): 31 1 32 2017-12-05 Stephan Szabo <stephan.szabo@sony.com> 2 33 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r225524 r225598 261 261 6356FB221EC4E0BA0044BF18 /* VisibleContentRect.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6356FB211EC4E0BA0044BF18 /* VisibleContentRect.mm */; }; 262 262 636353A71E98665D0009F8AF /* GeolocationGetCurrentPositionResult.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 636353A61E9861940009F8AF /* GeolocationGetCurrentPositionResult.html */; }; 263 63F668221F97F7F90032EE51 /* ApplicationManifest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 63F668201F97C3AA0032EE51 /* ApplicationManifest.mm */; }; 263 264 6BFD294C1D5E6C1D008EC968 /* HashCountedSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A38D7E51C752D5F004F157D /* HashCountedSet.cpp */; }; 264 265 751B05D61F8EAC410028A09E /* DatabaseTrackerTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 751B05D51F8EAC1A0028A09E /* DatabaseTrackerTest.mm */; }; … … 1404 1405 6356FB211EC4E0BA0044BF18 /* VisibleContentRect.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = VisibleContentRect.mm; sourceTree = "<group>"; }; 1405 1406 636353A61E9861940009F8AF /* GeolocationGetCurrentPositionResult.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = GeolocationGetCurrentPositionResult.html; sourceTree = "<group>"; }; 1407 63F668201F97C3AA0032EE51 /* ApplicationManifest.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ApplicationManifest.mm; sourceTree = "<group>"; }; 1406 1408 751B05D51F8EAC1A0028A09E /* DatabaseTrackerTest.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DatabaseTrackerTest.mm; sourceTree = "<group>"; }; 1407 1409 754CEC801F6722DC00D0039A /* AutoFillAvailable.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AutoFillAvailable.mm; sourceTree = "<group>"; }; … … 2003 2005 A1DF74301C41B65800A2F4D0 /* AlwaysRevalidatedURLSchemes.mm */, 2004 2006 2DE71AFD1D49C0BD00904094 /* AnimatedResize.mm */, 2007 63F668201F97C3AA0032EE51 /* ApplicationManifest.mm */, 2005 2008 754CEC801F6722DC00D0039A /* AutoFillAvailable.mm */, 2006 2009 2DD355351BD08378005DF4A7 /* AutoLayoutIntegration.mm */, … … 3257 3260 A1DF74321C41B65800A2F4D0 /* AlwaysRevalidatedURLSchemes.mm in Sources */, 3258 3261 2DE71AFE1D49C0BD00904094 /* AnimatedResize.mm in Sources */, 3262 63F668221F97F7F90032EE51 /* ApplicationManifest.mm in Sources */, 3259 3263 6354F4D11F7C3AB500D89DF3 /* ApplicationManifestParser.cpp in Sources */, 3260 3264 7CCE7EB41A411A7E00447C4C /* AttributedString.mm in Sources */, -
trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
r225006 r225598 307 307 308 308 void removeAllSessionCredentials(object callback); 309 310 void getApplicationManifestThen(object callback); 309 311 }; -
trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
r223565 r225598 299 299 } 300 300 301 if (WKStringIsEqualToUTF8CString(messageName, "DidGetApplicationManifest")) { 302 m_testRunner->didGetApplicationManifest(); 303 return; 304 } 305 301 306 WKRetainPtr<WKStringRef> errorMessageName(AdoptWK, WKStringCreateWithUTF8CString("Error")); 302 307 WKRetainPtr<WKStringRef> errorMessageBody(AdoptWK, WKStringCreateWithUTF8CString("Unknown")); -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
r225006 r225598 653 653 StatisticsDidClearThroughWebsiteDataRemovalCallbackID, 654 654 DidRemoveAllSessionCredentialsCallbackID, 655 GetApplicationManifestCallbackID, 655 656 FirstUIScriptCallbackID = 100 656 657 }; … … 1875 1876 } 1876 1877 1878 void TestRunner::getApplicationManifestThen(JSValueRef callback) 1879 { 1880 cacheTestRunnerCallback(GetApplicationManifestCallbackID, callback); 1881 1882 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("GetApplicationManifest")); 1883 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), nullptr, nullptr); 1884 } 1885 1886 void TestRunner::didGetApplicationManifest() 1887 { 1888 callTestRunnerCallback(GetApplicationManifestCallbackID); 1889 } 1890 1877 1891 } // namespace WTR -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
r225006 r225598 406 406 void removeAllSessionCredentials(JSValueRef); 407 407 void callDidRemoveAllSessionCredentialsCallback(); 408 409 void getApplicationManifestThen(JSValueRef); 410 void didGetApplicationManifest(); 408 411 409 412 private: -
trunk/Tools/WebKitTestRunner/TestInvocation.cpp
r225117 r225598 1247 1247 } 1248 1248 1249 if (WKStringIsEqualToUTF8CString(messageName, "GetApplicationManifest")) { 1250 #ifdef __BLOCKS__ 1251 WKPageGetApplicationManifest_b(TestController::singleton().mainWebView()->page(), ^{ 1252 WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("DidGetApplicationManifest")); 1253 WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), 0); 1254 }); 1255 #else 1256 // FIXME: Add API for loading the manifest on non-__BLOCKS__ ports. 1257 ASSERT_NOT_REACHED(); 1258 #endif 1259 return nullptr; 1260 } 1261 1249 1262 ASSERT_NOT_REACHED(); 1250 1263 return nullptr;
Note: See TracChangeset
for help on using the changeset viewer.