Closed
Bug 1346240
Opened 9 years ago
Closed 9 years ago
WebExtensions — Context menu of browser_action: sometimes few first items are inactive
Categories
(WebExtensions :: Untriaged, defect)
Tracking
(Not tracked)
RESOLVED
INVALID
People
(Reporter: vitaliydev, Assigned: zombie)
Details
User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0
Build ID: 20170307064827
Steps to reproduce:
Pressed to toolbar button by right mouse button.
Actual results:
2 first items are inactive by some reason.
Expected results:
It should be always active.
| Reporter | ||
Comment 1•9 years ago
|
||
Here's screenshot of inactive items in context menu: https://files.tesuto.ru/WebExtensions%20-%20BA%20Context%20Menu%20Bug%202.png
I don't know when it is happening but when I click second time they become always active.
| Reporter | ||
Updated•9 years ago
|
Summary: Context menu of browser_action: sometimes few first items are inactive → WebExtensions — Context menu of browser_action: sometimes few first items are inactive
Component: Untriaged → WebExtensions: Untriaged
Product: Firefox → Toolkit
Comment 2•9 years ago
|
||
Can you please attach the extension that's causing this?
| Reporter | ||
Comment 3•9 years ago
|
||
It is my own extension but I didn't publushed it yet. I attach it after publishing.
Here is code that adding toolbar buttons:
let curMenuId = undefined;
browser.contextMenus.create({
title: tree[tree.length - 1],
contexts: ['browser_action'],
parentId: curMenuId,
onclick: info => {
if (search) {
zbutton.openSearchOrHome(info.pageUrl, search, home || search, true, false);
}else{
zbutton.openHome(home);
}
},
});
| Reporter | ||
Comment 4•9 years ago
|
||
Also full code of function that adding BA context menu items:
//Init CM: BA_list
this.init_CM_BA_list = function() {
let a = config.CM_BA_list.replace(/\r\n?/g, '\n').replace(/\n\n\n+/g, '\n\n').trim().split('\n\n');
let mainMenuChilds = Object.create(null), submenuCounter = 0;
//Parse and add items
for (let i = 0; i < a.length; i++) {
if (a[i].match(/^\-+$/)) {
browser.contextMenus.create({
type: 'separator',
contexts: ['browser_action'],
});
continue;
}
let b = a[i].split('\n');
if (b.length < 2) continue;
//Parse home and search
let home = null, search = null;
for (let j = 1; j < b.length; j++) {
if (b[j].includes('$')) {
if (!search) search = b[j];
}else{
if (!home) home = b[j];
}
}
//Parse tree (0..length-2 - menus, length-1 - item; here we go to length-2, i.e. we go to the last menu)
let tree = b[0].split('>>>');
let curMenuId = undefined, curMenuChilds = mainMenuChilds;
for (let j = 0; j < tree.length - 1; j++) {
let parentMenuId = curMenuId;
let parentMenuChilds = curMenuChilds;
let curMenuTitle = tree[j].trim();
let curMenuObj = parentMenuChilds[curMenuTitle];
if (!curMenuObj) {
curMenuObj = {
id: 'BA_submenu' + ++submenuCounter,
childs: Object.create(null),
};
browser.contextMenus.create({
id: curMenuObj.id,
title: curMenuTitle,
contexts: ['browser_action'],
parentId: parentMenuId,
});
parentMenuChilds[curMenuTitle] = curMenuObj;
}
curMenuId = curMenuObj.id;
curMenuChilds = curMenuObj.childs;
}
//Add item
browser.contextMenus.create({
title: tree[tree.length - 1],
contexts: ['browser_action'],
parentId: curMenuId,
onclick: info => {
if (search) {
zbutton.openSearchOrHome(info.pageUrl, search, home || search, true, false);
}else{
zbutton.openHome(home);
}
},
});
}
};
| Reporter | ||
Comment 5•9 years ago
|
||
In 90-95% cases all items are active but sometimes few items are inactive (I guess it may happen even if they was active before). After second click they become active.
| Assignee | ||
Comment 6•9 years ago
|
||
I was unable to reproduce this on my own.
Can you please attach the full source (a zip file) of a working extension that exhibits the problem? (preferably, a minimal test).
Flags: needinfo?(vitaliydev)
| Assignee | ||
Updated•9 years ago
|
Assignee: nobody → tomica
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
| Assignee | ||
Updated•9 years ago
|
Status: ASSIGNED → UNCONFIRMED
Ever confirmed: false
| Reporter | ||
Comment 7•9 years ago
|
||
Problem is that I don't know how to reproduce too. Bug is occuring few times per day. I don't know when. Code is not changing. I can attach full source in few days but you can't reproduce the bug immediatly after installing extension.
| Reporter | ||
Comment 8•9 years ago
|
||
I'm sorry, the bug was in Classic Theme Restorer extension.
| Reporter | ||
Updated•9 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
| Assignee | ||
Updated•9 years ago
|
Flags: needinfo?(vitaliydev)
Updated•7 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•