Skip to content

Windows JumpList empty when a single entry has a long description #26862

Closed

Description

@bpasero

Issue Details

  • Electron Version:
    • 11.0.3
  • Operating System:
    • Windows 10
  • Last Known Working Electron version:

Expected Behavior

An invalid entry to the JumpList does not cause other entries to disappear.

Actual Behavior

A single invalid JumpList entry makes all other entries disappear.

To Reproduce

// Modules to control application life and create native browser window
const { app, BrowserWindow } = require('electron')

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow

function createWindow() {
  // Create the browser window.
  mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      nodeIntegration: true
    }
  })

  // and load the index.html of the app.
  mainWindow.loadFile('index.html')

  // Open the DevTools.
  // mainWindow.webContents.openDevTools()

  // Emitted when the window is closed.
  mainWindow.on('closed', function () {
    // Dereference the window object, usually you would store windows
    // in an array if your app supports multi windows, this is the time
    // when you should delete the corresponding element.
    mainWindow = null
  })
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow)

app.setJumpList([
  {
    type: "custom",
    name: "Recent Workspaces",
    items: [
      {
        type: "task",
        title: "Title",
        description: "Description",
        program: process.execPath
      },
      {
        type: "task",
        title: "Long Title",
        description: "DescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescription",
        program: process.execPath
      }
    ]
  }
])

// Quit when all windows are closed.
app.on('window-all-closed', function () {
  // On OS X it is common for applications and their menu bar
  // to stay active until the user quits explicitly with Cmd + Q
  if (process.platform !== 'darwin') {
    app.quit()
  }
})

app.on('activate', function () {
  // On OS X it's common to re-create a window in the app when the
  // dock icon is clicked and there are no other windows open.
  if (mainWindow === null) {
    createWindow()
  }
})

// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.

Additional Information

It looks like this happens when the description property exceeds 255 characters length?

Activity

  1. zg3d commented on Dec 11, 2020

    @zg3d

    Could I try to contribute to this issue.

  2. codebytere commented on Dec 12, 2020

    @codebytere
    Member

    hey @zg3d - sure! i'd be happy to give you some pointers. So what's happening here is that is looks like when the SetDescription method is called with a too-long parameter, it causes the IShellLink to not show up. SetJumpList is implemented here, which in turn invokes methods from this file. I'd start by digging into this line.

  3. MarcoDotIO commented on Jan 2, 2021

    @MarcoDotIO

    Hi there,

    I'm a complete beginner for developing on the Electron platform. Do you guys have any resources for getting started with solving issues with this type of platform?

  4. ankushduacodes commented on Jan 22, 2021

    @ankushduacodes

    Hi @codebytere, I would love to work on this issue if no one is.
    Please let me know if I may.

    Thank you!... 🚀

  5. rohit306-bit commented on Feb 1, 2021

    @rohit306-bit

    i also wants to try to fix it

  6. codebytere commented on Feb 1, 2021

    @codebytere
    Member

    As this is an open source project, you do not need my permission to work on available issues :)

  7. HiMyNameIsBennet commented on Mar 31, 2021

    @HiMyNameIsBennet
    Contributor

    Hello! I'm a first time contributor, and trying my hands at this issue. I see the "LOG" function being called a lot, to, probably, log errors and warnings into a file somewhere, but I couldn't find out how to access these logs/where they are saved. Could someone give me a pointer on this?

  8. erickzhao commented on Mar 31, 2021

    @erickzhao
    Member

    @SushiJackal the LOG functions are inherited from Chromium: https://chromium.googlesource.com/chromium/src/base/+/refs/heads/master/logging.h

    You can enable these log messages with the ELECTRON_ENABLE_LOGGING environment variable.

    If you're building locally and testing your custom build with Electron Fiddle, there's a checkbox in the settings to enable it.

  9. HiMyNameIsBennet commented on Apr 1, 2021

    @HiMyNameIsBennet
    Contributor

    After running some tests to determine the source of the issue, I've come to the conclusion that the SetDescription function returns S_OK, so 0, even if the description is too long to function as expected.

    Since this behaviour is part of a Windows function (as far as I can see), in my opinion the best solution would be to keep the if-statement checks intact (FAILED(link->SetDescription... and such), and, after, check the item.description.c_str() string against a predetermined maximum length (the above suggested 255?), returning false if it should exceed it, like what is done with the if-checks within AppendTask. Would this be good practice? Is there a more elegant way?

  10. erickzhao commented on Apr 1, 2021

    @erickzhao
    Member

    @SushiJackal I'm personally unfamiliar with the code, but if you have a working fix, I'd suggest submitting a PR to show your solution and getting feedback there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions