Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 60e0f080e0bd7519786d780c6890ed2a11ea6748 https://github.com/WebKit/WebKit/commit/60e0f080e0bd7519786d780c6890ed2a11ea6748 Author: Timothy Hatcher <timo...@apple.com> Date: 2023-10-02 (Mon, 02 Oct 2023)
Changed paths: M Source/WebKit/WebProcess/Extensions/Bindings/Cocoa/JSWebExtensionWrapperCocoa.mm M Source/WebKit/WebProcess/Extensions/Bindings/JSWebExtensionWrapper.h M Source/WebKit/WebProcess/Extensions/Bindings/Scripts/CodeGeneratorExtensions.pm Log Message: ----------- Web Extensions CodeGenerator needs to handle objects better. https://webkit.org/b/262496 rdar://problem/116359645 Reviewed by Brent Fulgham. The object checks were too aggressively converting things to an NSDictionary, when only basic Objects should be converted, and everything else should be a JSValue. This is needed for the action APIs which allow ImageData objects, and was requiring the action code to manually deal with JSValue for all input. * Source/WebKit/WebProcess/Extensions/Bindings/Cocoa/JSWebExtensionWrapperCocoa.mm: (WebKit::toNSObject): Change logic for when to use JSValue by checking _isDictionary and other native types. (WebKit::toNSDictionary): Recursively use toNSDictionary() for dictionary items. (-[JSValue _isDictionary]): Added. (-[JSValue _isRegularExpression]): Do a proper type check. (-[JSValue _isThenable]): Use _isFunction for clarity. (-[JSValue _awaitThenableResolutionWithCompletionHandler:]): Use _isThenable for clarity. * Source/WebKit/WebProcess/Extensions/Bindings/JSWebExtensionWrapper.h: (WebKit::toNSArray): Added wrapper that ASSERTs containingObjectsOfClass and defaults to NSObject type. (WebKit::toJSValue): Add null check for value and ASSERT for context. (WebKit::isDictionary): Added. C version of -[JSValue _isDictionary]. * Source/WebKit/WebProcess/Extensions/Bindings/Scripts/CodeGeneratorExtensions.pm: (_generateImplementationFile): Use $defaultEarlyReturnValue when needed, this was incorrect before when $defaultReturnValue can also still return the promise result during an exception. (_javaScriptTypeCondition): Use isDictionary() and JSValueIsArray for dictionary and array checks. (_platformTypeConstructor): Support NullAllowed, which is needed for action. Use toNSArray. Canonical link: https://commits.webkit.org/268747@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes