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

[iOS] - MessageHandlers don't exist immediately after deleting them #41653

Closed
3 of 5 tasks
Brandon-T opened this issue Oct 15, 2024 · 0 comments · Fixed by brave/brave-core#26014
Closed
3 of 5 tasks
Assignees
Labels
OS/iOS Fixes related to iOS browser functionality QA/Yes release-notes/exclude

Comments

@Brandon-T
Copy link

Description

  • For security reasons, we execute delete window.webkit.messageHandlers and then immediately WebKit would restore the original, so we could use it securely.
  • On iOS 18, it seems it does NOT restore immediately anymore, but rather after some arbitrary time-frame.

Chrome does the same thing:

 function sendWebKitMessage(handlerName, message) {
      try {
          // A web page can override `window.webkit` with any value. Deleting the
          // object ensures that original and working implementation of
          // window.webkit is restored.
          var oldWebkit = window.webkit;
          delete window['webkit'];
          window.webkit.messageHandlers[handlerName].postMessage(message);
          window.webkit = oldWebkit;
      }
      catch (err) {
          // TODO(crbug.com/40269960): Report this fatal error
      }
  }

and it's also broken.

Steps to reproduce

  1. Visit https://www.atgtickets.com/shows/cabaret/kit-kat-club-at-the-playhouse/calendar/
  2. Page won't load

Actual result

  • Page doesn't load at all

Expected result

  • Page should load

Reproduces how often

Easily reproduced

Brave version

  • All

Device/iOS version

  • All

Affected browser versions

  • latest AppStore
  • latest TestFlight
  • previous TestFlight

Reproducibility

  • with Brave Shields disabled
  • in the latest version of mobile Safari

Miscellaneous information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS/iOS Fixes related to iOS browser functionality QA/Yes release-notes/exclude
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants