|
|
@@ -37,7 +37,7 @@
|
|
|
try {
|
|
|
nativeAPI.browserAction.setBadgeText(options, () => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve();
|
|
|
}
|
|
|
@@ -49,7 +49,7 @@
|
|
|
if (FEATURE_TESTS["browserAction.setBadgeText"] && FEATURE_TESTS["browserAction.setBadgeText"].callbackNotSupported) {
|
|
|
nativeAPI.browserAction.setBadgeText(options);
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve();
|
|
|
}
|
|
|
@@ -60,7 +60,7 @@
|
|
|
try {
|
|
|
nativeAPI.browserAction.setBadgeBackgroundColor(options, () => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve();
|
|
|
}
|
|
|
@@ -72,7 +72,7 @@
|
|
|
if (FEATURE_TESTS["browserAction.setBadgeBackgroundColor"] && FEATURE_TESTS["browserAction.setBadgeBackgroundColor"].callbackNotSupported) {
|
|
|
nativeAPI.browserAction.setBadgeBackgroundColor(options);
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve();
|
|
|
}
|
|
|
@@ -83,7 +83,7 @@
|
|
|
try {
|
|
|
nativeAPI.browserAction.setTitle(options, () => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve();
|
|
|
}
|
|
|
@@ -95,7 +95,7 @@
|
|
|
if (FEATURE_TESTS["browserAction.setTitle"] && FEATURE_TESTS["browserAction.setTitle"].callbackNotSupported) {
|
|
|
nativeAPI.browserAction.setTitle(options);
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve();
|
|
|
}
|
|
|
@@ -106,7 +106,7 @@
|
|
|
try {
|
|
|
nativeAPI.browserAction.setIcon(options, () => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve();
|
|
|
}
|
|
|
@@ -118,7 +118,7 @@
|
|
|
if (FEATURE_TESTS["browserAction.setIcon"] && FEATURE_TESTS["browserAction.setIcon"].callbackNotSupported) {
|
|
|
nativeAPI.browserAction.setIcon(options);
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve();
|
|
|
}
|
|
|
@@ -129,7 +129,7 @@
|
|
|
get: id => new Promise((resolve, reject) => {
|
|
|
nativeAPI.bookmarks.get(id, result => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve(result);
|
|
|
}
|
|
|
@@ -146,7 +146,7 @@
|
|
|
update: (id, changes) => new Promise((resolve, reject) => {
|
|
|
nativeAPI.bookmarks.update(id, changes, node => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve(node);
|
|
|
}
|
|
|
@@ -162,7 +162,7 @@
|
|
|
download: options => new Promise((resolve, reject) => {
|
|
|
nativeAPI.downloads.download(options, downloadId => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve(downloadId);
|
|
|
}
|
|
|
@@ -175,7 +175,7 @@
|
|
|
search: query => new Promise((resolve, reject) => {
|
|
|
nativeAPI.downloads.search(query, downloadItems => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve(downloadItems);
|
|
|
}
|
|
|
@@ -190,7 +190,7 @@
|
|
|
return nativeAPI.identity && nativeAPI.identity.getAuthToken && (details => new Promise((resolve, reject) =>
|
|
|
nativeAPI.identity.getAuthToken(details, token => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve(token);
|
|
|
}
|
|
|
@@ -201,7 +201,7 @@
|
|
|
return nativeAPI.identity && nativeAPI.identity.launchWebAuthFlow && (options => new Promise((resolve, reject) => {
|
|
|
nativeAPI.identity.launchWebAuthFlow(options, responseUrl => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve(responseUrl);
|
|
|
}
|
|
|
@@ -212,7 +212,7 @@
|
|
|
return nativeAPI.identity && nativeAPI.identity.removeCachedAuthToken && (details => new Promise((resolve, reject) =>
|
|
|
nativeAPI.identity.removeCachedAuthToken(details, () => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve();
|
|
|
}
|
|
|
@@ -228,7 +228,7 @@
|
|
|
update: (menuItemId, options) => new Promise((resolve, reject) => {
|
|
|
nativeAPI.contextMenus.update(menuItemId, options, () => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve();
|
|
|
}
|
|
|
@@ -237,7 +237,7 @@
|
|
|
removeAll: () => new Promise((resolve, reject) => {
|
|
|
nativeAPI.contextMenus.removeAll(() => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve();
|
|
|
}
|
|
|
@@ -248,7 +248,7 @@
|
|
|
request: permissions => new Promise((resolve, reject) => {
|
|
|
nativeAPI.permissions.request(permissions, result => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve(result);
|
|
|
}
|
|
|
@@ -297,13 +297,13 @@
|
|
|
sendMessage: message => new Promise((resolve, reject) => {
|
|
|
nativeAPI.runtime.sendMessage(message, response => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve(response);
|
|
|
}
|
|
|
});
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
}
|
|
|
}),
|
|
|
getURL: (path) => nativeAPI.runtime.getURL(path),
|
|
|
@@ -316,7 +316,7 @@
|
|
|
set: value => new Promise((resolve, reject) => {
|
|
|
nativeAPI.storage.local.set(value, () => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve();
|
|
|
}
|
|
|
@@ -325,7 +325,7 @@
|
|
|
get: () => new Promise((resolve, reject) => {
|
|
|
nativeAPI.storage.local.get(null, value => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve(value);
|
|
|
}
|
|
|
@@ -334,7 +334,7 @@
|
|
|
clear: () => new Promise((resolve, reject) => {
|
|
|
nativeAPI.storage.local.clear(() => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve();
|
|
|
}
|
|
|
@@ -343,7 +343,7 @@
|
|
|
remove: keys => new Promise((resolve, reject) => {
|
|
|
nativeAPI.storage.local.remove(keys, () => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve();
|
|
|
}
|
|
|
@@ -354,7 +354,7 @@
|
|
|
set: value => new Promise((resolve, reject) => {
|
|
|
nativeAPI.storage.sync.set(value, () => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve();
|
|
|
}
|
|
|
@@ -363,7 +363,7 @@
|
|
|
get: () => new Promise((resolve, reject) => {
|
|
|
nativeAPI.storage.sync.get(null, value => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve(value);
|
|
|
}
|
|
|
@@ -372,7 +372,7 @@
|
|
|
clear: () => new Promise((resolve, reject) => {
|
|
|
nativeAPI.storage.sync.clear(() => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve();
|
|
|
}
|
|
|
@@ -381,7 +381,7 @@
|
|
|
remove: keys => new Promise((resolve, reject) => {
|
|
|
nativeAPI.storage.sync.remove(keys, () => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve();
|
|
|
}
|
|
|
@@ -407,7 +407,7 @@
|
|
|
executeScript: (tabId, details) => new Promise((resolve, reject) => {
|
|
|
nativeAPI.tabs.executeScript(tabId, details, () => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve();
|
|
|
}
|
|
|
@@ -416,19 +416,19 @@
|
|
|
sendMessage: (tabId, message, options = {}) => new Promise((resolve, reject) => {
|
|
|
nativeAPI.tabs.sendMessage(tabId, message, options, response => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve(response);
|
|
|
}
|
|
|
});
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
}
|
|
|
}),
|
|
|
query: options => new Promise((resolve, reject) => {
|
|
|
nativeAPI.tabs.query(options, tabs => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve(tabs);
|
|
|
}
|
|
|
@@ -437,7 +437,7 @@
|
|
|
create: createProperties => new Promise((resolve, reject) => {
|
|
|
nativeAPI.tabs.create(createProperties, tab => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve(tab);
|
|
|
}
|
|
|
@@ -446,7 +446,7 @@
|
|
|
get: options => new Promise((resolve, reject) => {
|
|
|
nativeAPI.tabs.get(options, tab => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve(tab);
|
|
|
}
|
|
|
@@ -455,7 +455,7 @@
|
|
|
remove: tabId => new Promise((resolve, reject) => {
|
|
|
nativeAPI.tabs.remove(tabId, () => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve();
|
|
|
}
|
|
|
@@ -464,7 +464,7 @@
|
|
|
update: (tabId, updateProperties) => new Promise((resolve, reject) => {
|
|
|
nativeAPI.tabs.update(tabId, updateProperties, tab => {
|
|
|
if (nativeAPI.runtime.lastError) {
|
|
|
- reject(nativeAPI.runtime.lastError.message || nativeAPI.runtime.lastError);
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
|
resolve(tab);
|
|
|
}
|