Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions chrome-extension-async.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
return new Promise((resolve, reject) => {
try {
// Try to run the original function, with the trimmed args list
f(...safeArgs, (...cbArgs) => {
const ret = f(...safeArgs, (...cbArgs) => {

// If a callback was passed at the end of the original arguments
if (callback) {
Expand All @@ -50,7 +50,7 @@
resolve(cbObj);
}
else if (!cbArgs || cbArgs.length === 0)
resolve();
resolve(ret); // if there were no callback args, resolve with the function's own return value
else if (cbArgs.length === 1)
resolve(cbArgs[0]);
else
Expand Down Expand Up @@ -155,7 +155,7 @@
{ n: 'camera', props: knownInContentSetting },
{ n: 'unsandboxedPlugins', props: knownInContentSetting },
{ n: 'automaticDownloads', props: knownInContentSetting }],
contextMenus: ['update', 'remove', 'removeAll'], /* 'create' omitted intentionally, it does not follow standard asynchronous pattern */
contextMenus: ['create', 'update', 'remove', 'removeAll'],
cookies: ['get', 'getAll', 'set', 'remove', 'getAllCookieStores'],
debugger: ['attach', 'detach', 'sendCommand', 'getTargets'],
desktopCapture: ['chooseDesktopMedia'],
Expand Down