|
@@ -30,74 +30,93 @@
|
|
|
addListener: listener => nativeAPI.browserAction.onClicked.addListener(listener)
|
|
addListener: listener => nativeAPI.browserAction.onClicked.addListener(listener)
|
|
|
},
|
|
},
|
|
|
setBadgeText: options => new Promise((resolve, reject) => {
|
|
setBadgeText: options => new Promise((resolve, reject) => {
|
|
|
- if (nativeAPI.runtime.lastError) {
|
|
|
|
|
- reject(nativeAPI.runtime.lastError);
|
|
|
|
|
- } else {
|
|
|
|
|
- if (!FEATURE_TESTS["browserAction.setBadgeText"] || !FEATURE_TESTS["browserAction.setBadgeText"].callbackNotSupported) {
|
|
|
|
|
- try {
|
|
|
|
|
- nativeAPI.browserAction.setBadgeText(options, resolve);
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- FEATURE_TESTS["browserAction.setBadgeText"] = { callbackNotSupported: true };
|
|
|
|
|
- nativeAPI.browserAction.setBadgeText(options);
|
|
|
|
|
- resolve();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (!FEATURE_TESTS["browserAction.setBadgeText"] || !FEATURE_TESTS["browserAction.setBadgeText"].callbackNotSupported) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ nativeAPI.browserAction.setBadgeText(options, () => {
|
|
|
|
|
+ if (nativeAPI.runtime.lastError) {
|
|
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ resolve();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ FEATURE_TESTS["browserAction.setBadgeText"] = { callbackNotSupported: true };
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (FEATURE_TESTS["browserAction.setBadgeText"] && FEATURE_TESTS["browserAction.setBadgeText"].callbackNotSupported) {
|
|
|
|
|
+ nativeAPI.browserAction.setBadgeText(options);
|
|
|
|
|
+ if (nativeAPI.runtime.lastError) {
|
|
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
} else {
|
|
|
- nativeAPI.browserAction.setBadgeText(options);
|
|
|
|
|
resolve();
|
|
resolve();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}),
|
|
}),
|
|
|
setBadgeBackgroundColor: options => new Promise((resolve, reject) => {
|
|
setBadgeBackgroundColor: options => new Promise((resolve, reject) => {
|
|
|
- if (nativeAPI.runtime.lastError) {
|
|
|
|
|
- reject(nativeAPI.runtime.lastError);
|
|
|
|
|
- } else {
|
|
|
|
|
- if (!FEATURE_TESTS["browserAction.setBadgeBackgroundColor"] || !FEATURE_TESTS["browserAction.setBadgeBackgroundColor"].callbackNotSupported) {
|
|
|
|
|
- try {
|
|
|
|
|
- nativeAPI.browserAction.setBadgeBackgroundColor(options, resolve);
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- FEATURE_TESTS["browserAction.setBadgeBackgroundColor"] = { callbackNotSupported: true };
|
|
|
|
|
- nativeAPI.browserAction.setBadgeBackgroundColor(options);
|
|
|
|
|
- resolve();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (!FEATURE_TESTS["browserAction.setBadgeBackgroundColor"] || !FEATURE_TESTS["browserAction.setBadgeBackgroundColor"].callbackNotSupported) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ nativeAPI.browserAction.setBadgeBackgroundColor(options, () => {
|
|
|
|
|
+ if (nativeAPI.runtime.lastError) {
|
|
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ resolve();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ FEATURE_TESTS["browserAction.setBadgeBackgroundColor"] = { callbackNotSupported: true };
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (FEATURE_TESTS["browserAction.setBadgeBackgroundColor"] && FEATURE_TESTS["browserAction.setBadgeBackgroundColor"].callbackNotSupported) {
|
|
|
|
|
+ nativeAPI.browserAction.setBadgeBackgroundColor(options);
|
|
|
|
|
+ if (nativeAPI.runtime.lastError) {
|
|
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
} else {
|
|
|
- nativeAPI.browserAction.setBadgeBackgroundColor(options);
|
|
|
|
|
resolve();
|
|
resolve();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}),
|
|
}),
|
|
|
setTitle: options => new Promise((resolve, reject) => {
|
|
setTitle: options => new Promise((resolve, reject) => {
|
|
|
- if (nativeAPI.runtime.lastError) {
|
|
|
|
|
- reject(nativeAPI.runtime.lastError);
|
|
|
|
|
- } else {
|
|
|
|
|
- if (!FEATURE_TESTS["browserAction.setTitle"] || !FEATURE_TESTS["browserAction.setTitle"].callbackNotSupported) {
|
|
|
|
|
- try {
|
|
|
|
|
- nativeAPI.browserAction.setTitle(options, resolve);
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- FEATURE_TESTS["browserAction.setTitle"] = { callbackNotSupported: true };
|
|
|
|
|
- nativeAPI.browserAction.setTitle(options);
|
|
|
|
|
- resolve();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (!FEATURE_TESTS["browserAction.setTitle"] || !FEATURE_TESTS["browserAction.setTitle"].callbackNotSupported) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ nativeAPI.browserAction.setTitle(options, () => {
|
|
|
|
|
+ if (nativeAPI.runtime.lastError) {
|
|
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ resolve();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ FEATURE_TESTS["browserAction.setTitle"] = { callbackNotSupported: true };
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (FEATURE_TESTS["browserAction.setTitle"] && FEATURE_TESTS["browserAction.setTitle"].callbackNotSupported) {
|
|
|
|
|
+ nativeAPI.browserAction.setTitle(options);
|
|
|
|
|
+ if (nativeAPI.runtime.lastError) {
|
|
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
} else {
|
|
|
- nativeAPI.browserAction.setTitle(options);
|
|
|
|
|
resolve();
|
|
resolve();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
}),
|
|
}),
|
|
|
setIcon: options => new Promise((resolve, reject) => {
|
|
setIcon: options => new Promise((resolve, reject) => {
|
|
|
- if (nativeAPI.runtime.lastError) {
|
|
|
|
|
- reject(nativeAPI.runtime.lastError);
|
|
|
|
|
- } else {
|
|
|
|
|
- if (!FEATURE_TESTS["browserAction.setIcon"] || !FEATURE_TESTS["browserAction.setIcon"].callbackNotSupported) {
|
|
|
|
|
- try {
|
|
|
|
|
- nativeAPI.browserAction.setIcon(options, resolve);
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- FEATURE_TESTS["browserAction.setIcon"] = { callbackNotSupported: true };
|
|
|
|
|
- nativeAPI.browserAction.setIcon(options);
|
|
|
|
|
- resolve();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (!FEATURE_TESTS["browserAction.setIcon"] || !FEATURE_TESTS["browserAction.setIcon"].callbackNotSupported) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ nativeAPI.browserAction.setIcon(options, () => {
|
|
|
|
|
+ if (nativeAPI.runtime.lastError) {
|
|
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ resolve();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ FEATURE_TESTS["browserAction.setIcon"] = { callbackNotSupported: true };
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (FEATURE_TESTS["browserAction.setIcon"] && FEATURE_TESTS["browserAction.setIcon"].callbackNotSupported) {
|
|
|
|
|
+ nativeAPI.browserAction.setIcon(options);
|
|
|
|
|
+ if (nativeAPI.runtime.lastError) {
|
|
|
|
|
+ reject(nativeAPI.runtime.lastError);
|
|
|
} else {
|
|
} else {
|
|
|
- nativeAPI.browserAction.setIcon(options);
|
|
|
|
|
resolve();
|
|
resolve();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|