[webkit-changes] [WebKit/WebKit] 156f51: CodeGeneratorExtensions tweaks to improve generate...

Timothy Hatcher noreply at github.com
Thu Nov 17 14:10:54 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 156f516a94342550ffd68575a4f41f29ecc18d82
      https://github.com/WebKit/WebKit/commit/156f516a94342550ffd68575a4f41f29ecc18d82
  Author: Timothy Hatcher <timothy at apple.com>
  Date:   2022-11-17 (Thu, 17 Nov 2022)

  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:
  -----------
  CodeGeneratorExtensions tweaks to improve generated Web Extension code.
https://bugs.webkit.org/show_bug.cgi?id=248050

Reviewed by Brian Weinstein.

Tweaks include:
* Using the ObjC JSValue class instead of JSValueRef in argument types to avoid needing JSContextRef also.
* Properly handle the boolean IDL type which is needed for upcoming test functions.

* Source/WebKit/WebProcess/Extensions/Bindings/Cocoa/JSWebExtensionWrapperCocoa.mm:
(WebKit::WebExtensionCallbackHandler::reportError): Use toJSValueRef().
(WebKit::WebExtensionCallbackHandler::call): Use toJSValueRef().
(WebKit::toJSValueRef): Renamed from toJSValue.
* Source/WebKit/WebProcess/Extensions/Bindings/JSWebExtensionWrapper.h:
(WebKit::toJSValueRefOrJSNull): Renamed from toJSNullIfNull().
(WebKit::toJSValue): Added.
(WebKit::toJSValueRef): Renamed from toJSValue().
(WebKit::toJSError): Use toJSValueRef().
* Source/WebKit/WebProcess/Extensions/Bindings/Scripts/CodeGeneratorExtensions.pm:
(_generateImplementationFile): No need for automatic NeedsScriptContext for fucntions now that JSValue is used.
(_installAutomaticExceptions): Use JSValue's isObject property. Don't use isnan() on bool types.
(_platformType): Use JSValue instead of JSValueRef.
(_platformTypeConstructor): Use new toJSValue() helper.
(_platformTypeVariableDeclaration): Added JSValue to %objCTypes. Use false for bool initial value.
(_returnExpression): Use toJSValueRefOrJSNull() and toJSValueRef().

Canonical link: https://commits.webkit.org/256801@main




More information about the webkit-changes mailing list