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

Commit

Permalink
Return menuId and throws error for non support properties
Browse files Browse the repository at this point in the history
Auditors: @bridiver, @bbondy
  • Loading branch information
darkdh committed Oct 31, 2016
1 parent 324ea18 commit e4ff678
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 e4ff678

Please sign in to comment.