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 1 commit
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
166 changes: 166 additions & 0 deletions src/wkwebkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,76 @@ 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 ();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general those defaults are bound as properties

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!


[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<NSString []> callback);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this be better as Action<string[]>? Or does the generator not support that (if so, maybe we should add it)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I did not catch this, thanks for the review.

}

[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 (WKHttpCookieStoreObserver observer);

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

[Mac (10,13), iOS (11,0)]
[Protocol]
[BaseType (typeof(NSObject))]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No BaseType for protocols (only Model needs one)
Normal inheritance, if needed, can be used to extend another protocol

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - I am getting rusty.

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 +297,58 @@ 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
[Mac (10,13), iOS (11,0)]
[Protocol]
[BaseType (typeof(NSObject))]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

interface WKUrlSchemeHandler
{
[Abstract]
[Export ("webView:startURLSchemeTask:")]
void StartUrlSchemeTask (WKWebView webView, WKUrlSchemeTask urlSchemeTask);

[Abstract]
[Export ("webView:stopURLSchemeTask:")]
void StopUrlSchemeTask (WKWebView webView, WKUrlSchemeTask urlSchemeTask);
}
#endif
[Mac (10,13), iOS (11,0)]
[Protocol]
[BaseType (typeof(NSObject))]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

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 +418,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 +481,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 +657,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 +741,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] WKUrlSchemeHandler urlSchemeHandler, string urlScheme);

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

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