Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WebKit] Update to Xcode 9 beta 1 #2228

Merged
merged 2 commits into from
Jun 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/WKWebKit/Defs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ public enum WKErrorCode : nint {
JavaScriptExceptionOccurred,
[iOS (9,0)][Mac (10,11, onlyOn64 : true)]
JavaScriptResultTypeIsUnsupported,
[iOS (11,0)][Mac (10,13, onlyOn64 : true)]
ContentRuleListStoreCompileFailed,
[iOS (11,0)][Mac (10,13, onlyOn64 : true)]
ContentRuleListStoreLookUpFailed,
[iOS (11,0)][Mac (10,13, onlyOn64 : true)]
ContentRuleListStoreRemoveFailed,
[iOS (11,0)][Mac (10,13, onlyOn64 : true)]
ContentRuleListStoreVersionMismatch
}

#if !MONOMAC || !XAMCORE_4_0
Expand Down
168 changes: 168 additions & 0 deletions src/wkwebkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,77 @@ interface WKBackForwardList {
WKBackForwardListItem ItemAtIndex (nint index);
}

[Mac (10,13), iOS (11,0)]
[BaseType (typeof(NSObject))]
interface WKContentRuleList
{
[Export ("identifier")]
string Identifier { get; }
}

[Mac (10,13), iOS (11,0)]
[BaseType (typeof(NSObject))]
interface WKContentRuleListStore
{
[Static]
[Export ("defaultStore")]
WKContentRuleListStore DefaultStore { get; }

[Static]
[Export ("storeWithURL:")]
WKContentRuleListStore FromUrl (NSUrl url);

[Export ("compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:")]
[Async]
void CompileContentRuleList (string identifier, string encodedContentRuleList, Action<WKContentRuleList, NSError> completionHandler);

[Export ("lookUpContentRuleListForIdentifier:completionHandler:")]
[Async]
void LookUpContentRuleList (string identifier, Action<WKContentRuleList, NSError> completionHandler);

[Export ("removeContentRuleListForIdentifier:completionHandler:")]
[Async]
void RemoveContentRuleList (string identifier, Action<NSError> completionHandler);

[Export ("getAvailableContentRuleListIdentifiers:")]
[Async]
void GetAvailableContentRuleListIdentifiers (Action<string []> callback);
}

[Mac (10,13), iOS (11,0)]
[BaseType (typeof(NSObject))]
[DisableDefaultCtor]
interface WKHttpCookieStore
{
[Export ("getAllCookies:")]
[Async]
void GetAllCookies (Action<NSHttpCookie []> completionHandler);

[Export ("setCookie:completionHandler:")]
[Async]
void SetCookie (NSHttpCookie cookie, [NullAllowed] Action completionHandler);

[Export ("deleteCookie:completionHandler:")]
[Async]
void DeleteCookie (NSHttpCookie cookie, [NullAllowed] Action completionHandler);

[Export ("addObserver:")]
void AddObserver (IWKHttpCookieStoreObserver observer);

[Export ("removeObserver:")]
void RemoveObserver (IWKHttpCookieStoreObserver observer);
}

interface IWKHttpCookieStoreObserver {}

[Mac (10,13), iOS (11,0)]
[Protocol]
interface WKHttpCookieStoreObserver
{
[Export ("cookiesDidChangeInCookieStore:")]
void CookiesDidChangeInCookieStore (WKHttpCookieStore cookieStore);
}

