Skip to content

Polyfill confirm() and possibly other similar APIs #10

@heyzec

Description

@heyzec

The frontend UI can call confirm sometimes, and when this happens within the extension WebView, it is ignored. Here's an example:

  1. Open the Source Academy Panel and the VS Code Developer Tools pane
  2. In the Webview, open any question in an assessment.
  3. Click on the "Reset" button. The "Save" button should turn orange, indicating unsaved changes.
  4. Navigate back by clicking on the Missions button (Fire icon).
    • In the standard frontend, the user is prompted on whether they want to discard the unsaved changed.
    • In the extension, nothing happens. The WebView does not navigate to the Missions page either. Instead, an error entry appears in the console:
      Ignored call to 'confirm()'. The document is sandboxed, and the 'allow-modals' keyword is not set.
      

We need to polyfill this confirm function so that it appears as a VS Code notification. Note that confirm is blocking, though most VS Code APIs are non-blocking. Also, identify other such Web APIs that the frontend may call.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions