X Tutup
Skip to content

Commit 82ea8ea

Browse files
fix: reject task append to JumpList when description exceeds 260 characters (electron#28485)
* fix: reject task when description exceeds 260 characters * Switched out wcslen() for size() [linear -> constant time] * Included comment describing the need for the additional check * Added information about character limit to documentation * Added newline character to end of jump-list-category.md
1 parent c280d77 commit 82ea8ea

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

docs/api/app.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,10 @@ re-add a removed item to a custom category earlier than that will result in the
871871
entire custom category being omitted from the Jump List. The list of removed
872872
items can be obtained using `app.getJumpListSettings()`.
873873

874+
**Note:** The maximum length of a Jump List item's `description` property is
875+
260 characters. Beyond this limit, the item will not be added to the Jump
876+
List, nor will it be displayed.
877+
874878
Here's a very simple example of creating a custom Jump List:
875879

876880
```javascript

docs/api/structures/jump-list-category.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@
1919
property set then its `type` is assumed to be `tasks`. If the `name` property
2020
is set but the `type` property is omitted then the `type` is assumed to be
2121
`custom`.
22+
23+
**Note:** The maximum length of a Jump List item's `description` property is
24+
260 characters. Beyond this limit, the item will not be added to the Jump
25+
List, nor will it be displayed.

docs/api/structures/jump-list-item.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* `title` String (optional) - The text to be displayed for the item in the Jump List.
1818
Should only be set if `type` is `task`.
1919
* `description` String (optional) - Description of the task (displayed in a tooltip).
20-
Should only be set if `type` is `task`.
20+
Should only be set if `type` is `task`. Maximum length 260 characters.
2121
* `iconPath` String (optional) - The absolute path to an icon to be displayed in a
2222
Jump List, which can be an arbitrary resource file that contains an icon
2323
(e.g. `.ico`, `.exe`, `.dll`). You can usually specify `process.execPath` to

shell/browser/ui/win/jump_list.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ bool AppendTask(const JumpListItem& item, IObjectCollection* collection) {
2828
FAILED(link->SetDescription(item.description.c_str())))
2929
return false;
3030

31+
// SetDescription limits the size of the parameter to INFOTIPSIZE (1024),
32+
// which suggests rejection when exceeding that limit, but experimentation
33+
// has shown that descriptions longer than 260 characters cause a silent
34+
// failure, despite SetDescription returning the success code S_OK.
35+
if (item.description.size() > 260)
36+
return false;
37+
3138
if (!item.icon_path.empty() &&
3239
FAILED(link->SetIconLocation(item.icon_path.value().c_str(),
3340
item.icon_index)))

0 commit comments

Comments
 (0)
X Tutup