Skip to content

Show alert on web IDE start error

Cindy Halim requested to merge 460284-alert-web-ide-error into master

Issue: Uninstall perviously installed Extensions when ... (#460284 - closed)

What does this MR do and why?

As a follow up to Uninstall extensions if Extensions Marketplace ... (gitlab-web-ide!314 - merged), an alert is shown if an error occurs upon starting the Web IDE.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

  • Alert is shown upon error uninstalling previously installed extension when Extensions Marketplace is disabled and crossOriginHostEnabled flag is false:

    demo.mov

How to set up and validate locally

Setup:

  • gitlab-web-ide:
    • Pull latest changes from main and run yarn install

    • To simulate the error condition, copy the following code block and run pbpaste | git apply on a terminal in the gitlab-web-ide repo directory:

      Patch

      diff --git a/packages/web-ide/src/cleanExtensions.ts b/packages/web-ide/src/cleanExtensions.ts
      index 0a0a198..7ebbafc 100644
      --- a/packages/web-ide/src/cleanExtensions.ts
      +++ b/packages/web-ide/src/cleanExtensions.ts
      @@ -52,8 +52,8 @@ const removeExtensions = async () => {
           }
       
           const request = db
      -      .transaction(VSCODE_USER_DATA_STORE, 'readwrite')
      -      .objectStore(VSCODE_USER_DATA_STORE)
      +      .transaction('WRONG_STORE_NAME', 'readwrite')
      +      .objectStore('WRONG_STORE_NAME')
             .delete(VSCODE_EXTENSIONS_KEY);
       
           request.onsuccess = () => {
    • Run ./scripts/pack-web-ide-package.sh to generate a local artifact of the web IDE package.

  • gitlab repo:
    • Run yarn add <path to generated artifact> . You can retrieve the path from the output of the above script by looking for the following line:

      Package archive generated in <path_to_generated_artifact>
    • Make sure crossOriginExtensionHost flag value is false by applying the following:

      Patch

      diff --git a/app/assets/javascripts/ide/init_gitlab_web_ide.js b/app/assets/javascripts/ide/init_gitlab_web_ide.js
      index 2c50ed466bd2..fcaace4d8c61 100644
      --- a/app/assets/javascripts/ide/init_gitlab_web_ide.js
      +++ b/app/assets/javascripts/ide/init_gitlab_web_ide.js
      @@ -98,7 +98,8 @@ export const initGitlabWebIDE = async (el) => {
             },
             featureFlags: {
               settingsSync: true,
      -        crossOriginExtensionHost: getCrossOriginExtensionHostFlagValue(extensionsGallerySettings),
      +        crossOriginExtensionHost: false,
      +        // crossOriginExtensionHost: getCrossOriginExtensionHostFlagValue(extensionsGallerySettings),
             },
             editorFont,
             extensionsGallerySettings,

Steps:

  • Visit user settings > Integrations > enable Extensions Marketplace
  • Load Web IDE
  • Disable Extensions Marketplace in user settings
  • Load Web IDE
  • Should see alert
Edited by Cindy Halim

Merge request reports