[iOS (8,0), Mac (10,10, onlyOn64 : true)] // Not defined in 32-bit
[BaseType (typeof (NSObject))]
interface WKFrameInfo : NSCopying {
Expand Down Expand Up @@ -227,6 +298,59 @@ interface WKSecurityOrigin {
nint Port { get; }
}


[Mac (10,13), iOS (11,0)]
[BaseType (typeof(NSObject))]
interface WKSnapshotConfiguration {
[Export ("rect")]
CGRect Rect { get; set; }

[Export ("snapshotWidth")]
NSNumber SnapshotWidth { get; set; }
}

#if XAMCORE_2_0
interface IWKUrlSchemeHandler {}
[Mac (10,13), iOS (11,0)]
[Protocol]
interface WKUrlSchemeHandler
{
[Abstract]
[Export ("webView:startURLSchemeTask:")]
void StartUrlSchemeTask (WKWebView webView, IWKUrlSchemeTask urlSchemeTask);

[Abstract]
[Export ("webView:stopURLSchemeTask:")]
void StopUrlSchemeTask (WKWebView webView, IWKUrlSchemeTask urlSchemeTask);
}
#endif
interface IWKUrlSchemeTask {}

[Mac (10,13), iOS (11,0)]
[Protocol]
interface WKUrlSchemeTask
{
[Abstract]
[Export ("request", ArgumentSemantic.Copy)]
NSUrlRequest Request { get; }

[Abstract]
[Export ("didReceiveResponse:")]
void DidReceiveResponse (NSUrlResponse response);

[Abstract]
[Export ("didReceiveData:")]
void DidReceiveData (NSData data);

[Abstract]
[Export ("didFinish")]
void DidFinish ();

[Abstract]
[Export ("didFailWithError:")]
void DidFailWithError (NSError error);
}

[iOS (9,0), Mac(10,11, onlyOn64 : true)]
[BaseType (typeof(NSObject))]
interface WKWebsiteDataRecord
Expand Down Expand Up @@ -296,6 +420,10 @@ interface WKWebsiteDataStore : NSCoding {
[Export ("removeDataOfTypes:modifiedSince:completionHandler:")]
[Async]
void RemoveDataOfTypes (NSSet<NSString> websiteDataTypes, NSDate date, Action completionHandler);

[Mac (10, 13), iOS (11, 0)]
[Export ("httpCookieStore")]
WKHttpCookieStore HttpCookieStore { get; }
}

[Mac (10,10, onlyOn64 : true), iOS (8,0)]
Expand Down Expand Up @@ -355,6 +483,18 @@ interface WKUserContentController : NSCoding {

[Export ("removeScriptMessageHandlerForName:")]
void RemoveScriptMessageHandler (string name);

[Mac (10,13), iOS (11,0)]
[Export ("addContentRuleList:")]
void AddContentRuleList (WKContentRuleList contentRuleList);

[Mac (10,13), iOS (11,0)]
[Export ("removeContentRuleList:")]
void RemoveContentRuleList (WKContentRuleList contentRuleList);

[Mac (10,13), iOS (11,0)]
[Export ("removeAllContentRuleLists")]
void RemoveAllContentRuleLists ();
}

[iOS (8,0), Mac (10,10, onlyOn64 : true)] // Not defined in 32-bit
Expand Down Expand Up @@ -519,6 +659,23 @@ interface WKWebView {
[iOS (10,0)][Mac (10,12, onlyOn64 : true)]
[NullAllowed, Export ("serverTrust")]
SecTrust ServerTrust { get; }

#if !MONOMAC
[iOS (11,0)]
[Async]
[Export ("takeSnapshotWithConfiguration:completionHandler:")]
void TakeSnapshot ([NullAllowed] WKSnapshotConfiguration snapshotConfiguration, Action<UIImage, NSError> completionHandler);
#else
[Mac (10,13)]
[Export ("takeSnapshotWithConfiguration:completionHandler:")]
[Async]
void TakeSnapshot ([NullAllowed] WKSnapshotConfiguration snapshotConfiguration, Action<NSImage, NSError> completionHandler);
#endif
[Mac (10,13), iOS (11,0)]
[Static]
[Export ("handlesURLScheme:")]
bool HandlesUrlScheme (string urlScheme);

}

delegate void WKJavascriptEvaluationResult (NSObject result, NSError error);
Expand Down Expand Up @@ -586,6 +743,17 @@ interface WKWebViewConfiguration : NSCopying, NSCoding {
[NoMac]
[Export ("ignoresViewportScaleLimits")]
bool IgnoresViewportScaleLimits { get; set; }

#if XAMCORE_2_0
[Mac (10,13), iOS (11,0)]
[Export ("setURLSchemeHandler:forURLScheme:")]
void SetUrlSchemeHandler ([NullAllowed] IWKUrlSchemeHandler urlSchemeHandler, string urlScheme);

[Mac (10,13), iOS (11,0)]
[Export ("urlSchemeHandlerForURLScheme:")]
[return: NullAllowed]
IWKUrlSchemeHandler GetUrlSchemeHandler (string urlScheme);
#endif
}

[iOS (8,0), Mac (10,10, onlyOn64 : true)] // Not defined in 32-bit
Expand Down