Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
Merge pull request #85 from brave/context-menus-refined
Browse files Browse the repository at this point in the history
Return menuId and throws error for non support properties
  • Loading branch information
bridiver committed Nov 1, 2016
2 parents 324ea18 + e4ff678 commit 6070270
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions atom/common/api/resources/context_menus_bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ var binding = {
create: function (properties, cb) {
var responseId = createResponseId()
var menuItemId = properties.id || createMenuItemId()
if (properties.checked !== undefined) {
throw new Error('createProperties.checked of contextMenus.create is not supported yet')
}
if (properties.documentUrlPatterns !== undefined) {
throw new Error('createProperties.documentUrlPatterns of contextMenus.create is not supported yet')
}
if (properties.targetUrlPatterns !== undefined) {
throw new Error('createProperties.targetUrlPatterns of contextMenus.create is not supported yet')
}
if (properties.enabled !== undefined) {
throw new Error('createProperties.enabled of contextMenus.create is not supported yet')
}
cb && ipc.once('chrome-context-menus-create-response-' + responseId, function(evt) {
cb()
})
Expand All @@ -43,6 +55,7 @@ var binding = {
}
})
ipc.send('chrome-context-menus-create', responseId, extensionId, menuItemId, properties)
return menuItemId
}
}

Expand Down

0 comments on commit 6070270

Please sign in to comment.