Title: [286497] trunk/Source/WebKit
- Revision
- 286497
- Author
- [email protected]
- Date
- 2021-12-03 09:36:07 -0800 (Fri, 03 Dec 2021)
Log Message
[Cocoa] Web Inspector: fix completion handler type signature for _WKInspectorExtension methods
https://bugs.webkit.org/show_bug.cgi?id=233792
<rdar://problem/85995314>
Reviewed by Devin Rousso.
* UIProcess/API/Cocoa/_WKInspectorExtension.h:
* UIProcess/API/Cocoa/_WKInspectorExtension.mm:
(-[_WKInspectorExtension evaluateScript:frameURL:contextSecurityOrigin:useContentScriptContext:completionHandler:]):
(-[_WKInspectorExtension evaluateScript:inTabWithIdentifier:completionHandler:]):
Replace the completionHandler's NSDictionary argument type with `id`.
A dictionary is not necessarily returned here because the implementation deserializes a SerializedScriptValue.
This could be a string, number, array, dictionary, or other serializable values.
While the frontend does return a dictionary payload, this is unpacked on the WebProcess-side
before being sent back out via the _WKInspectorExtension APi.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (286496 => 286497)
--- trunk/Source/WebKit/ChangeLog 2021-12-03 17:35:24 UTC (rev 286496)
+++ trunk/Source/WebKit/ChangeLog 2021-12-03 17:36:07 UTC (rev 286497)
@@ -1,3 +1,23 @@
+2021-12-03 BJ Burg <[email protected]>
+
+ [Cocoa] Web Inspector: fix completion handler type signature for _WKInspectorExtension methods
+ https://bugs.webkit.org/show_bug.cgi?id=233792
+ <rdar://problem/85995314>
+
+ Reviewed by Devin Rousso.
+
+ * UIProcess/API/Cocoa/_WKInspectorExtension.h:
+ * UIProcess/API/Cocoa/_WKInspectorExtension.mm:
+ (-[_WKInspectorExtension evaluateScript:frameURL:contextSecurityOrigin:useContentScriptContext:completionHandler:]):
+ (-[_WKInspectorExtension evaluateScript:inTabWithIdentifier:completionHandler:]):
+ Replace the completionHandler's NSDictionary argument type with `id`.
+
+ A dictionary is not necessarily returned here because the implementation deserializes a SerializedScriptValue.
+ This could be a string, number, array, dictionary, or other serializable values.
+
+ While the frontend does return a dictionary payload, this is unpacked on the WebProcess-side
+ before being sent back out via the _WKInspectorExtension APi.
+
2021-12-03 Alex Christensen <[email protected]>
Add room for more bytecode in WKContentRuleList file format
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorExtension.h (286496 => 286497)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorExtension.h 2021-12-03 17:35:24 UTC (rev 286496)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorExtension.h 2021-12-03 17:36:07 UTC (rev 286497)
@@ -63,7 +63,7 @@
* scriptSource is treated as a top-level evaluation. By default, the script is evaluated in the inspected page's script context.
* The inspected page ultimately controls its execution context and the result of this evaluation. Thus, the result shall be treated as untrusted input.
*/
-- (void)evaluateScript:(NSString *)scriptSource frameURL:(NSURL *)frameURL contextSecurityOrigin:(NSURL *)contextSecurityOrigin useContentScriptContext:(BOOL)useContentScriptContext completionHandler:(void(^)(NSError * _Nullable, NSDictionary * _Nullable result))completionHandler;
+- (void)evaluateScript:(NSString *)scriptSource frameURL:(NSURL *)frameURL contextSecurityOrigin:(NSURL *)contextSecurityOrigin useContentScriptContext:(BOOL)useContentScriptContext completionHandler:(void(^)(NSError * _Nullable, id result))completionHandler;
/**
* @abstract Evaluates _javascript_ in the context of a Web Inspector tab created by this _WKInspectorExtension.
@@ -73,7 +73,7 @@
* @discussion The completionHandler is passed an NSJSONSerialization-compatible NSObject representing the evaluation result, or an error.
* scriptSource is treated as a top-level evaluation.
*/
-- (void)evaluateScript:(NSString *)scriptSource inTabWithIdentifier:(NSString *)tabIdentifier completionHandler:(void(^)(NSError * _Nullable, NSDictionary * _Nullable result))completionHandler;
+- (void)evaluateScript:(NSString *)scriptSource inTabWithIdentifier:(NSString *)tabIdentifier completionHandler:(void(^)(NSError * _Nullable, id result))completionHandler;
/**
* @abstract Reloads the inspected page on behalf of the _WKInspectorExtension.
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorExtension.mm (286496 => 286497)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorExtension.mm 2021-12-03 17:35:24 UTC (rev 286496)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKInspectorExtension.mm 2021-12-03 17:36:07 UTC (rev 286497)
@@ -82,7 +82,7 @@
});
}
-- (void)evaluateScript:(NSString *)scriptSource frameURL:(NSURL *)frameURL contextSecurityOrigin:(NSURL *)contextSecurityOrigin useContentScriptContext:(BOOL)useContentScriptContext completionHandler:(void(^)(NSError *, NSDictionary *))completionHandler
+- (void)evaluateScript:(NSString *)scriptSource frameURL:(NSURL *)frameURL contextSecurityOrigin:(NSURL *)contextSecurityOrigin useContentScriptContext:(BOOL)useContentScriptContext completionHandler:(void(^)(NSError *, id))completionHandler
{
std::optional<URL> optionalFrameURL = frameURL ? std::make_optional(URL(frameURL)) : std::nullopt;
std::optional<URL> optionalContextSecurityOrigin = contextSecurityOrigin ? std::make_optional(URL(contextSecurityOrigin)) : std::nullopt;
@@ -103,7 +103,7 @@
});
}
-- (void)evaluateScript:(NSString *)scriptSource inTabWithIdentifier:(NSString *)extensionTabIdentifier completionHandler:(void(^)(NSError *, NSDictionary *))completionHandler
+- (void)evaluateScript:(NSString *)scriptSource inTabWithIdentifier:(NSString *)extensionTabIdentifier completionHandler:(void(^)(NSError *, id))completionHandler
{
_extension->evaluateScriptInExtensionTab(extensionTabIdentifier, scriptSource, [protectedSelf = retainPtr(self), capturedBlock = makeBlockPtr(WTFMove(completionHandler))] (Inspector::ExtensionEvaluationResult&& result) mutable {
if (!result) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes