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

Problem with webView_runJavaScriptConfirmPanelWithMessage_initiatedByFrame_completionHandler metadata #512

Closed
r0x0r opened this issue Nov 14, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@r0x0r
Copy link

r0x0r commented Nov 14, 2022

Metadata for webView_runJavaScriptConfirmPanelWithMessage_initiatedByFrame_completionHandler seems to be incorrect. Calling completion handler with a boolean value results in the following exception

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/xxxx/testvenv/lib/python3.9/site-packages/objc/_convenience.py", line 158, in __call__
    return _block_call(self, self.__block_signature__, args, kwds)
TypeError: Need 1 arguments, got 1

Example code:

class BrowserDelegate(AppKit.NSObject):
        def webView_runJavaScriptConfirmPanelWithMessage_initiatedByFrame_completionHandler_(self, webview, message, frame, handler):
            handler(Foundation.YES)

Metadata description for this selector (from WebKit/_metadata.py) is

r(
        b"NSObject",
        b"webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:",
        {
            "required": False,
            "retval": {"type": b"v"},
            "arguments": {
                2: {"type": b"@"},
                3: {"type": b"@"},
                4: {"type": b"@"},
                5: {
                    "callable": {
                        "retval": {"type": b"v"},
                        "arguments": {0: {"type": b"^v"}},
                    },
                    "type": "@?",
                },
            },
        },
    )

If I read this code correctly it assumes that the argument to the handler is void, while it should be boolean.

Platform information

  • Python version : 3.9
  • How was python installed (python.org, anaconda, homebrew, ...): pip / virtualenv
  • macOS version: 12.6
  • pyobjc version: 9.0
@r0x0r r0x0r added the bug Something isn't working label Nov 14, 2022
@ronaldoussoren
Copy link
Owner

Thanks for the report. I've fixed the issue and the repository. Current plan is to push out a bug fix release during the weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants