Merge browser.contextualIdentity from 'master'
This commit is contained in:
+11
-22
@@ -1,26 +1,15 @@
|
||||
const IDENTITY_L10NID_MATCH_INDEX = 1;
|
||||
browser.contextualIdentities.query({}).then(identites=> {
|
||||
identites.forEach(identity=> {
|
||||
console.log('identity: ', identity);
|
||||
const identityRow = `
|
||||
<tr>
|
||||
<td><div class="userContext-icon" data-identity-icon="${identity.icon}" data-identity-icon-color="${identity.color}"></div></td>
|
||||
<td>${identity.name}</td>
|
||||
<td>></td>
|
||||
</tr>`;
|
||||
|
||||
browser.runtime.sendMessage('get-identities').then(reply=> {
|
||||
if (reply) {
|
||||
console.log('reply from sdk addon: ', reply);
|
||||
reply.content.identities.forEach(identity=> {
|
||||
let identityName = identity.name;
|
||||
|
||||
console.log('identityName: ', identityName);
|
||||
|
||||
if (typeof identityName === 'undefined') {
|
||||
identityName = identity.l10nID.match(/userContext(\w*)\.label/)[IDENTITY_L10NID_MATCH_INDEX];
|
||||
}
|
||||
const identityRow = `
|
||||
<tr>
|
||||
<td><div class="userContext-icon" data-identity-icon="${identity.icon}" data-identity-icon-color="${identity.color}"></div></td>
|
||||
<td>${identityName}</td>
|
||||
<td>></td>
|
||||
</tr>`;
|
||||
|
||||
document.querySelector('.identities-list').innerHTML += identityRow;
|
||||
});
|
||||
}
|
||||
document.querySelector('.identities-list').innerHTML += identityRow;
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelector('#edit-containers-link').addEventListener('click', ()=> {
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
"homepage_url": "https://testpilot.firefox.com/",
|
||||
|
||||
"permissions": [
|
||||
"experiments.contextualidentities",
|
||||
"contextualidentities"
|
||||
],
|
||||
|
||||
"browser_action": {
|
||||
|
||||
Reference in New Issue
Block a user